update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
2
electron/node_modules/.bin/asar
generated
vendored
2
electron/node_modules/.bin/asar
generated
vendored
|
|
@ -1 +1 @@
|
||||||
../asar/bin/asar.js
|
../@electron/asar/bin/asar.js
|
||||||
1
electron/node_modules/.bin/dircompare
generated
vendored
1
electron/node_modules/.bin/dircompare
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../dir-compare/src/cli/dircompare.js
|
|
||||||
1
electron/node_modules/.bin/electron-fuses
generated
vendored
Symbolic link
1
electron/node_modules/.bin/electron-fuses
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../@electron/fuses/dist/bin.js
|
||||||
2
electron/node_modules/.bin/electron-osx-flat
generated
vendored
2
electron/node_modules/.bin/electron-osx-flat
generated
vendored
|
|
@ -1 +1 @@
|
||||||
../electron-osx-sign/bin/electron-osx-flat.js
|
../@electron/osx-sign/bin/electron-osx-flat.js
|
||||||
2
electron/node_modules/.bin/electron-osx-sign
generated
vendored
2
electron/node_modules/.bin/electron-osx-sign
generated
vendored
|
|
@ -1 +1 @@
|
||||||
../electron-osx-sign/bin/electron-osx-sign.js
|
../@electron/osx-sign/bin/electron-osx-sign.js
|
||||||
2
electron/node_modules/.bin/electron-rebuild
generated
vendored
2
electron/node_modules/.bin/electron-rebuild
generated
vendored
|
|
@ -1 +1 @@
|
||||||
../electron-rebuild/lib/src/cli.js
|
../@electron/rebuild/lib/cli.js
|
||||||
1
electron/node_modules/.bin/electron-windows-sign
generated
vendored
Symbolic link
1
electron/node_modules/.bin/electron-windows-sign
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../@electron/windows-sign/bin/electron-windows-sign.js
|
||||||
1
electron/node_modules/.bin/extract-zip
generated
vendored
1
electron/node_modules/.bin/extract-zip
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../extract-zip/cli.js
|
|
||||||
1
electron/node_modules/.bin/install-electron
generated
vendored
Symbolic link
1
electron/node_modules/.bin/install-electron
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../electron/install.js
|
||||||
1
electron/node_modules/.bin/is-ci
generated
vendored
1
electron/node_modules/.bin/is-ci
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../is-ci/bin.js
|
|
||||||
1
electron/node_modules/.bin/jiti
generated
vendored
Symbolic link
1
electron/node_modules/.bin/jiti
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../jiti/lib/jiti-cli.mjs
|
||||||
1
electron/node_modules/.bin/postject
generated
vendored
Symbolic link
1
electron/node_modules/.bin/postject
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../postject/dist/cli.js
|
||||||
1
electron/node_modules/.bin/read-binary-file-arch
generated
vendored
Symbolic link
1
electron/node_modules/.bin/read-binary-file-arch
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../read-binary-file-arch/cli.js
|
||||||
2580
electron/node_modules/.package-lock.json
generated
vendored
2580
electron/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load diff
9
electron/node_modules/7zip-bin/7x.sh
generated
vendored
9
electron/node_modules/7zip-bin/7x.sh
generated
vendored
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
sz_program=${SZA_PATH:-7za}
|
|
||||||
sz_type=${SZA_ARCHIVE_TYPE:-xz}
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
-d) "$sz_program" e -si -so -t${sz_type} ;;
|
|
||||||
*) "$sz_program" a f -si -so -t${sz_type} -mx${SZA_COMPRESSION_LEVEL:-9} ;;
|
|
||||||
esac 2> /dev/null
|
|
||||||
22
electron/node_modules/7zip-bin/LICENSE.txt
generated
vendored
22
electron/node_modules/7zip-bin/LICENSE.txt
generated
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2016 Vladimir Krivosheev
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
1
electron/node_modules/7zip-bin/README.md
generated
vendored
1
electron/node_modules/7zip-bin/README.md
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
7-Zip precompiled binaries.
|
|
||||||
2
electron/node_modules/7zip-bin/index.d.ts
generated
vendored
2
electron/node_modules/7zip-bin/index.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
export const path7za: string
|
|
||||||
export const path7x: string
|
|
||||||
22
electron/node_modules/7zip-bin/index.js
generated
vendored
22
electron/node_modules/7zip-bin/index.js
generated
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
"use strict"
|
|
||||||
|
|
||||||
const path = require("path")
|
|
||||||
|
|
||||||
function getPath() {
|
|
||||||
if (process.env.USE_SYSTEM_7ZA === "true") {
|
|
||||||
return "7za"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.platform === "darwin") {
|
|
||||||
return path.join(__dirname, "mac", process.arch, "7za")
|
|
||||||
}
|
|
||||||
else if (process.platform === "win32") {
|
|
||||||
return path.join(__dirname, "win", process.arch, "7za.exe")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return path.join(__dirname, "linux", process.arch, "7za")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.path7za = getPath()
|
|
||||||
exports.path7x = path.join(__dirname, "7x.sh")
|
|
||||||
BIN
electron/node_modules/7zip-bin/linux/arm/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/linux/arm/7za
generated
vendored
Binary file not shown.
BIN
electron/node_modules/7zip-bin/linux/arm64/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/linux/arm64/7za
generated
vendored
Binary file not shown.
BIN
electron/node_modules/7zip-bin/linux/ia32/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/linux/ia32/7za
generated
vendored
Binary file not shown.
BIN
electron/node_modules/7zip-bin/linux/x64/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/linux/x64/7za
generated
vendored
Binary file not shown.
9
electron/node_modules/7zip-bin/linux/x64/build.sh
generated
vendored
9
electron/node_modules/7zip-bin/linux/x64/build.sh
generated
vendored
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
rm -rf /tmp/7z-linux
|
|
||||||
mkdir /tmp/7z-linux
|
|
||||||
cp "$BASEDIR/do-build.sh" /tmp/7z-linux/do-build.sh
|
|
||||||
docker run --rm -v /tmp/7z-linux:/project buildpack-deps:xenial /project/do-build.sh
|
|
||||||
20
electron/node_modules/7zip-bin/linux/x64/do-build.sh
generated
vendored
20
electron/node_modules/7zip-bin/linux/x64/do-build.sh
generated
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
apt-get update -qq
|
|
||||||
apt-get upgrade -qq
|
|
||||||
|
|
||||||
echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" > /etc/apt/sources.list.d/llvm.list
|
|
||||||
curl -L http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
|
|
||||||
apt-get update -qq
|
|
||||||
apt-get install -qq bzip2 yasm clang-5.0 lldb-5.0 lld-5.0
|
|
||||||
|
|
||||||
ln -s /usr/bin/clang-5.0 /usr/bin/clang
|
|
||||||
ln -s /usr/bin/clang++-5.0 /usr/bin/clang++
|
|
||||||
|
|
||||||
mkdir -p /tmp/7z
|
|
||||||
cd /tmp/7z
|
|
||||||
curl -L http://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2 | tar -xj -C . --strip-components 1
|
|
||||||
cp makefile.linux_clang_amd64_asm makefile.machine
|
|
||||||
make -j4
|
|
||||||
mv bin/7za /project/7za
|
|
||||||
BIN
electron/node_modules/7zip-bin/mac/arm64/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/mac/arm64/7za
generated
vendored
Binary file not shown.
BIN
electron/node_modules/7zip-bin/mac/x64/7za
generated
vendored
BIN
electron/node_modules/7zip-bin/mac/x64/7za
generated
vendored
Binary file not shown.
20
electron/node_modules/7zip-bin/package.json
generated
vendored
20
electron/node_modules/7zip-bin/package.json
generated
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "7zip-bin",
|
|
||||||
"description": "7-Zip precompiled binaries",
|
|
||||||
"version": "5.1.1",
|
|
||||||
"files": [
|
|
||||||
"*.js",
|
|
||||||
"7x.sh",
|
|
||||||
"index.d.ts",
|
|
||||||
"linux",
|
|
||||||
"mac",
|
|
||||||
"win"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "develar/7zip-bin",
|
|
||||||
"keywords": [
|
|
||||||
"7zip",
|
|
||||||
"7z",
|
|
||||||
"7za"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
BIN
electron/node_modules/7zip-bin/win/ia32/7za.exe
generated
vendored
BIN
electron/node_modules/7zip-bin/win/ia32/7za.exe
generated
vendored
Binary file not shown.
BIN
electron/node_modules/7zip-bin/win/x64/7za.exe
generated
vendored
BIN
electron/node_modules/7zip-bin/win/x64/7za.exe
generated
vendored
Binary file not shown.
BIN
electron/node_modules/@capacitor/cli/assets/android-template.tar.gz
generated
vendored
BIN
electron/node_modules/@capacitor/cli/assets/android-template.tar.gz
generated
vendored
Binary file not shown.
BIN
electron/node_modules/@capacitor/cli/assets/capacitor-cordova-android-plugins.tar.gz
generated
vendored
BIN
electron/node_modules/@capacitor/cli/assets/capacitor-cordova-android-plugins.tar.gz
generated
vendored
Binary file not shown.
BIN
electron/node_modules/@capacitor/cli/assets/capacitor-cordova-ios-plugins.tar.gz
generated
vendored
BIN
electron/node_modules/@capacitor/cli/assets/capacitor-cordova-ios-plugins.tar.gz
generated
vendored
Binary file not shown.
BIN
electron/node_modules/@capacitor/cli/assets/ios-pods-template.tar.gz
generated
vendored
BIN
electron/node_modules/@capacitor/cli/assets/ios-pods-template.tar.gz
generated
vendored
Binary file not shown.
BIN
electron/node_modules/@capacitor/cli/assets/ios-spm-template.tar.gz
generated
vendored
BIN
electron/node_modules/@capacitor/cli/assets/ios-spm-template.tar.gz
generated
vendored
Binary file not shown.
25
electron/node_modules/@capacitor/cli/dist/declarations.d.ts
generated
vendored
25
electron/node_modules/@capacitor/cli/dist/declarations.d.ts
generated
vendored
|
|
@ -511,6 +511,15 @@ export interface CapacitorConfig {
|
||||||
packageTraits?: {
|
packageTraits?: {
|
||||||
[pluginId: string]: string[];
|
[pluginId: string]: string[];
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Define options to apply to the package.
|
||||||
|
* The key is the plugin ID (e.g. `@capacitor-community/device`)
|
||||||
|
*
|
||||||
|
* @since 8.4.0
|
||||||
|
*/
|
||||||
|
packageOptions?: {
|
||||||
|
[pluginId: string]: PackageOptions;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -546,7 +555,7 @@ export interface CapacitorConfig {
|
||||||
* Configure the local scheme on Android.
|
* Configure the local scheme on Android.
|
||||||
*
|
*
|
||||||
* Custom schemes on Android are unable to change the URL path as of Webview 117. Changing this value from anything other than `http` or `https` can result in your
|
* Custom schemes on Android are unable to change the URL path as of Webview 117. Changing this value from anything other than `http` or `https` can result in your
|
||||||
* application unable to resolve routing. If you must change this for some reason, consider using a hash-based url strategy, but there are no guarentees that this
|
* application unable to resolve routing. If you must change this for some reason, consider using a hash-based url strategy, but there are no guarantees that this
|
||||||
* will continue to work long term as allowing non-standard schemes to modify query parameters and url fragments is only allowed for compatibility reasons.
|
* will continue to work long term as allowing non-standard schemes to modify query parameters and url fragments is only allowed for compatibility reasons.
|
||||||
* https://ionic.io/blog/capacitor-android-customscheme-issue-with-chrome-117
|
* https://ionic.io/blog/capacitor-android-customscheme-issue-with-chrome-117
|
||||||
*
|
*
|
||||||
|
|
@ -732,3 +741,17 @@ export interface PluginsConfig {
|
||||||
animation?: 'FADE' | 'NONE';
|
animation?: 'FADE' | 'NONE';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
export interface PackageOptions {
|
||||||
|
/**
|
||||||
|
* Create a symlink to the plugin folder instead of pointing to the plugin path.
|
||||||
|
* Useful when plugin names conflict.
|
||||||
|
*/
|
||||||
|
symlink?: boolean;
|
||||||
|
/**
|
||||||
|
* Useful to avoid target name conflicts in dependencies
|
||||||
|
* [see](https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/modulealiasing/)
|
||||||
|
*/
|
||||||
|
moduleAliases?: {
|
||||||
|
[target: string]: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
206
electron/node_modules/@capacitor/cli/dist/ios/update.js
generated
vendored
206
electron/node_modules/@capacitor/cli/dist/ios/update.js
generated
vendored
|
|
@ -4,6 +4,7 @@ exports.installCocoaPodsPlugins = exports.updateIOS = void 0;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
|
const semver_1 = require("semver");
|
||||||
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
||||||
const common_1 = require("../common");
|
const common_1 = require("../common");
|
||||||
const cordova_1 = require("../cordova");
|
const cordova_1 = require("../cordova");
|
||||||
|
|
@ -11,6 +12,7 @@ const errors_1 = require("../errors");
|
||||||
const log_1 = require("../log");
|
const log_1 = require("../log");
|
||||||
const plugin_1 = require("../plugin");
|
const plugin_1 = require("../plugin");
|
||||||
const copy_1 = require("../tasks/copy");
|
const copy_1 = require("../tasks/copy");
|
||||||
|
const migrate_1 = require("../tasks/migrate");
|
||||||
const fs_1 = require("../util/fs");
|
const fs_1 = require("../util/fs");
|
||||||
const iosplugin_1 = require("../util/iosplugin");
|
const iosplugin_1 = require("../util/iosplugin");
|
||||||
const node_1 = require("../util/node");
|
const node_1 = require("../util/node");
|
||||||
|
|
@ -43,6 +45,22 @@ async function updatePluginFiles(config, plugins, deployment) {
|
||||||
if ((await config.ios.packageManager) === 'SPM') {
|
if ((await config.ios.packageManager) === 'SPM') {
|
||||||
await generateCordovaPackageFiles(cordovaPlugins, config);
|
await generateCordovaPackageFiles(cordovaPlugins, config);
|
||||||
const validSPMPackages = await (0, spm_1.checkPluginsForPackageSwift)(config, plugins);
|
const validSPMPackages = await (0, spm_1.checkPluginsForPackageSwift)(config, plugins);
|
||||||
|
await Promise.all(validSPMPackages.map(async (plugin) => {
|
||||||
|
var _a;
|
||||||
|
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
||||||
|
const packageSwiftPath = (0, path_1.join)(plugin.rootPath, 'Package.swift');
|
||||||
|
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
||||||
|
const regex = new RegExp('url:\\s*"https://github.com/ionic-team/capacitor-swift-pm\\.git",\\s*from:\\s*"([^"]+)"');
|
||||||
|
const version = (_a = content.match(regex)) === null || _a === void 0 ? void 0 : _a[1];
|
||||||
|
const majorCapVersion = (0, semver_1.major)(iosPlatformVersion);
|
||||||
|
if (version && (0, semver_1.major)(version) != majorCapVersion) {
|
||||||
|
const preCapVersion = (0, semver_1.prerelease)(iosPlatformVersion);
|
||||||
|
const forceVersion = preCapVersion ? iosPlatformVersion : `${majorCapVersion}.0.0`;
|
||||||
|
content = (0, migrate_1.setAllStringIn)(content, `url: "https://github.com/ionic-team/capacitor-swift-pm.git",`, `)`, ` from: "${forceVersion}"`);
|
||||||
|
await (0, fs_extra_1.writeFile)(packageSwiftPath, content);
|
||||||
|
log_1.logger.warn(`${plugin.id} is built for Capacitor ${(0, semver_1.major)(version)}, it might cause issues`);
|
||||||
|
}
|
||||||
|
}));
|
||||||
await (0, spm_1.generatePackageFile)(config, validSPMPackages.concat(cordovaPlugins));
|
await (0, spm_1.generatePackageFile)(config, validSPMPackages.concat(cordovaPlugins));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -59,14 +77,159 @@ async function generateCordovaPackageFiles(cordovaPlugins, config) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function generateCordovaPackageFile(p, config) {
|
async function generateCordovaPackageFile(p, config) {
|
||||||
|
var _a;
|
||||||
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
||||||
|
const platformTag = (0, plugin_1.getPluginPlatform)(p, platform);
|
||||||
|
if ((_a = platformTag.$) === null || _a === void 0 ? void 0 : _a.package) {
|
||||||
|
const packageSwiftPath = (0, path_1.join)(p.rootPath, 'Package.swift');
|
||||||
|
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
||||||
|
content = content.replace(`apache`, `ionic-team`).replaceAll(`cordova-ios`, `capacitor-swift-pm`);
|
||||||
|
content = (0, migrate_1.setAllStringIn)(content, `url: "https://github.com/ionic-team/capacitor-swift-pm.git",`, `)`, ` from: "${iosPlatformVersion}"`);
|
||||||
|
await (0, fs_extra_1.writeFile)(packageSwiftPath, content);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await writeGeneratedPackageSwift(p, config, iosPlatformVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function buildBinaryTargetEntries(p, frameworks) {
|
||||||
|
const customXcframeworks = frameworks.filter((f) => f.$.custom === 'true' && f.$.src.endsWith('.xcframework'));
|
||||||
|
const customFrameworks = frameworks.filter((f) => f.$.custom === 'true' && f.$.src.endsWith('.framework'));
|
||||||
|
if (customFrameworks.length > 0) {
|
||||||
|
customFrameworks.forEach((f) => {
|
||||||
|
log_1.logger.warn(`${p.id}: custom .framework files are not supported as binaryTarget in SPM (${f.$.src}). Convert to .xcframework for SPM compatibility.`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const binaryTargetsText = customXcframeworks
|
||||||
|
.map((f) => {
|
||||||
|
const name = f.$.src.split('/').pop().replace('.xcframework', '');
|
||||||
|
return `,
|
||||||
|
.binaryTarget(
|
||||||
|
name: "${name}",
|
||||||
|
path: "${f.$.src}"
|
||||||
|
)`;
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
const binaryDepsText = customXcframeworks
|
||||||
|
.map((f) => {
|
||||||
|
const name = f.$.src.split('/').pop().replace('.xcframework', '');
|
||||||
|
return `,\n .target(name: "${name}")`;
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
return { binaryTargetsText, binaryDepsText };
|
||||||
|
}
|
||||||
|
function buildResourcesText(resources) {
|
||||||
|
const resourceEntry = [];
|
||||||
|
for (const resource of resources) {
|
||||||
|
resourceEntry.push(`.copy("resources/${resource.$.src.split('/').pop()}")`);
|
||||||
|
}
|
||||||
|
return resources.length > 0
|
||||||
|
? `,
|
||||||
|
resources: [
|
||||||
|
${resourceEntry.join(',\n ')}
|
||||||
|
]`
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
async function buildDependencyTexts(p, config) {
|
||||||
|
let allDependencies = (0, plugin_1.getPlatformElement)(p, platform, 'dependency');
|
||||||
|
if (p.xml['dependency']) {
|
||||||
|
allDependencies = allDependencies.concat(p.xml['dependency']);
|
||||||
|
}
|
||||||
|
let packageText = '';
|
||||||
|
let productText = '';
|
||||||
|
await Promise.all(allDependencies.map(async (dep) => {
|
||||||
|
let plugin = dep.$.id;
|
||||||
|
if (plugin.includes('@') && plugin.indexOf('@') !== 0) {
|
||||||
|
[plugin] = plugin.split('@');
|
||||||
|
}
|
||||||
|
const depPlugin = await (0, plugin_1.resolvePlugin)(config, plugin);
|
||||||
|
if (depPlugin) {
|
||||||
|
const headerFiles = (0, plugin_1.getPlatformElement)(depPlugin, platform, 'header-file');
|
||||||
|
const resources = (0, plugin_1.getPlatformElement)(depPlugin, platform, 'resource-file');
|
||||||
|
const sourceFiles = (0, plugin_1.getPlatformElement)(depPlugin, platform, 'source-file');
|
||||||
|
if (sourceFiles.length === 0 && headerFiles.length === 0 && resources.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
packageText += `,\n .package(name: "${depPlugin.name}", path: "../${depPlugin.name}")`;
|
||||||
|
productText += `,\n .product(name: "${depPlugin.name}", package: "${depPlugin.name}")`;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
return { packageText, productText };
|
||||||
|
}
|
||||||
|
function buildCSettingsText(p, sourceFiles) {
|
||||||
|
var _a;
|
||||||
|
const pluginId = p.id;
|
||||||
|
const allFlags = new Set();
|
||||||
|
for (const sourceFile of sourceFiles) {
|
||||||
|
const flags = (_a = sourceFile.$) === null || _a === void 0 ? void 0 : _a['compiler-flags'];
|
||||||
|
if (flags) {
|
||||||
|
flags
|
||||||
|
.split(/\s+/)
|
||||||
|
.map((f) => f.trim())
|
||||||
|
.filter((f) => f.length > 0)
|
||||||
|
.forEach((f) => allFlags.add(f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allFlags.size === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const entries = [];
|
||||||
|
const unsupportedFlags = [];
|
||||||
|
for (const flag of allFlags) {
|
||||||
|
if (flag.startsWith('-D')) {
|
||||||
|
const definition = flag.slice(2);
|
||||||
|
const eqIndex = definition.indexOf('=');
|
||||||
|
if (eqIndex !== -1) {
|
||||||
|
const name = definition.slice(0, eqIndex);
|
||||||
|
const value = definition.slice(eqIndex + 1);
|
||||||
|
entries.push(` .define("${name}", to: "${value}")`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
entries.push(` .define("${definition}")`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
unsupportedFlags.push(flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (unsupportedFlags.length > 0) {
|
||||||
|
log_1.logger.warn(`${pluginId}: the following compiler flags are not supported in SPM and were ignored: ${unsupportedFlags.join(', ')}. ` +
|
||||||
|
`This might cause the plugin to fail to compile.`);
|
||||||
|
}
|
||||||
|
if (entries.length === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return `,
|
||||||
|
cSettings: [
|
||||||
|
${entries.join(',\n')}
|
||||||
|
]`;
|
||||||
|
}
|
||||||
|
async function writeGeneratedPackageSwift(p, config, iosPlatformVersion) {
|
||||||
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
||||||
const headerFiles = (0, plugin_1.getPlatformElement)(p, platform, 'header-file');
|
const headerFiles = (0, plugin_1.getPlatformElement)(p, platform, 'header-file');
|
||||||
let headersText = '';
|
const headersText = headerFiles.length > 0
|
||||||
if (headerFiles.length > 0) {
|
? `,
|
||||||
headersText = `,
|
publicHeadersPath: "."`
|
||||||
publicHeadersPath: "."`;
|
: '';
|
||||||
|
const resources = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
|
||||||
|
const sourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'source-file');
|
||||||
|
if (sourceFiles.length === 0 && headerFiles.length === 0 && resources.length === 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
||||||
|
const { binaryTargetsText, binaryDepsText } = buildBinaryTargetEntries(p, frameworks);
|
||||||
|
const cSettingsText = buildCSettingsText(p, sourceFiles);
|
||||||
|
const systemFrameworks = frameworks.filter((f) => !f.$.custom && f.$.src.endsWith('.framework'));
|
||||||
|
const hasWeakFrameworks = systemFrameworks.some((f) => f.$.weak === 'true');
|
||||||
|
const requiredSystemFrameworks = systemFrameworks.filter((f) => f.$.weak !== 'true');
|
||||||
|
const resourcesText = buildResourcesText(resources);
|
||||||
|
const libraryTypeText = hasWeakFrameworks ? `\n type: .dynamic,` : '';
|
||||||
|
const linkerSettingsText = requiredSystemFrameworks.length > 0
|
||||||
|
? `,
|
||||||
|
linkerSettings: [
|
||||||
|
${requiredSystemFrameworks.map((f) => ` .linkedFramework("${f.$.src.replace('.framework', '')}")`).join(',\n')}
|
||||||
|
]`
|
||||||
|
: '';
|
||||||
|
const { packageText, productText } = await buildDependencyTexts(p, config);
|
||||||
const content = `// swift-tools-version: 5.9
|
const content = `// swift-tools-version: 5.9
|
||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
@ -76,21 +239,21 @@ let package = Package(
|
||||||
platforms: [.iOS(.v${iosVersion})],
|
platforms: [.iOS(.v${iosVersion})],
|
||||||
products: [
|
products: [
|
||||||
.library(
|
.library(
|
||||||
name: "${p.name}",
|
name: "${p.name}",${libraryTypeText}
|
||||||
targets: ["${p.name}"]
|
targets: ["${p.name}"]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "${iosPlatformVersion}")
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "${iosPlatformVersion}")${packageText}
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
name: "${p.name}",
|
name: "${p.name}",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.product(name: "Cordova", package: "capacitor-swift-pm")
|
.product(name: "Cordova", package: "capacitor-swift-pm")${binaryDepsText}${productText}
|
||||||
],
|
],
|
||||||
path: "."${headersText}
|
path: "."${resourcesText}${headersText}${cSettingsText}${linkerSettingsText}
|
||||||
)
|
)${binaryTargetsText}
|
||||||
]
|
]
|
||||||
)`;
|
)`;
|
||||||
await (0, fs_extra_1.writeFile)((0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'sources', p.name, 'Package.swift'), content);
|
await (0, fs_extra_1.writeFile)((0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'sources', p.name, 'Package.swift'), content);
|
||||||
|
|
@ -354,13 +517,19 @@ function getLinkerFlags(config) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
||||||
|
var _a;
|
||||||
|
const isSPM = (await config.ios.packageManager) === 'SPM';
|
||||||
for (const p of cordovaPlugins) {
|
for (const p of cordovaPlugins) {
|
||||||
|
const platformTag = (0, plugin_1.getPluginPlatform)(p, platform);
|
||||||
|
if (isSPM && ((_a = platformTag.$) === null || _a === void 0 ? void 0 : _a.package)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const sourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'source-file');
|
const sourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'source-file');
|
||||||
const headerFiles = (0, plugin_1.getPlatformElement)(p, platform, 'header-file');
|
const headerFiles = (0, plugin_1.getPlatformElement)(p, platform, 'header-file');
|
||||||
const codeFiles = sourceFiles.concat(headerFiles);
|
const codeFiles = sourceFiles.concat(headerFiles);
|
||||||
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
||||||
let sourcesFolderName = 'sources';
|
let sourcesFolderName = 'sources';
|
||||||
if ((0, cordova_1.needsStaticPod)(p)) {
|
if (!isSPM && (0, cordova_1.needsStaticPod)(p)) {
|
||||||
sourcesFolderName += 'static';
|
sourcesFolderName += 'static';
|
||||||
}
|
}
|
||||||
const sourcesFolder = (0, path_1.join)(config.ios.cordovaPluginsDirAbs, sourcesFolderName, p.name);
|
const sourcesFolder = (0, path_1.join)(config.ios.cordovaPluginsDirAbs, sourcesFolderName, p.name);
|
||||||
|
|
@ -371,7 +540,7 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
||||||
fileName = 'lib' + fileName;
|
fileName = 'lib' + fileName;
|
||||||
}
|
}
|
||||||
let destFolder = sourcesFolderName;
|
let destFolder = sourcesFolderName;
|
||||||
if (codeFile.$['compiler-flags'] && codeFile.$['compiler-flags'] === '-fno-objc-arc') {
|
if (!isSPM && codeFile.$['compiler-flags'] && codeFile.$['compiler-flags'] === '-fno-objc-arc') {
|
||||||
destFolder = 'noarc';
|
destFolder = 'noarc';
|
||||||
}
|
}
|
||||||
const filePath = (0, plugin_1.getFilePath)(config, p, codeFile.$.src);
|
const filePath = (0, plugin_1.getFilePath)(config, p, codeFile.$.src);
|
||||||
|
|
@ -390,8 +559,13 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
||||||
}
|
}
|
||||||
if (fileContent.includes('[NSBundle bundleForClass:[self class]]') ||
|
if (fileContent.includes('[NSBundle bundleForClass:[self class]]') ||
|
||||||
fileContent.includes('[NSBundle bundleForClass:[CDVCapture class]]')) {
|
fileContent.includes('[NSBundle bundleForClass:[CDVCapture class]]')) {
|
||||||
fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', '[NSBundle mainBundle]');
|
const bundleName = isSPM ? 'SWIFTPM_MODULE_BUNDLE' : '[NSBundle mainBundle]';
|
||||||
fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', '[NSBundle mainBundle]');
|
fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', bundleName);
|
||||||
|
fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', bundleName);
|
||||||
|
await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
||||||
|
}
|
||||||
|
if (isSPM && fileContent.includes('[NSBundle mainBundle] URLForResource')) {
|
||||||
|
fileContent = fileContent.replace('[NSBundle mainBundle] URLForResource', 'SWIFTPM_MODULE_BUNDLE URLForResource');
|
||||||
await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
||||||
}
|
}
|
||||||
if (fileContent.includes('[self.webView superview]') || fileContent.includes('self.webView.superview')) {
|
if (fileContent.includes('[self.webView superview]') || fileContent.includes('self.webView.superview')) {
|
||||||
|
|
@ -405,7 +579,8 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
||||||
const resourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
|
const resourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
|
||||||
for (const resourceFile of resourceFiles) {
|
for (const resourceFile of resourceFiles) {
|
||||||
const fileName = resourceFile.$.src.split('/').pop();
|
const fileName = resourceFile.$.src.split('/').pop();
|
||||||
await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'resources', fileName));
|
const rootResFolder = isSPM ? sourcesFolder : config.ios.cordovaPluginsDirAbs;
|
||||||
|
await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(rootResFolder, 'resources', fileName));
|
||||||
}
|
}
|
||||||
for (const framework of frameworks) {
|
for (const framework of frameworks) {
|
||||||
if (framework.$.custom && framework.$.custom === 'true') {
|
if (framework.$.custom && framework.$.custom === 'true') {
|
||||||
|
|
@ -416,6 +591,9 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
||||||
}
|
}
|
||||||
async function removePluginsNativeFiles(config) {
|
async function removePluginsNativeFiles(config) {
|
||||||
await (0, fs_extra_1.remove)(config.ios.cordovaPluginsDirAbs);
|
await (0, fs_extra_1.remove)(config.ios.cordovaPluginsDirAbs);
|
||||||
|
if ((await config.ios.packageManager) === 'SPM') {
|
||||||
|
await (0, fs_extra_1.remove)((0, path_1.join)(config.ios.nativeProjectDirAbs, 'CapApp-SPM', 'symlinks'));
|
||||||
|
}
|
||||||
await (0, template_1.extractTemplate)(config.cli.assets.ios.cordovaPluginsTemplateArchiveAbs, config.ios.cordovaPluginsDirAbs);
|
await (0, template_1.extractTemplate)(config.cli.assets.ios.cordovaPluginsTemplateArchiveAbs, config.ios.cordovaPluginsDirAbs);
|
||||||
}
|
}
|
||||||
function filterResources(plugin) {
|
function filterResources(plugin) {
|
||||||
|
|
|
||||||
6
electron/node_modules/@capacitor/cli/dist/ipc.js
generated
vendored
6
electron/node_modules/@capacitor/cli/dist/ipc.js
generated
vendored
|
|
@ -36,16 +36,16 @@ async function receive(msg) {
|
||||||
const { data } = msg;
|
const { data } = msg;
|
||||||
// This request is only made if telemetry is on.
|
// This request is only made if telemetry is on.
|
||||||
const req = (0, https_1.request)({
|
const req = (0, https_1.request)({
|
||||||
hostname: 'api.ionicjs.com',
|
hostname: 'metrics-capacitor.outsystems.com',
|
||||||
port: 443,
|
port: 443,
|
||||||
path: '/events/metrics',
|
path: '/metrics',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
debug('Sent %O metric to events service (status: %O)', data.name, response.statusCode);
|
debug('Sent %O metric to events service (status: %O)', data.name, response.statusCode);
|
||||||
if (response.statusCode !== 204) {
|
if (response.statusCode !== 202) {
|
||||||
response.on('data', (chunk) => {
|
response.on('data', (chunk) => {
|
||||||
debug('Bad response from events service. Request body: %O', chunk.toString());
|
debug('Bad response from events service. Request body: %O', chunk.toString());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
3
electron/node_modules/@capacitor/cli/dist/tasks/migrate.js
generated
vendored
3
electron/node_modules/@capacitor/cli/dist/tasks/migrate.js
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.migrateCommand = void 0;
|
exports.setAllStringIn = exports.migrateCommand = void 0;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
|
|
@ -497,6 +497,7 @@ function setAllStringIn(data, start, end, replacement) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
exports.setAllStringIn = setAllStringIn;
|
||||||
async function updateAndroidManifest(filename) {
|
async function updateAndroidManifest(filename) {
|
||||||
const txt = readFile(filename);
|
const txt = readFile(filename);
|
||||||
if (!txt) {
|
if (!txt) {
|
||||||
|
|
|
||||||
3
electron/node_modules/@capacitor/cli/dist/tasks/run.js
generated
vendored
3
electron/node_modules/@capacitor/cli/dist/tasks/run.js
generated
vendored
|
|
@ -85,6 +85,9 @@ async function runCommand(config, selectedPlatformName, options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
if (options.liveReload) {
|
||||||
|
await livereload_1.CapLiveReloadHelper.revertCapConfigForLiveReload();
|
||||||
|
}
|
||||||
if (!(0, errors_1.isFatal)(e)) {
|
if (!(0, errors_1.isFatal)(e)) {
|
||||||
(0, errors_1.fatal)((_c = e.stack) !== null && _c !== void 0 ? _c : e);
|
(0, errors_1.fatal)((_c = e.stack) !== null && _c !== void 0 ? _c : e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
electron/node_modules/@capacitor/cli/dist/telemetry.js
generated
vendored
23
electron/node_modules/@capacitor/cli/dist/telemetry.js
generated
vendored
|
|
@ -1,9 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.sendMetric = exports.telemetryAction = void 0;
|
exports.getIOSPackageManager = exports.sendMetric = exports.telemetryAction = void 0;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const commander_1 = require("commander");
|
const commander_1 = require("commander");
|
||||||
const debug_1 = tslib_1.__importDefault(require("debug"));
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
||||||
|
const fs_extra_1 = require("fs-extra");
|
||||||
const colors_1 = tslib_1.__importDefault(require("./colors"));
|
const colors_1 = tslib_1.__importDefault(require("./colors"));
|
||||||
const ipc_1 = require("./ipc");
|
const ipc_1 = require("./ipc");
|
||||||
const log_1 = require("./log");
|
const log_1 = require("./log");
|
||||||
|
|
@ -51,8 +52,10 @@ function telemetryAction(config, action) {
|
||||||
error: error ? (error.message ? error.message : String(error)) : null,
|
error: error ? (error.message ? error.message : String(error)) : null,
|
||||||
node_version: process.version,
|
node_version: process.version,
|
||||||
os: config.cli.os,
|
os: config.cli.os,
|
||||||
|
ios_package_manager: await getIOSPackageManager(config),
|
||||||
...Object.fromEntries(versions),
|
...Object.fromEntries(versions),
|
||||||
};
|
};
|
||||||
|
debug('metric payload: %O', data);
|
||||||
if ((0, term_1.isInteractive)()) {
|
if ((0, term_1.isInteractive)()) {
|
||||||
let sysconfig = await (0, sysconfig_1.readConfig)();
|
let sysconfig = await (0, sysconfig_1.readConfig)();
|
||||||
if (!error && typeof sysconfig.telemetry === 'undefined') {
|
if (!error && typeof sysconfig.telemetry === 'undefined') {
|
||||||
|
|
@ -88,6 +91,24 @@ async function sendMetric(sysconfig, name, data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.sendMetric = sendMetric;
|
exports.sendMetric = sendMetric;
|
||||||
|
/**
|
||||||
|
* Resolve the iOS dependency manager for telemetry. Returns 'unknown' for
|
||||||
|
* non-iOS projects or when detection throws, so callers never have to handle
|
||||||
|
* errors from this signal.
|
||||||
|
*/
|
||||||
|
async function getIOSPackageManager(config) {
|
||||||
|
try {
|
||||||
|
if (!(await (0, fs_extra_1.pathExists)(config.ios.platformDirAbs))) {
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
return await config.ios.packageManager;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
debug('Could not resolve iOS package manager for telemetry: %O', e);
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getIOSPackageManager = getIOSPackageManager;
|
||||||
/**
|
/**
|
||||||
* Get a unique anonymous identifier for this app.
|
* Get a unique anonymous identifier for this app.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
61
electron/node_modules/@capacitor/cli/dist/util/spm.js
generated
vendored
61
electron/node_modules/@capacitor/cli/dist/util/spm.js
generated
vendored
|
|
@ -45,12 +45,12 @@ exports.generatePackageFile = generatePackageFile;
|
||||||
async function checkPluginsForPackageSwift(config, plugins) {
|
async function checkPluginsForPackageSwift(config, plugins) {
|
||||||
const iOSCapacitorPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, 'ios') === 0 /* PluginType.Core */);
|
const iOSCapacitorPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, 'ios') === 0 /* PluginType.Core */);
|
||||||
const packageSwiftPluginList = await pluginsWithPackageSwift(iOSCapacitorPlugins);
|
const packageSwiftPluginList = await pluginsWithPackageSwift(iOSCapacitorPlugins);
|
||||||
if (plugins.length == packageSwiftPluginList.length) {
|
if (iOSCapacitorPlugins.length == packageSwiftPluginList.length) {
|
||||||
log_1.logger.debug(`Found ${plugins.length} iOS plugins, ${packageSwiftPluginList.length} have a Package.swift file`);
|
log_1.logger.debug(`Found ${iOSCapacitorPlugins.length} Capacitor iOS plugins, ${packageSwiftPluginList.length} have a Package.swift file`);
|
||||||
log_1.logger.info('All plugins have a Package.swift file and will be included in Package.swift');
|
log_1.logger.info('All Capacitor plugins have a Package.swift file and will be included in Package.swift');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log_1.logger.warn('Some installed packages are not compatable with SPM');
|
log_1.logger.warn('Some installed Capacitor plugins are not compatible with SPM');
|
||||||
}
|
}
|
||||||
return packageSwiftPluginList;
|
return packageSwiftPluginList;
|
||||||
}
|
}
|
||||||
|
|
@ -84,11 +84,12 @@ async function removeCocoapodsFiles(config) {
|
||||||
}
|
}
|
||||||
exports.removeCocoapodsFiles = removeCocoapodsFiles;
|
exports.removeCocoapodsFiles = removeCocoapodsFiles;
|
||||||
async function generatePackageText(config, plugins) {
|
async function generatePackageText(config, plugins) {
|
||||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
||||||
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
||||||
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
||||||
const packageTraits = (_d = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits) !== null && _d !== void 0 ? _d : {};
|
const packageTraits = (_d = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits) !== null && _d !== void 0 ? _d : {};
|
||||||
const swiftToolsVersion = (_h = (_g = (_f = (_e = config.app.extConfig.experimental) === null || _e === void 0 ? void 0 : _e.ios) === null || _f === void 0 ? void 0 : _f.spm) === null || _g === void 0 ? void 0 : _g.swiftToolsVersion) !== null && _h !== void 0 ? _h : '5.9';
|
const packageOptions = (_h = (_g = (_f = (_e = config.app.extConfig.experimental) === null || _e === void 0 ? void 0 : _e.ios) === null || _f === void 0 ? void 0 : _f.spm) === null || _g === void 0 ? void 0 : _g.packageOptions) !== null && _h !== void 0 ? _h : {};
|
||||||
|
const swiftToolsVersion = (_m = (_l = (_k = (_j = config.app.extConfig.experimental) === null || _j === void 0 ? void 0 : _j.ios) === null || _k === void 0 ? void 0 : _k.spm) === null || _l === void 0 ? void 0 : _l.swiftToolsVersion) !== null && _m !== void 0 ? _m : '5.9';
|
||||||
let packageSwiftText = `// swift-tools-version: ${swiftToolsVersion}
|
let packageSwiftText = `// swift-tools-version: ${swiftToolsVersion}
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
|
|
@ -105,10 +106,28 @@ let package = Package(
|
||||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "${iosPlatformVersion}")`;
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "${iosPlatformVersion}")`;
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
if ((0, plugin_1.getPluginType)(plugin, config.ios.name) === 1 /* PluginType.Cordova */) {
|
if ((0, plugin_1.getPluginType)(plugin, config.ios.name) === 1 /* PluginType.Cordova */) {
|
||||||
packageSwiftText += `,\n .package(name: "${plugin.name}", path: "../../capacitor-cordova-ios-plugins/sources/${plugin.name}")`;
|
const platformTag = (0, plugin_1.getPluginPlatform)(plugin, config.ios.name);
|
||||||
|
if ((_o = platformTag.$) === null || _o === void 0 ? void 0 : _o.package) {
|
||||||
|
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
||||||
|
packageSwiftText += `,\n .package(name: "${plugin.id}", path: "${relPath}")`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
const sourceFiles = (0, plugin_1.getPlatformElement)(plugin, config.ios.name, 'source-file');
|
||||||
|
const headerFiles = (0, plugin_1.getPlatformElement)(plugin, config.ios.name, 'header-file');
|
||||||
|
if (sourceFiles.length === 0 && headerFiles.length === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
packageSwiftText += `,\n .package(name: "${plugin.name}", path: "../../capacitor-cordova-ios-plugins/sources/${plugin.name}")`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const options = packageOptions[plugin.id];
|
||||||
|
const symlink = options === null || options === void 0 ? void 0 : options.symlink;
|
||||||
|
const symlinkFolder = (0, path_1.join)('symlinks', plugin.name);
|
||||||
|
const relPath = symlink ? symlinkFolder : (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
||||||
|
if (symlink) {
|
||||||
|
await (0, fs_extra_1.ensureSymlink)(plugin.rootPath, (0, path_1.resolve)(config.ios.nativeProjectDirAbs, 'CapApp-SPM', symlinkFolder));
|
||||||
|
}
|
||||||
const traits = packageTraits[plugin.id];
|
const traits = packageTraits[plugin.id];
|
||||||
const traitsSuffix = (traits === null || traits === void 0 ? void 0 : traits.length)
|
const traitsSuffix = (traits === null || traits === void 0 ? void 0 : traits.length)
|
||||||
? `, traits: [${traits
|
? `, traits: [${traits
|
||||||
|
|
@ -118,7 +137,7 @@ let package = Package(
|
||||||
})
|
})
|
||||||
.join(', ')}]`
|
.join(', ')}]`
|
||||||
: '';
|
: '';
|
||||||
packageSwiftText += `,\n .package(name: "${(_j = plugin.ios) === null || _j === void 0 ? void 0 : _j.name}", path: "${relPath}"${traitsSuffix})`;
|
packageSwiftText += `,\n .package(name: "${(_p = plugin.ios) === null || _p === void 0 ? void 0 : _p.name}", path: "${relPath}"${traitsSuffix})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
packageSwiftText += `
|
packageSwiftText += `
|
||||||
|
|
@ -130,7 +149,29 @@ let package = Package(
|
||||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||||
.product(name: "Cordova", package: "capacitor-swift-pm")`;
|
.product(name: "Cordova", package: "capacitor-swift-pm")`;
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
packageSwiftText += `,\n .product(name: "${(_k = plugin.ios) === null || _k === void 0 ? void 0 : _k.name}", package: "${(_l = plugin.ios) === null || _l === void 0 ? void 0 : _l.name}")`;
|
const aliases = Object.entries((_r = (_q = packageOptions[plugin.id]) === null || _q === void 0 ? void 0 : _q.moduleAliases) !== null && _r !== void 0 ? _r : {});
|
||||||
|
const aliasText = (aliases === null || aliases === void 0 ? void 0 : aliases.length)
|
||||||
|
? `, moduleAliases: [${aliases
|
||||||
|
.map(([target, replacement]) => {
|
||||||
|
return `"${target}": "${replacement}"`;
|
||||||
|
})
|
||||||
|
.join(', ')}]`
|
||||||
|
: '';
|
||||||
|
let pluginText = `,\n .product(name: "${(_s = plugin.ios) === null || _s === void 0 ? void 0 : _s.name}", package: "${(_t = plugin.ios) === null || _t === void 0 ? void 0 : _t.name}"${aliasText})`;
|
||||||
|
if ((0, plugin_1.getPluginType)(plugin, config.ios.name) === 1 /* PluginType.Cordova */) {
|
||||||
|
const platformTag = (0, plugin_1.getPluginPlatform)(plugin, config.ios.name);
|
||||||
|
if ((_u = platformTag.$) === null || _u === void 0 ? void 0 : _u.package) {
|
||||||
|
pluginText = `,\n .product(name: "${plugin.id}", package: "${plugin.id}")`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const sourceFiles = (0, plugin_1.getPlatformElement)(plugin, config.ios.name, 'source-file');
|
||||||
|
const headerFiles = (0, plugin_1.getPlatformElement)(plugin, config.ios.name, 'header-file');
|
||||||
|
if (sourceFiles.length === 0 && headerFiles.length === 0) {
|
||||||
|
pluginText = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packageSwiftText += pluginText;
|
||||||
}
|
}
|
||||||
packageSwiftText += `
|
packageSwiftText += `
|
||||||
]
|
]
|
||||||
|
|
|
||||||
2
electron/node_modules/@capacitor/cli/node_modules/fs-extra/README.md
generated
vendored
2
electron/node_modules/@capacitor/cli/node_modules/fs-extra/README.md
generated
vendored
|
|
@ -61,7 +61,7 @@ const fse = require('fs-extra')
|
||||||
|
|
||||||
### ESM
|
### ESM
|
||||||
|
|
||||||
There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` seperately:
|
There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` separately:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
|
|
|
||||||
8
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/ensure/link.js
generated
vendored
8
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/ensure/link.js
generated
vendored
|
|
@ -10,14 +10,14 @@ const { areIdentical } = require('../util/stat')
|
||||||
async function createLink (srcpath, dstpath) {
|
async function createLink (srcpath, dstpath) {
|
||||||
let dstStat
|
let dstStat
|
||||||
try {
|
try {
|
||||||
dstStat = await fs.lstat(dstpath)
|
dstStat = await fs.lstat(dstpath, { bigint: true })
|
||||||
} catch {
|
} catch {
|
||||||
// ignore error
|
// ignore error
|
||||||
}
|
}
|
||||||
|
|
||||||
let srcStat
|
let srcStat
|
||||||
try {
|
try {
|
||||||
srcStat = await fs.lstat(srcpath)
|
srcStat = await fs.lstat(srcpath, { bigint: true })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
err.message = err.message.replace('lstat', 'ensureLink')
|
err.message = err.message.replace('lstat', 'ensureLink')
|
||||||
throw err
|
throw err
|
||||||
|
|
@ -39,11 +39,11 @@ async function createLink (srcpath, dstpath) {
|
||||||
function createLinkSync (srcpath, dstpath) {
|
function createLinkSync (srcpath, dstpath) {
|
||||||
let dstStat
|
let dstStat
|
||||||
try {
|
try {
|
||||||
dstStat = fs.lstatSync(dstpath)
|
dstStat = fs.lstatSync(dstpath, { bigint: true })
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const srcStat = fs.lstatSync(srcpath)
|
const srcStat = fs.lstatSync(srcpath, { bigint: true })
|
||||||
if (dstStat && areIdentical(srcStat, dstStat)) return
|
if (dstStat && areIdentical(srcStat, dstStat)) return
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
err.message = err.message.replace('lstat', 'ensureLink')
|
err.message = err.message.replace('lstat', 'ensureLink')
|
||||||
|
|
|
||||||
16
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
16
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/ensure/symlink.js
generated
vendored
|
|
@ -24,18 +24,18 @@ async function createSymlink (srcpath, dstpath, type) {
|
||||||
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
||||||
let srcStat
|
let srcStat
|
||||||
if (path.isAbsolute(srcpath)) {
|
if (path.isAbsolute(srcpath)) {
|
||||||
srcStat = await fs.stat(srcpath)
|
srcStat = await fs.stat(srcpath, { bigint: true })
|
||||||
} else {
|
} else {
|
||||||
const dstdir = path.dirname(dstpath)
|
const dstdir = path.dirname(dstpath)
|
||||||
const relativeToDst = path.join(dstdir, srcpath)
|
const relativeToDst = path.join(dstdir, srcpath)
|
||||||
try {
|
try {
|
||||||
srcStat = await fs.stat(relativeToDst)
|
srcStat = await fs.stat(relativeToDst, { bigint: true })
|
||||||
} catch {
|
} catch {
|
||||||
srcStat = await fs.stat(srcpath)
|
srcStat = await fs.stat(srcpath, { bigint: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dstStat = await fs.stat(dstpath)
|
const dstStat = await fs.stat(dstpath, { bigint: true })
|
||||||
if (areIdentical(srcStat, dstStat)) return
|
if (areIdentical(srcStat, dstStat)) return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,18 +61,18 @@ function createSymlinkSync (srcpath, dstpath, type) {
|
||||||
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
// (standard symlink behavior) or fall back to cwd if that doesn't exist
|
||||||
let srcStat
|
let srcStat
|
||||||
if (path.isAbsolute(srcpath)) {
|
if (path.isAbsolute(srcpath)) {
|
||||||
srcStat = fs.statSync(srcpath)
|
srcStat = fs.statSync(srcpath, { bigint: true })
|
||||||
} else {
|
} else {
|
||||||
const dstdir = path.dirname(dstpath)
|
const dstdir = path.dirname(dstpath)
|
||||||
const relativeToDst = path.join(dstdir, srcpath)
|
const relativeToDst = path.join(dstdir, srcpath)
|
||||||
try {
|
try {
|
||||||
srcStat = fs.statSync(relativeToDst)
|
srcStat = fs.statSync(relativeToDst, { bigint: true })
|
||||||
} catch {
|
} catch {
|
||||||
srcStat = fs.statSync(srcpath)
|
srcStat = fs.statSync(srcpath, { bigint: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dstStat = fs.statSync(dstpath)
|
const dstStat = fs.statSync(dstpath, { bigint: true })
|
||||||
if (areIdentical(srcStat, dstStat)) return
|
if (areIdentical(srcStat, dstStat)) return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/util/stat.js
generated
vendored
10
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/util/stat.js
generated
vendored
|
|
@ -101,7 +101,10 @@ async function checkParentPaths (src, srcStat, dest, funcName) {
|
||||||
try {
|
try {
|
||||||
destStat = await fs.stat(destParent, { bigint: true })
|
destStat = await fs.stat(destParent, { bigint: true })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code === 'ENOENT') return
|
// The destination parent does not exist yet, but a deeper ancestor might
|
||||||
|
// (e.g. when it is a symlink into the source tree). Keep walking up so the
|
||||||
|
// self-subdirectory check is not bypassed.
|
||||||
|
if (err.code === 'ENOENT') return checkParentPaths(src, srcStat, destParent, funcName)
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +123,10 @@ function checkParentPathsSync (src, srcStat, dest, funcName) {
|
||||||
try {
|
try {
|
||||||
destStat = fs.statSync(destParent, { bigint: true })
|
destStat = fs.statSync(destParent, { bigint: true })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.code === 'ENOENT') return
|
// The destination parent does not exist yet, but a deeper ancestor might
|
||||||
|
// (e.g. when it is a symlink into the source tree). Keep walking up so the
|
||||||
|
// self-subdirectory check is not bypassed.
|
||||||
|
if (err.code === 'ENOENT') return checkParentPathsSync(src, srcStat, destParent, funcName)
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
if (areIdentical(srcStat, destStat)) {
|
if (areIdentical(srcStat, destStat)) {
|
||||||
|
|
|
||||||
31
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/util/utimes.js
generated
vendored
31
electron/node_modules/@capacitor/cli/node_modules/fs-extra/lib/util/utimes.js
generated
vendored
|
|
@ -4,30 +4,47 @@ const fs = require('../fs')
|
||||||
const u = require('universalify').fromPromise
|
const u = require('universalify').fromPromise
|
||||||
|
|
||||||
async function utimesMillis (path, atime, mtime) {
|
async function utimesMillis (path, atime, mtime) {
|
||||||
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
||||||
const fd = await fs.open(path, 'r+')
|
const fd = await fs.open(path, 'r+')
|
||||||
|
|
||||||
let closeErr = null
|
let error = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.futimes(fd, atime, mtime)
|
await fs.futimes(fd, atime, mtime)
|
||||||
|
} catch (futimesErr) {
|
||||||
|
error = futimesErr
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
await fs.close(fd)
|
await fs.close(fd)
|
||||||
} catch (e) {
|
} catch (closeErr) {
|
||||||
closeErr = e
|
if (!error) error = closeErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closeErr) {
|
if (error) {
|
||||||
throw closeErr
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function utimesMillisSync (path, atime, mtime) {
|
function utimesMillisSync (path, atime, mtime) {
|
||||||
const fd = fs.openSync(path, 'r+')
|
const fd = fs.openSync(path, 'r+')
|
||||||
|
|
||||||
|
let error = null
|
||||||
|
|
||||||
|
try {
|
||||||
fs.futimesSync(fd, atime, mtime)
|
fs.futimesSync(fd, atime, mtime)
|
||||||
return fs.closeSync(fd)
|
} catch (futimesErr) {
|
||||||
|
error = futimesErr
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fs.closeSync(fd)
|
||||||
|
} catch (closeErr) {
|
||||||
|
if (!error) error = closeErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
2
electron/node_modules/@capacitor/cli/node_modules/fs-extra/package.json
generated
vendored
2
electron/node_modules/@capacitor/cli/node_modules/fs-extra/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "fs-extra",
|
"name": "fs-extra",
|
||||||
"version": "11.3.4",
|
"version": "11.3.6",
|
||||||
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.",
|
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.14"
|
"node": ">=14.14"
|
||||||
|
|
|
||||||
2
electron/node_modules/@capacitor/cli/package.json
generated
vendored
2
electron/node_modules/@capacitor/cli/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@capacitor/cli",
|
"name": "@capacitor/cli",
|
||||||
"version": "8.3.1",
|
"version": "8.4.1",
|
||||||
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
||||||
"homepage": "https://capacitorjs.com",
|
"homepage": "https://capacitorjs.com",
|
||||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||||
|
|
|
||||||
2
electron/node_modules/@capacitor/core/package.json
generated
vendored
2
electron/node_modules/@capacitor/core/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@capacitor/core",
|
"name": "@capacitor/core",
|
||||||
"version": "8.3.1",
|
"version": "8.4.1",
|
||||||
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
||||||
"homepage": "https://capacitorjs.com",
|
"homepage": "https://capacitorjs.com",
|
||||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||||
|
|
|
||||||
259
electron/node_modules/@develar/schema-utils/CHANGELOG.md
generated
vendored
259
electron/node_modules/@develar/schema-utils/CHANGELOG.md
generated
vendored
|
|
@ -1,259 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
||||||
|
|
||||||
### [2.6.5](https://github.com/webpack/schema-utils/compare/v2.6.4...v2.6.5) (2020-03-11)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* typo ([#88](https://github.com/webpack/schema-utils/issues/88)) ([52fc92b](https://github.com/webpack/schema-utils/commit/52fc92b531b7503b7bbe1bf9b21bfa26dffbc8f5))
|
|
||||||
|
|
||||||
### [2.6.4](https://github.com/webpack/schema-utils/compare/v2.6.3...v2.6.4) (2020-01-17)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* change `initialised` to `initialized` ([#87](https://github.com/webpack/schema-utils/issues/87)) ([70f12d3](https://github.com/webpack/schema-utils/commit/70f12d33a8eaa27249bc9c1a27f886724cf91ea7))
|
|
||||||
|
|
||||||
### [2.6.3](https://github.com/webpack/schema-utils/compare/v2.6.2...v2.6.3) (2020-01-17)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* prefer the `baseDataPath` option from arguments ([#86](https://github.com/webpack/schema-utils/issues/86)) ([e236859](https://github.com/webpack/schema-utils/commit/e236859e85b28e35e1294f86fc1ff596a5031cea))
|
|
||||||
|
|
||||||
### [2.6.2](https://github.com/webpack/schema-utils/compare/v2.6.1...v2.6.2) (2020-01-14)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* better handle Windows absolute paths ([#85](https://github.com/webpack/schema-utils/issues/85)) ([1fa2930](https://github.com/webpack/schema-utils/commit/1fa2930a161e907b9fc53a7233d605910afdb883))
|
|
||||||
|
|
||||||
### [2.6.1](https://github.com/webpack/schema-utils/compare/v2.6.0...v2.6.1) (2019-11-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* typescript declarations ([#84](https://github.com/webpack/schema-utils/issues/84)) ([89d55a9](https://github.com/webpack/schema-utils/commit/89d55a9a8edfa6a8ac8b112f226bb3154e260319))
|
|
||||||
|
|
||||||
## [2.6.0](https://github.com/webpack/schema-utils/compare/v2.5.0...v2.6.0) (2019-11-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* support configuration via title ([#81](https://github.com/webpack/schema-utils/issues/81)) ([afddc10](https://github.com/webpack/schema-utils/commit/afddc109f6891cd37a9f1835d50862d119a072bf))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* typescript definitions ([#70](https://github.com/webpack/schema-utils/issues/70)) ([f38158d](https://github.com/webpack/schema-utils/commit/f38158d6d040e2c701622778ae8122fb26a4f990))
|
|
||||||
|
|
||||||
## [2.5.0](https://github.com/webpack/schema-utils/compare/v2.4.1...v2.5.0) (2019-10-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* rework format for maxLength, minLength ([#67](https://github.com/webpack/schema-utils/issues/67)) ([0d12259](https://github.com/webpack/schema-utils/commit/0d12259))
|
|
||||||
* support all cases with one number in range ([#64](https://github.com/webpack/schema-utils/issues/64)) ([7fc8069](https://github.com/webpack/schema-utils/commit/7fc8069))
|
|
||||||
* typescript definition and export naming ([#69](https://github.com/webpack/schema-utils/issues/69)) ([a435b79](https://github.com/webpack/schema-utils/commit/a435b79))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* "smart" numbers range ([62fb107](https://github.com/webpack/schema-utils/commit/62fb107))
|
|
||||||
|
|
||||||
### [2.4.1](https://github.com/webpack/schema-utils/compare/v2.4.0...v2.4.1) (2019-09-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* publish definitions ([#58](https://github.com/webpack/schema-utils/issues/58)) ([1885faa](https://github.com/webpack/schema-utils/commit/1885faa))
|
|
||||||
|
|
||||||
## [2.4.0](https://github.com/webpack/schema-utils/compare/v2.3.0...v2.4.0) (2019-09-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* better errors when the `type` keyword doesn't exist ([0988be2](https://github.com/webpack/schema-utils/commit/0988be2))
|
|
||||||
* support $data reference ([#56](https://github.com/webpack/schema-utils/issues/56)) ([d2f11d6](https://github.com/webpack/schema-utils/commit/d2f11d6))
|
|
||||||
* types definitions ([#52](https://github.com/webpack/schema-utils/issues/52)) ([facb431](https://github.com/webpack/schema-utils/commit/facb431))
|
|
||||||
|
|
||||||
## [2.3.0](https://github.com/webpack/schema-utils/compare/v2.2.0...v2.3.0) (2019-09-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* support `not` keyword ([#53](https://github.com/webpack/schema-utils/issues/53)) ([765f458](https://github.com/webpack/schema-utils/commit/765f458))
|
|
||||||
|
|
||||||
## [2.2.0](https://github.com/webpack/schema-utils/compare/v2.1.0...v2.2.0) (2019-09-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* better error output for `oneOf` and `anyOf` ([#48](https://github.com/webpack/schema-utils/issues/48)) ([#50](https://github.com/webpack/schema-utils/issues/50)) ([332242f](https://github.com/webpack/schema-utils/commit/332242f))
|
|
||||||
|
|
||||||
## [2.1.0](https://github.com/webpack-contrib/schema-utils/compare/v2.0.1...v2.1.0) (2019-08-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* throw error on sparse arrays ([#47](https://github.com/webpack-contrib/schema-utils/issues/47)) ([b85ac38](https://github.com/webpack-contrib/schema-utils/commit/b85ac38))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* export `ValidateError` ([#46](https://github.com/webpack-contrib/schema-utils/issues/46)) ([ff781d7](https://github.com/webpack-contrib/schema-utils/commit/ff781d7))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### [2.0.1](https://github.com/webpack-contrib/schema-utils/compare/v2.0.0...v2.0.1) (2019-07-18)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* error message for empty object ([#44](https://github.com/webpack-contrib/schema-utils/issues/44)) ([0b4b4a2](https://github.com/webpack-contrib/schema-utils/commit/0b4b4a2))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### [2.0.0](https://github.com/webpack-contrib/schema-utils/compare/v1.0.0...v2.0.0) (2019-07-17)
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* drop support for Node.js < 8.9.0
|
|
||||||
* drop support `errorMessage`, please use `description` for links.
|
|
||||||
* api was changed, please look documentation.
|
|
||||||
* error messages was fully rewritten.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="1.0.0"></a>
|
|
||||||
# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.7"></a>
|
|
||||||
## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.6"></a>
|
|
||||||
## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81))
|
|
||||||
* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.5"></a>
|
|
||||||
## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f))
|
|
||||||
* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.4"></a>
|
|
||||||
## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.3"></a>
|
|
||||||
## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda))
|
|
||||||
* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.2"></a>
|
|
||||||
## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.1"></a>
|
|
||||||
## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.4.0"></a>
|
|
||||||
# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.3.0"></a>
|
|
||||||
# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.2.1"></a>
|
|
||||||
## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363))
|
|
||||||
* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.2.0"></a>
|
|
||||||
# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12)
|
|
||||||
|
|
||||||
<a name="0.1.0"></a>
|
|
||||||
# 0.1.0 (2017-03-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
||||||
20
electron/node_modules/@develar/schema-utils/LICENSE
generated
vendored
20
electron/node_modules/@develar/schema-utils/LICENSE
generated
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
Copyright JS Foundation and other contributors
|
|
||||||
|
|
||||||
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.
|
|
||||||
276
electron/node_modules/@develar/schema-utils/README.md
generated
vendored
276
electron/node_modules/@develar/schema-utils/README.md
generated
vendored
|
|
@ -1,276 +0,0 @@
|
||||||
<div align="center">
|
|
||||||
<a href="http://json-schema.org">
|
|
||||||
<img width="160" height="160"
|
|
||||||
src="https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/.github/assets/logo.png">
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/webpack/webpack">
|
|
||||||
<img width="200" height="200"
|
|
||||||
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
[![npm][npm]][npm-url]
|
|
||||||
[![node][node]][node-url]
|
|
||||||
[![deps][deps]][deps-url]
|
|
||||||
[![tests][tests]][tests-url]
|
|
||||||
[![coverage][cover]][cover-url]
|
|
||||||
[![chat][chat]][chat-url]
|
|
||||||
[![size][size]][size-url]
|
|
||||||
|
|
||||||
# schema-utils
|
|
||||||
|
|
||||||
Package for validate options in loaders and plugins.
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
To begin, you'll need to install `schema-utils`:
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install schema-utils
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
**schema.json**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"option": {
|
|
||||||
"type": ["boolean"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
import schema from './path/to/schema.json';
|
|
||||||
import validate from 'schema-utils';
|
|
||||||
|
|
||||||
const options = { option: true };
|
|
||||||
const configuration = { name: 'Loader Name/Plugin Name/Name' };
|
|
||||||
|
|
||||||
validate(schema, options, configuration);
|
|
||||||
```
|
|
||||||
|
|
||||||
### `schema`
|
|
||||||
|
|
||||||
Type: `String`
|
|
||||||
|
|
||||||
JSON schema.
|
|
||||||
|
|
||||||
Simple example of schema:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"description": "This is description of option.",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `options`
|
|
||||||
|
|
||||||
Type: `Object`
|
|
||||||
|
|
||||||
Object with options.
|
|
||||||
|
|
||||||
```js
|
|
||||||
validate(
|
|
||||||
schema,
|
|
||||||
{
|
|
||||||
name: 123,
|
|
||||||
},
|
|
||||||
{ name: 'MyPlugin' }
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
### `configuration`
|
|
||||||
|
|
||||||
Allow to configure validator.
|
|
||||||
|
|
||||||
There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"title": "My Loader options",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"description": "This is description of option.",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The last word used for the `baseDataPath` option, other words used for the `name` option.
|
|
||||||
Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`.
|
|
||||||
|
|
||||||
#### `name`
|
|
||||||
|
|
||||||
Type: `Object`
|
|
||||||
Default: `"Object"`
|
|
||||||
|
|
||||||
Allow to setup name in validation errors.
|
|
||||||
|
|
||||||
```js
|
|
||||||
validate(schema, options, { name: 'MyPlugin' });
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema.
|
|
||||||
- configuration.optionName should be a integer.
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `baseDataPath`
|
|
||||||
|
|
||||||
Type: `String`
|
|
||||||
Default: `"configuration"`
|
|
||||||
|
|
||||||
Allow to setup base data path in validation errors.
|
|
||||||
|
|
||||||
```js
|
|
||||||
validate(schema, options, { name: 'MyPlugin', baseDataPath: 'options' });
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema.
|
|
||||||
- options.optionName should be a integer.
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `postFormatter`
|
|
||||||
|
|
||||||
Type: `Function`
|
|
||||||
Default: `undefined`
|
|
||||||
|
|
||||||
Allow to reformat errors.
|
|
||||||
|
|
||||||
```js
|
|
||||||
validate(schema, options, {
|
|
||||||
name: 'MyPlugin',
|
|
||||||
postFormatter: (formattedError, error) => {
|
|
||||||
if (error.keyword === 'type') {
|
|
||||||
return `${formattedError}\nAdditional Information.`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return formattedError;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
```shell
|
|
||||||
Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema.
|
|
||||||
- options.optionName should be a integer.
|
|
||||||
Additional Information.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
**schema.json**
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"anyOf": [
|
|
||||||
{ "type": "array" },
|
|
||||||
{ "type": "string" },
|
|
||||||
{ "instanceof": "RegExp" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"transform": {
|
|
||||||
"instanceof": "Function"
|
|
||||||
},
|
|
||||||
"sourceMap": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `Loader`
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { getOptions } from 'loader-utils';
|
|
||||||
import validateOptions from 'schema-utils';
|
|
||||||
|
|
||||||
import schema from 'path/to/schema.json';
|
|
||||||
|
|
||||||
function loader(src, map) {
|
|
||||||
const options = getOptions(this) || {};
|
|
||||||
|
|
||||||
validateOptions(schema, options, {
|
|
||||||
name: 'Loader Name',
|
|
||||||
baseDataPath: 'options',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Code...
|
|
||||||
}
|
|
||||||
|
|
||||||
export default loader;
|
|
||||||
```
|
|
||||||
|
|
||||||
### `Plugin`
|
|
||||||
|
|
||||||
```js
|
|
||||||
import validateOptions from 'schema-utils';
|
|
||||||
|
|
||||||
import schema from 'path/to/schema.json';
|
|
||||||
|
|
||||||
class Plugin {
|
|
||||||
constructor(options) {
|
|
||||||
validateOptions(schema, options, {
|
|
||||||
name: 'Plugin Name',
|
|
||||||
baseDataPath: 'options',
|
|
||||||
});
|
|
||||||
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
apply(compiler) {
|
|
||||||
// Code...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Plugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
|
||||||
|
|
||||||
[CONTRIBUTING](./.github/CONTRIBUTING.md)
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
[MIT](./LICENSE)
|
|
||||||
|
|
||||||
[npm]: https://img.shields.io/npm/v/schema-utils.svg
|
|
||||||
[npm-url]: https://npmjs.com/package/schema-utils
|
|
||||||
[node]: https://img.shields.io/node/v/schema-utils.svg
|
|
||||||
[node-url]: https://nodejs.org
|
|
||||||
[deps]: https://david-dm.org/webpack/schema-utils.svg
|
|
||||||
[deps-url]: https://david-dm.org/webpack/schema-utils
|
|
||||||
[tests]: https://dev.azure.com/webpack/schema-utils/_apis/build/status/webpack.schema-utils?branchName=master
|
|
||||||
[tests-url]: https://dev.azure.com/webpack/schema-utils/_build/latest?definitionId=9&branchName=master
|
|
||||||
[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg
|
|
||||||
[cover-url]: https://codecov.io/gh/webpack/schema-utils
|
|
||||||
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
|
||||||
[chat-url]: https://gitter.im/webpack/webpack
|
|
||||||
[size]: https://packagephobia.now.sh/badge?p=schema-utils
|
|
||||||
[size-url]: https://packagephobia.now.sh/result?p=schema-utils
|
|
||||||
115
electron/node_modules/@develar/schema-utils/declarations/ValidationError.d.ts
generated
vendored
115
electron/node_modules/@develar/schema-utils/declarations/ValidationError.d.ts
generated
vendored
|
|
@ -1,115 +0,0 @@
|
||||||
export default ValidationError;
|
|
||||||
export type JSONSchema6 = import('json-schema').JSONSchema6;
|
|
||||||
export type JSONSchema7 = import('json-schema').JSONSchema7;
|
|
||||||
export type Schema =
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7;
|
|
||||||
export type ValidationErrorConfiguration = {
|
|
||||||
name?: string | undefined;
|
|
||||||
baseDataPath?: string | undefined;
|
|
||||||
postFormatter?: import('./validate').PostFormatter | undefined;
|
|
||||||
};
|
|
||||||
export type PostFormatter = (
|
|
||||||
formattedError: string,
|
|
||||||
error: import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
}
|
|
||||||
) => string;
|
|
||||||
export type SchemaUtilErrorObject = import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
};
|
|
||||||
export type SPECIFICITY = number;
|
|
||||||
declare class ValidationError extends Error {
|
|
||||||
/**
|
|
||||||
* @param {Array<SchemaUtilErrorObject>} errors
|
|
||||||
* @param {Schema} schema
|
|
||||||
* @param {ValidationErrorConfiguration} configuration
|
|
||||||
*/
|
|
||||||
constructor(
|
|
||||||
errors: (import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
})[],
|
|
||||||
schema:
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7,
|
|
||||||
configuration?: import('./validate').ValidationErrorConfiguration
|
|
||||||
);
|
|
||||||
/** @type {Array<SchemaUtilErrorObject>} */
|
|
||||||
errors: Array<SchemaUtilErrorObject>;
|
|
||||||
/** @type {Schema} */
|
|
||||||
schema: Schema;
|
|
||||||
/** @type {string} */
|
|
||||||
headerName: string;
|
|
||||||
/** @type {string} */
|
|
||||||
baseDataPath: string;
|
|
||||||
/** @type {PostFormatter | null} */
|
|
||||||
postFormatter: PostFormatter | null;
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Schema}
|
|
||||||
*/
|
|
||||||
getSchemaPart(
|
|
||||||
path: string
|
|
||||||
):
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7;
|
|
||||||
/**
|
|
||||||
* @param {Schema} schema
|
|
||||||
* @param {Array<Object>} prevSchemas
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
formatSchema(
|
|
||||||
schema:
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7,
|
|
||||||
prevSchemas?: Object[]
|
|
||||||
): string;
|
|
||||||
/**
|
|
||||||
* @param {Schema=} schemaPart
|
|
||||||
* @param {(boolean | Array<string>)=} additionalPath
|
|
||||||
* @param {boolean=} needDot
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
getSchemaPartText(
|
|
||||||
schemaPart?:
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7
|
|
||||||
| undefined,
|
|
||||||
additionalPath?: boolean | string[] | undefined,
|
|
||||||
needDot?: boolean | undefined
|
|
||||||
): string;
|
|
||||||
/**
|
|
||||||
* @param {Schema=} schemaPart
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
getSchemaPartDescription(
|
|
||||||
schemaPart?:
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7
|
|
||||||
| undefined
|
|
||||||
): string;
|
|
||||||
/**
|
|
||||||
* @param {SchemaUtilErrorObject} error
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
formatValidationError(
|
|
||||||
error: import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
}
|
|
||||||
): string;
|
|
||||||
/**
|
|
||||||
* @param {Array<SchemaUtilErrorObject>} errors
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
formatValidationErrors(
|
|
||||||
errors: (import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
})[]
|
|
||||||
): string;
|
|
||||||
}
|
|
||||||
2
electron/node_modules/@develar/schema-utils/declarations/index.d.ts
generated
vendored
2
electron/node_modules/@develar/schema-utils/declarations/index.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
||||||
declare const _exports: typeof import('./validate').default;
|
|
||||||
export = _exports;
|
|
||||||
13
electron/node_modules/@develar/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
13
electron/node_modules/@develar/schema-utils/declarations/keywords/absolutePath.d.ts
generated
vendored
|
|
@ -1,13 +0,0 @@
|
||||||
export default addAbsolutePathKeyword;
|
|
||||||
export type Ajv = import('ajv').Ajv;
|
|
||||||
export type SchemaUtilErrorObject = import('ajv').ErrorObject & {
|
|
||||||
children?: import('ajv').ErrorObject[] | undefined;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {Ajv} ajv
|
|
||||||
* @returns {Ajv}
|
|
||||||
*/
|
|
||||||
declare function addAbsolutePathKeyword(
|
|
||||||
ajv: import('ajv').Ajv
|
|
||||||
): import('ajv').Ajv;
|
|
||||||
43
electron/node_modules/@develar/schema-utils/declarations/util/Range.d.ts
generated
vendored
43
electron/node_modules/@develar/schema-utils/declarations/util/Range.d.ts
generated
vendored
|
|
@ -1,43 +0,0 @@
|
||||||
export = Range;
|
|
||||||
/**
|
|
||||||
* @typedef {[number, boolean]} RangeValue
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @callback RangeValueCallback
|
|
||||||
* @param {RangeValue} rangeValue
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
declare class Range {
|
|
||||||
/** @type {Array<RangeValue>} */
|
|
||||||
_left: Array<RangeValue>;
|
|
||||||
/** @type {Array<RangeValue>} */
|
|
||||||
_right: Array<RangeValue>;
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean=} exclusive
|
|
||||||
*/
|
|
||||||
left(value: number, exclusive?: boolean | undefined): void;
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean=} exclusive
|
|
||||||
*/
|
|
||||||
right(value: number, exclusive?: boolean | undefined): void;
|
|
||||||
/**
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @return {string} "smart" range string representation
|
|
||||||
*/
|
|
||||||
format(logic?: boolean): string;
|
|
||||||
}
|
|
||||||
declare namespace Range {
|
|
||||||
export {
|
|
||||||
getOperator,
|
|
||||||
formatRight,
|
|
||||||
formatLeft,
|
|
||||||
formatRange,
|
|
||||||
getRangeValue,
|
|
||||||
RangeValue,
|
|
||||||
RangeValueCallback,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
type RangeValue = [number, boolean];
|
|
||||||
type RangeValueCallback = (rangeValue: [number, boolean]) => boolean;
|
|
||||||
43
electron/node_modules/@develar/schema-utils/declarations/validate.d.ts
generated
vendored
43
electron/node_modules/@develar/schema-utils/declarations/validate.d.ts
generated
vendored
|
|
@ -1,43 +0,0 @@
|
||||||
export default validate;
|
|
||||||
export type JSONSchema4 = import('json-schema').JSONSchema4;
|
|
||||||
export type JSONSchema6 = import('json-schema').JSONSchema6;
|
|
||||||
export type JSONSchema7 = import('json-schema').JSONSchema7;
|
|
||||||
export type ErrorObject = Ajv.ErrorObject;
|
|
||||||
export type Schema =
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7;
|
|
||||||
export type SchemaUtilErrorObject = Ajv.ErrorObject & {
|
|
||||||
children?: Ajv.ErrorObject[] | undefined;
|
|
||||||
};
|
|
||||||
export type PostFormatter = (
|
|
||||||
formattedError: string,
|
|
||||||
error: Ajv.ErrorObject & {
|
|
||||||
children?: Ajv.ErrorObject[] | undefined;
|
|
||||||
}
|
|
||||||
) => string;
|
|
||||||
export type ValidationErrorConfiguration = {
|
|
||||||
name?: string | undefined;
|
|
||||||
baseDataPath?: string | undefined;
|
|
||||||
postFormatter?: PostFormatter | undefined;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* @param {Schema} schema
|
|
||||||
* @param {Array<object> | object} options
|
|
||||||
* @param {ValidationErrorConfiguration=} configuration
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
declare function validate(
|
|
||||||
schema:
|
|
||||||
| import('json-schema').JSONSchema4
|
|
||||||
| import('json-schema').JSONSchema6
|
|
||||||
| import('json-schema').JSONSchema7,
|
|
||||||
options: any,
|
|
||||||
configuration?: ValidationErrorConfiguration | undefined
|
|
||||||
): void;
|
|
||||||
declare namespace validate {
|
|
||||||
export { ValidationError };
|
|
||||||
export { ValidationError as ValidateError };
|
|
||||||
}
|
|
||||||
import Ajv from 'ajv';
|
|
||||||
import ValidationError from './ValidationError';
|
|
||||||
1286
electron/node_modules/@develar/schema-utils/dist/ValidationError.js
generated
vendored
1286
electron/node_modules/@develar/schema-utils/dist/ValidationError.js
generated
vendored
File diff suppressed because it is too large
Load diff
5
electron/node_modules/@develar/schema-utils/dist/index.js
generated
vendored
5
electron/node_modules/@develar/schema-utils/dist/index.js
generated
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const validate = require('./validate');
|
|
||||||
|
|
||||||
module.exports = validate.default;
|
|
||||||
91
electron/node_modules/@develar/schema-utils/dist/keywords/absolutePath.js
generated
vendored
91
electron/node_modules/@develar/schema-utils/dist/keywords/absolutePath.js
generated
vendored
|
|
@ -1,91 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = void 0;
|
|
||||||
|
|
||||||
/** @typedef {import("ajv").Ajv} Ajv */
|
|
||||||
|
|
||||||
/** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string} data
|
|
||||||
* @param {object} schema
|
|
||||||
* @param {string} message
|
|
||||||
* @returns {object} // Todo `returns` should be `SchemaUtilErrorObject`
|
|
||||||
*/
|
|
||||||
function errorMessage(message, schema, data) {
|
|
||||||
return {
|
|
||||||
keyword: 'absolutePath',
|
|
||||||
params: {
|
|
||||||
absolutePath: data
|
|
||||||
},
|
|
||||||
message,
|
|
||||||
parentSchema: schema
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {boolean} shouldBeAbsolute
|
|
||||||
* @param {object} schema
|
|
||||||
* @param {string} data
|
|
||||||
* @returns {object}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function getErrorFor(shouldBeAbsolute, schema, data) {
|
|
||||||
const message = shouldBeAbsolute ? `The provided value ${JSON.stringify(data)} is not an absolute path!` : `A relative path is expected. However, the provided value ${JSON.stringify(data)} is an absolute path!`;
|
|
||||||
return errorMessage(message, schema, data);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {Ajv} ajv
|
|
||||||
* @returns {Ajv}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function addAbsolutePathKeyword(ajv) {
|
|
||||||
ajv.addKeyword('absolutePath', {
|
|
||||||
errors: true,
|
|
||||||
type: 'string',
|
|
||||||
|
|
||||||
compile(schema, parentSchema) {
|
|
||||||
/**
|
|
||||||
* @param {any} data
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function callback(data) {
|
|
||||||
let passes = true;
|
|
||||||
const isExclamationMarkPresent = data.includes('!');
|
|
||||||
|
|
||||||
if (isExclamationMarkPresent) {
|
|
||||||
callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)];
|
|
||||||
passes = false;
|
|
||||||
} // ?:[A-Za-z]:\\ - Windows absolute path
|
|
||||||
// \\\\ - Windows network absolute path
|
|
||||||
// \/ - Unix-like OS absolute path
|
|
||||||
|
|
||||||
|
|
||||||
const isCorrectAbsolutePath = schema === /^(?:[A-Za-z]:(\\|\/)|\\\\|\/)/.test(data);
|
|
||||||
|
|
||||||
if (!isCorrectAbsolutePath) {
|
|
||||||
callback.errors = [getErrorFor(schema, parentSchema, data)];
|
|
||||||
passes = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return passes;
|
|
||||||
}
|
|
||||||
/** @type {null | Array<SchemaUtilErrorObject>}*/
|
|
||||||
|
|
||||||
|
|
||||||
callback.errors = [];
|
|
||||||
return callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return ajv;
|
|
||||||
}
|
|
||||||
|
|
||||||
var _default = addAbsolutePathKeyword;
|
|
||||||
exports.default = _default;
|
|
||||||
163
electron/node_modules/@develar/schema-utils/dist/util/Range.js
generated
vendored
163
electron/node_modules/@develar/schema-utils/dist/util/Range.js
generated
vendored
|
|
@ -1,163 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {[number, boolean]} RangeValue
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @callback RangeValueCallback
|
|
||||||
* @param {RangeValue} rangeValue
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
class Range {
|
|
||||||
/**
|
|
||||||
* @param {"left" | "right"} side
|
|
||||||
* @param {boolean} exclusive
|
|
||||||
* @returns {">" | ">=" | "<" | "<="}
|
|
||||||
*/
|
|
||||||
static getOperator(side, exclusive) {
|
|
||||||
if (side === 'left') {
|
|
||||||
return exclusive ? '>' : '>=';
|
|
||||||
}
|
|
||||||
|
|
||||||
return exclusive ? '<' : '<=';
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @param {boolean} exclusive is range exclusive
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static formatRight(value, logic, exclusive) {
|
|
||||||
if (logic === false) {
|
|
||||||
return Range.formatLeft(value, !logic, !exclusive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `should be ${Range.getOperator('right', exclusive)} ${value}`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @param {boolean} exclusive is range exclusive
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static formatLeft(value, logic, exclusive) {
|
|
||||||
if (logic === false) {
|
|
||||||
return Range.formatRight(value, !logic, !exclusive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `should be ${Range.getOperator('left', exclusive)} ${value}`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {number} start left side value
|
|
||||||
* @param {number} end right side value
|
|
||||||
* @param {boolean} startExclusive is range exclusive from left side
|
|
||||||
* @param {boolean} endExclusive is range exclusive from right side
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static formatRange(start, end, startExclusive, endExclusive, logic) {
|
|
||||||
let result = 'should be';
|
|
||||||
result += ` ${Range.getOperator(logic ? 'left' : 'right', logic ? startExclusive : !startExclusive)} ${start} `;
|
|
||||||
result += logic ? 'and' : 'or';
|
|
||||||
result += ` ${Range.getOperator(logic ? 'right' : 'left', logic ? endExclusive : !endExclusive)} ${end}`;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {Array<RangeValue>} values
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @return {RangeValue} computed value and it's exclusive flag
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static getRangeValue(values, logic) {
|
|
||||||
let minMax = logic ? Infinity : -Infinity;
|
|
||||||
let j = -1;
|
|
||||||
const predicate = logic ?
|
|
||||||
/** @type {RangeValueCallback} */
|
|
||||||
([value]) => value <= minMax :
|
|
||||||
/** @type {RangeValueCallback} */
|
|
||||||
([value]) => value >= minMax;
|
|
||||||
|
|
||||||
for (let i = 0; i < values.length; i++) {
|
|
||||||
if (predicate(values[i])) {
|
|
||||||
[minMax] = values[i];
|
|
||||||
j = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (j > -1) {
|
|
||||||
return values[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [Infinity, true];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
/** @type {Array<RangeValue>} */
|
|
||||||
this._left = [];
|
|
||||||
/** @type {Array<RangeValue>} */
|
|
||||||
|
|
||||||
this._right = [];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean=} exclusive
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
left(value, exclusive = false) {
|
|
||||||
this._left.push([value, exclusive]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {number} value
|
|
||||||
* @param {boolean=} exclusive
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
right(value, exclusive = false) {
|
|
||||||
this._right.push([value, exclusive]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {boolean} logic is not logic applied
|
|
||||||
* @return {string} "smart" range string representation
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
format(logic = true) {
|
|
||||||
const [start, leftExclusive] = Range.getRangeValue(this._left, logic);
|
|
||||||
const [end, rightExclusive] = Range.getRangeValue(this._right, !logic);
|
|
||||||
|
|
||||||
if (!Number.isFinite(start) && !Number.isFinite(end)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const realStart = leftExclusive ? start + 1 : start;
|
|
||||||
const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6
|
|
||||||
|
|
||||||
if (realStart === realEnd) {
|
|
||||||
return `should be ${logic ? '' : '!'}= ${realStart}`;
|
|
||||||
} // e.g. 4 < x < ∞
|
|
||||||
|
|
||||||
|
|
||||||
if (Number.isFinite(start) && !Number.isFinite(end)) {
|
|
||||||
return Range.formatLeft(start, logic, leftExclusive);
|
|
||||||
} // e.g. ∞ < x < 4
|
|
||||||
|
|
||||||
|
|
||||||
if (!Number.isFinite(start) && Number.isFinite(end)) {
|
|
||||||
return Range.formatRight(end, logic, rightExclusive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Range.formatRange(start, end, leftExclusive, rightExclusive, logic);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Range;
|
|
||||||
154
electron/node_modules/@develar/schema-utils/dist/validate.js
generated
vendored
154
electron/node_modules/@develar/schema-utils/dist/validate.js
generated
vendored
|
|
@ -1,154 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.default = void 0;
|
|
||||||
|
|
||||||
var _ajv = _interopRequireDefault(require("ajv"));
|
|
||||||
|
|
||||||
var _ajvKeywords = _interopRequireDefault(require("ajv-keywords"));
|
|
||||||
|
|
||||||
var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath"));
|
|
||||||
|
|
||||||
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
/** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */
|
|
||||||
|
|
||||||
/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */
|
|
||||||
|
|
||||||
/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */
|
|
||||||
|
|
||||||
/** @typedef {import("ajv").ErrorObject} ErrorObject */
|
|
||||||
|
|
||||||
/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7)} Schema */
|
|
||||||
|
|
||||||
/** @typedef {ErrorObject & { children?: Array<ErrorObject>}} SchemaUtilErrorObject */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @callback PostFormatter
|
|
||||||
* @param {string} formattedError
|
|
||||||
* @param {SchemaUtilErrorObject} error
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} ValidationErrorConfiguration
|
|
||||||
* @property {string=} name
|
|
||||||
* @property {string=} baseDataPath
|
|
||||||
* @property {PostFormatter=} postFormatter
|
|
||||||
*/
|
|
||||||
const ajv = new _ajv.default({
|
|
||||||
allErrors: true,
|
|
||||||
verbose: true,
|
|
||||||
$data: true,
|
|
||||||
coerceTypes: true
|
|
||||||
});
|
|
||||||
(0, _ajvKeywords.default)(ajv, ['instanceof', 'formatMinimum', 'formatMaximum', 'patternRequired']); // Custom keywords
|
|
||||||
|
|
||||||
(0, _absolutePath.default)(ajv);
|
|
||||||
/**
|
|
||||||
* @param {Schema} schema
|
|
||||||
* @param {Array<object> | object} options
|
|
||||||
* @param {ValidationErrorConfiguration=} configuration
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function validate(schema, options, configuration) {
|
|
||||||
let errors = [];
|
|
||||||
|
|
||||||
if (Array.isArray(options)) {
|
|
||||||
errors = Array.from(options).map(nestedOptions => validateObject(schema, nestedOptions));
|
|
||||||
errors.forEach((list, idx) => {
|
|
||||||
const applyPrefix =
|
|
||||||
/**
|
|
||||||
* @param {SchemaUtilErrorObject} error
|
|
||||||
*/
|
|
||||||
error => {
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
error.dataPath = `[${idx}]${error.dataPath}`;
|
|
||||||
|
|
||||||
if (error.children) {
|
|
||||||
error.children.forEach(applyPrefix);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
list.forEach(applyPrefix);
|
|
||||||
});
|
|
||||||
errors = errors.reduce((arr, items) => arr.concat(items), []);
|
|
||||||
} else {
|
|
||||||
errors = validateObject(schema, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errors.length > 0) {
|
|
||||||
throw new _ValidationError.default(errors, schema, configuration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {Schema} schema
|
|
||||||
* @param {Array<object> | object} options
|
|
||||||
* @returns {Array<SchemaUtilErrorObject>}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function validateObject(schema, options) {
|
|
||||||
const compiledSchema = ajv.compile(schema);
|
|
||||||
const valid = compiledSchema(options);
|
|
||||||
|
|
||||||
if (!compiledSchema.errors) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return valid ? [] : filterErrors(compiledSchema.errors);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {Array<ErrorObject>} errors
|
|
||||||
* @returns {Array<SchemaUtilErrorObject>}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function filterErrors(errors) {
|
|
||||||
/** @type {Array<SchemaUtilErrorObject>} */
|
|
||||||
let newErrors = [];
|
|
||||||
|
|
||||||
for (const error of
|
|
||||||
/** @type {Array<SchemaUtilErrorObject>} */
|
|
||||||
errors) {
|
|
||||||
const {
|
|
||||||
dataPath
|
|
||||||
} = error;
|
|
||||||
/** @type {Array<SchemaUtilErrorObject>} */
|
|
||||||
|
|
||||||
let children = [];
|
|
||||||
newErrors = newErrors.filter(oldError => {
|
|
||||||
if (oldError.dataPath.includes(dataPath)) {
|
|
||||||
if (oldError.children) {
|
|
||||||
children = children.concat(oldError.children.slice(0));
|
|
||||||
} // eslint-disable-next-line no-undefined, no-param-reassign
|
|
||||||
|
|
||||||
|
|
||||||
oldError.children = undefined;
|
|
||||||
children.push(oldError);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (children.length) {
|
|
||||||
error.children = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
newErrors.push(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newErrors;
|
|
||||||
} // TODO change after resolve https://github.com/microsoft/TypeScript/issues/34994
|
|
||||||
|
|
||||||
|
|
||||||
validate.ValidationError = _ValidationError.default;
|
|
||||||
validate.ValidateError = _ValidationError.default;
|
|
||||||
var _default = validate;
|
|
||||||
exports.default = _default;
|
|
||||||
78
electron/node_modules/@develar/schema-utils/package.json
generated
vendored
78
electron/node_modules/@develar/schema-utils/package.json
generated
vendored
|
|
@ -1,78 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@develar/schema-utils",
|
|
||||||
"version": "2.6.5",
|
|
||||||
"description": "webpack Validation Utils",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "webpack/schema-utils",
|
|
||||||
"author": "webpack Contrib (https://github.com/webpack-contrib)",
|
|
||||||
"homepage": "https://github.com/webpack/schema-utils",
|
|
||||||
"bugs": "https://github.com/webpack/schema-utils/issues",
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/webpack"
|
|
||||||
},
|
|
||||||
"main": "dist/index.js",
|
|
||||||
"types": "declarations/index.d.ts",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 8.9.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"start": "npm run build -- -w",
|
|
||||||
"clean": "del-cli dist declarations",
|
|
||||||
"prebuild": "npm run clean",
|
|
||||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write",
|
|
||||||
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
|
||||||
"build": "npm-run-all -p \"build:**\"",
|
|
||||||
"commitlint": "commitlint --from=master",
|
|
||||||
"security": "npm audit",
|
|
||||||
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
|
|
||||||
"lint:js": "eslint --cache .",
|
|
||||||
"lint:types": "tsc --pretty --noEmit",
|
|
||||||
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
||||||
"test:only": "cross-env NODE_ENV=test jest",
|
|
||||||
"test:watch": "npm run test:only -- --watch",
|
|
||||||
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
|
||||||
"pretest": "npm run lint",
|
|
||||||
"test": "npm run test:coverage",
|
|
||||||
"prepare": "npm run build",
|
|
||||||
"release": "standard-version",
|
|
||||||
"defaults": "webpack-defaults"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"declarations"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"ajv": "^6.12.0",
|
|
||||||
"ajv-keywords": "^3.4.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/cli": "^7.8.3",
|
|
||||||
"@babel/core": "^7.8.3",
|
|
||||||
"@babel/preset-env": "^7.8.3",
|
|
||||||
"@commitlint/cli": "^8.3.5",
|
|
||||||
"@commitlint/config-conventional": "^8.3.4",
|
|
||||||
"@types/json-schema": "^7.0.4",
|
|
||||||
"@webpack-contrib/defaults": "^6.3.0",
|
|
||||||
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
||||||
"babel-jest": "^24.9.0",
|
|
||||||
"commitlint-azure-pipelines-cli": "^1.0.3",
|
|
||||||
"cross-env": "^6.0.3",
|
|
||||||
"del": "^5.1.0",
|
|
||||||
"del-cli": "^3.0.0",
|
|
||||||
"eslint": "^6.8.0",
|
|
||||||
"eslint-config-prettier": "^6.9.0",
|
|
||||||
"eslint-plugin-import": "^2.20.0",
|
|
||||||
"husky": "^4.0.10",
|
|
||||||
"jest": "^24.9.0",
|
|
||||||
"jest-junit": "^10.0.0",
|
|
||||||
"lint-staged": "^9.5.0",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"prettier": "^1.19.1",
|
|
||||||
"standard-version": "^7.0.1",
|
|
||||||
"typescript": "^3.7.5"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"webpack"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
96
electron/node_modules/@electron-internal/extract-zip/README.md
generated
vendored
Normal file
96
electron/node_modules/@electron-internal/extract-zip/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
# @electron-internal/extract-zip
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> **Internal to the Electron project.** This package exists to serve Electron's
|
||||||
|
> own tooling. Use from non-Electron packages is not supported: the API may
|
||||||
|
> change to suit Electron's needs, and bug reports or feature requests from
|
||||||
|
> outside use cases may be closed without action. If you need a general-purpose
|
||||||
|
> extractor, use [`extract-zip`](https://github.com/max-mapper/extract-zip).
|
||||||
|
|
||||||
|
Fast, safe, native zip extraction for Node.js. Drop-in replacement for [`extract-zip`](https://github.com/max-mapper/extract-zip).
|
||||||
|
|
||||||
|
- **Native**: Rust core via N-API, decompression runs off the event loop.
|
||||||
|
- **Fast**: ~2x faster on entry-heavy archives, never slower. See [benchmarks](#benchmarks).
|
||||||
|
- **Safe**: hardened against Zip Slip, symlink escapes, absolute paths, NUL injection, Windows reserved names, and zip bombs.
|
||||||
|
- **Zero runtime deps**: no `debug`/`yauzl`/`get-stream` in your tree.
|
||||||
|
- **Cross-platform**: prebuilt binaries for macOS, Linux (glibc/musl), and Windows (x64/arm64).
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @electron-internal/extract-zip
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
ESM only:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import extract from '@electron-internal/extract-zip';
|
||||||
|
|
||||||
|
await extract('archive.zip', { dir: '/absolute/output/path' });
|
||||||
|
```
|
||||||
|
|
||||||
|
`dir` (required, absolute) is the only option. Everything else is fixed: existing
|
||||||
|
files are overwritten, archive mode bits (masked to `0o777`) and mtimes are
|
||||||
|
preserved, symlinks are created (skipped on Windows without symlink privilege),
|
||||||
|
and writes are parallelised across `min(cpus, 8)` workers. The original's
|
||||||
|
`onEntry`, `defaultDirMode`, and `defaultFileMode` are not supported, since no
|
||||||
|
consumer in the `electron` org uses them.
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Every entry path is verified to land inside `dir`:
|
||||||
|
|
||||||
|
- `..` traversal is rejected and absolute paths are stripped, via the `zip` crate's audited `enclosed_name()`.
|
||||||
|
- Directories are created one component at a time without following symlinks; an entry whose path crosses a symlink is rejected.
|
||||||
|
- Symlinks are created after all files. Each target is walked against the on-disk tree and the archive's own symlink set, with relative-only hops bounded by `dir` and a hop cap, so a chain resolving outside `dir` is rejected before any link is created.
|
||||||
|
- NUL bytes and Windows reserved device names (`CON`, `AUX`, `COM1`, trailing space/dot) are rejected on every platform.
|
||||||
|
- Symlink targets are capped at 4 KiB; per-file output is capped at `max(2 x declared size, 1 MB)` to catch entries that lie about their size.
|
||||||
|
|
||||||
|
`test/security.test.js` exercises these escapes end-to-end with hand-crafted archives.
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
`yarn bench` (Apple M-series, Node 24, median of 5):
|
||||||
|
|
||||||
|
| Corpus | Zip size | `extract-zip` (JS) | this | Speedup |
|
||||||
|
|---|--:|--:|--:|--:|
|
||||||
|
| electron-v42.2.0-darwin-arm64 | 112 MB | 817 ms | 441 ms | 1.9x |
|
||||||
|
| 8 x 4 MB compressible | 0.1 MB | 24 ms | 3 ms | 9.4x |
|
||||||
|
| 2000 small text files | 0.4 MB | 372 ms | 199 ms | 1.9x |
|
||||||
|
| 200 incompressible files | 6.2 MB | 40 ms | 22 ms | 1.8x |
|
||||||
|
| `node_modules` | 2.9 MB | 68 ms | 37 ms | 1.9x |
|
||||||
|
|
||||||
|
Extraction runs in phases: validate paths and create directories, inflate and
|
||||||
|
write files in parallel with zlib-ng, then apply symlinks and directory
|
||||||
|
metadata. The Electron number is gated by its single 182 MB framework binary,
|
||||||
|
which can't be split further.
|
||||||
|
|
||||||
|
## Distribution
|
||||||
|
|
||||||
|
One package ships all prebuilt binaries (~2 MB gzipped): macOS
|
||||||
|
`darwin-universal`, Windows `x64`/`arm64`, and Linux `x64`/`arm64` for both glibc
|
||||||
|
and musl. `binding.js` picks the right one at load time. No
|
||||||
|
`optionalDependencies`, no postinstall, no network at install.
|
||||||
|
|
||||||
|
## Building from source
|
||||||
|
|
||||||
|
Requires a Rust toolchain (and `cmake` for zlib-ng).
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn install
|
||||||
|
yarn build # builds index.<your-platform>.node
|
||||||
|
yarn test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Releasing
|
||||||
|
|
||||||
|
Releases are driven by [semantic-release](https://semantic-release.gitbook.io/)
|
||||||
|
on every push to `main`: conventional commit messages decide the version bump,
|
||||||
|
CI builds all targets, and the fat package is published to npm via trusted
|
||||||
|
publishing. No manual version bumps or tags.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
BSD-2-Clause
|
||||||
8
electron/node_modules/@electron-internal/extract-zip/binding.d.ts
generated
vendored
Normal file
8
electron/node_modules/@electron-internal/extract-zip/binding.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* auto-generated by NAPI-RS */
|
||||||
|
/* eslint-disable */
|
||||||
|
export declare function extract(zipPath: string, opts: ExtractOptions): Promise<void>
|
||||||
|
|
||||||
|
export interface ExtractOptions {
|
||||||
|
/** Destination directory. Must be an absolute path. */
|
||||||
|
dir: string
|
||||||
|
}
|
||||||
629
electron/node_modules/@electron-internal/extract-zip/binding.js
generated
vendored
Normal file
629
electron/node_modules/@electron-internal/extract-zip/binding.js
generated
vendored
Normal file
|
|
@ -0,0 +1,629 @@
|
||||||
|
// prettier-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
/* auto-generated by NAPI-RS */
|
||||||
|
|
||||||
|
import { createRequire } from 'node:module'
|
||||||
|
const require = createRequire(import.meta.url)
|
||||||
|
const __dirname = new URL('.', import.meta.url).pathname
|
||||||
|
|
||||||
|
const { readFileSync } = require('node:fs')
|
||||||
|
let nativeBinding = null
|
||||||
|
const loadErrors = []
|
||||||
|
|
||||||
|
const isMusl = () => {
|
||||||
|
let musl = false
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
musl = isMuslFromFilesystem()
|
||||||
|
if (musl === null) {
|
||||||
|
musl = isMuslFromReport()
|
||||||
|
}
|
||||||
|
if (musl === null) {
|
||||||
|
musl = isMuslFromChildProcess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return musl
|
||||||
|
}
|
||||||
|
|
||||||
|
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
||||||
|
|
||||||
|
const isMuslFromFilesystem = () => {
|
||||||
|
try {
|
||||||
|
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isMuslFromReport = () => {
|
||||||
|
let report = null
|
||||||
|
if (typeof process.report?.getReport === 'function') {
|
||||||
|
process.report.excludeNetwork = true
|
||||||
|
report = process.report.getReport()
|
||||||
|
}
|
||||||
|
if (!report) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (report.header && report.header.glibcVersionRuntime) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (Array.isArray(report.sharedObjects)) {
|
||||||
|
if (report.sharedObjects.some(isFileMusl)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
const isMuslFromChildProcess = () => {
|
||||||
|
try {
|
||||||
|
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
||||||
|
} catch (e) {
|
||||||
|
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function requireNative() {
|
||||||
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||||
|
try {
|
||||||
|
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||||
|
} catch (err) {
|
||||||
|
loadErrors.push(err)
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'android') {
|
||||||
|
if (process.arch === 'arm64') {
|
||||||
|
try {
|
||||||
|
return require('./index.android-arm64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-android-arm64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-android-arm64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm') {
|
||||||
|
try {
|
||||||
|
return require('./index.android-arm-eabi.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-android-arm-eabi is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-android-arm-eabi/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'win32') {
|
||||||
|
if (process.arch === 'x64') {
|
||||||
|
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
||||||
|
try {
|
||||||
|
return require('./index.win32-x64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-x64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-x64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.win32-x64-msvc.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-x64-msvc is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-x64-msvc/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'ia32') {
|
||||||
|
try {
|
||||||
|
return require('./index.win32-ia32-msvc.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-ia32-msvc is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-ia32-msvc/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm64') {
|
||||||
|
try {
|
||||||
|
return require('./index.win32-arm64-msvc.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-arm64-msvc is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-win32-arm64-msvc/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
try {
|
||||||
|
return require('./index.darwin-universal.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-universal is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-universal/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
if (process.arch === 'x64') {
|
||||||
|
try {
|
||||||
|
return require('./index.darwin-x64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-x64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-x64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm64') {
|
||||||
|
try {
|
||||||
|
return require('./index.darwin-arm64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-arm64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-darwin-arm64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'freebsd') {
|
||||||
|
if (process.arch === 'x64') {
|
||||||
|
try {
|
||||||
|
return require('./index.freebsd-x64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-freebsd-x64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-freebsd-x64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm64') {
|
||||||
|
try {
|
||||||
|
return require('./index.freebsd-arm64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-freebsd-arm64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-freebsd-arm64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'linux') {
|
||||||
|
if (process.arch === 'x64') {
|
||||||
|
if (isMusl()) {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-x64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-x64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return require('./index.linux-x64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-x64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm64') {
|
||||||
|
if (isMusl()) {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-arm64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-arm64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return require('./index.linux-arm64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm') {
|
||||||
|
if (isMusl()) {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-arm-musleabihf.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm-musleabihf is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm-musleabihf/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-arm-gnueabihf.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm-gnueabihf is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-arm-gnueabihf/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'loong64') {
|
||||||
|
if (isMusl()) {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-loong64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-loong64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-loong64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-loong64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-loong64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-loong64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'riscv64') {
|
||||||
|
if (isMusl()) {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-riscv64-musl.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-riscv64-musl is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-riscv64-musl/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-riscv64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-riscv64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-riscv64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'ppc64') {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-ppc64-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-ppc64-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-ppc64-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 's390x') {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-s390x-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-s390x-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-s390x-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'ia32') {
|
||||||
|
try {
|
||||||
|
return require('./index.linux-ia32-gnu.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-ia32-gnu is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-linux-ia32-gnu/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else if (process.platform === 'openharmony') {
|
||||||
|
if (process.arch === 'arm64') {
|
||||||
|
try {
|
||||||
|
return require('./index.openharmony-arm64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-arm64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-arm64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'x64') {
|
||||||
|
try {
|
||||||
|
return require('./index.openharmony-x64.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-x64 is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-x64/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else if (process.arch === 'arm') {
|
||||||
|
try {
|
||||||
|
return require('./index.openharmony-arm.node')
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const binding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-arm is intentionally not published)') })()
|
||||||
|
const bindingPackageVersion = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-openharmony-arm/package.json is intentionally not published)') })().version
|
||||||
|
if (bindingPackageVersion !== '0.0.0-development' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||||
|
throw new Error(`Native binding package version mismatch, expected 0.0.0-development but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||||
|
}
|
||||||
|
return binding
|
||||||
|
} catch (e) {
|
||||||
|
loadErrors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeBinding = requireNative()
|
||||||
|
|
||||||
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||||
|
let wasiBinding = null
|
||||||
|
let wasiBindingError = null
|
||||||
|
try {
|
||||||
|
wasiBinding = require('./index.wasi.cjs')
|
||||||
|
nativeBinding = wasiBinding
|
||||||
|
} catch (err) {
|
||||||
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||||
|
wasiBindingError = err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||||
|
try {
|
||||||
|
wasiBinding = (() => { throw new Error('prebuild for this platform is not bundled (and @electron-internal/extract-zip-wasm32-wasi is intentionally not published)') })()
|
||||||
|
nativeBinding = wasiBinding
|
||||||
|
} catch (err) {
|
||||||
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||||
|
if (!wasiBindingError) {
|
||||||
|
wasiBindingError = err
|
||||||
|
} else {
|
||||||
|
wasiBindingError.cause = err
|
||||||
|
}
|
||||||
|
loadErrors.push(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||||
|
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||||
|
error.cause = wasiBindingError
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nativeBinding) {
|
||||||
|
if (loadErrors.length > 0) {
|
||||||
|
throw new Error(
|
||||||
|
`Cannot find native binding. ` +
|
||||||
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
||||||
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
||||||
|
{
|
||||||
|
cause: loadErrors.reduce((err, cur) => {
|
||||||
|
cur.cause = err
|
||||||
|
return cur
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
throw new Error(`Failed to load native binding`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { extract } = nativeBinding
|
||||||
|
export { extract }
|
||||||
8
electron/node_modules/@electron-internal/extract-zip/index.d.ts
generated
vendored
Normal file
8
electron/node_modules/@electron-internal/extract-zip/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
export interface ExtractOptions {
|
||||||
|
/** Destination directory. Must be an absolute path. */
|
||||||
|
dir: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function extract(zipPath: string, opts: ExtractOptions): Promise<void>;
|
||||||
|
|
||||||
|
export default extract;
|
||||||
BIN
electron/node_modules/@electron-internal/extract-zip/index.darwin-universal.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.darwin-universal.node
generated
vendored
Normal file
Binary file not shown.
23
electron/node_modules/@electron-internal/extract-zip/index.js
generated
vendored
Normal file
23
electron/node_modules/@electron-internal/extract-zip/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import path from 'node:path';
|
||||||
|
import { extract as nativeExtract } from './binding.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract a zip archive to a directory.
|
||||||
|
*
|
||||||
|
* await extract(source, { dir: '/abs/path' })
|
||||||
|
*
|
||||||
|
* @param {string} zipPath
|
||||||
|
* @param {import('./index.js').ExtractOptions} opts
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
export async function extract(zipPath, opts) {
|
||||||
|
if (!opts || typeof opts.dir !== 'string') {
|
||||||
|
throw new TypeError('extract: opts.dir is required');
|
||||||
|
}
|
||||||
|
if (!path.isAbsolute(opts.dir)) {
|
||||||
|
throw new TypeError('extract: opts.dir must be an absolute path');
|
||||||
|
}
|
||||||
|
return nativeExtract(zipPath, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default extract;
|
||||||
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm-gnueabihf.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm-gnueabihf.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm64-gnu.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm64-gnu.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm64-musl.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-arm64-musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-ia32-gnu.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-ia32-gnu.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-x64-gnu.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-x64-gnu.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-x64-musl.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.linux-x64-musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.win32-arm64-msvc.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.win32-arm64-msvc.node
generated
vendored
Normal file
Binary file not shown.
BIN
electron/node_modules/@electron-internal/extract-zip/index.win32-x64-msvc.node
generated
vendored
Normal file
BIN
electron/node_modules/@electron-internal/extract-zip/index.win32-x64-msvc.node
generated
vendored
Normal file
Binary file not shown.
69
electron/node_modules/@electron-internal/extract-zip/package.json
generated
vendored
Normal file
69
electron/node_modules/@electron-internal/extract-zip/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"name": "@electron-internal/extract-zip",
|
||||||
|
"version": "1.0.4",
|
||||||
|
"description": "Fast, safe, native zip extraction for Node.js. Drop-in replacement for extract-zip.",
|
||||||
|
"type": "module",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts",
|
||||||
|
"binding.js",
|
||||||
|
"binding.d.ts",
|
||||||
|
"index.*.node"
|
||||||
|
],
|
||||||
|
"napi": {
|
||||||
|
"binaryName": "index",
|
||||||
|
"packageName": "@electron-internal/extract-zip",
|
||||||
|
"targets": [
|
||||||
|
"x86_64-apple-darwin",
|
||||||
|
"aarch64-apple-darwin",
|
||||||
|
"universal-apple-darwin",
|
||||||
|
"x86_64-pc-windows-msvc",
|
||||||
|
"aarch64-pc-windows-msvc",
|
||||||
|
"x86_64-unknown-linux-gnu",
|
||||||
|
"aarch64-unknown-linux-gnu",
|
||||||
|
"x86_64-unknown-linux-musl",
|
||||||
|
"aarch64-unknown-linux-musl",
|
||||||
|
"i686-unknown-linux-gnu",
|
||||||
|
"armv7-unknown-linux-gnueabihf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "napi build --platform --release --esm --output-dir . --js binding.js --dts binding.d.ts && node scripts/strip-binding-fallbacks.js",
|
||||||
|
"build:debug": "napi build --platform --esm --output-dir . --js binding.js --dts binding.d.ts && node scripts/strip-binding-fallbacks.js",
|
||||||
|
"universal": "napi universalize --output-dir .",
|
||||||
|
"test": "node --test test/*.test.js",
|
||||||
|
"bench": "node bench/bench.js",
|
||||||
|
"bench:electron": "node bench/electron.js",
|
||||||
|
"prepublishOnly": "node scripts/check-prebuilds.js"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"zip",
|
||||||
|
"unzip",
|
||||||
|
"extract",
|
||||||
|
"native",
|
||||||
|
"fast"
|
||||||
|
],
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22.12.0"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"provenance": true,
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"url": "https://github.com/electron/extract-zip"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@napi-rs/cli": "patch:@napi-rs/cli@npm%3A3.6.2#~/.yarn/patches/@napi-rs-cli-npm-3.6.2-b710c59d43.patch",
|
||||||
|
"extract-zip": "2.0.1",
|
||||||
|
"yazl": "3.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
208
electron/node_modules/@electron/asar/README.md
generated
vendored
Normal file
208
electron/node_modules/@electron/asar/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,208 @@
|
||||||
|
# @electron/asar - Electron Archive
|
||||||
|
|
||||||
|
[](https://github.com/electron/asar/actions/workflows/test.yml)
|
||||||
|
[](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 <dir> <output>
|
||||||
|
create asar archive
|
||||||
|
|
||||||
|
list|l <archive>
|
||||||
|
list files of asar archive
|
||||||
|
|
||||||
|
extract-file|ef <archive> <filename>
|
||||||
|
extract one file from archive
|
||||||
|
|
||||||
|
extract|e <archive> <dest>
|
||||||
|
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
|
||||||
82
electron/node_modules/@electron/asar/bin/asar.js
generated
vendored
Executable file
82
electron/node_modules/@electron/asar/bin/asar.js
generated
vendored
Executable file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var packageJSON = require('../package.json')
|
||||||
|
var splitVersion = function (version) { return version.split('.').map(function (part) { return Number(part) }) }
|
||||||
|
var requiredNodeVersion = splitVersion(packageJSON.engines.node.slice(2))
|
||||||
|
var actualNodeVersion = splitVersion(process.versions.node)
|
||||||
|
|
||||||
|
if (actualNodeVersion[0] < requiredNodeVersion[0] || (actualNodeVersion[0] === requiredNodeVersion[0] && actualNodeVersion[1] < requiredNodeVersion[1])) {
|
||||||
|
console.error('CANNOT RUN WITH NODE ' + process.versions.node)
|
||||||
|
console.error('asar requires Node ' + packageJSON.engines.node + '.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not consts so that this file can load in Node < 4.0
|
||||||
|
var asar = require('../lib/asar')
|
||||||
|
var program = require('commander')
|
||||||
|
|
||||||
|
program.version('v' + packageJSON.version)
|
||||||
|
.description('Manipulate asar archive files')
|
||||||
|
|
||||||
|
program.command('pack <dir> <output>')
|
||||||
|
.alias('p')
|
||||||
|
.description('create asar archive')
|
||||||
|
.option('--ordering <file path>', 'path to a text file for ordering contents')
|
||||||
|
.option('--unpack <expression>', 'do not pack files matching glob <expression>')
|
||||||
|
.option('--unpack-dir <expression>', 'do not pack dirs matching glob <expression> or starting with literal <expression>')
|
||||||
|
.option('--exclude-hidden', 'exclude hidden files')
|
||||||
|
.action(function (dir, output, options) {
|
||||||
|
options = {
|
||||||
|
unpack: options.unpack,
|
||||||
|
unpackDir: options.unpackDir,
|
||||||
|
ordering: options.ordering,
|
||||||
|
version: options.sv,
|
||||||
|
arch: options.sa,
|
||||||
|
builddir: options.sb,
|
||||||
|
dot: !options.excludeHidden
|
||||||
|
}
|
||||||
|
asar.createPackageWithOptions(dir, output, options).catch(error => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
program.command('list <archive>')
|
||||||
|
.alias('l')
|
||||||
|
.description('list files of asar archive')
|
||||||
|
.option('-i, --is-pack', 'each file in the asar is pack or unpack')
|
||||||
|
.action(function (archive, options) {
|
||||||
|
options = {
|
||||||
|
isPack: options.isPack
|
||||||
|
}
|
||||||
|
var files = asar.listPackage(archive, options)
|
||||||
|
for (var i in files) {
|
||||||
|
console.log(files[i])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
program.command('extract-file <archive> <filename>')
|
||||||
|
.alias('ef')
|
||||||
|
.description('extract one file from archive')
|
||||||
|
.action(function (archive, filename) {
|
||||||
|
require('fs').writeFileSync(require('path').basename(filename),
|
||||||
|
asar.extractFile(archive, filename))
|
||||||
|
})
|
||||||
|
|
||||||
|
program.command('extract <archive> <dest>')
|
||||||
|
.alias('e')
|
||||||
|
.description('extract archive')
|
||||||
|
.action(function (archive, dest) {
|
||||||
|
asar.extractAll(archive, dest)
|
||||||
|
})
|
||||||
|
|
||||||
|
program.command('*')
|
||||||
|
.action(function (_cmd, args) {
|
||||||
|
console.log('asar: \'%s\' is not an asar command. See \'asar --help\'.', args[0])
|
||||||
|
})
|
||||||
|
|
||||||
|
program.parse(process.argv)
|
||||||
|
|
||||||
|
if (program.args.length === 0) {
|
||||||
|
program.help()
|
||||||
|
}
|
||||||
96
electron/node_modules/@electron/asar/lib/asar.d.ts
generated
vendored
Normal file
96
electron/node_modules/@electron/asar/lib/asar.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
import { FilesystemDirectoryEntry, FilesystemEntry, FilesystemLinkEntry } from './filesystem';
|
||||||
|
import * as disk from './disk';
|
||||||
|
import { CrawledFileType } from './crawlfs';
|
||||||
|
import { IOptions } from './types/glob';
|
||||||
|
export declare function createPackage(src: string, dest: string): Promise<NodeJS.WritableStream>;
|
||||||
|
export type CreateOptions = {
|
||||||
|
dot?: boolean;
|
||||||
|
globOptions?: IOptions;
|
||||||
|
/**
|
||||||
|
* Path to a file containing the list of relative filepaths relative to `src` and the specific order they should be inserted into the asar.
|
||||||
|
* Formats allowed below:
|
||||||
|
* filepath
|
||||||
|
* : filepath
|
||||||
|
* <anything>:filepath
|
||||||
|
*/
|
||||||
|
ordering?: string;
|
||||||
|
pattern?: string;
|
||||||
|
transform?: (filePath: string) => NodeJS.ReadWriteStream | void;
|
||||||
|
unpack?: string;
|
||||||
|
unpackDir?: string;
|
||||||
|
};
|
||||||
|
export declare function createPackageWithOptions(src: string, dest: string, options: CreateOptions): Promise<NodeJS.WritableStream>;
|
||||||
|
/**
|
||||||
|
* Create an ASAR archive from a list of filenames.
|
||||||
|
*
|
||||||
|
* @param src - Base path. All files are relative to this.
|
||||||
|
* @param dest - Archive filename (& path).
|
||||||
|
* @param filenames - List of filenames relative to src.
|
||||||
|
* @param [metadata] - Object with filenames as keys and {type='directory|file|link', stat: fs.stat} as values. (Optional)
|
||||||
|
* @param [options] - Options passed to `createPackageWithOptions`.
|
||||||
|
*/
|
||||||
|
export declare function createPackageFromFiles(src: string, dest: string, filenames: string[], metadata?: disk.InputMetadata, options?: CreateOptions): Promise<NodeJS.WritableStream>;
|
||||||
|
export type AsarStream = {
|
||||||
|
/**
|
||||||
|
Relative path to the file or directory from within the archive
|
||||||
|
*/
|
||||||
|
path: string;
|
||||||
|
/**
|
||||||
|
Function that returns a read stream for a file.
|
||||||
|
Note: this is called multiple times per "file", so a new NodeJS.ReadableStream needs to be created each time
|
||||||
|
*/
|
||||||
|
streamGenerator: () => NodeJS.ReadableStream;
|
||||||
|
/**
|
||||||
|
Whether the file/link should be unpacked
|
||||||
|
*/
|
||||||
|
unpacked: boolean;
|
||||||
|
stat: CrawledFileType['stat'];
|
||||||
|
};
|
||||||
|
export type AsarDirectory = Pick<AsarStream, 'path' | 'unpacked'> & {
|
||||||
|
type: 'directory';
|
||||||
|
};
|
||||||
|
export type AsarSymlinkStream = AsarStream & {
|
||||||
|
type: 'link';
|
||||||
|
symlink: string;
|
||||||
|
};
|
||||||
|
export type AsarFileStream = AsarStream & {
|
||||||
|
type: 'file';
|
||||||
|
};
|
||||||
|
export type AsarStreamType = AsarDirectory | AsarFileStream | AsarSymlinkStream;
|
||||||
|
/**
|
||||||
|
* Create an ASAR archive from a list of streams.
|
||||||
|
*
|
||||||
|
* @param dest - Archive filename (& path).
|
||||||
|
* @param streams - List of streams to be piped in-memory into asar filesystem. Insertion order is preserved.
|
||||||
|
*/
|
||||||
|
export declare function createPackageFromStreams(dest: string, streams: AsarStreamType[]): Promise<import("fs").WriteStream>;
|
||||||
|
export declare function statFile(archivePath: string, filename: string, followLinks?: boolean): FilesystemEntry;
|
||||||
|
export declare function getRawHeader(archivePath: string): disk.ArchiveHeader;
|
||||||
|
export interface ListOptions {
|
||||||
|
isPack: boolean;
|
||||||
|
}
|
||||||
|
export declare function listPackage(archivePath: string, options: ListOptions): string[];
|
||||||
|
export declare function extractFile(archivePath: string, filename: string, followLinks?: boolean): Buffer;
|
||||||
|
export declare function extractAll(archivePath: string, dest: string): void;
|
||||||
|
export declare function uncache(archivePath: string): boolean;
|
||||||
|
export declare function uncacheAll(): void;
|
||||||
|
export { EntryMetadata } from './filesystem';
|
||||||
|
export { InputMetadata, DirectoryRecord, FileRecord, ArchiveHeader } from './disk';
|
||||||
|
export type InputMetadataType = 'directory' | 'file' | 'link';
|
||||||
|
export type DirectoryMetadata = FilesystemDirectoryEntry;
|
||||||
|
export type FileMetadata = FilesystemEntry;
|
||||||
|
export type LinkMetadata = FilesystemLinkEntry;
|
||||||
|
declare const _default: {
|
||||||
|
createPackage: typeof createPackage;
|
||||||
|
createPackageWithOptions: typeof createPackageWithOptions;
|
||||||
|
createPackageFromFiles: typeof createPackageFromFiles;
|
||||||
|
createPackageFromStreams: typeof createPackageFromStreams;
|
||||||
|
statFile: typeof statFile;
|
||||||
|
getRawHeader: typeof getRawHeader;
|
||||||
|
listPackage: typeof listPackage;
|
||||||
|
extractFile: typeof extractFile;
|
||||||
|
extractAll: typeof extractAll;
|
||||||
|
uncache: typeof uncache;
|
||||||
|
uncacheAll: typeof uncacheAll;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
337
electron/node_modules/@electron/asar/lib/asar.js
generated
vendored
Normal file
337
electron/node_modules/@electron/asar/lib/asar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,337 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.createPackage = createPackage;
|
||||||
|
exports.createPackageWithOptions = createPackageWithOptions;
|
||||||
|
exports.createPackageFromFiles = createPackageFromFiles;
|
||||||
|
exports.createPackageFromStreams = createPackageFromStreams;
|
||||||
|
exports.statFile = statFile;
|
||||||
|
exports.getRawHeader = getRawHeader;
|
||||||
|
exports.listPackage = listPackage;
|
||||||
|
exports.extractFile = extractFile;
|
||||||
|
exports.extractAll = extractAll;
|
||||||
|
exports.uncache = uncache;
|
||||||
|
exports.uncacheAll = uncacheAll;
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const minimatch_1 = __importDefault(require("minimatch"));
|
||||||
|
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
|
||||||
|
const filesystem_1 = require("./filesystem");
|
||||||
|
const disk = __importStar(require("./disk"));
|
||||||
|
const crawlfs_1 = require("./crawlfs");
|
||||||
|
/**
|
||||||
|
* Whether a directory should be excluded from packing due to the `--unpack-dir" option.
|
||||||
|
*
|
||||||
|
* @param dirPath - directory path to check
|
||||||
|
* @param pattern - literal prefix [for backward compatibility] or glob pattern
|
||||||
|
* @param unpackDirs - Array of directory paths previously marked as unpacked
|
||||||
|
*/
|
||||||
|
function isUnpackedDir(dirPath, pattern, unpackDirs) {
|
||||||
|
if (dirPath.startsWith(pattern) || (0, minimatch_1.default)(dirPath, pattern)) {
|
||||||
|
if (!unpackDirs.includes(dirPath)) {
|
||||||
|
unpackDirs.push(dirPath);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return unpackDirs.some((unpackDir) => dirPath.startsWith(unpackDir) && !path.relative(unpackDir, dirPath).startsWith('..'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function createPackage(src, dest) {
|
||||||
|
return createPackageWithOptions(src, dest, {});
|
||||||
|
}
|
||||||
|
async function createPackageWithOptions(src, dest, options) {
|
||||||
|
const globOptions = options.globOptions ? options.globOptions : {};
|
||||||
|
globOptions.dot = options.dot === undefined ? true : options.dot;
|
||||||
|
const pattern = src + (options.pattern ? options.pattern : '/**/*');
|
||||||
|
const [filenames, metadata] = await (0, crawlfs_1.crawl)(pattern, globOptions);
|
||||||
|
return createPackageFromFiles(src, dest, filenames, metadata, options);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create an ASAR archive from a list of filenames.
|
||||||
|
*
|
||||||
|
* @param src - Base path. All files are relative to this.
|
||||||
|
* @param dest - Archive filename (& path).
|
||||||
|
* @param filenames - List of filenames relative to src.
|
||||||
|
* @param [metadata] - Object with filenames as keys and {type='directory|file|link', stat: fs.stat} as values. (Optional)
|
||||||
|
* @param [options] - Options passed to `createPackageWithOptions`.
|
||||||
|
*/
|
||||||
|
async function createPackageFromFiles(src, dest, filenames, metadata = {}, options = {}) {
|
||||||
|
src = path.normalize(src);
|
||||||
|
dest = path.normalize(dest);
|
||||||
|
filenames = filenames.map(function (filename) {
|
||||||
|
return path.normalize(filename);
|
||||||
|
});
|
||||||
|
const filesystem = new filesystem_1.Filesystem(src);
|
||||||
|
const files = [];
|
||||||
|
const links = [];
|
||||||
|
const unpackDirs = [];
|
||||||
|
let filenamesSorted = [];
|
||||||
|
if (options.ordering) {
|
||||||
|
const orderingFiles = (await wrapped_fs_1.default.readFile(options.ordering))
|
||||||
|
.toString()
|
||||||
|
.split('\n')
|
||||||
|
.map((line) => {
|
||||||
|
if (line.includes(':')) {
|
||||||
|
line = line.split(':').pop();
|
||||||
|
}
|
||||||
|
line = line.trim();
|
||||||
|
if (line.startsWith('/')) {
|
||||||
|
line = line.slice(1);
|
||||||
|
}
|
||||||
|
return line;
|
||||||
|
});
|
||||||
|
const ordering = [];
|
||||||
|
for (const file of orderingFiles) {
|
||||||
|
const pathComponents = file.split(path.sep);
|
||||||
|
let str = src;
|
||||||
|
for (const pathComponent of pathComponents) {
|
||||||
|
str = path.join(str, pathComponent);
|
||||||
|
ordering.push(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let missing = 0;
|
||||||
|
const total = filenames.length;
|
||||||
|
for (const file of ordering) {
|
||||||
|
if (!filenamesSorted.includes(file) && filenames.includes(file)) {
|
||||||
|
filenamesSorted.push(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const file of filenames) {
|
||||||
|
if (!filenamesSorted.includes(file)) {
|
||||||
|
filenamesSorted.push(file);
|
||||||
|
missing += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`Ordering file has ${((total - missing) / total) * 100}% coverage.`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
filenamesSorted = filenames;
|
||||||
|
}
|
||||||
|
const handleFile = async function (filename) {
|
||||||
|
if (!metadata[filename]) {
|
||||||
|
const fileType = await (0, crawlfs_1.determineFileType)(filename);
|
||||||
|
if (!fileType) {
|
||||||
|
throw new Error('Unknown file type for file: ' + filename);
|
||||||
|
}
|
||||||
|
metadata[filename] = fileType;
|
||||||
|
}
|
||||||
|
const file = metadata[filename];
|
||||||
|
const shouldUnpackPath = function (relativePath, unpack, unpackDir) {
|
||||||
|
let shouldUnpack = false;
|
||||||
|
if (unpack) {
|
||||||
|
shouldUnpack = (0, minimatch_1.default)(filename, unpack, { matchBase: true });
|
||||||
|
}
|
||||||
|
if (!shouldUnpack && unpackDir) {
|
||||||
|
shouldUnpack = isUnpackedDir(relativePath, unpackDir, unpackDirs);
|
||||||
|
}
|
||||||
|
return shouldUnpack;
|
||||||
|
};
|
||||||
|
let shouldUnpack;
|
||||||
|
switch (file.type) {
|
||||||
|
case 'directory':
|
||||||
|
shouldUnpack = shouldUnpackPath(path.relative(src, filename), undefined, options.unpackDir);
|
||||||
|
filesystem.insertDirectory(filename, shouldUnpack);
|
||||||
|
break;
|
||||||
|
case 'file':
|
||||||
|
shouldUnpack = shouldUnpackPath(path.relative(src, path.dirname(filename)), options.unpack, options.unpackDir);
|
||||||
|
files.push({ filename, unpack: shouldUnpack });
|
||||||
|
return filesystem.insertFile(filename, () => wrapped_fs_1.default.createReadStream(filename), shouldUnpack, file, options);
|
||||||
|
case 'link':
|
||||||
|
shouldUnpack = shouldUnpackPath(path.relative(src, filename), options.unpack, options.unpackDir);
|
||||||
|
links.push({ filename, unpack: shouldUnpack });
|
||||||
|
filesystem.insertLink(filename, shouldUnpack);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
const insertsDone = async function () {
|
||||||
|
await wrapped_fs_1.default.mkdirp(path.dirname(dest));
|
||||||
|
return disk.writeFilesystem(dest, filesystem, { files, links }, metadata);
|
||||||
|
};
|
||||||
|
const names = filenamesSorted.slice();
|
||||||
|
const next = async function (name) {
|
||||||
|
if (!name) {
|
||||||
|
return insertsDone();
|
||||||
|
}
|
||||||
|
await handleFile(name);
|
||||||
|
return next(names.shift());
|
||||||
|
};
|
||||||
|
return next(names.shift());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create an ASAR archive from a list of streams.
|
||||||
|
*
|
||||||
|
* @param dest - Archive filename (& path).
|
||||||
|
* @param streams - List of streams to be piped in-memory into asar filesystem. Insertion order is preserved.
|
||||||
|
*/
|
||||||
|
async function createPackageFromStreams(dest, streams) {
|
||||||
|
// We use an ambiguous root `src` since we're piping directly from a stream and the `filePath` for the stream is already relative to the src/root
|
||||||
|
const src = '.';
|
||||||
|
const filesystem = new filesystem_1.Filesystem(src);
|
||||||
|
const files = [];
|
||||||
|
const links = [];
|
||||||
|
const handleFile = async function (stream) {
|
||||||
|
const { path: destinationPath, type } = stream;
|
||||||
|
const filename = path.normalize(destinationPath);
|
||||||
|
switch (type) {
|
||||||
|
case 'directory':
|
||||||
|
filesystem.insertDirectory(filename, stream.unpacked);
|
||||||
|
break;
|
||||||
|
case 'file':
|
||||||
|
files.push({
|
||||||
|
filename,
|
||||||
|
streamGenerator: stream.streamGenerator,
|
||||||
|
link: undefined,
|
||||||
|
mode: stream.stat.mode,
|
||||||
|
unpack: stream.unpacked,
|
||||||
|
});
|
||||||
|
return filesystem.insertFile(filename, stream.streamGenerator, stream.unpacked, {
|
||||||
|
type: 'file',
|
||||||
|
stat: stream.stat,
|
||||||
|
});
|
||||||
|
case 'link':
|
||||||
|
links.push({
|
||||||
|
filename,
|
||||||
|
streamGenerator: stream.streamGenerator,
|
||||||
|
link: stream.symlink,
|
||||||
|
mode: stream.stat.mode,
|
||||||
|
unpack: stream.unpacked,
|
||||||
|
});
|
||||||
|
filesystem.insertLink(filename, stream.unpacked, path.dirname(filename), stream.symlink, src);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
const insertsDone = async function () {
|
||||||
|
await wrapped_fs_1.default.mkdirp(path.dirname(dest));
|
||||||
|
return disk.streamFilesystem(dest, filesystem, { files, links });
|
||||||
|
};
|
||||||
|
const streamQueue = streams.slice();
|
||||||
|
const next = async function (stream) {
|
||||||
|
if (!stream) {
|
||||||
|
return insertsDone();
|
||||||
|
}
|
||||||
|
await handleFile(stream);
|
||||||
|
return next(streamQueue.shift());
|
||||||
|
};
|
||||||
|
return next(streamQueue.shift());
|
||||||
|
}
|
||||||
|
function statFile(archivePath, filename, followLinks = true) {
|
||||||
|
const filesystem = disk.readFilesystemSync(archivePath);
|
||||||
|
return filesystem.getFile(filename, followLinks);
|
||||||
|
}
|
||||||
|
function getRawHeader(archivePath) {
|
||||||
|
return disk.readArchiveHeaderSync(archivePath);
|
||||||
|
}
|
||||||
|
function listPackage(archivePath, options) {
|
||||||
|
return disk.readFilesystemSync(archivePath).listFiles(options);
|
||||||
|
}
|
||||||
|
function extractFile(archivePath, filename, followLinks = true) {
|
||||||
|
const filesystem = disk.readFilesystemSync(archivePath);
|
||||||
|
const fileInfo = filesystem.getFile(filename, followLinks);
|
||||||
|
if ('link' in fileInfo || 'files' in fileInfo) {
|
||||||
|
throw new Error('Expected to find file at: ' + filename + ' but found a directory or link');
|
||||||
|
}
|
||||||
|
return disk.readFileSync(filesystem, filename, fileInfo);
|
||||||
|
}
|
||||||
|
function extractAll(archivePath, dest) {
|
||||||
|
const filesystem = disk.readFilesystemSync(archivePath);
|
||||||
|
const filenames = filesystem.listFiles();
|
||||||
|
// under windows just extract links as regular files
|
||||||
|
const followLinks = process.platform === 'win32';
|
||||||
|
// create destination directory
|
||||||
|
wrapped_fs_1.default.mkdirpSync(dest);
|
||||||
|
const extractionErrors = [];
|
||||||
|
for (const fullPath of filenames) {
|
||||||
|
// Remove leading slash
|
||||||
|
const filename = fullPath.substr(1);
|
||||||
|
const destFilename = path.join(dest, filename);
|
||||||
|
const file = filesystem.getFile(filename, followLinks);
|
||||||
|
if (path.relative(dest, destFilename).startsWith('..')) {
|
||||||
|
throw new Error(`${fullPath}: file "${destFilename}" writes out of the package`);
|
||||||
|
}
|
||||||
|
if ('files' in file) {
|
||||||
|
// it's a directory, create it and continue with the next entry
|
||||||
|
wrapped_fs_1.default.mkdirpSync(destFilename);
|
||||||
|
}
|
||||||
|
else if ('link' in file) {
|
||||||
|
// it's a symlink, create a symlink
|
||||||
|
const linkSrcPath = path.dirname(path.join(dest, file.link));
|
||||||
|
const linkDestPath = path.dirname(destFilename);
|
||||||
|
const relativePath = path.relative(linkDestPath, linkSrcPath);
|
||||||
|
// try to delete output file, because we can't overwrite a link
|
||||||
|
try {
|
||||||
|
wrapped_fs_1.default.unlinkSync(destFilename);
|
||||||
|
}
|
||||||
|
catch (_a) { }
|
||||||
|
const linkTo = path.join(relativePath, path.basename(file.link));
|
||||||
|
if (path.relative(dest, linkSrcPath).startsWith('..')) {
|
||||||
|
throw new Error(`${fullPath}: file "${file.link}" links out of the package to "${linkSrcPath}"`);
|
||||||
|
}
|
||||||
|
wrapped_fs_1.default.symlinkSync(linkTo, destFilename);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// it's a file, try to extract it
|
||||||
|
try {
|
||||||
|
const content = disk.readFileSync(filesystem, filename, file);
|
||||||
|
wrapped_fs_1.default.writeFileSync(destFilename, content);
|
||||||
|
if (file.executable) {
|
||||||
|
wrapped_fs_1.default.chmodSync(destFilename, '755');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
extractionErrors.push(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (extractionErrors.length) {
|
||||||
|
throw new Error('Unable to extract some files:\n\n' +
|
||||||
|
extractionErrors.map((error) => error.stack).join('\n\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function uncache(archivePath) {
|
||||||
|
return disk.uncacheFilesystem(archivePath);
|
||||||
|
}
|
||||||
|
function uncacheAll() {
|
||||||
|
disk.uncacheAll();
|
||||||
|
}
|
||||||
|
// Export everything in default, too
|
||||||
|
exports.default = {
|
||||||
|
createPackage,
|
||||||
|
createPackageWithOptions,
|
||||||
|
createPackageFromFiles,
|
||||||
|
createPackageFromStreams,
|
||||||
|
statFile,
|
||||||
|
getRawHeader,
|
||||||
|
listPackage,
|
||||||
|
extractFile,
|
||||||
|
extractAll,
|
||||||
|
uncache,
|
||||||
|
uncacheAll,
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=asar.js.map
|
||||||
1
electron/node_modules/@electron/asar/lib/asar.js.map
generated
vendored
Normal file
1
electron/node_modules/@electron/asar/lib/asar.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
electron/node_modules/@electron/asar/lib/crawlfs.d.ts
generated
vendored
Normal file
12
electron/node_modules/@electron/asar/lib/crawlfs.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Stats } from 'fs';
|
||||||
|
import { IOptions } from './types/glob';
|
||||||
|
export type CrawledFileType = {
|
||||||
|
type: 'file' | 'directory' | 'link';
|
||||||
|
stat: Pick<Stats, 'mode' | 'size'>;
|
||||||
|
transformed?: {
|
||||||
|
path: string;
|
||||||
|
stat: Stats;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export declare function determineFileType(filename: string): Promise<CrawledFileType | null>;
|
||||||
|
export declare function crawl(dir: string, options: IOptions): Promise<readonly [string[], Record<string, CrawledFileType>]>;
|
||||||
79
electron/node_modules/@electron/asar/lib/crawlfs.js
generated
vendored
Normal file
79
electron/node_modules/@electron/asar/lib/crawlfs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.determineFileType = determineFileType;
|
||||||
|
exports.crawl = crawl;
|
||||||
|
const util_1 = require("util");
|
||||||
|
const glob_1 = require("glob");
|
||||||
|
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const glob = (0, util_1.promisify)(glob_1.glob);
|
||||||
|
async function determineFileType(filename) {
|
||||||
|
const stat = await wrapped_fs_1.default.lstat(filename);
|
||||||
|
if (stat.isFile()) {
|
||||||
|
return { type: 'file', stat };
|
||||||
|
}
|
||||||
|
else if (stat.isDirectory()) {
|
||||||
|
return { type: 'directory', stat };
|
||||||
|
}
|
||||||
|
else if (stat.isSymbolicLink()) {
|
||||||
|
return { type: 'link', stat };
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
async function crawl(dir, options) {
|
||||||
|
const metadata = {};
|
||||||
|
const crawled = await glob(dir, options);
|
||||||
|
const results = await Promise.all(crawled.map(async (filename) => [filename, await determineFileType(filename)]));
|
||||||
|
const links = [];
|
||||||
|
const filenames = results
|
||||||
|
.map(([filename, type]) => {
|
||||||
|
if (type) {
|
||||||
|
metadata[filename] = type;
|
||||||
|
if (type.type === 'link')
|
||||||
|
links.push(filename);
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
|
})
|
||||||
|
.filter((filename) => {
|
||||||
|
// Newer glob can return files inside symlinked directories, to avoid
|
||||||
|
// those appearing in archives we need to manually exclude theme here
|
||||||
|
const exactLinkIndex = links.findIndex((link) => filename === link);
|
||||||
|
return links.every((link, index) => {
|
||||||
|
if (index === exactLinkIndex) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const isFileWithinSymlinkDir = filename.startsWith(link);
|
||||||
|
// symlink may point outside the directory: https://github.com/electron/asar/issues/303
|
||||||
|
const relativePath = path.relative(link, path.dirname(filename));
|
||||||
|
return !isFileWithinSymlinkDir || relativePath.startsWith('..');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return [filenames, metadata];
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=crawlfs.js.map
|
||||||
1
electron/node_modules/@electron/asar/lib/crawlfs.js.map
generated
vendored
Normal file
1
electron/node_modules/@electron/asar/lib/crawlfs.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"crawlfs.js","sourceRoot":"","sources":["../src/crawlfs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,8CAUC;AAED,sBA8BC;AA7DD,+BAAiC;AACjC,+BAAqC;AAErC,8DAA8B;AAE9B,2CAA6B;AAG7B,MAAM,IAAI,GAAG,IAAA,gBAAS,EAAC,WAAK,CAAC,CAAC;AAWvB,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,IAAI,GAAG,MAAM,oBAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;SAAM,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACrC,CAAC;SAAM,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAEM,KAAK,UAAU,KAAK,CAAC,GAAW,EAAE,OAAiB;IACxD,MAAM,QAAQ,GAAoC,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAU,CAAC,CACxF,CAAC;IACF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,OAAO;SACtB,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;QACxB,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;YAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;QACnB,qEAAqE;QACrE,qEAAqE;QACrE,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;QACpE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACjC,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,sBAAsB,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACzD,uFAAuF;YACvF,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjE,OAAO,CAAC,sBAAsB,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACL,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC;AACxC,CAAC"}
|
||||||
44
electron/node_modules/@electron/asar/lib/disk.d.ts
generated
vendored
Normal file
44
electron/node_modules/@electron/asar/lib/disk.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { Filesystem, FilesystemFileEntry } from './filesystem';
|
||||||
|
import { CrawledFileType } from './crawlfs';
|
||||||
|
import { Stats } from 'fs';
|
||||||
|
export type InputMetadata = {
|
||||||
|
[property: string]: CrawledFileType;
|
||||||
|
};
|
||||||
|
export type BasicFilesArray = {
|
||||||
|
filename: string;
|
||||||
|
unpack: boolean;
|
||||||
|
}[];
|
||||||
|
export type BasicStreamArray = {
|
||||||
|
filename: string;
|
||||||
|
streamGenerator: () => NodeJS.ReadableStream;
|
||||||
|
mode: Stats['mode'];
|
||||||
|
unpack: boolean;
|
||||||
|
link: string | undefined;
|
||||||
|
}[];
|
||||||
|
export type FilesystemFilesAndLinks<T extends BasicFilesArray | BasicStreamArray> = {
|
||||||
|
files: T;
|
||||||
|
links: T;
|
||||||
|
};
|
||||||
|
export declare function writeFilesystem(dest: string, filesystem: Filesystem, lists: FilesystemFilesAndLinks<BasicFilesArray>, metadata: InputMetadata): Promise<NodeJS.WritableStream>;
|
||||||
|
export declare function streamFilesystem(dest: string, filesystem: Filesystem, lists: FilesystemFilesAndLinks<BasicStreamArray>): Promise<import("fs").WriteStream>;
|
||||||
|
export interface FileRecord extends FilesystemFileEntry {
|
||||||
|
integrity: {
|
||||||
|
hash: string;
|
||||||
|
algorithm: 'SHA256';
|
||||||
|
blocks: string[];
|
||||||
|
blockSize: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export type DirectoryRecord = {
|
||||||
|
files: Record<string, DirectoryRecord | FileRecord>;
|
||||||
|
};
|
||||||
|
export type ArchiveHeader = {
|
||||||
|
header: DirectoryRecord;
|
||||||
|
headerString: string;
|
||||||
|
headerSize: number;
|
||||||
|
};
|
||||||
|
export declare function readArchiveHeaderSync(archivePath: string): ArchiveHeader;
|
||||||
|
export declare function readFilesystemSync(archivePath: string): Filesystem;
|
||||||
|
export declare function uncacheFilesystem(archivePath: string): boolean;
|
||||||
|
export declare function uncacheAll(): void;
|
||||||
|
export declare function readFileSync(filesystem: Filesystem, filename: string, info: FilesystemFileEntry): Buffer;
|
||||||
219
electron/node_modules/@electron/asar/lib/disk.js
generated
vendored
Normal file
219
electron/node_modules/@electron/asar/lib/disk.js
generated
vendored
Normal file
|
|
@ -0,0 +1,219 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
||||||
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||||
|
var m = o[Symbol.asyncIterator], i;
|
||||||
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||||
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||||
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.writeFilesystem = writeFilesystem;
|
||||||
|
exports.streamFilesystem = streamFilesystem;
|
||||||
|
exports.readArchiveHeaderSync = readArchiveHeaderSync;
|
||||||
|
exports.readFilesystemSync = readFilesystemSync;
|
||||||
|
exports.uncacheFilesystem = uncacheFilesystem;
|
||||||
|
exports.uncacheAll = uncacheAll;
|
||||||
|
exports.readFileSync = readFileSync;
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
|
||||||
|
const pickle_1 = require("./pickle");
|
||||||
|
const filesystem_1 = require("./filesystem");
|
||||||
|
const util_1 = require("util");
|
||||||
|
const stream = __importStar(require("stream"));
|
||||||
|
const pipeline = (0, util_1.promisify)(stream.pipeline);
|
||||||
|
let filesystemCache = Object.create(null);
|
||||||
|
async function copyFile(dest, src, filename) {
|
||||||
|
const srcFile = path.join(src, filename);
|
||||||
|
const targetFile = path.join(dest, filename);
|
||||||
|
const [content, stats] = await Promise.all([
|
||||||
|
wrapped_fs_1.default.readFile(srcFile),
|
||||||
|
wrapped_fs_1.default.stat(srcFile),
|
||||||
|
wrapped_fs_1.default.mkdirp(path.dirname(targetFile)),
|
||||||
|
]);
|
||||||
|
return wrapped_fs_1.default.writeFile(targetFile, content, { mode: stats.mode });
|
||||||
|
}
|
||||||
|
async function streamTransformedFile(stream, outStream) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
stream.pipe(outStream, { end: false });
|
||||||
|
stream.on('error', reject);
|
||||||
|
stream.on('end', () => resolve());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const writeFileListToStream = async function (dest, filesystem, out, lists, metadata) {
|
||||||
|
const { files, links } = lists;
|
||||||
|
for (const file of files) {
|
||||||
|
if (file.unpack) {
|
||||||
|
// the file should not be packed into archive
|
||||||
|
const filename = path.relative(filesystem.getRootPath(), file.filename);
|
||||||
|
await copyFile(`${dest}.unpacked`, filesystem.getRootPath(), filename);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const transformed = metadata[file.filename].transformed;
|
||||||
|
const stream = wrapped_fs_1.default.createReadStream(transformed ? transformed.path : file.filename);
|
||||||
|
await streamTransformedFile(stream, out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const file of links.filter((f) => f.unpack)) {
|
||||||
|
// the symlink needs to be recreated outside in .unpacked
|
||||||
|
const filename = path.relative(filesystem.getRootPath(), file.filename);
|
||||||
|
const link = await wrapped_fs_1.default.readlink(file.filename);
|
||||||
|
await createSymlink(dest, filename, link);
|
||||||
|
}
|
||||||
|
return out.end();
|
||||||
|
};
|
||||||
|
async function writeFilesystem(dest, filesystem, lists, metadata) {
|
||||||
|
const out = await createFilesystemWriteStream(filesystem, dest);
|
||||||
|
return writeFileListToStream(dest, filesystem, out, lists, metadata);
|
||||||
|
}
|
||||||
|
async function streamFilesystem(dest, filesystem, lists) {
|
||||||
|
var _a, e_1, _b, _c;
|
||||||
|
const out = await createFilesystemWriteStream(filesystem, dest);
|
||||||
|
const { files, links } = lists;
|
||||||
|
try {
|
||||||
|
for (var _d = true, files_1 = __asyncValues(files), files_1_1; files_1_1 = await files_1.next(), _a = files_1_1.done, !_a; _d = true) {
|
||||||
|
_c = files_1_1.value;
|
||||||
|
_d = false;
|
||||||
|
const file = _c;
|
||||||
|
// the file should not be packed into archive
|
||||||
|
if (file.unpack) {
|
||||||
|
const targetFile = path.join(`${dest}.unpacked`, file.filename);
|
||||||
|
await wrapped_fs_1.default.mkdirp(path.dirname(targetFile));
|
||||||
|
const writeStream = wrapped_fs_1.default.createWriteStream(targetFile, { mode: file.mode });
|
||||||
|
await pipeline(file.streamGenerator(), writeStream);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await streamTransformedFile(file.streamGenerator(), out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (!_d && !_a && (_b = files_1.return)) await _b.call(files_1);
|
||||||
|
}
|
||||||
|
finally { if (e_1) throw e_1.error; }
|
||||||
|
}
|
||||||
|
for (const file of links.filter((f) => f.unpack && f.link)) {
|
||||||
|
// the symlink needs to be recreated outside in .unpacked
|
||||||
|
await createSymlink(dest, file.filename, file.link);
|
||||||
|
}
|
||||||
|
return out.end();
|
||||||
|
}
|
||||||
|
function readArchiveHeaderSync(archivePath) {
|
||||||
|
const fd = wrapped_fs_1.default.openSync(archivePath, 'r');
|
||||||
|
let size;
|
||||||
|
let headerBuf;
|
||||||
|
try {
|
||||||
|
const sizeBuf = Buffer.alloc(8);
|
||||||
|
if (wrapped_fs_1.default.readSync(fd, sizeBuf, 0, 8, null) !== 8) {
|
||||||
|
throw new Error('Unable to read header size');
|
||||||
|
}
|
||||||
|
const sizePickle = pickle_1.Pickle.createFromBuffer(sizeBuf);
|
||||||
|
size = sizePickle.createIterator().readUInt32();
|
||||||
|
headerBuf = Buffer.alloc(size);
|
||||||
|
if (wrapped_fs_1.default.readSync(fd, headerBuf, 0, size, null) !== size) {
|
||||||
|
throw new Error('Unable to read header');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
wrapped_fs_1.default.closeSync(fd);
|
||||||
|
}
|
||||||
|
const headerPickle = pickle_1.Pickle.createFromBuffer(headerBuf);
|
||||||
|
const header = headerPickle.createIterator().readString();
|
||||||
|
return { headerString: header, header: JSON.parse(header), headerSize: size };
|
||||||
|
}
|
||||||
|
function readFilesystemSync(archivePath) {
|
||||||
|
if (!filesystemCache[archivePath]) {
|
||||||
|
const header = readArchiveHeaderSync(archivePath);
|
||||||
|
const filesystem = new filesystem_1.Filesystem(archivePath);
|
||||||
|
filesystem.setHeader(header.header, header.headerSize);
|
||||||
|
filesystemCache[archivePath] = filesystem;
|
||||||
|
}
|
||||||
|
return filesystemCache[archivePath];
|
||||||
|
}
|
||||||
|
function uncacheFilesystem(archivePath) {
|
||||||
|
if (filesystemCache[archivePath]) {
|
||||||
|
filesystemCache[archivePath] = undefined;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function uncacheAll() {
|
||||||
|
filesystemCache = {};
|
||||||
|
}
|
||||||
|
function readFileSync(filesystem, filename, info) {
|
||||||
|
let buffer = Buffer.alloc(info.size);
|
||||||
|
if (info.size <= 0) {
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
if (info.unpacked) {
|
||||||
|
// it's an unpacked file, copy it.
|
||||||
|
buffer = wrapped_fs_1.default.readFileSync(path.join(`${filesystem.getRootPath()}.unpacked`, filename));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Node throws an exception when reading 0 bytes into a 0-size buffer,
|
||||||
|
// so we short-circuit the read in this case.
|
||||||
|
const fd = wrapped_fs_1.default.openSync(filesystem.getRootPath(), 'r');
|
||||||
|
try {
|
||||||
|
const offset = 8 + filesystem.getHeaderSize() + parseInt(info.offset);
|
||||||
|
wrapped_fs_1.default.readSync(fd, buffer, 0, info.size, offset);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
wrapped_fs_1.default.closeSync(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
async function createFilesystemWriteStream(filesystem, dest) {
|
||||||
|
const headerPickle = pickle_1.Pickle.createEmpty();
|
||||||
|
headerPickle.writeString(JSON.stringify(filesystem.getHeader()));
|
||||||
|
const headerBuf = headerPickle.toBuffer();
|
||||||
|
const sizePickle = pickle_1.Pickle.createEmpty();
|
||||||
|
sizePickle.writeUInt32(headerBuf.length);
|
||||||
|
const sizeBuf = sizePickle.toBuffer();
|
||||||
|
const out = wrapped_fs_1.default.createWriteStream(dest);
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
out.on('error', reject);
|
||||||
|
out.write(sizeBuf);
|
||||||
|
return out.write(headerBuf, () => resolve());
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
async function createSymlink(dest, filepath, link) {
|
||||||
|
// if symlink is within subdirectories, then we need to recreate dir structure
|
||||||
|
await wrapped_fs_1.default.mkdirp(path.join(`${dest}.unpacked`, path.dirname(filepath)));
|
||||||
|
// create symlink within unpacked dir
|
||||||
|
await wrapped_fs_1.default.symlink(link, path.join(`${dest}.unpacked`, filepath)).catch(async (error) => {
|
||||||
|
if (error.code === 'EPERM' && error.syscall === 'symlink') {
|
||||||
|
throw new Error('Could not create symlinks for unpacked assets. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.');
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=disk.js.map
|
||||||
1
electron/node_modules/@electron/asar/lib/disk.js.map
generated
vendored
Normal file
1
electron/node_modules/@electron/asar/lib/disk.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
electron/node_modules/@electron/asar/lib/filesystem.d.ts
generated
vendored
Normal file
44
electron/node_modules/@electron/asar/lib/filesystem.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { FileIntegrity } from './integrity';
|
||||||
|
import { CrawledFileType } from './crawlfs';
|
||||||
|
export type EntryMetadata = {
|
||||||
|
unpacked?: boolean;
|
||||||
|
};
|
||||||
|
export type FilesystemDirectoryEntry = {
|
||||||
|
files: Record<string, FilesystemEntry>;
|
||||||
|
} & EntryMetadata;
|
||||||
|
export type FilesystemFileEntry = {
|
||||||
|
unpacked: boolean;
|
||||||
|
executable: boolean;
|
||||||
|
offset: string;
|
||||||
|
size: number;
|
||||||
|
integrity: FileIntegrity;
|
||||||
|
} & EntryMetadata;
|
||||||
|
export type FilesystemLinkEntry = {
|
||||||
|
link: string;
|
||||||
|
} & EntryMetadata;
|
||||||
|
export type FilesystemEntry = FilesystemDirectoryEntry | FilesystemFileEntry | FilesystemLinkEntry;
|
||||||
|
export declare class Filesystem {
|
||||||
|
private src;
|
||||||
|
private header;
|
||||||
|
private headerSize;
|
||||||
|
private offset;
|
||||||
|
constructor(src: string);
|
||||||
|
getRootPath(): string;
|
||||||
|
getHeader(): FilesystemEntry;
|
||||||
|
getHeaderSize(): number;
|
||||||
|
setHeader(header: FilesystemEntry, headerSize: number): void;
|
||||||
|
searchNodeFromDirectory(p: string): FilesystemEntry;
|
||||||
|
searchNodeFromPath(p: string): FilesystemEntry;
|
||||||
|
insertDirectory(p: string, shouldUnpack: boolean): Record<string, FilesystemEntry>;
|
||||||
|
insertFile(p: string, streamGenerator: () => NodeJS.ReadableStream, shouldUnpack: boolean, file: CrawledFileType, options?: {
|
||||||
|
transform?: (filePath: string) => NodeJS.ReadWriteStream | void;
|
||||||
|
}): Promise<void>;
|
||||||
|
insertLink(p: string, shouldUnpack: boolean, parentPath?: string, symlink?: string, // /var/tmp => /private/var
|
||||||
|
src?: string): string;
|
||||||
|
private resolveLink;
|
||||||
|
listFiles(options?: {
|
||||||
|
isPack: boolean;
|
||||||
|
}): string[];
|
||||||
|
getNode(p: string, followLinks?: boolean): FilesystemEntry;
|
||||||
|
getFile(p: string, followLinks?: boolean): FilesystemEntry;
|
||||||
|
}
|
||||||
199
electron/node_modules/@electron/asar/lib/filesystem.js
generated
vendored
Normal file
199
electron/node_modules/@electron/asar/lib/filesystem.js
generated
vendored
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Filesystem = void 0;
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const util_1 = require("util");
|
||||||
|
const stream = __importStar(require("stream"));
|
||||||
|
const integrity_1 = require("./integrity");
|
||||||
|
const wrapped_fs_1 = __importDefault(require("./wrapped-fs"));
|
||||||
|
const UINT32_MAX = 2 ** 32 - 1;
|
||||||
|
const pipeline = (0, util_1.promisify)(stream.pipeline);
|
||||||
|
class Filesystem {
|
||||||
|
constructor(src) {
|
||||||
|
this.src = path.resolve(src);
|
||||||
|
this.header = { files: Object.create(null) };
|
||||||
|
this.headerSize = 0;
|
||||||
|
this.offset = BigInt(0);
|
||||||
|
}
|
||||||
|
getRootPath() {
|
||||||
|
return this.src;
|
||||||
|
}
|
||||||
|
getHeader() {
|
||||||
|
return this.header;
|
||||||
|
}
|
||||||
|
getHeaderSize() {
|
||||||
|
return this.headerSize;
|
||||||
|
}
|
||||||
|
setHeader(header, headerSize) {
|
||||||
|
this.header = header;
|
||||||
|
this.headerSize = headerSize;
|
||||||
|
}
|
||||||
|
searchNodeFromDirectory(p) {
|
||||||
|
let json = this.header;
|
||||||
|
const dirs = p.split(path.sep);
|
||||||
|
for (const dir of dirs) {
|
||||||
|
if (dir !== '.') {
|
||||||
|
if ('files' in json) {
|
||||||
|
if (!json.files[dir]) {
|
||||||
|
json.files[dir] = { files: Object.create(null) };
|
||||||
|
}
|
||||||
|
json = json.files[dir];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('Unexpected directory state while traversing: ' + p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
searchNodeFromPath(p) {
|
||||||
|
p = path.relative(this.src, p);
|
||||||
|
if (!p) {
|
||||||
|
return this.header;
|
||||||
|
}
|
||||||
|
const name = path.basename(p);
|
||||||
|
const node = this.searchNodeFromDirectory(path.dirname(p));
|
||||||
|
if (!node.files) {
|
||||||
|
node.files = Object.create(null);
|
||||||
|
}
|
||||||
|
if (!node.files[name]) {
|
||||||
|
node.files[name] = Object.create(null);
|
||||||
|
}
|
||||||
|
return node.files[name];
|
||||||
|
}
|
||||||
|
insertDirectory(p, shouldUnpack) {
|
||||||
|
const node = this.searchNodeFromPath(p);
|
||||||
|
if (shouldUnpack) {
|
||||||
|
node.unpacked = shouldUnpack;
|
||||||
|
}
|
||||||
|
node.files = node.files || Object.create(null);
|
||||||
|
return node.files;
|
||||||
|
}
|
||||||
|
async insertFile(p, streamGenerator, shouldUnpack, file, options = {}) {
|
||||||
|
const dirNode = this.searchNodeFromPath(path.dirname(p));
|
||||||
|
const node = this.searchNodeFromPath(p);
|
||||||
|
if (shouldUnpack || dirNode.unpacked) {
|
||||||
|
node.size = file.stat.size;
|
||||||
|
node.unpacked = true;
|
||||||
|
node.integrity = await (0, integrity_1.getFileIntegrity)(streamGenerator());
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
let size;
|
||||||
|
const transformed = options.transform && options.transform(p);
|
||||||
|
if (transformed) {
|
||||||
|
const tmpdir = await wrapped_fs_1.default.mkdtemp(path.join(os.tmpdir(), 'asar-'));
|
||||||
|
const tmpfile = path.join(tmpdir, path.basename(p));
|
||||||
|
const out = wrapped_fs_1.default.createWriteStream(tmpfile);
|
||||||
|
await pipeline(streamGenerator(), transformed, out);
|
||||||
|
file.transformed = {
|
||||||
|
path: tmpfile,
|
||||||
|
stat: await wrapped_fs_1.default.lstat(tmpfile),
|
||||||
|
};
|
||||||
|
size = file.transformed.stat.size;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
size = file.stat.size;
|
||||||
|
}
|
||||||
|
// JavaScript cannot precisely present integers >= UINT32_MAX.
|
||||||
|
if (size > UINT32_MAX) {
|
||||||
|
throw new Error(`${p}: file size can not be larger than 4.2GB`);
|
||||||
|
}
|
||||||
|
node.size = size;
|
||||||
|
node.offset = this.offset.toString();
|
||||||
|
node.integrity = await (0, integrity_1.getFileIntegrity)(streamGenerator());
|
||||||
|
if (process.platform !== 'win32' && file.stat.mode & 0o100) {
|
||||||
|
node.executable = true;
|
||||||
|
}
|
||||||
|
this.offset += BigInt(size);
|
||||||
|
}
|
||||||
|
insertLink(p, shouldUnpack, parentPath = wrapped_fs_1.default.realpathSync(path.dirname(p)), symlink = wrapped_fs_1.default.readlinkSync(p), // /var/tmp => /private/var
|
||||||
|
src = wrapped_fs_1.default.realpathSync(this.src)) {
|
||||||
|
const link = this.resolveLink(src, parentPath, symlink);
|
||||||
|
if (link.startsWith('..')) {
|
||||||
|
throw new Error(`${p}: file "${link}" links out of the package`);
|
||||||
|
}
|
||||||
|
const node = this.searchNodeFromPath(p);
|
||||||
|
const dirNode = this.searchNodeFromPath(path.dirname(p));
|
||||||
|
if (shouldUnpack || dirNode.unpacked) {
|
||||||
|
node.unpacked = true;
|
||||||
|
}
|
||||||
|
node.link = link;
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
resolveLink(src, parentPath, symlink) {
|
||||||
|
const target = path.join(parentPath, symlink);
|
||||||
|
const link = path.relative(src, target);
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
listFiles(options) {
|
||||||
|
const files = [];
|
||||||
|
const fillFilesFromMetadata = function (basePath, metadata) {
|
||||||
|
if (!('files' in metadata)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (const [childPath, childMetadata] of Object.entries(metadata.files)) {
|
||||||
|
const fullPath = path.join(basePath, childPath);
|
||||||
|
const packState = 'unpacked' in childMetadata && childMetadata.unpacked ? 'unpack' : 'pack ';
|
||||||
|
files.push(options && options.isPack ? `${packState} : ${fullPath}` : fullPath);
|
||||||
|
fillFilesFromMetadata(fullPath, childMetadata);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fillFilesFromMetadata('/', this.header);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
getNode(p, followLinks = true) {
|
||||||
|
const node = this.searchNodeFromDirectory(path.dirname(p));
|
||||||
|
const name = path.basename(p);
|
||||||
|
if ('link' in node && followLinks) {
|
||||||
|
return this.getNode(path.join(node.link, name));
|
||||||
|
}
|
||||||
|
if (name) {
|
||||||
|
return node.files[name];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getFile(p, followLinks = true) {
|
||||||
|
const info = this.getNode(p, followLinks);
|
||||||
|
if (!info) {
|
||||||
|
throw new Error(`"${p}" was not found in this archive`);
|
||||||
|
}
|
||||||
|
// if followLinks is false we don't resolve symlinks
|
||||||
|
if ('link' in info && followLinks) {
|
||||||
|
return this.getFile(info.link, followLinks);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Filesystem = Filesystem;
|
||||||
|
//# sourceMappingURL=filesystem.js.map
|
||||||
1
electron/node_modules/@electron/asar/lib/filesystem.js.map
generated
vendored
Normal file
1
electron/node_modules/@electron/asar/lib/filesystem.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
electron/node_modules/@electron/asar/lib/integrity.d.ts
generated
vendored
Normal file
7
electron/node_modules/@electron/asar/lib/integrity.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
export type FileIntegrity = {
|
||||||
|
algorithm: 'SHA256';
|
||||||
|
hash: string;
|
||||||
|
blockSize: number;
|
||||||
|
blocks: string[];
|
||||||
|
};
|
||||||
|
export declare function getFileIntegrity(inputFileStream: NodeJS.ReadableStream): Promise<FileIntegrity>;
|
||||||
75
electron/node_modules/@electron/asar/lib/integrity.js
generated
vendored
Normal file
75
electron/node_modules/@electron/asar/lib/integrity.js
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getFileIntegrity = getFileIntegrity;
|
||||||
|
const crypto = __importStar(require("crypto"));
|
||||||
|
const stream = __importStar(require("stream"));
|
||||||
|
const util_1 = require("util");
|
||||||
|
const ALGORITHM = 'SHA256';
|
||||||
|
// 4MB default block size
|
||||||
|
const BLOCK_SIZE = 4 * 1024 * 1024;
|
||||||
|
const pipeline = (0, util_1.promisify)(stream.pipeline);
|
||||||
|
function hashBlock(block) {
|
||||||
|
return crypto.createHash(ALGORITHM).update(block).digest('hex');
|
||||||
|
}
|
||||||
|
async function getFileIntegrity(inputFileStream) {
|
||||||
|
const fileHash = crypto.createHash(ALGORITHM);
|
||||||
|
const blockHashes = [];
|
||||||
|
let currentBlockSize = 0;
|
||||||
|
let currentBlock = [];
|
||||||
|
await pipeline(inputFileStream, new stream.PassThrough({
|
||||||
|
decodeStrings: false,
|
||||||
|
transform(_chunk, encoding, callback) {
|
||||||
|
fileHash.update(_chunk);
|
||||||
|
function handleChunk(chunk) {
|
||||||
|
const diffToSlice = Math.min(BLOCK_SIZE - currentBlockSize, chunk.byteLength);
|
||||||
|
currentBlockSize += diffToSlice;
|
||||||
|
currentBlock.push(chunk.slice(0, diffToSlice));
|
||||||
|
if (currentBlockSize === BLOCK_SIZE) {
|
||||||
|
blockHashes.push(hashBlock(Buffer.concat(currentBlock)));
|
||||||
|
currentBlock = [];
|
||||||
|
currentBlockSize = 0;
|
||||||
|
}
|
||||||
|
if (diffToSlice < chunk.byteLength) {
|
||||||
|
handleChunk(chunk.slice(diffToSlice));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleChunk(_chunk);
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
flush(callback) {
|
||||||
|
blockHashes.push(hashBlock(Buffer.concat(currentBlock)));
|
||||||
|
currentBlock = [];
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
return {
|
||||||
|
algorithm: ALGORITHM,
|
||||||
|
hash: fileHash.digest('hex'),
|
||||||
|
blockSize: BLOCK_SIZE,
|
||||||
|
blocks: blockHashes,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=integrity.js.map
|
||||||
1
electron/node_modules/@electron/asar/lib/integrity.js.map
generated
vendored
Normal file
1
electron/node_modules/@electron/asar/lib/integrity.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"integrity.js","sourceRoot":"","sources":["../src/integrity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,4CA8CC;AApED,+CAAiC;AAEjC,+CAAiC;AACjC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,yBAAyB;AACzB,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,MAAM,QAAQ,GAAG,IAAA,gBAAS,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE5C,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AASM,KAAK,UAAU,gBAAgB,CACpC,eAAsC;IAEtC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,YAAY,GAAa,EAAE,CAAC;IAEhC,MAAM,QAAQ,CACZ,eAAe,EACf,IAAI,MAAM,CAAC,WAAW,CAAC;QACrB,aAAa,EAAE,KAAK;QACpB,SAAS,CAAC,MAAc,EAAE,QAAQ,EAAE,QAAQ;YAC1C,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAExB,SAAS,WAAW,CAAC,KAAa;gBAChC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,gBAAgB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;gBAC9E,gBAAgB,IAAI,WAAW,CAAC;gBAChC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;gBAC/C,IAAI,gBAAgB,KAAK,UAAU,EAAE,CAAC;oBACpC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACzD,YAAY,GAAG,EAAE,CAAC;oBAClB,gBAAgB,GAAG,CAAC,CAAC;gBACvB,CAAC;gBACD,IAAI,WAAW,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;oBACnC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YACD,WAAW,CAAC,MAAM,CAAC,CAAC;YACpB,QAAQ,EAAE,CAAC;QACb,CAAC;QACD,KAAK,CAAC,QAAQ;YACZ,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACzD,YAAY,GAAG,EAAE,CAAC;YAClB,QAAQ,EAAE,CAAC;QACb,CAAC;KACF,CAAC,CACH,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,SAAS,EAAE,UAAU;QACrB,MAAM,EAAE,WAAW;KACpB,CAAC;AACJ,CAAC"}
|
||||||
46
electron/node_modules/@electron/asar/lib/pickle.d.ts
generated
vendored
Normal file
46
electron/node_modules/@electron/asar/lib/pickle.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
declare class PickleIterator {
|
||||||
|
private payload;
|
||||||
|
private payloadOffset;
|
||||||
|
private readIndex;
|
||||||
|
private endIndex;
|
||||||
|
constructor(pickle: Pickle);
|
||||||
|
readBool(): boolean;
|
||||||
|
readInt(): number;
|
||||||
|
readUInt32(): number;
|
||||||
|
readInt64(): bigint;
|
||||||
|
readUInt64(): bigint;
|
||||||
|
readFloat(): number;
|
||||||
|
readDouble(): number;
|
||||||
|
readString(): string;
|
||||||
|
readBytes(length: number): Buffer;
|
||||||
|
readBytes<R, F extends (...args: any[]) => R>(length: number, method: F): R;
|
||||||
|
getReadPayloadOffsetAndAdvance(length: number): number;
|
||||||
|
advance(size: number): void;
|
||||||
|
}
|
||||||
|
export declare class Pickle {
|
||||||
|
private header;
|
||||||
|
private headerSize;
|
||||||
|
private capacityAfterHeader;
|
||||||
|
private writeOffset;
|
||||||
|
private constructor();
|
||||||
|
static createEmpty(): Pickle;
|
||||||
|
static createFromBuffer(buffer: Buffer): Pickle;
|
||||||
|
getHeader(): Buffer;
|
||||||
|
getHeaderSize(): number;
|
||||||
|
createIterator(): PickleIterator;
|
||||||
|
toBuffer(): Buffer;
|
||||||
|
writeBool(value: boolean): boolean;
|
||||||
|
writeInt(value: number): boolean;
|
||||||
|
writeUInt32(value: number): boolean;
|
||||||
|
writeInt64(value: number): boolean;
|
||||||
|
writeUInt64(value: number): boolean;
|
||||||
|
writeFloat(value: number): boolean;
|
||||||
|
writeDouble(value: number): boolean;
|
||||||
|
writeString(value: string): boolean;
|
||||||
|
setPayloadSize(payloadSize: number): number;
|
||||||
|
getPayloadSize(): number;
|
||||||
|
writeBytes(data: string, length: number, method?: undefined): boolean;
|
||||||
|
writeBytes(data: number | BigInt, length: number, method: Function): boolean;
|
||||||
|
resize(newCapacity: number): void;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
199
electron/node_modules/@electron/asar/lib/pickle.js
generated
vendored
Normal file
199
electron/node_modules/@electron/asar/lib/pickle.js
generated
vendored
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Pickle = void 0;
|
||||||
|
// sizeof(T).
|
||||||
|
const SIZE_INT32 = 4;
|
||||||
|
const SIZE_UINT32 = 4;
|
||||||
|
const SIZE_INT64 = 8;
|
||||||
|
const SIZE_UINT64 = 8;
|
||||||
|
const SIZE_FLOAT = 4;
|
||||||
|
const SIZE_DOUBLE = 8;
|
||||||
|
// The allocation granularity of the payload.
|
||||||
|
const PAYLOAD_UNIT = 64;
|
||||||
|
// Largest JS number.
|
||||||
|
const CAPACITY_READ_ONLY = 9007199254740992;
|
||||||
|
// Aligns 'i' by rounding it up to the next multiple of 'alignment'.
|
||||||
|
const alignInt = function (i, alignment) {
|
||||||
|
return i + ((alignment - (i % alignment)) % alignment);
|
||||||
|
};
|
||||||
|
// PickleIterator reads data from a Pickle. The Pickle object must remain valid
|
||||||
|
// while the PickleIterator object is in use.
|
||||||
|
class PickleIterator {
|
||||||
|
constructor(pickle) {
|
||||||
|
this.payload = pickle.getHeader();
|
||||||
|
this.payloadOffset = pickle.getHeaderSize();
|
||||||
|
this.readIndex = 0;
|
||||||
|
this.endIndex = pickle.getPayloadSize();
|
||||||
|
}
|
||||||
|
readBool() {
|
||||||
|
return this.readInt() !== 0;
|
||||||
|
}
|
||||||
|
readInt() {
|
||||||
|
return this.readBytes(SIZE_INT32, Buffer.prototype.readInt32LE);
|
||||||
|
}
|
||||||
|
readUInt32() {
|
||||||
|
return this.readBytes(SIZE_UINT32, Buffer.prototype.readUInt32LE);
|
||||||
|
}
|
||||||
|
readInt64() {
|
||||||
|
return this.readBytes(SIZE_INT64, Buffer.prototype.readBigInt64LE);
|
||||||
|
}
|
||||||
|
readUInt64() {
|
||||||
|
return this.readBytes(SIZE_UINT64, Buffer.prototype.readBigUInt64LE);
|
||||||
|
}
|
||||||
|
readFloat() {
|
||||||
|
return this.readBytes(SIZE_FLOAT, Buffer.prototype.readFloatLE);
|
||||||
|
}
|
||||||
|
readDouble() {
|
||||||
|
return this.readBytes(SIZE_DOUBLE, Buffer.prototype.readDoubleLE);
|
||||||
|
}
|
||||||
|
readString() {
|
||||||
|
return this.readBytes(this.readInt()).toString();
|
||||||
|
}
|
||||||
|
readBytes(length, method) {
|
||||||
|
const readPayloadOffset = this.getReadPayloadOffsetAndAdvance(length);
|
||||||
|
if (method != null) {
|
||||||
|
return method.call(this.payload, readPayloadOffset, length);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return this.payload.slice(readPayloadOffset, readPayloadOffset + length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getReadPayloadOffsetAndAdvance(length) {
|
||||||
|
if (length > this.endIndex - this.readIndex) {
|
||||||
|
this.readIndex = this.endIndex;
|
||||||
|
throw new Error('Failed to read data with length of ' + length);
|
||||||
|
}
|
||||||
|
const readPayloadOffset = this.payloadOffset + this.readIndex;
|
||||||
|
this.advance(length);
|
||||||
|
return readPayloadOffset;
|
||||||
|
}
|
||||||
|
advance(size) {
|
||||||
|
const alignedSize = alignInt(size, SIZE_UINT32);
|
||||||
|
if (this.endIndex - this.readIndex < alignedSize) {
|
||||||
|
this.readIndex = this.endIndex;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.readIndex += alignedSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This class provides facilities for basic binary value packing and unpacking.
|
||||||
|
//
|
||||||
|
// The Pickle class supports appending primitive values (ints, strings, etc.)
|
||||||
|
// to a pickle instance. The Pickle instance grows its internal memory buffer
|
||||||
|
// dynamically to hold the sequence of primitive values. The internal memory
|
||||||
|
// buffer is exposed as the "data" of the Pickle. This "data" can be passed
|
||||||
|
// to a Pickle object to initialize it for reading.
|
||||||
|
//
|
||||||
|
// When reading from a Pickle object, it is important for the consumer to know
|
||||||
|
// what value types to read and in what order to read them as the Pickle does
|
||||||
|
// not keep track of the type of data written to it.
|
||||||
|
//
|
||||||
|
// The Pickle's data has a header which contains the size of the Pickle's
|
||||||
|
// payload. It can optionally support additional space in the header. That
|
||||||
|
// space is controlled by the header_size parameter passed to the Pickle
|
||||||
|
// constructor.
|
||||||
|
class Pickle {
|
||||||
|
constructor(buffer) {
|
||||||
|
if (buffer) {
|
||||||
|
this.header = buffer;
|
||||||
|
this.headerSize = buffer.length - this.getPayloadSize();
|
||||||
|
this.capacityAfterHeader = CAPACITY_READ_ONLY;
|
||||||
|
this.writeOffset = 0;
|
||||||
|
if (this.headerSize > buffer.length) {
|
||||||
|
this.headerSize = 0;
|
||||||
|
}
|
||||||
|
if (this.headerSize !== alignInt(this.headerSize, SIZE_UINT32)) {
|
||||||
|
this.headerSize = 0;
|
||||||
|
}
|
||||||
|
if (this.headerSize === 0) {
|
||||||
|
this.header = Buffer.alloc(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.header = Buffer.alloc(0);
|
||||||
|
this.headerSize = SIZE_UINT32;
|
||||||
|
this.capacityAfterHeader = 0;
|
||||||
|
this.writeOffset = 0;
|
||||||
|
this.resize(PAYLOAD_UNIT);
|
||||||
|
this.setPayloadSize(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static createEmpty() {
|
||||||
|
return new Pickle();
|
||||||
|
}
|
||||||
|
static createFromBuffer(buffer) {
|
||||||
|
return new Pickle(buffer);
|
||||||
|
}
|
||||||
|
getHeader() {
|
||||||
|
return this.header;
|
||||||
|
}
|
||||||
|
getHeaderSize() {
|
||||||
|
return this.headerSize;
|
||||||
|
}
|
||||||
|
createIterator() {
|
||||||
|
return new PickleIterator(this);
|
||||||
|
}
|
||||||
|
toBuffer() {
|
||||||
|
return this.header.slice(0, this.headerSize + this.getPayloadSize());
|
||||||
|
}
|
||||||
|
writeBool(value) {
|
||||||
|
return this.writeInt(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
writeInt(value) {
|
||||||
|
return this.writeBytes(value, SIZE_INT32, Buffer.prototype.writeInt32LE);
|
||||||
|
}
|
||||||
|
writeUInt32(value) {
|
||||||
|
return this.writeBytes(value, SIZE_UINT32, Buffer.prototype.writeUInt32LE);
|
||||||
|
}
|
||||||
|
writeInt64(value) {
|
||||||
|
return this.writeBytes(BigInt(value), SIZE_INT64, Buffer.prototype.writeBigInt64LE);
|
||||||
|
}
|
||||||
|
writeUInt64(value) {
|
||||||
|
return this.writeBytes(BigInt(value), SIZE_UINT64, Buffer.prototype.writeBigUInt64LE);
|
||||||
|
}
|
||||||
|
writeFloat(value) {
|
||||||
|
return this.writeBytes(value, SIZE_FLOAT, Buffer.prototype.writeFloatLE);
|
||||||
|
}
|
||||||
|
writeDouble(value) {
|
||||||
|
return this.writeBytes(value, SIZE_DOUBLE, Buffer.prototype.writeDoubleLE);
|
||||||
|
}
|
||||||
|
writeString(value) {
|
||||||
|
const length = Buffer.byteLength(value, 'utf8');
|
||||||
|
if (!this.writeInt(length)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.writeBytes(value, length);
|
||||||
|
}
|
||||||
|
setPayloadSize(payloadSize) {
|
||||||
|
return this.header.writeUInt32LE(payloadSize, 0);
|
||||||
|
}
|
||||||
|
getPayloadSize() {
|
||||||
|
return this.header.readUInt32LE(0);
|
||||||
|
}
|
||||||
|
writeBytes(data, length, method) {
|
||||||
|
const dataLength = alignInt(length, SIZE_UINT32);
|
||||||
|
const newSize = this.writeOffset + dataLength;
|
||||||
|
if (newSize > this.capacityAfterHeader) {
|
||||||
|
this.resize(Math.max(this.capacityAfterHeader * 2, newSize));
|
||||||
|
}
|
||||||
|
if (method) {
|
||||||
|
method.call(this.header, data, this.headerSize + this.writeOffset);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.header.write(data, this.headerSize + this.writeOffset, length);
|
||||||
|
}
|
||||||
|
const endOffset = this.headerSize + this.writeOffset + length;
|
||||||
|
this.header.fill(0, endOffset, endOffset + dataLength - length);
|
||||||
|
this.setPayloadSize(newSize);
|
||||||
|
this.writeOffset = newSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
resize(newCapacity) {
|
||||||
|
newCapacity = alignInt(newCapacity, PAYLOAD_UNIT);
|
||||||
|
this.header = Buffer.concat([this.header, Buffer.alloc(newCapacity)]);
|
||||||
|
this.capacityAfterHeader = newCapacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Pickle = Pickle;
|
||||||
|
//# sourceMappingURL=pickle.js.map
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue