From d6518698b1c489c50e4fc2095e63a9127b81801b Mon Sep 17 00:00:00 2001 From: M_Viper Date: Thu, 22 Oct 2026 06:56:19 +0000 Subject: [PATCH] Upload via GUI (7543 Dateien) --- node_modules/@electron/asar/LICENSE.md | 20 ++ node_modules/@electron/asar/README.md | 208 +++++++++++++++ node_modules/@electron/asar/lib/types/glob.js | 3 + .../@electron/asar/lib/types/glob.js.map | 1 + .../@electron/asar/lib/wrapped-fs.d.ts | 13 + node_modules/@electron/asar/lib/wrapped-fs.js | 26 ++ .../@electron/asar/lib/wrapped-fs.js.map | 1 + node_modules/@electron/asar/package.json | 60 +++++ node_modules/@electron/fuses/LICENSE | 20 ++ node_modules/@electron/fuses/README.md | 78 ++++++ node_modules/@electron/fuses/dist/bin.d.ts | 2 + node_modules/@electron/fuses/dist/bin.js | 146 +++++++++++ node_modules/@electron/fuses/dist/bin.js.map | 1 + node_modules/@electron/fuses/dist/config.d.ts | 34 +++ node_modules/@electron/fuses/dist/config.js | 22 ++ .../@electron/fuses/dist/config.js.map | 1 + .../@electron/fuses/dist/constants.d.ts | 7 + .../@electron/fuses/dist/constants.js | 12 + .../@electron/fuses/dist/constants.js.map | 1 + node_modules/@electron/fuses/dist/index.d.ts | 5 + node_modules/@electron/fuses/dist/index.js | 155 +++++++++++ .../@electron/fuses/dist/index.js.map | 1 + .../@electron/fuses/dist/tsconfig.tsbuildinfo | 1 + node_modules/@electron/fuses/package.json | 58 +++++ node_modules/@electron/get/dist/Cache.d.ts | 9 + node_modules/@electron/get/dist/Cache.js | 99 +++++++ node_modules/@electron/get/dist/Cache.js.map | 1 + .../@electron/get/dist/Downloader.d.ts | 18 ++ node_modules/@electron/get/dist/Downloader.js | 2 + .../@electron/get/dist/Downloader.js.map | 1 + .../@electron/get/dist/FetchDownloader.d.ts | 43 +++ .../@electron/get/dist/FetchDownloader.js | 82 ++++++ .../@electron/get/dist/FetchDownloader.js.map | 1 + .../@electron/get/dist/artifact-utils.d.ts | 4 + .../@electron/get/dist/artifact-utils.js | 54 ++++ .../@electron/get/dist/artifact-utils.js.map | 1 + .../get/dist/downloader-resolver.d.ts | 3 + .../@electron/get/dist/downloader-resolver.js | 5 + .../get/dist/downloader-resolver.js.map | 1 + node_modules/@electron/get/dist/index.d.ts | 27 ++ node_modules/@electron/get/dist/index.js | 188 ++++++++++++++ node_modules/@electron/get/dist/index.js.map | 1 + node_modules/@electron/get/dist/proxy.d.ts | 14 + node_modules/@electron/get/dist/proxy.js | 28 ++ node_modules/@electron/get/dist/proxy.js.map | 1 + node_modules/@electron/get/dist/types.d.ts | 244 ++++++++++++++++++ node_modules/@electron/get/dist/types.js | 25 ++ node_modules/@electron/get/dist/types.js.map | 1 + node_modules/@electron/get/dist/utils.d.ts | 38 +++ node_modules/@electron/get/dist/utils.js | 147 +++++++++++ 50 files changed, 1914 insertions(+) create mode 100644 node_modules/@electron/asar/LICENSE.md create mode 100644 node_modules/@electron/asar/README.md create mode 100644 node_modules/@electron/asar/lib/types/glob.js create mode 100644 node_modules/@electron/asar/lib/types/glob.js.map create mode 100644 node_modules/@electron/asar/lib/wrapped-fs.d.ts create mode 100644 node_modules/@electron/asar/lib/wrapped-fs.js create mode 100644 node_modules/@electron/asar/lib/wrapped-fs.js.map create mode 100644 node_modules/@electron/asar/package.json create mode 100644 node_modules/@electron/fuses/LICENSE create mode 100644 node_modules/@electron/fuses/README.md create mode 100644 node_modules/@electron/fuses/dist/bin.d.ts create mode 100644 node_modules/@electron/fuses/dist/bin.js create mode 100644 node_modules/@electron/fuses/dist/bin.js.map create mode 100644 node_modules/@electron/fuses/dist/config.d.ts create mode 100644 node_modules/@electron/fuses/dist/config.js create mode 100644 node_modules/@electron/fuses/dist/config.js.map create mode 100644 node_modules/@electron/fuses/dist/constants.d.ts create mode 100644 node_modules/@electron/fuses/dist/constants.js create mode 100644 node_modules/@electron/fuses/dist/constants.js.map create mode 100644 node_modules/@electron/fuses/dist/index.d.ts create mode 100644 node_modules/@electron/fuses/dist/index.js create mode 100644 node_modules/@electron/fuses/dist/index.js.map create mode 100644 node_modules/@electron/fuses/dist/tsconfig.tsbuildinfo create mode 100644 node_modules/@electron/fuses/package.json create mode 100644 node_modules/@electron/get/dist/Cache.d.ts create mode 100644 node_modules/@electron/get/dist/Cache.js create mode 100644 node_modules/@electron/get/dist/Cache.js.map create mode 100644 node_modules/@electron/get/dist/Downloader.d.ts create mode 100644 node_modules/@electron/get/dist/Downloader.js create mode 100644 node_modules/@electron/get/dist/Downloader.js.map create mode 100644 node_modules/@electron/get/dist/FetchDownloader.d.ts create mode 100644 node_modules/@electron/get/dist/FetchDownloader.js create mode 100644 node_modules/@electron/get/dist/FetchDownloader.js.map create mode 100644 node_modules/@electron/get/dist/artifact-utils.d.ts create mode 100644 node_modules/@electron/get/dist/artifact-utils.js create mode 100644 node_modules/@electron/get/dist/artifact-utils.js.map create mode 100644 node_modules/@electron/get/dist/downloader-resolver.d.ts create mode 100644 node_modules/@electron/get/dist/downloader-resolver.js create mode 100644 node_modules/@electron/get/dist/downloader-resolver.js.map create mode 100644 node_modules/@electron/get/dist/index.d.ts create mode 100644 node_modules/@electron/get/dist/index.js create mode 100644 node_modules/@electron/get/dist/index.js.map create mode 100644 node_modules/@electron/get/dist/proxy.d.ts create mode 100644 node_modules/@electron/get/dist/proxy.js create mode 100644 node_modules/@electron/get/dist/proxy.js.map create mode 100644 node_modules/@electron/get/dist/types.d.ts create mode 100644 node_modules/@electron/get/dist/types.js create mode 100644 node_modules/@electron/get/dist/types.js.map create mode 100644 node_modules/@electron/get/dist/utils.d.ts create mode 100644 node_modules/@electron/get/dist/utils.js diff --git a/node_modules/@electron/asar/LICENSE.md b/node_modules/@electron/asar/LICENSE.md new file mode 100644 index 0000000..4d231b4 --- /dev/null +++ b/node_modules/@electron/asar/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2014 GitHub Inc. + +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. diff --git a/node_modules/@electron/asar/README.md b/node_modules/@electron/asar/README.md new file mode 100644 index 0000000..ff605d1 --- /dev/null +++ b/node_modules/@electron/asar/README.md @@ -0,0 +1,208 @@ +# @electron/asar - Electron Archive + +[![Test](https://github.com/electron/asar/actions/workflows/test.yml/badge.svg)](https://github.com/electron/asar/actions/workflows/test.yml) +[![npm version](http://img.shields.io/npm/v/@electron/asar.svg)](https://npmjs.org/package/@electron/asar) + +Asar is a simple extensive archive format, it works like `tar` that concatenates +all files together without compression, while having random access support. + +## Features + +* Support random access +* Use JSON to store files' information +* Very easy to write a parser + +## Command line utility + +### Install + +This module requires Node 10 or later. + +```bash +$ npm install --engine-strict @electron/asar +``` + +### Usage + +```bash +$ asar --help + + Usage: asar [options] [command] + + Commands: + + pack|p + create asar archive + + list|l + list files of asar archive + + extract-file|ef + extract one file from archive + + extract|e + extract archive + + + Options: + + -h, --help output usage information + -V, --version output the version number + +``` + +#### Excluding multiple resources from being packed + +Given: +``` + app +(a) ├── x1 +(b) ├── x2 +(c) ├── y3 +(d) │   ├── x1 +(e) │   └── z1 +(f) │   └── x2 +(g) └── z4 +(h) └── w1 +``` + +Exclude: a, b +```bash +$ asar pack app app.asar --unpack-dir "{x1,x2}" +``` + +Exclude: a, b, d, f +```bash +$ asar pack app app.asar --unpack-dir "**/{x1,x2}" +``` + +Exclude: a, b, d, f, h +```bash +$ asar pack app app.asar --unpack-dir "{**/x1,**/x2,z4/w1}" +``` + +## Using programmatically + +### Example + +```javascript +const asar = require('@electron/asar'); + +const src = 'some/path/'; +const dest = 'name.asar'; + +await asar.createPackage(src, dest); +console.log('done.'); +``` + +Please note that there is currently **no** error handling provided! + +### Transform +You can pass in a `transform` option, that is a function, which either returns +nothing, or a `stream.Transform`. The latter will be used on files that will be +in the `.asar` file to transform them (e.g. compress). + +```javascript +const asar = require('@electron/asar'); + +const src = 'some/path/'; +const dest = 'name.asar'; + +function transform (filename) { + return new CustomTransformStream() +} + +await asar.createPackageWithOptions(src, dest, { transform: transform }); +console.log('done.'); +``` + +## Format + +Asar uses [Pickle][pickle] to safely serialize binary value to file. + +The format of asar is very flat: + +``` +| UInt32: header_size | String: header | Bytes: file1 | ... | Bytes: file42 | +``` + +The `header_size` and `header` are serialized with [Pickle][pickle] class, and +`header_size`'s [Pickle][pickle] object is 8 bytes. + +The `header` is a JSON string, and the `header_size` is the size of `header`'s +`Pickle` object. + +Structure of `header` is something like this: + +```json +{ + "files": { + "tmp": { + "files": {} + }, + "usr" : { + "files": { + "bin": { + "files": { + "ls": { + "offset": "0", + "size": 100, + "executable": true, + "integrity": { + "algorithm": "SHA256", + "hash": "...", + "blockSize": 1024, + "blocks": ["...", "..."] + } + }, + "cd": { + "offset": "100", + "size": 100, + "executable": true, + "integrity": { + "algorithm": "SHA256", + "hash": "...", + "blockSize": 1024, + "blocks": ["...", "..."] + } + } + } + } + } + }, + "etc": { + "files": { + "hosts": { + "offset": "200", + "size": 32, + "integrity": { + "algorithm": "SHA256", + "hash": "...", + "blockSize": 1024, + "blocks": ["...", "..."] + } + } + } + } + } +} +``` + +`offset` and `size` records the information to read the file from archive, the +`offset` starts from 0 so you have to manually add the size of `header_size` and +`header` to the `offset` to get the real offset of the file. + +`offset` is a UINT64 number represented in string, because there is no way to +precisely represent UINT64 in JavaScript `Number`. `size` is a JavaScript +`Number` that is no larger than `Number.MAX_SAFE_INTEGER`, which has a value of +`9007199254740991` and is about 8PB in size. We didn't store `size` in UINT64 +because file size in Node.js is represented as `Number` and it is not safe to +convert `Number` to UINT64. + +`integrity` is an object consisting of a few keys: +* A hashing `algorithm`, currently only `SHA256` is supported. +* A hex encoded `hash` value representing the hash of the entire file. +* An array of hex encoded hashes for the `blocks` of the file. i.e. for a blockSize of 4KB this array contains the hash of every block if you split the file into N 4KB blocks. +* A integer value `blockSize` representing the size in bytes of each block in the `blocks` hashes above + +[pickle]: https://chromium.googlesource.com/chromium/src/+/main/base/pickle.h diff --git a/node_modules/@electron/asar/lib/types/glob.js b/node_modules/@electron/asar/lib/types/glob.js new file mode 100644 index 0000000..e67aa08 --- /dev/null +++ b/node_modules/@electron/asar/lib/types/glob.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=glob.js.map \ No newline at end of file diff --git a/node_modules/@electron/asar/lib/types/glob.js.map b/node_modules/@electron/asar/lib/types/glob.js.map new file mode 100644 index 0000000..be1b090 --- /dev/null +++ b/node_modules/@electron/asar/lib/types/glob.js.map @@ -0,0 +1 @@ +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/types/glob.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@electron/asar/lib/wrapped-fs.d.ts b/node_modules/@electron/asar/lib/wrapped-fs.d.ts new file mode 100644 index 0000000..b0be31e --- /dev/null +++ b/node_modules/@electron/asar/lib/wrapped-fs.d.ts @@ -0,0 +1,13 @@ +type AsarFS = typeof import('fs') & { + mkdirp(dir: string): Promise; + mkdirpSync(dir: string): void; + lstat: (typeof import('fs'))['promises']['lstat']; + mkdtemp: (typeof import('fs'))['promises']['mkdtemp']; + readFile: (typeof import('fs'))['promises']['readFile']; + stat: (typeof import('fs'))['promises']['stat']; + writeFile: (typeof import('fs'))['promises']['writeFile']; + symlink: (typeof import('fs'))['promises']['symlink']; + readlink: (typeof import('fs'))['promises']['readlink']; +}; +declare const promisified: AsarFS; +export default promisified; diff --git a/node_modules/@electron/asar/lib/wrapped-fs.js b/node_modules/@electron/asar/lib/wrapped-fs.js new file mode 100644 index 0000000..7f0e2b2 --- /dev/null +++ b/node_modules/@electron/asar/lib/wrapped-fs.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = 'electron' in process.versions ? require('original-fs') : require('fs'); +const promisifiedMethods = [ + 'lstat', + 'mkdtemp', + 'readFile', + 'stat', + 'writeFile', + 'symlink', + 'readlink', +]; +const promisified = {}; +for (const method of Object.keys(fs)) { + if (promisifiedMethods.includes(method)) { + promisified[method] = fs.promises[method]; + } + else { + promisified[method] = fs[method]; + } +} +// To make it more like fs-extra +promisified.mkdirp = (dir) => fs.promises.mkdir(dir, { recursive: true }); +promisified.mkdirpSync = (dir) => fs.mkdirSync(dir, { recursive: true }); +exports.default = promisified; +//# sourceMappingURL=wrapped-fs.js.map \ No newline at end of file diff --git a/node_modules/@electron/asar/lib/wrapped-fs.js.map b/node_modules/@electron/asar/lib/wrapped-fs.js.map new file mode 100644 index 0000000..40daf44 --- /dev/null +++ b/node_modules/@electron/asar/lib/wrapped-fs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapped-fs.js","sourceRoot":"","sources":["../src/wrapped-fs.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,GAAG,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnF,MAAM,kBAAkB,GAAG;IACzB,OAAO;IACP,SAAS;IACT,UAAU;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,UAAU;CACX,CAAC;AAcF,MAAM,WAAW,GAAG,EAAY,CAAC;AAEjC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACrC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,WAAmB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACL,WAAmB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AACD,gCAAgC;AAChC,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,WAAW,CAAC,UAAU,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE,kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/node_modules/@electron/asar/package.json b/node_modules/@electron/asar/package.json new file mode 100644 index 0000000..bb0f29e --- /dev/null +++ b/node_modules/@electron/asar/package.json @@ -0,0 +1,60 @@ +{ + "name": "@electron/asar", + "description": "Creating Electron app packages", + "version": "3.4.1", + "main": "./lib/asar.js", + "types": "./lib/asar.d.ts", + "bin": { + "asar": "./bin/asar.js" + }, + "files": [ + "bin", + "lib" + ], + "engines": { + "node": ">=10.12.0" + }, + "license": "MIT", + "homepage": "https://github.com/electron/asar", + "repository": { + "type": "git", + "url": "git+https://github.com/electron/asar.git" + }, + "bugs": { + "url": "https://github.com/electron/asar/issues" + }, + "publishConfig": { + "provenance": true + }, + "scripts": { + "build": "tsc", + "mocha": "xvfb-maybe electron-mocha && mocha", + "mocha:update": "mocha --update", + "mocha:watch": "mocha --watch", + "test": "yarn lint && yarn mocha", + "lint": "yarn prettier:check", + "prettier": "prettier \"src/**/*.ts\" \"test/**/*.js\" \"*.js\"", + "prettier:check": "yarn prettier --check", + "prettier:write": "yarn prettier --write", + "prepare": "tsc" + }, + "dependencies": { + "commander": "^5.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.4" + }, + "devDependencies": { + "@types/minimatch": "^3.0.5", + "@types/node": "^12.0.0", + "chai": "^4.5.0", + "electron": "^22.0.0", + "electron-mocha": "^13.0.1", + "lodash": "^4.17.15", + "mocha": "^10.1.0", + "mocha-chai-jest-snapshot": "^1.1.6", + "prettier": "^3.3.3", + "rimraf": "^3.0.2", + "typescript": "^5.5.4", + "xvfb-maybe": "^0.2.1" + } +} diff --git a/node_modules/@electron/fuses/LICENSE b/node_modules/@electron/fuses/LICENSE new file mode 100644 index 0000000..03deca3 --- /dev/null +++ b/node_modules/@electron/fuses/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2020 Electron Maintainers. + +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. diff --git a/node_modules/@electron/fuses/README.md b/node_modules/@electron/fuses/README.md new file mode 100644 index 0000000..2852927 --- /dev/null +++ b/node_modules/@electron/fuses/README.md @@ -0,0 +1,78 @@ +# @electron/fuses + +> Flip [Electron Fuses](https://github.com/electron/electron/blob/main/docs/tutorial/fuses.md) and customize your packaged build of Electron + +[![CircleCI](https://circleci.com/gh/electron/fuses.svg?style=shield)](https://circleci.com/gh/electron/fuses) +[![npm version](http://img.shields.io/npm/v/@electron/fuses.svg)](https://npmjs.org/package/@electron/fuses) + +## Usage + +### Via JavaScript + +```typescript +import { flipFuses, FuseVersion, FuseV1Options } from '@electron/fuses'; + +// During your build / package process +await flipFuses( + require('electron'), // Returns the path to the electron binary + { + version: FuseVersion.V1, + [FuseV1Options.RunAsNode]: false, // Disables ELECTRON_RUN_AS_NODE + [FuseV1Options.EnableCookieEncryption]: true, // Enables cookie encryption + [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, // Disables the NODE_OPTIONS environment variable + [FuseV1Options.EnableNodeCliInspectArguments]: false, // Disables the --inspect and --inspect-brk family of CLI options + [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, // Enables validation of the app.asar archive on macOS + [FuseV1Options.OnlyLoadAppFromAsar]: true, // Enforces that Electron will only load your app from "app.asar" instead of its normal search paths + [FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]: true, // Loads V8 Snapshot from `browser_v8_context_snapshot.bin` for the browser process + [FuseV1Options.GrantFileProtocolExtraPrivileges]: true, // Grants the file protocol extra privileges + }, +); +``` + +### From the command line + +```sh +$ npx @electron/fuses read --app /Applications/Foo.app +$ npx @electron/fuses write --app /Applications/Foo.app <...key=on/off> +``` + +### Apple Silicon + +For `arm64` macOS builds of your app if you are not immediately codesigning your app after flipping +the fuses you will need to pass `resetAdHocDarwinSignature: true` to the `flipFuses` method. Otherwise +the app will refuse to launch with code signature validation errors. This is a new security measure on +Apple Silicon devices. + +```typescript +import { flipFuses, FuseVersion, FuseV1Options } from '@electron/fuses'; + +await flipFuses( + require('electron'), + { + version: FuseVersion.V1, + resetAdHocDarwinSignature: targetPlatform === 'darwin' && targetArch === 'arm64', + [FuseV1Options.RunAsNode]: false, + }, +); +``` + +### New Fuses + +If you want to ensure you provide a config for every fuse, even newly added fuses during Electron upgrades +you can set the `strictlyRequireAllFuses` option to `true`. This will hard fail the build if you are on +a version of `@electron/fuses` that doesn't have configuration options for every fuse in the Electron binary +you are targetting or if you don't provide a configuration for a specific fuse present in the Electron binary +you are targetting. + +```typescript +import { flipFuses, FuseVersion, FuseV1Options } from '@electron/fuses'; + +await flipFuses( + require('electron'), + { + version: FuseVersion.V1, + strictlyRequireAllFuses: true, + [FuseV1Options.RunAsNode]: false, + }, +); +``` diff --git a/node_modules/@electron/fuses/dist/bin.d.ts b/node_modules/@electron/fuses/dist/bin.d.ts new file mode 100644 index 0000000..b798801 --- /dev/null +++ b/node_modules/@electron/fuses/dist/bin.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/node_modules/@electron/fuses/dist/bin.js b/node_modules/@electron/fuses/dist/bin.js new file mode 100644 index 0000000..6f51edb --- /dev/null +++ b/node_modules/@electron/fuses/dist/bin.js @@ -0,0 +1,146 @@ +#!/usr/bin/env node +"use strict"; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const chalk = require("chalk"); +const minimist = require("minimist"); +const path = require("path"); +const _1 = require("."); +const config_1 = require("./config"); +const constants_1 = require("./constants"); +const mode = process.argv[2]; +const readHelpText = `electron-fuses read --app [path-to-app]`; +const writeHelpText = `electron-fuses write --app [path-to-app] <...key=on/off>`; +if (mode !== 'read' && mode !== 'write') { + console.error('Invalid mode, check the usage below:'); + console.info(readHelpText); + console.info(writeHelpText); + process.exit(0); +} +function stringForState(state) { + switch (state) { + case constants_1.FuseState.ENABLE: + return chalk.green('Enabled'); + case constants_1.FuseState.DISABLE: + return chalk.red('Disabled'); + case constants_1.FuseState.INHERIT: + return chalk.yellow('Inherited'); + case constants_1.FuseState.REMOVED: + return chalk.strikethrough(chalk.red('Removed')); + } +} +if (mode === 'read') { + const argv = minimist(process.argv.slice(3), { + string: ['app'], + boolean: ['help'], + }); + if (argv.help) { + console.log(readHelpText); + process.exit(0); + } + if (!argv.app) { + console.error('--app argument is required'); + process.exit(1); + } + console.log('Analyzing app:', chalk.cyan(path.basename(argv.app))); + (0, _1.getCurrentFuseWire)(argv.app) + .then((config) => { + const { version, resetAdHocDarwinSignature, strictlyRequireAllFuses } = config, rest = __rest(config, ["version", "resetAdHocDarwinSignature", "strictlyRequireAllFuses"]); + console.log(`Fuse Version: ${chalk.cyan(`v${version}`)}`); + switch (config.version) { + case config_1.FuseVersion.V1: + for (const key of Object.keys(rest)) { + console.log(` ${chalk.yellow(config_1.FuseV1Options[key])} is ${stringForState(rest[key])}`); + } + break; + } + }) + .catch((err) => { + console.error(err); + process.exit(1); + }); +} +else { + const argv = minimist(process.argv.slice(3), { + string: ['app'], + boolean: ['help'], + }); + if (argv.help) { + console.log(writeHelpText); + process.exit(0); + } + if (!argv.app) { + console.error('--app argument is required'); + process.exit(1); + } + console.log('Analyzing app:', chalk.cyan(path.basename(argv.app))); + (0, _1.getCurrentFuseWire)(argv.app) + .then((config) => { + const { version, resetAdHocDarwinSignature } = config, rest = __rest(config, ["version", "resetAdHocDarwinSignature"]); + console.log(`Fuse Version: ${chalk.cyan(`v${version}`)}`); + const keyPairs = argv._ || []; + for (const keyPair of keyPairs) { + const [key, state] = keyPair.split('='); + if (!key || !state) { + console.error('Invalid fuse:', keyPair); + console.error('Must be in the format FuseName=on/off'); + process.exit(1); + } + if (state !== 'on' && state !== 'off') { + console.error('Invalid fuse state:', chalk.yellow(keyPair)); + console.error(`Fuses can only be set to the "${chalk.green('on')}" or "${chalk.red('off')}" state`); + process.exit(1); + } + switch (config.version) { + case config_1.FuseVersion.V1: + const validFuseNames = Object.keys(config_1.FuseV1Options).filter((k) => !/^[0-9]+$/.test(k)); + if (!validFuseNames.includes(key)) { + console.error('Invalid fuse name', chalk.yellow(key)); + console.error('Expected name to be one of', chalk.yellow(JSON.stringify(validFuseNames))); + process.exit(1); + } + const currentState = config[config_1.FuseV1Options[key]]; + const newState = state === 'on' ? constants_1.FuseState.ENABLE : constants_1.FuseState.DISABLE; + if (currentState === newState) { + console.log(` ${chalk.yellow(key)} is already ${stringForState(currentState)} and will not be changed`); + } + else { + console.log(` ${chalk.yellow(key)} is ${stringForState(currentState)} and will become ${stringForState(newState)}`); + } + config[config_1.FuseV1Options[key]] = newState; + break; + } + } + console.log('Writing to app:', chalk.cyan(path.basename(argv.app))); + function adaptConfig(config) { + const { version, resetAdHocDarwinSignature } = config, rest = __rest(config, ["version", "resetAdHocDarwinSignature"]); + const fuseConfig = { + version, + resetAdHocDarwinSignature, + }; + for (const key of Object.keys(rest)) { + fuseConfig[key] = rest[key] === constants_1.FuseState.ENABLE; + } + return fuseConfig; + } + return (0, _1.flipFuses)(argv.app, adaptConfig(config)); + }) + .then(() => { + console.log(chalk.green('Fuses written to disk')); + }) + .catch((err) => { + console.error(err); + process.exit(1); + }); +} +//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/bin.js.map b/node_modules/@electron/fuses/dist/bin.js.map new file mode 100644 index 0000000..67d5a03 --- /dev/null +++ b/node_modules/@electron/fuses/dist/bin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,+BAA+B;AAC/B,qCAAqC;AACrC,6BAA6B;AAE7B,wBAAkD;AAClD,qCAAkE;AAClE,2CAAwC;AAYxC,MAAM,IAAI,G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config.d.ts new file mode 100644 index 0000000..ee64269 --- /dev/null +++ b/node_modules/@electron/fuses/dist/config.d.ts @@ -0,0 +1,34 @@ +export declare enum FuseVersion { + V1 = "1" +} +/** + * Maps config keys to their index in the fuse wire + */ +export declare enum FuseV1Options { + RunAsNode = 0, + EnableCookieEncryption = 1, + EnableNodeOptionsEnvironmentVariable = 2, + EnableNodeCliInspectArguments = 3, + EnableEmbeddedAsarIntegrityValidation = 4, + OnlyLoadAppFromAsar = 5, + LoadBrowserProcessSpecificV8Snapshot = 6, + GrantFileProtocolExtraPrivileges = 7 +} +export declare type FuseV1Config = { + version: FuseVersion.V1; + resetAdHocDarwinSignature?: boolean; + /** + * Ensures that all fuses in the fuse wire being set have been defined to a set value + * by the provided config. Set this to true to ensure you don't accidentally miss a + * fuse being added in future Electron upgrades. + * + * This option may default to "true" in a future version of @electron/fuses but currently + * defaults to "false" + */ + strictlyRequireAllFuses?: boolean; +} & ((Partial> & { + strictlyRequireAllFuses?: false | undefined; +}) | (Record & { + strictlyRequireAllFuses: true; +})); +export declare type FuseConfig = FuseV1Config; diff --git a/node_modules/@electron/fuses/dist/config.js b/node_modules/@electron/fuses/dist/config.js new file mode 100644 index 0000000..6561e08 --- /dev/null +++ b/node_modules/@electron/fuses/dist/config.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FuseV1Options = exports.FuseVersion = void 0; +var FuseVersion; +(function (FuseVersion) { + FuseVersion["V1"] = "1"; +})(FuseVersion = exports.FuseVersion || (exports.FuseVersion = {})); +/** + * Maps config keys to their index in the fuse wire + */ +var FuseV1Options; +(function (FuseV1Options) { + FuseV1Options[FuseV1Options["RunAsNode"] = 0] = "RunAsNode"; + FuseV1Options[FuseV1Options["EnableCookieEncryption"] = 1] = "EnableCookieEncryption"; + FuseV1Options[FuseV1Options["EnableNodeOptionsEnvironmentVariable"] = 2] = "EnableNodeOptionsEnvironmentVariable"; + FuseV1Options[FuseV1Options["EnableNodeCliInspectArguments"] = 3] = "EnableNodeCliInspectArguments"; + FuseV1Options[FuseV1Options["EnableEmbeddedAsarIntegrityValidation"] = 4] = "EnableEmbeddedAsarIntegrityValidation"; + FuseV1Options[FuseV1Options["OnlyLoadAppFromAsar"] = 5] = "OnlyLoadAppFromAsar"; + FuseV1Options[FuseV1Options["LoadBrowserProcessSpecificV8Snapshot"] = 6] = "LoadBrowserProcessSpecificV8Snapshot"; + FuseV1Options[FuseV1Options["GrantFileProtocolExtraPrivileges"] = 7] = "GrantFileProtocolExtraPrivileges"; +})(FuseV1Options = exports.FuseV1Options || (exports.FuseV1Options = {})); +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/config.js.map b/node_modules/@electron/fuses/dist/config.js.map new file mode 100644 index 0000000..3d58cc8 --- /dev/null +++ b/node_modules/@electron/fuses/dist/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAEX;AAFD,WAAY,WAAW;IACrB,uBAAQ,CAAA;AACV,CAAC,EAFW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAEtB;AAED;;GAEG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACvB,2DAAa,CAAA;IACb,qFAA0B,CAAA;IAC1B,iHAAwC,CAAA;IACxC,mGAAiC,CAAA;IACjC,mHAAyC,CAAA;IACzC,+EAAuB,CAAA;IACvB,iHAAwC,CAAA;IACxC,yGAAoC,CAAA;AACtC,CAAC,EATW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QASxB"} \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/constants.d.ts b/node_modules/@electron/fuses/dist/constants.d.ts new file mode 100644 index 0000000..92190ac --- /dev/null +++ b/node_modules/@electron/fuses/dist/constants.d.ts @@ -0,0 +1,7 @@ +export declare const SENTINEL = "dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX"; +export declare enum FuseState { + DISABLE = 48, + ENABLE = 49, + REMOVED = 114, + INHERIT = 144 +} diff --git a/node_modules/@electron/fuses/dist/constants.js b/node_modules/@electron/fuses/dist/constants.js new file mode 100644 index 0000000..47ab477 --- /dev/null +++ b/node_modules/@electron/fuses/dist/constants.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FuseState = exports.SENTINEL = void 0; +exports.SENTINEL = 'dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX'; +var FuseState; +(function (FuseState) { + FuseState[FuseState["DISABLE"] = 48] = "DISABLE"; + FuseState[FuseState["ENABLE"] = 49] = "ENABLE"; + FuseState[FuseState["REMOVED"] = 114] = "REMOVED"; + FuseState[FuseState["INHERIT"] = 144] = "INHERIT"; +})(FuseState = exports.FuseState || (exports.FuseState = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/constants.js.map b/node_modules/@electron/fuses/dist/constants.js.map new file mode 100644 index 0000000..95ed279 --- /dev/null +++ b/node_modules/@electron/fuses/dist/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,kCAAkC,CAAC;AAE3D,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,gDAAc,CAAA;IACd,8CAAa,CAAA;IACb,iDAAc,CAAA;IACd,iDAAc,CAAA;AAChB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB"} \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/index.d.ts b/node_modules/@electron/fuses/dist/index.d.ts new file mode 100644 index 0000000..0719a8e --- /dev/null +++ b/node_modules/@electron/fuses/dist/index.d.ts @@ -0,0 +1,5 @@ +import { FuseConfig } from './config'; +import { FuseState } from './constants'; +export * from './config'; +export declare const getCurrentFuseWire: (pathToElectron: string) => Promise>; +export declare const flipFuses: (pathToElectron: string, fuseConfig: FuseConfig) => Promise; diff --git a/node_modules/@electron/fuses/dist/index.js b/node_modules/@electron/fuses/dist/index.js new file mode 100644 index 0000000..b54ccf0 --- /dev/null +++ b/node_modules/@electron/fuses/dist/index.js @@ -0,0 +1,155 @@ +"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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.flipFuses = exports.getCurrentFuseWire = void 0; +const cp = require("child_process"); +const fs = require("fs-extra"); +const path = require("path"); +const config_1 = require("./config"); +const constants_1 = require("./constants"); +__exportStar(require("./config"), exports); +const state = (b) => b === undefined ? constants_1.FuseState.INHERIT : b ? constants_1.FuseState.ENABLE : constants_1.FuseState.DISABLE; +const buildFuseV1Wire = (config, wireLength) => { + const { version } = config, nonVersionConfig = __rest(config, ["version"]); + const badFuseOption = Object.keys(nonVersionConfig).find((fuseOption) => parseInt(fuseOption, 10) >= wireLength); + if (badFuseOption !== undefined) { + throw new Error(`Trying to configure ${config_1.FuseV1Options[badFuseOption]} but the fuse wire in this version of Electron is not long enough`); + } + return [ + state(config[config_1.FuseV1Options.RunAsNode]), + state(config[config_1.FuseV1Options.EnableCookieEncryption]), + state(config[config_1.FuseV1Options.EnableNodeOptionsEnvironmentVariable]), + state(config[config_1.FuseV1Options.EnableNodeCliInspectArguments]), + state(config[config_1.FuseV1Options.EnableEmbeddedAsarIntegrityValidation]), + state(config[config_1.FuseV1Options.OnlyLoadAppFromAsar]), + state(config[config_1.FuseV1Options.LoadBrowserProcessSpecificV8Snapshot]), + state(config[config_1.FuseV1Options.GrantFileProtocolExtraPrivileges]), + ]; +}; +const pathToFuseFile = (pathToElectron) => { + if (pathToElectron.endsWith('.app')) { + return path.resolve(pathToElectron, 'Contents', 'Frameworks', 'Electron Framework.framework', 'Electron Framework'); + } + if (pathToElectron.includes('.app')) { + return path.resolve(pathToElectron, '..', '..', 'Frameworks', 'Electron Framework.framework', 'Electron Framework'); + } + return pathToElectron; +}; +const setFuseWire = async (pathToElectron, fuseVersion, strictlyRequireAllFuses, fuseWireBuilder, fuseNamer) => { + const fuseFilePath = pathToFuseFile(pathToElectron); + const electron = await fs.readFile(fuseFilePath); + const firstSentinel = electron.indexOf(constants_1.SENTINEL); + const lastSentinel = electron.lastIndexOf(constants_1.SENTINEL); + // If the last sentinel is different to the first sentinel we are probably in a universal build + // We should flip the fuses in both sentinels to affect both slices of the universal binary + const sentinels = firstSentinel === lastSentinel ? [firstSentinel] : [firstSentinel, lastSentinel]; + for (const indexOfSentinel of sentinels) { + if (indexOfSentinel === -1) { + throw new Error('Could not find sentinel in the provided Electron binary, fuses are only supported in Electron 12 and higher'); + } + const fuseWirePosition = indexOfSentinel + constants_1.SENTINEL.length; + const fuseWireVersion = electron[fuseWirePosition]; + if (parseInt(fuseVersion, 10) !== fuseWireVersion) { + throw new Error(`Provided fuse wire version "${parseInt(fuseVersion, 10)}" does not match watch was found in the binary "${fuseWireVersion}". You should update your usage of @electron/fuses.`); + } + const fuseWireLength = electron[fuseWirePosition + 1]; + const wire = fuseWireBuilder(fuseWireLength).slice(0, fuseWireLength); + if (wire.length < fuseWireLength && strictlyRequireAllFuses) { + throw new Error(`strictlyRequireAllFuses: The fuse wire in the Electron binary has ${fuseWireLength} fuses but you only provided a config for ${wire.length} fuses, you may need to update @electron/fuses or provide additional fuse settings`); + } + for (let i = 0; i < wire.length; i++) { + const idx = fuseWirePosition + 2 + i; + const currentState = electron[idx]; + const newState = wire[i]; + if (currentState === constants_1.FuseState.REMOVED && newState !== constants_1.FuseState.INHERIT) { + console.warn(`Overriding fuse "${fuseNamer(i)}" that has been marked as removed, setting this fuse is a noop`); + } + if (newState === constants_1.FuseState.INHERIT) { + if (strictlyRequireAllFuses) { + throw new Error(`strictlyRequireAllFuses: Missing explicit configuration for fuse ${fuseNamer(i)}`); + } + continue; + } + electron[idx] = newState; + } + } + await fs.writeFile(fuseFilePath, electron); + return sentinels.length; +}; +const getCurrentFuseWire = async (pathToElectron) => { + const fuseFilePath = pathToFuseFile(pathToElectron); + const electron = await fs.readFile(fuseFilePath); + const fuseWirePosition = electron.indexOf(constants_1.SENTINEL) + constants_1.SENTINEL.length; + if (fuseWirePosition - constants_1.SENTINEL.length === -1) { + throw new Error('Could not find sentinel in the provided Electron binary, fuses are only supported in Electron 12 and higher'); + } + const fuseWireVersion = electron[fuseWirePosition]; + const fuseWireLength = electron[fuseWirePosition + 1]; + const fuseConfig = { + version: `${fuseWireVersion}`, + }; + for (let i = 0; i < fuseWireLength; i++) { + const idx = fuseWirePosition + 2 + i; + const currentState = electron[idx]; + switch (fuseConfig.version) { + case config_1.FuseVersion.V1: + fuseConfig[i] = currentState; + break; + } + } + return fuseConfig; +}; +exports.getCurrentFuseWire = getCurrentFuseWire; +const flipFuses = async (pathToElectron, fuseConfig) => { + let numSentinels; + switch (fuseConfig.version) { + case config_1.FuseVersion.V1: + numSentinels = await setFuseWire(pathToElectron, fuseConfig.version, fuseConfig.strictlyRequireAllFuses || false, buildFuseV1Wire.bind(null, fuseConfig), (i) => config_1.FuseV1Options[i]); + break; + default: + throw new Error(`Unsupported fuse version number: ${fuseConfig.version}`); + } + // Reset the ad-hoc signature on macOS, should only be done for arm64 apps + if (fuseConfig.resetAdHocDarwinSignature && pathToElectron.includes('.app')) { + const pathToApp = `${pathToElectron.split('.app')[0]}.app`; + const result = cp.spawnSync('codesign', [ + '--sign', + '-', + '--force', + '--preserve-metadata=entitlements,requirements,flags,runtime', + '--deep', + pathToApp, + ]); + if (result.status !== 0) { + console.error(result.stderr.toString()); + throw new Error(`Ad-hoc codesign failed with status: ${result.status}`); + } + } + return numSentinels; +}; +exports.flipFuses = flipFuses; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/index.js.map b/node_modules/@electron/fuses/dist/index.js.map new file mode 100644 index 0000000..f48ae44 --- /dev/null +++ b/node_modules/@electron/fuses/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAoC;AACpC,+BAA+B;AAC/B,6BAA6B;AAC7B,qCAAgF;AAChF,2CAAkD;AAElD,2CAAyB;AAEzB,MAAM,KAAK,GAAG,CAAC,CAAsB,EAAE,EAAE,CACvC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAS,CAAC,OAAO,CAAC;AAEjF,MAAM,eAAe,GAAG,CAAC,MAAoB,EAAE,UAAkB,EAAE,EAAE;IACnE,MAAM,EAAE,OAAO,KAA0B,MAAM,EAA3B,gBAAgB,UAAK,MAAM,EAAzC,WAAgC,CAAS,CAAC;IAChD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CACtD,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CA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AAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC3D,MAAM,MAAM,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE;YACtC,QAAQ;YACR,GAAG;YACH,SAAS;YACT,6DAA6D;YAC7D,QAAQ;YACR,SAAS;SACV,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;SACzE;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAtCW,QAAA,SAAS,aAsCpB"} \ No newline at end of file diff --git a/node_modules/@electron/fuses/dist/tsconfig.tsbuildinfo b/node_modules/@electron/fuses/dist/tsconfig.tsbuildinfo new file mode 100644 index 0000000..e0ed3ee --- /dev/null +++ b/node_modules/@electron/fuses/dist/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/chalk/index.d.ts","../node_modules/@types/minimist/index.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/ts3.4/base.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/ts3.6/base.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/base.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/fs-extra/index.d.ts","../src/config.ts","../src/constants.ts","../src/index.ts","../src/bin.ts","../node_modules/@babel/types/lib/index.d.ts","../node_modules/@types/babel__generator/index.d.ts","../node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/@types/babel__template/index.d.ts","../node_modules/@types/babel__traverse/index.d.ts","../node_modules/@types/babel__core/index.d.ts","../node_modules/keyv/src/index.d.ts","../node_modules/@types/http-cache-semantics/index.d.ts","../node_modules/@types/responselike/index.d.ts","../node_modules/@types/cacheable-request/index.d.ts","../node_modules/@types/color-name/index.d.ts","../node_modules/@types/minimatch/index.d.ts","../node_modules/@types/glob/index.d.ts","../node_modules/@types/graceful-fs/index.d.ts","../node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/@types/istanbul-lib-report/index.d.ts","../node_modules/@types/istanbul-reports/index.d.ts","../node_modules/@jest/expect-utils/build/index.d.ts","../node_modules/jest-matcher-utils/node_modules/chalk/index.d.ts","../node_modules/@sinclair/typebox/typebox.d.ts","../node_modules/@jest/schemas/build/index.d.ts","../node_modules/pretty-format/build/index.d.ts","../node_modules/jest-diff/build/index.d.ts","../node_modules/jest-matcher-utils/build/index.d.ts","../node_modules/expect/build/index.d.ts","../node_modules/@types/jest/index.d.ts","../node_modules/@types/keyv/index.d.ts","../node_modules/@types/parse-json/index.d.ts","../node_modules/@types/prettier/index.d.ts","../node_modules/@types/stack-utils/index.d.ts","../node_modules/@types/yargs-parser/index.d.ts","../node_modules/@types/yargs/index.d.ts","../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06",{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","e437d83044ba17246a861aa9691aa14223ff4a9d6f338ab1269c41c758586a88",{"version":"68aba9c37b535b42ce96b78a4cfa93813bf4525f86dceb88a6d726c5f7c6c14f","affectsGlobalScope":true},"c438b413e94ff76dfa20ae005f33a1c84f2480d1d66e0fd687501020d0de9b50","bc6a78961535181265845bf9b9e8a147ffd0ca275097ceb670a9b92afa825152","1fc4b0908c44f39b1f2e5a728d472670a0ea0970d2c6b5691c88167fe541ff82","123ec69e4b3a686eb49afd94ebe3292a5c84a867ecbcb6bb84bdd720a12af803",{"version":"51851805d06a6878796c3a00ccf0839fe18111a38d1bae84964c269f16bcc2b7","affectsGlobalScope":true},"90c85ddbb8de82cd19198bda062065fc51b7407c0f206f2e399e65a52e979720","dab288a3d92e6a3323566256ba56987b78b100341866fa3cc245c9cd2fd55706","7ecfe97b43aa6c8b8f90caa599d5648bb559962e74e6f038f73a77320569dd78","7db7569fbb3e2b01ba8751c761cdd3f0debd104170d5665b7dc20a11630df3a9",{"version":"cde4d7f6274468180fa39847b183aec22626e8212ff885d535c53f4cd7c225fd","affectsGlobalScope":true},{"version":"072b0ac82ae8fe05b0d4f2eadb7f6edd0ebd84175ecad2f9e09261290a86bcee","affectsGlobalScope":true},"f6eedd1053167b8a651d8d9c70b1772e1b501264a36dfa881d7d4b30d623a9bc","fb28748ff8d015f52e99daee4f454e57cec1a22141f1257c317f3630a15edeb7","bbc5e63e6789b5dca3ed78bbeaaca9f6a67bad86e235726f35fdc7831c0fa553","5d9394b829cfd504b2fe17287aaad8ce1dcfb2a2183c962a90a85b96da2c1c90","c969bf4c7cdfe4d5dd28aa09432f99d09ad1d8d8b839959646579521d0467d1a","6c3857edaeeaaf43812f527830ebeece9266b6e8eb5271ab6d2f0008306c9947","bc6a77e750f4d34584e46b1405b771fb69a224197dd6bafe5b0392a29a70b665","46cac76114704902baa535b30fb66a26aeaf9430f3b3ab44746e329f12e85498","ed4ae81196cccc10f297d228bca8d02e31058e6d723a3c5bc4be5fb3c61c6a34","84044697c8b3e08ef24e4b32cfe6440143d07e469a5e34bda0635276d32d9f35","6999f789ed86a40f3bc4d7e644e8d42ffda569465969df8077cd6c4e3505dd76",{"version":"0c9f2b308e5696d0802b613aff47c99f092add29408e654f7ab6026134250c18","affectsGlobalScope":true},"30ec6f9c683b988c3cfaa0c4690692049c4e7ed7dc6f6e94f56194c06b86f5e1","884560fda6c3868f925f022adc3a1289fe6507bbb45adb10fa1bbcc73a941bb0","6b2bb67b0942bcfce93e1d6fad5f70afd54940a2b13df7f311201fba54b2cbe9","dd3706b25d06fe23c73d16079e8c66ac775831ef419da00716bf2aee530a04a4","1298327149e93a60c24a3b5db6048f7cc8fd4e3259e91d05fc44306a04b1b873","d67e08745494b000da9410c1ae2fdc9965fc6d593fe0f381a47491f75417d457","b40652bf8ce4a18133b31349086523b219724dca8df3448c1a0742528e7ad5b9","3181290a158e54a78c1a57c41791ec1cbdc860ae565916daa1bf4e425b7edac7","a77fdb357c78b70142b2fdbbfb72958d69e8f765fd2a3c69946c1018e89d4638","3c2ac350c3baa61fd2b1925844109e098f4376d0768a4643abc82754fd752748","826d48e49c905cedb906cbde6ccaf758827ff5867d4daa006b5a79e0fb489357","5ef157fbb39494a581bd24f21b60488fe248d452c479738b5e41b48720ea69b8","289be113bad7ee27ee7fa5b1e373c964c9789a5e9ed7db5ddcb631371120b953","a1136cf18dbe1b9b600c65538fd48609a1a4772d115a0c1d775839fe6544487c","e8482f41c6e001657302dcb3a1ba30359a0983574caee9405ef863cb9eac3b95","f409183966a1dd93d3a9cd1d54fbeb85c73101e87cd5b19467c5e37b252f3fd8","d44028ae0127eb3e9fcfa5f55a8b81d64775ce15aca1020fe25c511bbb055834",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"0b3fef11ea6208c4cb3715c9aa108766ce98fc726bfba68cc23b25ce944ce9c0","0f04bc8950ad634ac8ac70f704f200ef06f8852af9017f97c446de4def5b3546","08d15b727da0c4f0870d98159311b5d4de1f0293dbb9f1261b6752962d2aa239","d20072cb51d8baad944bedd935a25c7f10c29744e9a648d2c72c215337356077","35cbbc58882d2c158032d7f24ba8953d7e1caeb8cb98918d85819496109f55d2","b4730e5cbeac402e543a0186f3c7521bd7c3c25c8fc7cf048103fc6487566654",{"version":"7452214bbfaf3828400078248e7329ce4ebb62dbd84b8eb82f10dbbe9406c61a","signature":"9ff11caa5cd56a823ccbc2e246436e65597ffe9b3aeda967109a061b79d7873c"},{"version":"df70fed175ce319b6e193ee479791f0cbb81c229f4a743e0825372f75a96ab5d","signature":"50195c7524b59ce7d3c0604315234a7e9e5667f644abdd064a13731636a47b19"},{"version":"88f228443272c127b0e2b900d4df3c385bfaa8bb15f1cf0f4a0bb92cfc96685a","signature":"2d332b27462df123c380db9089b54d5c01ccca07bd7ec07e9c1c9df9c3d98fb5"},{"version":"6bb38ec8413446d4c269ba56c457e7b2a491d92219dee926907ce2e3b261e952","signature":"43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012"},"c561efdf5ba0b62619745d4761fe2d9756f23db972e039367d15922fed67fd2f","cc957354aa3c94c9961ebf46282cfde1e81d107fc5785a61f62c67f1dd3ac2eb","7ec238b220ea991b6643e24191b1f552a65956d5f6de4c6144e700b9985265d8","93de1c6dab503f053efe8d304cb522bb3a89feab8c98f307a674a4fae04773e9","dae3d1adc67ac3dbd1cd471889301339ec439837b5df565982345be20c8fca9a","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3","a7d9d2a35530516e191ade6dc804d7de42d45ff6620c0319cfb4469dbdbd8044","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","3cfb0cb51cc2c2e1b313d7c4df04dbf7e5bda0a133c6b309bf6af77cf614b971","f992cd6cc0bcbaa4e6c810468c90f2d8595f8c6c3cf050c806397d3de8585562","f0cb4b3ab88193e3e51e9e2622e4c375955003f1f81239d72c5b7a95415dad3e","963d59066dd6742da1918a6213a209bcc205b8ee53b1876ee2b4e6d80f97c85e","fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","f5638f7c2f12a9a1a57b5c41b3c1ea7db3876c003bab68e6a57afd6bcc169af0","763e521cf114b80e0dd0e21ca49b9f8ae62e8999555a5e7bade8ce36b33001c2","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","3e6bbb0883148627ca0854a9f62d820aaf1a0f1842f5568176721fef156b8f23","427ce5854885cfc34387e09de05c1d5c1acf94c2143e1693f1d9ff54880573e7","bed2c4f96fab3348be4a34d88dcb12578c1b2475b07c6acd369e99e227718d81","e3ba509d3dce019b3190ceb2f3fc88e2610ab717122dabd91a9efaa37804040d","cda0cb09b995489b7f4c57f168cd31b83dcbaa7aad49612734fb3c9c73f6e4f2","3ad5991645bbea846d4efe615cd847e785ca30fff0205fdffb0f9a3ade3d13df",{"version":"0dd26bdaa8dfb562d2a600540fa76375f778f34e83fd84fcadc586050e3572ca","affectsGlobalScope":true},"fec943fdb3275eb6e006b35e04a8e2e99e9adf3f4b969ddf15315ac7575a93e4","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","93c4fc5b5237c09bc9ed65cb8f0dc1d89034406ab40500b89701341994897142","b0d10e46cfe3f6c476b69af02eaa38e4ccc7430221ce3109ae84bb9fb8282298","70e9a18da08294f75bf23e46c7d69e67634c0765d355887b9b41f0d959e1426e","28288f5e5f8b7b895ed2abe6359c1da3e0d14a64b5aef985071285671f347c01","65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c"],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"module":1,"noImplicitAny":true,"outDir":"./","sourceMap":true,"strict":true,"target":4},"fileIdsList":[[83],[102],[83,84,85,86,87],[83,85],[42,45,65,77,89,90,91],[43,77],[42,43,77,94],[97],[98],[104,107],[42,77],[74,75],[42,43,50,59],[34,42,50],[66],[38,43,51],[59],[40,42,50],[42],[42,44,59,65],[43],[50,59,65],[42,43,45,50,59,62,65],[42,45,62,65],[76],[65],[40,42,59],[32],[64],[42,59],[57,66,68],[38,40,50,59],[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70],[71,72,73],[50],[56],[42,59,65,68],[45,59,77],[113],[42,59,77],[100,106],[104],[101,105],[103],[29,30,52,79,80,81],[34,52,78,79,80],[79,80]],"referencedMap":[[85,1],[103,2],[88,3],[84,1],[86,4],[87,1],[92,5],[78,6],[95,7],[96,6],[98,8],[99,9],[108,10],[109,11],[76,12],[34,13],[35,14],[36,15],[37,16],[38,17],[39,18],[41,19],[43,20],[44,21],[45,22],[46,23],[47,24],[77,25],[48,19],[49,26],[50,27],[53,28],[54,29],[57,30],[58,31],[59,19],[62,32],[71,33],[74,34],[64,35],[65,36],[67,17],[69,37],[70,17],[91,38],[114,39],[115,40],[107,41],[105,42],[106,43],[89,19],[104,44],[82,45],[81,46]],"exportedModulesMap":[[85,1],[103,2],[88,3],[84,1],[86,4],[87,1],[92,5],[78,6],[95,7],[96,6],[98,8],[99,9],[108,10],[109,11],[76,12],[34,13],[35,14],[36,15],[37,16],[38,17],[39,18],[41,19],[43,20],[44,21],[45,22],[46,23],[47,24],[77,25],[48,19],[49,26],[50,27],[53,28],[54,29],[57,30],[58,31],[59,19],[62,32],[71,33],[74,34],[64,35],[65,36],[67,17],[69,37],[70,17],[91,38],[114,39],[115,40],[107,41],[105,42],[106,43],[89,19],[104,44],[81,47]],"semanticDiagnosticsPerFile":[85,83,100,103,102,88,84,86,87,92,93,78,95,96,90,97,98,99,108,109,94,30,75,32,76,33,34,35,36,37,38,39,40,41,42,43,44,31,72,45,46,47,77,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,71,74,64,65,66,67,68,73,69,70,110,111,91,112,113,114,115,29,107,105,106,101,89,104,7,6,2,8,9,10,11,12,13,14,15,3,4,19,16,17,18,20,21,22,5,23,24,25,26,27,1,28,82,79,80,81]},"version":"4.8.3"} \ No newline at end of file diff --git a/node_modules/@electron/fuses/package.json b/node_modules/@electron/fuses/package.json new file mode 100644 index 0000000..dbe1851 --- /dev/null +++ b/node_modules/@electron/fuses/package.json @@ -0,0 +1,58 @@ +{ + "name": "@electron/fuses", + "version": "1.8.0", + "main": "dist/index.js", + "license": "MIT", + "bin": { + "electron-fuses": "dist/bin.js" + }, + "scripts": { + "build": "tsc", + "test": "jest", + "prepublishOnly": "tsc", + "prepare": "husky install" + }, + "devDependencies": { + "@electron/get": "^2.0.1", + "@electron/universal": "^1.3.0", + "@types/fs-extra": "^9.0.1", + "@types/jest": "^29.0.3", + "@types/minimist": "^1.2.1", + "@types/node": "^14.11.2", + "extract-zip": "^2.0.1", + "husky": "^8.0.0", + "jest": "^29.0.3", + "lint-staged": "^10.4.0", + "prettier": "^2.1.2", + "ts-jest": "^29.0.1", + "typescript": "^4.3.3" + }, + "lint-staged": { + "*.ts": [ + "prettier --write" + ] + }, + "dependencies": { + "chalk": "^4.1.1", + "fs-extra": "^9.0.1", + "minimist": "^1.2.5" + }, + "files": [ + "dist", + "README.md" + ], + "description": "Flip Electron Fuses and customize your packaged build of Electron", + "repository": { + "type": "git", + "url": "git+https://github.com/electron/fuses.git" + }, + "keywords": [ + "electron", + "fuses" + ], + "author": "Electron Community", + "bugs": { + "url": "https://github.com/electron/fuses/issues" + }, + "homepage": "https://github.com/electron/fuses#readme" +} diff --git a/node_modules/@electron/get/dist/Cache.d.ts b/node_modules/@electron/get/dist/Cache.d.ts new file mode 100644 index 0000000..c311182 --- /dev/null +++ b/node_modules/@electron/get/dist/Cache.d.ts @@ -0,0 +1,9 @@ +export declare class Cache { + private cacheRoot; + constructor(cacheRoot?: string); + static getCacheDirectory(downloadUrl: string): string; + getCachePath(downloadUrl: string, fileName: string): string; + getPathForFileInCache(url: string, fileName: string): string | null; + private hashFile; + putFileInCache(url: string, currentPath: string, fileName: string): Promise; +} diff --git a/node_modules/@electron/get/dist/Cache.js b/node_modules/@electron/get/dist/Cache.js new file mode 100644 index 0000000..dd42aa9 --- /dev/null +++ b/node_modules/@electron/get/dist/Cache.js @@ -0,0 +1,99 @@ +import debug from 'debug'; +import envPaths from 'env-paths'; +import fs from 'graceful-fs'; +import crypto from 'node:crypto'; +import path from 'node:path'; +import { pipeline } from 'node:stream/promises'; +const d = debug('@electron/get:cache'); +const defaultCacheRoot = envPaths('electron', { + suffix: '', +}).cache; +export class Cache { + cacheRoot; + constructor(cacheRoot = defaultCacheRoot) { + this.cacheRoot = cacheRoot; + } + static getCacheDirectory(downloadUrl) { + const parsed = new URL(downloadUrl); + parsed.hash = ''; + parsed.search = ''; + parsed.pathname = path.posix.dirname(parsed.pathname); + return crypto.createHash('sha256').update(parsed.toString()).digest('hex'); + } + getCachePath(downloadUrl, fileName) { + return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName); + } + getPathForFileInCache(url, fileName) { + const cachePath = this.getCachePath(url, fileName); + if (fs.existsSync(cachePath)) { + return cachePath; + } + return null; + } + async hashFile(path) { + const hasher = crypto.createHash('sha256'); + await pipeline(fs.createReadStream(path), hasher); + return hasher.digest('hex'); + } + async putFileInCache(url, currentPath, fileName) { + const attempt = async (attemptsLeft = 3) => { + try { + const cachePath = this.getCachePath(url, fileName); + d(`Moving ${currentPath} to ${cachePath}`); + if (!fs.existsSync(path.dirname(cachePath))) { + await fs.promises.mkdir(path.dirname(cachePath), { recursive: true }); + } + if (fs.existsSync(cachePath)) { + const [existingHash, currentHash] = await Promise.all([ + this.hashFile(cachePath), + this.hashFile(currentPath), + ]); + if (existingHash !== currentHash) { + d('* Replacing existing file as it does not match our inbound file'); + await fs.promises.rm(cachePath, { recursive: true, force: true }); + } + else { + d('* Using existing file as the hash matches our inbound file, no need to replace'); + return cachePath; + } + } + try { + await fs.promises.rename(currentPath, cachePath); + } + catch (err) { + if (err.code === 'EXDEV') { + // Cross-device link, fallback to copy and delete + await fs.promises.cp(currentPath, cachePath, { + force: true, + recursive: true, + verbatimSymlinks: true, + }); + await fs.promises.rm(currentPath, { force: true, recursive: true }); + } + else { + throw err; + } + } + return cachePath; + } + catch (err) { + if (process.platform === 'win32' && err.code === 'EPERM') { + // On windows this normally means we're fighting another instance of @electron/get + // also trying to write this file to the cache + d('Experienced error putting thing in cache', err); + if (attemptsLeft > 0) { + d('Trying again in a few seconds'); + await new Promise((resolve) => { + setTimeout(resolve, 2000); + }); + return await attempt(attemptsLeft - 1); + } + d('We have already tried too many times, giving up...'); + } + throw err; + } + }; + return await attempt(); + } +} +//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/Cache.js.map b/node_modules/@electron/get/dist/Cache.js.map new file mode 100644 index 0000000..37a47b2 --- /dev/null +++ b/node_modules/@electron/get/dist/Cache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../src/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,EAAE;IAC5C,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,KAAK,CAAC;AAET,MAAM,OAAO,KAAK;IACI;IAApB,YAAoB,YAAY,gBAAgB;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAE7C,MAAM,CAAC,iBAAiB,CAAC,WAAmB;QACjD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QACjB,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;QACnB,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEtD,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ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AAS,CAAC;YACnB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAK,GAA6B,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBACpF,kFAAkF;oBAClF,8CAA8C;oBAC9C,CAAC,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAC;oBACnD,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;wBACrB,CAAC,CAAC,+BAA+B,CAAC,CAAC;wBACnC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;4BAC5B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;wBAC5B,CAAC,CAAC,CAAC;wBACH,OAAO,MAAM,OAAO,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;oBACzC,CAAC;oBACD,CAAC,CAAC,oDAAoD,CAAC,CAAC;gBAC1D,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC,CAAC;QAEF,OAAO,MAAM,OAAO,EAAE,CAAC;IACzB,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/Downloader.d.ts b/node_modules/@electron/get/dist/Downloader.d.ts new file mode 100644 index 0000000..f63abaa --- /dev/null +++ b/node_modules/@electron/get/dist/Downloader.d.ts @@ -0,0 +1,18 @@ +/** + * Generic interface for the artifact downloader library. + * The default implementation is {@link FetchDownloader}, + * but any custom downloader can be passed to `@electron/get` via + * the {@link ElectronDownloadRequestOptions.downloader} option. + * + * @typeParam T - Options to pass to the downloader + * @category Downloader + */ +export interface Downloader { + /** + * Download an artifact from an arbitrary URL to a file path on system + * @param url URL of the file to download + * @param targetFilePath Filesystem path to download the artifact to (including the file name) + * @param options Options to pass to the downloader + */ + download(url: string, targetFilePath: string, options: T): Promise; +} diff --git a/node_modules/@electron/get/dist/Downloader.js b/node_modules/@electron/get/dist/Downloader.js new file mode 100644 index 0000000..f1d61d6 --- /dev/null +++ b/node_modules/@electron/get/dist/Downloader.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Downloader.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/Downloader.js.map b/node_modules/@electron/get/dist/Downloader.js.map new file mode 100644 index 0000000..86b7c63 --- /dev/null +++ b/node_modules/@electron/get/dist/Downloader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Downloader.js","sourceRoot":"","sources":["../src/Downloader.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/FetchDownloader.d.ts b/node_modules/@electron/get/dist/FetchDownloader.d.ts new file mode 100644 index 0000000..127bdf9 --- /dev/null +++ b/node_modules/@electron/get/dist/FetchDownloader.d.ts @@ -0,0 +1,43 @@ +import { Downloader } from './Downloader.js'; +/** + * @category Downloader + */ +export interface Progress { + /** Bytes downloaded so far. */ + transferred: number; + /** Total bytes to download, or `null` if the response had no `Content-Length` header. */ + total: number | null; + /** + * Ratio of `transferred` to `total` between 0 and 1. + * If `total` is unknown, this is 0 until the download completes, then 1. + */ + percent: number; +} +/** + * @category Downloader + */ +export declare class HTTPError extends Error { + readonly response: Response; + constructor(response: Response); +} +/** + * @category Downloader + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit | `RequestInit`} for possible keys/values. + */ +export type FetchDownloaderOptions = RequestInit & { + /** Called on each chunk with the current download {@link Progress}. */ + getProgressCallback?: (progress: Progress) => Promise; + /** + * Disables the console progress bar. Setting the `ELECTRON_GET_NO_PROGRESS` + * environment variable to a non-empty value also does this. + */ + quiet?: boolean; +}; +/** + * Default {@link Downloader} implemented with the built-in + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}. + * @category Downloader + */ +export declare class FetchDownloader implements Downloader { + download(url: string, targetFilePath: string, options?: FetchDownloaderOptions): Promise; +} diff --git a/node_modules/@electron/get/dist/FetchDownloader.js b/node_modules/@electron/get/dist/FetchDownloader.js new file mode 100644 index 0000000..d539192 --- /dev/null +++ b/node_modules/@electron/get/dist/FetchDownloader.js @@ -0,0 +1,82 @@ +import fs from 'graceful-fs'; +import path from 'node:path'; +import ProgressBar from 'progress'; +import { pipeline } from 'node:stream/promises'; +import { Readable } from 'node:stream'; +const PROGRESS_BAR_DELAY_IN_SECONDS = 30; +/** + * @category Downloader + */ +export class HTTPError extends Error { + response; + constructor(response) { + super(`Response code ${response.status} (${response.statusText}) for ${response.url}`); + this.response = response; + this.name = 'HTTPError'; + } +} +/** + * Default {@link Downloader} implemented with the built-in + * {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}. + * @category Downloader + */ +export class FetchDownloader { + async download(url, targetFilePath, options = {}) { + const { quiet, getProgressCallback, ...fetchOptions } = options; + let downloadCompleted = false; + let bar; + let progressPercent; + let timeout = undefined; + await fs.promises.mkdir(path.dirname(targetFilePath), { recursive: true }); + if (!quiet && !process.env.ELECTRON_GET_NO_PROGRESS) { + const start = new Date(); + timeout = setTimeout(() => { + if (!downloadCompleted) { + bar = new ProgressBar(`Downloading ${path.basename(url)}: [:bar] :percent ETA: :eta seconds `, { + curr: progressPercent, + total: 100, + }); + // https://github.com/visionmedia/node-progress/issues/159 + // eslint-disable-next-line @typescript-eslint/no-explicit-any + bar.start = start; + } + }, PROGRESS_BAR_DELAY_IN_SECONDS * 1000); + } + try { + const response = await fetch(url, fetchOptions); + if (!response.ok) { + throw new HTTPError(response); + } + if (!response.body) { + throw new Error('Response body is empty'); + } + const contentLength = response.headers.get('content-length'); + const total = contentLength ? parseInt(contentLength, 10) : null; + let transferred = 0; + const onProgress = (percent) => { + progressPercent = percent; + if (bar) { + bar.update(percent); + } + if (getProgressCallback) { + void getProgressCallback({ transferred, total, percent }); + } + }; + await pipeline(Readable.fromWeb(response.body), async function* (source) { + for await (const chunk of source) { + transferred += chunk.length; + onProgress(total ? transferred / total : 0); + yield chunk; + } + }, fs.createWriteStream(targetFilePath)); + onProgress(1); + } + finally { + downloadCompleted = true; + if (timeout) { + clearTimeout(timeout); + } + } + } +} +//# sourceMappingURL=FetchDownloader.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/FetchDownloader.js.map b/node_modules/@electron/get/dist/FetchDownloader.js.map new file mode 100644 index 0000000..4f9e2cf --- /dev/null +++ b/node_modules/@electron/get/dist/FetchDownloader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FetchDownloader.js","sourceRoot":"","sources":["../src/FetchDownloader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAE7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,WAAW,MAAM,UAAU,CAAC;AAGnC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAiBzC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IACN;IAA5B,YAA4B,QAAkB;QAC5C,KAAK,CAAC,iBAAiB,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,SAAS,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QAD7D,aAAQ,GAAR,QAAQ,CAAU;QAE5C,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAgBD;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAC1B,KAAK,CAAC,QAAQ,CACZ,GAAW,EACX,cAAsB,EACtB,UAAkC,EAAE;QAEpC,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC;QAChE,IAAI,iBAAiB,GAAG,KAAK,CAAC;QAC9B,IAAI,GAA4B,CAAC;QACjC,IAAI,eAAuB,CAAC;QAC5B,IAAI,OAAO,GAA+B,SAAS,CAAC;QACpD,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,E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ACR,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtB,CAAC;gBACD,IAAI,mBAAmB,EAAE,CAAC;oBACxB,KAAK,mBAAmB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC,CAAC;YAEF,MAAM,QAAQ,CACZ,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC/B,KAAK,SAAS,CAAC,EAAE,MAAM;gBACrB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBACjC,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC;oBAC5B,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5C,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,EACD,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CACrC,CAAC;YAEF,UAAU,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;gBAAS,CAAC;YACT,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI,OAAO,EAAE,CAAC;gBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/artifact-utils.d.ts b/node_modules/@electron/get/dist/artifact-utils.d.ts new file mode 100644 index 0000000..4da24ea --- /dev/null +++ b/node_modules/@electron/get/dist/artifact-utils.d.ts @@ -0,0 +1,4 @@ +import { ElectronArtifactDetails } from './types.js'; +export declare function getArtifactFileName(details: ElectronArtifactDetails): string; +export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise; +export declare function getArtifactVersion(details: ElectronArtifactDetails): string; diff --git a/node_modules/@electron/get/dist/artifact-utils.js b/node_modules/@electron/get/dist/artifact-utils.js new file mode 100644 index 0000000..1638609 --- /dev/null +++ b/node_modules/@electron/get/dist/artifact-utils.js @@ -0,0 +1,54 @@ +import { ensureIsTruthyString, normalizeVersion } from './utils.js'; +const BASE_URL = 'https://github.com/electron/electron/releases/download/'; +const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/'; +export function getArtifactFileName(details) { + ensureIsTruthyString(details, 'artifactName'); + if (details.isGeneric) { + return details.artifactName; + } + ensureIsTruthyString(details, 'arch'); + ensureIsTruthyString(details, 'platform'); + ensureIsTruthyString(details, 'version'); + return `${[ + details.artifactName, + details.version, + details.platform, + details.arch, + ...(details.artifactSuffix ? [details.artifactSuffix] : []), + ].join('-')}.zip`; +} +function mirrorVar(name, options, defaultValue) { + // Convert camelCase to camel_case for env var reading + const snakeName = name.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}_${b}`).toLowerCase(); + return ( + // .npmrc + process.env[`npm_config_electron_${name.toLowerCase()}`] || + process.env[`NPM_CONFIG_ELECTRON_${snakeName.toUpperCase()}`] || + process.env[`npm_config_electron_${snakeName}`] || + // package.json + process.env[`npm_package_config_electron_${name}`] || + process.env[`npm_package_config_electron_${snakeName.toLowerCase()}`] || + // env + process.env[`ELECTRON_${snakeName.toUpperCase()}`] || + options[name] || + defaultValue); +} +export async function getArtifactRemoteURL(details) { + const opts = details.mirrorOptions || {}; + let base = mirrorVar('mirror', opts, BASE_URL); + if (details.version.includes('nightly')) { + base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL); + } + const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, '')); + const file = mirrorVar('customFilename', opts, getArtifactFileName(details)); + // Allow customized download URL resolution. + if (opts.resolveAssetURL) { + const url = await opts.resolveAssetURL(details); + return url; + } + return `${base}${path}/${file}`; +} +export function getArtifactVersion(details) { + return normalizeVersion(mirrorVar('customVersion', details.mirrorOptions || {}, details.version)); +} +//# sourceMappingURL=artifact-utils.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/artifact-utils.js.map b/node_modules/@electron/get/dist/artifact-utils.js.map new file mode 100644 index 0000000..c68f326 --- /dev/null +++ b/node_modules/@electron/get/dist/artifact-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"artifact-utils.js","sourceRoot":"","sources":["../src/artifact-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,QAAQ,GAAG,yDAAyD,CAAC;AAC3E,MAAM,gBAAgB,GAAG,0DAA0D,CAAC;AAEpF,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE9C,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,YAAY,CAAC;IAC9B,CAAC;IAED,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1C,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAEzC,OAAO,GAAG;QACR,OAAO,CAAC,YAAY;QACpB,OAAO,CAAC,OAAO;QACf,OAAO,CAAC,QAAQ;QAChB,OAAO,CAAC,IAAI;QACZ,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5D,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAChB,IAAkD,EAClD,OAAsB,EACtB,YAAoB;IAEpB,sDAAsD;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAE1F,OAAO;IACL,SAAS;IACT,OAAO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CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgC;IACjE,OAAO,gBAAgB,CAAC,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACpG,CAAC"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/downloader-resolver.d.ts b/node_modules/@electron/get/dist/downloader-resolver.d.ts new file mode 100644 index 0000000..80b000e --- /dev/null +++ b/node_modules/@electron/get/dist/downloader-resolver.d.ts @@ -0,0 +1,3 @@ +import { DownloadOptions } from './types.js'; +import { Downloader } from './Downloader.js'; +export declare function getDownloaderForSystem(): Promise>; diff --git a/node_modules/@electron/get/dist/downloader-resolver.js b/node_modules/@electron/get/dist/downloader-resolver.js new file mode 100644 index 0000000..a534b3f --- /dev/null +++ b/node_modules/@electron/get/dist/downloader-resolver.js @@ -0,0 +1,5 @@ +import { FetchDownloader } from './FetchDownloader.js'; +export async function getDownloaderForSystem() { + return new FetchDownloader(); +} +//# sourceMappingURL=downloader-resolver.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/downloader-resolver.js.map b/node_modules/@electron/get/dist/downloader-resolver.js.map new file mode 100644 index 0000000..05ff1fe --- /dev/null +++ b/node_modules/@electron/get/dist/downloader-resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"downloader-resolver.js","sourceRoot":"","sources":["../src/downloader-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,OAAO,IAAI,eAAe,EAAE,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/index.d.ts b/node_modules/@electron/get/dist/index.d.ts new file mode 100644 index 0000000..6ee6f8e --- /dev/null +++ b/node_modules/@electron/get/dist/index.d.ts @@ -0,0 +1,27 @@ +import { ElectronDownloadRequestOptions, ElectronGenericArtifactDetails, ElectronPlatformArtifactDetailsWithDefaults } from './types.js'; +export { getHostArch } from './utils.js'; +export { initializeProxy } from './proxy.js'; +export * from './types.js'; +/** + * Downloads an artifact from an Electron release and returns an absolute path + * to the downloaded file. + * + * Each release of Electron comes with artifacts, many of which are + * platform/arch-specific (e.g. `ffmpeg-v31.0.0-darwin-arm64.zip`) and others that + * are generic (e.g. `SHASUMS256.txt`). + * + * + * @param artifactDetails - The information required to download the artifact + * @category Download Artifact + */ +export declare function downloadArtifact(artifactDetails: ElectronPlatformArtifactDetailsWithDefaults | ElectronGenericArtifactDetails): Promise; +/** + * Downloads the Electron binary for a specific version and returns an absolute path to a + * ZIP file. + * + * @param version - The version of Electron you want to download (e.g. `31.0.0`) + * @param options - Options to customize the download behavior + * @returns An absolute path to the downloaded ZIP file + * @category Download Electron + */ +export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise; diff --git a/node_modules/@electron/get/dist/index.js b/node_modules/@electron/get/dist/index.js new file mode 100644 index 0000000..f0671ba --- /dev/null +++ b/node_modules/@electron/get/dist/index.js @@ -0,0 +1,188 @@ +import debug from 'debug'; +import fs from 'graceful-fs'; +import path from 'node:path'; +import util from 'node:util'; +import semver from 'semver'; +import sumchecker from 'sumchecker'; +import { getArtifactFileName, getArtifactRemoteURL, getArtifactVersion } from './artifact-utils.js'; +import { ElectronDownloadCacheMode, } from './types.js'; +import { Cache } from './Cache.js'; +import { getDownloaderForSystem } from './downloader-resolver.js'; +import { initializeProxy } from './proxy.js'; +import { withTempDirectoryIn, getHostArch, getNodeArch, ensureIsTruthyString, isOfficialDropped32BitDownload, isOfficialLinuxIA32Download, mkdtemp, doesCallerOwnTemporaryOutput, effectiveCacheMode, shouldTryReadCache, TempDirCleanUpMode, } from './utils.js'; +export { getHostArch } from './utils.js'; +export { initializeProxy } from './proxy.js'; +export * from './types.js'; +const d = debug('@electron/get:index'); +if (process.env.ELECTRON_GET_USE_PROXY) { + initializeProxy(); +} +async function validateArtifact(artifactDetails, downloadedAssetPath, _downloadArtifact) { + return await withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => { + // Don't try to verify the hash of the hash file itself + // and for older versions that don't have a SHASUMS256.txt + if (!artifactDetails.artifactName.startsWith('SHASUMS256') && + !artifactDetails.unsafelyDisableChecksums && + semver.gte(artifactDetails.version, '1.3.2')) { + let shasumPath; + const checksums = artifactDetails.checksums; + if (checksums) { + shasumPath = path.resolve(tempFolder, 'SHASUMS256.txt'); + const fileNames = Object.keys(checksums); + if (fileNames.length === 0) { + throw new Error('Provided "checksums" object is empty, cannot generate a valid SHASUMS256.txt'); + } + const generatedChecksums = fileNames + .map((fileName) => `${checksums[fileName]} *${fileName}`) + .join('\n'); + await util.promisify(fs.writeFile)(shasumPath, generatedChecksums); + } + else { + shasumPath = await _downloadArtifact({ + isGeneric: true, + version: artifactDetails.version, + artifactName: 'SHASUMS256.txt', + downloadOptions: artifactDetails.downloadOptions, + cacheRoot: artifactDetails.cacheRoot, + downloader: artifactDetails.downloader, + mirrorOptions: artifactDetails.mirrorOptions, + tempDirectory: artifactDetails.tempDirectory, + // Never use the cache for loading checksums, load + // them fresh every time + cacheMode: ElectronDownloadCacheMode.Bypass, + }); + } + try { + // For versions 1.3.2 - 1.3.4, need to overwrite the `defaultTextEncoding` option: + // https://github.com/electron/electron/pull/6676#discussion_r75332120 + if (semver.satisfies(artifactDetails.version, '1.3.2 - 1.3.4')) { + const validatorOptions = {}; + validatorOptions.defaultTextEncoding = 'binary'; + const checker = new sumchecker.ChecksumValidator('sha256', shasumPath, validatorOptions); + await checker.validate(path.dirname(downloadedAssetPath), path.basename(downloadedAssetPath)); + } + else { + await sumchecker('sha256', shasumPath, path.dirname(downloadedAssetPath), [ + path.basename(downloadedAssetPath), + ]); + } + } + finally { + // Once we're done make sure we clean up the shasum temp dir + await fs.promises.rm(path.dirname(shasumPath), { recursive: true, force: true }); + } + } + }, TempDirCleanUpMode.CLEAN); +} +/** + * Downloads an artifact from an Electron release and returns an absolute path + * to the downloaded file. + * + * Each release of Electron comes with artifacts, many of which are + * platform/arch-specific (e.g. `ffmpeg-v31.0.0-darwin-arm64.zip`) and others that + * are generic (e.g. `SHASUMS256.txt`). + * + * + * @param artifactDetails - The information required to download the artifact + * @category Download Artifact + */ +export async function downloadArtifact(artifactDetails) { + const details = { + ...artifactDetails, + }; + if (!artifactDetails.isGeneric) { + const platformArtifactDetails = details; + if (!platformArtifactDetails.platform) { + d('No platform found, defaulting to the host platform'); + platformArtifactDetails.platform = process.platform; + } + if (platformArtifactDetails.arch) { + platformArtifactDetails.arch = getNodeArch(platformArtifactDetails.arch); + } + else { + d('No arch found, defaulting to the host arch'); + platformArtifactDetails.arch = getHostArch(); + } + } + ensureIsTruthyString(details, 'version'); + details.version = getArtifactVersion(details); + const fileName = getArtifactFileName(details); + const url = await getArtifactRemoteURL(details); + const cache = new Cache(details.cacheRoot); + const cacheMode = effectiveCacheMode(details); + // Do not check if the file exists in the cache when force === true + if (shouldTryReadCache(cacheMode)) { + d(`Checking the cache (${details.cacheRoot}) for ${fileName} (${url})`); + const cachedPath = cache.getPathForFileInCache(url, fileName); + if (cachedPath === null) { + d('Cache miss'); + } + else { + d('Cache hit'); + let artifactPath = cachedPath; + if (doesCallerOwnTemporaryOutput(cacheMode)) { + // Copy out of cache into temporary directory if readOnly cache so + // that the caller can take ownership of the returned file + const tempDir = await mkdtemp(artifactDetails.tempDirectory); + artifactPath = path.resolve(tempDir, fileName); + await util.promisify(fs.copyFile)(cachedPath, artifactPath); + } + try { + await validateArtifact(details, artifactPath, downloadArtifact); + return artifactPath; + } + catch (err) { + if (doesCallerOwnTemporaryOutput(cacheMode)) { + await fs.promises.rm(path.dirname(artifactPath), { recursive: true, force: true }); + } + d("Artifact in cache didn't match checksums", err); + d('falling back to re-download'); + } + } + } + if (!details.isGeneric && + isOfficialLinuxIA32Download(details.platform, details.arch, details.version, details.mirrorOptions)) { + console.warn('Official Linux/ia32 support is deprecated.'); + console.warn('For more info: https://electronjs.org/blog/linux-32bit-support'); + } + if (!details.isGeneric && + isOfficialDropped32BitDownload(details.platform, details.arch, details.version, details.mirrorOptions)) { + throw new Error(`Electron ${details.version} does not have a published ${details.platform}/${details.arch} artifact. ` + + 'Electron 44 and newer no longer publish win32/ia32 or linux/armv7l builds; ' + + 'the last release line with 32-bit support is Electron 43, which is supported until January 2027.'); + } + return await withTempDirectoryIn(details.tempDirectory, async (tempFolder) => { + const tempDownloadPath = path.resolve(tempFolder, getArtifactFileName(details)); + const downloader = details.downloader || (await getDownloaderForSystem()); + d(`Downloading ${url} to ${tempDownloadPath} with options: ${JSON.stringify(details.downloadOptions)}`); + await downloader.download(url, tempDownloadPath, details.downloadOptions); + d('attempting to validate artifact...', { details }); + await validateArtifact(details, tempDownloadPath, downloadArtifact); + d('artifact validated'); + if (doesCallerOwnTemporaryOutput(cacheMode)) { + return tempDownloadPath; + } + else { + return await cache.putFileInCache(url, tempDownloadPath, fileName); + } + }, doesCallerOwnTemporaryOutput(cacheMode) ? TempDirCleanUpMode.ORPHAN : TempDirCleanUpMode.CLEAN); +} +/** + * Downloads the Electron binary for a specific version and returns an absolute path to a + * ZIP file. + * + * @param version - The version of Electron you want to download (e.g. `31.0.0`) + * @param options - Options to customize the download behavior + * @returns An absolute path to the downloaded ZIP file + * @category Download Electron + */ +export function download(version, options) { + return downloadArtifact({ + ...options, + version, + platform: process.platform, + arch: process.arch, + artifactName: 'electron', + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/index.js.map b/node_modules/@electron/get/dist/index.js.map new file mode 100644 index 0000000..460cc07 --- /dev/null +++ b/node_modules/@electron/get/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,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1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,UAAU;KACzB,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/proxy.d.ts b/node_modules/@electron/get/dist/proxy.d.ts new file mode 100644 index 0000000..5a91004 --- /dev/null +++ b/node_modules/@electron/get/dist/proxy.d.ts @@ -0,0 +1,14 @@ +/** + * Initializes a third-party proxy module for HTTP(S) requests. Call this function before + * using the {@link download} and {@link downloadArtifact} APIs if you need proxy support. + * + * If the `ELECTRON_GET_USE_PROXY` environment variable is set to `true`, this function will be + * called automatically for `@electron/get` requests. + * + * Supported environment variables are `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`. + * + * @category Utility + * @see {@link https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent | `EnvHttpProxyAgent`} + * documentation for available environment variables. + */ +export declare function initializeProxy(): void; diff --git a/node_modules/@electron/get/dist/proxy.js b/node_modules/@electron/get/dist/proxy.js new file mode 100644 index 0000000..bc5bcd0 --- /dev/null +++ b/node_modules/@electron/get/dist/proxy.js @@ -0,0 +1,28 @@ +import { createRequire } from 'node:module'; +import debug from 'debug'; +const d = debug('@electron/get:proxy'); +const require = createRequire(import.meta.url); +/** + * Initializes a third-party proxy module for HTTP(S) requests. Call this function before + * using the {@link download} and {@link downloadArtifact} APIs if you need proxy support. + * + * If the `ELECTRON_GET_USE_PROXY` environment variable is set to `true`, this function will be + * called automatically for `@electron/get` requests. + * + * Supported environment variables are `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`. + * + * @category Utility + * @see {@link https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent | `EnvHttpProxyAgent`} + * documentation for available environment variables. + */ +export function initializeProxy() { + try { + // eslint-disable-next-line @typescript-eslint/no-require-imports + const { EnvHttpProxyAgent, setGlobalDispatcher } = require('undici'); + setGlobalDispatcher(new EnvHttpProxyAgent()); + } + catch (e) { + d('Could not load undici, built-in proxy support not available:', e); + } +} +//# sourceMappingURL=proxy.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/proxy.js.map b/node_modules/@electron/get/dist/proxy.js.map new file mode 100644 index 0000000..a3c1e2f --- /dev/null +++ b/node_modules/@electron/get/dist/proxy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrE,mBAAmB,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,CAAC,CAAC,8DAA8D,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/types.d.ts b/node_modules/@electron/get/dist/types.d.ts new file mode 100644 index 0000000..abbad73 --- /dev/null +++ b/node_modules/@electron/get/dist/types.d.ts @@ -0,0 +1,244 @@ +import { Downloader } from './Downloader.js'; +import { FetchDownloader, FetchDownloaderOptions, HTTPError, Progress } from './FetchDownloader.js'; +export { Downloader, FetchDownloader, FetchDownloaderOptions, HTTPError, Progress }; +/** + * Custom downloaders can implement any set of options. + * @category Downloader + */ +export type DownloadOptions = any; +/** + * Options for specifying an alternative download mirror for Electron. + * + * @category Utility + * @example + * + * To download the Electron v4.0.4 release for x64 Linux from + * https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip + * + * ```js + * const opts = { + * mirror: 'https://github.com/electron/electron/releases/download', + * customDir: 'v4.0.4', + * customFilename: 'electron-v4.0.4-linux-x64.zip', + * } + * ``` + */ +export interface MirrorOptions { + /** + * The mirror URL for [`electron-nightly`](https://npmjs.com/package/electron-nightly), + * which lives in a separate npm package. + */ + nightlyMirror?: string; + /** + * The base URL of the mirror to download from. + * e.g https://github.com/electron/electron/releases/download + */ + mirror?: string; + /** + * The name of the directory to download from, + * often scoped by version number e.g 'v4.0.4' + */ + customDir?: string; + /** + * The name of the asset to download, + * e.g 'electron-v4.0.4-linux-x64.zip' + */ + customFilename?: string; + /** + * The version of the asset to download, + * e.g '4.0.4' + */ + customVersion?: string; + /** + * A function allowing customization of the url returned + * from getArtifactRemoteURL(). + */ + resolveAssetURL?: (opts: DownloadOptions) => Promise; +} +/** + * @category Download Artifact + * @internal + */ +export interface ElectronDownloadRequest { + /** + * The version of Electron associated with the artifact. + */ + version: string; + /** + * The type of artifact. For example: + * * `electron` + * * `ffmpeg` + */ + artifactName: string; +} +export declare enum ElectronDownloadCacheMode { + /** + * Reads from the cache if present + * Writes to the cache after fetch if not present + */ + ReadWrite = 0, + /** + * Reads from the cache if present + * Will **not** write back to the cache after fetching missing artifact + */ + ReadOnly = 1, + /** + * Skips reading from the cache + * Will write back into the cache, overwriting anything currently in the cache after fetch + */ + WriteOnly = 2, + /** + * Bypasses the cache completely, neither reads from nor writes to the cache + */ + Bypass = 3 +} +/** + * @category Download Electron + */ +export interface ElectronDownloadRequestOptions { + /** + * When set to `true`, disables checking that the artifact download completed successfully + * with the correct payload. + * + * @defaultValue `false` + */ + unsafelyDisableChecksums?: boolean; + /** + * Provides checksums for the artifact as strings. + * Can be used if you already know the checksums of the Electron artifact + * you are downloading and want to skip the checksum file download + * without skipping the checksum validation. + * + * This should be an object whose keys are the file names of the artifacts and + * the values are their respective SHA256 checksums. + * + * @example + * ```json + * { + * "electron-v4.0.4-linux-x64.zip": "877617029f4c0f2b24f3805a1c3554ba166fda65c4e88df9480ae7b6ffa26a22" + * } + * ``` + */ + checksums?: Record; + /** + * The directory that caches Electron artifact downloads. + * + * @defaultValue The default value is dependent upon the host platform: + * + * * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/` + * * MacOS: `~/Library/Caches/electron/` + * * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/` + */ + cacheRoot?: string; + /** + * Options passed to the downloader module. + * + * @see {@link FetchDownloaderOptions} for options for the default {@link FetchDownloader}. + */ + downloadOptions?: DownloadOptions; + /** + * Options related to specifying an artifact mirror. + */ + mirrorOptions?: MirrorOptions; + /** + * A custom {@link Downloader} class used to download artifacts. Defaults to the + * built-in {@link FetchDownloader}. + */ + downloader?: Downloader; + /** + * A temporary directory for downloads. + * It is used before artifacts are put into cache. + * + * @defaultValue the OS default temporary directory via [`os.tmpdir()`](https://nodejs.org/api/os.html#ostmpdir) + */ + tempDirectory?: string; + /** + * Controls the cache read and write behavior. + * + * When set to either {@link ElectronDownloadCacheMode.ReadOnly | ReadOnly} or + * {@link ElectronDownloadCacheMode.Bypass | Bypass}, the caller is responsible + * for cleaning up the returned file path once they are done using it + * (e.g. via `fs.remove(path.dirname(pathFromElectronGet))`). + * + * When set to either {@link ElectronDownloadCacheMode.WriteOnly | WriteOnly} or + * {@link ElectronDownloadCacheMode.ReadWrite | ReadWrite} (the default), the caller + * should not move or delete the file path that is returned as the path + * points directly to the disk cache. + * + * @defaultValue {@link ElectronDownloadCacheMode.ReadWrite} + */ + cacheMode?: ElectronDownloadCacheMode; +} +/** + * @category Download Artifact + * @internal + */ +export type ElectronPlatformArtifactDetails = { + /** + * The target artifact platform. These are Node-style platform names, for example: + * * `win32` + * * `darwin` + * * `linux` + * + * @see Node.js {@link https://nodejs.org/api/process.html#processplatform | process.platform} docs + */ + platform: string; + /** + * The target artifact architecture. These are Node-style architecture names, for example: + * * `ia32` (Electron 43 and earlier) + * * `x64` + * * `armv7l` (Electron 43 and earlier) + * + * @see Node.js {@link https://nodejs.org/api/process.html#processarch | process.arch} docs + */ + arch: string; + artifactSuffix?: string; + isGeneric?: false; +} & ElectronDownloadRequest & ElectronDownloadRequestOptions; +/** + * Options to download a generic (i.e. platform and architecture-agnostic) + * Electron artifact. Contains all options from {@link ElectronDownloadRequestOptions}, + * but specifies a `version` and `artifactName` for the artifact to download. + * + * @category Download Artifact + * @interface + */ +export type ElectronGenericArtifactDetails = { + isGeneric: true; +} & ElectronDownloadRequest & ElectronDownloadRequestOptions; +/** + * @category Download Artifact + * @internal + */ +export type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails; +/** + * Options to download a platform and architecture-specific Electron artifact. + * Contains all options from {@link ElectronDownloadRequestOptions}, but + * specifies a `version` and `artifactName` for the artifact to download. + * + * If `platform` and `arch` are omitted, they will be inferred using the host + * system platform and architecture. + * + * @category Download Artifact + * @interface + */ +export type ElectronPlatformArtifactDetailsWithDefaults = Omit & { + /** + * The target artifact platform. These are Node-style platform names, for example: + * * `win32` + * * `darwin` + * * `linux` + * + * @see Node.js {@link https://nodejs.org/api/process.html#processplatform | process.platform} docs + */ + platform?: string; + /** + * The target artifact architecture. These are Node-style architecture names, for example: + * * `ia32` (Electron 43 and earlier) + * * `x64` + * * `armv7l` (Electron 43 and earlier) + * + * @see Node.js {@link https://nodejs.org/api/process.html#processarch | process.arch} docs + */ + arch?: string; +}; diff --git a/node_modules/@electron/get/dist/types.js b/node_modules/@electron/get/dist/types.js new file mode 100644 index 0000000..0cc9716 --- /dev/null +++ b/node_modules/@electron/get/dist/types.js @@ -0,0 +1,25 @@ +import { FetchDownloader, HTTPError } from './FetchDownloader.js'; +export { FetchDownloader, HTTPError }; +export var ElectronDownloadCacheMode; +(function (ElectronDownloadCacheMode) { + /** + * Reads from the cache if present + * Writes to the cache after fetch if not present + */ + ElectronDownloadCacheMode[ElectronDownloadCacheMode["ReadWrite"] = 0] = "ReadWrite"; + /** + * Reads from the cache if present + * Will **not** write back to the cache after fetching missing artifact + */ + ElectronDownloadCacheMode[ElectronDownloadCacheMode["ReadOnly"] = 1] = "ReadOnly"; + /** + * Skips reading from the cache + * Will write back into the cache, overwriting anything currently in the cache after fetch + */ + ElectronDownloadCacheMode[ElectronDownloadCacheMode["WriteOnly"] = 2] = "WriteOnly"; + /** + * Bypasses the cache completely, neither reads from nor writes to the cache + */ + ElectronDownloadCacheMode[ElectronDownloadCacheMode["Bypass"] = 3] = "Bypass"; +})(ElectronDownloadCacheMode || (ElectronDownloadCacheMode = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/@electron/get/dist/types.js.map b/node_modules/@electron/get/dist/types.js.map new file mode 100644 index 0000000..adb62a0 --- /dev/null +++ b/node_modules/@electron/get/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA0B,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAEpG,OAAO,EAAc,eAAe,EAA0B,SAAS,EAAY,CAAC;AA4EpF,MAAM,CAAN,IAAY,yBAoBX;AApBD,WAAY,yBAAyB;IACnC;;;OAGG;IACH,mFAAS,CAAA;IACT;;;OAGG;IACH,iFAAQ,CAAA;IACR;;;OAGG;IACH,mFAAS,CAAA;IACT;;OAEG;IACH,6EAAM,CAAA;AACR,CAAC,EApBW,yBAAyB,KAAzB,yBAAyB,QAoBpC"} \ No newline at end of file diff --git a/node_modules/@electron/get/dist/utils.d.ts b/node_modules/@electron/get/dist/utils.d.ts new file mode 100644 index 0000000..ad29690 --- /dev/null +++ b/node_modules/@electron/get/dist/utils.d.ts @@ -0,0 +1,38 @@ +import { ElectronDownloadCacheMode, ElectronGenericArtifactDetails, ElectronPlatformArtifactDetailsWithDefaults } from './types.js'; +export declare function mkdtemp(parentDirectory?: string): Promise; +export declare enum TempDirCleanUpMode { + CLEAN = 0, + ORPHAN = 1 +} +export declare function withTempDirectoryIn(parentDirectory: string | undefined, fn: (directory: string) => Promise, cleanUp: TempDirCleanUpMode): Promise; +export declare function withTempDirectory(fn: (directory: string) => Promise, cleanUp: TempDirCleanUpMode): Promise; +export declare function normalizeVersion(version: string): string; +/** + * Runs the `uname` command and returns the trimmed output. + */ +export declare function uname(): string; +/** + * Generates an architecture name that would be used in an Electron or Node.js + * download file name. + */ +export declare function getNodeArch(arch: string): string; +/** + * Generates an architecture name that would be used in an Electron or Node.js + * download file name from the `process` module information. + * + * @category Utility + */ +export declare function getHostArch(): string; +export declare function ensureIsTruthyString(obj: T, key: K): void; +export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean; +export declare function isOfficialDropped32BitDownload(platform: string, arch: string, version: string, mirrorOptions?: object): boolean; +/** + * Find the value of a environment variable which may or may not have the + * prefix, in a case-insensitive manner. + */ +export declare function getEnv(prefix?: string): (name: string) => string | undefined; +export declare function setEnv(key: string, value: string | undefined): void; +export declare function effectiveCacheMode(artifactDetails: ElectronPlatformArtifactDetailsWithDefaults | ElectronGenericArtifactDetails): ElectronDownloadCacheMode; +export declare function shouldTryReadCache(cacheMode: ElectronDownloadCacheMode): boolean; +export declare function shouldWriteCache(cacheMode: ElectronDownloadCacheMode): boolean; +export declare function doesCallerOwnTemporaryOutput(cacheMode: ElectronDownloadCacheMode): boolean; diff --git a/node_modules/@electron/get/dist/utils.js b/node_modules/@electron/get/dist/utils.js new file mode 100644 index 0000000..750111a --- /dev/null +++ b/node_modules/@electron/get/dist/utils.js @@ -0,0 +1,147 @@ +import childProcess from 'node:child_process'; +import fs from 'graceful-fs'; +import os from 'node:os'; +import path from 'node:path'; +import semver from 'semver'; +import { ElectronDownloadCacheMode, } from './types.js'; +async function useAndRemoveDirectory(directory, fn) { + let result; + try { + result = await fn(directory); + } + finally { + await fs.promises.rm(directory, { recursive: true, force: true }); + } + return result; +} +export async function mkdtemp(parentDirectory = os.tmpdir()) { + const tempDirectoryPrefix = 'electron-download-'; + return await fs.promises.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix)); +} +export var TempDirCleanUpMode; +(function (TempDirCleanUpMode) { + TempDirCleanUpMode[TempDirCleanUpMode["CLEAN"] = 0] = "CLEAN"; + TempDirCleanUpMode[TempDirCleanUpMode["ORPHAN"] = 1] = "ORPHAN"; +})(TempDirCleanUpMode || (TempDirCleanUpMode = {})); +export async function withTempDirectoryIn(parentDirectory = os.tmpdir(), fn, cleanUp) { + const tempDirectory = await mkdtemp(parentDirectory); + if (cleanUp === TempDirCleanUpMode.CLEAN) { + return useAndRemoveDirectory(tempDirectory, fn); + } + else { + return fn(tempDirectory); + } +} +export async function withTempDirectory(fn, cleanUp) { + return withTempDirectoryIn(undefined, fn, cleanUp); +} +export function normalizeVersion(version) { + if (!version.startsWith('v')) { + return `v${version}`; + } + return version; +} +/** + * Runs the `uname` command and returns the trimmed output. + */ +export function uname() { + return childProcess.execSync('uname -m').toString().trim(); +} +/** + * Generates an architecture name that would be used in an Electron or Node.js + * download file name. + */ +export function getNodeArch(arch) { + if (arch === 'arm') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + switch (process.config.variables.arm_version) { + case '6': + return uname(); + case '7': + default: + return 'armv7l'; + } + } + return arch; +} +/** + * Generates an architecture name that would be used in an Electron or Node.js + * download file name from the `process` module information. + * + * @category Utility + */ +export function getHostArch() { + return getNodeArch(process.arch); +} +export function ensureIsTruthyString(obj, key) { + if (!obj[key] || typeof obj[key] !== 'string') { + throw new Error(`Expected property "${String(key)}" to be provided as a string but it was not`); + } +} +export function isOfficialLinuxIA32Download(platform, arch, version, mirrorOptions) { + return (platform === 'linux' && + arch === 'ia32' && + Number(version.slice(1).split('.')[0]) >= 4 && + typeof mirrorOptions === 'undefined'); +} +// Electron 44 dropped support for 32-bit Windows (win32/ia32) and for +// armv7l Linux. The last official releases to ship these artifacts are +// v44.0.0-alpha.3 on the release channel and v45.0.0-nightly.20260713 on +// the nightly channel. +const FIRST_RELEASE_WITHOUT_32_BIT_SUPPORT = '44.0.0-alpha.4'; +const FIRST_NIGHTLY_WITHOUT_32_BIT_SUPPORT = '45.0.0-nightly.20260714'; +export function isOfficialDropped32BitDownload(platform, arch, version, mirrorOptions) { + // Custom mirrors may legitimately host their own builds for these platforms + if (typeof mirrorOptions !== 'undefined') { + return false; + } + if (!((platform === 'win32' && arch === 'ia32') || (platform === 'linux' && arch === 'armv7l'))) { + return false; + } + const parsedVersion = semver.parse(version); + if (parsedVersion === null) { + return false; + } + const firstVersionWithoutArtifacts = parsedVersion.prerelease.includes('nightly') + ? FIRST_NIGHTLY_WITHOUT_32_BIT_SUPPORT + : FIRST_RELEASE_WITHOUT_32_BIT_SUPPORT; + return semver.gte(parsedVersion, firstVersionWithoutArtifacts); +} +/** + * Find the value of a environment variable which may or may not have the + * prefix, in a case-insensitive manner. + */ +export function getEnv(prefix = '') { + const envsLowerCase = {}; + for (const envKey in process.env) { + envsLowerCase[envKey.toLowerCase()] = process.env[envKey]; + } + return (name) => { + return (envsLowerCase[`${prefix}${name}`.toLowerCase()] || + envsLowerCase[name.toLowerCase()] || + undefined); + }; +} +export function setEnv(key, value) { + // The `void` operator always returns `undefined`. + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void + if (value !== void 0) { + process.env[key] = value; + } +} +export function effectiveCacheMode(artifactDetails) { + return artifactDetails.cacheMode || ElectronDownloadCacheMode.ReadWrite; +} +export function shouldTryReadCache(cacheMode) { + return (cacheMode === ElectronDownloadCacheMode.ReadOnly || + cacheMode === ElectronDownloadCacheMode.ReadWrite); +} +export function shouldWriteCache(cacheMode) { + return (cacheMode === ElectronDownloadCacheMode.WriteOnly || + cacheMode === ElectronDownloadCacheMode.ReadWrite); +} +export function doesCallerOwnTemporaryOutput(cacheMode) { + return (cacheMode === ElectronDownloadCacheMode.Bypass || + cacheMode === ElectronDownloadCacheMode.ReadOnly); +} +//# sourceMappingURL=utils.js.map \ No newline at end of file