main funcions fixes
This commit is contained in:
21
desktop-operator/node_modules/@electron/rebuild/LICENSE
generated
vendored
Normal file
21
desktop-operator/node_modules/@electron/rebuild/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Contributors to the Electron project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
166
desktop-operator/node_modules/@electron/rebuild/README.md
generated
vendored
Normal file
166
desktop-operator/node_modules/@electron/rebuild/README.md
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
## Electron Rebuild
|
||||
|
||||
[](https://circleci.com/gh/electron/rebuild)
|
||||
[](https://npm.im/@electron/rebuild)
|
||||
[](https://codecov.io/gh/electron/rebuild)
|
||||
|
||||
This executable rebuilds native Node.js modules against the version of Node.js
|
||||
that your Electron project is using. This allows you to use native Node.js
|
||||
modules in Electron apps without your system version of Node.js matching exactly
|
||||
(which is often not the case, and sometimes not even possible).
|
||||
|
||||
### How does it work?
|
||||
|
||||
Install the package with `--save-dev`:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @electron/rebuild
|
||||
```
|
||||
|
||||
Then, whenever you install a new npm package, rerun electron-rebuild:
|
||||
|
||||
```sh
|
||||
$(npm bin)/electron-rebuild
|
||||
```
|
||||
|
||||
Or if you're on Windows:
|
||||
|
||||
```sh
|
||||
.\node_modules\.bin\electron-rebuild.cmd
|
||||
```
|
||||
If you have a good node-gyp config but you see an error about a missing element on Windows like `Could not load the Visual C++ component "VCBuild.exe"`, try to launch electron-rebuild in an npm script:
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"rebuild": "electron-rebuild -f -w yourmodule"
|
||||
}
|
||||
```
|
||||
|
||||
and then
|
||||
|
||||
```sh
|
||||
npm run rebuild
|
||||
```
|
||||
|
||||
### What are the requirements?
|
||||
|
||||
Node v12.13.0 or higher is required. Building native modules from source uses
|
||||
[`node-gyp`](https://github.com/nodejs/node-gyp#installation), refer to the link for its
|
||||
installation/runtime requirements.
|
||||
|
||||
### CLI Arguments
|
||||
|
||||
```
|
||||
Usage: electron-rebuild --version [version] --module-dir [path]
|
||||
|
||||
Options:
|
||||
-v, --version The version of Electron to build against [string]
|
||||
-f, --force Force rebuilding modules, even if we would skip
|
||||
it otherwise [boolean]
|
||||
-a, --arch Override the target architecture to something
|
||||
other than your system's [string]
|
||||
-m, --module-dir The path to the node_modules directory to rebuild
|
||||
[string]
|
||||
-w, --which-module A specific module to build, or comma separated
|
||||
list of modules. Modules will only be rebuilt if
|
||||
they also match the types of dependencies being
|
||||
rebuilt (see --types). [string]
|
||||
-o, --only Only build specified module, or comma separated
|
||||
list of modules. All others are ignored. [string]
|
||||
-e, --electron-prebuilt-dir The path to the prebuilt electron module [string]
|
||||
-d, --dist-url Custom header tarball URL [string]
|
||||
-t, --types The types of dependencies to rebuild. Comma
|
||||
separated list of "prod", "dev" and "optional".
|
||||
Default is "prod,optional" [string]
|
||||
-p, --parallel Rebuild in parallel, this is enabled by default
|
||||
on macOS and Linux [boolean]
|
||||
-s, --sequential Rebuild modules sequentially, this is enabled by
|
||||
default on Windows [boolean]
|
||||
-b, --debug Build debug version of modules [boolean]
|
||||
--prebuild-tag-prefix GitHub tag prefix passed to prebuild-install.
|
||||
Default is "v" [string]
|
||||
--force-abi Override the ABI version for the version of
|
||||
Electron you are targeting. Only use when
|
||||
targeting Nightly releases. [number]
|
||||
--use-electron-clang Use the clang executable that Electron used when
|
||||
building its binary. This will guarantee compiler
|
||||
compatibility [boolean]
|
||||
--disable-pre-gyp-copy Disables the pre-gyp copy step [boolean]
|
||||
--build-from-source Skips prebuild download and rebuilds module from
|
||||
source. [boolean]
|
||||
-h, --help Show help [boolean]
|
||||
```
|
||||
|
||||
### How can I use this with [Electron Forge](https://github.com/electron/forge)?
|
||||
|
||||
This package is automatically used with Electron Forge when packaging an Electron app.
|
||||
|
||||
### How can I integrate this into [Electron Packager](https://github.com/electron/packager)?
|
||||
|
||||
electron-rebuild provides a function compatible with the [`afterCopy` hook](https://electron.github.io/packager/main/interfaces/electronpackager.options.html#aftercopy)
|
||||
for Electron Packager. For example:
|
||||
|
||||
```javascript
|
||||
import packager from '@electron/packager';
|
||||
import rebuild from '@electron/rebuild';
|
||||
|
||||
packager({
|
||||
// … other options
|
||||
afterCopy: [(buildPath, electronVersion, platform, arch, callback) => {
|
||||
rebuild({ buildPath, electronVersion, arch })
|
||||
.then(() => callback())
|
||||
.catch((error) => callback(error));
|
||||
}],
|
||||
// … other options
|
||||
});
|
||||
```
|
||||
|
||||
### How can I integrate this with [prebuild](https://github.com/prebuild/prebuild)?
|
||||
|
||||
If your module uses [prebuild](https://github.com/prebuild/prebuild) for creating prebuilt binaries,
|
||||
it also uses [prebuild-install](https://github.com/prebuild/prebuild-install) to download them. If
|
||||
this is the case, then `electron-rebuild` will run `prebuild-install` to download the correct
|
||||
binaries from the project's GitHub Releases instead of rebuilding them.
|
||||
|
||||
### How can I integrate this into Grunt / Gulp / Whatever?
|
||||
|
||||
electron-rebuild is also a library that you can require into your app or
|
||||
build process. It has a very simple API:
|
||||
|
||||
```javascript
|
||||
import rebuild from '@electron/rebuild';
|
||||
|
||||
// Public: Rebuilds a node_modules directory with the given Electron version.
|
||||
//
|
||||
// options: Object with the following properties
|
||||
// buildPath - An absolute path to your app's directory. (The directory that contains your node_modules)
|
||||
// electronVersion - The version of Electron to rebuild for
|
||||
// arch (optional) - Default: process.arch - The arch to rebuild for
|
||||
// extraModules (optional) - Default: [] - An array of modules to rebuild as well as the detected modules
|
||||
// onlyModules (optional) - Default: null - An array of modules to rebuild, ONLY these module names will be rebuilt.
|
||||
// The "types" property will be ignored if this option is set.
|
||||
// force (optional) - Default: false - Force a rebuild of modules regardless of their current build state
|
||||
// headerURL (optional) - Default: https://www.electronjs.org/headers - The URL to download Electron header files from
|
||||
// types (optional) - Default: ['prod', 'optional'] - The types of modules to rebuild
|
||||
// mode (optional) - The rebuild mode, either 'sequential' or 'parallel' - Default varies per platform (probably shouldn't mess with this one)
|
||||
// useElectronClang (optional) - Whether to use the clang executable that Electron used when building its binary. This will guarantee compiler compatibility
|
||||
|
||||
// Returns a Promise indicating whether the operation succeeded or not
|
||||
```
|
||||
|
||||
A full build process might look something like:
|
||||
|
||||
```javascript
|
||||
const childProcess = require('child_process');
|
||||
const pathToElectron = require('electron');
|
||||
|
||||
rebuild({
|
||||
buildPath: __dirname,
|
||||
electronVersion: '1.4.12'
|
||||
})
|
||||
.then(() => console.info('Rebuild Successful'))
|
||||
.catch((e) => {
|
||||
console.error("Building modules didn't work!");
|
||||
console.error(e);
|
||||
});
|
||||
```
|
||||
16
desktop-operator/node_modules/@electron/rebuild/lib/arch.d.ts
generated
vendored
Normal file
16
desktop-operator/node_modules/@electron/rebuild/lib/arch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
export declare function uname(): string;
|
||||
export declare type ConfigVariables = {
|
||||
arm_version?: string;
|
||||
};
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
export declare function getNodeArch(arch: string, configVariables: ConfigVariables): string;
|
||||
36
desktop-operator/node_modules/@electron/rebuild/lib/arch.js
generated
vendored
Normal file
36
desktop-operator/node_modules/@electron/rebuild/lib/arch.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getNodeArch = exports.uname = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
function uname() {
|
||||
return (0, child_process_1.execSync)('uname -m')
|
||||
.toString()
|
||||
.trim();
|
||||
}
|
||||
exports.uname = uname;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
function getNodeArch(arch, configVariables) {
|
||||
if (arch === 'arm') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
switch (configVariables.arm_version) {
|
||||
case '6':
|
||||
return uname();
|
||||
case '7':
|
||||
default:
|
||||
return 'armv7l';
|
||||
}
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
exports.getNodeArch = getNodeArch;
|
||||
//# sourceMappingURL=arch.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/arch.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/arch.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"arch.js","sourceRoot":"","sources":["../src/arch.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAEzC;;;;GAIG;AACH,SAAgB,KAAK;IACnB,OAAO,IAAA,wBAAQ,EAAC,UAAU,CAAC;SACxB,QAAQ,EAAE;SACV,IAAI,EAAE,CAAC;AACZ,CAAC;AAJD,sBAIC;AAMD;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAY,EAAE,eAAgC;IACxE,IAAI,IAAI,KAAK,KAAK,EAAE;QAClB,8DAA8D;QAC9D,QAAQ,eAAe,CAAC,WAAW,EAAE;YACnC,KAAK,GAAG;gBACN,OAAO,KAAK,EAAE,CAAC;YACjB,KAAK,GAAG,CAAC;YACT;gBACE,OAAO,QAAQ,CAAC;SACnB;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,kCAaC"}
|
||||
14
desktop-operator/node_modules/@electron/rebuild/lib/cache.d.ts
generated
vendored
Normal file
14
desktop-operator/node_modules/@electron/rebuild/lib/cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
declare type CacheOptions = {
|
||||
ABI: string;
|
||||
arch: string;
|
||||
platform: string;
|
||||
debug: boolean;
|
||||
electronVersion: string;
|
||||
headerURL: string;
|
||||
modulePath: string;
|
||||
};
|
||||
export declare const cacheModuleState: (dir: string, cachePath: string, key: string) => Promise<void>;
|
||||
declare type ApplyDiffFunction = (dir: string) => Promise<void>;
|
||||
export declare const lookupModuleState: (cachePath: string, key: string) => Promise<ApplyDiffFunction | boolean>;
|
||||
export declare function generateCacheKey(opts: CacheOptions): Promise<string>;
|
||||
export {};
|
||||
154
desktop-operator/node_modules/@electron/rebuild/lib/cache.js
generated
vendored
Normal file
154
desktop-operator/node_modules/@electron/rebuild/lib/cache.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateCacheKey = exports.lookupModuleState = exports.cacheModuleState = void 0;
|
||||
const crypto_1 = __importDefault(require("crypto"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const zlib_1 = __importDefault(require("zlib"));
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
// Update this number if you change the caching logic to ensure no bad cache hits
|
||||
const ELECTRON_REBUILD_CACHE_ID = 1;
|
||||
class Snap {
|
||||
constructor(hash, data) {
|
||||
this.hash = hash;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
const takeSnapshot = async (dir, relativeTo = dir) => {
|
||||
const snap = {};
|
||||
await Promise.all((await fs_extra_1.default.readdir(dir)).map(async (child) => {
|
||||
if (child === 'node_modules')
|
||||
return;
|
||||
const childPath = path_1.default.resolve(dir, child);
|
||||
const relative = path_1.default.relative(relativeTo, childPath);
|
||||
if ((await fs_extra_1.default.stat(childPath)).isDirectory()) {
|
||||
snap[relative] = await takeSnapshot(childPath, relativeTo);
|
||||
}
|
||||
else {
|
||||
const data = await fs_extra_1.default.readFile(childPath);
|
||||
snap[relative] = new Snap(crypto_1.default.createHash('SHA256').update(data).digest('hex'), data);
|
||||
}
|
||||
}));
|
||||
return snap;
|
||||
};
|
||||
const writeSnapshot = async (diff, dir) => {
|
||||
for (const key in diff) {
|
||||
if (diff[key] instanceof Snap) {
|
||||
await fs_extra_1.default.mkdirp(path_1.default.dirname(path_1.default.resolve(dir, key)));
|
||||
await fs_extra_1.default.writeFile(path_1.default.resolve(dir, key), diff[key].data);
|
||||
}
|
||||
else {
|
||||
await fs_extra_1.default.mkdirp(path_1.default.resolve(dir, key));
|
||||
await writeSnapshot(diff[key], dir);
|
||||
}
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const serialize = (snap) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const jsonReady = {};
|
||||
for (const key in snap) {
|
||||
if (snap[key] instanceof Snap) {
|
||||
const s = snap[key];
|
||||
jsonReady[key] = {
|
||||
__isSnap: true,
|
||||
hash: s.hash,
|
||||
data: s.data.toString('base64')
|
||||
};
|
||||
}
|
||||
else {
|
||||
jsonReady[key] = serialize(snap[key]);
|
||||
}
|
||||
}
|
||||
return jsonReady;
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const unserialize = (jsonReady) => {
|
||||
const snap = {};
|
||||
for (const key in jsonReady) {
|
||||
if (jsonReady[key].__isSnap) {
|
||||
snap[key] = new Snap(jsonReady[key].hash, Buffer.from(jsonReady[key].data, 'base64'));
|
||||
}
|
||||
else {
|
||||
snap[key] = unserialize(jsonReady[key]);
|
||||
}
|
||||
}
|
||||
return snap;
|
||||
};
|
||||
const cacheModuleState = async (dir, cachePath, key) => {
|
||||
const snap = await takeSnapshot(dir);
|
||||
const moduleBuffer = Buffer.from(JSON.stringify(serialize(snap)));
|
||||
const zipped = await new Promise(resolve => zlib_1.default.gzip(moduleBuffer, (_, result) => resolve(result)));
|
||||
await fs_extra_1.default.mkdirp(cachePath);
|
||||
await fs_extra_1.default.writeFile(path_1.default.resolve(cachePath, key), zipped);
|
||||
};
|
||||
exports.cacheModuleState = cacheModuleState;
|
||||
const lookupModuleState = async (cachePath, key) => {
|
||||
if (await fs_extra_1.default.pathExists(path_1.default.resolve(cachePath, key))) {
|
||||
return async function applyDiff(dir) {
|
||||
const zipped = await fs_extra_1.default.readFile(path_1.default.resolve(cachePath, key));
|
||||
const unzipped = await new Promise(resolve => { zlib_1.default.gunzip(zipped, (_, result) => resolve(result)); });
|
||||
const diff = unserialize(JSON.parse(unzipped.toString()));
|
||||
await writeSnapshot(diff, dir);
|
||||
};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.lookupModuleState = lookupModuleState;
|
||||
function dHashTree(tree, hash) {
|
||||
for (const key of Object.keys(tree).sort()) {
|
||||
hash.update(key);
|
||||
if (typeof tree[key] === 'string') {
|
||||
hash.update(tree[key]);
|
||||
}
|
||||
else {
|
||||
dHashTree(tree[key], hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
async function hashDirectory(dir, relativeTo) {
|
||||
relativeTo !== null && relativeTo !== void 0 ? relativeTo : (relativeTo = dir);
|
||||
d('hashing dir', dir);
|
||||
const dirTree = {};
|
||||
await Promise.all((await fs_extra_1.default.readdir(dir)).map(async (child) => {
|
||||
d('found child', child, 'in dir', dir);
|
||||
// Ignore output directories
|
||||
if (dir === relativeTo && (child === 'build' || child === 'bin'))
|
||||
return;
|
||||
// Don't hash nested node_modules
|
||||
if (child === 'node_modules')
|
||||
return;
|
||||
const childPath = path_1.default.resolve(dir, child);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const relative = path_1.default.relative(relativeTo, childPath);
|
||||
if ((await fs_extra_1.default.stat(childPath)).isDirectory()) {
|
||||
dirTree[relative] = await hashDirectory(childPath, relativeTo);
|
||||
}
|
||||
else {
|
||||
dirTree[relative] = crypto_1.default.createHash('SHA256').update(await fs_extra_1.default.readFile(childPath)).digest('hex');
|
||||
}
|
||||
}));
|
||||
return dirTree;
|
||||
}
|
||||
async function generateCacheKey(opts) {
|
||||
const tree = await hashDirectory(opts.modulePath);
|
||||
const hasher = crypto_1.default.createHash('SHA256')
|
||||
.update(`${ELECTRON_REBUILD_CACHE_ID}`)
|
||||
.update(path_1.default.basename(opts.modulePath))
|
||||
.update(opts.ABI)
|
||||
.update(opts.arch)
|
||||
.update(opts.platform)
|
||||
.update(opts.debug ? 'debug' : 'not debug')
|
||||
.update(opts.headerURL)
|
||||
.update(opts.electronVersion);
|
||||
dHashTree(tree, hasher);
|
||||
const hash = hasher.digest('hex');
|
||||
d('calculated hash of', opts.modulePath, 'to be', hash);
|
||||
return hash;
|
||||
}
|
||||
exports.generateCacheKey = generateCacheKey;
|
||||
//# sourceMappingURL=cache.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/cache.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.d.ts
generated
vendored
Normal file
4
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare function getClangEnvironmentVars(electronVersion: string, targetArch: string): Promise<{
|
||||
env: Record<string, string>;
|
||||
args: string[];
|
||||
}>;
|
||||
142
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.js
generated
vendored
Normal file
142
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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.getClangEnvironmentVars = void 0;
|
||||
const cp = __importStar(require("child_process"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
const tar = __importStar(require("tar"));
|
||||
const zlib = __importStar(require("zlib"));
|
||||
const constants_1 = require("./constants");
|
||||
const fetcher_1 = require("./fetcher");
|
||||
const sysroot_fetcher_1 = require("./sysroot-fetcher");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
const CDS_URL = 'https://commondatastorage.googleapis.com/chromium-browser-clang';
|
||||
function getPlatformUrlPrefix(hostOS, hostArch) {
|
||||
const prefixMap = {
|
||||
'linux': 'Linux_x64',
|
||||
'darwin': 'Mac',
|
||||
'win32': 'Win',
|
||||
};
|
||||
let prefix = prefixMap[hostOS];
|
||||
if (prefix === 'Mac' && hostArch === 'arm64') {
|
||||
prefix = 'Mac_arm64';
|
||||
}
|
||||
return CDS_URL + '/' + prefix + '/';
|
||||
}
|
||||
function getClangDownloadURL(packageFile, packageVersion, hostOS, hostArch) {
|
||||
const cdsFile = `${packageFile}-${packageVersion}.tgz`;
|
||||
return getPlatformUrlPrefix(hostOS, hostArch) + cdsFile;
|
||||
}
|
||||
function getSDKRoot() {
|
||||
if (process.env.SDKROOT)
|
||||
return process.env.SDKROOT;
|
||||
const output = cp.execFileSync('xcrun', ['--sdk', 'macosx', '--show-sdk-path']);
|
||||
return output.toString().trim();
|
||||
}
|
||||
async function getClangEnvironmentVars(electronVersion, targetArch) {
|
||||
const clangDownloadDir = await downloadClangVersion(electronVersion);
|
||||
const clangDir = path.resolve(clangDownloadDir, 'bin');
|
||||
const clangArgs = [];
|
||||
if (process.platform === 'darwin') {
|
||||
clangArgs.push('-isysroot', getSDKRoot());
|
||||
}
|
||||
const gypArgs = [];
|
||||
if (process.platform === 'win32') {
|
||||
console.log(fs.readdirSync(clangDir));
|
||||
gypArgs.push(`/p:CLToolExe=clang-cl.exe`, `/p:CLToolPath=${clangDir}`);
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
const sysrootPath = await (0, sysroot_fetcher_1.downloadLinuxSysroot)(electronVersion, targetArch);
|
||||
clangArgs.push('--sysroot', sysrootPath);
|
||||
}
|
||||
return {
|
||||
env: {
|
||||
CC: `"${path.resolve(clangDir, 'clang')}" ${clangArgs.join(' ')}`,
|
||||
CXX: `"${path.resolve(clangDir, 'clang++')}" ${clangArgs.join(' ')}`,
|
||||
},
|
||||
args: gypArgs,
|
||||
};
|
||||
}
|
||||
exports.getClangEnvironmentVars = getClangEnvironmentVars;
|
||||
function clangVersionFromRevision(update) {
|
||||
const regex = /CLANG_REVISION = '([^']+)'\nCLANG_SUB_REVISION = (\d+)\n/g;
|
||||
const clangVersionMatch = regex.exec(update);
|
||||
if (!clangVersionMatch)
|
||||
return null;
|
||||
const [, clangVersion, clangSubRevision] = clangVersionMatch;
|
||||
return `${clangVersion}-${clangSubRevision}`;
|
||||
}
|
||||
function clangVersionFromSVN(update) {
|
||||
const regex = /CLANG_REVISION = '([^']+)'\nCLANG_SVN_REVISION = '([^']+)'\nCLANG_SUB_REVISION = (\d+)\n/g;
|
||||
const clangVersionMatch = regex.exec(update);
|
||||
if (!clangVersionMatch)
|
||||
return null;
|
||||
const [, clangVersion, clangSvn, clangSubRevision] = clangVersionMatch;
|
||||
return `${clangSvn}-${clangVersion.substr(0, 8)}-${clangSubRevision}`;
|
||||
}
|
||||
async function downloadClangVersion(electronVersion) {
|
||||
d('fetching clang for Electron:', electronVersion);
|
||||
const clangDirPath = path.resolve(constants_1.ELECTRON_GYP_DIR, `${electronVersion}-clang`);
|
||||
if (await fs.pathExists(path.resolve(clangDirPath, 'bin', 'clang')))
|
||||
return clangDirPath;
|
||||
if (!await fs.pathExists(constants_1.ELECTRON_GYP_DIR))
|
||||
await fs.mkdirp(constants_1.ELECTRON_GYP_DIR);
|
||||
const electronDeps = await (0, fetcher_1.fetch)(`https://raw.githubusercontent.com/electron/electron/v${electronVersion}/DEPS`, 'text');
|
||||
const chromiumRevisionExtractor = /'chromium_version':\n\s+'([^']+)/g;
|
||||
const chromiumRevisionMatch = chromiumRevisionExtractor.exec(electronDeps);
|
||||
if (!chromiumRevisionMatch)
|
||||
throw new Error('Failed to determine Chromium revision for given Electron version');
|
||||
const chromiumRevision = chromiumRevisionMatch[1];
|
||||
d('fetching clang for Chromium:', chromiumRevision);
|
||||
const base64ClangUpdate = await (0, fetcher_1.fetch)(`https://chromium.googlesource.com/chromium/src.git/+/${chromiumRevision}/tools/clang/scripts/update.py?format=TEXT`, 'text');
|
||||
const clangUpdate = Buffer.from(base64ClangUpdate, 'base64').toString('utf8');
|
||||
const clangVersionString = clangVersionFromRevision(clangUpdate) || clangVersionFromSVN(clangUpdate);
|
||||
if (!clangVersionString)
|
||||
throw new Error('Failed to determine Clang revision from Electron version');
|
||||
d('fetching clang:', clangVersionString);
|
||||
const clangDownloadURL = getClangDownloadURL('clang', clangVersionString, process.platform, process.arch);
|
||||
const contents = await (0, fetcher_1.fetch)(clangDownloadURL, 'buffer');
|
||||
d('deflating clang');
|
||||
zlib.deflateSync(contents);
|
||||
const tarPath = path.resolve(constants_1.ELECTRON_GYP_DIR, `${electronVersion}-clang.tar`);
|
||||
if (await fs.pathExists(tarPath))
|
||||
await fs.remove(tarPath);
|
||||
await fs.writeFile(tarPath, Buffer.from(contents));
|
||||
await fs.mkdirp(clangDirPath);
|
||||
d('tar running on clang');
|
||||
await tar.x({
|
||||
file: tarPath,
|
||||
cwd: clangDirPath,
|
||||
});
|
||||
await fs.remove(tarPath);
|
||||
d('cleaning up clang tar file');
|
||||
return clangDirPath;
|
||||
}
|
||||
//# sourceMappingURL=clang-fetcher.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/clang-fetcher.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"clang-fetcher.js","sourceRoot":"","sources":["../src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,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC9B,CAAC,CAAC,sBAAsB,CAAC,CAAC;IAC1B,MAAM,GAAG,CAAC,CAAC,CAAC;QACV,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,YAAY;KAClB,CAAC,CAAC;IACH,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC,4BAA4B,CAAC,CAAC;IAChC,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
||||
2
desktop-operator/node_modules/@electron/rebuild/lib/cli.d.ts
generated
vendored
Normal file
2
desktop-operator/node_modules/@electron/rebuild/lib/cli.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
export {};
|
||||
170
desktop-operator/node_modules/@electron/rebuild/lib/cli.js
generated
vendored
Executable file
170
desktop-operator/node_modules/@electron/rebuild/lib/cli.js
generated
vendored
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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 });
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
const ora = require("ora");
|
||||
const yargs_1 = __importDefault(require("yargs/yargs"));
|
||||
const search_module_1 = require("./search-module");
|
||||
const electron_locator_1 = require("./electron-locator");
|
||||
const rebuild_1 = require("./rebuild");
|
||||
const argv = (0, yargs_1.default)(process.argv.slice(2)).version(false).options({
|
||||
version: { alias: 'v', type: 'string', description: 'The version of Electron to build against' },
|
||||
force: { alias: 'f', type: 'boolean', description: 'Force rebuilding modules, even if we would skip it otherwise' },
|
||||
arch: { alias: 'a', type: 'string', description: "Override the target architecture to something other than your system's" },
|
||||
'module-dir': { alias: 'm', type: 'string', description: 'The path to the node_modules directory to rebuild' },
|
||||
// TODO: should be type: array
|
||||
'which-module': { alias: 'w', type: 'string', description: 'A specific module to build, or comma separated list of modules. Modules will only be rebuilt if they also match the types of dependencies being rebuilt (see --types).' },
|
||||
// TODO: should be type: array
|
||||
only: { alias: 'o', type: 'string', description: 'Only build specified module, or comma separated list of modules. All others are ignored.' },
|
||||
'electron-prebuilt-dir': { alias: 'e', type: 'string', description: 'The path to the prebuilt electron module' },
|
||||
'dist-url': { alias: 'd', type: 'string', description: 'Custom header tarball URL' },
|
||||
// TODO: should be type: array
|
||||
types: { alias: 't', type: 'string', description: 'The types of dependencies to rebuild. Comma separated list of "prod", "dev" and "optional". Default is "prod,optional"' },
|
||||
parallel: { alias: 'p', type: 'boolean', description: 'Rebuild in parallel, this is enabled by default on macOS and Linux' },
|
||||
sequential: { alias: 's', type: 'boolean', description: 'Rebuild modules sequentially, this is enabled by default on Windows' },
|
||||
debug: { alias: 'b', type: 'boolean', description: 'Build debug version of modules' },
|
||||
'prebuild-tag-prefix': { type: 'string', description: 'GitHub tag prefix passed to prebuild-install. Default is "v"' },
|
||||
'force-abi': { type: 'number', description: 'Override the ABI version for the version of Electron you are targeting. Only use when targeting Nightly releases.' },
|
||||
'use-electron-clang': { type: 'boolean', description: 'Use the clang executable that Electron used when building its binary. This will guarantee compiler compatibility' },
|
||||
'disable-pre-gyp-copy': { type: 'boolean', description: 'Disables the pre-gyp copy step' },
|
||||
'build-from-source': { type: 'boolean', description: 'Skips prebuild download and rebuilds module from source.' },
|
||||
}).usage('Usage: $0 --version [version] --module-dir [path]')
|
||||
.help()
|
||||
.alias('help', 'h')
|
||||
.epilog('Copyright 2016-2021')
|
||||
.parseSync();
|
||||
if (process.argv.length === 3 && process.argv[2] === '--version') {
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
try {
|
||||
console.log('Electron Rebuild Version:', require(path.resolve(__dirname, '../../package.json')).version);
|
||||
}
|
||||
catch (err) {
|
||||
console.log('Electron Rebuild Version:', require(path.resolve(__dirname, '../package.json')).version);
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/no-var-requires */
|
||||
process.exit(0);
|
||||
}
|
||||
const handler = (err) => {
|
||||
console.error(chalk_1.default.red('\nAn unhandled error occurred inside electron-rebuild'));
|
||||
console.error(chalk_1.default.red(`${err.message}\n\n${err.stack}`));
|
||||
process.exit(-1);
|
||||
};
|
||||
process.on('uncaughtException', handler);
|
||||
process.on('unhandledRejection', handler);
|
||||
(async () => {
|
||||
const projectRootPath = await (0, search_module_1.getProjectRootPath)(process.cwd());
|
||||
const electronModulePath = argv.e ? path.resolve(process.cwd(), argv.e) : await (0, electron_locator_1.locateElectronModule)(projectRootPath);
|
||||
let electronModuleVersion = argv.v;
|
||||
if (!electronModuleVersion) {
|
||||
try {
|
||||
if (!electronModulePath)
|
||||
throw new Error('Prebuilt electron module not found');
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const pkgJson = require(path.join(electronModulePath, 'package.json'));
|
||||
electronModuleVersion = pkgJson.version;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unable to find electron's version number, either install it or specify an explicit version`);
|
||||
}
|
||||
}
|
||||
let rootDirectory = argv.m;
|
||||
if (!rootDirectory) {
|
||||
// NB: We assume here that we're going to rebuild the immediate parent's
|
||||
// node modules, which might not always be the case but it's at least a
|
||||
// good guess
|
||||
rootDirectory = path.resolve(__dirname, '../../..');
|
||||
if (!await fs.pathExists(rootDirectory) || !await fs.pathExists(path.resolve(rootDirectory, 'package.json'))) {
|
||||
// Then we try the CWD
|
||||
rootDirectory = process.cwd();
|
||||
if (!await fs.pathExists(rootDirectory) || !await fs.pathExists(path.resolve(rootDirectory, 'package.json'))) {
|
||||
throw new Error('Unable to find parent node_modules directory, specify it via --module-dir, E.g. "--module-dir ." for the current directory');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
rootDirectory = path.resolve(process.cwd(), rootDirectory);
|
||||
}
|
||||
if (argv.forceAbi && typeof argv.forceAbi !== 'number') {
|
||||
throw new Error('force-abi must be a number');
|
||||
}
|
||||
let modulesDone = 0;
|
||||
let moduleTotal = 0;
|
||||
const rebuildSpinner = ora('Searching dependency tree').start();
|
||||
let lastModuleName;
|
||||
const redraw = (moduleName) => {
|
||||
if (moduleName)
|
||||
lastModuleName = moduleName;
|
||||
if (argv.p) {
|
||||
rebuildSpinner.text = `Building modules: ${modulesDone}/${moduleTotal}`;
|
||||
}
|
||||
else {
|
||||
rebuildSpinner.text = `Building module: ${lastModuleName}, Completed: ${modulesDone}`;
|
||||
}
|
||||
};
|
||||
const rebuilder = (0, rebuild_1.rebuild)({
|
||||
buildPath: rootDirectory,
|
||||
electronVersion: electronModuleVersion,
|
||||
arch: argv.a || process.arch,
|
||||
extraModules: argv.w ? argv.w.split(',') : [],
|
||||
onlyModules: argv.o ? argv.o.split(',') : null,
|
||||
force: argv.f,
|
||||
headerURL: argv.d,
|
||||
types: argv.t ? argv.t.split(',') : ['prod', 'optional'],
|
||||
mode: argv.p ? 'parallel' : (argv.s ? 'sequential' : undefined),
|
||||
debug: argv.debug,
|
||||
prebuildTagPrefix: argv.prebuildTagPrefix || 'v',
|
||||
forceABI: argv.forceAbi,
|
||||
useElectronClang: !!argv.useElectronClang,
|
||||
disablePreGypCopy: !!argv.disablePreGypCopy,
|
||||
projectRootPath,
|
||||
buildFromSource: !!argv.buildFromSource,
|
||||
});
|
||||
const lifecycle = rebuilder.lifecycle;
|
||||
lifecycle.on('module-found', (moduleName) => {
|
||||
moduleTotal += 1;
|
||||
redraw(moduleName);
|
||||
});
|
||||
lifecycle.on('module-done', () => {
|
||||
modulesDone += 1;
|
||||
redraw();
|
||||
});
|
||||
try {
|
||||
await rebuilder;
|
||||
}
|
||||
catch (err) {
|
||||
rebuildSpinner.text = 'Rebuild Failed';
|
||||
rebuildSpinner.fail();
|
||||
throw err;
|
||||
}
|
||||
rebuildSpinner.text = 'Rebuild Complete';
|
||||
rebuildSpinner.succeed();
|
||||
})();
|
||||
//# sourceMappingURL=cli.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/cli.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/cli.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
desktop-operator/node_modules/@electron/rebuild/lib/constants.d.ts
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const ELECTRON_GYP_DIR: string;
|
||||
30
desktop-operator/node_modules/@electron/rebuild/lib/constants.js
generated
vendored
Normal file
30
desktop-operator/node_modules/@electron/rebuild/lib/constants.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ELECTRON_GYP_DIR = void 0;
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
exports.ELECTRON_GYP_DIR = path.resolve(os.homedir(), '.electron-gyp');
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/constants.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/constants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAEhB,QAAA,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC,CAAC"}
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.d.ts
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function locateElectronModule(projectRootPath?: string | undefined, startDir?: string | undefined): Promise<string | null>;
|
||||
56
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.js
generated
vendored
Normal file
56
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.locateElectronModule = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
const search_module_1 = require("./search-module");
|
||||
const electronModuleNames = ['electron', 'electron-prebuilt-compile'];
|
||||
async function locateModuleByRequire() {
|
||||
for (const moduleName of electronModuleNames) {
|
||||
try {
|
||||
const modulePath = path.resolve(require.resolve(path.join(moduleName, 'package.json')), '..');
|
||||
if (await fs.pathExists(path.join(modulePath, 'package.json'))) {
|
||||
return modulePath;
|
||||
}
|
||||
}
|
||||
catch { // eslint-disable-line no-empty
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async function locateElectronModule(projectRootPath = undefined, startDir = undefined) {
|
||||
startDir !== null && startDir !== void 0 ? startDir : (startDir = process.cwd());
|
||||
for (const moduleName of electronModuleNames) {
|
||||
const electronPaths = await (0, search_module_1.searchForModule)(startDir, moduleName, projectRootPath);
|
||||
const electronPath = electronPaths.find(async (ePath) => await fs.pathExists(path.join(ePath, 'package.json')));
|
||||
if (electronPath) {
|
||||
return electronPath;
|
||||
}
|
||||
}
|
||||
return locateModuleByRequire();
|
||||
}
|
||||
exports.locateElectronModule = locateElectronModule;
|
||||
//# sourceMappingURL=electron-locator.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/electron-locator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"electron-locator.js","sourceRoot":"","sources":["../src/electron-locator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAC7B,mDAAkD;AAElD,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAG,2BAA2B,CAAC,CAAC;AAEvE,KAAK,UAAU,qBAAqB;IAClC,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE;QAC5C,IAAI;YACF,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC9F,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE;gBAC9D,OAAO,UAAU,CAAC;aACnB;SACF;QAAC,MAAM,EAAE,+BAA+B;SACxC;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACxC,kBAAsC,SAAS,EAC/C,WAA+B,SAAS;IAExC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,IAAR,QAAQ,GAAK,OAAO,CAAC,GAAG,EAAE,EAAC;IAE3B,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE;QAC5C,MAAM,aAAa,GAAG,MAAM,IAAA,+BAAe,EAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QACnF,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;QAExH,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;KACF;IAED,OAAO,qBAAqB,EAAE,CAAC;AACjC,CAAC;AAhBD,oDAgBC"}
|
||||
2
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.d.ts
generated
vendored
Normal file
2
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="node" />
|
||||
export declare function fetch<T extends 'buffer' | 'text', RT = T extends 'buffer' ? Buffer : string>(url: string, responseType: T, retries?: number): Promise<RT>;
|
||||
36
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.js
generated
vendored
Normal file
36
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fetch = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const got_1 = __importDefault(require("got"));
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
function sleep(n) {
|
||||
return new Promise(r => setTimeout(r, n));
|
||||
}
|
||||
async function fetch(url, responseType, retries = 3) {
|
||||
if (retries === 0)
|
||||
throw new Error('Failed to fetch a clang resource, run with DEBUG=electron-rebuild for more information');
|
||||
d('downloading:', url);
|
||||
try {
|
||||
const response = await got_1.default.get(url, {
|
||||
responseType,
|
||||
});
|
||||
if (response.statusCode !== 200) {
|
||||
d('got bad status code:', response.statusCode);
|
||||
await sleep(2000);
|
||||
return fetch(url, responseType, retries - 1);
|
||||
}
|
||||
d('response came back OK');
|
||||
return response.body;
|
||||
}
|
||||
catch (err) {
|
||||
d('request failed for some reason', err);
|
||||
await sleep(2000);
|
||||
return fetch(url, responseType, retries - 1);
|
||||
}
|
||||
}
|
||||
exports.fetch = fetch;
|
||||
//# sourceMappingURL=fetcher.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/fetcher.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8CAAsB;AAEtB,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;AAEpC,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,KAAK,CAAyE,GAAW,EAAE,YAAe,EAAE,OAAO,GAAG,CAAC;IAC3I,IAAI,OAAO,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;IAC7H,CAAC,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACvB,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,aAAG,CAAC,GAAG,CAAC,GAAG,EAAE;YAClC,YAAY;SACb,CAAC,CAAC;QACH,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,EAAE;YAC/B,CAAC,CAAC,sBAAsB,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC/C,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;YAClB,OAAO,KAAK,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;SAC9C;QACD,CAAC,CAAC,uBAAuB,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC,IAAU,CAAC;KAC5B;IAAC,OAAO,GAAG,EAAE;QACZ,CAAC,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;QACzC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,KAAK,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;KAC9C;AACH,CAAC;AAnBD,sBAmBC"}
|
||||
3
desktop-operator/node_modules/@electron/rebuild/lib/main.d.ts
generated
vendored
Normal file
3
desktop-operator/node_modules/@electron/rebuild/lib/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { rebuild, RebuildOptions } from './rebuild';
|
||||
export { rebuild, RebuildOptions };
|
||||
export default rebuild;
|
||||
10
desktop-operator/node_modules/@electron/rebuild/lib/main.js
generated
vendored
Normal file
10
desktop-operator/node_modules/@electron/rebuild/lib/main.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.rebuild = void 0;
|
||||
const rebuild_1 = require("./rebuild");
|
||||
Object.defineProperty(exports, "rebuild", { enumerable: true, get: function () { return rebuild_1.rebuild; } });
|
||||
exports.default = rebuild_1.rebuild;
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/main.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AAE3C,wFAFA,iBAAO,OAEA;AAChB,kBAAe,iBAAO,CAAC;AACvB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE;IAC3C,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC"}
|
||||
29
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.d.ts
generated
vendored
Normal file
29
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import { IRebuilder } from './types';
|
||||
export declare class ModuleRebuilder {
|
||||
private modulePath;
|
||||
private nodeGyp;
|
||||
private rebuilder;
|
||||
private prebuildify;
|
||||
private prebuildInstall;
|
||||
private nodePreGyp;
|
||||
constructor(rebuilder: IRebuilder, modulePath: string);
|
||||
get metaPath(): string;
|
||||
get metaData(): string;
|
||||
alreadyBuiltByRebuild(): Promise<boolean>;
|
||||
cacheModuleState(cacheKey: string): Promise<void>;
|
||||
/**
|
||||
* Whether a prebuild-install-generated native module exists.
|
||||
*/
|
||||
prebuildInstallNativeModuleExists(): Promise<boolean>;
|
||||
/**
|
||||
* If the native module uses prebuildify, check to see if it comes with a prebuilt module for
|
||||
* the given platform and arch.
|
||||
*/
|
||||
findPrebuildifyModule(cacheKey: string): Promise<boolean>;
|
||||
findPrebuildInstallModule(cacheKey: string): Promise<boolean>;
|
||||
findNodePreGypInstallModule(cacheKey: string): Promise<boolean>;
|
||||
rebuildNodeGypModule(cacheKey: string): Promise<boolean>;
|
||||
replaceExistingNativeModule(): Promise<void>;
|
||||
writeMetadata(): Promise<void>;
|
||||
rebuild(cacheKey: string): Promise<boolean>;
|
||||
}
|
||||
149
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.js
generated
vendored
Normal file
149
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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.ModuleRebuilder = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
const cache_1 = require("./cache");
|
||||
const node_gyp_1 = require("./module-type/node-gyp/node-gyp");
|
||||
const prebuildify_1 = require("./module-type/prebuildify");
|
||||
const prebuild_install_1 = require("./module-type/prebuild-install");
|
||||
const node_pre_gyp_1 = require("./module-type/node-pre-gyp");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
class ModuleRebuilder {
|
||||
constructor(rebuilder, modulePath) {
|
||||
this.modulePath = modulePath;
|
||||
this.rebuilder = rebuilder;
|
||||
this.nodeGyp = new node_gyp_1.NodeGyp(rebuilder, modulePath);
|
||||
this.prebuildify = new prebuildify_1.Prebuildify(rebuilder, modulePath);
|
||||
this.prebuildInstall = new prebuild_install_1.PrebuildInstall(rebuilder, modulePath);
|
||||
this.nodePreGyp = new node_pre_gyp_1.NodePreGyp(rebuilder, modulePath);
|
||||
}
|
||||
get metaPath() {
|
||||
return path.resolve(this.modulePath, 'build', this.rebuilder.buildType, '.forge-meta');
|
||||
}
|
||||
get metaData() {
|
||||
return `${this.rebuilder.arch}--${this.rebuilder.ABI}`;
|
||||
}
|
||||
async alreadyBuiltByRebuild() {
|
||||
if (await fs.pathExists(this.metaPath)) {
|
||||
const meta = await fs.readFile(this.metaPath, 'utf8');
|
||||
return meta === this.metaData;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async cacheModuleState(cacheKey) {
|
||||
if (this.rebuilder.useCache) {
|
||||
await (0, cache_1.cacheModuleState)(this.modulePath, this.rebuilder.cachePath, cacheKey);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Whether a prebuild-install-generated native module exists.
|
||||
*/
|
||||
async prebuildInstallNativeModuleExists() {
|
||||
return this.prebuildInstall.prebuiltModuleExists();
|
||||
}
|
||||
/**
|
||||
* If the native module uses prebuildify, check to see if it comes with a prebuilt module for
|
||||
* the given platform and arch.
|
||||
*/
|
||||
async findPrebuildifyModule(cacheKey) {
|
||||
if (await this.prebuildify.usesTool()) {
|
||||
d(`assuming is prebuildify powered: ${this.prebuildify.moduleName}`);
|
||||
if (await this.prebuildify.findPrebuiltModule()) {
|
||||
await this.writeMetadata();
|
||||
await this.cacheModuleState(cacheKey);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async findPrebuildInstallModule(cacheKey) {
|
||||
if (await this.prebuildInstall.usesTool()) {
|
||||
d(`assuming is prebuild-install powered: ${this.prebuildInstall.moduleName}`);
|
||||
if (await this.prebuildInstall.findPrebuiltModule()) {
|
||||
d('installed prebuilt module:', this.prebuildInstall.moduleName);
|
||||
await this.writeMetadata();
|
||||
await this.cacheModuleState(cacheKey);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async findNodePreGypInstallModule(cacheKey) {
|
||||
if (await this.nodePreGyp.usesTool()) {
|
||||
d(`assuming is node-pre-gyp powered: ${this.nodePreGyp.moduleName}`);
|
||||
if (await this.nodePreGyp.findPrebuiltModule()) {
|
||||
d('installed prebuilt module:', this.nodePreGyp.moduleName);
|
||||
await this.writeMetadata();
|
||||
await this.cacheModuleState(cacheKey);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async rebuildNodeGypModule(cacheKey) {
|
||||
await this.nodeGyp.rebuildModule();
|
||||
d('built via node-gyp:', this.nodeGyp.moduleName);
|
||||
await this.writeMetadata();
|
||||
await this.replaceExistingNativeModule();
|
||||
await this.cacheModuleState(cacheKey);
|
||||
return true;
|
||||
}
|
||||
async replaceExistingNativeModule() {
|
||||
const buildLocation = path.resolve(this.modulePath, 'build', this.rebuilder.buildType);
|
||||
d('searching for .node file', buildLocation);
|
||||
const buildLocationFiles = await fs.readdir(buildLocation);
|
||||
d('testing files', buildLocationFiles);
|
||||
const nodeFile = buildLocationFiles.find((file) => file !== '.node' && file.endsWith('.node'));
|
||||
const nodePath = nodeFile ? path.resolve(buildLocation, nodeFile) : undefined;
|
||||
if (nodePath && await fs.pathExists(nodePath)) {
|
||||
d('found .node file', nodePath);
|
||||
if (!this.rebuilder.disablePreGypCopy) {
|
||||
const abiPath = path.resolve(this.modulePath, `bin/${this.rebuilder.platform}-${this.rebuilder.arch}-${this.rebuilder.ABI}`);
|
||||
d('copying to prebuilt place:', abiPath);
|
||||
await fs.mkdir(abiPath, { recursive: true });
|
||||
await fs.copyFile(nodePath, path.join(abiPath, `${this.nodeGyp.moduleName}.node`));
|
||||
}
|
||||
}
|
||||
}
|
||||
async writeMetadata() {
|
||||
await fs.outputFile(this.metaPath, this.metaData);
|
||||
}
|
||||
async rebuild(cacheKey) {
|
||||
if (!this.rebuilder.buildFromSource && ((await this.findPrebuildifyModule(cacheKey)) ||
|
||||
(await this.findPrebuildInstallModule(cacheKey)) ||
|
||||
(await this.findNodePreGypInstallModule(cacheKey)))) {
|
||||
return true;
|
||||
}
|
||||
return await this.rebuildNodeGypModule(cacheKey);
|
||||
}
|
||||
}
|
||||
exports.ModuleRebuilder = ModuleRebuilder;
|
||||
//# sourceMappingURL=module-rebuilder.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-rebuilder.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"module-rebuilder.js","sourceRoot":"","sources":["../src/module-rebuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6CAA+B;AAC/B,2CAA6B;AAE7B,mCAA2C;AAC3C,8DAA0D;AAC1D,2DAAwD;AACxD,qEAAiE;AACjE,6DAAwD;AAGxD,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;AAEpC,MAAa,eAAe;IAQ1B,YAAY,SAAqB,EAAE,UAAkB;QACnD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;Q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AAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;gBAC7H,CAAC,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;gBACzC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC7C,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,OAAO,CAAC,CAAC,CAAC;aACpF;SACF;IACH,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,IACE,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,CACjC,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC5C,CAAC,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YAChD,CAAC,MAAM,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC,EACrD;YACA,OAAO,IAAI,CAAC;SACb;QAED,OAAO,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF;AA9ID,0CA8IC"}
|
||||
17
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.d.ts
generated
vendored
Normal file
17
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { NodeAPI } from '../node-api';
|
||||
import { IRebuilder } from '../types';
|
||||
declare type PackageJSONValue = string | Record<string, unknown>;
|
||||
export declare class NativeModule {
|
||||
protected rebuilder: IRebuilder;
|
||||
private _moduleName;
|
||||
protected modulePath: string;
|
||||
nodeAPI: NodeAPI;
|
||||
private packageJSON;
|
||||
constructor(rebuilder: IRebuilder, modulePath: string);
|
||||
get moduleName(): string;
|
||||
packageJSONFieldWithDefault(key: string, defaultValue: PackageJSONValue): Promise<PackageJSONValue>;
|
||||
packageJSONField(key: string): Promise<PackageJSONValue | undefined>;
|
||||
getSupportedNapiVersions(): Promise<number[] | undefined>;
|
||||
}
|
||||
export declare function locateBinary(basePath: string, suffix: string): Promise<string | null>;
|
||||
export {};
|
||||
56
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.js
generated
vendored
Normal file
56
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.locateBinary = exports.NativeModule = void 0;
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const node_api_1 = require("../node-api");
|
||||
const read_package_json_1 = require("../read-package-json");
|
||||
class NativeModule {
|
||||
constructor(rebuilder, modulePath) {
|
||||
this.rebuilder = rebuilder;
|
||||
this.modulePath = modulePath;
|
||||
this.nodeAPI = new node_api_1.NodeAPI(this.moduleName, this.rebuilder.electronVersion);
|
||||
}
|
||||
get moduleName() {
|
||||
if (!this._moduleName) {
|
||||
const basename = path_1.default.basename(this.modulePath);
|
||||
const parentDir = path_1.default.basename(path_1.default.dirname(this.modulePath));
|
||||
if (parentDir.startsWith('@')) {
|
||||
this._moduleName = `${parentDir}/${basename}`;
|
||||
}
|
||||
this._moduleName = basename;
|
||||
}
|
||||
return this._moduleName;
|
||||
}
|
||||
async packageJSONFieldWithDefault(key, defaultValue) {
|
||||
const result = await this.packageJSONField(key);
|
||||
return result === undefined ? defaultValue : result;
|
||||
}
|
||||
async packageJSONField(key) {
|
||||
this.packageJSON || (this.packageJSON = await (0, read_package_json_1.readPackageJson)(this.modulePath));
|
||||
return this.packageJSON[key];
|
||||
}
|
||||
async getSupportedNapiVersions() {
|
||||
const binary = (await this.packageJSONFieldWithDefault('binary', {}));
|
||||
return binary === null || binary === void 0 ? void 0 : binary.napi_versions;
|
||||
}
|
||||
}
|
||||
exports.NativeModule = NativeModule;
|
||||
async function locateBinary(basePath, suffix) {
|
||||
let parentPath = basePath;
|
||||
let testPath;
|
||||
while (testPath !== parentPath) {
|
||||
testPath = parentPath;
|
||||
const checkPath = path_1.default.resolve(testPath, suffix);
|
||||
if (await fs_extra_1.default.pathExists(checkPath)) {
|
||||
return checkPath;
|
||||
}
|
||||
parentPath = path_1.default.resolve(testPath, '..');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.locateBinary = locateBinary;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module-type/index.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAExB,0CAAsC;AACtC,4DAAuD;AAKvD,MAAa,YAAY;IAOvB,YAAY,SAAqB,EAAE,UAAkB;QACnD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAChD,MAAM,SAAS,GAAG,cA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AAC;QACjD,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAClC,OAAO,SAAS,CAAC;SAClB;QACD,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KAC3C;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAdD,oCAcC"}
|
||||
6
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.d.ts
generated
vendored
Normal file
6
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { NativeModule } from '..';
|
||||
export declare class NodeGyp extends NativeModule {
|
||||
buildArgs(prefixedArgs: string[]): Promise<string[]>;
|
||||
buildArgsFromBinaryField(): Promise<string[]>;
|
||||
rebuildModule(): Promise<void>;
|
||||
}
|
||||
127
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js
generated
vendored
Normal file
127
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeGyp = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const detect_libc_1 = __importDefault(require("detect-libc"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const semver_1 = __importDefault(require("semver"));
|
||||
const constants_1 = require("../../constants");
|
||||
const clang_fetcher_1 = require("../../clang-fetcher");
|
||||
const __1 = require("..");
|
||||
const child_process_1 = require("child_process");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
class NodeGyp extends __1.NativeModule {
|
||||
async buildArgs(prefixedArgs) {
|
||||
const args = [
|
||||
'node',
|
||||
'node-gyp',
|
||||
'rebuild',
|
||||
...prefixedArgs,
|
||||
`--runtime=electron`,
|
||||
`--target=${this.rebuilder.electronVersion}`,
|
||||
`--arch=${this.rebuilder.arch}`,
|
||||
`--dist-url=${this.rebuilder.headerURL}`,
|
||||
'--build-from-source'
|
||||
];
|
||||
args.push(d.enabled ? '--verbose' : '--silent');
|
||||
if (this.rebuilder.debug) {
|
||||
args.push('--debug');
|
||||
}
|
||||
args.push(...(await this.buildArgsFromBinaryField()));
|
||||
if (this.rebuilder.msvsVersion) {
|
||||
args.push(`--msvs_version=${this.rebuilder.msvsVersion}`);
|
||||
}
|
||||
// Headers of old Electron versions do not have a valid config.gypi file
|
||||
// and --force-process-config must be passed to node-gyp >= 8.4.0 to
|
||||
// correctly build modules for them.
|
||||
// See also https://github.com/nodejs/node-gyp/pull/2497
|
||||
if (!semver_1.default.satisfies(this.rebuilder.electronVersion, '^14.2.0 || ^15.3.0') && semver_1.default.major(this.rebuilder.electronVersion) < 16) {
|
||||
args.push('--force-process-config');
|
||||
}
|
||||
return args;
|
||||
}
|
||||
async buildArgsFromBinaryField() {
|
||||
const binary = await this.packageJSONFieldWithDefault('binary', {});
|
||||
let napiBuildVersion = undefined;
|
||||
if (Array.isArray(binary.napi_versions)) {
|
||||
napiBuildVersion = this.nodeAPI.getNapiVersion(binary.napi_versions.map(str => Number(str)));
|
||||
}
|
||||
const flags = await Promise.all(Object.entries(binary).map(async ([binaryKey, binaryValue]) => {
|
||||
if (binaryKey === 'napi_versions') {
|
||||
return;
|
||||
}
|
||||
let value = binaryValue;
|
||||
if (binaryKey === 'module_path') {
|
||||
value = path_1.default.resolve(this.modulePath, value);
|
||||
}
|
||||
value = value.replace('{configuration}', this.rebuilder.buildType)
|
||||
.replace('{node_abi}', `electron-v${this.rebuilder.electronVersion.split('.').slice(0, 2).join('.')}`)
|
||||
.replace('{platform}', this.rebuilder.platform)
|
||||
.replace('{arch}', this.rebuilder.arch)
|
||||
.replace('{version}', await this.packageJSONField('version'))
|
||||
.replace('{libc}', await detect_libc_1.default.family() || 'unknown');
|
||||
if (napiBuildVersion !== undefined) {
|
||||
value = value.replace('{napi_build_version}', napiBuildVersion.toString());
|
||||
}
|
||||
for (const [replaceKey, replaceValue] of Object.entries(binary)) {
|
||||
value = value.replace(`{${replaceKey}}`, replaceValue);
|
||||
}
|
||||
return `--${binaryKey}=${value}`;
|
||||
}));
|
||||
return flags.filter(value => value);
|
||||
}
|
||||
async rebuildModule() {
|
||||
var _a, _b;
|
||||
if (this.rebuilder.platform !== process.platform) {
|
||||
throw new Error("node-gyp does not support cross-compiling native modules from source.");
|
||||
}
|
||||
if (this.modulePath.includes(' ')) {
|
||||
console.error('Attempting to build a module with a space in the path');
|
||||
console.error('See https://github.com/nodejs/node-gyp/issues/65#issuecomment-368820565 for reasons why this may not work');
|
||||
// FIXME: Re-enable the throw when more research has been done
|
||||
// throw new Error(`node-gyp does not support building modules with spaces in their path, tried to build: ${modulePath}`);
|
||||
}
|
||||
const env = {
|
||||
...process.env,
|
||||
};
|
||||
const extraNodeGypArgs = [];
|
||||
if (this.rebuilder.useElectronClang) {
|
||||
const { env: clangEnv, args: clangArgs } = await (0, clang_fetcher_1.getClangEnvironmentVars)(this.rebuilder.electronVersion, this.rebuilder.arch);
|
||||
Object.assign(env, clangEnv);
|
||||
extraNodeGypArgs.push(...clangArgs);
|
||||
}
|
||||
const nodeGypArgs = await this.buildArgs(extraNodeGypArgs);
|
||||
d('rebuilding', this.moduleName, 'with args', nodeGypArgs);
|
||||
const forkedChild = (0, child_process_1.fork)(path_1.default.resolve(__dirname, 'worker.js'), {
|
||||
env,
|
||||
cwd: this.modulePath,
|
||||
stdio: 'pipe',
|
||||
});
|
||||
const outputBuffers = [];
|
||||
(_a = forkedChild.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (chunk) => {
|
||||
outputBuffers.push(chunk);
|
||||
});
|
||||
(_b = forkedChild.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (chunk) => {
|
||||
outputBuffers.push(chunk);
|
||||
});
|
||||
forkedChild.send({
|
||||
moduleName: this.moduleName,
|
||||
nodeGypArgs,
|
||||
extraNodeGypArgs,
|
||||
devDir: this.rebuilder.mode === 'sequential' ? constants_1.ELECTRON_GYP_DIR : path_1.default.resolve(constants_1.ELECTRON_GYP_DIR, '_p', this.moduleName),
|
||||
});
|
||||
await new Promise((resolve, reject) => {
|
||||
forkedChild.on('exit', (code) => {
|
||||
if (code === 0)
|
||||
return resolve();
|
||||
console.error(Buffer.concat(outputBuffers).toString());
|
||||
reject(new Error(`node-gyp failed to rebuild '${this.modulePath}'`));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.NodeGyp = NodeGyp;
|
||||
//# sourceMappingURL=node-gyp.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/node-gyp.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node-gyp.js","sourceRoot":"","sources":["../../../src/module-type/node-gyp/node-gyp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAqC;AACrC,gDAAwB;AACxB,oDAA4B;AAE5B,+CAAmD;AACnD,uDAA8D;AAC9D,0BAAkC;AAClC,iDAAqC;AAErC,MAAM,CAAC,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;AAEpC,MAAa,OAAQ,SAAQ,gBAAY;IACvC,KAAK,CAAC,SAAS,CAAC,YAAsB;QACpC,MAAM,IAAI,GAAG;YACX,MAAM;YACN,UAAU;YACV,SAAS;YACT,GAAG,YAAY;YACf,oBAAoB;YACpB,YAAY,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;YAC5C,UAAU,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YAC/B,cAAc,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YACxC,qBAAqB;SACtB,CAAC;QAEF,IAAI,C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p/worker.d.ts
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/worker.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
38
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/worker.js
generated
vendored
Normal file
38
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/worker.js
generated
vendored
Normal file
@@ -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 });
|
||||
const node_gyp_1 = __importDefault(require("node-gyp"));
|
||||
const util_1 = require("util");
|
||||
process.on('message', async ({ nodeGypArgs, devDir, extraNodeGypArgs, }) => {
|
||||
const nodeGyp = (0, node_gyp_1.default)();
|
||||
nodeGyp.parseArgv(nodeGypArgs);
|
||||
nodeGyp.devDir = devDir;
|
||||
let command = nodeGyp.todo.shift();
|
||||
try {
|
||||
while (command) {
|
||||
if (command.name === 'configure') {
|
||||
command.args = command.args.filter((arg) => !extraNodeGypArgs.includes(arg));
|
||||
}
|
||||
else if (command.name === 'build' && process.platform === 'win32') {
|
||||
// This is disgusting but it prevents node-gyp from destroying our MSBuild arguments
|
||||
command.args.map = (fn) => {
|
||||
return Array.prototype.map.call(command.args, (arg) => {
|
||||
if (arg.startsWith('/p:'))
|
||||
return arg;
|
||||
return fn(arg);
|
||||
});
|
||||
};
|
||||
}
|
||||
await (0, util_1.promisify)(nodeGyp.commands[command.name])(command.args);
|
||||
command = nodeGyp.todo.shift();
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=worker.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/worker.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-gyp/worker.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/module-type/node-gyp/worker.ts"],"names":[],"mappings":";;;;;AAAA,wDAAqC;AACrC,+BAAiC;AAEjC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAC3B,WAAW,EACX,MAAM,EACN,gBAAgB,GACjB,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,IAAA,kBAAa,GAAE,CAAC;IAChC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACnC,IAAI;QACF,OAAO,OAAO,EAAE;YACd,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE;gBAChC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;aACtF;iBAAM,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;gBACnE,oFAAoF;gBACpF,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,EAA2B,EAAE,EAAE;oBACjD,OAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE;wBAC5D,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC;4BAAE,OAAO,GAAG,CAAC;wBACtC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;oBACjB,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC;aACH;YACD,MAAM,IAAA,gBAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9D,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;SAChC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC"}
|
||||
10
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.d.ts
generated
vendored
Normal file
10
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NativeModule } from '.';
|
||||
export declare class NodePreGyp extends NativeModule {
|
||||
usesTool(): Promise<boolean>;
|
||||
locateBinary(): Promise<string | null>;
|
||||
run(nodePreGypPath: string): Promise<void>;
|
||||
findPrebuiltModule(): Promise<boolean>;
|
||||
getNodePreGypRuntimeArgs(): Promise<string[]>;
|
||||
private shouldUpdateBinary;
|
||||
private getModulePaths;
|
||||
}
|
||||
116
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.js
generated
vendored
Normal file
116
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodePreGyp = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
||||
const read_binary_file_arch_1 = require("read-binary-file-arch");
|
||||
const _1 = require(".");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
class NodePreGyp extends _1.NativeModule {
|
||||
async usesTool() {
|
||||
const dependencies = await this.packageJSONFieldWithDefault('dependencies', {});
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return dependencies.hasOwnProperty('@mapbox/node-pre-gyp');
|
||||
}
|
||||
async locateBinary() {
|
||||
return (0, _1.locateBinary)(this.modulePath, 'node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp');
|
||||
}
|
||||
async run(nodePreGypPath) {
|
||||
const redownloadBinary = await this.shouldUpdateBinary(nodePreGypPath);
|
||||
await (0, cross_spawn_promise_1.spawn)(process.execPath, [
|
||||
nodePreGypPath,
|
||||
'reinstall',
|
||||
'--fallback-to-build',
|
||||
...(redownloadBinary ? ['--update-binary'] : []),
|
||||
`--arch=${this.rebuilder.arch}`,
|
||||
`--target_arch=${this.rebuilder.arch}`,
|
||||
`--target_platform=${this.rebuilder.platform}`,
|
||||
...await this.getNodePreGypRuntimeArgs(),
|
||||
], {
|
||||
cwd: this.modulePath,
|
||||
});
|
||||
}
|
||||
async findPrebuiltModule() {
|
||||
var _a;
|
||||
const nodePreGypPath = await this.locateBinary();
|
||||
if (nodePreGypPath) {
|
||||
d(`triggering prebuild download step: ${this.moduleName}`);
|
||||
try {
|
||||
await this.run(nodePreGypPath);
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
d('failed to use node-pre-gyp:', err);
|
||||
if ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('requires Node-API but Electron')) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
d(`could not find node-pre-gyp relative to: ${this.modulePath}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async getNodePreGypRuntimeArgs() {
|
||||
const moduleNapiVersions = await this.getSupportedNapiVersions();
|
||||
if (moduleNapiVersions) {
|
||||
return [];
|
||||
}
|
||||
else {
|
||||
return [
|
||||
'--runtime=electron',
|
||||
`--target=${this.rebuilder.electronVersion}`,
|
||||
`--dist-url=${this.rebuilder.headerURL}`,
|
||||
];
|
||||
}
|
||||
}
|
||||
async shouldUpdateBinary(nodePreGypPath) {
|
||||
let shouldUpdate = false;
|
||||
// Redownload binary only if the existing module arch differs from the
|
||||
// target arch.
|
||||
try {
|
||||
const modulePaths = await this.getModulePaths(nodePreGypPath);
|
||||
d('module paths:', modulePaths);
|
||||
for (const modulePath of modulePaths) {
|
||||
let moduleArch;
|
||||
try {
|
||||
moduleArch = await (0, read_binary_file_arch_1.readBinaryFileArch)(modulePath);
|
||||
d('module arch:', moduleArch);
|
||||
}
|
||||
catch (error) {
|
||||
d('failed to read module arch:', error.message);
|
||||
continue;
|
||||
}
|
||||
if (moduleArch && moduleArch !== this.rebuilder.arch) {
|
||||
shouldUpdate = true;
|
||||
d('module architecture differs:', `${moduleArch} !== ${this.rebuilder.arch}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
d('failed to get existing binary arch:', error.message);
|
||||
// Assume architecture differs
|
||||
shouldUpdate = true;
|
||||
}
|
||||
return shouldUpdate;
|
||||
}
|
||||
async getModulePaths(nodePreGypPath) {
|
||||
const results = await (0, cross_spawn_promise_1.spawn)(process.execPath, [
|
||||
nodePreGypPath,
|
||||
'reveal',
|
||||
'module',
|
||||
`--target_arch=${this.rebuilder.arch}`,
|
||||
`--target_platform=${this.rebuilder.platform}`,
|
||||
], {
|
||||
cwd: this.modulePath,
|
||||
});
|
||||
// Packages with multiple binaries will output one per line
|
||||
return results.split('\n').filter(Boolean);
|
||||
}
|
||||
}
|
||||
exports.NodePreGyp = NodePreGyp;
|
||||
//# sourceMappingURL=node-pre-gyp.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/node-pre-gyp.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node-pre-gyp.js","sourceRoot":"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C,CAAC,6BAA6B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;oBAChD,SAAS;iBACV;gBAED,IAAI,UAAU,IAAI,UAAU,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;oBACpD,YAAY,GAAG,IAAI,CAAC;oBACpB,CAAC,CAAC,8BAA8B,EAAE,GAAG,UAAU,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC9E,MAAM;iBACP;aACF;SACF;QAAC,OAAO,KAAK,EAAE;YACd,CAAC,CAAC,qCAAqC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAExD,8BAA8B;YAC9B,YAAY,GAAG,IAAI,CAAC;SACrB;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,cAAsB;QACjD,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAK,EAAC,OAAO,CAAC,QAAQ,EAAE;YAC5C,cAAc;YACd,QAAQ;YACR,QAAQ;YACR,iBAAiB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YACtC,qBAAqB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;SAC/C,EAAE;YACD,GAAG,EAAE,IAAI,CAAC,UAAU;SACrB,CAAC,CAAC;QAEH,2DAA2D;QAC3D,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAlHD,gCAkHC"}
|
||||
12
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.d.ts
generated
vendored
Normal file
12
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NativeModule } from '.';
|
||||
export declare class PrebuildInstall extends NativeModule {
|
||||
usesTool(): Promise<boolean>;
|
||||
locateBinary(): Promise<string | null>;
|
||||
run(prebuildInstallPath: string): Promise<void>;
|
||||
findPrebuiltModule(): Promise<boolean>;
|
||||
/**
|
||||
* Whether a prebuild-install-based native module exists.
|
||||
*/
|
||||
prebuiltModuleExists(): Promise<boolean>;
|
||||
getPrebuildInstallRuntimeArgs(): Promise<string[]>;
|
||||
}
|
||||
79
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.js
generated
vendored
Normal file
79
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PrebuildInstall = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
||||
const _1 = require(".");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
class PrebuildInstall extends _1.NativeModule {
|
||||
async usesTool() {
|
||||
const dependencies = await this.packageJSONFieldWithDefault('dependencies', {});
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return dependencies.hasOwnProperty('prebuild-install');
|
||||
}
|
||||
async locateBinary() {
|
||||
return (0, _1.locateBinary)(this.modulePath, 'node_modules/prebuild-install/bin.js');
|
||||
}
|
||||
async run(prebuildInstallPath) {
|
||||
await (0, cross_spawn_promise_1.spawn)(process.execPath, [
|
||||
path_1.default.resolve(__dirname, '..', `prebuild-shim.js`),
|
||||
prebuildInstallPath,
|
||||
`--arch=${this.rebuilder.arch}`,
|
||||
`--platform=${this.rebuilder.platform}`,
|
||||
`--tag-prefix=${this.rebuilder.prebuildTagPrefix}`,
|
||||
...await this.getPrebuildInstallRuntimeArgs(),
|
||||
], {
|
||||
cwd: this.modulePath,
|
||||
});
|
||||
}
|
||||
async findPrebuiltModule() {
|
||||
var _a;
|
||||
const prebuildInstallPath = await this.locateBinary();
|
||||
if (prebuildInstallPath) {
|
||||
d(`triggering prebuild download step: ${this.moduleName}`);
|
||||
try {
|
||||
await this.run(prebuildInstallPath);
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
d('failed to use prebuild-install:', err);
|
||||
if ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('requires Node-API but Electron')) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
d(`could not find prebuild-install relative to: ${this.modulePath}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Whether a prebuild-install-based native module exists.
|
||||
*/
|
||||
async prebuiltModuleExists() {
|
||||
return fs_extra_1.default.pathExists(path_1.default.resolve(this.modulePath, 'prebuilds', `${this.rebuilder.platform}-${this.rebuilder.arch}`, `electron-${this.rebuilder.ABI}.node`));
|
||||
}
|
||||
async getPrebuildInstallRuntimeArgs() {
|
||||
const moduleNapiVersions = await this.getSupportedNapiVersions();
|
||||
if (moduleNapiVersions) {
|
||||
const napiVersion = this.nodeAPI.getNapiVersion(moduleNapiVersions);
|
||||
return [
|
||||
'--runtime=napi',
|
||||
`--target=${napiVersion}`,
|
||||
];
|
||||
}
|
||||
else {
|
||||
return [
|
||||
'--runtime=electron',
|
||||
`--target=${this.rebuilder.electronVersion}`,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.PrebuildInstall = PrebuildInstall;
|
||||
//# sourceMappingURL=prebuild-install.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuild-install.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"prebuild-install.js","sourceRoot":"","sources":["../../src/module-type/prebuild-install.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,wDAA0B;AA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AG,CAAC,CAAC;gBAE1C,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,0CAAE,QAAQ,CAAC,gCAAgC,CAAC,EAAE;oBAC5D,MAAM,GAAG,CAAC;iBACX;aACF;SACF;aAAM;YACL,CAAC,CAAC,gDAAgD,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SACtE;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,oBAAoB;QACxB,OAAO,kBAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,YAAY,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAC/J,CAAC;IAED,KAAK,CAAC,6BAA6B;QACjC,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACjE,IAAI,kBAAkB,EAAE;YACtB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;YACpE,OAAO;gBACL,gBAAgB;gBAChB,YAAY,WAAW,EAAE;aAC1B,CAAC;SACH;aAAM;YACL,OAAO;gBACL,oBAAoB;gBACpB,YAAY,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;aAC7C,CAAC;SACH;IACH,CAAC;CACF;AAvED,0CAuEC"}
|
||||
11
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.d.ts
generated
vendored
Normal file
11
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { NativeModule } from '.';
|
||||
export declare function determineNativePrebuildArch(arch: string): string;
|
||||
/**
|
||||
* The extension of `prebuildify`-generated native modules, after the last `.`. This value differs
|
||||
* based on whether the target arch is ARM-based.
|
||||
*/
|
||||
export declare function determineNativePrebuildExtension(arch: string): string;
|
||||
export declare class Prebuildify extends NativeModule {
|
||||
usesTool(): Promise<boolean>;
|
||||
findPrebuiltModule(): Promise<boolean>;
|
||||
}
|
||||
68
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.js
generated
vendored
Normal file
68
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Prebuildify = exports.determineNativePrebuildExtension = exports.determineNativePrebuildArch = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const arch_1 = require("../arch");
|
||||
const _1 = require(".");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
function determineNativePrebuildArch(arch) {
|
||||
if (arch === 'armv7l') {
|
||||
return 'arm';
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
exports.determineNativePrebuildArch = determineNativePrebuildArch;
|
||||
/**
|
||||
* The extension of `prebuildify`-generated native modules, after the last `.`. This value differs
|
||||
* based on whether the target arch is ARM-based.
|
||||
*/
|
||||
function determineNativePrebuildExtension(arch) {
|
||||
switch (arch) {
|
||||
case 'arm64':
|
||||
return 'armv8.node';
|
||||
case 'armv7l':
|
||||
return 'armv7.node';
|
||||
}
|
||||
return 'node';
|
||||
}
|
||||
exports.determineNativePrebuildExtension = determineNativePrebuildExtension;
|
||||
class Prebuildify extends _1.NativeModule {
|
||||
async usesTool() {
|
||||
const devDependencies = await this.packageJSONFieldWithDefault('devDependencies', {});
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return devDependencies.hasOwnProperty('prebuildify');
|
||||
}
|
||||
async findPrebuiltModule() {
|
||||
const nodeArch = (0, arch_1.getNodeArch)(this.rebuilder.arch, process.config.variables);
|
||||
d(`Checking for prebuilds for "${this.moduleName}"`);
|
||||
const prebuildsDir = path_1.default.join(this.modulePath, 'prebuilds');
|
||||
if (!(await fs_extra_1.default.pathExists(prebuildsDir))) {
|
||||
d(`Could not find the prebuilds directory at "${prebuildsDir}"`);
|
||||
return false;
|
||||
}
|
||||
const prebuiltModuleDir = path_1.default.join(prebuildsDir, `${this.rebuilder.platform}-${determineNativePrebuildArch(nodeArch)}`);
|
||||
const nativeExt = determineNativePrebuildExtension(nodeArch);
|
||||
const electronNapiModuleFilename = path_1.default.join(prebuiltModuleDir, `electron.napi.${nativeExt}`);
|
||||
const nodejsNapiModuleFilename = path_1.default.join(prebuiltModuleDir, `node.napi.${nativeExt}`);
|
||||
const abiModuleFilename = path_1.default.join(prebuiltModuleDir, `electron.abi${this.rebuilder.ABI}.${nativeExt}`);
|
||||
if (await fs_extra_1.default.pathExists(electronNapiModuleFilename) || await fs_extra_1.default.pathExists(nodejsNapiModuleFilename)) {
|
||||
this.nodeAPI.ensureElectronSupport();
|
||||
d(`Found prebuilt Node-API module in ${prebuiltModuleDir}"`);
|
||||
}
|
||||
else if (await fs_extra_1.default.pathExists(abiModuleFilename)) {
|
||||
d(`Found prebuilt module: "${abiModuleFilename}"`);
|
||||
}
|
||||
else {
|
||||
d(`Could not locate "${electronNapiModuleFilename}", "${nodejsNapiModuleFilename}", or "${abiModuleFilename}"`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.Prebuildify = Prebuildify;
|
||||
//# sourceMappingURL=prebuildify.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-type/prebuildify.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"prebuildify.js","sourceRoot":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ED,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,2BAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACzH,MAAM,SAAS,GAAG,gCAAgC,CAAC,QAAQ,CAAC,CAAC;QAC7D,MAAM,0BAA0B,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,SAAS,EAAE,CAAC,CAAC;QAC9F,MAAM,wBAAwB,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,SAAS,EAAE,CAAC,CAAC;QACxF,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,eAAe,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC,CAAC;QAEzG,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,0BAA0B,CAAC,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE;YACpG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACrC,CAAC,CAAC,qCAAqC,iBAAiB,GAAG,CAAC,CAAC;SAC9D;aAAM,IAAI,MAAM,kBAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACjD,CAAC,CAAC,2BAA2B,iBAAiB,GAAG,CAAC,CAAC;SACpD;aAAM;YACL,CAAC,CAAC,qBAAqB,0BAA0B,OAAO,wBAAwB,UAAU,iBAAiB,GAAG,CAAC,CAAC;YAChH,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AApCD,kCAoCC"}
|
||||
17
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.d.ts
generated
vendored
Normal file
17
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export declare type ModuleType = 'prod' | 'dev' | 'optional';
|
||||
export declare class ModuleWalker {
|
||||
buildPath: string;
|
||||
modulesToRebuild: string[];
|
||||
onlyModules: string[] | null;
|
||||
prodDeps: Set<string>;
|
||||
projectRootPath?: string;
|
||||
realModulePaths: Set<string>;
|
||||
realNodeModulesPaths: Set<string>;
|
||||
types: ModuleType[];
|
||||
constructor(buildPath: string, projectRootPath: string | undefined, types: ModuleType[], prodDeps: Set<string>, onlyModules: string[] | null);
|
||||
get nodeModulesPaths(): Promise<string[]>;
|
||||
walkModules(): Promise<void>;
|
||||
findModule(moduleName: string, fromDir: string, foundFn: ((p: string) => Promise<void>)): Promise<void[]>;
|
||||
markChildrenAsProdDeps(modulePath: string): Promise<void>;
|
||||
findAllModulesIn(nodeModulesPath: string, prefix?: string): Promise<void>;
|
||||
}
|
||||
112
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.js
generated
vendored
Normal file
112
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ModuleWalker = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const read_package_json_1 = require("./read-package-json");
|
||||
const search_module_1 = require("./search-module");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
class ModuleWalker {
|
||||
constructor(buildPath, projectRootPath, types, prodDeps, onlyModules) {
|
||||
this.buildPath = buildPath;
|
||||
this.modulesToRebuild = [];
|
||||
this.projectRootPath = projectRootPath;
|
||||
this.types = types;
|
||||
this.prodDeps = prodDeps;
|
||||
this.onlyModules = onlyModules;
|
||||
this.realModulePaths = new Set();
|
||||
this.realNodeModulesPaths = new Set();
|
||||
}
|
||||
get nodeModulesPaths() {
|
||||
return (0, search_module_1.searchForNodeModules)(this.buildPath, this.projectRootPath);
|
||||
}
|
||||
async walkModules() {
|
||||
const rootPackageJson = await (0, read_package_json_1.readPackageJson)(this.buildPath);
|
||||
const markWaiters = [];
|
||||
const depKeys = [];
|
||||
if (this.types.includes('prod') || this.onlyModules) {
|
||||
depKeys.push(...Object.keys(rootPackageJson.dependencies || {}));
|
||||
}
|
||||
if (this.types.includes('optional') || this.onlyModules) {
|
||||
depKeys.push(...Object.keys(rootPackageJson.optionalDependencies || {}));
|
||||
}
|
||||
if (this.types.includes('dev') || this.onlyModules) {
|
||||
depKeys.push(...Object.keys(rootPackageJson.devDependencies || {}));
|
||||
}
|
||||
for (const key of depKeys) {
|
||||
this.prodDeps[key] = true;
|
||||
const modulePaths = await (0, search_module_1.searchForModule)(this.buildPath, key, this.projectRootPath);
|
||||
for (const modulePath of modulePaths) {
|
||||
markWaiters.push(this.markChildrenAsProdDeps(modulePath));
|
||||
}
|
||||
}
|
||||
await Promise.all(markWaiters);
|
||||
d('identified prod deps:', this.prodDeps);
|
||||
}
|
||||
async findModule(moduleName, fromDir, foundFn) {
|
||||
const testPaths = await (0, search_module_1.searchForModule)(fromDir, moduleName, this.projectRootPath);
|
||||
const foundFns = testPaths.map(testPath => foundFn(testPath));
|
||||
return Promise.all(foundFns);
|
||||
}
|
||||
async markChildrenAsProdDeps(modulePath) {
|
||||
if (!await fs_extra_1.default.pathExists(modulePath)) {
|
||||
return;
|
||||
}
|
||||
d('exploring', modulePath);
|
||||
let childPackageJson;
|
||||
try {
|
||||
childPackageJson = await (0, read_package_json_1.readPackageJson)(modulePath, true);
|
||||
}
|
||||
catch (err) {
|
||||
return;
|
||||
}
|
||||
const moduleWait = [];
|
||||
const callback = this.markChildrenAsProdDeps.bind(this);
|
||||
for (const key of Object.keys(childPackageJson.dependencies || {}).concat(Object.keys(childPackageJson.optionalDependencies || {}))) {
|
||||
if (this.prodDeps[key]) {
|
||||
continue;
|
||||
}
|
||||
this.prodDeps[key] = true;
|
||||
moduleWait.push(this.findModule(key, modulePath, callback));
|
||||
}
|
||||
await Promise.all(moduleWait);
|
||||
}
|
||||
async findAllModulesIn(nodeModulesPath, prefix = '') {
|
||||
// Some package managers use symbolic links when installing node modules
|
||||
// we need to be sure we've never tested the a package before by resolving
|
||||
// all symlinks in the path and testing against a set
|
||||
const realNodeModulesPath = await fs_extra_1.default.realpath(nodeModulesPath);
|
||||
if (this.realNodeModulesPaths.has(realNodeModulesPath)) {
|
||||
return;
|
||||
}
|
||||
this.realNodeModulesPaths.add(realNodeModulesPath);
|
||||
d('scanning:', realNodeModulesPath);
|
||||
for (const modulePath of await fs_extra_1.default.readdir(realNodeModulesPath)) {
|
||||
// Ignore the magical .bin directory
|
||||
if (modulePath === '.bin')
|
||||
continue;
|
||||
// Ensure that we don't mark modules as needing to be rebuilt more than once
|
||||
// by ignoring / resolving symlinks
|
||||
const realPath = await fs_extra_1.default.realpath(path_1.default.resolve(nodeModulesPath, modulePath));
|
||||
if (this.realModulePaths.has(realPath)) {
|
||||
continue;
|
||||
}
|
||||
this.realModulePaths.add(realPath);
|
||||
if (this.prodDeps[`${prefix}${modulePath}`] && (!this.onlyModules || this.onlyModules.includes(modulePath))) {
|
||||
this.modulesToRebuild.push(realPath);
|
||||
}
|
||||
if (modulePath.startsWith('@')) {
|
||||
await this.findAllModulesIn(realPath, `${modulePath}/`);
|
||||
}
|
||||
if (await fs_extra_1.default.pathExists(path_1.default.resolve(nodeModulesPath, modulePath, 'node_modules'))) {
|
||||
await this.findAllModulesIn(path_1.default.resolve(realPath, 'node_modules'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ModuleWalker = ModuleWalker;
|
||||
//# sourceMappingURL=module-walker.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/module-walker.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":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ild/lib/node-api.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare class NodeAPI {
|
||||
private moduleName;
|
||||
private electronVersion;
|
||||
constructor(moduleName: string, electronVersion: string);
|
||||
ensureElectronSupport(): void;
|
||||
getVersionForElectron(): number;
|
||||
getNapiVersion(moduleNapiVersions: number[]): number;
|
||||
}
|
||||
31
desktop-operator/node_modules/@electron/rebuild/lib/node-api.js
generated
vendored
Normal file
31
desktop-operator/node_modules/@electron/rebuild/lib/node-api.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeAPI = void 0;
|
||||
const node_api_version_1 = require("node-api-version");
|
||||
class NodeAPI {
|
||||
constructor(moduleName, electronVersion) {
|
||||
this.moduleName = moduleName;
|
||||
this.electronVersion = electronVersion;
|
||||
}
|
||||
ensureElectronSupport() {
|
||||
this.getVersionForElectron();
|
||||
}
|
||||
getVersionForElectron() {
|
||||
const electronNapiVersion = (0, node_api_version_1.fromElectronVersion)(this.electronVersion);
|
||||
if (!electronNapiVersion) {
|
||||
throw new Error(`Native module '${this.moduleName}' requires Node-API but Electron v${this.electronVersion} does not support Node-API`);
|
||||
}
|
||||
return electronNapiVersion;
|
||||
}
|
||||
getNapiVersion(moduleNapiVersions) {
|
||||
const electronNapiVersion = this.getVersionForElectron();
|
||||
// Filter out Node-API versions that are too high
|
||||
const filteredVersions = moduleNapiVersions.filter((v) => (v <= electronNapiVersion));
|
||||
if (filteredVersions.length === 0) {
|
||||
throw new Error(`Native module '${this.moduleName}' supports Node-API versions ${moduleNapiVersions} but Electron v${this.electronVersion} only supports Node-API v${electronNapiVersion}`);
|
||||
}
|
||||
return Math.max(...filteredVersions);
|
||||
}
|
||||
}
|
||||
exports.NodeAPI = NodeAPI;
|
||||
//# sourceMappingURL=node-api.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/node-api.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/node-api.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node-api.js","sourceRoot":"","sources":["../src/node-api.ts"],"names":[],"mappings":";;;AAAA,uDAAyF;AAEzF,MAAa,OAAO;IAIlB,YAAY,UAAkB,EAAE,eAAuB;QACrD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,qBAAqB;QACnB,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAED,qBAAqB;QACnB,MAAM,mBAAmB,GAAG,IAAA,sCAA8B,EAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEjF,IAAI,CAAC,mBAAmB,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,UAAU,qCAAqC,IAAI,CAAC,eAAe,4BAA4B,CAAC,CAAC;SACzI;QAED,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,cAAc,CAAC,kBAA4B;QACzC,MAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEzD,iDAAiD;QACjD,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC;QAEtF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,UAAU,gCAAgC,kBAAkB,kBAAkB,IAAI,CAAC,eAAe,4BAA4B,mBAAmB,EAAE,CAAC,CAAC;SAC7L;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAC;IACvC,CAAC;CACF;AAnCD,0BAmCC"}
|
||||
0
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.d.ts
generated
vendored
Normal file
0
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.d.ts
generated
vendored
Normal file
6
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.js
generated
vendored
Normal file
6
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
process.argv.splice(1, 1);
|
||||
// This tricks prebuild-install into not validating on the
|
||||
// 1.8.x and 8.x ABI collision
|
||||
Object.defineProperty(process.versions, 'modules', { value: '-1', writable: false });
|
||||
require(process.argv[1]);
|
||||
//# sourceMappingURL=prebuild-shim.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/prebuild-shim.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"prebuild-shim.js","sourceRoot":"","sources":["../src/prebuild-shim.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1B,0DAA0D;AAC1D,8BAA8B;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAErF,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.d.ts
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function readPackageJson(dir: string, safe?: boolean): Promise<any>;
|
||||
44
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.js
generated
vendored
Normal file
44
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.readPackageJson = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async function readPackageJson(dir, safe = false) {
|
||||
try {
|
||||
return await fs.readJson(path.resolve(dir, 'package.json'));
|
||||
}
|
||||
catch (err) {
|
||||
if (safe) {
|
||||
return {};
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.readPackageJson = readPackageJson;
|
||||
//# sourceMappingURL=read-package-json.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/read-package-json.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"read-package-json.js","sourceRoot":"","sources":["../src/read-package-json.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAE7B,8DAA8D;AACvD,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,IAAI,GAAG,KAAK;IAC7D,IAAI;QACF,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;KAC7D;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,IAAI,EAAE;YACR,OAAO,EAAE,CAAC;SACX;aAAM;YACL,MAAM,GAAG,CAAC;SACX;KACF;AACH,CAAC;AAVD,0CAUC"}
|
||||
149
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.d.ts
generated
vendored
Normal file
149
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.d.ts
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { BuildType, IRebuilder, RebuildMode } from './types';
|
||||
import { ModuleType } from './module-walker';
|
||||
export interface RebuildOptions {
|
||||
/**
|
||||
* The path to the `node_modules` directory to rebuild.
|
||||
*/
|
||||
buildPath: string;
|
||||
/**
|
||||
* The version of Electron to build against.
|
||||
*/
|
||||
electronVersion: string;
|
||||
/**
|
||||
* Override the target platform to something other than the host system platform.
|
||||
* Note: This only applies to downloading prebuilt binaries. **It is not possible to cross-compile native modules.**
|
||||
*
|
||||
* @defaultValue The system {@link https://nodejs.org/api/process.html#processplatform | `process.platform`} value
|
||||
*/
|
||||
platform?: NodeJS.Platform;
|
||||
/**
|
||||
* Override the target rebuild architecture to something other than the host system architecture.
|
||||
*
|
||||
* @defaultValue The system {@link https://nodejs.org/api/process.html#processarch | `process.arch`} value
|
||||
*/
|
||||
arch?: string;
|
||||
/**
|
||||
* An array of module names to rebuild in addition to detected modules
|
||||
* @default []
|
||||
*/
|
||||
extraModules?: string[];
|
||||
/**
|
||||
* An array of module names to rebuild. **Only** these modules will be rebuilt.
|
||||
*/
|
||||
onlyModules?: string[] | null;
|
||||
/**
|
||||
* Force a rebuild of modules regardless of their current build state.
|
||||
*/
|
||||
force?: boolean;
|
||||
/**
|
||||
* URL to download Electron header files from.
|
||||
* @defaultValue `https://www.electronjs.org/headers`
|
||||
*/
|
||||
headerURL?: string;
|
||||
/**
|
||||
* Array of types of dependencies to rebuild. Possible values are `prod`, `dev`, and `optional`.
|
||||
*
|
||||
* @defaultValue `['prod', 'optional']`
|
||||
*/
|
||||
types?: ModuleType[];
|
||||
/**
|
||||
* Whether to rebuild modules sequentially or in parallel.
|
||||
*
|
||||
* @defaultValue `sequential`
|
||||
*/
|
||||
mode?: RebuildMode;
|
||||
/**
|
||||
* Rebuilds a Debug build of target modules. If this is `false`, a Release build will be generated instead.
|
||||
*
|
||||
* @defaultValue false
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Enables hash-based caching to speed up local rebuilds.
|
||||
*
|
||||
* @experimental
|
||||
* @defaultValue false
|
||||
*/
|
||||
useCache?: boolean;
|
||||
/**
|
||||
* Whether to use the `clang` executable that Electron uses when building.
|
||||
* This will guarantee compiler compatibility.
|
||||
*
|
||||
* @defaultValue false
|
||||
*/
|
||||
useElectronClang?: boolean;
|
||||
/**
|
||||
* Sets a custom cache path for the {@link useCache} option.
|
||||
* @experimental
|
||||
* @defaultValue a `.electron-rebuild-cache` folder in the `os.homedir()` directory
|
||||
*/
|
||||
cachePath?: string;
|
||||
/**
|
||||
* GitHub tag prefix passed to {@link https://www.npmjs.com/package/prebuild-install | `prebuild-install`}.
|
||||
* @defaultValue `v`
|
||||
*/
|
||||
prebuildTagPrefix?: string;
|
||||
/**
|
||||
* Path to the root of the project if using npm or yarn workspaces.
|
||||
*/
|
||||
projectRootPath?: string;
|
||||
/**
|
||||
* Override the Application Binary Interface (ABI) version for the version of Electron you are targeting.
|
||||
* Only use when targeting nightly releases.
|
||||
*
|
||||
* @see the {@link https://github.com/electron/node-abi | electron/node-abi} repository for a list of Electron and Node.js ABIs
|
||||
*/
|
||||
forceABI?: number;
|
||||
/**
|
||||
* Disables the copying of `.node` files if not needed.
|
||||
* @defaultValue false
|
||||
*/
|
||||
disablePreGypCopy?: boolean;
|
||||
/**
|
||||
* Skip prebuild download and rebuild module from source.
|
||||
*
|
||||
* @defaultValue false
|
||||
*/
|
||||
buildFromSource?: boolean;
|
||||
/**
|
||||
* Array of module names to ignore during the rebuild process.
|
||||
*/
|
||||
ignoreModules?: string[];
|
||||
}
|
||||
export interface RebuilderOptions extends RebuildOptions {
|
||||
lifecycle: EventEmitter;
|
||||
}
|
||||
export declare class Rebuilder implements IRebuilder {
|
||||
private ABIVersion;
|
||||
private moduleWalker;
|
||||
nodeGypPath: string;
|
||||
rebuilds: (() => Promise<void>)[];
|
||||
lifecycle: EventEmitter;
|
||||
buildPath: string;
|
||||
electronVersion: string;
|
||||
platform: NodeJS.Platform;
|
||||
arch: string;
|
||||
force: boolean;
|
||||
headerURL: string;
|
||||
mode: RebuildMode;
|
||||
debug: boolean;
|
||||
useCache: boolean;
|
||||
cachePath: string;
|
||||
prebuildTagPrefix: string;
|
||||
msvsVersion?: string;
|
||||
useElectronClang: boolean;
|
||||
disablePreGypCopy: boolean;
|
||||
buildFromSource: boolean;
|
||||
ignoreModules: string[];
|
||||
constructor(options: RebuilderOptions);
|
||||
get ABI(): string;
|
||||
get buildType(): BuildType;
|
||||
rebuild(): Promise<void>;
|
||||
rebuildModuleAt(modulePath: string): Promise<void>;
|
||||
}
|
||||
export declare type RebuildResult = Promise<void> & {
|
||||
lifecycle: EventEmitter;
|
||||
};
|
||||
export declare function rebuild(options: RebuildOptions): RebuildResult;
|
||||
182
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.js
generated
vendored
Normal file
182
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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.rebuild = exports.Rebuilder = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const events_1 = require("events");
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const nodeAbi = __importStar(require("node-abi"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const cache_1 = require("./cache");
|
||||
const types_1 = require("./types");
|
||||
const module_rebuilder_1 = require("./module-rebuilder");
|
||||
const module_walker_1 = require("./module-walker");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
const defaultMode = 'sequential';
|
||||
const defaultTypes = ['prod', 'optional'];
|
||||
class Rebuilder {
|
||||
constructor(options) {
|
||||
var _a;
|
||||
this.lifecycle = options.lifecycle;
|
||||
this.buildPath = options.buildPath;
|
||||
this.electronVersion = options.electronVersion;
|
||||
this.platform = options.platform || process.platform;
|
||||
this.arch = options.arch || process.arch;
|
||||
this.force = options.force || false;
|
||||
this.headerURL = options.headerURL || 'https://www.electronjs.org/headers';
|
||||
this.mode = options.mode || defaultMode;
|
||||
this.debug = options.debug || false;
|
||||
this.useCache = options.useCache || false;
|
||||
this.useElectronClang = options.useElectronClang || false;
|
||||
this.cachePath = options.cachePath || path.resolve(os.homedir(), '.electron-rebuild-cache');
|
||||
this.prebuildTagPrefix = options.prebuildTagPrefix || 'v';
|
||||
this.msvsVersion = process.env.GYP_MSVS_VERSION;
|
||||
this.disablePreGypCopy = options.disablePreGypCopy || false;
|
||||
this.buildFromSource = options.buildFromSource || false;
|
||||
this.ignoreModules = options.ignoreModules || [];
|
||||
d('ignoreModules', this.ignoreModules);
|
||||
if (this.useCache && this.force) {
|
||||
console.warn('[WARNING]: Electron Rebuild has force enabled and cache enabled, force take precedence and the cache will not be used.');
|
||||
this.useCache = false;
|
||||
}
|
||||
if (typeof this.electronVersion === 'number') {
|
||||
if (`${this.electronVersion}`.split('.').length === 1) {
|
||||
this.electronVersion = `${this.electronVersion}.0.0`;
|
||||
}
|
||||
else {
|
||||
this.electronVersion = `${this.electronVersion}.0`;
|
||||
}
|
||||
}
|
||||
if (typeof this.electronVersion !== 'string') {
|
||||
throw new Error(`Expected a string version for electron version, got a "${typeof this.electronVersion}"`);
|
||||
}
|
||||
this.ABIVersion = (_a = options.forceABI) === null || _a === void 0 ? void 0 : _a.toString();
|
||||
const onlyModules = options.onlyModules || null;
|
||||
const extraModules = (options.extraModules || []).reduce((acc, x) => acc.add(x), new Set());
|
||||
const types = options.types || defaultTypes;
|
||||
this.moduleWalker = new module_walker_1.ModuleWalker(this.buildPath, options.projectRootPath, types, extraModules, onlyModules);
|
||||
this.rebuilds = [];
|
||||
d('rebuilding with args:', this.buildPath, this.electronVersion, this.platform, this.arch, extraModules, this.force, this.headerURL, types, this.debug);
|
||||
}
|
||||
get ABI() {
|
||||
if (this.ABIVersion === undefined) {
|
||||
this.ABIVersion = nodeAbi.getAbi(this.electronVersion, 'electron');
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return this.ABIVersion;
|
||||
}
|
||||
get buildType() {
|
||||
return this.debug ? types_1.BuildType.Debug : types_1.BuildType.Release;
|
||||
}
|
||||
async rebuild() {
|
||||
if (!path.isAbsolute(this.buildPath)) {
|
||||
throw new Error('Expected buildPath to be an absolute path');
|
||||
}
|
||||
this.lifecycle.emit('start');
|
||||
await this.moduleWalker.walkModules();
|
||||
for (const nodeModulesPath of await this.moduleWalker.nodeModulesPaths) {
|
||||
await this.moduleWalker.findAllModulesIn(nodeModulesPath);
|
||||
}
|
||||
for (const modulePath of this.moduleWalker.modulesToRebuild) {
|
||||
this.rebuilds.push(() => this.rebuildModuleAt(modulePath));
|
||||
}
|
||||
this.rebuilds.push(() => this.rebuildModuleAt(this.buildPath));
|
||||
if (this.mode !== 'sequential') {
|
||||
await Promise.all(this.rebuilds.map(fn => fn()));
|
||||
}
|
||||
else {
|
||||
for (const rebuildFn of this.rebuilds) {
|
||||
await rebuildFn();
|
||||
}
|
||||
}
|
||||
}
|
||||
async rebuildModuleAt(modulePath) {
|
||||
if (!(await fs.pathExists(path.resolve(modulePath, 'binding.gyp')))) {
|
||||
return;
|
||||
}
|
||||
const moduleRebuilder = new module_rebuilder_1.ModuleRebuilder(this, modulePath);
|
||||
let moduleName = path.basename(modulePath);
|
||||
const parentName = path.basename(path.dirname(modulePath));
|
||||
if (parentName !== 'node_modules') {
|
||||
moduleName = `${parentName}/${moduleName}`;
|
||||
}
|
||||
this.lifecycle.emit('module-found', moduleName);
|
||||
if (!this.force && await moduleRebuilder.alreadyBuiltByRebuild()) {
|
||||
d(`skipping: ${moduleName} as it is already built`);
|
||||
this.lifecycle.emit('module-done', moduleName);
|
||||
this.lifecycle.emit('module-skip', moduleName);
|
||||
return;
|
||||
}
|
||||
d('checking', moduleName, 'against', this.ignoreModules);
|
||||
if (this.ignoreModules.includes(moduleName)) {
|
||||
d(`skipping: ${moduleName} as it is in the ignoreModules array`);
|
||||
this.lifecycle.emit('module-done', moduleName);
|
||||
this.lifecycle.emit('module-skip', moduleName);
|
||||
return;
|
||||
}
|
||||
if (await moduleRebuilder.prebuildInstallNativeModuleExists()) {
|
||||
d(`skipping: ${moduleName} as it was prebuilt`);
|
||||
return;
|
||||
}
|
||||
let cacheKey;
|
||||
if (this.useCache) {
|
||||
cacheKey = await (0, cache_1.generateCacheKey)({
|
||||
ABI: this.ABI,
|
||||
arch: this.arch,
|
||||
platform: this.platform,
|
||||
debug: this.debug,
|
||||
electronVersion: this.electronVersion,
|
||||
headerURL: this.headerURL,
|
||||
modulePath,
|
||||
});
|
||||
const applyDiffFn = await (0, cache_1.lookupModuleState)(this.cachePath, cacheKey);
|
||||
if (typeof applyDiffFn === 'function') {
|
||||
await applyDiffFn(modulePath);
|
||||
this.lifecycle.emit('module-done', moduleName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (await moduleRebuilder.rebuild(cacheKey)) {
|
||||
this.lifecycle.emit('module-done', moduleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Rebuilder = Rebuilder;
|
||||
function rebuild(options) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
d('rebuilding with args:', arguments);
|
||||
const lifecycle = new events_1.EventEmitter();
|
||||
const rebuilderOptions = { ...options, lifecycle };
|
||||
const rebuilder = new Rebuilder(rebuilderOptions);
|
||||
const ret = rebuilder.rebuild();
|
||||
ret.lifecycle = lifecycle;
|
||||
return ret;
|
||||
}
|
||||
exports.rebuild = rebuild;
|
||||
//# sourceMappingURL=rebuild.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/rebuild.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
23
desktop-operator/node_modules/@electron/rebuild/lib/search-module.d.ts
generated
vendored
Normal file
23
desktop-operator/node_modules/@electron/rebuild/lib/search-module.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Find all instances of a given module in node_modules subdirectories while traversing up
|
||||
* ancestor directories.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
* @param moduleName the Node module name (should work for scoped modules as well)
|
||||
* @param rootPath the project's root path. If provided, the traversal will stop at this path.
|
||||
*/
|
||||
export declare function searchForModule(cwd: string, moduleName: string, rootPath?: string): Promise<string[]>;
|
||||
/**
|
||||
* Find all instances of node_modules subdirectories while traversing up ancestor directories.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
* @param rootPath the project's root path. If provided, the traversal will stop at this path.
|
||||
*/
|
||||
export declare function searchForNodeModules(cwd: string, rootPath?: string): Promise<string[]>;
|
||||
/**
|
||||
* Determine the root directory of a given project, by looking for a directory with an
|
||||
* NPM or yarn lockfile or pnpm lockfile.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
*/
|
||||
export declare function getProjectRootPath(cwd: string): Promise<string>;
|
||||
97
desktop-operator/node_modules/@electron/rebuild/lib/search-module.js
generated
vendored
Normal file
97
desktop-operator/node_modules/@electron/rebuild/lib/search-module.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getProjectRootPath = exports.searchForNodeModules = exports.searchForModule = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
async function shouldContinueSearch(traversedPath, rootPath, stopAtPackageJSON) {
|
||||
if (rootPath) {
|
||||
return Promise.resolve(traversedPath !== path.dirname(rootPath));
|
||||
}
|
||||
else if (stopAtPackageJSON) {
|
||||
return fs.pathExists(path.join(traversedPath, 'package.json'));
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
async function traverseAncestorDirectories(cwd, pathGenerator, rootPath, maxItems, stopAtPackageJSON) {
|
||||
const paths = [];
|
||||
let traversedPath = path.resolve(cwd);
|
||||
while (await shouldContinueSearch(traversedPath, rootPath, stopAtPackageJSON)) {
|
||||
const generatedPath = pathGenerator(traversedPath);
|
||||
if (await fs.pathExists(generatedPath)) {
|
||||
paths.push(generatedPath);
|
||||
}
|
||||
const parentPath = path.dirname(traversedPath);
|
||||
if (parentPath === traversedPath || (maxItems && paths.length >= maxItems)) {
|
||||
break;
|
||||
}
|
||||
traversedPath = parentPath;
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
/**
|
||||
* Find all instances of a given module in node_modules subdirectories while traversing up
|
||||
* ancestor directories.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
* @param moduleName the Node module name (should work for scoped modules as well)
|
||||
* @param rootPath the project's root path. If provided, the traversal will stop at this path.
|
||||
*/
|
||||
async function searchForModule(cwd, moduleName, rootPath) {
|
||||
const pathGenerator = (traversedPath) => path.join(traversedPath, 'node_modules', moduleName);
|
||||
return traverseAncestorDirectories(cwd, pathGenerator, rootPath, undefined, true);
|
||||
}
|
||||
exports.searchForModule = searchForModule;
|
||||
/**
|
||||
* Find all instances of node_modules subdirectories while traversing up ancestor directories.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
* @param rootPath the project's root path. If provided, the traversal will stop at this path.
|
||||
*/
|
||||
async function searchForNodeModules(cwd, rootPath) {
|
||||
const pathGenerator = (traversedPath) => path.join(traversedPath, 'node_modules');
|
||||
return traverseAncestorDirectories(cwd, pathGenerator, rootPath, undefined, true);
|
||||
}
|
||||
exports.searchForNodeModules = searchForNodeModules;
|
||||
/**
|
||||
* Determine the root directory of a given project, by looking for a directory with an
|
||||
* NPM or yarn lockfile or pnpm lockfile.
|
||||
*
|
||||
* @param cwd the initial directory to traverse
|
||||
*/
|
||||
async function getProjectRootPath(cwd) {
|
||||
for (const lockFilename of ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml']) {
|
||||
const pathGenerator = (traversedPath) => path.join(traversedPath, lockFilename);
|
||||
const lockPaths = await traverseAncestorDirectories(cwd, pathGenerator, undefined, 1);
|
||||
if (lockPaths.length > 0) {
|
||||
return path.dirname(lockPaths[0]);
|
||||
}
|
||||
}
|
||||
return cwd;
|
||||
}
|
||||
exports.getProjectRootPath = getProjectRootPath;
|
||||
//# sourceMappingURL=search-module.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/search-module.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/search-module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"search-module.js","sourceRoot":"","sources":["../src/search-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAE7B,KAAK,UAAU,oBAAoB,CAAC,aAAqB,EAAE,QAAiB,EAAE,iBAA2B;IACvG,IAAI,QAAQ,EAAE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Q,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACpF,CAAC;AAPD,0CAOC;AAED;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,QAAiB;IACvE,MAAM,aAAa,GAA0B,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IACzG,OAAO,2BAA2B,CAAC,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACpF,CAAC;AAHD,oDAGC;AAED;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CAAC,GAAW;IAClD,KAAK,MAAM,YAAY,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,EAAE;QAC/E,MAAM,aAAa,GAA0B,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QACvG,MAAM,SAAS,GAAG,MAAM,2BAA2B,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QACtF,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SACnC;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,gDAUC"}
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.d.ts
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function downloadLinuxSysroot(electronVersion: string, targetArch: string): Promise<string>;
|
||||
70
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.js
generated
vendored
Normal file
70
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (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.downloadLinuxSysroot = void 0;
|
||||
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
||||
const crypto = __importStar(require("crypto"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const path = __importStar(require("path"));
|
||||
const constants_1 = require("./constants");
|
||||
const fetcher_1 = require("./fetcher");
|
||||
const d = (0, debug_1.default)('electron-rebuild');
|
||||
const sysrootArchAliases = {
|
||||
x64: 'amd64',
|
||||
ia32: 'i386',
|
||||
};
|
||||
const SYSROOT_BASE_URL = 'https://dev-cdn.electronjs.org/linux-sysroots';
|
||||
async function downloadLinuxSysroot(electronVersion, targetArch) {
|
||||
d('fetching sysroot for Electron:', electronVersion);
|
||||
const sysrootDir = path.resolve(constants_1.ELECTRON_GYP_DIR, `${electronVersion}-sysroot`);
|
||||
if (await fs.pathExists(path.resolve(sysrootDir, 'lib')))
|
||||
return sysrootDir;
|
||||
if (!await fs.pathExists(sysrootDir))
|
||||
await fs.mkdirp(sysrootDir);
|
||||
const linuxArch = sysrootArchAliases[targetArch] || targetArch;
|
||||
const electronSysroots = JSON.parse(await (0, fetcher_1.fetch)(`https://raw.githubusercontent.com/electron/electron/v${electronVersion}/script/sysroots.json`, 'text'));
|
||||
const { Sha1Sum: sha, Tarball: fileName } = electronSysroots[`sid_${linuxArch}`] || electronSysroots[`bullseye_${linuxArch}`];
|
||||
const sysrootURL = `${SYSROOT_BASE_URL}/${sha}/${fileName}`;
|
||||
const sysrootBuffer = await (0, fetcher_1.fetch)(sysrootURL, 'buffer');
|
||||
const actualSha = crypto.createHash('SHA1').update(sysrootBuffer).digest('hex');
|
||||
d('expected sha:', sha);
|
||||
d('actual sha:', actualSha);
|
||||
if (sha !== actualSha)
|
||||
throw new Error(`Attempted to download the linux sysroot for ${electronVersion} but the SHA checksum did not match`);
|
||||
d('writing sysroot to disk');
|
||||
const tmpTarFile = path.resolve(constants_1.ELECTRON_GYP_DIR, `${electronVersion}-${fileName}`);
|
||||
if (await fs.pathExists(tmpTarFile))
|
||||
await fs.remove(tmpTarFile);
|
||||
await fs.writeFile(tmpTarFile, sysrootBuffer);
|
||||
d('decompressing sysroot');
|
||||
await (0, cross_spawn_promise_1.spawn)('tar', ['-xf', tmpTarFile, '-C', sysrootDir], { stdio: 'ignore' });
|
||||
return sysrootDir;
|
||||
}
|
||||
exports.downloadLinuxSysroot = downloadLinuxSysroot;
|
||||
//# sourceMappingURL=sysroot-fetcher.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/sysroot-fetcher.js.map
generated
vendored
Normal file
@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M,UAAU,GAAG,GAAG,gBAAgB,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5D,MAAM,aAAa,GAAG,MAAM,IAAA,eAAK,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAExD,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC5B,IAAI,GAAG,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,eAAe,qCAAqC,CAAC,CAAC;IAE5I,CAAC,CAAC,yBAAyB,CAAC,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,4BAAgB,EAAE,GAAG,eAAe,IAAI,QAAQ,EAAE,CAAC,CAAC;IACpF,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjE,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAE9C,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC3B,MAAM,IAAA,2BAAK,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE/E,OAAO,UAAU,CAAC;AACpB,CAAC;AA3BD,oDA2BC"}
|
||||
27
desktop-operator/node_modules/@electron/rebuild/lib/types.d.ts
generated
vendored
Normal file
27
desktop-operator/node_modules/@electron/rebuild/lib/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
export declare enum BuildType {
|
||||
Debug = "Debug",
|
||||
Release = "Release"
|
||||
}
|
||||
export declare type RebuildMode = 'sequential' | 'parallel';
|
||||
export interface IRebuilder {
|
||||
ABI: string;
|
||||
arch: string;
|
||||
buildPath: string;
|
||||
buildType: BuildType;
|
||||
cachePath: string;
|
||||
debug: boolean;
|
||||
disablePreGypCopy: boolean;
|
||||
electronVersion: string;
|
||||
force: boolean;
|
||||
headerURL: string;
|
||||
lifecycle: EventEmitter;
|
||||
mode: RebuildMode;
|
||||
msvsVersion?: string;
|
||||
platform: NodeJS.Platform;
|
||||
prebuildTagPrefix: string;
|
||||
buildFromSource: boolean;
|
||||
useCache: boolean;
|
||||
useElectronClang: boolean;
|
||||
}
|
||||
9
desktop-operator/node_modules/@electron/rebuild/lib/types.js
generated
vendored
Normal file
9
desktop-operator/node_modules/@electron/rebuild/lib/types.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BuildType = void 0;
|
||||
var BuildType;
|
||||
(function (BuildType) {
|
||||
BuildType["Debug"] = "Debug";
|
||||
BuildType["Release"] = "Release";
|
||||
})(BuildType = exports.BuildType || (exports.BuildType = {}));
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
desktop-operator/node_modules/@electron/rebuild/lib/types.js.map
generated
vendored
Normal file
1
desktop-operator/node_modules/@electron/rebuild/lib/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,gCAAmB,CAAA;AACrB,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
|
||||
1
desktop-operator/node_modules/@electron/rebuild/node_modules/.bin/semver
generated
vendored
Symbolic link
1
desktop-operator/node_modules/@electron/rebuild/node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
15
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/LICENSE
generated
vendored
Normal file
15
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011-2017 JP Richardson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
|
||||
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
262
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/README.md
generated
vendored
Normal file
262
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/README.md
generated
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
Node.js: fs-extra
|
||||
=================
|
||||
|
||||
`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`.
|
||||
|
||||
[](https://www.npmjs.org/package/fs-extra)
|
||||
[](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)
|
||||
[](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)
|
||||
[](https://www.npmjs.org/package/fs-extra)
|
||||
[](https://standardjs.com)
|
||||
|
||||
Why?
|
||||
----
|
||||
|
||||
I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects.
|
||||
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
npm install fs-extra
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.
|
||||
|
||||
You don't ever need to include the original `fs` module again:
|
||||
|
||||
```js
|
||||
const fs = require('fs') // this is no longer necessary
|
||||
```
|
||||
|
||||
you can now do this:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
```
|
||||
|
||||
or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want
|
||||
to name your `fs` variable `fse` like so:
|
||||
|
||||
```js
|
||||
const fse = require('fs-extra')
|
||||
```
|
||||
|
||||
you can also keep both, but it's redundant:
|
||||
|
||||
```js
|
||||
const fs = require('fs')
|
||||
const fse = require('fs-extra')
|
||||
```
|
||||
|
||||
Sync vs Async vs Async/Await
|
||||
-------------
|
||||
Most methods are async by default. All async methods will return a promise if the callback isn't passed.
|
||||
|
||||
Sync methods on the other hand will throw if an error occurs.
|
||||
|
||||
Also Async/Await will throw an error if one occurs.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// Async with promises:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => console.log('success!'))
|
||||
.catch(err => console.error(err))
|
||||
|
||||
// Async with callbacks:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
|
||||
if (err) return console.error(err)
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// Sync:
|
||||
try {
|
||||
fs.copySync('/tmp/myfile', '/tmp/mynewfile')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
// Async/Await:
|
||||
async function copyFiles () {
|
||||
try {
|
||||
await fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
copyFiles()
|
||||
```
|
||||
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
### Async
|
||||
|
||||
- [copy](docs/copy.md)
|
||||
- [emptyDir](docs/emptyDir.md)
|
||||
- [ensureFile](docs/ensureFile.md)
|
||||
- [ensureDir](docs/ensureDir.md)
|
||||
- [ensureLink](docs/ensureLink.md)
|
||||
- [ensureSymlink](docs/ensureSymlink.md)
|
||||
- [mkdirp](docs/ensureDir.md)
|
||||
- [mkdirs](docs/ensureDir.md)
|
||||
- [move](docs/move.md)
|
||||
- [outputFile](docs/outputFile.md)
|
||||
- [outputJson](docs/outputJson.md)
|
||||
- [pathExists](docs/pathExists.md)
|
||||
- [readJson](docs/readJson.md)
|
||||
- [remove](docs/remove.md)
|
||||
- [writeJson](docs/writeJson.md)
|
||||
|
||||
### Sync
|
||||
|
||||
- [copySync](docs/copy-sync.md)
|
||||
- [emptyDirSync](docs/emptyDir-sync.md)
|
||||
- [ensureFileSync](docs/ensureFile-sync.md)
|
||||
- [ensureDirSync](docs/ensureDir-sync.md)
|
||||
- [ensureLinkSync](docs/ensureLink-sync.md)
|
||||
- [ensureSymlinkSync](docs/ensureSymlink-sync.md)
|
||||
- [mkdirpSync](docs/ensureDir-sync.md)
|
||||
- [mkdirsSync](docs/ensureDir-sync.md)
|
||||
- [moveSync](docs/move-sync.md)
|
||||
- [outputFileSync](docs/outputFile-sync.md)
|
||||
- [outputJsonSync](docs/outputJson-sync.md)
|
||||
- [pathExistsSync](docs/pathExists-sync.md)
|
||||
- [readJsonSync](docs/readJson-sync.md)
|
||||
- [removeSync](docs/remove-sync.md)
|
||||
- [writeJsonSync](docs/writeJson-sync.md)
|
||||
|
||||
|
||||
**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md)
|
||||
|
||||
### What happened to `walk()` and `walkSync()`?
|
||||
|
||||
They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync).
|
||||
|
||||
|
||||
Third Party
|
||||
-----------
|
||||
|
||||
### CLI
|
||||
|
||||
[fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts.
|
||||
|
||||
### TypeScript
|
||||
|
||||
If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra
|
||||
|
||||
|
||||
### File / Directory Watching
|
||||
|
||||
If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar).
|
||||
|
||||
### Obtain Filesystem (Devices, Partitions) Information
|
||||
|
||||
[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system.
|
||||
|
||||
### Misc.
|
||||
|
||||
- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug).
|
||||
- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls.
|
||||
|
||||
|
||||
|
||||
Hacking on fs-extra
|
||||
-------------------
|
||||
|
||||
Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project
|
||||
uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you,
|
||||
you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`.
|
||||
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
What's needed?
|
||||
- First, take a look at existing issues. Those are probably going to be where the priority lies.
|
||||
- More tests for edge cases. Specifically on different platforms. There can never be enough tests.
|
||||
- Improve test coverage.
|
||||
|
||||
Note: If you make any big changes, **you should definitely file an issue for discussion first.**
|
||||
|
||||
### Running the Test Suite
|
||||
|
||||
fs-extra contains hundreds of tests.
|
||||
|
||||
- `npm run lint`: runs the linter ([standard](http://standardjs.com/))
|
||||
- `npm run unit`: runs the unit tests
|
||||
- `npm test`: runs both the linter and the tests
|
||||
|
||||
|
||||
### Windows
|
||||
|
||||
If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's
|
||||
because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
|
||||
account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
|
||||
However, I didn't have much luck doing this.
|
||||
|
||||
Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.
|
||||
I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command:
|
||||
|
||||
net use z: "\\vmware-host\Shared Folders"
|
||||
|
||||
I can then navigate to my `fs-extra` directory and run the tests.
|
||||
|
||||
|
||||
Naming
|
||||
------
|
||||
|
||||
I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:
|
||||
|
||||
* https://github.com/jprichardson/node-fs-extra/issues/2
|
||||
* https://github.com/flatiron/utile/issues/11
|
||||
* https://github.com/ryanmcgrath/wrench-js/issues/29
|
||||
* https://github.com/substack/node-mkdirp/issues/17
|
||||
|
||||
First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes.
|
||||
|
||||
For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc.
|
||||
|
||||
We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`?
|
||||
|
||||
My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.
|
||||
|
||||
So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.
|
||||
|
||||
|
||||
Credit
|
||||
------
|
||||
|
||||
`fs-extra` wouldn't be possible without using the modules from the following authors:
|
||||
|
||||
- [Isaac Shlueter](https://github.com/isaacs)
|
||||
- [Charlie McConnel](https://github.com/avianflu)
|
||||
- [James Halliday](https://github.com/substack)
|
||||
- [Andrew Kelley](https://github.com/andrewrk)
|
||||
|
||||
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Licensed under MIT
|
||||
|
||||
Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson)
|
||||
|
||||
[1]: http://nodejs.org/docs/latest/api/fs.html
|
||||
|
||||
|
||||
[jsonfile]: https://github.com/jprichardson/node-jsonfile
|
||||
169
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/copy-sync.js
generated
vendored
Normal file
169
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/copy-sync.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdirsSync = require('../mkdirs').mkdirsSync
|
||||
const utimesMillisSync = require('../util/utimes').utimesMillisSync
|
||||
const stat = require('../util/stat')
|
||||
|
||||
function copySync (src, dest, opts) {
|
||||
if (typeof opts === 'function') {
|
||||
opts = { filter: opts }
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
||||
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
||||
|
||||
// Warn about using preserveTimestamps on 32-bit node
|
||||
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
||||
process.emitWarning(
|
||||
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
||||
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
||||
'Warning', 'fs-extra-WARN0002'
|
||||
)
|
||||
}
|
||||
|
||||
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
|
||||
stat.checkParentPathsSync(src, srcStat, dest, 'copy')
|
||||
return handleFilterAndCopy(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
function handleFilterAndCopy (destStat, src, dest, opts) {
|
||||
if (opts.filter && !opts.filter(src, dest)) return
|
||||
const destParent = path.dirname(dest)
|
||||
if (!fs.existsSync(destParent)) mkdirsSync(destParent)
|
||||
return getStats(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
function startCopy (destStat, src, dest, opts) {
|
||||
if (opts.filter && !opts.filter(src, dest)) return
|
||||
return getStats(destStat, src, dest, opts)
|
||||
}
|
||||
|
||||
function getStats (destStat, src, dest, opts) {
|
||||
const statSync = opts.dereference ? fs.statSync : fs.lstatSync
|
||||
const srcStat = statSync(src)
|
||||
|
||||
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
|
||||
else if (srcStat.isFile() ||
|
||||
srcStat.isCharacterDevice() ||
|
||||
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
|
||||
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
|
||||
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
|
||||
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
|
||||
throw new Error(`Unknown file: ${src}`)
|
||||
}
|
||||
|
||||
function onFile (srcStat, destStat, src, dest, opts) {
|
||||
if (!destStat) return copyFile(srcStat, src, dest, opts)
|
||||
return mayCopyFile(srcStat, src, dest, opts)
|
||||
}
|
||||
|
||||
function mayCopyFile (srcStat, src, dest, opts) {
|
||||
if (opts.overwrite) {
|
||||
fs.unlinkSync(dest)
|
||||
return copyFile(srcStat, src, dest, opts)
|
||||
} else if (opts.errorOnExist) {
|
||||
throw new Error(`'${dest}' already exists`)
|
||||
}
|
||||
}
|
||||
|
||||
function copyFile (srcStat, src, dest, opts) {
|
||||
fs.copyFileSync(src, dest)
|
||||
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
|
||||
return setDestMode(dest, srcStat.mode)
|
||||
}
|
||||
|
||||
function handleTimestamps (srcMode, src, dest) {
|
||||
// Make sure the file is writable before setting the timestamp
|
||||
// otherwise open fails with EPERM when invoked with 'r+'
|
||||
// (through utimes call)
|
||||
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
|
||||
return setDestTimestamps(src, dest)
|
||||
}
|
||||
|
||||
function fileIsNotWritable (srcMode) {
|
||||
return (srcMode & 0o200) === 0
|
||||
}
|
||||
|
||||
function makeFileWritable (dest, srcMode) {
|
||||
return setDestMode(dest, srcMode | 0o200)
|
||||
}
|
||||
|
||||
function setDestMode (dest, srcMode) {
|
||||
return fs.chmodSync(dest, srcMode)
|
||||
}
|
||||
|
||||
function setDestTimestamps (src, dest) {
|
||||
// The initial srcStat.atime cannot be trusted
|
||||
// because it is modified by the read(2) system call
|
||||
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
||||
const updatedSrcStat = fs.statSync(src)
|
||||
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
||||
}
|
||||
|
||||
function onDir (srcStat, destStat, src, dest, opts) {
|
||||
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
|
||||
return copyDir(src, dest, opts)
|
||||
}
|
||||
|
||||
function mkDirAndCopy (srcMode, src, dest, opts) {
|
||||
fs.mkdirSync(dest)
|
||||
copyDir(src, dest, opts)
|
||||
return setDestMode(dest, srcMode)
|
||||
}
|
||||
|
||||
function copyDir (src, dest, opts) {
|
||||
fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
|
||||
}
|
||||
|
||||
function copyDirItem (item, src, dest, opts) {
|
||||
const srcItem = path.join(src, item)
|
||||
const destItem = path.join(dest, item)
|
||||
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
|
||||
return startCopy(destStat, srcItem, destItem, opts)
|
||||
}
|
||||
|
||||
function onLink (destStat, src, dest, opts) {
|
||||
let resolvedSrc = fs.readlinkSync(src)
|
||||
if (opts.dereference) {
|
||||
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
||||
}
|
||||
|
||||
if (!destStat) {
|
||||
return fs.symlinkSync(resolvedSrc, dest)
|
||||
} else {
|
||||
let resolvedDest
|
||||
try {
|
||||
resolvedDest = fs.readlinkSync(dest)
|
||||
} catch (err) {
|
||||
// dest exists and is a regular file or directory,
|
||||
// Windows may throw UNKNOWN error. If dest already exists,
|
||||
// fs throws error anyway, so no need to guard against it here.
|
||||
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
|
||||
throw err
|
||||
}
|
||||
if (opts.dereference) {
|
||||
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
||||
}
|
||||
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
||||
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
|
||||
}
|
||||
|
||||
// prevent copy if src is a subdir of dest since unlinking
|
||||
// dest in this case would result in removing src contents
|
||||
// and therefore a broken symlink would be created.
|
||||
if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
||||
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
|
||||
}
|
||||
return copyLink(resolvedSrc, dest)
|
||||
}
|
||||
}
|
||||
|
||||
function copyLink (resolvedSrc, dest) {
|
||||
fs.unlinkSync(dest)
|
||||
return fs.symlinkSync(resolvedSrc, dest)
|
||||
}
|
||||
|
||||
module.exports = copySync
|
||||
235
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/copy.js
generated
vendored
Normal file
235
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/copy.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdirs = require('../mkdirs').mkdirs
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const utimesMillis = require('../util/utimes').utimesMillis
|
||||
const stat = require('../util/stat')
|
||||
|
||||
function copy (src, dest, opts, cb) {
|
||||
if (typeof opts === 'function' && !cb) {
|
||||
cb = opts
|
||||
opts = {}
|
||||
} else if (typeof opts === 'function') {
|
||||
opts = { filter: opts }
|
||||
}
|
||||
|
||||
cb = cb || function () {}
|
||||
opts = opts || {}
|
||||
|
||||
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
||||
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
||||
|
||||
// Warn about using preserveTimestamps on 32-bit node
|
||||
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
||||
process.emitWarning(
|
||||
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
||||
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
||||
'Warning', 'fs-extra-WARN0001'
|
||||
)
|
||||
}
|
||||
|
||||
stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
|
||||
if (err) return cb(err)
|
||||
const { srcStat, destStat } = stats
|
||||
stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
|
||||
if (err) return cb(err)
|
||||
if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
|
||||
return checkParentDir(destStat, src, dest, opts, cb)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function checkParentDir (destStat, src, dest, opts, cb) {
|
||||
const destParent = path.dirname(dest)
|
||||
pathExists(destParent, (err, dirExists) => {
|
||||
if (err) return cb(err)
|
||||
if (dirExists) return getStats(destStat, src, dest, opts, cb)
|
||||
mkdirs(destParent, err => {
|
||||
if (err) return cb(err)
|
||||
return getStats(destStat, src, dest, opts, cb)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleFilter (onInclude, destStat, src, dest, opts, cb) {
|
||||
Promise.resolve(opts.filter(src, dest)).then(include => {
|
||||
if (include) return onInclude(destStat, src, dest, opts, cb)
|
||||
return cb()
|
||||
}, error => cb(error))
|
||||
}
|
||||
|
||||
function startCopy (destStat, src, dest, opts, cb) {
|
||||
if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb)
|
||||
return getStats(destStat, src, dest, opts, cb)
|
||||
}
|
||||
|
||||
function getStats (destStat, src, dest, opts, cb) {
|
||||
const stat = opts.dereference ? fs.stat : fs.lstat
|
||||
stat(src, (err, srcStat) => {
|
||||
if (err) return cb(err)
|
||||
|
||||
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb)
|
||||
else if (srcStat.isFile() ||
|
||||
srcStat.isCharacterDevice() ||
|
||||
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
|
||||
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
|
||||
else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))
|
||||
else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))
|
||||
return cb(new Error(`Unknown file: ${src}`))
|
||||
})
|
||||
}
|
||||
|
||||
function onFile (srcStat, destStat, src, dest, opts, cb) {
|
||||
if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
|
||||
return mayCopyFile(srcStat, src, dest, opts, cb)
|
||||
}
|
||||
|
||||
function mayCopyFile (srcStat, src, dest, opts, cb) {
|
||||
if (opts.overwrite) {
|
||||
fs.unlink(dest, err => {
|
||||
if (err) return cb(err)
|
||||
return copyFile(srcStat, src, dest, opts, cb)
|
||||
})
|
||||
} else if (opts.errorOnExist) {
|
||||
return cb(new Error(`'${dest}' already exists`))
|
||||
} else return cb()
|
||||
}
|
||||
|
||||
function copyFile (srcStat, src, dest, opts, cb) {
|
||||
fs.copyFile(src, dest, err => {
|
||||
if (err) return cb(err)
|
||||
if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
|
||||
return setDestMode(dest, srcStat.mode, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function handleTimestampsAndMode (srcMode, src, dest, cb) {
|
||||
// Make sure the file is writable before setting the timestamp
|
||||
// otherwise open fails with EPERM when invoked with 'r+'
|
||||
// (through utimes call)
|
||||
if (fileIsNotWritable(srcMode)) {
|
||||
return makeFileWritable(dest, srcMode, err => {
|
||||
if (err) return cb(err)
|
||||
return setDestTimestampsAndMode(srcMode, src, dest, cb)
|
||||
})
|
||||
}
|
||||
return setDestTimestampsAndMode(srcMode, src, dest, cb)
|
||||
}
|
||||
|
||||
function fileIsNotWritable (srcMode) {
|
||||
return (srcMode & 0o200) === 0
|
||||
}
|
||||
|
||||
function makeFileWritable (dest, srcMode, cb) {
|
||||
return setDestMode(dest, srcMode | 0o200, cb)
|
||||
}
|
||||
|
||||
function setDestTimestampsAndMode (srcMode, src, dest, cb) {
|
||||
setDestTimestamps(src, dest, err => {
|
||||
if (err) return cb(err)
|
||||
return setDestMode(dest, srcMode, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function setDestMode (dest, srcMode, cb) {
|
||||
return fs.chmod(dest, srcMode, cb)
|
||||
}
|
||||
|
||||
function setDestTimestamps (src, dest, cb) {
|
||||
// The initial srcStat.atime cannot be trusted
|
||||
// because it is modified by the read(2) system call
|
||||
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
||||
fs.stat(src, (err, updatedSrcStat) => {
|
||||
if (err) return cb(err)
|
||||
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function onDir (srcStat, destStat, src, dest, opts, cb) {
|
||||
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
|
||||
return copyDir(src, dest, opts, cb)
|
||||
}
|
||||
|
||||
function mkDirAndCopy (srcMode, src, dest, opts, cb) {
|
||||
fs.mkdir(dest, err => {
|
||||
if (err) return cb(err)
|
||||
copyDir(src, dest, opts, err => {
|
||||
if (err) return cb(err)
|
||||
return setDestMode(dest, srcMode, cb)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function copyDir (src, dest, opts, cb) {
|
||||
fs.readdir(src, (err, items) => {
|
||||
if (err) return cb(err)
|
||||
return copyDirItems(items, src, dest, opts, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function copyDirItems (items, src, dest, opts, cb) {
|
||||
const item = items.pop()
|
||||
if (!item) return cb()
|
||||
return copyDirItem(items, item, src, dest, opts, cb)
|
||||
}
|
||||
|
||||
function copyDirItem (items, item, src, dest, opts, cb) {
|
||||
const srcItem = path.join(src, item)
|
||||
const destItem = path.join(dest, item)
|
||||
stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
|
||||
if (err) return cb(err)
|
||||
const { destStat } = stats
|
||||
startCopy(destStat, srcItem, destItem, opts, err => {
|
||||
if (err) return cb(err)
|
||||
return copyDirItems(items, src, dest, opts, cb)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function onLink (destStat, src, dest, opts, cb) {
|
||||
fs.readlink(src, (err, resolvedSrc) => {
|
||||
if (err) return cb(err)
|
||||
if (opts.dereference) {
|
||||
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
||||
}
|
||||
|
||||
if (!destStat) {
|
||||
return fs.symlink(resolvedSrc, dest, cb)
|
||||
} else {
|
||||
fs.readlink(dest, (err, resolvedDest) => {
|
||||
if (err) {
|
||||
// dest exists and is a regular file or directory,
|
||||
// Windows may throw UNKNOWN error. If dest already exists,
|
||||
// fs throws error anyway, so no need to guard against it here.
|
||||
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb)
|
||||
return cb(err)
|
||||
}
|
||||
if (opts.dereference) {
|
||||
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
||||
}
|
||||
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
||||
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
|
||||
}
|
||||
|
||||
// do not copy if src is a subdir of dest since unlinking
|
||||
// dest in this case would result in removing src contents
|
||||
// and therefore a broken symlink would be created.
|
||||
if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
||||
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
|
||||
}
|
||||
return copyLink(resolvedSrc, dest, cb)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function copyLink (resolvedSrc, dest, cb) {
|
||||
fs.unlink(dest, err => {
|
||||
if (err) return cb(err)
|
||||
return fs.symlink(resolvedSrc, dest, cb)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = copy
|
||||
7
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/index.js
generated
vendored
Normal file
7
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/copy/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
module.exports = {
|
||||
copy: u(require('./copy')),
|
||||
copySync: require('./copy-sync')
|
||||
}
|
||||
39
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/empty/index.js
generated
vendored
Normal file
39
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/empty/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromPromise
|
||||
const fs = require('../fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const remove = require('../remove')
|
||||
|
||||
const emptyDir = u(async function emptyDir (dir) {
|
||||
let items
|
||||
try {
|
||||
items = await fs.readdir(dir)
|
||||
} catch {
|
||||
return mkdir.mkdirs(dir)
|
||||
}
|
||||
|
||||
return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
|
||||
})
|
||||
|
||||
function emptyDirSync (dir) {
|
||||
let items
|
||||
try {
|
||||
items = fs.readdirSync(dir)
|
||||
} catch {
|
||||
return mkdir.mkdirsSync(dir)
|
||||
}
|
||||
|
||||
items.forEach(item => {
|
||||
item = path.join(dir, item)
|
||||
remove.removeSync(item)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
emptyDirSync,
|
||||
emptydirSync: emptyDirSync,
|
||||
emptyDir,
|
||||
emptydir: emptyDir
|
||||
}
|
||||
69
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/file.js
generated
vendored
Normal file
69
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/file.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
|
||||
function createFile (file, callback) {
|
||||
function makeFile () {
|
||||
fs.writeFile(file, '', err => {
|
||||
if (err) return callback(err)
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err
|
||||
if (!err && stats.isFile()) return callback()
|
||||
const dir = path.dirname(file)
|
||||
fs.stat(dir, (err, stats) => {
|
||||
if (err) {
|
||||
// if the directory doesn't exist, make it
|
||||
if (err.code === 'ENOENT') {
|
||||
return mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
makeFile()
|
||||
})
|
||||
}
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
if (stats.isDirectory()) makeFile()
|
||||
else {
|
||||
// parent is not a directory
|
||||
// This is just to cause an internal ENOTDIR error to be thrown
|
||||
fs.readdir(dir, err => {
|
||||
if (err) return callback(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createFileSync (file) {
|
||||
let stats
|
||||
try {
|
||||
stats = fs.statSync(file)
|
||||
} catch {}
|
||||
if (stats && stats.isFile()) return
|
||||
|
||||
const dir = path.dirname(file)
|
||||
try {
|
||||
if (!fs.statSync(dir).isDirectory()) {
|
||||
// parent is not a directory
|
||||
// This is just to cause an internal ENOTDIR error to be thrown
|
||||
fs.readdirSync(dir)
|
||||
}
|
||||
} catch (err) {
|
||||
// If the stat call above failed because the directory doesn't exist, create it
|
||||
if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
|
||||
else throw err
|
||||
}
|
||||
|
||||
fs.writeFileSync(file, '')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createFile: u(createFile),
|
||||
createFileSync
|
||||
}
|
||||
23
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/index.js
generated
vendored
Normal file
23
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
const { createFile, createFileSync } = require('./file')
|
||||
const { createLink, createLinkSync } = require('./link')
|
||||
const { createSymlink, createSymlinkSync } = require('./symlink')
|
||||
|
||||
module.exports = {
|
||||
// file
|
||||
createFile,
|
||||
createFileSync,
|
||||
ensureFile: createFile,
|
||||
ensureFileSync: createFileSync,
|
||||
// link
|
||||
createLink,
|
||||
createLinkSync,
|
||||
ensureLink: createLink,
|
||||
ensureLinkSync: createLinkSync,
|
||||
// symlink
|
||||
createSymlink,
|
||||
createSymlinkSync,
|
||||
ensureSymlink: createSymlink,
|
||||
ensureSymlinkSync: createSymlinkSync
|
||||
}
|
||||
64
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/link.js
generated
vendored
Normal file
64
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/link.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const { areIdentical } = require('../util/stat')
|
||||
|
||||
function createLink (srcpath, dstpath, callback) {
|
||||
function makeLink (srcpath, dstpath) {
|
||||
fs.link(srcpath, dstpath, err => {
|
||||
if (err) return callback(err)
|
||||
callback(null)
|
||||
})
|
||||
}
|
||||
|
||||
fs.lstat(dstpath, (_, dstStat) => {
|
||||
fs.lstat(srcpath, (err, srcStat) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
return callback(err)
|
||||
}
|
||||
if (dstStat && areIdentical(srcStat, dstStat)) return callback(null)
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeLink(srcpath, dstpath)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
makeLink(srcpath, dstpath)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createLinkSync (srcpath, dstpath) {
|
||||
let dstStat
|
||||
try {
|
||||
dstStat = fs.lstatSync(dstpath)
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
const srcStat = fs.lstatSync(srcpath)
|
||||
if (dstStat && areIdentical(srcStat, dstStat)) return
|
||||
} catch (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
throw err
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
const dirExists = fs.existsSync(dir)
|
||||
if (dirExists) return fs.linkSync(srcpath, dstpath)
|
||||
mkdir.mkdirsSync(dir)
|
||||
|
||||
return fs.linkSync(srcpath, dstpath)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createLink: u(createLink),
|
||||
createLinkSync
|
||||
}
|
||||
99
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink-paths.js
generated
vendored
Normal file
99
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink-paths.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
/**
|
||||
* Function that returns two types of paths, one relative to symlink, and one
|
||||
* relative to the current working directory. Checks if path is absolute or
|
||||
* relative. If the path is relative, this function checks if the path is
|
||||
* relative to symlink or relative to current working directory. This is an
|
||||
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
||||
* This allows you to determine which path to use out of one of three possible
|
||||
* types of source paths. The first is an absolute path. This is detected by
|
||||
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
||||
* see if it exists. If it does it's used, if not an error is returned
|
||||
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
||||
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
||||
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
||||
* created symlink. If you provide a `srcpath` that does not exist on the file
|
||||
* system it results in a broken symlink. To minimize this, the function
|
||||
* checks to see if the 'relative to symlink' source file exists, and if it
|
||||
* does it will use it. If it does not, it checks if there's a file that
|
||||
* exists that is relative to the current working directory, if does its used.
|
||||
* This preserves the expectations of the original fs.symlink spec and adds
|
||||
* the ability to pass in `relative to current working direcotry` paths.
|
||||
*/
|
||||
|
||||
function symlinkPaths (srcpath, dstpath, callback) {
|
||||
if (path.isAbsolute(srcpath)) {
|
||||
return fs.lstat(srcpath, (err) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureSymlink')
|
||||
return callback(err)
|
||||
}
|
||||
return callback(null, {
|
||||
toCwd: srcpath,
|
||||
toDst: srcpath
|
||||
})
|
||||
})
|
||||
} else {
|
||||
const dstdir = path.dirname(dstpath)
|
||||
const relativeToDst = path.join(dstdir, srcpath)
|
||||
return pathExists(relativeToDst, (err, exists) => {
|
||||
if (err) return callback(err)
|
||||
if (exists) {
|
||||
return callback(null, {
|
||||
toCwd: relativeToDst,
|
||||
toDst: srcpath
|
||||
})
|
||||
} else {
|
||||
return fs.lstat(srcpath, (err) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureSymlink')
|
||||
return callback(err)
|
||||
}
|
||||
return callback(null, {
|
||||
toCwd: srcpath,
|
||||
toDst: path.relative(dstdir, srcpath)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function symlinkPathsSync (srcpath, dstpath) {
|
||||
let exists
|
||||
if (path.isAbsolute(srcpath)) {
|
||||
exists = fs.existsSync(srcpath)
|
||||
if (!exists) throw new Error('absolute srcpath does not exist')
|
||||
return {
|
||||
toCwd: srcpath,
|
||||
toDst: srcpath
|
||||
}
|
||||
} else {
|
||||
const dstdir = path.dirname(dstpath)
|
||||
const relativeToDst = path.join(dstdir, srcpath)
|
||||
exists = fs.existsSync(relativeToDst)
|
||||
if (exists) {
|
||||
return {
|
||||
toCwd: relativeToDst,
|
||||
toDst: srcpath
|
||||
}
|
||||
} else {
|
||||
exists = fs.existsSync(srcpath)
|
||||
if (!exists) throw new Error('relative srcpath does not exist')
|
||||
return {
|
||||
toCwd: srcpath,
|
||||
toDst: path.relative(dstdir, srcpath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
symlinkPaths,
|
||||
symlinkPathsSync
|
||||
}
|
||||
31
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink-type.js
generated
vendored
Normal file
31
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink-type.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
function symlinkType (srcpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
if (type) return callback(null, type)
|
||||
fs.lstat(srcpath, (err, stats) => {
|
||||
if (err) return callback(null, 'file')
|
||||
type = (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
callback(null, type)
|
||||
})
|
||||
}
|
||||
|
||||
function symlinkTypeSync (srcpath, type) {
|
||||
let stats
|
||||
|
||||
if (type) return type
|
||||
try {
|
||||
stats = fs.lstatSync(srcpath)
|
||||
} catch {
|
||||
return 'file'
|
||||
}
|
||||
return (stats && stats.isDirectory()) ? 'dir' : 'file'
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
symlinkType,
|
||||
symlinkTypeSync
|
||||
}
|
||||
82
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
Normal file
82
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('../fs')
|
||||
const _mkdirs = require('../mkdirs')
|
||||
const mkdirs = _mkdirs.mkdirs
|
||||
const mkdirsSync = _mkdirs.mkdirsSync
|
||||
|
||||
const _symlinkPaths = require('./symlink-paths')
|
||||
const symlinkPaths = _symlinkPaths.symlinkPaths
|
||||
const symlinkPathsSync = _symlinkPaths.symlinkPathsSync
|
||||
|
||||
const _symlinkType = require('./symlink-type')
|
||||
const symlinkType = _symlinkType.symlinkType
|
||||
const symlinkTypeSync = _symlinkType.symlinkTypeSync
|
||||
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
const { areIdentical } = require('../util/stat')
|
||||
|
||||
function createSymlink (srcpath, dstpath, type, callback) {
|
||||
callback = (typeof type === 'function') ? type : callback
|
||||
type = (typeof type === 'function') ? false : type
|
||||
|
||||
fs.lstat(dstpath, (err, stats) => {
|
||||
if (!err && stats.isSymbolicLink()) {
|
||||
Promise.all([
|
||||
fs.stat(srcpath),
|
||||
fs.stat(dstpath)
|
||||
]).then(([srcStat, dstStat]) => {
|
||||
if (areIdentical(srcStat, dstStat)) return callback(null)
|
||||
_createSymlink(srcpath, dstpath, type, callback)
|
||||
})
|
||||
} else _createSymlink(srcpath, dstpath, type, callback)
|
||||
})
|
||||
}
|
||||
|
||||
function _createSymlink (srcpath, dstpath, type, callback) {
|
||||
symlinkPaths(srcpath, dstpath, (err, relative) => {
|
||||
if (err) return callback(err)
|
||||
srcpath = relative.toDst
|
||||
symlinkType(relative.toCwd, type, (err, type) => {
|
||||
if (err) return callback(err)
|
||||
const dir = path.dirname(dstpath)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
|
||||
mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
fs.symlink(srcpath, dstpath, type, callback)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createSymlinkSync (srcpath, dstpath, type) {
|
||||
let stats
|
||||
try {
|
||||
stats = fs.lstatSync(dstpath)
|
||||
} catch {}
|
||||
if (stats && stats.isSymbolicLink()) {
|
||||
const srcStat = fs.statSync(srcpath)
|
||||
const dstStat = fs.statSync(dstpath)
|
||||
if (areIdentical(srcStat, dstStat)) return
|
||||
}
|
||||
|
||||
const relative = symlinkPathsSync(srcpath, dstpath)
|
||||
srcpath = relative.toDst
|
||||
type = symlinkTypeSync(relative.toCwd, type)
|
||||
const dir = path.dirname(dstpath)
|
||||
const exists = fs.existsSync(dir)
|
||||
if (exists) return fs.symlinkSync(srcpath, dstpath, type)
|
||||
mkdirsSync(dir)
|
||||
return fs.symlinkSync(srcpath, dstpath, type)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSymlink: u(createSymlink),
|
||||
createSymlinkSync
|
||||
}
|
||||
128
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
128
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/fs/index.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
'use strict'
|
||||
// This is adapted from https://github.com/normalize/mz
|
||||
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
|
||||
const api = [
|
||||
'access',
|
||||
'appendFile',
|
||||
'chmod',
|
||||
'chown',
|
||||
'close',
|
||||
'copyFile',
|
||||
'fchmod',
|
||||
'fchown',
|
||||
'fdatasync',
|
||||
'fstat',
|
||||
'fsync',
|
||||
'ftruncate',
|
||||
'futimes',
|
||||
'lchmod',
|
||||
'lchown',
|
||||
'link',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdtemp',
|
||||
'open',
|
||||
'opendir',
|
||||
'readdir',
|
||||
'readFile',
|
||||
'readlink',
|
||||
'realpath',
|
||||
'rename',
|
||||
'rm',
|
||||
'rmdir',
|
||||
'stat',
|
||||
'symlink',
|
||||
'truncate',
|
||||
'unlink',
|
||||
'utimes',
|
||||
'writeFile'
|
||||
].filter(key => {
|
||||
// Some commands are not available on some systems. Ex:
|
||||
// fs.opendir was added in Node.js v12.12.0
|
||||
// fs.rm was added in Node.js v14.14.0
|
||||
// fs.lchown is not available on at least some Linux
|
||||
return typeof fs[key] === 'function'
|
||||
})
|
||||
|
||||
// Export cloned fs:
|
||||
Object.assign(exports, fs)
|
||||
|
||||
// Universalify async methods:
|
||||
api.forEach(method => {
|
||||
exports[method] = u(fs[method])
|
||||
})
|
||||
|
||||
// We differ from mz/fs in that we still ship the old, broken, fs.exists()
|
||||
// since we are a drop-in replacement for the native module
|
||||
exports.exists = function (filename, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.exists(filename, callback)
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
return fs.exists(filename, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
// fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
|
||||
|
||||
exports.read = function (fd, buffer, offset, length, position, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
return fs.read(fd, buffer, offset, length, position, callback)
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesRead, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Function signature can be
|
||||
// fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
||||
// OR
|
||||
// fs.write(fd, string[, position[, encoding]], callback)
|
||||
// We need to handle both cases, so we use ...args
|
||||
exports.write = function (fd, buffer, ...args) {
|
||||
if (typeof args[args.length - 1] === 'function') {
|
||||
return fs.write(fd, buffer, ...args)
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffer })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// fs.writev only available in Node v12.9.0+
|
||||
if (typeof fs.writev === 'function') {
|
||||
// Function signature is
|
||||
// s.writev(fd, buffers[, position], callback)
|
||||
// We need to handle the optional arg, so we use ...args
|
||||
exports.writev = function (fd, buffers, ...args) {
|
||||
if (typeof args[args.length - 1] === 'function') {
|
||||
return fs.writev(fd, buffers, ...args)
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
||||
if (err) return reject(err)
|
||||
resolve({ bytesWritten, buffers })
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// fs.realpath.native sometimes not available if fs is monkey-patched
|
||||
if (typeof fs.realpath.native === 'function') {
|
||||
exports.realpath.native = u(fs.realpath.native)
|
||||
} else {
|
||||
process.emitWarning(
|
||||
'fs.realpath.native is not a function. Is fs being monkey-patched?',
|
||||
'Warning', 'fs-extra-WARN0003'
|
||||
)
|
||||
}
|
||||
16
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/index.js
generated
vendored
Normal file
16
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
// Export promiseified graceful-fs:
|
||||
...require('./fs'),
|
||||
// Export extra methods:
|
||||
...require('./copy'),
|
||||
...require('./empty'),
|
||||
...require('./ensure'),
|
||||
...require('./json'),
|
||||
...require('./mkdirs'),
|
||||
...require('./move'),
|
||||
...require('./output-file'),
|
||||
...require('./path-exists'),
|
||||
...require('./remove')
|
||||
}
|
||||
16
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/index.js
generated
vendored
Normal file
16
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromPromise
|
||||
const jsonFile = require('./jsonfile')
|
||||
|
||||
jsonFile.outputJson = u(require('./output-json'))
|
||||
jsonFile.outputJsonSync = require('./output-json-sync')
|
||||
// aliases
|
||||
jsonFile.outputJSON = jsonFile.outputJson
|
||||
jsonFile.outputJSONSync = jsonFile.outputJsonSync
|
||||
jsonFile.writeJSON = jsonFile.writeJson
|
||||
jsonFile.writeJSONSync = jsonFile.writeJsonSync
|
||||
jsonFile.readJSON = jsonFile.readJson
|
||||
jsonFile.readJSONSync = jsonFile.readJsonSync
|
||||
|
||||
module.exports = jsonFile
|
||||
11
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/jsonfile.js
generated
vendored
Normal file
11
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/jsonfile.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
const jsonFile = require('jsonfile')
|
||||
|
||||
module.exports = {
|
||||
// jsonfile exports
|
||||
readJson: jsonFile.readFile,
|
||||
readJsonSync: jsonFile.readFileSync,
|
||||
writeJson: jsonFile.writeFile,
|
||||
writeJsonSync: jsonFile.writeFileSync
|
||||
}
|
||||
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/output-json-sync.js
generated
vendored
Normal file
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/output-json-sync.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const { stringify } = require('jsonfile/utils')
|
||||
const { outputFileSync } = require('../output-file')
|
||||
|
||||
function outputJsonSync (file, data, options) {
|
||||
const str = stringify(data, options)
|
||||
|
||||
outputFileSync(file, str, options)
|
||||
}
|
||||
|
||||
module.exports = outputJsonSync
|
||||
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/output-json.js
generated
vendored
Normal file
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/json/output-json.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const { stringify } = require('jsonfile/utils')
|
||||
const { outputFile } = require('../output-file')
|
||||
|
||||
async function outputJson (file, data, options = {}) {
|
||||
const str = stringify(data, options)
|
||||
|
||||
await outputFile(file, str, options)
|
||||
}
|
||||
|
||||
module.exports = outputJson
|
||||
14
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/index.js
generated
vendored
Normal file
14
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
const u = require('universalify').fromPromise
|
||||
const { makeDir: _makeDir, makeDirSync } = require('./make-dir')
|
||||
const makeDir = u(_makeDir)
|
||||
|
||||
module.exports = {
|
||||
mkdirs: makeDir,
|
||||
mkdirsSync: makeDirSync,
|
||||
// alias
|
||||
mkdirp: makeDir,
|
||||
mkdirpSync: makeDirSync,
|
||||
ensureDir: makeDir,
|
||||
ensureDirSync: makeDirSync
|
||||
}
|
||||
27
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/make-dir.js
generated
vendored
Normal file
27
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/make-dir.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
const fs = require('../fs')
|
||||
const { checkPath } = require('./utils')
|
||||
|
||||
const getMode = options => {
|
||||
const defaults = { mode: 0o777 }
|
||||
if (typeof options === 'number') return options
|
||||
return ({ ...defaults, ...options }).mode
|
||||
}
|
||||
|
||||
module.exports.makeDir = async (dir, options) => {
|
||||
checkPath(dir)
|
||||
|
||||
return fs.mkdir(dir, {
|
||||
mode: getMode(options),
|
||||
recursive: true
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.makeDirSync = (dir, options) => {
|
||||
checkPath(dir)
|
||||
|
||||
return fs.mkdirSync(dir, {
|
||||
mode: getMode(options),
|
||||
recursive: true
|
||||
})
|
||||
}
|
||||
21
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/utils.js
generated
vendored
Normal file
21
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/mkdirs/utils.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// Adapted from https://github.com/sindresorhus/make-dir
|
||||
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
|
||||
// https://github.com/nodejs/node/issues/8987
|
||||
// https://github.com/libuv/libuv/pull/1088
|
||||
module.exports.checkPath = function checkPath (pth) {
|
||||
if (process.platform === 'win32') {
|
||||
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
|
||||
|
||||
if (pathHasInvalidWinCharacters) {
|
||||
const error = new Error(`Path contains invalid characters: ${pth}`)
|
||||
error.code = 'EINVAL'
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
7
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/index.js
generated
vendored
Normal file
7
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
module.exports = {
|
||||
move: u(require('./move')),
|
||||
moveSync: require('./move-sync')
|
||||
}
|
||||
54
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/move-sync.js
generated
vendored
Normal file
54
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/move-sync.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const copySync = require('../copy').copySync
|
||||
const removeSync = require('../remove').removeSync
|
||||
const mkdirpSync = require('../mkdirs').mkdirpSync
|
||||
const stat = require('../util/stat')
|
||||
|
||||
function moveSync (src, dest, opts) {
|
||||
opts = opts || {}
|
||||
const overwrite = opts.overwrite || opts.clobber || false
|
||||
|
||||
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
|
||||
stat.checkParentPathsSync(src, srcStat, dest, 'move')
|
||||
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
|
||||
return doRename(src, dest, overwrite, isChangingCase)
|
||||
}
|
||||
|
||||
function isParentRoot (dest) {
|
||||
const parent = path.dirname(dest)
|
||||
const parsedPath = path.parse(parent)
|
||||
return parsedPath.root === parent
|
||||
}
|
||||
|
||||
function doRename (src, dest, overwrite, isChangingCase) {
|
||||
if (isChangingCase) return rename(src, dest, overwrite)
|
||||
if (overwrite) {
|
||||
removeSync(dest)
|
||||
return rename(src, dest, overwrite)
|
||||
}
|
||||
if (fs.existsSync(dest)) throw new Error('dest already exists.')
|
||||
return rename(src, dest, overwrite)
|
||||
}
|
||||
|
||||
function rename (src, dest, overwrite) {
|
||||
try {
|
||||
fs.renameSync(src, dest)
|
||||
} catch (err) {
|
||||
if (err.code !== 'EXDEV') throw err
|
||||
return moveAcrossDevice(src, dest, overwrite)
|
||||
}
|
||||
}
|
||||
|
||||
function moveAcrossDevice (src, dest, overwrite) {
|
||||
const opts = {
|
||||
overwrite,
|
||||
errorOnExist: true
|
||||
}
|
||||
copySync(src, dest, opts)
|
||||
return removeSync(src)
|
||||
}
|
||||
|
||||
module.exports = moveSync
|
||||
75
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/move.js
generated
vendored
Normal file
75
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/move/move.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const copy = require('../copy').copy
|
||||
const remove = require('../remove').remove
|
||||
const mkdirp = require('../mkdirs').mkdirp
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
const stat = require('../util/stat')
|
||||
|
||||
function move (src, dest, opts, cb) {
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts
|
||||
opts = {}
|
||||
}
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
const overwrite = opts.overwrite || opts.clobber || false
|
||||
|
||||
stat.checkPaths(src, dest, 'move', opts, (err, stats) => {
|
||||
if (err) return cb(err)
|
||||
const { srcStat, isChangingCase = false } = stats
|
||||
stat.checkParentPaths(src, srcStat, dest, 'move', err => {
|
||||
if (err) return cb(err)
|
||||
if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb)
|
||||
mkdirp(path.dirname(dest), err => {
|
||||
if (err) return cb(err)
|
||||
return doRename(src, dest, overwrite, isChangingCase, cb)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function isParentRoot (dest) {
|
||||
const parent = path.dirname(dest)
|
||||
const parsedPath = path.parse(parent)
|
||||
return parsedPath.root === parent
|
||||
}
|
||||
|
||||
function doRename (src, dest, overwrite, isChangingCase, cb) {
|
||||
if (isChangingCase) return rename(src, dest, overwrite, cb)
|
||||
if (overwrite) {
|
||||
return remove(dest, err => {
|
||||
if (err) return cb(err)
|
||||
return rename(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
pathExists(dest, (err, destExists) => {
|
||||
if (err) return cb(err)
|
||||
if (destExists) return cb(new Error('dest already exists.'))
|
||||
return rename(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function rename (src, dest, overwrite, cb) {
|
||||
fs.rename(src, dest, err => {
|
||||
if (!err) return cb()
|
||||
if (err.code !== 'EXDEV') return cb(err)
|
||||
return moveAcrossDevice(src, dest, overwrite, cb)
|
||||
})
|
||||
}
|
||||
|
||||
function moveAcrossDevice (src, dest, overwrite, cb) {
|
||||
const opts = {
|
||||
overwrite,
|
||||
errorOnExist: true
|
||||
}
|
||||
copy(src, dest, opts, err => {
|
||||
if (err) return cb(err)
|
||||
return remove(src, cb)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = move
|
||||
40
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/output-file/index.js
generated
vendored
Normal file
40
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/output-file/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function outputFile (file, data, encoding, callback) {
|
||||
if (typeof encoding === 'function') {
|
||||
callback = encoding
|
||||
encoding = 'utf8'
|
||||
}
|
||||
|
||||
const dir = path.dirname(file)
|
||||
pathExists(dir, (err, itDoes) => {
|
||||
if (err) return callback(err)
|
||||
if (itDoes) return fs.writeFile(file, data, encoding, callback)
|
||||
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
|
||||
fs.writeFile(file, data, encoding, callback)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function outputFileSync (file, ...args) {
|
||||
const dir = path.dirname(file)
|
||||
if (fs.existsSync(dir)) {
|
||||
return fs.writeFileSync(file, ...args)
|
||||
}
|
||||
mkdir.mkdirsSync(dir)
|
||||
fs.writeFileSync(file, ...args)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
outputFile: u(outputFile),
|
||||
outputFileSync
|
||||
}
|
||||
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
12
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/path-exists/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
const u = require('universalify').fromPromise
|
||||
const fs = require('../fs')
|
||||
|
||||
function pathExists (path) {
|
||||
return fs.access(path).then(() => true).catch(() => false)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pathExists: u(pathExists),
|
||||
pathExistsSync: fs.existsSync
|
||||
}
|
||||
22
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/remove/index.js
generated
vendored
Normal file
22
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/remove/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const u = require('universalify').fromCallback
|
||||
const rimraf = require('./rimraf')
|
||||
|
||||
function remove (path, callback) {
|
||||
// Node 14.14.0+
|
||||
if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback)
|
||||
rimraf(path, callback)
|
||||
}
|
||||
|
||||
function removeSync (path) {
|
||||
// Node 14.14.0+
|
||||
if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true })
|
||||
rimraf.sync(path)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
remove: u(remove),
|
||||
removeSync
|
||||
}
|
||||
302
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
Normal file
302
desktop-operator/node_modules/@electron/rebuild/node_modules/fs-extra/lib/remove/rimraf.js
generated
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('graceful-fs')
|
||||
const path = require('path')
|
||||
const assert = require('assert')
|
||||
|
||||
const isWindows = (process.platform === 'win32')
|
||||
|
||||
function defaults (options) {
|
||||
const methods = [
|
||||
'unlink',
|
||||
'chmod',
|
||||
'stat',
|
||||
'lstat',
|
||||
'rmdir',
|
||||
'readdir'
|
||||
]
|
||||
methods.forEach(m => {
|
||||
options[m] = options[m] || fs[m]
|
||||
m = m + 'Sync'
|
||||
options[m] = options[m] || fs[m]
|
||||
})
|
||||
|
||||
options.maxBusyTries = options.maxBusyTries || 3
|
||||
}
|
||||
|
||||
function rimraf (p, options, cb) {
|
||||
let busyTries = 0
|
||||
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')
|
||||
assert(options, 'rimraf: invalid options argument provided')
|
||||
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
defaults(options)
|
||||
|
||||
rimraf_(p, options, function CB (er) {
|
||||
if (er) {
|
||||
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
|
||||
busyTries < options.maxBusyTries) {
|
||||
busyTries++
|
||||
const time = busyTries * 100
|
||||
// try again, with the same exact callback as this one.
|
||||
return setTimeout(() => rimraf_(p, options, CB), time)
|
||||
}
|
||||
|
||||
// already gone
|
||||
if (er.code === 'ENOENT') er = null
|
||||
}
|
||||
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
// Two possible strategies.
|
||||
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
|
||||
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
|
||||
//
|
||||
// Both result in an extra syscall when you guess wrong. However, there
|
||||
// are likely far more normal files in the world than directories. This
|
||||
// is based on the assumption that a the average number of files per
|
||||
// directory is >= 1.
|
||||
//
|
||||
// If anyone ever complains about this, then I guess the strategy could
|
||||
// be made configurable somehow. But until then, YAGNI.
|
||||
function rimraf_ (p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
// sunos lets the root user unlink directories, which is... weird.
|
||||
// so we have to lstat here and make sure it's not a dir.
|
||||
options.lstat(p, (er, st) => {
|
||||
if (er && er.code === 'ENOENT') {
|
||||
return cb(null)
|
||||
}
|
||||
|
||||
// Windows can EPERM on stat. Life is suffering.
|
||||
if (er && er.code === 'EPERM' && isWindows) {
|
||||
return fixWinEPERM(p, options, er, cb)
|
||||
}
|
||||
|
||||
if (st && st.isDirectory()) {
|
||||
return rmdir(p, options, er, cb)
|
||||
}
|
||||
|
||||
options.unlink(p, er => {
|
||||
if (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return cb(null)
|
||||
}
|
||||
if (er.code === 'EPERM') {
|
||||
return (isWindows)
|
||||
? fixWinEPERM(p, options, er, cb)
|
||||
: rmdir(p, options, er, cb)
|
||||
}
|
||||
if (er.code === 'EISDIR') {
|
||||
return rmdir(p, options, er, cb)
|
||||
}
|
||||
}
|
||||
return cb(er)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERM (p, options, er, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
options.chmod(p, 0o666, er2 => {
|
||||
if (er2) {
|
||||
cb(er2.code === 'ENOENT' ? null : er)
|
||||
} else {
|
||||
options.stat(p, (er3, stats) => {
|
||||
if (er3) {
|
||||
cb(er3.code === 'ENOENT' ? null : er)
|
||||
} else if (stats.isDirectory()) {
|
||||
rmdir(p, options, er, cb)
|
||||
} else {
|
||||
options.unlink(p, cb)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function fixWinEPERMSync (p, options, er) {
|
||||
let stats
|
||||
|
||||
assert(p)
|
||||
assert(options)
|
||||
|
||||
try {
|
||||
options.chmodSync(p, 0o666)
|
||||
} catch (er2) {
|
||||
if (er2.code === 'ENOENT') {
|
||||
return
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
stats = options.statSync(p)
|
||||
} catch (er3) {
|
||||
if (er3.code === 'ENOENT') {
|
||||
return
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
if (stats.isDirectory()) {
|
||||
rmdirSync(p, options, er)
|
||||
} else {
|
||||
options.unlinkSync(p)
|
||||
}
|
||||
}
|
||||
|
||||
function rmdir (p, options, originalEr, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
|
||||
// if we guessed wrong, and it's not a directory, then
|
||||
// raise the original error.
|
||||
options.rmdir(p, er => {
|
||||
if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {
|
||||
rmkids(p, options, cb)
|
||||
} else if (er && er.code === 'ENOTDIR') {
|
||||
cb(originalEr)
|
||||
} else {
|
||||
cb(er)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function rmkids (p, options, cb) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
assert(typeof cb === 'function')
|
||||
|
||||
options.readdir(p, (er, files) => {
|
||||
if (er) return cb(er)
|
||||
|
||||
let n = files.length
|
||||
let errState
|
||||
|
||||
if (n === 0) return options.rmdir(p, cb)
|
||||
|
||||
files.forEach(f => {
|
||||
rimraf(path.join(p, f), options, er => {
|
||||
if (errState) {
|
||||
return
|
||||
}
|
||||
if (er) return cb(errState = er)
|
||||
if (--n === 0) {
|
||||
options.rmdir(p, cb)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// this looks simpler, and is strictly *faster*, but will
|
||||
// tie up the JavaScript thread and fail on excessively
|
||||
// deep directory trees.
|
||||
function rimrafSync (p, options) {
|
||||
let st
|
||||
|
||||
options = options || {}
|
||||
defaults(options)
|
||||
|
||||
assert(p, 'rimraf: missing path')
|
||||
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
|
||||
assert(options, 'rimraf: missing options')
|
||||
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
|
||||
|
||||
try {
|
||||
st = options.lstatSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
}
|
||||
|
||||
// Windows can EPERM on stat. Life is suffering.
|
||||
if (er.code === 'EPERM' && isWindows) {
|
||||
fixWinEPERMSync(p, options, er)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// sunos lets the root user unlink directories, which is... weird.
|
||||
if (st && st.isDirectory()) {
|
||||
rmdirSync(p, options, null)
|
||||
} else {
|
||||
options.unlinkSync(p)
|
||||
}
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
} else if (er.code === 'EPERM') {
|
||||
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
|
||||
} else if (er.code !== 'EISDIR') {
|
||||
throw er
|
||||
}
|
||||
rmdirSync(p, options, er)
|
||||
}
|
||||
}
|
||||
|
||||
function rmdirSync (p, options, originalEr) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
|
||||
try {
|
||||
options.rmdirSync(p)
|
||||
} catch (er) {
|
||||
if (er.code === 'ENOTDIR') {
|
||||
throw originalEr
|
||||
} else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
|
||||
rmkidsSync(p, options)
|
||||
} else if (er.code !== 'ENOENT') {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rmkidsSync (p, options) {
|
||||
assert(p)
|
||||
assert(options)
|
||||
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
|
||||
|
||||
if (isWindows) {
|
||||
// We only end up here once we got ENOTEMPTY at least once, and
|
||||
// at this point, we are guaranteed to have removed all the kids.
|
||||
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
|
||||
// try really hard to delete stuff on windows, because it has a
|
||||
// PROFOUNDLY annoying habit of not closing handles promptly when
|
||||
// files are deleted, resulting in spurious ENOTEMPTY errors.
|
||||
const startTime = Date.now()
|
||||
do {
|
||||
try {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
return ret
|
||||
} catch {}
|
||||
} while (Date.now() - startTime < 500) // give up after 500ms
|
||||
} else {
|
||||
const ret = options.rmdirSync(p, options)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rimraf
|
||||
rimraf.sync = rimrafSync
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user