Delete 100 files via Git Manager GUI
This commit is contained in:
-21
@@ -1,21 +0,0 @@
|
||||
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.
|
||||
-202
@@ -1,202 +0,0 @@
|
||||
# @electron/rebuild
|
||||
|
||||
[](https://github.com/electron/rebuild/actions/workflows/test.yml)
|
||||
[](https://npm.im/@electron/rebuild)
|
||||
[](https://codecov.io/gh/electron/rebuild)
|
||||
[](https://packages.electronjs.org/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 v22.12.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]
|
||||
-j, --jobs Number of parallel compile jobs node-gyp should
|
||||
run (passed as node-gyp --jobs). Defaults to
|
||||
node-gyp's own default. [number]
|
||||
--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]
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The `--dist-url` value can also be provided via the `ELECTRON_REBUILD_DIST_URL`
|
||||
> environment variable. The `--dist-url` flag takes precedence when both are set.
|
||||
|
||||
> [!NOTE]
|
||||
> By default, only your `prod` and `optional` dependencies are rebuilt —
|
||||
> `devDependencies` are **not** rebuilt. This is because the default value of
|
||||
> `types` is `['prod', 'optional']`. If you have a native module in your
|
||||
> `devDependencies` that you need rebuilt, you must explicitly include `dev` in
|
||||
> the list of types:
|
||||
>
|
||||
> - CLI: `electron-rebuild --types prod,optional,dev` (or `-t prod,optional,dev`)
|
||||
> - API: `rebuild({ ..., types: ['prod', 'optional', 'dev'] })`
|
||||
|
||||
### 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://packages.electronjs.org/packager/v19.0.5/interfaces/Options.html#aftercopy)
|
||||
for Electron Packager. For example:
|
||||
|
||||
```javascript
|
||||
import { packager } from "@electron/packager";
|
||||
import { rebuild } from "@electron/rebuild";
|
||||
|
||||
packager({
|
||||
// … other options
|
||||
afterCopy: [
|
||||
async ({ buildPath, electronVersion, arch }) => {
|
||||
await rebuild({ buildPath, electronVersion, arch });
|
||||
},
|
||||
],
|
||||
// … 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 my build pipeline?
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
For full API usage, see the [API documentation](https://packages.electronjs.org/rebuild).
|
||||
|
||||
A full build process might look something like:
|
||||
|
||||
```javascript
|
||||
// ESM
|
||||
import { rebuild } from "@electron/rebuild";
|
||||
|
||||
rebuild({
|
||||
buildPath: import.meta.dirname,
|
||||
electronVersion: "35.1.5",
|
||||
})
|
||||
.then(() => console.info("Rebuild Successful"))
|
||||
.catch((e) => {
|
||||
console.error("Building modules didn't work!");
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
// CommonJS
|
||||
const { rebuild } = require("@electron/rebuild");
|
||||
|
||||
rebuild({
|
||||
buildPath: __dirname,
|
||||
electronVersion: "35.1.5",
|
||||
})
|
||||
.then(() => console.info("Rebuild Successful"))
|
||||
.catch((e) => {
|
||||
console.error("Building modules didn't work!");
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
```
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
export declare function uname(): string;
|
||||
export 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;
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
export function uname() {
|
||||
return execSync('uname -m').toString().trim();
|
||||
}
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*
|
||||
* Copied from `@electron/get`.
|
||||
*/
|
||||
export 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;
|
||||
}
|
||||
//# sourceMappingURL=arch.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"arch.js","sourceRoot":"","sources":["../src/arch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;AAChD,CAAC;AAMD;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,eAAgC;IACxE,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,8DAA8D;QAC9D,QAAQ,eAAe,CAAC,WAAW,EAAE,CAAC;YACpC,KAAK,GAAG;gBACN,OAAO,KAAK,EAAE,CAAC;YACjB,KAAK,GAAG,CAAC;YACT;gBACE,OAAO,QAAQ,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
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>;
|
||||
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 {};
|
||||
-153
@@ -1,153 +0,0 @@
|
||||
import crypto from 'node:crypto';
|
||||
import debug from 'debug';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import zlib from 'node:zlib';
|
||||
const d = debug('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 {
|
||||
hash;
|
||||
data;
|
||||
constructor(hash, data) {
|
||||
this.hash = hash;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
const takeSnapshot = async (dir, relativeTo = dir) => {
|
||||
const snap = {};
|
||||
await Promise.all((await fs.promises.readdir(dir)).map(async (child) => {
|
||||
if (child === 'node_modules')
|
||||
return;
|
||||
const childPath = path.resolve(dir, child);
|
||||
const relative = path.relative(relativeTo, childPath);
|
||||
if ((await fs.promises.stat(childPath)).isDirectory()) {
|
||||
snap[relative] = await takeSnapshot(childPath, relativeTo);
|
||||
}
|
||||
else {
|
||||
const data = await fs.promises.readFile(childPath);
|
||||
snap[relative] = new Snap(crypto.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.promises.mkdir(path.dirname(path.resolve(dir, key)), { recursive: true });
|
||||
await fs.promises.writeFile(path.resolve(dir, key), diff[key].data);
|
||||
}
|
||||
else {
|
||||
await fs.promises.mkdir(path.resolve(dir, key), { recursive: true });
|
||||
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;
|
||||
};
|
||||
export 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.gzip(moduleBuffer, (_, result) => resolve(result)));
|
||||
await fs.promises.mkdir(cachePath, { recursive: true });
|
||||
await fs.promises.writeFile(path.resolve(cachePath, key), zipped);
|
||||
};
|
||||
export const lookupModuleState = async (cachePath, key) => {
|
||||
if (fs.existsSync(path.resolve(cachePath, key))) {
|
||||
return async function applyDiff(dir) {
|
||||
const zipped = await fs.promises.readFile(path.resolve(cachePath, key));
|
||||
const unzipped = await new Promise((resolve) => {
|
||||
zlib.gunzip(zipped, (_, result) => resolve(result));
|
||||
});
|
||||
const diff = unserialize(JSON.parse(unzipped.toString()));
|
||||
await writeSnapshot(diff, dir);
|
||||
};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
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 ??= dir;
|
||||
d('hashing dir', dir);
|
||||
const dirTree = {};
|
||||
await Promise.all((await fs.promises.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.resolve(dir, child);
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const relative = path.relative(relativeTo, childPath);
|
||||
if ((await fs.promises.stat(childPath)).isDirectory()) {
|
||||
dirTree[relative] = await hashDirectory(childPath, relativeTo);
|
||||
}
|
||||
else {
|
||||
dirTree[relative] = crypto
|
||||
.createHash('SHA256')
|
||||
.update(await fs.promises.readFile(childPath))
|
||||
.digest('hex');
|
||||
}
|
||||
}));
|
||||
return dirTree;
|
||||
}
|
||||
export async function generateCacheKey(opts) {
|
||||
const tree = await hashDirectory(opts.modulePath);
|
||||
const hasher = crypto
|
||||
.createHash('SHA256')
|
||||
.update(`${ELECTRON_REBUILD_CACHE_ID}`)
|
||||
.update(path.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;
|
||||
}
|
||||
//# sourceMappingURL=cache.js.map
|
||||
-1
File diff suppressed because one or more lines are too long
-4
@@ -1,4 +0,0 @@
|
||||
export declare function getClangEnvironmentVars(electronVersion: string, targetArch: string): Promise<{
|
||||
env: Record<string, string>;
|
||||
args: string[];
|
||||
}>;
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
import cp from 'node:child_process';
|
||||
import debug from 'debug';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { ELECTRON_GYP_DIR } from './constants.js';
|
||||
import { fetchUrl } from './fetcher.js';
|
||||
import { downloadLinuxSysroot } from './sysroot-fetcher.js';
|
||||
import { spawn } from '@malept/cross-spawn-promise';
|
||||
const d = debug('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();
|
||||
}
|
||||
export 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(await fs.promises.readdir(clangDir));
|
||||
gypArgs.push(`/p:CLToolExe=clang-cl.exe`, `/p:CLToolPath=${clangDir}`);
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
const sysrootPath = await 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,
|
||||
};
|
||||
}
|
||||
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(ELECTRON_GYP_DIR, `${electronVersion}-clang`);
|
||||
if (fs.existsSync(path.resolve(clangDirPath, 'bin', 'clang')))
|
||||
return clangDirPath;
|
||||
await fs.promises.mkdir(ELECTRON_GYP_DIR, { recursive: true });
|
||||
const electronDeps = await fetchUrl(`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 fetchUrl(`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 fetchUrl(clangDownloadURL, 'buffer');
|
||||
const tarPath = path.resolve(ELECTRON_GYP_DIR, `${electronVersion}-clang.tgz`);
|
||||
if (fs.existsSync(tarPath))
|
||||
await fs.promises.rm(tarPath, { recursive: true, force: true });
|
||||
await fs.promises.writeFile(tarPath, contents);
|
||||
await fs.promises.mkdir(clangDirPath, { recursive: true });
|
||||
d('extracting clang');
|
||||
await spawn('tar', ['-xf', tarPath, '-C', clangDirPath], { stdio: 'ignore' });
|
||||
await fs.promises.rm(tarPath, { recursive: true, force: true });
|
||||
d('cleaning up clang tar file');
|
||||
return clangDirPath;
|
||||
}
|
||||
//# sourceMappingURL=clang-fetcher.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"clang-fetcher.js","sourceRoot":"","sources":["../src/clang-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,MAAM,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAEpC,MAAM,OAAO,GAAG,iEAAiE,CAAC;AAElF,SAAS,oBAAoB,CAAC,MAAc,EAAE,QAAgB;IAC5D,MAAM,SAAS,GAA2B;QACxC,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;KACb,CAAC;IACF,IAAI,MAAM,GAAG,SAAS,CA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0,0 @@
|
||||
#!/usr/bin/env node
|
||||
export {};
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { parseArgs, styleText } from 'node:util';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { getProjectRootPath } from './search-module.js';
|
||||
import { locateElectronModule } from './electron-locator.js';
|
||||
import { rebuild } from './rebuild.js';
|
||||
const options = {
|
||||
version: { short: 'v', type: 'string', description: 'The version of Electron to build against' },
|
||||
force: {
|
||||
short: 'f',
|
||||
type: 'boolean',
|
||||
description: 'Force rebuilding modules, even if we would skip it otherwise',
|
||||
},
|
||||
arch: {
|
||||
short: 'a',
|
||||
type: 'string',
|
||||
description: "Override the target architecture to something other than your system's",
|
||||
},
|
||||
platform: {
|
||||
type: 'string',
|
||||
description: "Override the target platform to something other than your system's",
|
||||
},
|
||||
'module-dir': {
|
||||
short: 'm',
|
||||
type: 'string',
|
||||
description: 'The path to the node_modules directory to rebuild',
|
||||
},
|
||||
'which-module': {
|
||||
short: '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).',
|
||||
},
|
||||
only: {
|
||||
short: 'o',
|
||||
type: 'string',
|
||||
description: 'Only build specified module, or comma separated list of modules. All others are ignored.',
|
||||
},
|
||||
'electron-prebuilt-dir': {
|
||||
short: 'e',
|
||||
type: 'string',
|
||||
description: 'The path to the prebuilt electron module',
|
||||
},
|
||||
'dist-url': {
|
||||
short: 'd',
|
||||
type: 'string',
|
||||
description: 'Custom header tarball URL. Can also be set via the ELECTRON_REBUILD_DIST_URL environment variable.',
|
||||
},
|
||||
types: {
|
||||
short: 't',
|
||||
type: 'string',
|
||||
description: 'The types of dependencies to rebuild. Comma separated list of "prod", "dev" and "optional". Default is "prod,optional"',
|
||||
},
|
||||
parallel: {
|
||||
short: 'p',
|
||||
type: 'boolean',
|
||||
description: 'Rebuild in parallel, this is enabled by default on macOS and Linux',
|
||||
},
|
||||
sequential: {
|
||||
short: 's',
|
||||
type: 'boolean',
|
||||
description: 'Rebuild modules sequentially, this is enabled by default on Windows',
|
||||
},
|
||||
debug: { short: 'b', type: 'boolean', description: 'Build debug version of modules' },
|
||||
jobs: {
|
||||
short: 'j',
|
||||
type: 'string',
|
||||
description: "Number of parallel compile jobs node-gyp should run (passed as node-gyp --jobs). Defaults to node-gyp's own default.",
|
||||
},
|
||||
'prebuild-tag-prefix': {
|
||||
type: 'string',
|
||||
description: 'GitHub tag prefix passed to prebuild-install. Default is "v"',
|
||||
},
|
||||
'force-abi': {
|
||||
type: 'string',
|
||||
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.',
|
||||
},
|
||||
help: { short: 'h', type: 'boolean', description: 'Show help' },
|
||||
};
|
||||
const { values: argv } = parseArgs({ options, allowPositionals: true });
|
||||
if (argv.help) {
|
||||
console.log('Usage: electron-rebuild --version [version] --module-dir [path]\n\nOptions:');
|
||||
for (const [name, opt] of Object.entries(options)) {
|
||||
const short = 'short' in opt ? `-${opt.short}, ` : ' ';
|
||||
console.log(` ${short}--${name.padEnd(22)} ${opt.description}`);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
if (process.argv.length === 3 && process.argv[2] === '--version') {
|
||||
try {
|
||||
console.log('Electron Rebuild Version:', (await import(pathToFileURL(path.resolve(import.meta.dirname, '../../package.json')).toString(), { with: { type: 'json' } })).default.version);
|
||||
}
|
||||
catch {
|
||||
console.log('Electron Rebuild Version:', (await import(pathToFileURL(path.resolve(import.meta.dirname, '../package.json')).toString(), { with: { type: 'json' } })).default.version);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
const handler = (err) => {
|
||||
console.error(styleText('red', '\nAn unhandled error occurred inside electron-rebuild'));
|
||||
console.error(styleText('red', `${err.message}\n\n${err.stack}`));
|
||||
process.exit(-1);
|
||||
};
|
||||
process.on('uncaughtException', handler);
|
||||
process.on('unhandledRejection', handler);
|
||||
void (async () => {
|
||||
const projectRootPath = await getProjectRootPath(process.cwd());
|
||||
const electronModulePath = argv['electron-prebuilt-dir']
|
||||
? path.resolve(process.cwd(), argv['electron-prebuilt-dir'])
|
||||
: await locateElectronModule(projectRootPath);
|
||||
let electronModuleVersion = argv.version;
|
||||
if (!electronModuleVersion) {
|
||||
try {
|
||||
if (!electronModulePath)
|
||||
throw new Error('Prebuilt electron module not found');
|
||||
const pkgJson = await import(pathToFileURL(path.join(electronModulePath, 'package.json')).toString(), { with: { type: 'json' } });
|
||||
electronModuleVersion = pkgJson.default.version;
|
||||
}
|
||||
catch {
|
||||
throw new Error(`Unable to find electron's version number, either install it or specify an explicit version`);
|
||||
}
|
||||
}
|
||||
let rootDirectory = argv['module-dir'];
|
||||
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(import.meta.dirname, '../../..');
|
||||
if (!fs.existsSync(rootDirectory) ||
|
||||
!fs.existsSync(path.resolve(rootDirectory, 'package.json'))) {
|
||||
// Then we try the CWD
|
||||
rootDirectory = process.cwd();
|
||||
if (!fs.existsSync(rootDirectory) ||
|
||||
!fs.existsSync(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);
|
||||
}
|
||||
const forceAbi = argv['force-abi'] ? Number(argv['force-abi']) : undefined;
|
||||
if (argv['force-abi'] && Number.isNaN(forceAbi)) {
|
||||
throw new Error('force-abi must be a number');
|
||||
}
|
||||
const jobs = argv.jobs ? Number(argv.jobs) : undefined;
|
||||
if (argv.jobs && Number.isNaN(jobs)) {
|
||||
throw new Error('jobs must be a number');
|
||||
}
|
||||
console.error('Searching dependency tree');
|
||||
const rebuilder = rebuild({
|
||||
buildPath: rootDirectory,
|
||||
electronVersion: electronModuleVersion,
|
||||
arch: argv.arch || process.arch,
|
||||
platform: argv.platform || process.platform,
|
||||
extraModules: argv['which-module'] ? argv['which-module'].split(',') : [],
|
||||
onlyModules: argv.only ? argv.only.split(',') : null,
|
||||
force: argv.force,
|
||||
headerURL: argv['dist-url'] || process.env.ELECTRON_REBUILD_DIST_URL,
|
||||
types: argv.types ? argv.types.split(',') : ['prod', 'optional'],
|
||||
mode: argv.parallel ? 'parallel' : argv.sequential ? 'sequential' : undefined,
|
||||
debug: argv.debug,
|
||||
prebuildTagPrefix: argv['prebuild-tag-prefix'] ?? 'v',
|
||||
forceABI: forceAbi,
|
||||
useElectronClang: !!argv['use-electron-clang'],
|
||||
disablePreGypCopy: !!argv['disable-pre-gyp-copy'],
|
||||
projectRootPath,
|
||||
buildFromSource: !!argv['build-from-source'],
|
||||
jobs,
|
||||
});
|
||||
const lifecycle = rebuilder.lifecycle;
|
||||
lifecycle.on('modules-found', (moduleNames) => {
|
||||
if (moduleNames.length > 0) {
|
||||
console.error(`Building modules: ${moduleNames.join(', ')}`);
|
||||
}
|
||||
else {
|
||||
console.error('No native modules found');
|
||||
}
|
||||
});
|
||||
try {
|
||||
await rebuilder;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(styleText('red', '✖ Rebuild Failed'));
|
||||
throw err;
|
||||
}
|
||||
console.error(styleText('green', '✔ Rebuild Complete'));
|
||||
})();
|
||||
//# sourceMappingURL=cli.js.map
|
||||
-1
File diff suppressed because one or more lines are too long
-1
@@ -1 +0,0 @@
|
||||
export declare const ELECTRON_GYP_DIR: string;
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
export const ELECTRON_GYP_DIR = path.resolve(os.homedir(), '.electron-gyp');
|
||||
//# sourceMappingURL=constants.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC,CAAC"}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Detects the libc family on the current Linux host via `process.report`.
|
||||
*
|
||||
* Used to resolve the `{libc}` token in prebuilt binary path templates.
|
||||
*
|
||||
* @returns `'glibc'` | `'musl'` | `null` (non-Linux or unable to detect)
|
||||
*/
|
||||
export declare function detectLibcFamily(): string | null;
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
let cached;
|
||||
/**
|
||||
* Detects the libc family on the current Linux host via `process.report`.
|
||||
*
|
||||
* Used to resolve the `{libc}` token in prebuilt binary path templates.
|
||||
*
|
||||
* @returns `'glibc'` | `'musl'` | `null` (non-Linux or unable to detect)
|
||||
*/
|
||||
export function detectLibcFamily() {
|
||||
if (cached !== undefined)
|
||||
return cached;
|
||||
if (process.platform !== 'linux')
|
||||
return (cached = null);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const report = process.report?.getReport();
|
||||
if (report?.header?.glibcVersionRuntime)
|
||||
return (cached = 'glibc');
|
||||
if (Array.isArray(report?.sharedObjects) &&
|
||||
report.sharedObjects.some((s) => s.includes('libc.musl') || s.includes('ld-musl'))) {
|
||||
return (cached = 'musl');
|
||||
}
|
||||
return (cached = null);
|
||||
}
|
||||
//# sourceMappingURL=detect-libc.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"detect-libc.js","sourceRoot":"","sources":["../src/detect-libc.ts"],"names":[],"mappings":"AAAA,IAAI,MAAiC,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEzD,8DAA8D;IAC9D,MAAM,MAAM,GAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAChD,IAAI,MAAM,EAAE,MAAM,EAAE,mBAAmB;QAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IACnE,IACE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC;QACpC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAC1F,CAAC;QACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
||||
-1
@@ -1 +0,0 @@
|
||||
export declare function locateElectronModule(projectRootPath?: string | undefined, startDir?: string | undefined): Promise<string | null>;
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { searchForModule } from './search-module.js';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const electronModuleNames = ['electron', 'electron-prebuilt-compile'];
|
||||
async function locateModuleByImport() {
|
||||
for (const moduleName of electronModuleNames) {
|
||||
try {
|
||||
const modulePath = path.resolve(fileURLToPath(import.meta.resolve(`${moduleName}/package.json`)), '..');
|
||||
if (fs.existsSync(path.join(modulePath, 'package.json'))) {
|
||||
return modulePath;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// eslint-disable-line no-empty
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
export async function locateElectronModule(projectRootPath, startDir) {
|
||||
startDir ??= process.cwd();
|
||||
for (const moduleName of electronModuleNames) {
|
||||
const electronPaths = await searchForModule(startDir, moduleName, projectRootPath);
|
||||
const electronPath = electronPaths.find((ePath) => fs.existsSync(path.join(ePath, 'package.json')));
|
||||
if (electronPath) {
|
||||
return electronPath;
|
||||
}
|
||||
}
|
||||
return locateModuleByImport();
|
||||
}
|
||||
//# sourceMappingURL=electron-locator.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"electron-locator.js","sourceRoot":"","sources":["../src/electron-locator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,2BAA2B,CAAC,CAAC;AAEtE,KAAK,UAAU,oBAAoB;IACjC,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE,CAAC;QAC7C,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,UAAU,eAAe,CAAC,CAAC,EAChE,IAAI,CACL,CAAC;YACF,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;gBACzD,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;QACjC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,eAAoC,EACpC,QAA6B;IAE7B,QAAQ,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;IAE3B,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QACnF,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,KAAa,EAAE,EAAE,CACxD,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAChD,CAAC;QAEF,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,YAAY,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC"}
|
||||
-1
@@ -1 +0,0 @@
|
||||
export declare function fetchUrl<T extends 'buffer' | 'text', RT = T extends 'buffer' ? Buffer : string>(url: string, responseType: T, retries?: number): Promise<RT>;
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
import debug from 'debug';
|
||||
import { setTimeout as sleep } from 'node:timers/promises';
|
||||
const d = debug('electron-rebuild');
|
||||
export async function fetchUrl(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 globalThis.fetch(url);
|
||||
if (!response.ok) {
|
||||
d('got bad status code:', response.status);
|
||||
await sleep(2000);
|
||||
return fetchUrl(url, responseType, retries - 1);
|
||||
}
|
||||
d('response came back OK');
|
||||
if (responseType === 'buffer') {
|
||||
return Buffer.from(await response.arrayBuffer());
|
||||
}
|
||||
return (await response.text());
|
||||
}
|
||||
catch (err) {
|
||||
d('request failed for some reason', err);
|
||||
await sleep(2000);
|
||||
return fetchUrl(url, responseType, retries - 1);
|
||||
}
|
||||
}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GAAG,EAAE,YAAY,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
import { rebuild, RebuildOptions } from './rebuild.js';
|
||||
export { rebuild, RebuildOptions };
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
import { rebuild } from './rebuild.js';
|
||||
export { rebuild };
|
||||
//# sourceMappingURL=main.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAkB,CAAC"}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
import { IRebuilder } from './types.js';
|
||||
export declare class ModuleRebuilder {
|
||||
private modulePath;
|
||||
private nodeGyp;
|
||||
private rebuilder;
|
||||
private prebuildify;
|
||||
private prebuildInstall;
|
||||
private nodePreGyp;
|
||||
constructor(rebuilder: IRebuilder, modulePath: string);
|
||||
get metaPath(): string;
|
||||
/**
|
||||
* The marker written to `.forge-meta` after a successful rebuild, and compared against on
|
||||
* subsequent runs to decide whether the module can be skipped. It must capture every input
|
||||
* that changes the resulting binary, so that e.g. a Linux build is not reused for macOS.
|
||||
*/
|
||||
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>;
|
||||
}
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
import debug from 'debug';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { cacheModuleState } from './cache.js';
|
||||
import { NodeGyp } from './module-type/node-gyp/node-gyp.js';
|
||||
import { Prebuildify } from './module-type/prebuildify.js';
|
||||
import { PrebuildInstall } from './module-type/prebuild-install.js';
|
||||
import { NodePreGyp } from './module-type/node-pre-gyp.js';
|
||||
const d = debug('electron-rebuild');
|
||||
export class ModuleRebuilder {
|
||||
modulePath;
|
||||
nodeGyp;
|
||||
rebuilder;
|
||||
prebuildify;
|
||||
prebuildInstall;
|
||||
nodePreGyp;
|
||||
constructor(rebuilder, modulePath) {
|
||||
this.modulePath = modulePath;
|
||||
this.rebuilder = rebuilder;
|
||||
this.nodeGyp = new NodeGyp(rebuilder, modulePath);
|
||||
this.prebuildify = new Prebuildify(rebuilder, modulePath);
|
||||
this.prebuildInstall = new PrebuildInstall(rebuilder, modulePath);
|
||||
this.nodePreGyp = new NodePreGyp(rebuilder, modulePath);
|
||||
}
|
||||
get metaPath() {
|
||||
return path.resolve(this.modulePath, 'build', this.rebuilder.buildType, '.forge-meta');
|
||||
}
|
||||
/**
|
||||
* The marker written to `.forge-meta` after a successful rebuild, and compared against on
|
||||
* subsequent runs to decide whether the module can be skipped. It must capture every input
|
||||
* that changes the resulting binary, so that e.g. a Linux build is not reused for macOS.
|
||||
*/
|
||||
get metaData() {
|
||||
return `${this.rebuilder.platform}--${this.rebuilder.arch}--${this.rebuilder.ABI}`;
|
||||
}
|
||||
async alreadyBuiltByRebuild() {
|
||||
if (fs.existsSync(this.metaPath)) {
|
||||
const meta = await fs.promises.readFile(this.metaPath, 'utf8');
|
||||
return meta === this.metaData;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async cacheModuleState(cacheKey) {
|
||||
if (this.rebuilder.useCache) {
|
||||
await 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.promises.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 && fs.existsSync(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.promises.mkdir(abiPath, { recursive: true });
|
||||
await fs.promises.copyFile(nodePath, path.join(abiPath, `${this.nodeGyp.moduleName}.node`));
|
||||
}
|
||||
}
|
||||
}
|
||||
async writeMetadata() {
|
||||
await fs.promises.mkdir(path.dirname(this.metaPath), { recursive: true });
|
||||
await fs.promises.writeFile(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);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=module-rebuilder.js.map
|
||||
-1
File diff suppressed because one or more lines are too long
-22
@@ -1,22 +0,0 @@
|
||||
import { NodeAPI } from '../node-api.js';
|
||||
import { IRebuilder } from '../types.js';
|
||||
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>;
|
||||
/**
|
||||
* Search dependencies for package using either `packageName` or
|
||||
* `@namespace/packageName` in the case of forks.
|
||||
*/
|
||||
findPackageInDependencies(packageName: string, packageProperty?: string): Promise<string | null>;
|
||||
}
|
||||
export declare function locateBinary(basePath: string, suffix: string): Promise<string | null>;
|
||||
export {};
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { NodeAPI } from '../node-api.js';
|
||||
import { readPackageJson } from '../read-package-json.js';
|
||||
export class NativeModule {
|
||||
rebuilder;
|
||||
_moduleName;
|
||||
modulePath;
|
||||
nodeAPI;
|
||||
packageJSON;
|
||||
constructor(rebuilder, modulePath) {
|
||||
this.rebuilder = rebuilder;
|
||||
this.modulePath = modulePath;
|
||||
this.nodeAPI = new NodeAPI(this.moduleName, this.rebuilder.electronVersion);
|
||||
}
|
||||
get moduleName() {
|
||||
if (!this._moduleName) {
|
||||
const basename = path.basename(this.modulePath);
|
||||
const parentDir = path.basename(path.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 ||= await readPackageJson(this.modulePath);
|
||||
return this.packageJSON[key];
|
||||
}
|
||||
async getSupportedNapiVersions() {
|
||||
const binary = (await this.packageJSONFieldWithDefault('binary', {}));
|
||||
return binary?.napi_versions;
|
||||
}
|
||||
/**
|
||||
* Search dependencies for package using either `packageName` or
|
||||
* `@namespace/packageName` in the case of forks.
|
||||
*/
|
||||
async findPackageInDependencies(packageName, packageProperty = 'dependencies') {
|
||||
const dependencies = await this.packageJSONFieldWithDefault(packageProperty, {});
|
||||
if (typeof dependencies !== 'object')
|
||||
return null;
|
||||
// Look for direct dependency match
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (dependencies.hasOwnProperty(packageName))
|
||||
return packageName;
|
||||
const forkedPackage = Object.keys(dependencies).find((dependency) => dependency.startsWith('@') && dependency.endsWith(`/${packageName}`));
|
||||
return forkedPackage || null;
|
||||
}
|
||||
}
|
||||
export async function locateBinary(basePath, suffix) {
|
||||
let parentPath = basePath;
|
||||
let testPath;
|
||||
while (testPath !== parentPath) {
|
||||
testPath = parentPath;
|
||||
const checkPath = path.resolve(testPath, suffix);
|
||||
if (fs.existsSync(checkPath)) {
|
||||
return checkPath;
|
||||
}
|
||||
parentPath = path.resolve(testPath, '..');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module-type/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,MAAM,OAAO,YAAY;IACb,SAAS,CAAa;IACxB,WAAW,CAAqB;IAC9B,UAAU,CAAS;IACtB,OAAO,CAAU;IAChB,WAAW,CAAgD;IAEnE,YAAY,SAAqB,EAAE,UAAkB;QACnD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CA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ACH,KAAK,CAAC,yBAAyB,CAC7B,WAAmB,EACnB,eAAe,GAAG,cAAc;QAEhC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACjF,IAAI,OAAO,YAAY,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAElD,mCAAmC;QACnC,iDAAiD;QACjD,IAAI,YAAY,CAAC,cAAc,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;QAEjE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAClD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,WAAW,EAAE,CAAC,CACrF,CAAC;QAEF,OAAO,aAAa,IAAI,IAAI,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,MAAc;IACjE,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,IAAI,QAA4B,CAAC;IAEjC,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC/B,QAAQ,GAAG,UAAU,CAAC;QACtB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
import { NativeModule } from '../index.js';
|
||||
export declare class NodeGyp extends NativeModule {
|
||||
buildArgs(prefixedArgs: string[]): Promise<string[]>;
|
||||
buildArgsFromBinaryField(): Promise<string[]>;
|
||||
rebuildModule(): Promise<void>;
|
||||
}
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
import { fork } from 'node:child_process';
|
||||
import debug from 'debug';
|
||||
import path from 'node:path';
|
||||
import { ELECTRON_GYP_DIR } from '../../constants.js';
|
||||
import { getClangEnvironmentVars } from '../../clang-fetcher.js';
|
||||
import { NativeModule } from '../index.js';
|
||||
import { detectLibcFamily } from '../../detect-libc.js';
|
||||
const d = debug('electron-rebuild');
|
||||
export class NodeGyp extends 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}`);
|
||||
}
|
||||
if (this.rebuilder.jobs) {
|
||||
args.push(`--jobs=${this.rebuilder.jobs}`);
|
||||
}
|
||||
// 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
|
||||
const [maj, min] = this.rebuilder.electronVersion.split('.').map(Number);
|
||||
if (maj < 14 || (maj === 14 && min < 2) || (maj === 15 && min < 3)) {
|
||||
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.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}', detectLibcFamily() || '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() {
|
||||
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 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 = fork(path.resolve(import.meta.dirname, 'worker.js'), {
|
||||
env,
|
||||
cwd: this.modulePath,
|
||||
stdio: 'pipe',
|
||||
});
|
||||
const outputBuffers = [];
|
||||
forkedChild.stdout?.on('data', (chunk) => {
|
||||
outputBuffers.push(chunk);
|
||||
});
|
||||
forkedChild.stderr?.on('data', (chunk) => {
|
||||
outputBuffers.push(chunk);
|
||||
});
|
||||
forkedChild.send({
|
||||
moduleName: this.moduleName,
|
||||
nodeGypArgs,
|
||||
extraNodeGypArgs,
|
||||
devDir: this.rebuilder.mode === 'sequential'
|
||||
? ELECTRON_GYP_DIR
|
||||
: path.resolve(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}'`));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=node-gyp.js.map
|
||||
-1
File diff suppressed because one or more lines are too long
-1
@@ -1 +0,0 @@
|
||||
export {};
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import NodeGypRunner from 'node-gyp';
|
||||
process.on('message', async ({ nodeGypArgs, devDir, extraNodeGypArgs }) => {
|
||||
const nodeGyp = NodeGypRunner();
|
||||
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 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
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/module-type/node-gyp/worker.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,UAAU,CAAC;AAErC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE;IACxE,MAAM,OAAO,GAAG,aAAa,EAAE,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,CAAC;QACH,OAAO,OAAO,EAAE,CAAC;YACf,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBACjC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YACvF,CAAC;iBAAM,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACpE,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;YACJ,CAAC;YACD,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnD,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
import { NativeModule } from './index.js';
|
||||
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;
|
||||
}
|
||||
-110
@@ -1,110 +0,0 @@
|
||||
import debug from 'debug';
|
||||
import { readBinaryFileArch } from 'read-binary-file-arch';
|
||||
import { locateBinary, NativeModule } from './index.js';
|
||||
import { spawn } from '@malept/cross-spawn-promise';
|
||||
const d = debug('electron-rebuild');
|
||||
export class NodePreGyp extends NativeModule {
|
||||
async usesTool() {
|
||||
const packageName = await this.findPackageInDependencies('node-pre-gyp');
|
||||
return !!packageName;
|
||||
}
|
||||
async locateBinary() {
|
||||
const packageName = await this.findPackageInDependencies('node-pre-gyp');
|
||||
if (!packageName)
|
||||
return null;
|
||||
return locateBinary(this.modulePath, `node_modules/${packageName}/bin/node-pre-gyp`);
|
||||
}
|
||||
async run(nodePreGypPath) {
|
||||
const redownloadBinary = await this.shouldUpdateBinary(nodePreGypPath);
|
||||
await spawn(process.execPath, [
|
||||
nodePreGypPath,
|
||||
'reinstall',
|
||||
'--fallback-to-build',
|
||||
...(redownloadBinary ? ['--update-binary'] : []),
|
||||
`--arch=${this.rebuilder.arch}`, // fallback build arch
|
||||
`--target_arch=${this.rebuilder.arch}`, // prebuild arch
|
||||
`--target_platform=${this.rebuilder.platform}`,
|
||||
...(await this.getNodePreGypRuntimeArgs()),
|
||||
], {
|
||||
cwd: this.modulePath,
|
||||
});
|
||||
}
|
||||
async findPrebuiltModule() {
|
||||
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 (err?.message?.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 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 spawn(process.execPath, [
|
||||
nodePreGypPath,
|
||||
'reveal',
|
||||
'module', // pick property with module path
|
||||
`--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);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=node-pre-gyp.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"node-pre-gyp.js","sourceRoot":"","sources":["../../src/module-type/node-pre-gyp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,MAAM,CAAC,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAEpC,MAAM,OAAO,UAAW,SAAQ,YAAY;IAC1C,KAAK,CAAC,QAAQ;QACZ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