diff --git a/.github/workflows/build_and_test_debug_client.yml b/.github/workflows/build_and_test_debug_client.yml index 0574cf4f26..29c881c68a 100644 --- a/.github/workflows/build_and_test_debug_client.yml +++ b/.github/workflows/build_and_test_debug_client.yml @@ -18,7 +18,7 @@ jobs: web_test: name: Web Test runs-on: ubuntu-20.04 - timeout-minutes: 10 + timeout-minutes: 20 steps: - name: Checkout uses: actions/checkout@v2.3.4 @@ -37,20 +37,20 @@ jobs: run: npm run action lint - name: Build Web App - run: npm run action www/build + run: npm run action client/src/www/build - name: Test Web App - run: npm run action www/test + run: npm run action client/src/www/test - uses: codecov/codecov-action@v3 with: - files: ./output/coverage/www/coverage-final.json + files: ./client/src/output/coverage/www/coverage-final.json flags: unittests, www linux_debug_build: name: Linux Debug Build runs-on: ubuntu-20.04 - timeout-minutes: 10 + timeout-minutes: 20 needs: web_test steps: - name: Checkout @@ -72,12 +72,12 @@ jobs: go-version-file: '${{ github.workspace }}/go.mod' - name: Build Linux Client - run: npm run action electron/build linux + run: npm run action client/src/electron/build linux windows_debug_build: name: Windows Debug Build runs-on: windows-2019 - timeout-minutes: 10 + timeout-minutes: 20 needs: web_test steps: - name: Support longpaths @@ -102,7 +102,7 @@ jobs: go-version-file: '${{ github.workspace }}/go.mod' - name: Build Windows Client - run: npm run action electron/build windows + run: npm run action client/src/electron/build windows macos_debug_build: name: MacOS Debug Build @@ -132,18 +132,18 @@ jobs: go-version-file: '${{ github.workspace }}/go.mod' - name: Build Tun2Socks (required for Test OutlineAppleLib) - run: npm run action tun2socks/build macos + run: npm run action client/src/tun2socks/build macos - name: Test OutlineAppleLib - run: npm run action cordova/test macos + run: npm run action client/src/cordova/test macos - name: Build MacOS Client - run: npm run action cordova/build macos + run: npm run action client/src/cordova/build macos - uses: codecov/codecov-action@v3 with: xcode: true - xcode_archive_path: ./output/coverage/apple/macos/TestResult.xcresult + xcode_archive_path: ./client/src/output/coverage/apple/macos/TestResult.xcresult flags: unittests, apple, macos ios_debug_build: @@ -174,18 +174,18 @@ jobs: go-version-file: '${{ github.workspace }}/go.mod' - name: Build Tun2Socks (required for Test OutlineAppleLib) - run: npm run action tun2socks/build ios + run: npm run action client/src/tun2socks/build ios - name: Test OutlineAppleLib - run: npm run action cordova/test ios + run: npm run action client/src/cordova/test ios - name: Build iOS Client - run: npm run action cordova/build ios + run: npm run action client/src/cordova/build ios - uses: codecov/codecov-action@v3 with: xcode: true - xcode_archive_path: ./output/coverage/apple/ios/TestResult.xcresult + xcode_archive_path: ./client/src/output/coverage/apple/ios/TestResult.xcresult flags: unittests, apple, ios maccatalyst_debug_build: @@ -216,24 +216,24 @@ jobs: go-version-file: '${{ github.workspace }}/go.mod' - name: Build Tun2Socks (required for Test OutlineAppleLib) - run: npm run action tun2socks/build maccatalyst + run: npm run action client/src/tun2socks/build maccatalyst - name: Test OutlineAppleLib - run: npm run action cordova/test maccatalyst + run: npm run action client/src/cordova/test maccatalyst - name: Build Mac Catalyst Client - run: npm run action cordova/build maccatalyst + run: npm run action client/src/cordova/build maccatalyst - uses: codecov/codecov-action@v3 with: xcode: true - xcode_archive_path: ./output/coverage/apple/maccatalyst/TestResult.xcresult + xcode_archive_path: ./client/src/output/coverage/apple/maccatalyst/TestResult.xcresult flags: unittests, apple, maccatalyst android_debug_build: name: Android Debug Build runs-on: ubuntu-20.04 - timeout-minutes: 10 + timeout-minutes: 20 needs: web_test steps: - name: Checkout @@ -260,7 +260,7 @@ jobs: java-version: 11 - name: Setup Android - run: bash ./tools/build/setup_linux_android.sh + run: bash ./client/tools/build/setup_linux_android.sh - name: Build Android Client - run: npm run action cordova/build android -- --verbose + run: npm run action client/src/cordova/build android -- --verbose diff --git a/.gitignore b/.gitignore index ca0be6c62a..6856c1d84a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +node_modules .idea .vs/ .vscode @@ -5,27 +6,7 @@ *.env *.pdb *.sw? -/node_modules /server_manager/node_modules -/server_manager/do_install_script.ts -/server_manager/gcp_install_script.ts -/build +/server_manager/install_scripts/do_install_script.ts +/server_manager/install_scripts/gcp_install_script.ts /output -/platforms -/plugins -/third_party/Potatso/Pods -/www -coverage -info.txt -keystore.p12 -obj/ -Outline.apk -Outline.apks -packages/ -toc.pb -tools/OutlineService/OutlineService/bin/* -tools/smartdnsblock/bin/* -!tools/OutlineService/OutlineService/bin/*.exe -!tools/smartdnsblock/bin/*.exe -universal.apk -xcuserdata/ diff --git a/Makefile b/Makefile index e7da6e6b70..17a7512923 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,17 @@ -BUILDDIR=$(CURDIR)/output/build -GOBIN=$(CURDIR)/output/bin +BUILDDIR=$(CURDIR)/client/output/build +GOBIN=$(CURDIR)/client/output/bin GOMOBILE=$(GOBIN)/gomobile # Add GOBIN to $PATH so `gomobile` can find `gobind`. GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_HOST=github.com -IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-client +IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-apps .PHONY: android apple linux windows browser all: android apple linux windows -ROOT_PKG=src/tun2socks +ROOT_PKG=client/src/tun2socks # Don't strip Android debug symbols so we can upload them to crash reporting tools. ANDROID_BUILD_CMD=$(GOBIND) -a -ldflags '-w' -target=android -androidapi 19 -tags android -work diff --git a/README.md b/README.md index 7e427791db..bd2986aed6 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ The Outline Client is a cross-platform proxy client for Windows, macOS, iOS, And > [!NOTE] > Test coverage currently only tracks the Apple Libraries and core web view code. -The client's user interface is implemented in [Polymer](https://www.polymer-project.org/) 2.0. Platform support is provided by [Cordova](https://cordova.apache.org/) and [Electron](https://electronjs.org/), with additional native components in this repository. +We have two core apps: [Ouline Manager](./server_manager) and [Ouline Client](./client). To join our Outline Community, [sign up for the IFF Mattermost](https://wiki.digitalrights.community/index.php?title=IFF_Mattermost). #### Requirements for all builds -All builds require [Node](https://nodejs.org/) 18 (lts/hydrogen), and [Go](https://golang.org/) 1.20 installed in addition to other per-platform requirements. +### Outline Client > 💡 NOTE: if you have `nvm` installed, run `nvm use` to switch to the correct node version! @@ -44,7 +44,7 @@ npm install Outline clients share the same web app across all platforms. This code is located in the src/www directory. If you are making changes to the shared web app and do not need to test platform-specific functionality, you can test in a desktop browser by running: ```sh -npm run action src/www/start +npm run action client/src/www/start ``` The latter command will open a browser instance running the app. Browser platform development will use fake servers to test successful and unsuccessful connections. @@ -52,7 +52,7 @@ The latter command will open a browser instance running the app. Browser platfor The app logic is located in [src/www/app](src/www/app). UI components are located in [src/www/ui_components](src/www/ui_components). If you want to work specifically on an individual UI element, try the storybook!: ```sh -npm run action src/www/storybook +npm run action client/src/www/storybook ``` > [!NOTE] @@ -75,7 +75,7 @@ npm run action src/www/storybook Certain actions take configuration flags - but since we're running them through `npm`, you'll have to use the `--` seperator to funnel them through to the underlying process. For example, to set up a MacOS project in release mode, you'd run: ```sh -SENTRY_DSN= npm run action cordova/setup macos -- --buildMode=release --versionName= +SENTRY_DSN= npm run action client/src/cordova/setup macos -- --buildMode=release --versionName= ``` #### Life of a Packet diff --git a/.browserslistrc b/client/.browserslistrc similarity index 100% rename from .browserslistrc rename to client/.browserslistrc diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000000..061ad13c3c --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,19 @@ +/node_modules +/build +/output +/platforms +/plugins +/third_party/Potatso/Pods +/www +coverage +info.txt +keystore.p12 +obj/ +Outline.apk +Outline.apks +packages/ +toc.pb +tools/smartdnsblock/bin/* +!tools/smartdnsblock/bin/*.exe +universal.apk +xcuserdata/ diff --git a/LICENSE b/client/LICENSE similarity index 100% rename from LICENSE rename to client/LICENSE diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000000..3787ff9d6b --- /dev/null +++ b/client/README.md @@ -0,0 +1,87 @@ +# Outline Client + +![Build and Test](https://github.com/Jigsaw-Code/outline-apps/actions/workflows/build_and_test_debug_client.yml/badge.svg?branch=master) + +> **Test coverage currently only tracks the Apple Libraries and core web view code:** +> +> [![codecov](https://codecov.io/gh/Jigsaw-Code/outline-apps/branch/master/graph/badge.svg?token=gasD8v5tjn)](https://codecov.io/gh/Jigsaw-Code/outline-apps) + +The Outline Client is a cross-platform VPN or proxy client for Windows, macOS, iOS, Android, and ChromeOS. The Outline Client is designed for use with the [Outline Server](https://github.com/Jigsaw-Code/outline-server) software, but it is fully compatible with any [Shadowsocks](https://shadowsocks.org/) server. + +The client's user interface is implemented in [Polymer](https://www.polymer-project.org/) 2.0. Platform support is provided by [Cordova](https://cordova.apache.org/) and [Electron](https://electronjs.org/), with additional native components in this repository. + +To join our Outline Community, [sign up for the IFF Mattermost](https://internetfreedomfestival.org/wiki/index.php/IFF_Mattermost). + +## Requirements for all builds + +All builds require [Node](https://nodejs.org/) 18 (lts/hydrogen), and [Go](https://golang.org/) 1.20 installed in addition to other per-platform requirements. + +> 💡 NOTE: if you have `nvm` installed, run `nvm use` to switch to the correct node version! + +After cloning this repo, install all node dependencies: + +```sh +npm install +``` + +## Building the shared web app + +Outline clients share the same web app across all platforms. This code is located in the src/www directory. If you are making changes to the shared web app and do not need to test platform-specific functionality, you can test in a desktop browser by running: + +```sh +npm run action client/src/www/start +``` + +The latter command will open a browser instance running the app. Browser platform development will use fake servers to test successful and unsuccessful connections. + +The app logic is located in [src/www/app](src/www/app). UI components are located in [src/www/ui_components](src/www/ui_components). If you want to work specifically on an individual UI element, try the storybook!: + +```sh +npm run action client/src/www/storybook +``` + +> 💡 NOTE: every script in this repository can be run with `npm run action` - +> for a CLI-like experience, add something like +> +> ```sh +> alias outline="npm run action" +> ``` +> +> _(you can call it whatever you like)_ +> +> to your shell, then try `outline www/start`! + +## Passing configuration flags to actions + +Certain actions take configuration flags - but since we're running them through `npm`, you'll have to use the `--` seperator to funnel them through to the underlying process. For example, to set up a MacOS project in release mode, you'd run: + +```sh +SENTRY_DSN= npm run action client/src/cordova/setup macos -- --buildMode=release --versionName= +``` + +## Life of a Packet + +[How does the Outline Client work?](docs/life_of_a_packet.md) + +## Accepting a server invite + +[Looking for instructions on how to accept a server invite?](docs/invitation_instructions.md) + +## Platform-specific development + +Each platform is handled differently: + +1. [Developing for Apple **(MacOS and iOS)**](src/cordova/apple) +2. [Developing for **Android**](src/cordova/android) +3. [Developing for Electron **(Windows and Linux)**](src/electron) + +## Error reporting + +To enable error reporting through [Sentry](https://sentry.io/) for local builds, run: + +```bash +export SENTRY_DSN=[Sentry development API key] +[platform-specific build command] +``` + +Release builds on CI are configured with a production Sentry API key. diff --git a/config.xml b/client/config.xml similarity index 72% rename from config.xml rename to client/config.xml index f27a55f960..c54c39b5b3 100644 --- a/config.xml +++ b/client/config.xml @@ -88,44 +88,33 @@ - - - + - - - - + + + + - + - - - - - - - - - - - - - + + + + - + - - - + + + + - - - + + + - - - + + diff --git a/client/node_modules/.bin/dircompare b/client/node_modules/.bin/dircompare new file mode 120000 index 0000000000..4c66e5c605 --- /dev/null +++ b/client/node_modules/.bin/dircompare @@ -0,0 +1 @@ +../dir-compare/src/cli/dircompare.js \ No newline at end of file diff --git a/client/node_modules/.bin/electron-builder b/client/node_modules/.bin/electron-builder new file mode 120000 index 0000000000..6b2d72509c --- /dev/null +++ b/client/node_modules/.bin/electron-builder @@ -0,0 +1 @@ +../electron-builder/cli.js \ No newline at end of file diff --git a/client/node_modules/.bin/install-app-deps b/client/node_modules/.bin/install-app-deps new file mode 120000 index 0000000000..77384c3dcc --- /dev/null +++ b/client/node_modules/.bin/install-app-deps @@ -0,0 +1 @@ +../electron-builder/install-app-deps.js \ No newline at end of file diff --git a/client/node_modules/.bin/semver b/client/node_modules/.bin/semver new file mode 120000 index 0000000000..5aaadf42c4 --- /dev/null +++ b/client/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/client/node_modules/@electron/universal/README.md b/client/node_modules/@electron/universal/README.md new file mode 100644 index 0000000000..fe333b2cd9 --- /dev/null +++ b/client/node_modules/@electron/universal/README.md @@ -0,0 +1,36 @@ +# @electron/universal + +> Create universal macOS Electron applications + +[![CircleCI](https://circleci.com/gh/electron/universal/tree/master.svg?style=svg)](https://circleci.com/gh/electron/universal) + + +## Usage + +```typescript +import { makeUniversalApp } from '@electron/universal'; + +await makeUniversalApp({ + x64AppPath: 'path/to/App_x64.app', + arm64AppPath: 'path/to/App_arm64.app', + outAppPath: 'path/to/App_universal.app', +}); +``` + +## FAQ + +#### The app is twice as big now, why? + +Well, a Universal app isn't anything magical. It is literally the x64 app and +the arm64 app glued together into a single application. It's twice as big +because it contains two apps in one. + +#### What about native modules? + +The way `@electron/universal` works today means you don't need to worry about +things like building universal versions of your native modules. As long as +your x64 and arm64 apps work in isolation the Universal app will work as well. + +#### How do I build my app for Apple silicon in the first place? + +Check out the [Electron Apple silicon blog post](https://www.electronjs.org/blog/apple-silicon) diff --git a/client/node_modules/@electron/universal/dist/cjs/asar-utils.d.ts b/client/node_modules/@electron/universal/dist/cjs/asar-utils.d.ts new file mode 100644 index 0000000000..530b52bd10 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/asar-utils.d.ts @@ -0,0 +1,16 @@ +export declare enum AsarMode { + NO_ASAR = 0, + HAS_ASAR = 1 +} +export declare type MergeASARsOptions = { + x64AsarPath: string; + arm64AsarPath: string; + outputAsarPath: string; + singleArchFiles?: string; +}; +export declare const detectAsarMode: (appPath: string) => Promise; +export declare const generateAsarIntegrity: (asarPath: string) => { + algorithm: "SHA256"; + hash: string; +}; +export declare const mergeASARs: ({ x64AsarPath, arm64AsarPath, outputAsarPath, singleArchFiles, }: MergeASARsOptions) => Promise; diff --git a/client/node_modules/@electron/universal/dist/cjs/asar-utils.js b/client/node_modules/@electron/universal/dist/cjs/asar-utils.js new file mode 100644 index 0000000000..44028b273d --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/asar-utils.js @@ -0,0 +1,156 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mergeASARs = exports.generateAsarIntegrity = exports.detectAsarMode = exports.AsarMode = void 0; +const asar = require("asar"); +const child_process_1 = require("child_process"); +const crypto = require("crypto"); +const fs = require("fs-extra"); +const path = require("path"); +const minimatch = require("minimatch"); +const os = require("os"); +const debug_1 = require("./debug"); +const LIPO = 'lipo'; +var AsarMode; +(function (AsarMode) { + AsarMode[AsarMode["NO_ASAR"] = 0] = "NO_ASAR"; + AsarMode[AsarMode["HAS_ASAR"] = 1] = "HAS_ASAR"; +})(AsarMode = exports.AsarMode || (exports.AsarMode = {})); +// See: https://github.com/apple-opensource-mirror/llvmCore/blob/0c60489d96c87140db9a6a14c6e82b15f5e5d252/include/llvm/Object/MachOFormat.h#L108-L112 +const MACHO_MAGIC = new Set([ + // 32-bit Mach-O + 0xfeedface, + 0xcefaedfe, + // 64-bit Mach-O + 0xfeedfacf, + 0xcffaedfe, +]); +exports.detectAsarMode = async (appPath) => { + debug_1.d('checking asar mode of', appPath); + const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar'); + if (!(await fs.pathExists(asarPath))) { + debug_1.d('determined no asar'); + return AsarMode.NO_ASAR; + } + debug_1.d('determined has asar'); + return AsarMode.HAS_ASAR; +}; +exports.generateAsarIntegrity = (asarPath) => { + return { + algorithm: 'SHA256', + hash: crypto + .createHash('SHA256') + .update(asar.getRawHeader(asarPath).headerString) + .digest('hex'), + }; +}; +function toRelativePath(file) { + return file.replace(/^\//, ''); +} +function isDirectory(a, file) { + return Boolean('files' in asar.statFile(a, file)); +} +function checkSingleArch(archive, file, allowList) { + if (allowList === undefined || !minimatch(file, allowList, { matchBase: true })) { + throw new Error(`Detected unique file "${file}" in "${archive}" not covered by ` + + `allowList rule: "${allowList}"`); + } +} +exports.mergeASARs = async ({ x64AsarPath, arm64AsarPath, outputAsarPath, singleArchFiles, }) => { + debug_1.d(`merging ${x64AsarPath} and ${arm64AsarPath}`); + const x64Files = new Set(asar.listPackage(x64AsarPath).map(toRelativePath)); + const arm64Files = new Set(asar.listPackage(arm64AsarPath).map(toRelativePath)); + // + // Build set of unpacked directories and files + // + const unpackedFiles = new Set(); + function buildUnpacked(a, fileList) { + for (const file of fileList) { + const stat = asar.statFile(a, file); + if (!('unpacked' in stat) || !stat.unpacked) { + continue; + } + if ('files' in stat) { + continue; + } + unpackedFiles.add(file); + } + } + buildUnpacked(x64AsarPath, x64Files); + buildUnpacked(arm64AsarPath, arm64Files); + // + // Build list of files/directories unique to each asar + // + for (const file of x64Files) { + if (!arm64Files.has(file)) { + checkSingleArch(x64AsarPath, file, singleArchFiles); + } + } + const arm64Unique = []; + for (const file of arm64Files) { + if (!x64Files.has(file)) { + checkSingleArch(arm64AsarPath, file, singleArchFiles); + arm64Unique.push(file); + } + } + // + // Find common bindings with different content + // + const commonBindings = []; + for (const file of x64Files) { + if (!arm64Files.has(file)) { + continue; + } + // Skip directories + if (isDirectory(x64AsarPath, file)) { + continue; + } + const x64Content = asar.extractFile(x64AsarPath, file); + const arm64Content = asar.extractFile(arm64AsarPath, file); + if (x64Content.compare(arm64Content) === 0) { + continue; + } + if (!MACHO_MAGIC.has(x64Content.readUInt32LE(0))) { + throw new Error(`Can't reconcile two non-macho files ${file}`); + } + commonBindings.push(file); + } + // + // Extract both + // + const x64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'x64-')); + const arm64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'arm64-')); + try { + debug_1.d(`extracting ${x64AsarPath} to ${x64Dir}`); + asar.extractAll(x64AsarPath, x64Dir); + debug_1.d(`extracting ${arm64AsarPath} to ${arm64Dir}`); + asar.extractAll(arm64AsarPath, arm64Dir); + for (const file of arm64Unique) { + const source = path.resolve(arm64Dir, file); + const destination = path.resolve(x64Dir, file); + if (isDirectory(arm64AsarPath, file)) { + debug_1.d(`creating unique directory: ${file}`); + await fs.mkdirp(destination); + continue; + } + debug_1.d(`xopying unique file: ${file}`); + await fs.mkdirp(path.dirname(destination)); + await fs.copy(source, destination); + } + for (const binding of commonBindings) { + const source = await fs.realpath(path.resolve(arm64Dir, binding)); + const destination = await fs.realpath(path.resolve(x64Dir, binding)); + debug_1.d(`merging binding: ${binding}`); + child_process_1.execFileSync(LIPO, [source, destination, '-create', '-output', destination]); + } + debug_1.d(`creating archive at ${outputAsarPath}`); + const resolvedUnpack = Array.from(unpackedFiles).map((file) => path.join(x64Dir, file)); + await asar.createPackageWithOptions(x64Dir, outputAsarPath, { + unpack: `{${resolvedUnpack.join(',')}}`, + }); + debug_1.d('done merging'); + } + finally { + await Promise.all([fs.remove(x64Dir), fs.remove(arm64Dir)]); + } +}; +//# sourceMappingURL=asar-utils.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/asar-utils.js.map b/client/node_modules/@electron/universal/dist/cjs/asar-utils.js.map new file mode 100644 index 0000000000..b089ce8c22 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/asar-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asar-utils.js","sourceRoot":"","sources":["../../src/asar-utils.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,iDAA6C;AAC7C,iCAAiC;AACjC,+BAA+B;AAC/B,6BAA6B;AAC7B,uCAAuC;AACvC,yBAAyB;AACzB,mCAA4B;AAE5B,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,6CAAO,CAAA;IACP,+CAAQ,CAAA;AACV,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAUD,qJAAqJ;AACrJ,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,gBAAgB;IAChB,UAAU;IACV,UAAU;IAEV,gBAAgB;IAChB,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;IACtD,SAAC,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,CA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9E;QAED,SAAC,CAAC,uBAAuB,cAAc,EAAE,CAAC,CAAC;QAE3C,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAExF,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,cAAc,EAAE;YAC1D,MAAM,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;SACxC,CAAC,CAAC;QAEH,SAAC,CAAC,cAAc,CAAC,CAAC;KACnB;YAAS;QACR,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KAC7D;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/debug.d.ts b/client/node_modules/@electron/universal/dist/cjs/debug.d.ts new file mode 100644 index 0000000000..ec24d3b974 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/debug.d.ts @@ -0,0 +1,2 @@ +import * as debug from 'debug'; +export declare const d: debug.Debugger; diff --git a/client/node_modules/@electron/universal/dist/cjs/debug.js b/client/node_modules/@electron/universal/dist/cjs/debug.js new file mode 100644 index 0000000000..f3fccb1cdb --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/debug.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const debug = require("debug"); +exports.d = debug('electron-universal'); +//# sourceMappingURL=debug.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/debug.js.map b/client/node_modules/@electron/universal/dist/cjs/debug.js.map new file mode 100644 index 0000000000..8256675924 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/debug.js.map @@ -0,0 +1 @@ +{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAElB,QAAA,CAAC,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/file-utils.d.ts b/client/node_modules/@electron/universal/dist/cjs/file-utils.d.ts new file mode 100644 index 0000000000..ff08b0e599 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/file-utils.d.ts @@ -0,0 +1,16 @@ +export declare enum AppFileType { + MACHO = 0, + PLAIN = 1, + INFO_PLIST = 2, + SNAPSHOT = 3, + APP_CODE = 4 +} +export declare type AppFile = { + relativePath: string; + type: AppFileType; +}; +/** + * + * @param appPath Path to the application + */ +export declare const getAllAppFiles: (appPath: string) => Promise; diff --git a/client/node_modules/@electron/universal/dist/cjs/file-utils.js b/client/node_modules/@electron/universal/dist/cjs/file-utils.js new file mode 100644 index 0000000000..bed089ecaa --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/file-utils.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getAllAppFiles = exports.AppFileType = void 0; +const cross_spawn_promise_1 = require("@malept/cross-spawn-promise"); +const fs = require("fs-extra"); +const path = require("path"); +const MACHO_PREFIX = 'Mach-O '; +var AppFileType; +(function (AppFileType) { + AppFileType[AppFileType["MACHO"] = 0] = "MACHO"; + AppFileType[AppFileType["PLAIN"] = 1] = "PLAIN"; + AppFileType[AppFileType["INFO_PLIST"] = 2] = "INFO_PLIST"; + AppFileType[AppFileType["SNAPSHOT"] = 3] = "SNAPSHOT"; + AppFileType[AppFileType["APP_CODE"] = 4] = "APP_CODE"; +})(AppFileType = exports.AppFileType || (exports.AppFileType = {})); +/** + * + * @param appPath Path to the application + */ +exports.getAllAppFiles = async (appPath) => { + const files = []; + const visited = new Set(); + const traverse = async (p) => { + p = await fs.realpath(p); + if (visited.has(p)) + return; + visited.add(p); + const info = await fs.stat(p); + if (info.isSymbolicLink()) + return; + if (info.isFile()) { + let fileType = AppFileType.PLAIN; + var fileOutput = ''; + try { + fileOutput = await cross_spawn_promise_1.spawn('file', ['--brief', '--no-pad', p]); + } + catch (e) { + if (e instanceof cross_spawn_promise_1.ExitCodeError) { + /* silently accept error codes from "file" */ + } + else { + throw e; + } + } + if (p.includes('app.asar')) { + fileType = AppFileType.APP_CODE; + } + else if (fileOutput.startsWith(MACHO_PREFIX)) { + fileType = AppFileType.MACHO; + } + else if (p.endsWith('.bin')) { + fileType = AppFileType.SNAPSHOT; + } + else if (path.basename(p) === 'Info.plist') { + fileType = AppFileType.INFO_PLIST; + } + files.push({ + relativePath: path.relative(appPath, p), + type: fileType, + }); + } + if (info.isDirectory()) { + for (const child of await fs.readdir(p)) { + await traverse(path.resolve(p, child)); + } + } + }; + await traverse(appPath); + return files; +}; +//# sourceMappingURL=file-utils.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/file-utils.js.map b/client/node_modules/@electron/universal/dist/cjs/file-utils.js.map new file mode 100644 index 0000000000..1ca0c180e2 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/file-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file-utils.js","sourceRoot":"","sources":["../../src/file-utils.ts"],"names":[],"mappings":";;;AAAA,qEAAmE;AACnE,+BAA+B;AAC/B,6BAA6B;AAE7B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,+CAAK,CAAA;IACL,+CAAK,CAAA;IACL,yDAAU,CAAA;IACV,qDAAQ,CAAA;IACR,qDAAQ,CAAA;AACV,CAAC,EANW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAMtB;AAOD;;;GAGG;AACU,QAAA,cAAc,GAAG,KAAK,EAAE,OAAe,EAAsB,EAAE;IAC1E,MAAM,KAAK,GAAc,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAG,IAA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T,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvC,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;SACJ;QAED,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACvC,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;aACxC;SACF;IACH,CAAC,CAAC;IACF,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/index.d.ts b/client/node_modules/@electron/universal/dist/cjs/index.d.ts new file mode 100644 index 0000000000..2983f32bbb --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/index.d.ts @@ -0,0 +1,30 @@ +declare type MakeUniversalOpts = { + /** + * Absolute file system path to the x64 version of your application. E.g. /Foo/bar/MyApp_x64.app + */ + x64AppPath: string; + /** + * Absolute file system path to the arm64 version of your application. E.g. /Foo/bar/MyApp_arm64.app + */ + arm64AppPath: string; + /** + * Absolute file system path you want the universal app to be written to. E.g. /Foo/var/MyApp_universal.app + * + * If this file exists it will be overwritten ONLY if "force" is set to true + */ + outAppPath: string; + /** + * Forcefully overwrite any existing files that are in the way of generating the universal application + */ + force: boolean; + /** + * Merge x64 and arm64 ASARs into one. + */ + mergeASARs?: boolean; + /** + * Minimatch pattern of paths that are allowed to be present in one of the ASAR files, but not in the other. + */ + singleArchFiles?: string; +}; +export declare const makeUniversalApp: (opts: MakeUniversalOpts) => Promise; +export {}; diff --git a/client/node_modules/@electron/universal/dist/cjs/index.js b/client/node_modules/@electron/universal/dist/cjs/index.js new file mode 100644 index 0000000000..8f6fb1accb --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/index.js @@ -0,0 +1,216 @@ +"use strict"; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeUniversalApp = void 0; +const cross_spawn_promise_1 = require("@malept/cross-spawn-promise"); +const asar = require("asar"); +const fs = require("fs-extra"); +const os = require("os"); +const path = require("path"); +const plist = require("plist"); +const dircompare = require("dir-compare"); +const file_utils_1 = require("./file-utils"); +const asar_utils_1 = require("./asar-utils"); +const sha_1 = require("./sha"); +const debug_1 = require("./debug"); +const dupedFiles = (files) => files.filter((f) => f.type !== file_utils_1.AppFileType.SNAPSHOT && f.type !== file_utils_1.AppFileType.APP_CODE); +exports.makeUniversalApp = async (opts) => { + debug_1.d('making a universal app with options', opts); + if (process.platform !== 'darwin') + throw new Error('@electron/universal is only supported on darwin platforms'); + if (!opts.x64AppPath || !path.isAbsolute(opts.x64AppPath)) + throw new Error('Expected opts.x64AppPath to be an absolute path but it was not'); + if (!opts.arm64AppPath || !path.isAbsolute(opts.arm64AppPath)) + throw new Error('Expected opts.arm64AppPath to be an absolute path but it was not'); + if (!opts.outAppPath || !path.isAbsolute(opts.outAppPath)) + throw new Error('Expected opts.outAppPath to be an absolute path but it was not'); + if (await fs.pathExists(opts.outAppPath)) { + debug_1.d('output path exists already'); + if (!opts.force) { + throw new Error(`The out path "${opts.outAppPath}" already exists and force is not set to true`); + } + else { + debug_1.d('overwriting existing application because force == true'); + await fs.remove(opts.outAppPath); + } + } + const x64AsarMode = await asar_utils_1.detectAsarMode(opts.x64AppPath); + const arm64AsarMode = await asar_utils_1.detectAsarMode(opts.arm64AppPath); + debug_1.d('detected x64AsarMode =', x64AsarMode); + debug_1.d('detected arm64AsarMode =', arm64AsarMode); + if (x64AsarMode !== arm64AsarMode) + throw new Error('Both the x64 and arm64 versions of your application need to have been built with the same asar settings (enabled vs disabled)'); + const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-universal-')); + debug_1.d('building universal app in', tmpDir); + try { + debug_1.d('copying x64 app as starter template'); + const tmpApp = path.resolve(tmpDir, 'Tmp.app'); + await cross_spawn_promise_1.spawn('cp', ['-R', opts.x64AppPath, tmpApp]); + const uniqueToX64 = []; + const uniqueToArm64 = []; + const x64Files = await file_utils_1.getAllAppFiles(await fs.realpath(tmpApp)); + const arm64Files = await file_utils_1.getAllAppFiles(await fs.realpath(opts.arm64AppPath)); + for (const file of dupedFiles(x64Files)) { + if (!arm64Files.some((f) => f.relativePath === file.relativePath)) + uniqueToX64.push(file.relativePath); + } + for (const file of dupedFiles(arm64Files)) { + if (!x64Files.some((f) => f.relativePath === file.relativePath)) + uniqueToArm64.push(file.relativePath); + } + if (uniqueToX64.length !== 0 || uniqueToArm64.length !== 0) { + debug_1.d('some files were not in both builds, aborting'); + console.error({ + uniqueToX64, + uniqueToArm64, + }); + throw new Error('While trying to merge mach-o files across your apps we found a mismatch, the number of mach-o files is not the same between the arm64 and x64 builds'); + } + for (const file of x64Files.filter((f) => f.type === file_utils_1.AppFileType.PLAIN)) { + const x64Sha = await sha_1.sha(path.resolve(opts.x64AppPath, file.relativePath)); + const arm64Sha = await sha_1.sha(path.resolve(opts.arm64AppPath, file.relativePath)); + if (x64Sha !== arm64Sha) { + debug_1.d('SHA for file', file.relativePath, `does not match across builds ${x64Sha}!=${arm64Sha}`); + // The MainMenu.nib files generated by Xcode13 are deterministic in effect but not deterministic in generated sequence + if (path.basename(path.dirname(file.relativePath)) === 'MainMenu.nib') { + // The mismatch here is OK so we just move on to the next one + continue; + } + throw new Error(`Expected all non-binary files to have identical SHAs when creating a universal build but "${file.relativePath}" did not`); + } + } + for (const machOFile of x64Files.filter((f) => f.type === file_utils_1.AppFileType.MACHO)) { + const first = await fs.realpath(path.resolve(tmpApp, machOFile.relativePath)); + const second = await fs.realpath(path.resolve(opts.arm64AppPath, machOFile.relativePath)); + debug_1.d('joining two MachO files with lipo', { + first, + second, + }); + await cross_spawn_promise_1.spawn('lipo', [ + first, + second, + '-create', + '-output', + await fs.realpath(path.resolve(tmpApp, machOFile.relativePath)), + ]); + } + /** + * If we don't have an ASAR we need to check if the two "app" folders are identical, if + * they are then we can just leave one there and call it a day. If the app folders for x64 + * and arm64 are different though we need to rename each folder and create a new fake "app" + * entrypoint to dynamically load the correct app folder + */ + if (x64AsarMode === asar_utils_1.AsarMode.NO_ASAR) { + debug_1.d('checking if the x64 and arm64 app folders are identical'); + const comparison = await dircompare.compare(path.resolve(tmpApp, 'Contents', 'Resources', 'app'), path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app'), { compareSize: true, compareContent: true }); + if (!comparison.same) { + debug_1.d('x64 and arm64 app folders are different, creating dynamic entry ASAR'); + await fs.move(path.resolve(tmpApp, 'Contents', 'Resources', 'app'), path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64')); + await fs.copy(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app'), path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64')); + const entryAsar = path.resolve(tmpDir, 'entry-asar'); + await fs.mkdir(entryAsar); + await fs.copy(path.resolve(__dirname, '..', '..', 'entry-asar', 'no-asar.js'), path.resolve(entryAsar, 'index.js')); + let pj = await fs.readJson(path.resolve(opts.x64AppPath, 'Contents', 'Resources', 'app', 'package.json')); + pj.main = 'index.js'; + await fs.writeJson(path.resolve(entryAsar, 'package.json'), pj); + await asar.createPackage(entryAsar, path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + } + else { + debug_1.d('x64 and arm64 app folders are the same'); + } + } + const generatedIntegrity = {}; + let didSplitAsar = false; + /** + * If we have an ASAR we just need to check if the two "app.asar" files have the same hash, + * if they are, same as above, we can leave one there and call it a day. If they're different + * we have to make a dynamic entrypoint. There is an assumption made here that every file in + * app.asar.unpacked is a native node module. This assumption _may_ not be true so we should + * look at codifying that assumption as actual logic. + */ + // FIXME: Codify the assumption that app.asar.unpacked only contains native modules + if (x64AsarMode === asar_utils_1.AsarMode.HAS_ASAR && opts.mergeASARs) { + debug_1.d('merging x64 and arm64 asars'); + const output = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'); + await asar_utils_1.mergeASARs({ + x64AsarPath: path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'), + arm64AsarPath: path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar'), + outputAsarPath: output, + singleArchFiles: opts.singleArchFiles, + }); + generatedIntegrity['Resources/app.asar'] = asar_utils_1.generateAsarIntegrity(output); + } + else if (x64AsarMode === asar_utils_1.AsarMode.HAS_ASAR) { + debug_1.d('checking if the x64 and arm64 asars are identical'); + const x64AsarSha = await sha_1.sha(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + const arm64AsarSha = await sha_1.sha(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar')); + if (x64AsarSha !== arm64AsarSha) { + didSplitAsar = true; + debug_1.d('x64 and arm64 asars are different'); + const x64AsarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64.asar'); + await fs.move(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'), x64AsarPath); + const x64Unpacked = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar.unpacked'); + if (await fs.pathExists(x64Unpacked)) { + await fs.move(x64Unpacked, path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64.asar.unpacked')); + } + const arm64AsarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64.asar'); + await fs.copy(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar'), arm64AsarPath); + const arm64Unpacked = path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar.unpacked'); + if (await fs.pathExists(arm64Unpacked)) { + await fs.copy(arm64Unpacked, path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64.asar.unpacked')); + } + const entryAsar = path.resolve(tmpDir, 'entry-asar'); + await fs.mkdir(entryAsar); + await fs.copy(path.resolve(__dirname, '..', '..', 'entry-asar', 'has-asar.js'), path.resolve(entryAsar, 'index.js')); + let pj = JSON.parse((await asar.extractFile(path.resolve(opts.x64AppPath, 'Contents', 'Resources', 'app.asar'), 'package.json')).toString('utf8')); + pj.main = 'index.js'; + await fs.writeJson(path.resolve(entryAsar, 'package.json'), pj); + const asarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'); + await asar.createPackage(entryAsar, asarPath); + generatedIntegrity['Resources/app.asar'] = asar_utils_1.generateAsarIntegrity(asarPath); + generatedIntegrity['Resources/app-x64.asar'] = asar_utils_1.generateAsarIntegrity(x64AsarPath); + generatedIntegrity['Resources/app-arm64.asar'] = asar_utils_1.generateAsarIntegrity(arm64AsarPath); + } + else { + debug_1.d('x64 and arm64 asars are the same'); + generatedIntegrity['Resources/app.asar'] = asar_utils_1.generateAsarIntegrity(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + } + } + const plistFiles = x64Files.filter((f) => f.type === file_utils_1.AppFileType.INFO_PLIST); + for (const plistFile of plistFiles) { + const x64PlistPath = path.resolve(opts.x64AppPath, plistFile.relativePath); + const arm64PlistPath = path.resolve(opts.arm64AppPath, plistFile.relativePath); + const _a = plist.parse(await fs.readFile(x64PlistPath, 'utf8')), { ElectronAsarIntegrity: x64Integrity } = _a, x64Plist = __rest(_a, ["ElectronAsarIntegrity"]); + const _b = plist.parse(await fs.readFile(arm64PlistPath, 'utf8')), { ElectronAsarIntegrity: arm64Integrity } = _b, arm64Plist = __rest(_b, ["ElectronAsarIntegrity"]); + if (JSON.stringify(x64Plist) !== JSON.stringify(arm64Plist)) { + throw new Error(`Expected all Info.plist files to be identical when ignoring integrity when creating a universal build but "${plistFile.relativePath}" was not`); + } + const mergedPlist = Object.assign(Object.assign({}, x64Plist), { ElectronAsarIntegrity: generatedIntegrity }); + await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist)); + } + for (const snapshotsFile of arm64Files.filter((f) => f.type === file_utils_1.AppFileType.SNAPSHOT)) { + debug_1.d('copying snapshot file', snapshotsFile.relativePath, 'to target application'); + await fs.copy(path.resolve(opts.arm64AppPath, snapshotsFile.relativePath), path.resolve(tmpApp, snapshotsFile.relativePath)); + } + debug_1.d('moving final universal app to target destination'); + await fs.mkdirp(path.dirname(opts.outAppPath)); + await cross_spawn_promise_1.spawn('mv', [tmpApp, opts.outAppPath]); + } + catch (err) { + throw err; + } + finally { + await fs.remove(tmpDir); + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/index.js.map b/client/node_modules/@electron/universal/dist/cjs/index.js.map new file mode 100644 index 0000000000..fa7472efeb --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qEAAoD;AACpD,6BAA6B;AAE7B,+BAA+B;AAC/B,yBAAyB;AACzB,6BAA6B;AAC7B,+BAA+B;AAC/B,0CAA0C;AAE1C,6CAAoE;AACpE,6CAA2F;AAC3F,+BAA4B;AAC5B,mCAA4B;AA+B5B,MAAM,UAAU,GAAG,CAAC,KAAgB,EAAE,EAAE,CACtC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,wBAAW,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,wBAAW,CAAC,QAAQ,CAAC,CAAC;AAE7E,QAAA,gBAAgB,GAAG,KAAK,EAAE,IAAuB,EAAiB,EAAE;IAC/E,SAAC,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,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CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/C,MAAM,2BAAK,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,GAAG,CAAC;KACX;YAAS;QACR,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACzB;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/sha.d.ts b/client/node_modules/@electron/universal/dist/cjs/sha.d.ts new file mode 100644 index 0000000000..1c0daaa8b3 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/sha.d.ts @@ -0,0 +1 @@ +export declare const sha: (filePath: string) => Promise; diff --git a/client/node_modules/@electron/universal/dist/cjs/sha.js b/client/node_modules/@electron/universal/dist/cjs/sha.js new file mode 100644 index 0000000000..801fe61b82 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/sha.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha = void 0; +const fs = require("fs-extra"); +const crypto = require("crypto"); +const debug_1 = require("./debug"); +exports.sha = async (filePath) => { + debug_1.d('hashing', filePath); + const hash = crypto.createHash('sha256'); + hash.setEncoding('hex'); + const fileStream = fs.createReadStream(filePath); + fileStream.pipe(hash); + await new Promise((resolve, reject) => { + fileStream.on('end', () => resolve()); + fileStream.on('error', (err) => reject(err)); + }); + return hash.read(); +}; +//# sourceMappingURL=sha.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/cjs/sha.js.map b/client/node_modules/@electron/universal/dist/cjs/sha.js.map new file mode 100644 index 0000000000..3bfffd89ca --- /dev/null +++ b/client/node_modules/@electron/universal/dist/cjs/sha.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha.js","sourceRoot":"","sources":["../../src/sha.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAAiC;AACjC,mCAA4B;AAEf,QAAA,GAAG,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IAC5C,SAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/asar-utils.d.ts b/client/node_modules/@electron/universal/dist/esm/asar-utils.d.ts new file mode 100644 index 0000000000..530b52bd10 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/asar-utils.d.ts @@ -0,0 +1,16 @@ +export declare enum AsarMode { + NO_ASAR = 0, + HAS_ASAR = 1 +} +export declare type MergeASARsOptions = { + x64AsarPath: string; + arm64AsarPath: string; + outputAsarPath: string; + singleArchFiles?: string; +}; +export declare const detectAsarMode: (appPath: string) => Promise; +export declare const generateAsarIntegrity: (asarPath: string) => { + algorithm: "SHA256"; + hash: string; +}; +export declare const mergeASARs: ({ x64AsarPath, arm64AsarPath, outputAsarPath, singleArchFiles, }: MergeASARsOptions) => Promise; diff --git a/client/node_modules/@electron/universal/dist/esm/asar-utils.js b/client/node_modules/@electron/universal/dist/esm/asar-utils.js new file mode 100644 index 0000000000..94bb3bfbe0 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/asar-utils.js @@ -0,0 +1,153 @@ +import * as asar from 'asar'; +import { execFileSync } from 'child_process'; +import * as crypto from 'crypto'; +import * as fs from 'fs-extra'; +import * as path from 'path'; +import * as minimatch from 'minimatch'; +import * as os from 'os'; +import { d } from './debug'; +const LIPO = 'lipo'; +export var AsarMode; +(function (AsarMode) { + AsarMode[AsarMode["NO_ASAR"] = 0] = "NO_ASAR"; + AsarMode[AsarMode["HAS_ASAR"] = 1] = "HAS_ASAR"; +})(AsarMode || (AsarMode = {})); +// See: https://github.com/apple-opensource-mirror/llvmCore/blob/0c60489d96c87140db9a6a14c6e82b15f5e5d252/include/llvm/Object/MachOFormat.h#L108-L112 +const MACHO_MAGIC = new Set([ + // 32-bit Mach-O + 0xfeedface, + 0xcefaedfe, + // 64-bit Mach-O + 0xfeedfacf, + 0xcffaedfe, +]); +export const detectAsarMode = async (appPath) => { + d('checking asar mode of', appPath); + const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar'); + if (!(await fs.pathExists(asarPath))) { + d('determined no asar'); + return AsarMode.NO_ASAR; + } + d('determined has asar'); + return AsarMode.HAS_ASAR; +}; +export const generateAsarIntegrity = (asarPath) => { + return { + algorithm: 'SHA256', + hash: crypto + .createHash('SHA256') + .update(asar.getRawHeader(asarPath).headerString) + .digest('hex'), + }; +}; +function toRelativePath(file) { + return file.replace(/^\//, ''); +} +function isDirectory(a, file) { + return Boolean('files' in asar.statFile(a, file)); +} +function checkSingleArch(archive, file, allowList) { + if (allowList === undefined || !minimatch(file, allowList, { matchBase: true })) { + throw new Error(`Detected unique file "${file}" in "${archive}" not covered by ` + + `allowList rule: "${allowList}"`); + } +} +export const mergeASARs = async ({ x64AsarPath, arm64AsarPath, outputAsarPath, singleArchFiles, }) => { + d(`merging ${x64AsarPath} and ${arm64AsarPath}`); + const x64Files = new Set(asar.listPackage(x64AsarPath).map(toRelativePath)); + const arm64Files = new Set(asar.listPackage(arm64AsarPath).map(toRelativePath)); + // + // Build set of unpacked directories and files + // + const unpackedFiles = new Set(); + function buildUnpacked(a, fileList) { + for (const file of fileList) { + const stat = asar.statFile(a, file); + if (!('unpacked' in stat) || !stat.unpacked) { + continue; + } + if ('files' in stat) { + continue; + } + unpackedFiles.add(file); + } + } + buildUnpacked(x64AsarPath, x64Files); + buildUnpacked(arm64AsarPath, arm64Files); + // + // Build list of files/directories unique to each asar + // + for (const file of x64Files) { + if (!arm64Files.has(file)) { + checkSingleArch(x64AsarPath, file, singleArchFiles); + } + } + const arm64Unique = []; + for (const file of arm64Files) { + if (!x64Files.has(file)) { + checkSingleArch(arm64AsarPath, file, singleArchFiles); + arm64Unique.push(file); + } + } + // + // Find common bindings with different content + // + const commonBindings = []; + for (const file of x64Files) { + if (!arm64Files.has(file)) { + continue; + } + // Skip directories + if (isDirectory(x64AsarPath, file)) { + continue; + } + const x64Content = asar.extractFile(x64AsarPath, file); + const arm64Content = asar.extractFile(arm64AsarPath, file); + if (x64Content.compare(arm64Content) === 0) { + continue; + } + if (!MACHO_MAGIC.has(x64Content.readUInt32LE(0))) { + throw new Error(`Can't reconcile two non-macho files ${file}`); + } + commonBindings.push(file); + } + // + // Extract both + // + const x64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'x64-')); + const arm64Dir = await fs.mkdtemp(path.join(os.tmpdir(), 'arm64-')); + try { + d(`extracting ${x64AsarPath} to ${x64Dir}`); + asar.extractAll(x64AsarPath, x64Dir); + d(`extracting ${arm64AsarPath} to ${arm64Dir}`); + asar.extractAll(arm64AsarPath, arm64Dir); + for (const file of arm64Unique) { + const source = path.resolve(arm64Dir, file); + const destination = path.resolve(x64Dir, file); + if (isDirectory(arm64AsarPath, file)) { + d(`creating unique directory: ${file}`); + await fs.mkdirp(destination); + continue; + } + d(`xopying unique file: ${file}`); + await fs.mkdirp(path.dirname(destination)); + await fs.copy(source, destination); + } + for (const binding of commonBindings) { + const source = await fs.realpath(path.resolve(arm64Dir, binding)); + const destination = await fs.realpath(path.resolve(x64Dir, binding)); + d(`merging binding: ${binding}`); + execFileSync(LIPO, [source, destination, '-create', '-output', destination]); + } + d(`creating archive at ${outputAsarPath}`); + const resolvedUnpack = Array.from(unpackedFiles).map((file) => path.join(x64Dir, file)); + await asar.createPackageWithOptions(x64Dir, outputAsarPath, { + unpack: `{${resolvedUnpack.join(',')}}`, + }); + d('done merging'); + } + finally { + await Promise.all([fs.remove(x64Dir), fs.remove(arm64Dir)]); + } +}; +//# sourceMappingURL=asar-utils.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/asar-utils.js.map b/client/node_modules/@electron/universal/dist/esm/asar-utils.js.map new file mode 100644 index 0000000000..f4342d14f1 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/asar-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asar-utils.js","sourceRoot":"","sources":["../../src/asar-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAE5B,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,6CAAO,CAAA;IACP,+CAAQ,CAAA;AACV,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAUD,qJAAqJ;AACrJ,MAAM,WAAW,GAAG,IAAI,GAAG,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AAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAErE,CAAC,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;YACjC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;SAC9E;QAED,CAAC,CAAC,uBAAuB,cAAc,EAAE,CAAC,CAAC;QAE3C,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAExF,MAAM,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,cAAc,EAAE;YAC1D,MAAM,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG;SACxC,CAAC,CAAC;QAEH,CAAC,CAAC,cAAc,CAAC,CAAC;KACnB;YAAS;QACR,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KAC7D;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/debug.d.ts b/client/node_modules/@electron/universal/dist/esm/debug.d.ts new file mode 100644 index 0000000000..ec24d3b974 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/debug.d.ts @@ -0,0 +1,2 @@ +import * as debug from 'debug'; +export declare const d: debug.Debugger; diff --git a/client/node_modules/@electron/universal/dist/esm/debug.js b/client/node_modules/@electron/universal/dist/esm/debug.js new file mode 100644 index 0000000000..449f78f74f --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/debug.js @@ -0,0 +1,3 @@ +import * as debug from 'debug'; +export const d = debug('electron-universal'); +//# sourceMappingURL=debug.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/debug.js.map b/client/node_modules/@electron/universal/dist/esm/debug.js.map new file mode 100644 index 0000000000..7804bed334 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/debug.js.map @@ -0,0 +1 @@ +{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/file-utils.d.ts b/client/node_modules/@electron/universal/dist/esm/file-utils.d.ts new file mode 100644 index 0000000000..ff08b0e599 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/file-utils.d.ts @@ -0,0 +1,16 @@ +export declare enum AppFileType { + MACHO = 0, + PLAIN = 1, + INFO_PLIST = 2, + SNAPSHOT = 3, + APP_CODE = 4 +} +export declare type AppFile = { + relativePath: string; + type: AppFileType; +}; +/** + * + * @param appPath Path to the application + */ +export declare const getAllAppFiles: (appPath: string) => Promise; diff --git a/client/node_modules/@electron/universal/dist/esm/file-utils.js b/client/node_modules/@electron/universal/dist/esm/file-utils.js new file mode 100644 index 0000000000..68eb4b8693 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/file-utils.js @@ -0,0 +1,68 @@ +import { spawn, ExitCodeError } from '@malept/cross-spawn-promise'; +import * as fs from 'fs-extra'; +import * as path from 'path'; +const MACHO_PREFIX = 'Mach-O '; +export var AppFileType; +(function (AppFileType) { + AppFileType[AppFileType["MACHO"] = 0] = "MACHO"; + AppFileType[AppFileType["PLAIN"] = 1] = "PLAIN"; + AppFileType[AppFileType["INFO_PLIST"] = 2] = "INFO_PLIST"; + AppFileType[AppFileType["SNAPSHOT"] = 3] = "SNAPSHOT"; + AppFileType[AppFileType["APP_CODE"] = 4] = "APP_CODE"; +})(AppFileType || (AppFileType = {})); +/** + * + * @param appPath Path to the application + */ +export const getAllAppFiles = async (appPath) => { + const files = []; + const visited = new Set(); + const traverse = async (p) => { + p = await fs.realpath(p); + if (visited.has(p)) + return; + visited.add(p); + const info = await fs.stat(p); + if (info.isSymbolicLink()) + return; + if (info.isFile()) { + let fileType = AppFileType.PLAIN; + var fileOutput = ''; + try { + fileOutput = await spawn('file', ['--brief', '--no-pad', p]); + } + catch (e) { + if (e instanceof ExitCodeError) { + /* silently accept error codes from "file" */ + } + else { + throw e; + } + } + if (p.includes('app.asar')) { + fileType = AppFileType.APP_CODE; + } + else if (fileOutput.startsWith(MACHO_PREFIX)) { + fileType = AppFileType.MACHO; + } + else if (p.endsWith('.bin')) { + fileType = AppFileType.SNAPSHOT; + } + else if (path.basename(p) === 'Info.plist') { + fileType = AppFileType.INFO_PLIST; + } + files.push({ + relativePath: path.relative(appPath, p), + type: fileType, + }); + } + if (info.isDirectory()) { + for (const child of await fs.readdir(p)) { + await traverse(path.resolve(p, child)); + } + } + }; + await traverse(appPath); + return files; +}; +//# sourceMappingURL=file-utils.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/file-utils.js.map b/client/node_modules/@electron/universal/dist/esm/file-utils.js.map new file mode 100644 index 0000000000..7b095a5137 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/file-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"file-utils.js","sourceRoot":"","sources":["../../src/file-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,+CAAK,CAAA;IACL,+CAAK,CAAA;IACL,yD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AQ,CAAC,MAAM,CAAC,EAAE;gBAC7B,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;aACjC;iBAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE;gBAC5C,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC;aACnC;YAED,KAAK,CAAC,IAAI,CAAC;gBACT,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvC,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;SACJ;QAED,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACvC,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;aACxC;SACF;IACH,CAAC,CAAC;IACF,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/index.d.ts b/client/node_modules/@electron/universal/dist/esm/index.d.ts new file mode 100644 index 0000000000..2983f32bbb --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/index.d.ts @@ -0,0 +1,30 @@ +declare type MakeUniversalOpts = { + /** + * Absolute file system path to the x64 version of your application. E.g. /Foo/bar/MyApp_x64.app + */ + x64AppPath: string; + /** + * Absolute file system path to the arm64 version of your application. E.g. /Foo/bar/MyApp_arm64.app + */ + arm64AppPath: string; + /** + * Absolute file system path you want the universal app to be written to. E.g. /Foo/var/MyApp_universal.app + * + * If this file exists it will be overwritten ONLY if "force" is set to true + */ + outAppPath: string; + /** + * Forcefully overwrite any existing files that are in the way of generating the universal application + */ + force: boolean; + /** + * Merge x64 and arm64 ASARs into one. + */ + mergeASARs?: boolean; + /** + * Minimatch pattern of paths that are allowed to be present in one of the ASAR files, but not in the other. + */ + singleArchFiles?: string; +}; +export declare const makeUniversalApp: (opts: MakeUniversalOpts) => Promise; +export {}; diff --git a/client/node_modules/@electron/universal/dist/esm/index.js b/client/node_modules/@electron/universal/dist/esm/index.js new file mode 100644 index 0000000000..c1c48ab34f --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/index.js @@ -0,0 +1,213 @@ +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +import { spawn } from '@malept/cross-spawn-promise'; +import * as asar from 'asar'; +import * as fs from 'fs-extra'; +import * as os from 'os'; +import * as path from 'path'; +import * as plist from 'plist'; +import * as dircompare from 'dir-compare'; +import { AppFileType, getAllAppFiles } from './file-utils'; +import { AsarMode, detectAsarMode, generateAsarIntegrity, mergeASARs } from './asar-utils'; +import { sha } from './sha'; +import { d } from './debug'; +const dupedFiles = (files) => files.filter((f) => f.type !== AppFileType.SNAPSHOT && f.type !== AppFileType.APP_CODE); +export const makeUniversalApp = async (opts) => { + d('making a universal app with options', opts); + if (process.platform !== 'darwin') + throw new Error('@electron/universal is only supported on darwin platforms'); + if (!opts.x64AppPath || !path.isAbsolute(opts.x64AppPath)) + throw new Error('Expected opts.x64AppPath to be an absolute path but it was not'); + if (!opts.arm64AppPath || !path.isAbsolute(opts.arm64AppPath)) + throw new Error('Expected opts.arm64AppPath to be an absolute path but it was not'); + if (!opts.outAppPath || !path.isAbsolute(opts.outAppPath)) + throw new Error('Expected opts.outAppPath to be an absolute path but it was not'); + if (await fs.pathExists(opts.outAppPath)) { + d('output path exists already'); + if (!opts.force) { + throw new Error(`The out path "${opts.outAppPath}" already exists and force is not set to true`); + } + else { + d('overwriting existing application because force == true'); + await fs.remove(opts.outAppPath); + } + } + const x64AsarMode = await detectAsarMode(opts.x64AppPath); + const arm64AsarMode = await detectAsarMode(opts.arm64AppPath); + d('detected x64AsarMode =', x64AsarMode); + d('detected arm64AsarMode =', arm64AsarMode); + if (x64AsarMode !== arm64AsarMode) + throw new Error('Both the x64 and arm64 versions of your application need to have been built with the same asar settings (enabled vs disabled)'); + const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-universal-')); + d('building universal app in', tmpDir); + try { + d('copying x64 app as starter template'); + const tmpApp = path.resolve(tmpDir, 'Tmp.app'); + await spawn('cp', ['-R', opts.x64AppPath, tmpApp]); + const uniqueToX64 = []; + const uniqueToArm64 = []; + const x64Files = await getAllAppFiles(await fs.realpath(tmpApp)); + const arm64Files = await getAllAppFiles(await fs.realpath(opts.arm64AppPath)); + for (const file of dupedFiles(x64Files)) { + if (!arm64Files.some((f) => f.relativePath === file.relativePath)) + uniqueToX64.push(file.relativePath); + } + for (const file of dupedFiles(arm64Files)) { + if (!x64Files.some((f) => f.relativePath === file.relativePath)) + uniqueToArm64.push(file.relativePath); + } + if (uniqueToX64.length !== 0 || uniqueToArm64.length !== 0) { + d('some files were not in both builds, aborting'); + console.error({ + uniqueToX64, + uniqueToArm64, + }); + throw new Error('While trying to merge mach-o files across your apps we found a mismatch, the number of mach-o files is not the same between the arm64 and x64 builds'); + } + for (const file of x64Files.filter((f) => f.type === AppFileType.PLAIN)) { + const x64Sha = await sha(path.resolve(opts.x64AppPath, file.relativePath)); + const arm64Sha = await sha(path.resolve(opts.arm64AppPath, file.relativePath)); + if (x64Sha !== arm64Sha) { + d('SHA for file', file.relativePath, `does not match across builds ${x64Sha}!=${arm64Sha}`); + // The MainMenu.nib files generated by Xcode13 are deterministic in effect but not deterministic in generated sequence + if (path.basename(path.dirname(file.relativePath)) === 'MainMenu.nib') { + // The mismatch here is OK so we just move on to the next one + continue; + } + throw new Error(`Expected all non-binary files to have identical SHAs when creating a universal build but "${file.relativePath}" did not`); + } + } + for (const machOFile of x64Files.filter((f) => f.type === AppFileType.MACHO)) { + const first = await fs.realpath(path.resolve(tmpApp, machOFile.relativePath)); + const second = await fs.realpath(path.resolve(opts.arm64AppPath, machOFile.relativePath)); + d('joining two MachO files with lipo', { + first, + second, + }); + await spawn('lipo', [ + first, + second, + '-create', + '-output', + await fs.realpath(path.resolve(tmpApp, machOFile.relativePath)), + ]); + } + /** + * If we don't have an ASAR we need to check if the two "app" folders are identical, if + * they are then we can just leave one there and call it a day. If the app folders for x64 + * and arm64 are different though we need to rename each folder and create a new fake "app" + * entrypoint to dynamically load the correct app folder + */ + if (x64AsarMode === AsarMode.NO_ASAR) { + d('checking if the x64 and arm64 app folders are identical'); + const comparison = await dircompare.compare(path.resolve(tmpApp, 'Contents', 'Resources', 'app'), path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app'), { compareSize: true, compareContent: true }); + if (!comparison.same) { + d('x64 and arm64 app folders are different, creating dynamic entry ASAR'); + await fs.move(path.resolve(tmpApp, 'Contents', 'Resources', 'app'), path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64')); + await fs.copy(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app'), path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64')); + const entryAsar = path.resolve(tmpDir, 'entry-asar'); + await fs.mkdir(entryAsar); + await fs.copy(path.resolve(__dirname, '..', '..', 'entry-asar', 'no-asar.js'), path.resolve(entryAsar, 'index.js')); + let pj = await fs.readJson(path.resolve(opts.x64AppPath, 'Contents', 'Resources', 'app', 'package.json')); + pj.main = 'index.js'; + await fs.writeJson(path.resolve(entryAsar, 'package.json'), pj); + await asar.createPackage(entryAsar, path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + } + else { + d('x64 and arm64 app folders are the same'); + } + } + const generatedIntegrity = {}; + let didSplitAsar = false; + /** + * If we have an ASAR we just need to check if the two "app.asar" files have the same hash, + * if they are, same as above, we can leave one there and call it a day. If they're different + * we have to make a dynamic entrypoint. There is an assumption made here that every file in + * app.asar.unpacked is a native node module. This assumption _may_ not be true so we should + * look at codifying that assumption as actual logic. + */ + // FIXME: Codify the assumption that app.asar.unpacked only contains native modules + if (x64AsarMode === AsarMode.HAS_ASAR && opts.mergeASARs) { + d('merging x64 and arm64 asars'); + const output = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'); + await mergeASARs({ + x64AsarPath: path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'), + arm64AsarPath: path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar'), + outputAsarPath: output, + singleArchFiles: opts.singleArchFiles, + }); + generatedIntegrity['Resources/app.asar'] = generateAsarIntegrity(output); + } + else if (x64AsarMode === AsarMode.HAS_ASAR) { + d('checking if the x64 and arm64 asars are identical'); + const x64AsarSha = await sha(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + const arm64AsarSha = await sha(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar')); + if (x64AsarSha !== arm64AsarSha) { + didSplitAsar = true; + d('x64 and arm64 asars are different'); + const x64AsarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64.asar'); + await fs.move(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'), x64AsarPath); + const x64Unpacked = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar.unpacked'); + if (await fs.pathExists(x64Unpacked)) { + await fs.move(x64Unpacked, path.resolve(tmpApp, 'Contents', 'Resources', 'app-x64.asar.unpacked')); + } + const arm64AsarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64.asar'); + await fs.copy(path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar'), arm64AsarPath); + const arm64Unpacked = path.resolve(opts.arm64AppPath, 'Contents', 'Resources', 'app.asar.unpacked'); + if (await fs.pathExists(arm64Unpacked)) { + await fs.copy(arm64Unpacked, path.resolve(tmpApp, 'Contents', 'Resources', 'app-arm64.asar.unpacked')); + } + const entryAsar = path.resolve(tmpDir, 'entry-asar'); + await fs.mkdir(entryAsar); + await fs.copy(path.resolve(__dirname, '..', '..', 'entry-asar', 'has-asar.js'), path.resolve(entryAsar, 'index.js')); + let pj = JSON.parse((await asar.extractFile(path.resolve(opts.x64AppPath, 'Contents', 'Resources', 'app.asar'), 'package.json')).toString('utf8')); + pj.main = 'index.js'; + await fs.writeJson(path.resolve(entryAsar, 'package.json'), pj); + const asarPath = path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar'); + await asar.createPackage(entryAsar, asarPath); + generatedIntegrity['Resources/app.asar'] = generateAsarIntegrity(asarPath); + generatedIntegrity['Resources/app-x64.asar'] = generateAsarIntegrity(x64AsarPath); + generatedIntegrity['Resources/app-arm64.asar'] = generateAsarIntegrity(arm64AsarPath); + } + else { + d('x64 and arm64 asars are the same'); + generatedIntegrity['Resources/app.asar'] = generateAsarIntegrity(path.resolve(tmpApp, 'Contents', 'Resources', 'app.asar')); + } + } + const plistFiles = x64Files.filter((f) => f.type === AppFileType.INFO_PLIST); + for (const plistFile of plistFiles) { + const x64PlistPath = path.resolve(opts.x64AppPath, plistFile.relativePath); + const arm64PlistPath = path.resolve(opts.arm64AppPath, plistFile.relativePath); + const _a = plist.parse(await fs.readFile(x64PlistPath, 'utf8')), { ElectronAsarIntegrity: x64Integrity } = _a, x64Plist = __rest(_a, ["ElectronAsarIntegrity"]); + const _b = plist.parse(await fs.readFile(arm64PlistPath, 'utf8')), { ElectronAsarIntegrity: arm64Integrity } = _b, arm64Plist = __rest(_b, ["ElectronAsarIntegrity"]); + if (JSON.stringify(x64Plist) !== JSON.stringify(arm64Plist)) { + throw new Error(`Expected all Info.plist files to be identical when ignoring integrity when creating a universal build but "${plistFile.relativePath}" was not`); + } + const mergedPlist = Object.assign(Object.assign({}, x64Plist), { ElectronAsarIntegrity: generatedIntegrity }); + await fs.writeFile(path.resolve(tmpApp, plistFile.relativePath), plist.build(mergedPlist)); + } + for (const snapshotsFile of arm64Files.filter((f) => f.type === AppFileType.SNAPSHOT)) { + d('copying snapshot file', snapshotsFile.relativePath, 'to target application'); + await fs.copy(path.resolve(opts.arm64AppPath, snapshotsFile.relativePath), path.resolve(tmpApp, snapshotsFile.relativePath)); + } + d('moving final universal app to target destination'); + await fs.mkdirp(path.dirname(opts.outAppPath)); + await spawn('mv', [tmpApp, opts.outAppPath]); + } + catch (err) { + throw err; + } + finally { + await fs.remove(tmpDir); + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/index.js.map b/client/node_modules/@electron/universal/dist/esm/index.js.map new file mode 100644 index 0000000000..f24454a0d4 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAW,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AA+B5B,MAAM,UAAU,GAAG,CAAC,KAAgB,EAAE,EAAE,CACtC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI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I,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,EAC3D,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CACjD,CAAC;SACH;QAED,CAAC,CAAC,kDAAkD,CAAC,CAAC;QACtD,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;KAC9C;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,GAAG,CAAC;KACX;YAAS;QACR,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;KACzB;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/sha.d.ts b/client/node_modules/@electron/universal/dist/esm/sha.d.ts new file mode 100644 index 0000000000..1c0daaa8b3 --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/sha.d.ts @@ -0,0 +1 @@ +export declare const sha: (filePath: string) => Promise; diff --git a/client/node_modules/@electron/universal/dist/esm/sha.js b/client/node_modules/@electron/universal/dist/esm/sha.js new file mode 100644 index 0000000000..fbc749860a --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/sha.js @@ -0,0 +1,16 @@ +import * as fs from 'fs-extra'; +import * as crypto from 'crypto'; +import { d } from './debug'; +export const sha = async (filePath) => { + d('hashing', filePath); + const hash = crypto.createHash('sha256'); + hash.setEncoding('hex'); + const fileStream = fs.createReadStream(filePath); + fileStream.pipe(hash); + await new Promise((resolve, reject) => { + fileStream.on('end', () => resolve()); + fileStream.on('error', (err) => reject(err)); + }); + return hash.read(); +}; +//# sourceMappingURL=sha.js.map \ No newline at end of file diff --git a/client/node_modules/@electron/universal/dist/esm/sha.js.map b/client/node_modules/@electron/universal/dist/esm/sha.js.map new file mode 100644 index 0000000000..794d90135a --- /dev/null +++ b/client/node_modules/@electron/universal/dist/esm/sha.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha.js","sourceRoot":"","sources":["../../src/sha.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAE5B,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IAC5C,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC,CAAC"} \ No newline at end of file diff --git a/client/node_modules/@electron/universal/entry-asar/has-asar.js b/client/node_modules/@electron/universal/entry-asar/has-asar.js new file mode 100644 index 0000000000..9e37f7dabb --- /dev/null +++ b/client/node_modules/@electron/universal/entry-asar/has-asar.js @@ -0,0 +1,7 @@ +if (process.arch === 'arm64') { + process._archPath = require.resolve('../app-arm64.asar'); +} else { + process._archPath = require.resolve('../app-x64.asar'); +} + +require(process._archPath); diff --git a/client/node_modules/@electron/universal/entry-asar/no-asar.js b/client/node_modules/@electron/universal/entry-asar/no-asar.js new file mode 100644 index 0000000000..5391363b4a --- /dev/null +++ b/client/node_modules/@electron/universal/entry-asar/no-asar.js @@ -0,0 +1,7 @@ +if (process.arch === 'arm64') { + process._archPath = require.resolve('../app-arm64'); +} else { + process._archPath = require.resolve('../app-x64'); +} + +require(process._archPath); diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/CHANGELOG.md b/client/node_modules/@electron/universal/node_modules/fs-extra/CHANGELOG.md new file mode 100644 index 0000000000..225fdcaab5 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/CHANGELOG.md @@ -0,0 +1,902 @@ +9.1.0 / 2021-01-19 +------------------ + +- Add promise support for `fs.rm()` ([#841](https://github.com/jprichardson/node-fs-extra/issues/841), [#860](https://github.com/jprichardson/node-fs-extra/pull/860)) +- Upgrade universalify for performance improvments ([#825](https://github.com/jprichardson/node-fs-extra/pull/825)) + +9.0.1 / 2020-06-03 +------------------ + +- Fix issue with `ensureFile()` when used with Jest on Windows ([#804](https://github.com/jprichardson/node-fs-extra/issues/804), [#805](https://github.com/jprichardson/node-fs-extra/pull/805)) +- Remove unneeded `process.umask()` call ([#791](https://github.com/jprichardson/node-fs-extra/pull/791)) +- Docs improvements ([#753](https://github.com/jprichardson/node-fs-extra/pull/753), [#795](https://github.com/jprichardson/node-fs-extra/pull/795), [#797](https://github.com/jprichardson/node-fs-extra/pull/797)) + +9.0.0 / 2020-03-19 +------------------ + +### Breaking changes + +- Requires Node.js version 10 or greater ([#725](https://github.com/jprichardson/node-fs-extra/issues/725), [#751](https://github.com/jprichardson/node-fs-extra/pull/751)) +- Switched `ensureDir*` to use a fork of https://github.com/sindresorhus/make-dir to make use of native recursive `fs.mkdir` where possible ([#619](https://github.com/jprichardson/node-fs-extra/issues/619), [#756](https://github.com/jprichardson/node-fs-extra/pull/756)) +- Properly preserve `atime` for `copy*` with `preserveTimestamps` option ([#633](https://github.com/jprichardson/node-fs-extra/pull/633)) + +**The following changes, allthough technically breaking, will not affect the vast majority of users:** + +- `outputJson` now outputs objects as they were when the function was called, even if they are mutated later ([#702](https://github.com/jprichardson/node-fs-extra/issues/702), [#768](https://github.com/jprichardson/node-fs-extra/pull/768)) +- Cannot pass `null` as an options parameter to `*Json*` methods ([#745](https://github.com/jprichardson/node-fs-extra/issues/745), [#768](https://github.com/jprichardson/node-fs-extra/pull/768)) + +### Improvements + +- Add promise shims for `fs.writev` & `fs.opendir` ([#747](https://github.com/jprichardson/node-fs-extra/pull/747)) +- Better errors for `ensureFile` ([#696](https://github.com/jprichardson/node-fs-extra/issues/696), [#744](https://github.com/jprichardson/node-fs-extra/pull/744)) +- Better file comparison for older Node versions ([#694](https://github.com/jprichardson/node-fs-extra/pull/694)) + +### Miscellaneous changes +- Peformance optimizations ([#762](https://github.com/jprichardson/node-fs-extra/issues/762), [#764](https://github.com/jprichardson/node-fs-extra/pull/764)) +- Add missing documentation for aliases ([#758](https://github.com/jprichardson/node-fs-extra/issues/758), [#766](https://github.com/jprichardson/node-fs-extra/pull/766)) +- Update `universalify` dependency ([#767](https://github.com/jprichardson/node-fs-extra/pull/767)) + +8.1.0 / 2019-06-28 +------------------ + +- Add support for promisified `fs.realpath.native` in Node v9.2+ ([#650](https://github.com/jprichardson/node-fs-extra/issues/650), [#682](https://github.com/jprichardson/node-fs-extra/pull/682)) +- Update `graceful-fs` dependency ([#700](https://github.com/jprichardson/node-fs-extra/pull/700)) +- Use `graceful-fs` everywhere ([#700](https://github.com/jprichardson/node-fs-extra/pull/700)) + +8.0.1 / 2019-05-13 +------------------ + +- Fix bug `Maximum call stack size exceeded` error in `util/stat` ([#679](https://github.com/jprichardson/node-fs-extra/pull/679)) + +8.0.0 / 2019-05-11 +------------------ + +**NOTE:** Node.js v6 support is deprecated, and will be dropped in the next major release. + +- Use `renameSync()` under the hood in `moveSync()` +- Fix bug with bind-mounted directories in `copy*()` ([#613](https://github.com/jprichardson/node-fs-extra/issues/613), [#618](https://github.com/jprichardson/node-fs-extra/pull/618)) +- Fix bug in `move()` with case-insensitive file systems +- Use `fs.stat()`'s `bigint` option in `copy*()` & `move*()` where possible ([#657](https://github.com/jprichardson/node-fs-extra/issues/657)) + +7.0.1 / 2018-11-07 +------------------ + +- Fix `removeSync()` on Windows, in some cases, it would error out with `ENOTEMPTY` ([#646](https://github.com/jprichardson/node-fs-extra/pull/646)) +- Document `mode` option for `ensureDir*()` ([#587](https://github.com/jprichardson/node-fs-extra/pull/587)) +- Don't include documentation files in npm package tarball ([#642](https://github.com/jprichardson/node-fs-extra/issues/642), [#643](https://github.com/jprichardson/node-fs-extra/pull/643)) + +7.0.0 / 2018-07-16 +------------------ + +- **BREAKING:** Refine `copy*()` handling of symlinks to properly detect symlinks that point to the same file. ([#582](https://github.com/jprichardson/node-fs-extra/pull/582)) +- Fix bug with copying write-protected directories ([#600](https://github.com/jprichardson/node-fs-extra/pull/600)) +- Universalify `fs.lchmod()` ([#596](https://github.com/jprichardson/node-fs-extra/pull/596)) +- Add `engines` field to `package.json` ([#580](https://github.com/jprichardson/node-fs-extra/pull/580)) + +6.0.1 / 2018-05-09 +------------------ + +- Fix `fs.promises` `ExperimentalWarning` on Node v10.1.0 ([#578](https://github.com/jprichardson/node-fs-extra/pull/578)) + +6.0.0 / 2018-05-01 +------------------ + +- Drop support for Node.js versions 4, 5, & 7 ([#564](https://github.com/jprichardson/node-fs-extra/pull/564)) +- Rewrite `move` to use `fs.rename` where possible ([#549](https://github.com/jprichardson/node-fs-extra/pull/549)) +- Don't convert relative paths to absolute paths for `filter` ([#554](https://github.com/jprichardson/node-fs-extra/pull/554)) +- `copy*`'s behavior when `preserveTimestamps` is `false` has been OS-dependent since 5.0.0, but that's now explicitly noted in the docs ([#563](https://github.com/jprichardson/node-fs-extra/pull/563)) +- Fix subdirectory detection for `copy*` & `move*` ([#541](https://github.com/jprichardson/node-fs-extra/pull/541)) +- Handle case-insensitive paths correctly in `copy*` ([#568](https://github.com/jprichardson/node-fs-extra/pull/568)) + +5.0.0 / 2017-12-11 +------------------ + +Significant refactor of `copy()` & `copySync()`, including breaking changes. No changes to other functions in this release. + +Huge thanks to **[@manidlou](https://github.com/manidlou)** for doing most of the work on this release. + +- The `filter` option can no longer be a RegExp (must be a function). This was deprecated since fs-extra v1.0.0. [#512](https://github.com/jprichardson/node-fs-extra/pull/512) +- `copy()`'s `filter` option can now be a function that returns a Promise. [#518](https://github.com/jprichardson/node-fs-extra/pull/518) +- `copy()` & `copySync()` now use `fs.copyFile()`/`fs.copyFileSync()` in environments that support it (currently Node 8.5.0+). Older Node versions still get the old implementation. [#505](https://github.com/jprichardson/node-fs-extra/pull/505) +- Don't allow copying a directory into itself. [#83](https://github.com/jprichardson/node-fs-extra/issues/83) +- Handle copying between identical files. [#198](https://github.com/jprichardson/node-fs-extra/issues/198) +- Error out when copying an empty folder to a path that already exists. [#464](https://github.com/jprichardson/node-fs-extra/issues/464) +- Don't create `dest`'s parent if the `filter` function aborts the `copy()` operation. [#517](https://github.com/jprichardson/node-fs-extra/pull/517) +- Fix `writeStream` not being closed if there was an error in `copy()`. [#516](https://github.com/jprichardson/node-fs-extra/pull/516) + +4.0.3 / 2017-12-05 +------------------ + +- Fix wrong `chmod` values in `fs.remove()` [#501](https://github.com/jprichardson/node-fs-extra/pull/501) +- Fix `TypeError` on systems that don't have some `fs` operations like `lchown` [#520](https://github.com/jprichardson/node-fs-extra/pull/520) + +4.0.2 / 2017-09-12 +------------------ + +- Added `EOL` option to `writeJson*` & `outputJson*` (via upgrade to jsonfile v4) +- Added promise support to [`fs.copyFile()`](https://nodejs.org/api/fs.html#fs_fs_copyfile_src_dest_flags_callback) in Node 8.5+ +- Added `.js` extension to `main` field in `package.json` for better tooling compatibility. [#485](https://github.com/jprichardson/node-fs-extra/pull/485) + +4.0.1 / 2017-07-31 +------------------ + +### Fixed + +- Previously, `ensureFile()` & `ensureFileSync()` would do nothing if the path was a directory. Now, they error out for consistency with `ensureDir()`. [#465](https://github.com/jprichardson/node-fs-extra/issues/465), [#466](https://github.com/jprichardson/node-fs-extra/pull/466), [#470](https://github.com/jprichardson/node-fs-extra/issues/470) + +4.0.0 / 2017-07-14 +------------------ + +### Changed + +- **BREAKING:** The promisified versions of `fs.read()` & `fs.write()` now return objects. See [the docs](docs/fs-read-write.md) for details. [#436](https://github.com/jprichardson/node-fs-extra/issues/436), [#449](https://github.com/jprichardson/node-fs-extra/pull/449) +- `fs.move()` now errors out when destination is a subdirectory of source. [#458](https://github.com/jprichardson/node-fs-extra/pull/458) +- Applied upstream fixes from `rimraf` to `fs.remove()` & `fs.removeSync()`. [#459](https://github.com/jprichardson/node-fs-extra/pull/459) + +### Fixed + +- Got `fs.outputJSONSync()` working again; it was broken due to refactoring. [#428](https://github.com/jprichardson/node-fs-extra/pull/428) + +Also clarified the docs in a few places. + +3.0.1 / 2017-05-04 +------------------ + +- Fix bug in `move()` & `moveSync()` when source and destination are the same, and source does not exist. [#415](https://github.com/jprichardson/node-fs-extra/pull/415) + +3.0.0 / 2017-04-27 +------------------ + +### Added + +- **BREAKING:** Added Promise support. All asynchronous native fs methods and fs-extra methods now return a promise if the callback is not passed. [#403](https://github.com/jprichardson/node-fs-extra/pull/403) +- `pathExists()`, a replacement for the deprecated `fs.exists`. `pathExists` has a normal error-first callback signature. Also added `pathExistsSync`, an alias to `fs.existsSync`, for completeness. [#406](https://github.com/jprichardson/node-fs-extra/pull/406) + +### Removed + +- **BREAKING:** Removed support for setting the default spaces for `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()`. This was undocumented. [#402](https://github.com/jprichardson/node-fs-extra/pull/402) + +### Changed + +- Upgraded jsonfile dependency to v3.0.0: + - **BREAKING:** Changed behavior of `throws` option for `readJsonSync()`; now does not throw filesystem errors when `throws` is `false`. +- **BREAKING:** `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()` now output minified JSON by default for consistency with `JSON.stringify()`; set the `spaces` option to `2` to override this new behavior. [#402](https://github.com/jprichardson/node-fs-extra/pull/402) +- Use `Buffer.allocUnsafe()` instead of `new Buffer()` in environments that support it. [#394](https://github.com/jprichardson/node-fs-extra/pull/394) + +### Fixed + +- `removeSync()` silently failed on Windows in some cases. Now throws an `EBUSY` error. [#408](https://github.com/jprichardson/node-fs-extra/pull/408) + +2.1.2 / 2017-03-16 +------------------ + +### Fixed + +- Weird windows bug that resulted in `ensureDir()`'s callback being called twice in some cases. This bug may have also affected `remove()`. See [#392](https://github.com/jprichardson/node-fs-extra/issues/392), [#393](https://github.com/jprichardson/node-fs-extra/pull/393) + +2.1.1 / 2017-03-15 +------------------ + +### Fixed + +- Reverted [`5597bd`](https://github.com/jprichardson/node-fs-extra/commit/5597bd5b67f7d060f5f5bf26e9635be48330f5d7), this broke compatibility with Node.js versions v4+ but less than `v4.5.0`. +- Remove `Buffer.alloc()` usage in `moveSync()`. + +2.1.0 / 2017-03-15 +------------------ + +Thanks to [Mani Maghsoudlou (@manidlou)](https://github.com/manidlou) & [Jan Peer Stöcklmair (@JPeer264)](https://github.com/JPeer264) for their extraordinary help with this release! + +### Added +- `moveSync()` See [#309], [#381](https://github.com/jprichardson/node-fs-extra/pull/381). ([@manidlou](https://github.com/manidlou)) +- `copy()` and `copySync()`'s `filter` option now gets the destination path passed as the second parameter. [#366](https://github.com/jprichardson/node-fs-extra/pull/366) ([@manidlou](https://github.com/manidlou)) + +### Changed +- Use `Buffer.alloc()` instead of deprecated `new Buffer()` in `copySync()`. [#380](https://github.com/jprichardson/node-fs-extra/pull/380) ([@manidlou](https://github.com/manidlou)) +- Refactored entire codebase to use ES6 features supported by Node.js v4+ [#355](https://github.com/jprichardson/node-fs-extra/issues/355). [(@JPeer264)](https://github.com/JPeer264) +- Refactored docs. ([@manidlou](https://github.com/manidlou)) + +### Fixed + +- `move()` shouldn't error out when source and dest are the same. [#377](https://github.com/jprichardson/node-fs-extra/issues/377), [#378](https://github.com/jprichardson/node-fs-extra/pull/378) ([@jdalton](https://github.com/jdalton)) + +2.0.0 / 2017-01-16 +------------------ + +### Removed +- **BREAKING:** Removed support for Node `v0.12`. The Node foundation stopped officially supporting it +on Jan 1st, 2017. +- **BREAKING:** Remove `walk()` and `walkSync()`. `walkSync()` was only part of `fs-extra` for a little +over two months. Use [klaw](https://github.com/jprichardson/node-klaw) instead of `walk()`, in fact, `walk()` was just +an alias to klaw. For `walkSync()` use [klaw-sync](https://github.com/mawni/node-klaw-sync). See: [#338], [#339] + +### Changed +- **BREAKING:** Renamed `clobber` to `overwrite`. This affects `copy()`, `copySync()`, and `move()`. [#330], [#333] +- Moved docs, to `docs/`. [#340] + +### Fixed +- Apply filters to directories in `copySync()` like in `copy()`. [#324] +- A specific condition when disk is under heavy use, `copy()` can fail. [#326] + + +1.0.0 / 2016-11-01 +------------------ + +After five years of development, we finally have reach the 1.0.0 milestone! Big thanks goes +to [Ryan Zim](https://github.com/RyanZim) for leading the charge on this release! + +### Added +- `walkSync()` + +### Changed +- **BREAKING**: dropped Node v0.10 support. +- disabled `rimaf` globbing, wasn't used. [#280] +- deprecate `copy()/copySync()` option `filter` if it's a `RegExp`. `filter` should now be a function. +- inline `rimraf`. This is temporary and was done because `rimraf` depended upon the beefy `glob` which `fs-extra` does not use. [#300] + +### Fixed +- bug fix proper closing of file handle on `utimesMillis()` [#271] +- proper escaping of files with dollar signs [#291] +- `copySync()` failed if user didn't own file. [#199], [#301] + + +0.30.0 / 2016-04-28 +------------------- +- Brought back Node v0.10 support. I didn't realize there was still demand. Official support will end **2016-10-01**. + +0.29.0 / 2016-04-27 +------------------- +- **BREAKING**: removed support for Node v0.10. If you still want to use Node v0.10, everything should work except for `ensureLink()/ensureSymlink()`. Node v0.12 is still supported but will be dropped in the near future as well. + +0.28.0 / 2016-04-17 +------------------- +- **BREAKING**: removed `createOutputStream()`. Use https://www.npmjs.com/package/create-output-stream. See: [#192][#192] +- `mkdirs()/mkdirsSync()` check for invalid win32 path chars. See: [#209][#209], [#237][#237] +- `mkdirs()/mkdirsSync()` if drive not mounted, error. See: [#93][#93] + +0.27.0 / 2016-04-15 +------------------- +- add `dereference` option to `copySync()`. [#235][#235] + +0.26.7 / 2016-03-16 +------------------- +- fixed `copy()` if source and dest are the same. [#230][#230] + +0.26.6 / 2016-03-15 +------------------- +- fixed if `emptyDir()` does not have a callback: [#229][#229] + +0.26.5 / 2016-01-27 +------------------- +- `copy()` with two arguments (w/o callback) was broken. See: [#215][#215] + +0.26.4 / 2016-01-05 +------------------- +- `copySync()` made `preserveTimestamps` default consistent with `copy()` which is `false`. See: [#208][#208] + +0.26.3 / 2015-12-17 +------------------- +- fixed `copy()` hangup in copying blockDevice / characterDevice / `/dev/null`. See: [#193][#193] + +0.26.2 / 2015-11-02 +------------------- +- fixed `outputJson{Sync}()` spacing adherence to `fs.spaces` + +0.26.1 / 2015-11-02 +------------------- +- fixed `copySync()` when `clogger=true` and the destination is read only. See: [#190][#190] + +0.26.0 / 2015-10-25 +------------------- +- extracted the `walk()` function into its own module [`klaw`](https://github.com/jprichardson/node-klaw). + +0.25.0 / 2015-10-24 +------------------- +- now has a file walker `walk()` + +0.24.0 / 2015-08-28 +------------------- +- removed alias `delete()` and `deleteSync()`. See: [#171][#171] + +0.23.1 / 2015-08-07 +------------------- +- Better handling of errors for `move()` when moving across devices. [#170][#170] +- `ensureSymlink()` and `ensureLink()` should not throw errors if link exists. [#169][#169] + +0.23.0 / 2015-08-06 +------------------- +- added `ensureLink{Sync}()` and `ensureSymlink{Sync}()`. See: [#165][#165] + +0.22.1 / 2015-07-09 +------------------- +- Prevent calling `hasMillisResSync()` on module load. See: [#149][#149]. +Fixes regression that was introduced in `0.21.0`. + +0.22.0 / 2015-07-09 +------------------- +- preserve permissions / ownership in `copy()`. See: [#54][#54] + +0.21.0 / 2015-07-04 +------------------- +- add option to preserve timestamps in `copy()` and `copySync()`. See: [#141][#141] +- updated `graceful-fs@3.x` to `4.x`. This brings in features from `amazing-graceful-fs` (much cleaner code / less hacks) + +0.20.1 / 2015-06-23 +------------------- +- fixed regression caused by latest jsonfile update: See: https://github.com/jprichardson/node-jsonfile/issues/26 + +0.20.0 / 2015-06-19 +------------------- +- removed `jsonfile` aliases with `File` in the name, they weren't documented and probably weren't in use e.g. +this package had both `fs.readJsonFile` and `fs.readJson` that were aliases to each other, now use `fs.readJson`. +- preliminary walker created. Intentionally not documented. If you use it, it will almost certainly change and break your code. +- started moving tests inline +- upgraded to `jsonfile@2.1.0`, can now pass JSON revivers/replacers to `readJson()`, `writeJson()`, `outputJson()` + +0.19.0 / 2015-06-08 +------------------- +- `fs.copy()` had support for Node v0.8, dropped support + +0.18.4 / 2015-05-22 +------------------- +- fixed license field according to this: [#136][#136] and https://github.com/npm/npm/releases/tag/v2.10.0 + +0.18.3 / 2015-05-08 +------------------- +- bugfix: handle `EEXIST` when clobbering on some Linux systems. [#134][#134] + +0.18.2 / 2015-04-17 +------------------- +- bugfix: allow `F_OK` ([#120][#120]) + +0.18.1 / 2015-04-15 +------------------- +- improved windows support for `move()` a bit. https://github.com/jprichardson/node-fs-extra/commit/92838980f25dc2ee4ec46b43ee14d3c4a1d30c1b +- fixed a lot of tests for Windows (appveyor) + +0.18.0 / 2015-03-31 +------------------- +- added `emptyDir()` and `emptyDirSync()` + +0.17.0 / 2015-03-28 +------------------- +- `copySync` added `clobber` option (before always would clobber, now if `clobber` is `false` it throws an error if the destination exists). +**Only works with files at the moment.** +- `createOutputStream()` added. See: [#118][#118] + +0.16.5 / 2015-03-08 +------------------- +- fixed `fs.move` when `clobber` is `true` and destination is a directory, it should clobber. [#114][#114] + +0.16.4 / 2015-03-01 +------------------- +- `fs.mkdirs` fix infinite loop on Windows. See: See https://github.com/substack/node-mkdirp/pull/74 and https://github.com/substack/node-mkdirp/issues/66 + +0.16.3 / 2015-01-28 +------------------- +- reverted https://github.com/jprichardson/node-fs-extra/commit/1ee77c8a805eba5b99382a2591ff99667847c9c9 + + +0.16.2 / 2015-01-28 +------------------- +- fixed `fs.copy` for Node v0.8 (support is temporary and will be removed in the near future) + +0.16.1 / 2015-01-28 +------------------- +- if `setImmediate` is not available, fall back to `process.nextTick` + +0.16.0 / 2015-01-28 +------------------- +- bugfix `fs.move()` into itself. Closes [#104] +- bugfix `fs.move()` moving directory across device. Closes [#108] +- added coveralls support +- bugfix: nasty multiple callback `fs.copy()` bug. Closes [#98] +- misc fs.copy code cleanups + +0.15.0 / 2015-01-21 +------------------- +- dropped `ncp`, imported code in +- because of previous, now supports `io.js` +- `graceful-fs` is now a dependency + +0.14.0 / 2015-01-05 +------------------- +- changed `copy`/`copySync` from `fs.copy(src, dest, [filters], callback)` to `fs.copy(src, dest, [options], callback)` [#100][#100] +- removed mockfs tests for mkdirp (this may be temporary, but was getting in the way of other tests) + +0.13.0 / 2014-12-10 +------------------- +- removed `touch` and `touchSync` methods (they didn't handle permissions like UNIX touch) +- updated `"ncp": "^0.6.0"` to `"ncp": "^1.0.1"` +- imported `mkdirp` => `minimist` and `mkdirp` are no longer dependences, should now appease people who wanted `mkdirp` to be `--use_strict` safe. See [#59]([#59][#59]) + +0.12.0 / 2014-09-22 +------------------- +- copy symlinks in `copySync()` [#85][#85] + +0.11.1 / 2014-09-02 +------------------- +- bugfix `copySync()` preserve file permissions [#80][#80] + +0.11.0 / 2014-08-11 +------------------- +- upgraded `"ncp": "^0.5.1"` to `"ncp": "^0.6.0"` +- upgrade `jsonfile": "^1.2.0"` to `jsonfile": "^2.0.0"` => on write, json files now have `\n` at end. Also adds `options.throws` to `readJsonSync()` +see https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options for more details. + +0.10.0 / 2014-06-29 +------------------ +* bugfix: upgaded `"jsonfile": "~1.1.0"` to `"jsonfile": "^1.2.0"`, bumped minor because of `jsonfile` dep change +from `~` to `^`. [#67] + +0.9.1 / 2014-05-22 +------------------ +* removed Node.js `0.8.x` support, `0.9.0` was published moments ago and should have been done there + +0.9.0 / 2014-05-22 +------------------ +* upgraded `ncp` from `~0.4.2` to `^0.5.1`, [#58] +* upgraded `rimraf` from `~2.2.6` to `^2.2.8` +* upgraded `mkdirp` from `0.3.x` to `^0.5.0` +* added methods `ensureFile()`, `ensureFileSync()` +* added methods `ensureDir()`, `ensureDirSync()` [#31] +* added `move()` method. From: https://github.com/andrewrk/node-mv + + +0.8.1 / 2013-10-24 +------------------ +* copy failed to return an error to the callback if a file doesn't exist (ulikoehler [#38], [#39]) + +0.8.0 / 2013-10-14 +------------------ +* `filter` implemented on `copy()` and `copySync()`. (Srirangan / [#36]) + +0.7.1 / 2013-10-12 +------------------ +* `copySync()` implemented (Srirangan / [#33]) +* updated to the latest `jsonfile` version `1.1.0` which gives `options` params for the JSON methods. Closes [#32] + +0.7.0 / 2013-10-07 +------------------ +* update readme conventions +* `copy()` now works if destination directory does not exist. Closes [#29] + +0.6.4 / 2013-09-05 +------------------ +* changed `homepage` field in package.json to remove NPM warning + +0.6.3 / 2013-06-28 +------------------ +* changed JSON spacing default from `4` to `2` to follow Node conventions +* updated `jsonfile` dep +* updated `rimraf` dep + +0.6.2 / 2013-06-28 +------------------ +* added .npmignore, [#25] + +0.6.1 / 2013-05-14 +------------------ +* modified for `strict` mode, closes [#24] +* added `outputJson()/outputJsonSync()`, closes [#23] + +0.6.0 / 2013-03-18 +------------------ +* removed node 0.6 support +* added node 0.10 support +* upgraded to latest `ncp` and `rimraf`. +* optional `graceful-fs` support. Closes [#17] + + +0.5.0 / 2013-02-03 +------------------ +* Removed `readTextFile`. +* Renamed `readJSONFile` to `readJSON` and `readJson`, same with write. +* Restructured documentation a bit. Added roadmap. + +0.4.0 / 2013-01-28 +------------------ +* Set default spaces in `jsonfile` from 4 to 2. +* Updated `testutil` deps for tests. +* Renamed `touch()` to `createFile()` +* Added `outputFile()` and `outputFileSync()` +* Changed creation of testing diretories so the /tmp dir is not littered. +* Added `readTextFile()` and `readTextFileSync()`. + +0.3.2 / 2012-11-01 +------------------ +* Added `touch()` and `touchSync()` methods. + +0.3.1 / 2012-10-11 +------------------ +* Fixed some stray globals. + +0.3.0 / 2012-10-09 +------------------ +* Removed all CoffeeScript from tests. +* Renamed `mkdir` to `mkdirs`/`mkdirp`. + +0.2.1 / 2012-09-11 +------------------ +* Updated `rimraf` dep. + +0.2.0 / 2012-09-10 +------------------ +* Rewrote module into JavaScript. (Must still rewrite tests into JavaScript) +* Added all methods of [jsonfile](https://github.com/jprichardson/node-jsonfile) +* Added Travis-CI. + +0.1.3 / 2012-08-13 +------------------ +* Added method `readJSONFile`. + +0.1.2 / 2012-06-15 +------------------ +* Bug fix: `deleteSync()` didn't exist. +* Verified Node v0.8 compatibility. + +0.1.1 / 2012-06-15 +------------------ +* Fixed bug in `remove()`/`delete()` that wouldn't execute the function if a callback wasn't passed. + +0.1.0 / 2012-05-31 +------------------ +* Renamed `copyFile()` to `copy()`. `copy()` can now copy directories (recursively) too. +* Renamed `rmrf()` to `remove()`. +* `remove()` aliased with `delete()`. +* Added `mkdirp` capabilities. Named: `mkdir()`. Hides Node.js native `mkdir()`. +* Instead of exporting the native `fs` module with new functions, I now copy over the native methods to a new object and export that instead. + +0.0.4 / 2012-03-14 +------------------ +* Removed CoffeeScript dependency + +0.0.3 / 2012-01-11 +------------------ +* Added methods rmrf and rmrfSync +* Moved tests from Jasmine to Mocha + + +[#344]: https://github.com/jprichardson/node-fs-extra/issues/344 "Licence Year" +[#343]: https://github.com/jprichardson/node-fs-extra/pull/343 "Add klaw-sync link to readme" +[#342]: https://github.com/jprichardson/node-fs-extra/pull/342 "allow preserveTimestamps when use move" +[#341]: https://github.com/jprichardson/node-fs-extra/issues/341 "mkdirp(path.dirname(dest) in move() logic needs cleaning up [question]" +[#340]: https://github.com/jprichardson/node-fs-extra/pull/340 "Move docs to seperate docs folder [documentation]" +[#339]: https://github.com/jprichardson/node-fs-extra/pull/339 "Remove walk() & walkSync() [feature-walk]" +[#338]: https://github.com/jprichardson/node-fs-extra/issues/338 "Remove walk() and walkSync() [feature-walk]" +[#337]: https://github.com/jprichardson/node-fs-extra/issues/337 "copy doesn't return a yieldable value" +[#336]: https://github.com/jprichardson/node-fs-extra/pull/336 "Docs enhanced walk sync [documentation, feature-walk]" +[#335]: https://github.com/jprichardson/node-fs-extra/pull/335 "Refactor move() tests [feature-move]" +[#334]: https://github.com/jprichardson/node-fs-extra/pull/334 "Cleanup lib/move/index.js [feature-move]" +[#333]: https://github.com/jprichardson/node-fs-extra/pull/333 "Rename clobber to overwrite [feature-copy, feature-move]" +[#332]: https://github.com/jprichardson/node-fs-extra/pull/332 "BREAKING: Drop Node v0.12 & io.js support" +[#331]: https://github.com/jprichardson/node-fs-extra/issues/331 "Add support for chmodr [enhancement, future]" +[#330]: https://github.com/jprichardson/node-fs-extra/pull/330 "BREAKING: Do not error when copy destination exists & clobber: false [feature-copy]" +[#329]: https://github.com/jprichardson/node-fs-extra/issues/329 "Does .walk() scale to large directories? [question]" +[#328]: https://github.com/jprichardson/node-fs-extra/issues/328 "Copying files corrupts [feature-copy, needs-confirmed]" +[#327]: https://github.com/jprichardson/node-fs-extra/pull/327 "Use writeStream 'finish' event instead of 'close' [bug, feature-copy]" +[#326]: https://github.com/jprichardson/node-fs-extra/issues/326 "fs.copy fails with chmod error when disk under heavy use [bug, feature-copy]" +[#325]: https://github.com/jprichardson/node-fs-extra/issues/325 "ensureDir is difficult to promisify [enhancement]" +[#324]: https://github.com/jprichardson/node-fs-extra/pull/324 "copySync() should apply filter to directories like copy() [bug, feature-copy]" +[#323]: https://github.com/jprichardson/node-fs-extra/issues/323 "Support for `dest` being a directory when using `copy*()`?" +[#322]: https://github.com/jprichardson/node-fs-extra/pull/322 "Add fs-promise as fs-extra-promise alternative" +[#321]: https://github.com/jprichardson/node-fs-extra/issues/321 "fs.copy() with clobber set to false return EEXIST error [feature-copy]" +[#320]: https://github.com/jprichardson/node-fs-extra/issues/320 "fs.copySync: Error: EPERM: operation not permitted, unlink " +[#319]: https://github.com/jprichardson/node-fs-extra/issues/319 "Create directory if not exists" +[#318]: https://github.com/jprichardson/node-fs-extra/issues/318 "Support glob patterns [enhancement, future]" +[#317]: https://github.com/jprichardson/node-fs-extra/pull/317 "Adding copy sync test for src file without write perms" +[#316]: https://github.com/jprichardson/node-fs-extra/pull/316 "Remove move()'s broken limit option [feature-move]" +[#315]: https://github.com/jprichardson/node-fs-extra/pull/315 "Fix move clobber tests to work around graceful-fs bug." +[#314]: https://github.com/jprichardson/node-fs-extra/issues/314 "move() limit option [documentation, enhancement, feature-move]" +[#313]: https://github.com/jprichardson/node-fs-extra/pull/313 "Test that remove() ignores glob characters." +[#312]: https://github.com/jprichardson/node-fs-extra/pull/312 "Enhance walkSync() to return items with path and stats [feature-walk]" +[#311]: https://github.com/jprichardson/node-fs-extra/issues/311 "move() not work when dest name not provided [feature-move]" +[#310]: https://github.com/jprichardson/node-fs-extra/issues/310 "Edit walkSync to return items like what walk emits [documentation, enhancement, feature-walk]" +[#309]: https://github.com/jprichardson/node-fs-extra/issues/309 "moveSync support [enhancement, feature-move]" +[#308]: https://github.com/jprichardson/node-fs-extra/pull/308 "Fix incorrect anchor link" +[#307]: https://github.com/jprichardson/node-fs-extra/pull/307 "Fix coverage" +[#306]: https://github.com/jprichardson/node-fs-extra/pull/306 "Update devDeps, fix lint error" +[#305]: https://github.com/jprichardson/node-fs-extra/pull/305 "Re-add Coveralls" +[#304]: https://github.com/jprichardson/node-fs-extra/pull/304 "Remove path-is-absolute [enhancement]" +[#303]: https://github.com/jprichardson/node-fs-extra/pull/303 "Document copySync filter inconsistency [documentation, feature-copy]" +[#302]: https://github.com/jprichardson/node-fs-extra/pull/302 "fix(console): depreciated -> deprecated" +[#301]: https://github.com/jprichardson/node-fs-extra/pull/301 "Remove chmod call from copySync [feature-copy]" +[#300]: https://github.com/jprichardson/node-fs-extra/pull/300 "Inline Rimraf [enhancement, feature-move, feature-remove]" +[#299]: https://github.com/jprichardson/node-fs-extra/pull/299 "Warn when filter is a RegExp [feature-copy]" +[#298]: https://github.com/jprichardson/node-fs-extra/issues/298 "API Docs [documentation]" +[#297]: https://github.com/jprichardson/node-fs-extra/pull/297 "Warn about using preserveTimestamps on 32-bit node" +[#296]: https://github.com/jprichardson/node-fs-extra/pull/296 "Improve EEXIST error message for copySync [enhancement]" +[#295]: https://github.com/jprichardson/node-fs-extra/pull/295 "Depreciate using regular expressions for copy's filter option [documentation]" +[#294]: https://github.com/jprichardson/node-fs-extra/pull/294 "BREAKING: Refactor lib/copy/ncp.js [feature-copy]" +[#293]: https://github.com/jprichardson/node-fs-extra/pull/293 "Update CI configs" +[#292]: https://github.com/jprichardson/node-fs-extra/issues/292 "Rewrite lib/copy/ncp.js [enhancement, feature-copy]" +[#291]: https://github.com/jprichardson/node-fs-extra/pull/291 "Escape '$' in replacement string for async file copying" +[#290]: https://github.com/jprichardson/node-fs-extra/issues/290 "Exclude files pattern while copying using copy.config.js [question]" +[#289]: https://github.com/jprichardson/node-fs-extra/pull/289 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" +[#288]: https://github.com/jprichardson/node-fs-extra/pull/288 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" +[#287]: https://github.com/jprichardson/node-fs-extra/issues/287 "emptyDir() callback arguments are inconsistent [enhancement, feature-remove]" +[#286]: https://github.com/jprichardson/node-fs-extra/pull/286 "Added walkSync function" +[#285]: https://github.com/jprichardson/node-fs-extra/issues/285 "CITGM test failing on s390" +[#284]: https://github.com/jprichardson/node-fs-extra/issues/284 "outputFile method is missing a check to determine if existing item is a folder or not" +[#283]: https://github.com/jprichardson/node-fs-extra/pull/283 "Apply filter also on directories and symlinks for copySync()" +[#282]: https://github.com/jprichardson/node-fs-extra/pull/282 "Apply filter also on directories and symlinks for copySync()" +[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes 'successfully' but doesn't do anything?" +[#280]: https://github.com/jprichardson/node-fs-extra/pull/280 "Disable rimraf globbing" +[#279]: https://github.com/jprichardson/node-fs-extra/issues/279 "Some code is vendored instead of included [awaiting-reply]" +[#278]: https://github.com/jprichardson/node-fs-extra/issues/278 "copy() does not preserve file/directory ownership" +[#277]: https://github.com/jprichardson/node-fs-extra/pull/277 "Mention defaults for clobber and dereference options" +[#276]: https://github.com/jprichardson/node-fs-extra/issues/276 "Cannot connect to Shared Folder [awaiting-reply]" +[#275]: https://github.com/jprichardson/node-fs-extra/issues/275 "EMFILE, too many open files on Mac OS with JSON API" +[#274]: https://github.com/jprichardson/node-fs-extra/issues/274 "Use with memory-fs? [enhancement, future]" +[#273]: https://github.com/jprichardson/node-fs-extra/pull/273 "tests: rename `remote.test.js` to `remove.test.js`" +[#272]: https://github.com/jprichardson/node-fs-extra/issues/272 "Copy clobber flag never err even when true [bug, feature-copy]" +[#271]: https://github.com/jprichardson/node-fs-extra/issues/271 "Unclosed file handle on futimes error" +[#270]: https://github.com/jprichardson/node-fs-extra/issues/270 "copy not working as desired on Windows [feature-copy, platform-windows]" +[#269]: https://github.com/jprichardson/node-fs-extra/issues/269 "Copying with preserveTimeStamps: true is inaccurate using 32bit node [feature-copy]" +[#268]: https://github.com/jprichardson/node-fs-extra/pull/268 "port fix for mkdirp issue #111" +[#267]: https://github.com/jprichardson/node-fs-extra/issues/267 "WARN deprecated wrench@1.5.9: wrench.js is deprecated!" +[#266]: https://github.com/jprichardson/node-fs-extra/issues/266 "fs-extra" +[#265]: https://github.com/jprichardson/node-fs-extra/issues/265 "Link the `fs.stat fs.exists` etc. methods for replace the `fs` module forever?" +[#264]: https://github.com/jprichardson/node-fs-extra/issues/264 "Renaming a file using move fails when a file inside is open (at least on windows) [wont-fix]" +[#263]: https://github.com/jprichardson/node-fs-extra/issues/263 "ENOSYS: function not implemented, link [needs-confirmed]" +[#262]: https://github.com/jprichardson/node-fs-extra/issues/262 "Add .exists() and .existsSync()" +[#261]: https://github.com/jprichardson/node-fs-extra/issues/261 "Cannot read property 'prototype' of undefined" +[#260]: https://github.com/jprichardson/node-fs-extra/pull/260 "use more specific path for method require" +[#259]: https://github.com/jprichardson/node-fs-extra/issues/259 "Feature Request: isEmpty" +[#258]: https://github.com/jprichardson/node-fs-extra/issues/258 "copy files does not preserve file timestamp" +[#257]: https://github.com/jprichardson/node-fs-extra/issues/257 "Copying a file on windows fails" +[#256]: https://github.com/jprichardson/node-fs-extra/pull/256 "Updated Readme " +[#255]: https://github.com/jprichardson/node-fs-extra/issues/255 "Update rimraf required version" +[#254]: https://github.com/jprichardson/node-fs-extra/issues/254 "request for readTree, readTreeSync, walkSync method" +[#253]: https://github.com/jprichardson/node-fs-extra/issues/253 "outputFile does not touch mtime when file exists" +[#252]: https://github.com/jprichardson/node-fs-extra/pull/252 "Fixing problem when copying file with no write permission" +[#251]: https://github.com/jprichardson/node-fs-extra/issues/251 "Just wanted to say thank you" +[#250]: https://github.com/jprichardson/node-fs-extra/issues/250 "`fs.remove()` not removing files (works with `rm -rf`)" +[#249]: https://github.com/jprichardson/node-fs-extra/issues/249 "Just a Question ... Remove Servers" +[#248]: https://github.com/jprichardson/node-fs-extra/issues/248 "Allow option to not preserve permissions for copy" +[#247]: https://github.com/jprichardson/node-fs-extra/issues/247 "Add TypeScript typing directly in the fs-extra package" +[#246]: https://github.com/jprichardson/node-fs-extra/issues/246 "fse.remove() && fse.removeSync() don't throw error on ENOENT file" +[#245]: https://github.com/jprichardson/node-fs-extra/issues/245 "filter for empty dir [enhancement]" +[#244]: https://github.com/jprichardson/node-fs-extra/issues/244 "copySync doesn't apply the filter to directories" +[#243]: https://github.com/jprichardson/node-fs-extra/issues/243 "Can I request fs.walk() to be synchronous?" +[#242]: https://github.com/jprichardson/node-fs-extra/issues/242 "Accidentally truncates file names ending with $$ [bug, feature-copy]" +[#241]: https://github.com/jprichardson/node-fs-extra/pull/241 "Remove link to createOutputStream" +[#240]: https://github.com/jprichardson/node-fs-extra/issues/240 "walkSync request" +[#239]: https://github.com/jprichardson/node-fs-extra/issues/239 "Depreciate regular expressions for copy's filter [documentation, feature-copy]" +[#238]: https://github.com/jprichardson/node-fs-extra/issues/238 "Can't write to files while in a worker thread." +[#237]: https://github.com/jprichardson/node-fs-extra/issues/237 ".ensureDir(..) fails silently when passed an invalid path..." +[#236]: https://github.com/jprichardson/node-fs-extra/issues/236 "[Removed] Filed under wrong repo" +[#235]: https://github.com/jprichardson/node-fs-extra/pull/235 "Adds symlink dereference option to `fse.copySync` (#191)" +[#234]: https://github.com/jprichardson/node-fs-extra/issues/234 "ensureDirSync fails silent when EACCES: permission denied on travis-ci" +[#233]: https://github.com/jprichardson/node-fs-extra/issues/233 "please make sure the first argument in callback is error object [feature-copy]" +[#232]: https://github.com/jprichardson/node-fs-extra/issues/232 "Copy a folder content to its child folder. " +[#231]: https://github.com/jprichardson/node-fs-extra/issues/231 "Adding read/write/output functions for YAML" +[#230]: https://github.com/jprichardson/node-fs-extra/pull/230 "throw error if src and dest are the same to avoid zeroing out + test" +[#229]: https://github.com/jprichardson/node-fs-extra/pull/229 "fix 'TypeError: callback is not a function' in emptyDir" +[#228]: https://github.com/jprichardson/node-fs-extra/pull/228 "Throw error when target is empty so file is not accidentally zeroed out" +[#227]: https://github.com/jprichardson/node-fs-extra/issues/227 "Uncatchable errors when there are invalid arguments [feature-move]" +[#226]: https://github.com/jprichardson/node-fs-extra/issues/226 "Moving to the current directory" +[#225]: https://github.com/jprichardson/node-fs-extra/issues/225 "EBUSY: resource busy or locked, unlink" +[#224]: https://github.com/jprichardson/node-fs-extra/issues/224 "fse.copy ENOENT error" +[#223]: https://github.com/jprichardson/node-fs-extra/issues/223 "Suspicious behavior of fs.existsSync" +[#222]: https://github.com/jprichardson/node-fs-extra/pull/222 "A clearer description of emtpyDir function" +[#221]: https://github.com/jprichardson/node-fs-extra/pull/221 "Update README.md" +[#220]: https://github.com/jprichardson/node-fs-extra/pull/220 "Non-breaking feature: add option 'passStats' to copy methods." +[#219]: https://github.com/jprichardson/node-fs-extra/pull/219 "Add closing parenthesis in copySync example" +[#218]: https://github.com/jprichardson/node-fs-extra/pull/218 "fix #187 #70 options.filter bug" +[#217]: https://github.com/jprichardson/node-fs-extra/pull/217 "fix #187 #70 options.filter bug" +[#216]: https://github.com/jprichardson/node-fs-extra/pull/216 "fix #187 #70 options.filter bug" +[#215]: https://github.com/jprichardson/node-fs-extra/pull/215 "fse.copy throws error when only src and dest provided [bug, documentation, feature-copy]" +[#214]: https://github.com/jprichardson/node-fs-extra/pull/214 "Fixing copySync anchor tag" +[#213]: https://github.com/jprichardson/node-fs-extra/issues/213 "Merge extfs with this repo" +[#212]: https://github.com/jprichardson/node-fs-extra/pull/212 "Update year to 2016 in README.md and LICENSE" +[#211]: https://github.com/jprichardson/node-fs-extra/issues/211 "Not copying all files" +[#210]: https://github.com/jprichardson/node-fs-extra/issues/210 "copy/copySync behave differently when copying a symbolic file [bug, documentation, feature-copy]" +[#209]: https://github.com/jprichardson/node-fs-extra/issues/209 "In Windows invalid directory name causes infinite loop in ensureDir(). [bug]" +[#208]: https://github.com/jprichardson/node-fs-extra/pull/208 "fix options.preserveTimestamps to false in copy-sync by default [feature-copy]" +[#207]: https://github.com/jprichardson/node-fs-extra/issues/207 "Add `compare` suite of functions" +[#206]: https://github.com/jprichardson/node-fs-extra/issues/206 "outputFileSync" +[#205]: https://github.com/jprichardson/node-fs-extra/issues/205 "fix documents about copy/copySync [documentation, feature-copy]" +[#204]: https://github.com/jprichardson/node-fs-extra/pull/204 "allow copy of block and character device files" +[#203]: https://github.com/jprichardson/node-fs-extra/issues/203 "copy method's argument options couldn't be undefined [bug, feature-copy]" +[#202]: https://github.com/jprichardson/node-fs-extra/issues/202 "why there is not a walkSync method?" +[#201]: https://github.com/jprichardson/node-fs-extra/issues/201 "clobber for directories [feature-copy, future]" +[#200]: https://github.com/jprichardson/node-fs-extra/issues/200 "'copySync' doesn't work in sync" +[#199]: https://github.com/jprichardson/node-fs-extra/issues/199 "fs.copySync fails if user does not own file [bug, feature-copy]" +[#198]: https://github.com/jprichardson/node-fs-extra/issues/198 "handle copying between identical files [feature-copy]" +[#197]: https://github.com/jprichardson/node-fs-extra/issues/197 "Missing documentation for `outputFile` `options` 3rd parameter [documentation]" +[#196]: https://github.com/jprichardson/node-fs-extra/issues/196 "copy filter: async function and/or function called with `fs.stat` result [future]" +[#195]: https://github.com/jprichardson/node-fs-extra/issues/195 "How to override with outputFile?" +[#194]: https://github.com/jprichardson/node-fs-extra/pull/194 "allow ensureFile(Sync) to provide data to be written to created file" +[#193]: https://github.com/jprichardson/node-fs-extra/issues/193 "`fs.copy` fails silently if source file is /dev/null [bug, feature-copy]" +[#192]: https://github.com/jprichardson/node-fs-extra/issues/192 "Remove fs.createOutputStream()" +[#191]: https://github.com/jprichardson/node-fs-extra/issues/191 "How to copy symlinks to target as normal folders [feature-copy]" +[#190]: https://github.com/jprichardson/node-fs-extra/pull/190 "copySync to overwrite destination file if readonly and clobber true" +[#189]: https://github.com/jprichardson/node-fs-extra/pull/189 "move.test fix to support CRLF on Windows" +[#188]: https://github.com/jprichardson/node-fs-extra/issues/188 "move.test failing on windows platform" +[#187]: https://github.com/jprichardson/node-fs-extra/issues/187 "Not filter each file, stops on first false [feature-copy]" +[#186]: https://github.com/jprichardson/node-fs-extra/issues/186 "Do you need a .size() function in this module? [future]" +[#185]: https://github.com/jprichardson/node-fs-extra/issues/185 "Doesn't work on NodeJS v4.x" +[#184]: https://github.com/jprichardson/node-fs-extra/issues/184 "CLI equivalent for fs-extra" +[#183]: https://github.com/jprichardson/node-fs-extra/issues/183 "with clobber true, copy and copySync behave differently if destination file is read only [bug, feature-copy]" +[#182]: https://github.com/jprichardson/node-fs-extra/issues/182 "ensureDir(dir, callback) second callback parameter not specified" +[#181]: https://github.com/jprichardson/node-fs-extra/issues/181 "Add ability to remove file securely [enhancement, wont-fix]" +[#180]: https://github.com/jprichardson/node-fs-extra/issues/180 "Filter option doesn't work the same way in copy and copySync [bug, feature-copy]" +[#179]: https://github.com/jprichardson/node-fs-extra/issues/179 "Include opendir" +[#178]: https://github.com/jprichardson/node-fs-extra/issues/178 "ENOTEMPTY is thrown on removeSync " +[#177]: https://github.com/jprichardson/node-fs-extra/issues/177 "fix `remove()` wildcards (introduced by rimraf) [feature-remove]" +[#176]: https://github.com/jprichardson/node-fs-extra/issues/176 "createOutputStream doesn't emit 'end' event" +[#175]: https://github.com/jprichardson/node-fs-extra/issues/175 "[Feature Request].moveSync support [feature-move, future]" +[#174]: https://github.com/jprichardson/node-fs-extra/pull/174 "Fix copy formatting and document options.filter" +[#173]: https://github.com/jprichardson/node-fs-extra/issues/173 "Feature Request: writeJson should mkdirs" +[#172]: https://github.com/jprichardson/node-fs-extra/issues/172 "rename `clobber` flags to `overwrite`" +[#171]: https://github.com/jprichardson/node-fs-extra/issues/171 "remove unnecessary aliases" +[#170]: https://github.com/jprichardson/node-fs-extra/pull/170 "More robust handling of errors moving across virtual drives" +[#169]: https://github.com/jprichardson/node-fs-extra/pull/169 "suppress ensureLink & ensureSymlink dest exists error" +[#168]: https://github.com/jprichardson/node-fs-extra/pull/168 "suppress ensurelink dest exists error" +[#167]: https://github.com/jprichardson/node-fs-extra/pull/167 "Adds basic (string, buffer) support for ensureFile content [future]" +[#166]: https://github.com/jprichardson/node-fs-extra/pull/166 "Adds basic (string, buffer) support for ensureFile content" +[#165]: https://github.com/jprichardson/node-fs-extra/pull/165 "ensure for link & symlink" +[#164]: https://github.com/jprichardson/node-fs-extra/issues/164 "Feature Request: ensureFile to take optional argument for file content" +[#163]: https://github.com/jprichardson/node-fs-extra/issues/163 "ouputJson not formatted out of the box [bug]" +[#162]: https://github.com/jprichardson/node-fs-extra/pull/162 "ensure symlink & link" +[#161]: https://github.com/jprichardson/node-fs-extra/pull/161 "ensure symlink & link" +[#160]: https://github.com/jprichardson/node-fs-extra/pull/160 "ensure symlink & link" +[#159]: https://github.com/jprichardson/node-fs-extra/pull/159 "ensure symlink & link" +[#158]: https://github.com/jprichardson/node-fs-extra/issues/158 "Feature Request: ensureLink and ensureSymlink methods" +[#157]: https://github.com/jprichardson/node-fs-extra/issues/157 "writeJson isn't formatted" +[#156]: https://github.com/jprichardson/node-fs-extra/issues/156 "Promise.promisifyAll doesn't work for some methods" +[#155]: https://github.com/jprichardson/node-fs-extra/issues/155 "Readme" +[#154]: https://github.com/jprichardson/node-fs-extra/issues/154 "/tmp/millis-test-sync" +[#153]: https://github.com/jprichardson/node-fs-extra/pull/153 "Make preserveTimes also work on read-only files. Closes #152" +[#152]: https://github.com/jprichardson/node-fs-extra/issues/152 "fs.copy fails for read-only files with preserveTimestamp=true [feature-copy]" +[#151]: https://github.com/jprichardson/node-fs-extra/issues/151 "TOC does not work correctly on npm [documentation]" +[#150]: https://github.com/jprichardson/node-fs-extra/issues/150 "Remove test file fixtures, create with code." +[#149]: https://github.com/jprichardson/node-fs-extra/issues/149 "/tmp/millis-test-sync" +[#148]: https://github.com/jprichardson/node-fs-extra/issues/148 "split out `Sync` methods in documentation" +[#147]: https://github.com/jprichardson/node-fs-extra/issues/147 "Adding rmdirIfEmpty" +[#146]: https://github.com/jprichardson/node-fs-extra/pull/146 "ensure test.js works" +[#145]: https://github.com/jprichardson/node-fs-extra/issues/145 "Add `fs.exists` and `fs.existsSync` if it doesn't exist." +[#144]: https://github.com/jprichardson/node-fs-extra/issues/144 "tests failing" +[#143]: https://github.com/jprichardson/node-fs-extra/issues/143 "update graceful-fs" +[#142]: https://github.com/jprichardson/node-fs-extra/issues/142 "PrependFile Feature" +[#141]: https://github.com/jprichardson/node-fs-extra/pull/141 "Add option to preserve timestamps" +[#140]: https://github.com/jprichardson/node-fs-extra/issues/140 "Json file reading fails with 'utf8'" +[#139]: https://github.com/jprichardson/node-fs-extra/pull/139 "Preserve file timestamp on copy. Closes #138" +[#138]: https://github.com/jprichardson/node-fs-extra/issues/138 "Preserve timestamps on copying files" +[#137]: https://github.com/jprichardson/node-fs-extra/issues/137 "outputFile/outputJson: Unexpected end of input" +[#136]: https://github.com/jprichardson/node-fs-extra/pull/136 "Update license attribute" +[#135]: https://github.com/jprichardson/node-fs-extra/issues/135 "emptyDir throws Error if no callback is provided" +[#134]: https://github.com/jprichardson/node-fs-extra/pull/134 "Handle EEXIST error when clobbering dir" +[#133]: https://github.com/jprichardson/node-fs-extra/pull/133 "Travis runs with `sudo: false`" +[#132]: https://github.com/jprichardson/node-fs-extra/pull/132 "isDirectory method" +[#131]: https://github.com/jprichardson/node-fs-extra/issues/131 "copySync is not working iojs 1.8.4 on linux [feature-copy]" +[#130]: https://github.com/jprichardson/node-fs-extra/pull/130 "Please review additional features." +[#129]: https://github.com/jprichardson/node-fs-extra/pull/129 "can you review this feature?" +[#128]: https://github.com/jprichardson/node-fs-extra/issues/128 "fsExtra.move(filepath, newPath) broken;" +[#127]: https://github.com/jprichardson/node-fs-extra/issues/127 "consider using fs.access to remove deprecated warnings for fs.exists" +[#126]: https://github.com/jprichardson/node-fs-extra/issues/126 " TypeError: Object # has no method 'access'" +[#125]: https://github.com/jprichardson/node-fs-extra/issues/125 "Question: What do the *Sync function do different from non-sync" +[#124]: https://github.com/jprichardson/node-fs-extra/issues/124 "move with clobber option 'ENOTEMPTY'" +[#123]: https://github.com/jprichardson/node-fs-extra/issues/123 "Only copy the content of a directory" +[#122]: https://github.com/jprichardson/node-fs-extra/pull/122 "Update section links in README to match current section ids." +[#121]: https://github.com/jprichardson/node-fs-extra/issues/121 "emptyDir is undefined" +[#120]: https://github.com/jprichardson/node-fs-extra/issues/120 "usage bug caused by shallow cloning methods of 'graceful-fs'" +[#119]: https://github.com/jprichardson/node-fs-extra/issues/119 "mkdirs and ensureDir never invoke callback and consume CPU indefinitely if provided a path with invalid characters on Windows" +[#118]: https://github.com/jprichardson/node-fs-extra/pull/118 "createOutputStream" +[#117]: https://github.com/jprichardson/node-fs-extra/pull/117 "Fixed issue with slash separated paths on windows" +[#116]: https://github.com/jprichardson/node-fs-extra/issues/116 "copySync can only copy directories not files [documentation, feature-copy]" +[#115]: https://github.com/jprichardson/node-fs-extra/issues/115 ".Copy & .CopySync [feature-copy]" +[#114]: https://github.com/jprichardson/node-fs-extra/issues/114 "Fails to move (rename) directory to non-empty directory even with clobber: true" +[#113]: https://github.com/jprichardson/node-fs-extra/issues/113 "fs.copy seems to callback early if the destination file already exists" +[#112]: https://github.com/jprichardson/node-fs-extra/pull/112 "Copying a file into an existing directory" +[#111]: https://github.com/jprichardson/node-fs-extra/pull/111 "Moving a file into an existing directory " +[#110]: https://github.com/jprichardson/node-fs-extra/pull/110 "Moving a file into an existing directory" +[#109]: https://github.com/jprichardson/node-fs-extra/issues/109 "fs.move across windows drives fails" +[#108]: https://github.com/jprichardson/node-fs-extra/issues/108 "fse.move directories across multiple devices doesn't work" +[#107]: https://github.com/jprichardson/node-fs-extra/pull/107 "Check if dest path is an existing dir and copy or move source in it" +[#106]: https://github.com/jprichardson/node-fs-extra/issues/106 "fse.copySync crashes while copying across devices D: [feature-copy]" +[#105]: https://github.com/jprichardson/node-fs-extra/issues/105 "fs.copy hangs on iojs" +[#104]: https://github.com/jprichardson/node-fs-extra/issues/104 "fse.move deletes folders [bug]" +[#103]: https://github.com/jprichardson/node-fs-extra/issues/103 "Error: EMFILE with copy" +[#102]: https://github.com/jprichardson/node-fs-extra/issues/102 "touch / touchSync was removed ?" +[#101]: https://github.com/jprichardson/node-fs-extra/issues/101 "fs-extra promisified" +[#100]: https://github.com/jprichardson/node-fs-extra/pull/100 "copy: options object or filter to pass to ncp" +[#99]: https://github.com/jprichardson/node-fs-extra/issues/99 "ensureDir() modes [future]" +[#98]: https://github.com/jprichardson/node-fs-extra/issues/98 "fs.copy() incorrect async behavior [bug]" +[#97]: https://github.com/jprichardson/node-fs-extra/pull/97 "use path.join; fix copySync bug" +[#96]: https://github.com/jprichardson/node-fs-extra/issues/96 "destFolderExists in copySync is always undefined." +[#95]: https://github.com/jprichardson/node-fs-extra/pull/95 "Using graceful-ncp instead of ncp" +[#94]: https://github.com/jprichardson/node-fs-extra/issues/94 "Error: EEXIST, file already exists '../mkdirp/bin/cmd.js' on fs.copySync() [enhancement, feature-copy]" +[#93]: https://github.com/jprichardson/node-fs-extra/issues/93 "Confusing error if drive not mounted [enhancement]" +[#92]: https://github.com/jprichardson/node-fs-extra/issues/92 "Problems with Bluebird" +[#91]: https://github.com/jprichardson/node-fs-extra/issues/91 "fs.copySync('/test', '/haha') is different with 'cp -r /test /haha' [enhancement]" +[#90]: https://github.com/jprichardson/node-fs-extra/issues/90 "Folder creation and file copy is Happening in 64 bit machine but not in 32 bit machine" +[#89]: https://github.com/jprichardson/node-fs-extra/issues/89 "Error: EEXIST using fs-extra's fs.copy to copy a directory on Windows" +[#88]: https://github.com/jprichardson/node-fs-extra/issues/88 "Stacking those libraries" +[#87]: https://github.com/jprichardson/node-fs-extra/issues/87 "createWriteStream + outputFile = ?" +[#86]: https://github.com/jprichardson/node-fs-extra/issues/86 "no moveSync?" +[#85]: https://github.com/jprichardson/node-fs-extra/pull/85 "Copy symlinks in copySync" +[#84]: https://github.com/jprichardson/node-fs-extra/issues/84 "Push latest version to npm ?" +[#83]: https://github.com/jprichardson/node-fs-extra/issues/83 "Prevent copying a directory into itself [feature-copy]" +[#82]: https://github.com/jprichardson/node-fs-extra/pull/82 "README updates for move" +[#81]: https://github.com/jprichardson/node-fs-extra/issues/81 "fd leak after fs.move" +[#80]: https://github.com/jprichardson/node-fs-extra/pull/80 "Preserve file mode in copySync" +[#79]: https://github.com/jprichardson/node-fs-extra/issues/79 "fs.copy only .html file empty" +[#78]: https://github.com/jprichardson/node-fs-extra/pull/78 "copySync was not applying filters to directories" +[#77]: https://github.com/jprichardson/node-fs-extra/issues/77 "Create README reference to bluebird" +[#76]: https://github.com/jprichardson/node-fs-extra/issues/76 "Create README reference to typescript" +[#75]: https://github.com/jprichardson/node-fs-extra/issues/75 "add glob as a dep? [question]" +[#74]: https://github.com/jprichardson/node-fs-extra/pull/74 "including new emptydir module" +[#73]: https://github.com/jprichardson/node-fs-extra/pull/73 "add dependency status in readme" +[#72]: https://github.com/jprichardson/node-fs-extra/pull/72 "Use svg instead of png to get better image quality" +[#71]: https://github.com/jprichardson/node-fs-extra/issues/71 "fse.copy not working on Windows 7 x64 OS, but, copySync does work" +[#70]: https://github.com/jprichardson/node-fs-extra/issues/70 "Not filter each file, stops on first false [bug]" +[#69]: https://github.com/jprichardson/node-fs-extra/issues/69 "How to check if folder exist and read the folder name" +[#68]: https://github.com/jprichardson/node-fs-extra/issues/68 "consider flag to readJsonSync (throw false) [enhancement]" +[#67]: https://github.com/jprichardson/node-fs-extra/issues/67 "docs for readJson incorrectly states that is accepts options" +[#66]: https://github.com/jprichardson/node-fs-extra/issues/66 "ENAMETOOLONG" +[#65]: https://github.com/jprichardson/node-fs-extra/issues/65 "exclude filter in fs.copy" +[#64]: https://github.com/jprichardson/node-fs-extra/issues/64 "Announce: mfs - monitor your fs-extra calls" +[#63]: https://github.com/jprichardson/node-fs-extra/issues/63 "Walk" +[#62]: https://github.com/jprichardson/node-fs-extra/issues/62 "npm install fs-extra doesn't work" +[#61]: https://github.com/jprichardson/node-fs-extra/issues/61 "No longer supports node 0.8 due to use of `^` in package.json dependencies" +[#60]: https://github.com/jprichardson/node-fs-extra/issues/60 "chmod & chown for mkdirs" +[#59]: https://github.com/jprichardson/node-fs-extra/issues/59 "Consider including mkdirp and making fs-extra '--use_strict' safe [question]" +[#58]: https://github.com/jprichardson/node-fs-extra/issues/58 "Stack trace not included in fs.copy error" +[#57]: https://github.com/jprichardson/node-fs-extra/issues/57 "Possible to include wildcards in delete?" +[#56]: https://github.com/jprichardson/node-fs-extra/issues/56 "Crash when have no access to write to destination file in copy " +[#55]: https://github.com/jprichardson/node-fs-extra/issues/55 "Is it possible to have any console output similar to Grunt copy module?" +[#54]: https://github.com/jprichardson/node-fs-extra/issues/54 "`copy` does not preserve file ownership and permissons" +[#53]: https://github.com/jprichardson/node-fs-extra/issues/53 "outputFile() - ability to write data in appending mode" +[#52]: https://github.com/jprichardson/node-fs-extra/pull/52 "This fixes (what I think) is a bug in copySync" +[#51]: https://github.com/jprichardson/node-fs-extra/pull/51 "Add a Bitdeli Badge to README" +[#50]: https://github.com/jprichardson/node-fs-extra/issues/50 "Replace mechanism in createFile" +[#49]: https://github.com/jprichardson/node-fs-extra/pull/49 "update rimraf to v2.2.6" +[#48]: https://github.com/jprichardson/node-fs-extra/issues/48 "fs.copy issue [bug]" +[#47]: https://github.com/jprichardson/node-fs-extra/issues/47 "Bug in copy - callback called on readStream 'close' - Fixed in ncp 0.5.0" +[#46]: https://github.com/jprichardson/node-fs-extra/pull/46 "update copyright year" +[#45]: https://github.com/jprichardson/node-fs-extra/pull/45 "Added note about fse.outputFile() being the one that overwrites" +[#44]: https://github.com/jprichardson/node-fs-extra/pull/44 "Proposal: Stream support" +[#43]: https://github.com/jprichardson/node-fs-extra/issues/43 "Better error reporting " +[#42]: https://github.com/jprichardson/node-fs-extra/issues/42 "Performance issue?" +[#41]: https://github.com/jprichardson/node-fs-extra/pull/41 "There does seem to be a synchronous version now" +[#40]: https://github.com/jprichardson/node-fs-extra/issues/40 "fs.copy throw unexplained error ENOENT, utime " +[#39]: https://github.com/jprichardson/node-fs-extra/pull/39 "Added regression test for copy() return callback on error" +[#38]: https://github.com/jprichardson/node-fs-extra/pull/38 "Return err in copy() fstat cb, because stat could be undefined or null" +[#37]: https://github.com/jprichardson/node-fs-extra/issues/37 "Maybe include a line reader? [enhancement, question]" +[#36]: https://github.com/jprichardson/node-fs-extra/pull/36 "`filter` parameter `fs.copy` and `fs.copySync`" +[#35]: https://github.com/jprichardson/node-fs-extra/pull/35 "`filter` parameter `fs.copy` and `fs.copySync` " +[#34]: https://github.com/jprichardson/node-fs-extra/issues/34 "update docs to include options for JSON methods [enhancement]" +[#33]: https://github.com/jprichardson/node-fs-extra/pull/33 "fs_extra.copySync" +[#32]: https://github.com/jprichardson/node-fs-extra/issues/32 "update to latest jsonfile [enhancement]" +[#31]: https://github.com/jprichardson/node-fs-extra/issues/31 "Add ensure methods [enhancement]" +[#30]: https://github.com/jprichardson/node-fs-extra/issues/30 "update package.json optional dep `graceful-fs`" +[#29]: https://github.com/jprichardson/node-fs-extra/issues/29 "Copy failing if dest directory doesn't exist. Is this intended?" +[#28]: https://github.com/jprichardson/node-fs-extra/issues/28 "homepage field must be a string url. Deleted." +[#27]: https://github.com/jprichardson/node-fs-extra/issues/27 "Update Readme" +[#26]: https://github.com/jprichardson/node-fs-extra/issues/26 "Add readdir recursive method. [enhancement]" +[#25]: https://github.com/jprichardson/node-fs-extra/pull/25 "adding an `.npmignore` file" +[#24]: https://github.com/jprichardson/node-fs-extra/issues/24 "[bug] cannot run in strict mode [bug]" +[#23]: https://github.com/jprichardson/node-fs-extra/issues/23 "`writeJSON()` should create parent directories" +[#22]: https://github.com/jprichardson/node-fs-extra/pull/22 "Add a limit option to mkdirs()" +[#21]: https://github.com/jprichardson/node-fs-extra/issues/21 "touch() in 0.10.0" +[#20]: https://github.com/jprichardson/node-fs-extra/issues/20 "fs.remove yields callback before directory is really deleted" +[#19]: https://github.com/jprichardson/node-fs-extra/issues/19 "fs.copy err is empty array" +[#18]: https://github.com/jprichardson/node-fs-extra/pull/18 "Exposed copyFile Function" +[#17]: https://github.com/jprichardson/node-fs-extra/issues/17 "Use `require('graceful-fs')` if found instead of `require('fs')`" +[#16]: https://github.com/jprichardson/node-fs-extra/pull/16 "Update README.md" +[#15]: https://github.com/jprichardson/node-fs-extra/issues/15 "Implement cp -r but sync aka copySync. [enhancement]" +[#14]: https://github.com/jprichardson/node-fs-extra/issues/14 "fs.mkdirSync is broken in 0.3.1" +[#13]: https://github.com/jprichardson/node-fs-extra/issues/13 "Thoughts on including a directory tree / file watcher? [enhancement, question]" +[#12]: https://github.com/jprichardson/node-fs-extra/issues/12 "copyFile & copyFileSync are global" +[#11]: https://github.com/jprichardson/node-fs-extra/issues/11 "Thoughts on including a file walker? [enhancement, question]" +[#10]: https://github.com/jprichardson/node-fs-extra/issues/10 "move / moveFile API [enhancement]" +[#9]: https://github.com/jprichardson/node-fs-extra/issues/9 "don't import normal fs stuff into fs-extra" +[#8]: https://github.com/jprichardson/node-fs-extra/pull/8 "Update rimraf to latest version" +[#6]: https://github.com/jprichardson/node-fs-extra/issues/6 "Remove CoffeeScript development dependency" +[#5]: https://github.com/jprichardson/node-fs-extra/issues/5 "comments on naming" +[#4]: https://github.com/jprichardson/node-fs-extra/issues/4 "version bump to 0.2" +[#3]: https://github.com/jprichardson/node-fs-extra/pull/3 "Hi! I fixed some code for you!" +[#2]: https://github.com/jprichardson/node-fs-extra/issues/2 "Merge with fs.extra and mkdirp" +[#1]: https://github.com/jprichardson/node-fs-extra/issues/1 "file-extra npm !exist" diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/LICENSE b/client/node_modules/@electron/universal/node_modules/fs-extra/LICENSE new file mode 100644 index 0000000000..93546dfb76 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2017 JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/README.md b/client/node_modules/@electron/universal/node_modules/fs-extra/README.md new file mode 100644 index 0000000000..b4a5370b4a --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/README.md @@ -0,0 +1,264 @@ +Node.js: fs-extra +================= + +`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`. + +[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![License](https://img.shields.io/npm/l/express.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE) +[![build status](https://img.shields.io/travis/jprichardson/node-fs-extra/master.svg)](http://travis-ci.org/jprichardson/node-fs-extra) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-fs-extra/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-fs-extra/branch/master) +[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![Coverage Status](https://img.shields.io/coveralls/github/jprichardson/node-fs-extra/master.svg)](https://coveralls.io/github/jprichardson/node-fs-extra) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) + +Why? +---- + +I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects. + + + + +Installation +------------ + + npm install fs-extra + + + +Usage +----- + +`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed. + +You don't ever need to include the original `fs` module again: + +```js +const fs = require('fs') // this is no longer necessary +``` + +you can now do this: + +```js +const fs = require('fs-extra') +``` + +or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want +to name your `fs` variable `fse` like so: + +```js +const fse = require('fs-extra') +``` + +you can also keep both, but it's redundant: + +```js +const fs = require('fs') +const fse = require('fs-extra') +``` + +Sync vs Async vs Async/Await +------------- +Most methods are async by default. All async methods will return a promise if the callback isn't passed. + +Sync methods on the other hand will throw if an error occurs. + +Also Async/Await will throw an error if one occurs. + +Example: + +```js +const fs = require('fs-extra') + +// Async with promises: +fs.copy('/tmp/myfile', '/tmp/mynewfile') + .then(() => console.log('success!')) + .catch(err => console.error(err)) + +// Async with callbacks: +fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { + if (err) return console.error(err) + console.log('success!') +}) + +// Sync: +try { + fs.copySync('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') +} catch (err) { + console.error(err) +} + +// Async/Await: +async function copyFiles () { + try { + await fs.copy('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') + } catch (err) { + console.error(err) + } +} + +copyFiles() +``` + + +Methods +------- + +### Async + +- [copy](docs/copy.md) +- [emptyDir](docs/emptyDir.md) +- [ensureFile](docs/ensureFile.md) +- [ensureDir](docs/ensureDir.md) +- [ensureLink](docs/ensureLink.md) +- [ensureSymlink](docs/ensureSymlink.md) +- [mkdirp](docs/ensureDir.md) +- [mkdirs](docs/ensureDir.md) +- [move](docs/move.md) +- [outputFile](docs/outputFile.md) +- [outputJson](docs/outputJson.md) +- [pathExists](docs/pathExists.md) +- [readJson](docs/readJson.md) +- [remove](docs/remove.md) +- [writeJson](docs/writeJson.md) + +### Sync + +- [copySync](docs/copy-sync.md) +- [emptyDirSync](docs/emptyDir-sync.md) +- [ensureFileSync](docs/ensureFile-sync.md) +- [ensureDirSync](docs/ensureDir-sync.md) +- [ensureLinkSync](docs/ensureLink-sync.md) +- [ensureSymlinkSync](docs/ensureSymlink-sync.md) +- [mkdirpSync](docs/ensureDir-sync.md) +- [mkdirsSync](docs/ensureDir-sync.md) +- [moveSync](docs/move-sync.md) +- [outputFileSync](docs/outputFile-sync.md) +- [outputJsonSync](docs/outputJson-sync.md) +- [pathExistsSync](docs/pathExists-sync.md) +- [readJsonSync](docs/readJson-sync.md) +- [removeSync](docs/remove-sync.md) +- [writeJsonSync](docs/writeJson-sync.md) + + +**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md) + +### What happened to `walk()` and `walkSync()`? + +They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync). + + +Third Party +----------- + +### CLI + +[fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts. + +### TypeScript + +If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra + + +### File / Directory Watching + +If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar). + +### Obtain Filesystem (Devices, Partitions) Information + +[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system. + +### Misc. + +- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug). +- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls. + + + +Hacking on fs-extra +------------------- + +Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project +uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you, +you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +What's needed? +- First, take a look at existing issues. Those are probably going to be where the priority lies. +- More tests for edge cases. Specifically on different platforms. There can never be enough tests. +- Improve test coverage. See coveralls output for more info. + +Note: If you make any big changes, **you should definitely file an issue for discussion first.** + +### Running the Test Suite + +fs-extra contains hundreds of tests. + +- `npm run lint`: runs the linter ([standard](http://standardjs.com/)) +- `npm run unit`: runs the unit tests +- `npm test`: runs both the linter and the tests + + +### Windows + +If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's +because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's +account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 +However, I didn't have much luck doing this. + +Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows. +I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command: + + net use z: "\\vmware-host\Shared Folders" + +I can then navigate to my `fs-extra` directory and run the tests. + + +Naming +------ + +I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here: + +* https://github.com/jprichardson/node-fs-extra/issues/2 +* https://github.com/flatiron/utile/issues/11 +* https://github.com/ryanmcgrath/wrench-js/issues/29 +* https://github.com/substack/node-mkdirp/issues/17 + +First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes. + +For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc. + +We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`? + +My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too. + +So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`. + + +Credit +------ + +`fs-extra` wouldn't be possible without using the modules from the following authors: + +- [Isaac Shlueter](https://github.com/isaacs) +- [Charlie McConnel](https://github.com/avianflu) +- [James Halliday](https://github.com/substack) +- [Andrew Kelley](https://github.com/andrewrk) + + + + +License +------- + +Licensed under MIT + +Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson) + +[1]: http://nodejs.org/docs/latest/api/fs.html + + +[jsonfile]: https://github.com/jprichardson/node-jsonfile diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/copy-sync.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/copy-sync.js new file mode 100644 index 0000000000..31f06e4419 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/copy-sync.js @@ -0,0 +1,166 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirsSync = require('../mkdirs').mkdirsSync +const utimesMillisSync = require('../util/utimes').utimesMillisSync +const stat = require('../util/stat') + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} + +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirsSync(destParent) + return startCopy(destStat, src, dest, opts) +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + fs.copyFileSync(src, dest) + if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest) + return setDestMode(dest, srcStat.mode) +} + +function handleTimestamps (srcMode, src, dest) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode) + return setDestTimestamps(src, dest) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return setDestMode(dest, srcMode | 0o200) +} + +function setDestMode (dest, srcMode) { + return fs.chmodSync(dest, srcMode) +} + +function setDestTimestamps (src, dest) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = fs.statSync(src) + return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcMode, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return setDestMode(dest, srcMode) +} + +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/index.js new file mode 100644 index 0000000000..65945aedb2 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy-sync/index.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = { + copySync: require('./copy-sync') +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/copy.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/copy.js new file mode 100644 index 0000000000..328f1025f9 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/copy.js @@ -0,0 +1,232 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirs = require('../mkdirs').mkdirs +const pathExists = require('../path-exists').pathExists +const utimesMillis = require('../util/utimes').utimesMillis +const stat = require('../util/stat') + +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } + + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) +} + +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirs(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) +} + +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} + +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} + +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + }) +} + +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} + +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} + +function copyFile (srcStat, src, dest, opts, cb) { + fs.copyFile(src, dest, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb) + return setDestMode(dest, srcStat.mode, cb) + }) +} + +function handleTimestampsAndMode (srcMode, src, dest, cb) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) { + return makeFileWritable(dest, srcMode, err => { + if (err) return cb(err) + return setDestTimestampsAndMode(srcMode, src, dest, cb) + }) + } + return setDestTimestampsAndMode(srcMode, src, dest, cb) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode, cb) { + return setDestMode(dest, srcMode | 0o200, cb) +} + +function setDestTimestampsAndMode (srcMode, src, dest, cb) { + setDestTimestamps(src, dest, err => { + if (err) return cb(err) + return setDestMode(dest, srcMode, cb) + }) +} + +function setDestMode (dest, srcMode, cb) { + return fs.chmod(dest, srcMode, cb) +} + +function setDestTimestamps (src, dest, cb) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + fs.stat(src, (err, updatedSrcStat) => { + if (err) return cb(err) + return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb) + }) +} + +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + return copyDir(src, dest, opts, cb) +} + +function mkDirAndCopy (srcMode, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return setDestMode(dest, srcMode, cb) + }) + }) +} + +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} + +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} + +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} + +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} + +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} + +module.exports = copy diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/index.js new file mode 100644 index 0000000000..b7e4f7f8d4 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/copy/index.js @@ -0,0 +1,6 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + copy: u(require('./copy')) +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/empty/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/empty/index.js new file mode 100644 index 0000000000..90fb46991e --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/empty/index.js @@ -0,0 +1,48 @@ +'use strict' + +const u = require('universalify').fromCallback +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const remove = require('../remove') + +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) + + items = items.map(item => path.join(dir, item)) + + deleteItem() + + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) + } + }) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/file.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/file.js new file mode 100644 index 0000000000..15cc473c8a --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/file.js @@ -0,0 +1,69 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } + + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + fs.stat(dir, (err, stats) => { + if (err) { + // if the directory doesn't exist, make it + if (err.code === 'ENOENT') { + return mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + } + return callback(err) + } + + if (stats.isDirectory()) makeFile() + else { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + fs.readdir(dir, err => { + if (err) return callback(err) + }) + } + }) + }) +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch {} + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + try { + if (!fs.statSync(dir).isDirectory()) { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + fs.readdirSync(dir) + } + } catch (err) { + // If the stat call above failed because the directory doesn't exist, create it + if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir) + else throw err + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/index.js new file mode 100644 index 0000000000..c1f67b7187 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/index.js @@ -0,0 +1,23 @@ +'use strict' + +const file = require('./file') +const link = require('./link') +const symlink = require('./symlink') + +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/link.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/link.js new file mode 100644 index 0000000000..2cd419626a --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/link.js @@ -0,0 +1,61 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } + + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} + +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-paths.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-paths.js new file mode 100644 index 0000000000..33cd76000e --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-paths.js @@ -0,0 +1,99 @@ +'use strict' + +const path = require('path') +const fs = require('graceful-fs') +const pathExists = require('../path-exists').pathExists + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + toCwd: srcpath, + toDst: srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + toCwd: relativeToDst, + toDst: srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + toCwd: srcpath, + toDst: srcpath + } + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + exists = fs.existsSync(relativeToDst) + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + } + } else { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('relative srcpath does not exist') + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + } + } + } +} + +module.exports = { + symlinkPaths, + symlinkPathsSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-type.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-type.js new file mode 100644 index 0000000000..42dc0ce753 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink-type.js @@ -0,0 +1,31 @@ +'use strict' + +const fs = require('graceful-fs') + +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} + +function symlinkTypeSync (srcpath, type) { + let stats + + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +module.exports = { + symlinkType, + symlinkTypeSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink.js new file mode 100644 index 0000000000..fe68b79978 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/ensure/symlink.js @@ -0,0 +1,63 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const _mkdirs = require('../mkdirs') +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync + +const _symlinkPaths = require('./symlink-paths') +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + +const _symlinkType = require('./symlink-type') +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync + +const pathExists = require('../path-exists').pathExists + +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} + +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/fs/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/fs/index.js new file mode 100644 index 0000000000..9bbaea4e40 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/fs/index.js @@ -0,0 +1,130 @@ +'use strict' +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = require('universalify').fromCallback +const fs = require('graceful-fs') + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchmod', + 'lchown', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'opendir', + 'readdir', + 'readFile', + 'readlink', + 'realpath', + 'rename', + 'rm', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.opendir was added in Node.js v12.12.0 + // fs.rm was added in Node.js v14.14.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// fs.writev only available in Node v12.9.0+ +if (typeof fs.writev === 'function') { + // Function signature is + // s.writev(fd, buffers[, position], callback) + // We need to handle the optional arg, so we use ...args + exports.writev = function (fd, buffers, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.writev(fd, buffers, ...args) + } + + return new Promise((resolve, reject) => { + fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => { + if (err) return reject(err) + resolve({ bytesWritten, buffers }) + }) + }) + } +} + +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/index.js new file mode 100644 index 0000000000..d9468e699c --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/index.js @@ -0,0 +1,27 @@ +'use strict' + +module.exports = { + // Export promiseified graceful-fs: + ...require('./fs'), + // Export extra methods: + ...require('./copy-sync'), + ...require('./copy'), + ...require('./empty'), + ...require('./ensure'), + ...require('./json'), + ...require('./mkdirs'), + ...require('./move-sync'), + ...require('./move'), + ...require('./output'), + ...require('./path-exists'), + ...require('./remove') +} + +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = require('fs') +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, 'promises', { + get () { return fs.promises } + }) +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/index.js new file mode 100644 index 0000000000..900126ad0b --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/index.js @@ -0,0 +1,16 @@ +'use strict' + +const u = require('universalify').fromPromise +const jsonFile = require('./jsonfile') + +jsonFile.outputJson = u(require('./output-json')) +jsonFile.outputJsonSync = require('./output-json-sync') +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/jsonfile.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/jsonfile.js new file mode 100644 index 0000000000..f11d34d623 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/jsonfile.js @@ -0,0 +1,11 @@ +'use strict' + +const jsonFile = require('jsonfile') + +module.exports = { + // jsonfile exports + readJson: jsonFile.readFile, + readJsonSync: jsonFile.readFileSync, + writeJson: jsonFile.writeFile, + writeJsonSync: jsonFile.writeFileSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json-sync.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json-sync.js new file mode 100644 index 0000000000..f76b4744ce --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json-sync.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFileSync } = require('../output') + +function outputJsonSync (file, data, options) { + const str = stringify(data, options) + + outputFileSync(file, str, options) +} + +module.exports = outputJsonSync diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json.js new file mode 100644 index 0000000000..0fc668977f --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/json/output-json.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFile } = require('../output') + +async function outputJson (file, data, options = {}) { + const str = stringify(data, options) + + await outputFile(file, str, options) +} + +module.exports = outputJson diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/index.js new file mode 100644 index 0000000000..9edecee08f --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/index.js @@ -0,0 +1,14 @@ +'use strict' +const u = require('universalify').fromPromise +const { makeDir: _makeDir, makeDirSync } = require('./make-dir') +const makeDir = u(_makeDir) + +module.exports = { + mkdirs: makeDir, + mkdirsSync: makeDirSync, + // alias + mkdirp: makeDir, + mkdirpSync: makeDirSync, + ensureDir: makeDir, + ensureDirSync: makeDirSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/make-dir.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/make-dir.js new file mode 100644 index 0000000000..3e7e836054 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/mkdirs/make-dir.js @@ -0,0 +1,141 @@ +// Adapted from https://github.com/sindresorhus/make-dir +// Copyright (c) Sindre Sorhus (sindresorhus.com) +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict' +const fs = require('../fs') +const path = require('path') +const atLeastNode = require('at-least-node') + +const useNativeRecursiveOption = atLeastNode('10.12.0') + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +const checkPath = pth => { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')) + + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`) + error.code = 'EINVAL' + throw error + } + } +} + +const processOptions = options => { + const defaults = { mode: 0o777 } + if (typeof options === 'number') options = { mode: options } + return { ...defaults, ...options } +} + +const permissionError = pth => { + // This replicates the exception of `fs.mkdir` with native the + // `recusive` option when run on an invalid drive under Windows. + const error = new Error(`operation not permitted, mkdir '${pth}'`) + error.code = 'EPERM' + error.errno = -4048 + error.path = pth + error.syscall = 'mkdir' + return error +} + +module.exports.makeDir = async (input, options) => { + checkPath(input) + options = processOptions(options) + + if (useNativeRecursiveOption) { + const pth = path.resolve(input) + + return fs.mkdir(pth, { + mode: options.mode, + recursive: true + }) + } + + const make = async pth => { + try { + await fs.mkdir(pth, options.mode) + } catch (error) { + if (error.code === 'EPERM') { + throw error + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth) + } + + if (error.message.includes('null bytes')) { + throw error + } + + await make(path.dirname(pth)) + return make(pth) + } + + try { + const stats = await fs.stat(pth) + if (!stats.isDirectory()) { + // This error is never exposed to the user + // it is caught below, and the original error is thrown + throw new Error('The path is not a directory') + } + } catch { + throw error + } + } + } + + return make(path.resolve(input)) +} + +module.exports.makeDirSync = (input, options) => { + checkPath(input) + options = processOptions(options) + + if (useNativeRecursiveOption) { + const pth = path.resolve(input) + + return fs.mkdirSync(pth, { + mode: options.mode, + recursive: true + }) + } + + const make = pth => { + try { + fs.mkdirSync(pth, options.mode) + } catch (error) { + if (error.code === 'EPERM') { + throw error + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth) + } + + if (error.message.includes('null bytes')) { + throw error + } + + make(path.dirname(pth)) + return make(pth) + } + + try { + if (!fs.statSync(pth).isDirectory()) { + // This error is never exposed to the user + // it is caught below, and the original error is thrown + throw new Error('The path is not a directory') + } + } catch { + throw error + } + } + } + + return make(path.resolve(input)) +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/index.js new file mode 100644 index 0000000000..af90b06b42 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/index.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = { + moveSync: require('./move-sync') +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/move-sync.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/move-sync.js new file mode 100644 index 0000000000..20f910cc25 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move-sync/move-sync.js @@ -0,0 +1,47 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copySync = require('../copy-sync').copySync +const removeSync = require('../remove').removeSync +const mkdirpSync = require('../mkdirs').mkdirpSync +const stat = require('../util/stat') + +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) +} + +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} + +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} + +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} + +module.exports = moveSync diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/index.js new file mode 100644 index 0000000000..3785345bd2 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/index.js @@ -0,0 +1,6 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + move: u(require('./move')) +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/move.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/move.js new file mode 100644 index 0000000000..fa3ea618a2 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/move/move.js @@ -0,0 +1,65 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copy = require('../copy').copy +const remove = require('../remove').remove +const mkdirp = require('../mkdirs').mkdirp +const pathExists = require('../path-exists').pathExists +const stat = require('../util/stat') + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + const overwrite = opts.overwrite || opts.clobber || false + + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} + +function doRename (src, dest, overwrite, cb) { + if (overwrite) { + return remove(dest, err => { + if (err) return cb(err) + return rename(src, dest, overwrite, cb) + }) + } + pathExists(dest, (err, destExists) => { + if (err) return cb(err) + if (destExists) return cb(new Error('dest already exists.')) + return rename(src, dest, overwrite, cb) + }) +} + +function rename (src, dest, overwrite, cb) { + fs.rename(src, dest, err => { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} + +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} + +module.exports = move diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/output/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/output/index.js new file mode 100644 index 0000000000..92297ca3a6 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/output/index.js @@ -0,0 +1,40 @@ +'use strict' + +const u = require('universalify').fromCallback +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } + + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + + fs.writeFile(file, data, encoding, callback) + }) + }) +} + +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} + +module.exports = { + outputFile: u(outputFile), + outputFileSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/path-exists/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/path-exists/index.js new file mode 100644 index 0000000000..ddd9bc718f --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/path-exists/index.js @@ -0,0 +1,12 @@ +'use strict' +const u = require('universalify').fromPromise +const fs = require('../fs') + +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} + +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/index.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/index.js new file mode 100644 index 0000000000..cee5340077 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/index.js @@ -0,0 +1,9 @@ +'use strict' + +const u = require('universalify').fromCallback +const rimraf = require('./rimraf') + +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/rimraf.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/rimraf.js new file mode 100644 index 0000000000..2c77102658 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/remove/rimraf.js @@ -0,0 +1,302 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const assert = require('assert') + +const isWindows = (process.platform === 'win32') + +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 +} + +function rimraf (p, options, cb) { + let busyTries = 0 + + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } + + // already gone + if (er.code === 'ENOENT') er = null + } + + cb(er) + }) +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } + + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } + + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) +} + +function fixWinEPERMSync (p, options, er) { + let stats + + assert(p) + assert(options) + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } + + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } + + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) +} + +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) return cb(er) + + let n = files.length + let errState + + if (n === 0) return options.rmdir(p, cb) + + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st + + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } + + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch {} + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} + +module.exports = rimraf +rimraf.sync = rimrafSync diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/stat.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/stat.js new file mode 100644 index 0000000000..0b1c1b0963 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/stat.js @@ -0,0 +1,139 @@ +'use strict' + +const fs = require('../fs') +const path = require('path') +const util = require('util') +const atLeastNode = require('at-least-node') + +const nodeSupportsBigInt = atLeastNode('10.5.0') +const stat = (file) => nodeSupportsBigInt ? fs.stat(file, { bigint: true }) : fs.stat(file) +const statSync = (file) => nodeSupportsBigInt ? fs.statSync(file, { bigint: true }) : fs.statSync(file) + +function getStats (src, dest) { + return Promise.all([ + stat(src), + stat(dest).catch(err => { + if (err.code === 'ENOENT') return null + throw err + }) + ]).then(([srcStat, destStat]) => ({ srcStat, destStat })) +} + +function getStatsSync (src, dest) { + let destStat + const srcStat = statSync(src) + try { + destStat = statSync(dest) + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } +} + +function checkPaths (src, dest, funcName, cb) { + util.callbackify(getStats)(src, dest, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + if (destStat && areIdentical(srcStat, destStat)) { + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) + }) +} + +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && areIdentical(srcStat, destStat)) { + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} + +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +function checkParentPaths (src, srcStat, dest, funcName, cb) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() + const callback = (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (areIdentical(srcStat, destStat)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + } + if (nodeSupportsBigInt) fs.stat(destParent, { bigint: true }, callback) + else fs.stat(destParent, callback) +} + +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + destStat = statSync(destParent) + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} + +function areIdentical (srcStat, destStat) { + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + if (nodeSupportsBigInt || destStat.ino < Number.MAX_SAFE_INTEGER) { + // definitive answer + return true + } + // Use additional heuristics if we can't use 'bigint'. + // Different 'ino' could be represented the same if they are >= Number.MAX_SAFE_INTEGER + // See issue 657 + if (destStat.size === srcStat.size && + destStat.mode === srcStat.mode && + destStat.nlink === srcStat.nlink && + destStat.atimeMs === srcStat.atimeMs && + destStat.mtimeMs === srcStat.mtimeMs && + destStat.ctimeMs === srcStat.ctimeMs && + destStat.birthtimeMs === srcStat.birthtimeMs) { + // heuristic answer + return true + } + } + return false +} + +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} + +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} + +module.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/utimes.js b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/utimes.js new file mode 100644 index 0000000000..75395deff4 --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/lib/util/utimes.js @@ -0,0 +1,26 @@ +'use strict' + +const fs = require('graceful-fs') + +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + fs.open(path, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, atime, mtime, futimesErr => { + fs.close(fd, closeErr => { + if (callback) callback(futimesErr || closeErr) + }) + }) + }) +} + +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + utimesMillis, + utimesMillisSync +} diff --git a/client/node_modules/@electron/universal/node_modules/fs-extra/package.json b/client/node_modules/@electron/universal/node_modules/fs-extra/package.json new file mode 100644 index 0000000000..6f7d8ddb7a --- /dev/null +++ b/client/node_modules/@electron/universal/node_modules/fs-extra/package.json @@ -0,0 +1,70 @@ +{ + "name": "fs-extra", + "version": "9.1.0", + "description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.", + "engines": { + "node": ">=10" + }, + "homepage": "https://github.com/jprichardson/node-fs-extra", + "repository": { + "type": "git", + "url": "https://github.com/jprichardson/node-fs-extra" + }, + "keywords": [ + "fs", + "file", + "file system", + "copy", + "directory", + "extra", + "mkdirp", + "mkdir", + "mkdirs", + "recursive", + "json", + "read", + "write", + "extra", + "delete", + "remove", + "touch", + "create", + "text", + "output", + "move", + "promise" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "devDependencies": { + "coveralls": "^3.0.0", + "klaw": "^2.1.1", + "klaw-sync": "^3.0.2", + "minimist": "^1.1.1", + "mocha": "^5.0.5", + "nyc": "^15.0.0", + "proxyquire": "^2.0.1", + "read-dir-files": "^0.1.1", + "standard": "^14.1.0" + }, + "main": "./lib/index.js", + "files": [ + "lib/", + "!lib/**/__tests__/" + ], + "scripts": { + "full-ci": "npm run lint && npm run coverage", + "coverage": "nyc -r lcovonly npm run unit", + "coveralls": "coveralls < coverage/lcov.info", + "lint": "standard", + "test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha", + "test": "npm run lint && npm run unit", + "unit": "node test.js" + } +} diff --git a/client/node_modules/@electron/universal/package.json b/client/node_modules/@electron/universal/package.json new file mode 100644 index 0000000000..d22684a2d8 --- /dev/null +++ b/client/node_modules/@electron/universal/package.json @@ -0,0 +1,64 @@ +{ + "name": "@electron/universal", + "version": "1.2.1", + "description": "Utility for creating Universal macOS applications from two x64 and arm64 Electron applications", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "license": "MIT", + "keywords": [ + "electron", + "apple silicon", + "universal" + ], + "repository": { + "type": "git", + "url": "https://github.com/electron/universal.git" + }, + "engines": { + "node": ">=8.6" + }, + "files": [ + "dist/*", + "entry-asar/*", + "README.md" + ], + "author": "Samuel Attard", + "scripts": { + "build": "tsc && tsc -p tsconfig.esm.json", + "lint": "prettier --check \"src/**/*.ts\"", + "prepublishOnly": "npm run build", + "test": "exit 0" + }, + "devDependencies": { + "@continuous-auth/semantic-release-npm": "^2.0.0", + "@types/debug": "^4.1.5", + "@types/fs-extra": "^9.0.4", + "@types/minimatch": "^3.0.5", + "@types/node": "^14.14.7", + "@types/plist": "^3.0.2", + "husky": "^4.3.0", + "lint-staged": "^10.5.1", + "prettier": "^2.1.2", + "semantic-release": "^17.2.2", + "typescript": "^4.0.5" + }, + "dependencies": { + "@malept/cross-spawn-promise": "^1.1.0", + "asar": "^3.1.0", + "debug": "^4.3.1", + "dir-compare": "^2.4.0", + "fs-extra": "^9.0.1", + "minimatch": "^3.0.4", + "plist": "^3.0.4" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.ts": [ + "prettier --write" + ] + } +} diff --git a/client/node_modules/app-builder-bin/index.d.ts b/client/node_modules/app-builder-bin/index.d.ts new file mode 100644 index 0000000000..64f99fdc30 --- /dev/null +++ b/client/node_modules/app-builder-bin/index.d.ts @@ -0,0 +1 @@ +export const appBuilderPath: string \ No newline at end of file diff --git a/client/node_modules/app-builder-bin/index.js b/client/node_modules/app-builder-bin/index.js new file mode 100644 index 0000000000..bb85cf68d6 --- /dev/null +++ b/client/node_modules/app-builder-bin/index.js @@ -0,0 +1,32 @@ +"use strict" + +const path = require("path") + +function getPath() { + if (process.env.USE_SYSTEM_APP_BUILDER === "true") { + return "app-builder" + } + + const platform = process.platform; + const arch = process.arch + if (platform === "darwin") { + return path.join(__dirname, "mac", `app-builder_${arch === "x64" ? "amd64" : arch}`) + } + else if (platform === "win32" && arch === "arm64") { + /** + * Golang isn't available for Windows ARM64 yet, so an ARM64 binary + * can't be built yet. However, Windows ARM64 does support ia32 + * emulation, so we can leverage the existing executable for ia32. + * https://github.com/golang/go/issues/36439 + */ + return path.join(__dirname, "win", "ia32", "app-builder.exe") + } + else if (platform === "win32") { + return path.join(__dirname, "win", arch, "app-builder.exe") + } + else { + return path.join(__dirname, "linux", arch, "app-builder") + } +} + +exports.appBuilderPath = getPath() diff --git a/client/node_modules/app-builder-bin/linux/arm/app-builder b/client/node_modules/app-builder-bin/linux/arm/app-builder new file mode 100755 index 0000000000..ee7c86e513 Binary files /dev/null and b/client/node_modules/app-builder-bin/linux/arm/app-builder differ diff --git a/client/node_modules/app-builder-bin/linux/arm64/app-builder b/client/node_modules/app-builder-bin/linux/arm64/app-builder new file mode 100755 index 0000000000..5a0672c9fc Binary files /dev/null and b/client/node_modules/app-builder-bin/linux/arm64/app-builder differ diff --git a/client/node_modules/app-builder-bin/linux/ia32/app-builder b/client/node_modules/app-builder-bin/linux/ia32/app-builder new file mode 100755 index 0000000000..78380c9953 Binary files /dev/null and b/client/node_modules/app-builder-bin/linux/ia32/app-builder differ diff --git a/client/node_modules/app-builder-bin/linux/x64/app-builder b/client/node_modules/app-builder-bin/linux/x64/app-builder new file mode 100755 index 0000000000..ccaf8dc42d Binary files /dev/null and b/client/node_modules/app-builder-bin/linux/x64/app-builder differ diff --git a/client/node_modules/app-builder-bin/mac/app-builder_amd64 b/client/node_modules/app-builder-bin/mac/app-builder_amd64 new file mode 100755 index 0000000000..961da9e179 Binary files /dev/null and b/client/node_modules/app-builder-bin/mac/app-builder_amd64 differ diff --git a/client/node_modules/app-builder-bin/mac/app-builder_arm64 b/client/node_modules/app-builder-bin/mac/app-builder_arm64 new file mode 100755 index 0000000000..df827729ad Binary files /dev/null and b/client/node_modules/app-builder-bin/mac/app-builder_arm64 differ diff --git a/client/node_modules/app-builder-bin/package.json b/client/node_modules/app-builder-bin/package.json new file mode 100644 index 0000000000..9c7d76d6bb --- /dev/null +++ b/client/node_modules/app-builder-bin/package.json @@ -0,0 +1,19 @@ +{ + "name": "app-builder-bin", + "description": "app-builder precompiled binaries", + "version": "4.0.0", + "files": [ + "*.js", + "mac", + "linux", + "win", + "index.d.ts" + ], + "license": "MIT", + "repository": "develar/app-builder", + "keywords": [ + "snap", + "appimage", + "icns" + ] +} \ No newline at end of file diff --git a/client/node_modules/app-builder-bin/readme.md b/client/node_modules/app-builder-bin/readme.md new file mode 100644 index 0000000000..3ac1f0c344 --- /dev/null +++ b/client/node_modules/app-builder-bin/readme.md @@ -0,0 +1,93 @@ +# app-builder + +Generic helper tool to build app in a distributable formats. +Used by [electron-builder](http://github.com/electron-userland/electron-builder) but applicable not only for building Electron applications. + +``` +usage: app-builder [] [ ...] + +app-builder + +Flags: + --help Show context-sensitive help (also try --help-long and --help-man). + --version Show application version. + +Commands: + help [...] + Show help. + + + blockmap --input=INPUT [] + Generates file block map for differential update using content defined + chunking (that is robust to insertions, deletions, and changes to input + file) + + -i, --input=INPUT input file + -o, --output=OUTPUT output file + -c, --compression=gzip compression, one of: gzip, deflate + + download --url=URL --output=OUTPUT [] + Download file. + + -u, --url=URL The URL. + -o, --output=OUTPUT The output file. + --sha512=SHA512 The expected sha512 of file. + + download-artifact --name=NAME --url=URL [] + Download, unpack and cache artifact from GitHub. + + -n, --name=NAME The artifact name. + -u, --url=URL The artifact URL. + --sha512=SHA512 The expected sha512 of file. + + copy --from=FROM --to=TO [] + Copy file or dir. + + -f, --from=FROM + -t, --to=TO + --hard-link Whether to use hard-links if possible + + appimage --app=APP --stage=STAGE --output=OUTPUT [] + Build AppImage. + + -a, --app=APP The app dir. + -s, --stage=STAGE The stage dir. + -o, --output=OUTPUT The output file. + --arch=x64 The arch. + --compression=COMPRESSION The compression. + --remove-stage Whether to remove stage after build. + + snap --app=APP --stage=STAGE --output=OUTPUT [] + Build snap. + + -t, --template=TEMPLATE The template file. + -u, --template-url=TEMPLATE-URL + The template archive URL. + --template-sha512=TEMPLATE-SHA512 + The expected sha512 of template archive. + -a, --app=APP The app dir. + -s, --stage=STAGE The stage dir. + --icon=ICON The path to the icon. + --hooks=HOOKS The hooks dir. + --arch=amd64 The arch. + -o, --output=OUTPUT The output file. + --docker-image="snapcore/snapcraft:latest" + The docker image. + --docker Whether to use Docker. + --remove-stage Whether to remove stage after build. + + icon --input=INPUT --format=FORMAT --out=OUT [] + create ICNS or ICO or icon set from PNG files + + -i, --input=INPUT ... input directory or file + -f, --format=FORMAT output format + --out=OUT output directory + -r, --root=ROOT ... base directory to resolve relative path + + dmg --volume=VOLUME [] + Build dmg. + + --volume=VOLUME + --icon=ICON + --background=BACKGROUND +``` \ No newline at end of file diff --git a/client/node_modules/app-builder-bin/win/ia32/app-builder.exe b/client/node_modules/app-builder-bin/win/ia32/app-builder.exe new file mode 100755 index 0000000000..230086f290 Binary files /dev/null and b/client/node_modules/app-builder-bin/win/ia32/app-builder.exe differ diff --git a/client/node_modules/app-builder-bin/win/x64/app-builder.exe b/client/node_modules/app-builder-bin/win/x64/app-builder.exe new file mode 100755 index 0000000000..6ea48b6d07 Binary files /dev/null and b/client/node_modules/app-builder-bin/win/x64/app-builder.exe differ diff --git a/client/node_modules/app-builder-lib/certs/root_certs.keychain b/client/node_modules/app-builder-lib/certs/root_certs.keychain new file mode 100644 index 0000000000..a823698e87 Binary files /dev/null and b/client/node_modules/app-builder-lib/certs/root_certs.keychain differ diff --git a/client/node_modules/app-builder-lib/out/Framework.d.ts b/client/node_modules/app-builder-lib/out/Framework.d.ts new file mode 100644 index 0000000000..1d50b5a148 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/Framework.d.ts @@ -0,0 +1,36 @@ +import { FileTransformer } from "builder-util/out/fs"; +import { AsarIntegrity } from "./asar/integrity"; +import { Platform, PlatformPackager, ElectronPlatformName, AfterPackContext } from "./index"; +export interface Framework { + readonly name: string; + readonly version: string; + readonly distMacOsAppName: string; + readonly macOsDefaultTargets: Array; + readonly defaultAppIdPrefix: string; + readonly isNpmRebuildRequired: boolean; + readonly isCopyElevateHelper: boolean; + getDefaultIcon?(platform: Platform): string | null; + getMainFile?(platform: Platform): string | null; + getExcludedDependencies?(platform: Platform): Array | null; + prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise; + beforeCopyExtraFiles?(options: BeforeCopyExtraFilesOptions): Promise; + afterPack?(context: AfterPackContext): Promise; + createTransformer?(): FileTransformer | null; +} +export interface BeforeCopyExtraFilesOptions { + packager: PlatformPackager; + appOutDir: string; + asarIntegrity: AsarIntegrity | null; + platformName: string; +} +export interface PrepareApplicationStageDirectoryOptions { + readonly packager: PlatformPackager; + /** + * Platform doesn't process application output directory in any way. Unpack implementation must create or empty dir if need. + */ + readonly appOutDir: string; + readonly platformName: ElectronPlatformName; + readonly arch: string; + readonly version: string; +} +export declare function isElectronBased(framework: Framework): boolean; diff --git a/client/node_modules/app-builder-lib/out/Framework.js b/client/node_modules/app-builder-lib/out/Framework.js new file mode 100644 index 0000000000..617fd2576e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/Framework.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isElectronBased = void 0; +function isElectronBased(framework) { + return framework.name === "electron"; +} +exports.isElectronBased = isElectronBased; +//# sourceMappingURL=Framework.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/Framework.js.map b/client/node_modules/app-builder-lib/out/Framework.js.map new file mode 100644 index 0000000000..841d5c5ecd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/Framework.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Framework.js","sourceRoot":"","sources":["../src/Framework.ts"],"names":[],"mappings":";;;AAmDA,SAAgB,eAAe,CAAC,SAAoB;IAClD,OAAO,SAAS,CAAC,IAAI,KAAK,UAAU,CAAA;AACtC,CAAC;AAFD,0CAEC","sourcesContent":["import { FileTransformer } from \"builder-util/out/fs\"\nimport { AsarIntegrity } from \"./asar/integrity\"\nimport { Platform, PlatformPackager, ElectronPlatformName, AfterPackContext } from \"./index\"\n\nexport interface Framework {\n readonly name: string\n readonly version: string\n readonly distMacOsAppName: string\n readonly macOsDefaultTargets: Array\n readonly defaultAppIdPrefix: string\n\n readonly isNpmRebuildRequired: boolean\n\n readonly isCopyElevateHelper: boolean\n\n getDefaultIcon?(platform: Platform): string | null\n\n getMainFile?(platform: Platform): string | null\n\n getExcludedDependencies?(platform: Platform): Array | null\n\n prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise\n\n beforeCopyExtraFiles?(options: BeforeCopyExtraFilesOptions): Promise\n\n afterPack?(context: AfterPackContext): Promise\n\n createTransformer?(): FileTransformer | null\n}\n\nexport interface BeforeCopyExtraFilesOptions {\n packager: PlatformPackager\n appOutDir: string\n\n asarIntegrity: AsarIntegrity | null\n\n // ElectronPlatformName\n platformName: string\n}\n\nexport interface PrepareApplicationStageDirectoryOptions {\n readonly packager: PlatformPackager\n /**\n * Platform doesn't process application output directory in any way. Unpack implementation must create or empty dir if need.\n */\n readonly appOutDir: string\n readonly platformName: ElectronPlatformName\n readonly arch: string\n readonly version: string\n}\n\nexport function isElectronBased(framework: Framework): boolean {\n return framework.name === \"electron\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/ProtonFramework.d.ts b/client/node_modules/app-builder-lib/out/ProtonFramework.d.ts new file mode 100644 index 0000000000..4fcd219a75 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/ProtonFramework.d.ts @@ -0,0 +1,10 @@ +import { FileTransformer } from "builder-util/out/fs"; +import { Platform } from "./core"; +import { LibUiFramework } from "./frameworks/LibUiFramework"; +export declare class ProtonFramework extends LibUiFramework { + readonly name = "proton"; + readonly defaultAppIdPrefix = "com.proton-native."; + constructor(version: string, distMacOsAppName: string, isUseLaunchUi: boolean); + getDefaultIcon(platform: Platform): string; + createTransformer(): FileTransformer | null; +} diff --git a/client/node_modules/app-builder-lib/out/ProtonFramework.js b/client/node_modules/app-builder-lib/out/ProtonFramework.js new file mode 100644 index 0000000000..536941534f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/ProtonFramework.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ProtonFramework = void 0; +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const core_1 = require("./core"); +const fileTransformer_1 = require("./fileTransformer"); +const LibUiFramework_1 = require("./frameworks/LibUiFramework"); +const pathManager_1 = require("./util/pathManager"); +class ProtonFramework extends LibUiFramework_1.LibUiFramework { + constructor(version, distMacOsAppName, isUseLaunchUi) { + super(version, distMacOsAppName, isUseLaunchUi); + this.name = "proton"; + // noinspection JSUnusedGlobalSymbols + this.defaultAppIdPrefix = "com.proton-native."; + } + getDefaultIcon(platform) { + if (platform === core_1.Platform.WINDOWS) { + return pathManager_1.getTemplatePath("icons/proton-native/proton-native.ico"); + } + else if (platform === core_1.Platform.LINUX) { + return pathManager_1.getTemplatePath("icons/proton-native/linux"); + } + else { + return pathManager_1.getTemplatePath("icons/proton-native/proton-native.icns"); + } + } + createTransformer() { + let babel; + const babelOptions = { ast: false, sourceMaps: "inline" }; + if (process.env.TEST_SET_BABEL_PRESET === "true") { + babel = require("@babel/core"); + // eslint-disable-next-line @typescript-eslint/no-use-before-define + babel = testOnlyBabel(babel, babelOptions, this.version); + } + else { + try { + babel = require("babel-core"); + } + catch (e) { + // babel isn't installed + builder_util_1.log.debug(null, "don't transpile source code using Babel"); + return null; + } + } + builder_util_1.log.info({ + options: builder_util_runtime_1.safeStringifyJson(babelOptions, new Set(["presets"])), + }, "transpile source code using Babel"); + return (file) => { + if (!(file.endsWith(".js") || file.endsWith(".jsx")) || file.includes(fileTransformer_1.NODE_MODULES_PATTERN)) { + return null; + } + return new Promise((resolve, reject) => { + return babel.transformFile(file, babelOptions, (error, result) => { + if (error == null) { + resolve(result.code); + } + else { + reject(error); + } + }); + }); + }; + } +} +exports.ProtonFramework = ProtonFramework; +function testOnlyBabel(babel, babelOptions, nodeVersion) { + // out test dir can be located outside of electron-builder node_modules and babel cannot resolve string names of preset + babelOptions.presets = [[require("@babel/preset-env").default, { targets: { node: nodeVersion } }], require("@babel/preset-react")]; + babelOptions.plugins = [ + // stage 0 + require("@babel/plugin-proposal-function-bind").default, + // stage 1 + require("@babel/plugin-proposal-export-default-from").default, + require("@babel/plugin-proposal-logical-assignment-operators").default, + [require("@babel/plugin-proposal-optional-chaining").default, { loose: false }], + [require("@babel/plugin-proposal-pipeline-operator").default, { proposal: "minimal" }], + [require("@babel/plugin-proposal-nullish-coalescing-operator").default, { loose: false }], + require("@babel/plugin-proposal-do-expressions").default, + // stage 2 + [require("@babel/plugin-proposal-decorators").default, { legacy: true }], + require("@babel/plugin-proposal-function-sent").default, + require("@babel/plugin-proposal-export-namespace-from").default, + require("@babel/plugin-proposal-numeric-separator").default, + require("@babel/plugin-proposal-throw-expressions").default, + // stage 3 + require("@babel/plugin-syntax-dynamic-import").default, + require("@babel/plugin-syntax-import-meta").default, + [require("@babel/plugin-proposal-class-properties").default, { loose: false }], + require("@babel/plugin-proposal-json-strings").default, + ]; + babelOptions.babelrc = false; + return babel; +} +//# sourceMappingURL=ProtonFramework.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/ProtonFramework.js.map b/client/node_modules/app-builder-lib/out/ProtonFramework.js.map new file mode 100644 index 0000000000..06e986e4dd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/ProtonFramework.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProtonFramework.js","sourceRoot":"","sources":["../src/ProtonFramework.ts"],"names":[],"mappings":";;;AACA,+CAAkC;AAClC,+DAAwD;AACxD,iCAAiC;AACjC,uDAAwD;AACxD,gEAA4D;AAC5D,oDAAoD;AAEpD,MAAa,eAAgB,SAAQ,+BAAc;IAMjD,YAAY,OAAe,EAAE,gBAAwB,EAAE,aAAsB;QAC3E,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAA;QANxC,SAAI,GAAG,QAAQ,CAAA;QAExB,qCAAqC;QAC5B,uBAAkB,GAAG,oBAAoB,CAAA;IAIlD,CAAC;IAED,cAAc,CAAC,QAAkB;QAC/B,IAAI,QAAQ,KAAK,eAAQ,CAAC,OAAO,EAAE;YACjC,OAAO,6BAAe,CAAC,uCAAuC,CAAC,CAAA;SAChE;aAAM,IAAI,QAAQ,KAAK,eAAQ,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AA0C,CAAC,CAAC,OAAO;QAC3D,OAAO,CAAC,0CAA0C,CAAC,CAAC,OAAO;QAE3D,UAAU;QACV,OAAO,CAAC,qCAAqC,CAAC,CAAC,OAAO;QACtD,OAAO,CAAC,kCAAkC,CAAC,CAAC,OAAO;QACnD,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC9E,OAAO,CAAC,qCAAqC,CAAC,CAAC,OAAO;KACvD,CAAA;IACD,YAAY,CAAC,OAAO,GAAG,KAAK,CAAA;IAC5B,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { FileTransformer } from \"builder-util/out/fs\"\nimport { log } from \"builder-util\"\nimport { safeStringifyJson } from \"builder-util-runtime\"\nimport { Platform } from \"./core\"\nimport { NODE_MODULES_PATTERN } from \"./fileTransformer\"\nimport { LibUiFramework } from \"./frameworks/LibUiFramework\"\nimport { getTemplatePath } from \"./util/pathManager\"\n\nexport class ProtonFramework extends LibUiFramework {\n readonly name = \"proton\"\n\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.proton-native.\"\n\n constructor(version: string, distMacOsAppName: string, isUseLaunchUi: boolean) {\n super(version, distMacOsAppName, isUseLaunchUi)\n }\n\n getDefaultIcon(platform: Platform): string {\n if (platform === Platform.WINDOWS) {\n return getTemplatePath(\"icons/proton-native/proton-native.ico\")\n } else if (platform === Platform.LINUX) {\n return getTemplatePath(\"icons/proton-native/linux\")\n } else {\n return getTemplatePath(\"icons/proton-native/proton-native.icns\")\n }\n }\n\n createTransformer(): FileTransformer | null {\n let babel: any\n const babelOptions: any = { ast: false, sourceMaps: \"inline\" }\n if (process.env.TEST_SET_BABEL_PRESET === \"true\") {\n babel = require(\"@babel/core\")\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n babel = testOnlyBabel(babel, babelOptions, this.version)\n } else {\n try {\n babel = require(\"babel-core\")\n } catch (e) {\n // babel isn't installed\n log.debug(null, \"don't transpile source code using Babel\")\n return null\n }\n }\n\n log.info(\n {\n options: safeStringifyJson(babelOptions, new Set([\"presets\"])),\n },\n \"transpile source code using Babel\"\n )\n return (file): Promise | null => {\n if (!(file.endsWith(\".js\") || file.endsWith(\".jsx\")) || file.includes(NODE_MODULES_PATTERN)) {\n return null\n }\n\n return new Promise((resolve, reject) => {\n return babel.transformFile(file, babelOptions, (error: Error, result: any) => {\n if (error == null) {\n resolve(result.code)\n } else {\n reject(error)\n }\n })\n })\n }\n }\n}\n\nfunction testOnlyBabel(babel: any, babelOptions: any, nodeVersion: string): any {\n // out test dir can be located outside of electron-builder node_modules and babel cannot resolve string names of preset\n babelOptions.presets = [[require(\"@babel/preset-env\").default, { targets: { node: nodeVersion } }], require(\"@babel/preset-react\")]\n babelOptions.plugins = [\n // stage 0\n require(\"@babel/plugin-proposal-function-bind\").default,\n\n // stage 1\n require(\"@babel/plugin-proposal-export-default-from\").default,\n require(\"@babel/plugin-proposal-logical-assignment-operators\").default,\n [require(\"@babel/plugin-proposal-optional-chaining\").default, { loose: false }],\n [require(\"@babel/plugin-proposal-pipeline-operator\").default, { proposal: \"minimal\" }],\n [require(\"@babel/plugin-proposal-nullish-coalescing-operator\").default, { loose: false }],\n require(\"@babel/plugin-proposal-do-expressions\").default,\n\n // stage 2\n [require(\"@babel/plugin-proposal-decorators\").default, { legacy: true }],\n require(\"@babel/plugin-proposal-function-sent\").default,\n require(\"@babel/plugin-proposal-export-namespace-from\").default,\n require(\"@babel/plugin-proposal-numeric-separator\").default,\n require(\"@babel/plugin-proposal-throw-expressions\").default,\n\n // stage 3\n require(\"@babel/plugin-syntax-dynamic-import\").default,\n require(\"@babel/plugin-syntax-import-meta\").default,\n [require(\"@babel/plugin-proposal-class-properties\").default, { loose: false }],\n require(\"@babel/plugin-proposal-json-strings\").default,\n ]\n babelOptions.babelrc = false\n return babel\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/appInfo.d.ts b/client/node_modules/app-builder-lib/out/appInfo.d.ts new file mode 100644 index 0000000000..7ed7e3037f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/appInfo.d.ts @@ -0,0 +1,29 @@ +import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions"; +import { Packager } from "./packager"; +export declare function smarten(s: string): string; +export declare class AppInfo { + private readonly info; + private readonly platformSpecificOptions; + readonly description: string; + readonly version: string; + readonly shortVersion: string | undefined; + readonly shortVersionWindows: string | undefined; + readonly buildNumber: string | undefined; + readonly buildVersion: string; + readonly productName: string; + readonly sanitizedProductName: string; + readonly productFilename: string; + constructor(info: Packager, buildVersion: string | null | undefined, platformSpecificOptions?: PlatformSpecificBuildOptions | null); + get channel(): string | null; + getVersionInWeirdWindowsForm(isSetBuildNumber?: boolean): string; + private get notNullDevMetadata(); + get companyName(): string | null; + get id(): string; + get macBundleIdentifier(): string; + get name(): string; + get linuxPackageName(): string; + get sanitizedName(): string; + get updaterCacheDirName(): string; + get copyright(): string; + computePackageUrl(): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/appInfo.js b/client/node_modules/app-builder-lib/out/appInfo.js new file mode 100644 index 0000000000..6085c76b3c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/appInfo.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.filterCFBundleIdentifier = exports.AppInfo = exports.smarten = void 0; +const builder_util_1 = require("builder-util"); +const semver_1 = require("semver"); +const macroExpander_1 = require("./util/macroExpander"); +const filename_1 = require("./util/filename"); +// fpm bug - rpm build --description is not escaped, well... decided to replace quite to smart quote +// http://leancrew.com/all-this/2010/11/smart-quotes-in-javascript/ +function smarten(s) { + // opening singles + s = s.replace(/(^|[-\u2014\s(["])'/g, "$1\u2018"); + // closing singles & apostrophes + s = s.replace(/'/g, "\u2019"); + // opening doubles + s = s.replace(/(^|[-\u2014/[(\u2018\s])"/g, "$1\u201c"); + // closing doubles + s = s.replace(/"/g, "\u201d"); + return s; +} +exports.smarten = smarten; +class AppInfo { + constructor(info, buildVersion, platformSpecificOptions = null) { + this.info = info; + this.platformSpecificOptions = platformSpecificOptions; + this.description = smarten(this.info.metadata.description || ""); + this.version = info.metadata.version; + if (buildVersion == null) { + buildVersion = info.config.buildVersion; + } + const buildNumberEnvs = process.env.BUILD_NUMBER || + process.env.TRAVIS_BUILD_NUMBER || + process.env.APPVEYOR_BUILD_NUMBER || + process.env.CIRCLE_BUILD_NUM || + process.env.BUILD_BUILDNUMBER || + process.env.CI_PIPELINE_IID; + this.buildNumber = info.config.buildNumber || buildNumberEnvs; + if (buildVersion == null) { + buildVersion = this.version; + if (!builder_util_1.isEmptyOrSpaces(this.buildNumber)) { + buildVersion += `.${this.buildNumber}`; + } + } + this.buildVersion = buildVersion; + if (info.metadata.shortVersion) { + this.shortVersion = info.metadata.shortVersion; + } + if (info.metadata.shortVersionWindows) { + this.shortVersionWindows = info.metadata.shortVersionWindows; + } + this.productName = info.config.productName || info.metadata.productName || info.metadata.name; + this.sanitizedProductName = filename_1.sanitizeFileName(this.productName); + this.productFilename = (platformSpecificOptions === null || platformSpecificOptions === void 0 ? void 0 : platformSpecificOptions.executableName) != null ? filename_1.sanitizeFileName(platformSpecificOptions.executableName) : this.sanitizedProductName; + } + get channel() { + const prereleaseInfo = semver_1.prerelease(this.version); + if (prereleaseInfo != null && prereleaseInfo.length > 0) { + return prereleaseInfo[0]; + } + return null; + } + getVersionInWeirdWindowsForm(isSetBuildNumber = true) { + const parsedVersion = new semver_1.SemVer(this.version); + // https://github.com/electron-userland/electron-builder/issues/2635#issuecomment-371792272 + let buildNumber = isSetBuildNumber ? this.buildNumber : null; + if (buildNumber == null || !/^\d+$/.test(buildNumber)) { + buildNumber = "0"; + } + return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${buildNumber}`; + } + get notNullDevMetadata() { + return this.info.devMetadata || {}; + } + get companyName() { + const author = this.info.metadata.author || this.notNullDevMetadata.author; + return author == null ? null : author.name; + } + get id() { + let appId = null; + for (const options of [this.platformSpecificOptions, this.info.config]) { + if (options != null && appId == null) { + appId = options.appId; + } + } + const generateDefaultAppId = () => { + const info = this.info; + return `${info.framework.defaultAppIdPrefix}${info.metadata.name.toLowerCase()}`; + }; + if (appId != null && (appId === "your.id" || builder_util_1.isEmptyOrSpaces(appId))) { + const incorrectAppId = appId; + appId = generateDefaultAppId(); + builder_util_1.log.warn(`do not use "${incorrectAppId}" as appId, "${appId}" will be used instead`); + } + return appId == null ? generateDefaultAppId() : appId; + } + get macBundleIdentifier() { + return filterCFBundleIdentifier(this.id); + } + get name() { + return this.info.metadata.name; + } + get linuxPackageName() { + const name = this.name; + // https://github.com/electron-userland/electron-builder/issues/2963 + return name.startsWith("@") ? this.sanitizedProductName : name; + } + get sanitizedName() { + return filename_1.sanitizeFileName(this.name); + } + get updaterCacheDirName() { + return this.sanitizedName.toLowerCase() + "-updater"; + } + get copyright() { + const copyright = this.info.config.copyright; + if (copyright != null) { + return macroExpander_1.expandMacro(copyright, null, this); + } + return `Copyright © ${new Date().getFullYear()} ${this.companyName || this.productName}`; + } + async computePackageUrl() { + const url = this.info.metadata.homepage || this.notNullDevMetadata.homepage; + if (url != null) { + return url; + } + const info = await this.info.repositoryInfo; + return info == null || info.type !== "github" ? null : `https://${info.domain}/${info.user}/${info.project}`; + } +} +exports.AppInfo = AppInfo; +/** @internal */ +function filterCFBundleIdentifier(identifier) { + // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) + // Apple documentation: https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070 + return identifier.replace(/ /g, "-").replace(/[^a-zA-Z0-9.-]/g, ""); +} +exports.filterCFBundleIdentifier = filterCFBundleIdentifier; +//# sourceMappingURL=appInfo.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/appInfo.js.map b/client/node_modules/app-builder-lib/out/appInfo.js.map new file mode 100644 index 0000000000..98b3c41626 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/appInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"appInfo.js","sourceRoot":"","sources":["../src/appInfo.ts"],"names":[],"mappings":";;;AAAA,+CAAmD;AACnD,mCAA2C;AAG3C,wDAAkD;AAClD,8CAAkD;AAElD,oGAAoG;AACpG,mEAAmE;AACnE,SAAgB,OAAO,CAAC,CAAS;IAC/B,kBAAkB;IAClB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAA;IACjD,gCAAgC;IAChC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC7B,kBAAkB;IAClB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,4BAA4B,EAAE,UAAU,CAAC,CAAA;IACvD,kBAAkB;IAClB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC7B,OAAO,CAAC,CAAA;AACV,CAAC;AAVD,0BAUC;AAED,MAAa,OAAO;IAalB,YAA6B,IAAc,EAAE,YAAuC,EAAmB,0BAA+D,IAAI;QAA7I,SAAI,GAAJ,IAAI,CAAU;QAA4D,4BAAuB,GAAvB,uBAAuB,CAA4C;QAZjK,gBAAW,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QAalE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAQ,CAAA;QAErC,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;SACxC;QAED,MAAM,eAAe,GACnB,OAAO,CAAC,GAAG,CAAC,YAAY;YACxB,OAAO,CAAC,GAAG,CAAC,mBAAmB;YAC/B,OAAO,CAAC,GAAG,CAAC,qBAAqB;YACjC,OAAO,CAAC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AAI,SAAS,IAAI,IAAI,EAAE;YACrB,OAAO,2BAAW,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;SAC1C;QACD,OAAO,eAAe,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,CAAA;IAC1F,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAA;QAC3E,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,OAAO,GAAG,CAAA;SACX;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAA;QAC3C,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAA;IAC9G,CAAC;CACF;AAxID,0BAwIC;AAED,gBAAgB;AAChB,SAAgB,wBAAwB,CAAC,UAAkB;IACzD,kGAAkG;IAClG,0LAA0L;IAC1L,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;AACrE,CAAC;AAJD,4DAIC","sourcesContent":["import { isEmptyOrSpaces, log } from \"builder-util\"\nimport { prerelease, SemVer } from \"semver\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { Packager } from \"./packager\"\nimport { expandMacro } from \"./util/macroExpander\"\nimport { sanitizeFileName } from \"./util/filename\"\n\n// fpm bug - rpm build --description is not escaped, well... decided to replace quite to smart quote\n// http://leancrew.com/all-this/2010/11/smart-quotes-in-javascript/\nexport function smarten(s: string): string {\n // opening singles\n s = s.replace(/(^|[-\\u2014\\s([\"])'/g, \"$1\\u2018\")\n // closing singles & apostrophes\n s = s.replace(/'/g, \"\\u2019\")\n // opening doubles\n s = s.replace(/(^|[-\\u2014/[(\\u2018\\s])\"/g, \"$1\\u201c\")\n // closing doubles\n s = s.replace(/\"/g, \"\\u201d\")\n return s\n}\n\nexport class AppInfo {\n readonly description = smarten(this.info.metadata.description || \"\")\n readonly version: string\n readonly shortVersion: string | undefined\n readonly shortVersionWindows: string | undefined\n\n readonly buildNumber: string | undefined\n readonly buildVersion: string\n\n readonly productName: string\n readonly sanitizedProductName: string\n readonly productFilename: string\n\n constructor(private readonly info: Packager, buildVersion: string | null | undefined, private readonly platformSpecificOptions: PlatformSpecificBuildOptions | null = null) {\n this.version = info.metadata.version!\n\n if (buildVersion == null) {\n buildVersion = info.config.buildVersion\n }\n\n const buildNumberEnvs =\n process.env.BUILD_NUMBER ||\n process.env.TRAVIS_BUILD_NUMBER ||\n process.env.APPVEYOR_BUILD_NUMBER ||\n process.env.CIRCLE_BUILD_NUM ||\n process.env.BUILD_BUILDNUMBER ||\n process.env.CI_PIPELINE_IID\n this.buildNumber = info.config.buildNumber || buildNumberEnvs\n if (buildVersion == null) {\n buildVersion = this.version\n if (!isEmptyOrSpaces(this.buildNumber)) {\n buildVersion += `.${this.buildNumber}`\n }\n }\n this.buildVersion = buildVersion\n\n if (info.metadata.shortVersion) {\n this.shortVersion = info.metadata.shortVersion\n }\n if (info.metadata.shortVersionWindows) {\n this.shortVersionWindows = info.metadata.shortVersionWindows\n }\n\n this.productName = info.config.productName || info.metadata.productName || info.metadata.name!\n this.sanitizedProductName = sanitizeFileName(this.productName)\n this.productFilename = platformSpecificOptions?.executableName != null ? sanitizeFileName(platformSpecificOptions.executableName) : this.sanitizedProductName\n }\n\n get channel(): string | null {\n const prereleaseInfo = prerelease(this.version)\n if (prereleaseInfo != null && prereleaseInfo.length > 0) {\n return prereleaseInfo[0] as string | null\n }\n return null\n }\n\n getVersionInWeirdWindowsForm(isSetBuildNumber = true): string {\n const parsedVersion = new SemVer(this.version)\n // https://github.com/electron-userland/electron-builder/issues/2635#issuecomment-371792272\n let buildNumber = isSetBuildNumber ? this.buildNumber : null\n if (buildNumber == null || !/^\\d+$/.test(buildNumber)) {\n buildNumber = \"0\"\n }\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}.${buildNumber}`\n }\n\n private get notNullDevMetadata() {\n return this.info.devMetadata || {}\n }\n\n get companyName(): string | null {\n const author = this.info.metadata.author || this.notNullDevMetadata.author\n return author == null ? null : author.name\n }\n\n get id(): string {\n let appId: string | null | undefined = null\n for (const options of [this.platformSpecificOptions, this.info.config]) {\n if (options != null && appId == null) {\n appId = options.appId\n }\n }\n\n const generateDefaultAppId = () => {\n const info = this.info\n return `${info.framework.defaultAppIdPrefix}${info.metadata.name!.toLowerCase()}`\n }\n\n if (appId != null && (appId === \"your.id\" || isEmptyOrSpaces(appId))) {\n const incorrectAppId = appId\n appId = generateDefaultAppId()\n log.warn(`do not use \"${incorrectAppId}\" as appId, \"${appId}\" will be used instead`)\n }\n\n return appId == null ? generateDefaultAppId() : appId\n }\n\n get macBundleIdentifier(): string {\n return filterCFBundleIdentifier(this.id)\n }\n\n get name(): string {\n return this.info.metadata.name!\n }\n\n get linuxPackageName(): string {\n const name = this.name\n // https://github.com/electron-userland/electron-builder/issues/2963\n return name.startsWith(\"@\") ? this.sanitizedProductName : name\n }\n\n get sanitizedName(): string {\n return sanitizeFileName(this.name)\n }\n\n get updaterCacheDirName(): string {\n return this.sanitizedName.toLowerCase() + \"-updater\"\n }\n\n get copyright(): string {\n const copyright = this.info.config.copyright\n if (copyright != null) {\n return expandMacro(copyright, null, this)\n }\n return `Copyright © ${new Date().getFullYear()} ${this.companyName || this.productName}`\n }\n\n async computePackageUrl(): Promise {\n const url = this.info.metadata.homepage || this.notNullDevMetadata.homepage\n if (url != null) {\n return url\n }\n\n const info = await this.info.repositoryInfo\n return info == null || info.type !== \"github\" ? null : `https://${info.domain}/${info.user}/${info.project}`\n }\n}\n\n/** @internal */\nexport function filterCFBundleIdentifier(identifier: string) {\n // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)\n // Apple documentation: https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070\n return identifier.replace(/ /g, \"-\").replace(/[^a-zA-Z0-9.-]/g, \"\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asar.d.ts b/client/node_modules/app-builder-lib/out/asar/asar.d.ts new file mode 100644 index 0000000000..45b7dc804d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asar.d.ts @@ -0,0 +1,29 @@ +/// +import { Stats } from "fs-extra"; +export interface ReadAsarHeader { + readonly header: string; + readonly size: number; +} +export interface NodeIntegrity { + algorithm: "SHA256"; + hash: string; + blockSize: number; + blocks: Array; +} +export declare class AsarFilesystem { + readonly src: string; + readonly header: Node; + readonly headerSize: number; + private offset; + constructor(src: string, header?: Node, headerSize?: number); + searchNodeFromDirectory(p: string, isCreate: boolean): Node | null; + getOrCreateNode(p: string): Node; + addFileNode(file: string, dirNode: Node, size: number, unpacked: boolean, stat: Stats, integrity?: NodeIntegrity): Node; + getNode(p: string): Node | null; + getFile(p: string, followLinks?: boolean): Node; + readJson(file: string): Promise; + readFile(file: string): Promise; +} +export declare function readAsarHeader(archive: string): Promise; +export declare function readAsar(archive: string): Promise; +export declare function readAsarJson(archive: string, file: string): Promise; diff --git a/client/node_modules/app-builder-lib/out/asar/asar.js b/client/node_modules/app-builder-lib/out/asar/asar.js new file mode 100644 index 0000000000..ee017a8bd3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asar.js @@ -0,0 +1,152 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readAsarJson = exports.readAsar = exports.readAsarHeader = exports.AsarFilesystem = exports.Node = void 0; +const chromium_pickle_js_1 = require("chromium-pickle-js"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +/** @internal */ +class Node { +} +exports.Node = Node; +class AsarFilesystem { + constructor(src, header = new Node(), headerSize = -1) { + this.src = src; + this.header = header; + this.headerSize = headerSize; + this.offset = 0; + if (this.header.files == null) { + this.header.files = {}; + } + } + searchNodeFromDirectory(p, isCreate) { + let node = this.header; + for (const dir of p.split(path.sep)) { + if (dir !== ".") { + let child = node.files[dir]; + if (child == null) { + if (!isCreate) { + return null; + } + child = new Node(); + child.files = {}; + node.files[dir] = child; + } + node = child; + } + } + return node; + } + getOrCreateNode(p) { + if (p == null || p.length === 0) { + return this.header; + } + const name = path.basename(p); + const dirNode = this.searchNodeFromDirectory(path.dirname(p), true); + if (dirNode.files == null) { + dirNode.files = {}; + } + let result = dirNode.files[name]; + if (result == null) { + result = new Node(); + dirNode.files[name] = result; + } + return result; + } + addFileNode(file, dirNode, size, unpacked, stat, integrity) { + if (size > 4294967295) { + throw new Error(`${file}: file size cannot be larger than 4.2GB`); + } + const node = new Node(); + node.size = size; + if (integrity) { + node.integrity = integrity; + } + if (unpacked) { + node.unpacked = true; + } + else { + // electron expects string + node.offset = this.offset.toString(); + if (process.platform !== "win32" && stat.mode & 0o100) { + node.executable = true; + } + this.offset += node.size; + } + let children = dirNode.files; + if (children == null) { + children = {}; + dirNode.files = children; + } + children[path.basename(file)] = node; + return node; + } + getNode(p) { + const node = this.searchNodeFromDirectory(path.dirname(p), false); + return node.files[path.basename(p)]; + } + getFile(p, followLinks = true) { + const info = this.getNode(p); + // if followLinks is false we don't resolve symlinks + return followLinks && info.link != null ? this.getFile(info.link) : info; + } + async readJson(file) { + return JSON.parse((await this.readFile(file)).toString()); + } + readFile(file) { + return readFileFromAsar(this, file, this.getFile(file)); + } +} +exports.AsarFilesystem = AsarFilesystem; +async function readAsarHeader(archive) { + const fd = await fs_extra_1.open(archive, "r"); + let size; + let headerBuf; + try { + const sizeBuf = Buffer.allocUnsafe(8); + if ((await fs_extra_1.read(fd, sizeBuf, 0, 8, null)).bytesRead !== 8) { + throw new Error("Unable to read header size"); + } + const sizePickle = chromium_pickle_js_1.createFromBuffer(sizeBuf); + size = sizePickle.createIterator().readUInt32(); + headerBuf = Buffer.allocUnsafe(size); + if ((await fs_extra_1.read(fd, headerBuf, 0, size, null)).bytesRead !== size) { + throw new Error("Unable to read header"); + } + } + finally { + await fs_extra_1.close(fd); + } + const headerPickle = chromium_pickle_js_1.createFromBuffer(headerBuf); + return { header: headerPickle.createIterator().readString(), size }; +} +exports.readAsarHeader = readAsarHeader; +async function readAsar(archive) { + const { header, size } = await readAsarHeader(archive); + return new AsarFilesystem(archive, JSON.parse(header), size); +} +exports.readAsar = readAsar; +async function readAsarJson(archive, file) { + const fs = await readAsar(archive); + return await fs.readJson(file); +} +exports.readAsarJson = readAsarJson; +async function readFileFromAsar(filesystem, filename, info) { + const size = info.size; + const buffer = Buffer.allocUnsafe(size); + if (size <= 0) { + return buffer; + } + if (info.unpacked) { + return await fs_extra_1.readFile(path.join(`${filesystem.src}.unpacked`, filename)); + } + const fd = await fs_extra_1.open(filesystem.src, "r"); + try { + const offset = 8 + filesystem.headerSize + parseInt(info.offset, 10); + await fs_extra_1.read(fd, buffer, 0, size, offset); + } + finally { + await fs_extra_1.close(fd); + } + return buffer; +} +//# sourceMappingURL=asar.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asar.js.map b/client/node_modules/app-builder-lib/out/asar/asar.js.map new file mode 100644 index 0000000000..47e375bda2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asar.js","sourceRoot":"","sources":["../../src/asar/asar.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AACrD,uCAA6D;AAC7D,6BAA4B;AAc5B,gBAAgB;AAChB,MAAa,IAAI;CAehB;AAfD,oBAeC;AAED,MAAa,cAAc;IAGzB,YAAqB,GAAW,EAAW,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0B,EAAE,QAAgB,EAAE,IAAU;IACtF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAK,CAAA;IACvB,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACvC,IAAI,IAAI,IAAI,CAAC,EAAE;QACb,OAAO,MAAM,CAAA;KACd;IAED,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,OAAO,MAAM,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;KACzE;IAED,MAAM,EAAE,GAAG,MAAM,eAAI,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1C,IAAI;QACF,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAO,EAAE,EAAE,CAAC,CAAA;QACrE,MAAM,eAAI,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;KACxC;YAAS;QACR,MAAM,gBAAK,CAAC,EAAE,CAAC,CAAA;KAChB;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { createFromBuffer } from \"chromium-pickle-js\"\nimport { close, open, read, readFile, Stats } from \"fs-extra\"\nimport * as path from \"path\"\n\nexport interface ReadAsarHeader {\n readonly header: string\n readonly size: number\n}\n\nexport interface NodeIntegrity {\n algorithm: \"SHA256\"\n hash: string\n blockSize: number\n blocks: Array\n}\n\n/** @internal */\nexport class Node {\n // we don't use Map because later it will be stringified\n files?: { [key: string]: Node }\n\n unpacked?: boolean\n\n size?: number\n // electron expects string\n offset?: string\n\n executable?: boolean\n\n link?: string\n\n integrity?: NodeIntegrity\n}\n\nexport class AsarFilesystem {\n private offset = 0\n\n constructor(readonly src: string, readonly header = new Node(), readonly headerSize: number = -1) {\n if (this.header.files == null) {\n this.header.files = {}\n }\n }\n\n searchNodeFromDirectory(p: string, isCreate: boolean): Node | null {\n let node = this.header\n for (const dir of p.split(path.sep)) {\n if (dir !== \".\") {\n let child = node.files![dir]\n if (child == null) {\n if (!isCreate) {\n return null\n }\n child = new Node()\n child.files = {}\n node.files![dir] = child\n }\n node = child\n }\n }\n return node\n }\n\n getOrCreateNode(p: string): Node {\n if (p == null || p.length === 0) {\n return this.header\n }\n\n const name = path.basename(p)\n const dirNode = this.searchNodeFromDirectory(path.dirname(p), true)!\n if (dirNode.files == null) {\n dirNode.files = {}\n }\n\n let result = dirNode.files[name]\n if (result == null) {\n result = new Node()\n dirNode.files[name] = result\n }\n return result\n }\n\n addFileNode(file: string, dirNode: Node, size: number, unpacked: boolean, stat: Stats, integrity?: NodeIntegrity): Node {\n if (size > 4294967295) {\n throw new Error(`${file}: file size cannot be larger than 4.2GB`)\n }\n\n const node = new Node()\n node.size = size\n if (integrity) {\n node.integrity = integrity\n }\n if (unpacked) {\n node.unpacked = true\n } else {\n // electron expects string\n node.offset = this.offset.toString()\n if (process.platform !== \"win32\" && stat.mode & 0o100) {\n node.executable = true\n }\n this.offset += node.size\n }\n\n let children = dirNode.files\n if (children == null) {\n children = {}\n dirNode.files = children\n }\n children[path.basename(file)] = node\n\n return node\n }\n\n getNode(p: string): Node | null {\n const node = this.searchNodeFromDirectory(path.dirname(p), false)!\n return node.files![path.basename(p)]\n }\n\n getFile(p: string, followLinks = true): Node {\n const info = this.getNode(p)!\n // if followLinks is false we don't resolve symlinks\n return followLinks && info.link != null ? this.getFile(info.link) : info\n }\n\n async readJson(file: string): Promise {\n return JSON.parse((await this.readFile(file)).toString())\n }\n\n readFile(file: string): Promise {\n return readFileFromAsar(this, file, this.getFile(file))\n }\n}\n\nexport async function readAsarHeader(archive: string): Promise {\n const fd = await open(archive, \"r\")\n let size: number\n let headerBuf\n try {\n const sizeBuf = Buffer.allocUnsafe(8)\n if ((await read(fd, sizeBuf, 0, 8, null as any)).bytesRead !== 8) {\n throw new Error(\"Unable to read header size\")\n }\n\n const sizePickle = createFromBuffer(sizeBuf)\n size = sizePickle.createIterator().readUInt32()\n headerBuf = Buffer.allocUnsafe(size)\n if ((await read(fd, headerBuf, 0, size, null as any)).bytesRead !== size) {\n throw new Error(\"Unable to read header\")\n }\n } finally {\n await close(fd)\n }\n\n const headerPickle = createFromBuffer(headerBuf)\n return { header: headerPickle.createIterator().readString(), size }\n}\n\nexport async function readAsar(archive: string): Promise {\n const { header, size } = await readAsarHeader(archive)\n return new AsarFilesystem(archive, JSON.parse(header), size)\n}\n\nexport async function readAsarJson(archive: string, file: string): Promise {\n const fs = await readAsar(archive)\n return await fs.readJson(file)\n}\n\nasync function readFileFromAsar(filesystem: AsarFilesystem, filename: string, info: Node): Promise {\n const size = info.size!\n const buffer = Buffer.allocUnsafe(size)\n if (size <= 0) {\n return buffer\n }\n\n if (info.unpacked) {\n return await readFile(path.join(`${filesystem.src}.unpacked`, filename))\n }\n\n const fd = await open(filesystem.src, \"r\")\n try {\n const offset = 8 + filesystem.headerSize + parseInt(info.offset!, 10)\n await read(fd, buffer, 0, size, offset)\n } finally {\n await close(fd)\n }\n return buffer\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asarFileChecker.d.ts b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js new file mode 100644 index 0000000000..cb7f23705a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkFileInArchive = void 0; +const fs_1 = require("builder-util/out/fs"); +const asar_1 = require("./asar"); +/** @internal */ +async function checkFileInArchive(asarFile, relativeFile, messagePrefix) { + function error(text) { + return new Error(`${messagePrefix} "${relativeFile}" in the "${asarFile}" ${text}`); + } + let fs; + try { + fs = await asar_1.readAsar(asarFile); + } + catch (e) { + throw error(`is corrupted: ${e}`); + } + let stat; + try { + stat = fs.getFile(relativeFile); + } + catch (e) { + const fileStat = await fs_1.statOrNull(asarFile); + if (fileStat == null) { + throw error(`does not exist. Seems like a wrong configuration.`); + } + // asar throws error on access to undefined object (info.link) + stat = null; + } + if (stat == null) { + throw error(`does not exist. Seems like a wrong configuration.`); + } + if (stat.size === 0) { + throw error(`is corrupted: size 0`); + } +} +exports.checkFileInArchive = checkFileInArchive; +//# sourceMappingURL=asarFileChecker.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js.map b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js.map new file mode 100644 index 0000000000..85807681fa --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarFileChecker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asarFileChecker.js","sourceRoot":"","sources":["../../src/asar/asarFileChecker.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAChD,iCAAuC;AAEvC,gBAAgB;AACT,KAAK,UAAU,kBAAkB,CAAC,QAAgB,EAAE,YAAoB,EAAE,aAAqB;IACpG,SAAS,KAAK,CAAC,IAAY;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,aAAa,KAAK,YAAY,aAAa,QAAQ,KAAK,IAAI,EAAE,CAAC,CAAA;IACrF,CAAC;IAED,IAAI,EAAE,CAAA;IACN,IAAI;QACF,EAAE,GAAG,MAAM,eAAQ,CAAC,QAAQ,CAAC,CAAA;KAC9B;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAA;KAClC;IAED,IAAI,IAAiB,CAAA;IACrB,IAAI;QACF,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;KAChC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,QAAQ,GAAG,MAAM,eAAU,CAAC,QAAQ,CAAC,CAAA;QAC3C,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAA;SACjE;QAED,8DAA8D;QAC9D,IAAI,GAAG,IAAI,CAAA;KACZ;IAED,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,KAAK,CAAC,mDAAmD,CAAC,CAAA;KACjE;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;QACnB,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAA;KACpC;AACH,CAAC;AA/BD,gDA+BC","sourcesContent":["import { statOrNull } from \"builder-util/out/fs\"\nimport { Node, readAsar } from \"./asar\"\n\n/** @internal */\nexport async function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) {\n function error(text: string) {\n return new Error(`${messagePrefix} \"${relativeFile}\" in the \"${asarFile}\" ${text}`)\n }\n\n let fs\n try {\n fs = await readAsar(asarFile)\n } catch (e) {\n throw error(`is corrupted: ${e}`)\n }\n\n let stat: Node | null\n try {\n stat = fs.getFile(relativeFile)\n } catch (e) {\n const fileStat = await statOrNull(asarFile)\n if (fileStat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n\n // asar throws error on access to undefined object (info.link)\n stat = null\n }\n\n if (stat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n if (stat.size === 0) {\n throw error(`is corrupted: size 0`)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asarUtil.d.ts b/client/node_modules/app-builder-lib/out/asar/asarUtil.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarUtil.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/asar/asarUtil.js b/client/node_modules/app-builder-lib/out/asar/asarUtil.js new file mode 100644 index 0000000000..44a2726795 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarUtil.js @@ -0,0 +1,241 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AsarPackager = void 0; +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_2 = require("fs"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const appFileCopier_1 = require("../util/appFileCopier"); +const asar_1 = require("./asar"); +const integrity_1 = require("./integrity"); +const unpackDetector_1 = require("./unpackDetector"); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const pickle = require("chromium-pickle-js"); +/** @internal */ +class AsarPackager { + constructor(src, destination, options, unpackPattern) { + this.src = src; + this.destination = destination; + this.options = options; + this.unpackPattern = unpackPattern; + this.fs = new asar_1.AsarFilesystem(this.src); + this.outFile = path.join(destination, "app.asar"); + this.unpackedDest = `${this.outFile}.unpacked`; + } + // sort files to minimize file change (i.e. asar file is not changed dramatically on small change) + async pack(fileSets, packager) { + if (this.options.ordering != null) { + // ordering doesn't support transformed files, but ordering is not used functionality - wait user report to fix it + await order(fileSets[0].files, this.options.ordering, fileSets[0].src); + } + await promises_1.mkdir(path.dirname(this.outFile), { recursive: true }); + const unpackedFileIndexMap = new Map(); + for (const fileSet of fileSets) { + unpackedFileIndexMap.set(fileSet, await this.createPackageFromFiles(fileSet, packager.info)); + } + await this.writeAsarFile(fileSets, unpackedFileIndexMap); + } + async createPackageFromFiles(fileSet, packager) { + const metadata = fileSet.metadata; + // search auto unpacked dir + const unpackedDirs = new Set(); + const rootForAppFilesWithoutAsar = path.join(this.destination, "app"); + if (this.options.smartUnpack !== false) { + await unpackDetector_1.detectUnpackedDirs(fileSet, unpackedDirs, this.unpackedDest, rootForAppFilesWithoutAsar); + } + const dirToCreateForUnpackedFiles = new Set(unpackedDirs); + const correctDirNodeUnpackedFlag = async (filePathInArchive, dirNode) => { + for (const dir of unpackedDirs) { + if (filePathInArchive.length > dir.length + 2 && filePathInArchive[dir.length] === path.sep && filePathInArchive.startsWith(dir)) { + dirNode.unpacked = true; + unpackedDirs.add(filePathInArchive); + // not all dirs marked as unpacked after first iteration - because node module dir can be marked as unpacked after processing node module dir content + // e.g. node-notifier/example/advanced.js processed, but only on process vendor/terminal-notifier.app module will be marked as unpacked + await promises_1.mkdir(path.join(this.unpackedDest, filePathInArchive), { recursive: true }); + break; + } + } + }; + const transformedFiles = fileSet.transformedFiles; + const taskManager = new builder_util_1.AsyncTaskManager(packager.cancellationToken); + const fileCopier = new fs_1.FileCopier(); + let currentDirNode = null; + let currentDirPath = null; + const unpackedFileIndexSet = new Set(); + for (let i = 0, n = fileSet.files.length; i < n; i++) { + const file = fileSet.files[i]; + const stat = metadata.get(file); + if (stat == null) { + continue; + } + const pathInArchive = path.relative(rootForAppFilesWithoutAsar, appFileCopier_1.getDestinationPath(file, fileSet)); + if (stat.isSymbolicLink()) { + const s = stat; + this.fs.getOrCreateNode(pathInArchive).link = s.relativeLink; + s.pathInArchive = pathInArchive; + unpackedFileIndexSet.add(i); + continue; + } + let fileParent = path.dirname(pathInArchive); + if (fileParent === ".") { + fileParent = ""; + } + if (currentDirPath !== fileParent) { + if (fileParent.startsWith("..")) { + throw new Error(`Internal error: path must not start with "..": ${fileParent}`); + } + currentDirPath = fileParent; + currentDirNode = this.fs.getOrCreateNode(fileParent); + // do not check for root + if (fileParent !== "" && !currentDirNode.unpacked) { + if (unpackedDirs.has(fileParent)) { + currentDirNode.unpacked = true; + } + else { + await correctDirNodeUnpackedFlag(fileParent, currentDirNode); + } + } + } + const dirNode = currentDirNode; + const newData = transformedFiles == null ? undefined : transformedFiles.get(i); + const isUnpacked = dirNode.unpacked || (this.unpackPattern != null && this.unpackPattern(file, stat)); + const integrity = newData === undefined ? await integrity_1.hashFile(file) : integrity_1.hashFileContents(newData); + this.fs.addFileNode(file, dirNode, newData == undefined ? stat.size : Buffer.byteLength(newData), isUnpacked, stat, integrity); + if (isUnpacked) { + if (!dirNode.unpacked && !dirToCreateForUnpackedFiles.has(fileParent)) { + dirToCreateForUnpackedFiles.add(fileParent); + await promises_1.mkdir(path.join(this.unpackedDest, fileParent), { recursive: true }); + } + const unpackedFile = path.join(this.unpackedDest, pathInArchive); + taskManager.addTask(copyFileOrData(fileCopier, newData, file, unpackedFile, stat)); + if (taskManager.tasks.length > fs_1.MAX_FILE_REQUESTS) { + await taskManager.awaitTasks(); + } + unpackedFileIndexSet.add(i); + } + } + if (taskManager.tasks.length > 0) { + await taskManager.awaitTasks(); + } + return unpackedFileIndexSet; + } + writeAsarFile(fileSets, unpackedFileIndexMap) { + return new Promise((resolve, reject) => { + const headerPickle = pickle.createEmpty(); + headerPickle.writeString(JSON.stringify(this.fs.header)); + const headerBuf = headerPickle.toBuffer(); + const sizePickle = pickle.createEmpty(); + sizePickle.writeUInt32(headerBuf.length); + const sizeBuf = sizePickle.toBuffer(); + const writeStream = fs_2.createWriteStream(this.outFile); + writeStream.on("error", reject); + writeStream.on("close", resolve); + writeStream.write(sizeBuf); + let fileSetIndex = 0; + let files = fileSets[0].files; + let metadata = fileSets[0].metadata; + let transformedFiles = fileSets[0].transformedFiles; + let unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[0]); + const w = (index) => { + while (true) { + if (index >= files.length) { + if (++fileSetIndex >= fileSets.length) { + writeStream.end(); + return; + } + else { + files = fileSets[fileSetIndex].files; + metadata = fileSets[fileSetIndex].metadata; + transformedFiles = fileSets[fileSetIndex].transformedFiles; + unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[fileSetIndex]); + index = 0; + } + } + if (!unpackedFileIndexSet.has(index)) { + break; + } + else { + const stat = metadata.get(files[index]); + if (stat != null && stat.isSymbolicLink()) { + fs_2.symlink(stat.linkRelativeToFile, path.join(this.unpackedDest, stat.pathInArchive), () => w(index + 1)); + return; + } + } + index++; + } + const data = transformedFiles == null ? null : transformedFiles.get(index); + const file = files[index]; + if (data !== null && data !== undefined) { + writeStream.write(data, () => w(index + 1)); + return; + } + // https://github.com/yarnpkg/yarn/pull/3539 + const stat = metadata.get(file); + if (stat != null && stat.size < 2 * 1024 * 1024) { + promises_1.readFile(file) + .then(it => { + writeStream.write(it, () => w(index + 1)); + }) + .catch(e => reject(`Cannot read file ${file}: ${e.stack || e}`)); + } + else { + const readStream = fs_2.createReadStream(file); + readStream.on("error", reject); + readStream.once("end", () => w(index + 1)); + readStream.on("open", () => { + readStream.pipe(writeStream, { + end: false, + }); + }); + } + }; + writeStream.write(headerBuf, () => w(0)); + }); + } +} +exports.AsarPackager = AsarPackager; +async function order(filenames, orderingFile, src) { + const orderingFiles = (await promises_1.readFile(orderingFile, "utf8")).split("\n").map(line => { + if (line.indexOf(":") !== -1) { + line = line.split(":").pop(); + } + line = line.trim(); + if (line[0] === "/") { + line = line.slice(1); + } + return line; + }); + const ordering = []; + for (const file of orderingFiles) { + const pathComponents = file.split(path.sep); + for (const pathComponent of pathComponents) { + ordering.push(path.join(src, pathComponent)); + } + } + const sortedFiles = []; + let missing = 0; + const total = filenames.length; + for (const file of ordering) { + if (!sortedFiles.includes(file) && filenames.includes(file)) { + sortedFiles.push(file); + } + } + for (const file of filenames) { + if (!sortedFiles.includes(file)) { + sortedFiles.push(file); + missing += 1; + } + } + builder_util_1.log.info({ coverage: ((total - missing) / total) * 100 }, "ordering files in ASAR archive"); + return sortedFiles; +} +function copyFileOrData(fileCopier, data, source, destination, stats) { + if (data == null) { + return fileCopier.copy(source, destination, stats); + } + else { + return promises_1.writeFile(destination, data); + } +} +//# sourceMappingURL=asarUtil.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/asarUtil.js.map b/client/node_modules/app-builder-lib/out/asar/asarUtil.js.map new file mode 100644 index 0000000000..2a85a11d82 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/asarUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asarUtil.js","sourceRoot":"","sources":["../../src/asar/asarUtil.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AACpD,4CAA2E;AAC3E,2BA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K,CAAC,CAAA;KACnD;SAAM;QACL,OAAO,oBAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;KACpC;AACH,CAAC","sourcesContent":["import { AsyncTaskManager, log } from \"builder-util\"\nimport { FileCopier, Filter, MAX_FILE_REQUESTS } from \"builder-util/out/fs\"\nimport { symlink, createReadStream, createWriteStream, Stats } from \"fs\"\nimport { writeFile, readFile, mkdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport { AsarOptions } from \"../options/PlatformSpecificBuildOptions\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { getDestinationPath, ResolvedFileSet } from \"../util/appFileCopier\"\nimport { AsarFilesystem, Node } from \"./asar\"\nimport { hashFile, hashFileContents } from \"./integrity\"\nimport { detectUnpackedDirs } from \"./unpackDetector\"\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst pickle = require(\"chromium-pickle-js\")\n\n/** @internal */\nexport class AsarPackager {\n private readonly fs = new AsarFilesystem(this.src)\n private readonly outFile: string\n private readonly unpackedDest: string\n\n constructor(private readonly src: string, private readonly destination: string, private readonly options: AsarOptions, private readonly unpackPattern: Filter | null) {\n this.outFile = path.join(destination, \"app.asar\")\n this.unpackedDest = `${this.outFile}.unpacked`\n }\n\n // sort files to minimize file change (i.e. asar file is not changed dramatically on small change)\n async pack(fileSets: Array, packager: PlatformPackager) {\n if (this.options.ordering != null) {\n // ordering doesn't support transformed files, but ordering is not used functionality - wait user report to fix it\n await order(fileSets[0].files, this.options.ordering, fileSets[0].src)\n }\n await mkdir(path.dirname(this.outFile), { recursive: true })\n const unpackedFileIndexMap = new Map>()\n for (const fileSet of fileSets) {\n unpackedFileIndexMap.set(fileSet, await this.createPackageFromFiles(fileSet, packager.info))\n }\n await this.writeAsarFile(fileSets, unpackedFileIndexMap)\n }\n\n private async createPackageFromFiles(fileSet: ResolvedFileSet, packager: Packager) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const unpackedDirs = new Set()\n const rootForAppFilesWithoutAsar = path.join(this.destination, \"app\")\n\n if (this.options.smartUnpack !== false) {\n await detectUnpackedDirs(fileSet, unpackedDirs, this.unpackedDest, rootForAppFilesWithoutAsar)\n }\n\n const dirToCreateForUnpackedFiles = new Set(unpackedDirs)\n\n const correctDirNodeUnpackedFlag = async (filePathInArchive: string, dirNode: Node) => {\n for (const dir of unpackedDirs) {\n if (filePathInArchive.length > dir.length + 2 && filePathInArchive[dir.length] === path.sep && filePathInArchive.startsWith(dir)) {\n dirNode.unpacked = true\n unpackedDirs.add(filePathInArchive)\n // not all dirs marked as unpacked after first iteration - because node module dir can be marked as unpacked after processing node module dir content\n // e.g. node-notifier/example/advanced.js processed, but only on process vendor/terminal-notifier.app module will be marked as unpacked\n await mkdir(path.join(this.unpackedDest, filePathInArchive), { recursive: true })\n break\n }\n }\n }\n\n const transformedFiles = fileSet.transformedFiles\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const fileCopier = new FileCopier()\n\n let currentDirNode: Node | null = null\n let currentDirPath: string | null = null\n\n const unpackedFileIndexSet = new Set()\n\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const file = fileSet.files[i]\n const stat = metadata.get(file)\n if (stat == null) {\n continue\n }\n\n const pathInArchive = path.relative(rootForAppFilesWithoutAsar, getDestinationPath(file, fileSet))\n\n if (stat.isSymbolicLink()) {\n const s = stat as any\n this.fs.getOrCreateNode(pathInArchive).link = s.relativeLink\n s.pathInArchive = pathInArchive\n unpackedFileIndexSet.add(i)\n continue\n }\n\n let fileParent = path.dirname(pathInArchive)\n if (fileParent === \".\") {\n fileParent = \"\"\n }\n\n if (currentDirPath !== fileParent) {\n if (fileParent.startsWith(\"..\")) {\n throw new Error(`Internal error: path must not start with \"..\": ${fileParent}`)\n }\n\n currentDirPath = fileParent\n currentDirNode = this.fs.getOrCreateNode(fileParent)\n // do not check for root\n if (fileParent !== \"\" && !currentDirNode.unpacked) {\n if (unpackedDirs.has(fileParent)) {\n currentDirNode.unpacked = true\n } else {\n await correctDirNodeUnpackedFlag(fileParent, currentDirNode)\n }\n }\n }\n\n const dirNode = currentDirNode!\n const newData = transformedFiles == null ? undefined : transformedFiles.get(i)\n const isUnpacked = dirNode.unpacked || (this.unpackPattern != null && this.unpackPattern(file, stat))\n const integrity = newData === undefined ? await hashFile(file) : hashFileContents(newData)\n this.fs.addFileNode(file, dirNode, newData == undefined ? stat.size : Buffer.byteLength(newData), isUnpacked, stat, integrity)\n if (isUnpacked) {\n if (!dirNode.unpacked && !dirToCreateForUnpackedFiles.has(fileParent)) {\n dirToCreateForUnpackedFiles.add(fileParent)\n await mkdir(path.join(this.unpackedDest, fileParent), { recursive: true })\n }\n\n const unpackedFile = path.join(this.unpackedDest, pathInArchive)\n taskManager.addTask(copyFileOrData(fileCopier, newData, file, unpackedFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n\n unpackedFileIndexSet.add(i)\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n return unpackedFileIndexSet\n }\n\n private writeAsarFile(fileSets: Array, unpackedFileIndexMap: Map>): Promise {\n return new Promise((resolve, reject) => {\n const headerPickle = pickle.createEmpty()\n headerPickle.writeString(JSON.stringify(this.fs.header))\n const headerBuf = headerPickle.toBuffer()\n\n const sizePickle = pickle.createEmpty()\n sizePickle.writeUInt32(headerBuf.length)\n\n const sizeBuf = sizePickle.toBuffer()\n const writeStream = createWriteStream(this.outFile)\n writeStream.on(\"error\", reject)\n writeStream.on(\"close\", resolve)\n writeStream.write(sizeBuf)\n\n let fileSetIndex = 0\n\n let files = fileSets[0].files\n let metadata = fileSets[0].metadata\n let transformedFiles = fileSets[0].transformedFiles\n let unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[0])!\n const w = (index: number) => {\n while (true) {\n if (index >= files.length) {\n if (++fileSetIndex >= fileSets.length) {\n writeStream.end()\n return\n } else {\n files = fileSets[fileSetIndex].files\n metadata = fileSets[fileSetIndex].metadata\n transformedFiles = fileSets[fileSetIndex].transformedFiles\n unpackedFileIndexSet = unpackedFileIndexMap.get(fileSets[fileSetIndex])!\n index = 0\n }\n }\n\n if (!unpackedFileIndexSet.has(index)) {\n break\n } else {\n const stat = metadata.get(files[index])\n if (stat != null && stat.isSymbolicLink()) {\n symlink((stat as any).linkRelativeToFile, path.join(this.unpackedDest, (stat as any).pathInArchive), () => w(index + 1))\n return\n }\n }\n index++\n }\n\n const data = transformedFiles == null ? null : transformedFiles.get(index)\n const file = files[index]\n if (data !== null && data !== undefined) {\n writeStream.write(data, () => w(index + 1))\n return\n }\n\n // https://github.com/yarnpkg/yarn/pull/3539\n const stat = metadata.get(file)\n if (stat != null && stat.size < 2 * 1024 * 1024) {\n readFile(file)\n .then(it => {\n writeStream.write(it, () => w(index + 1))\n })\n .catch(e => reject(`Cannot read file ${file}: ${e.stack || e}`))\n } else {\n const readStream = createReadStream(file)\n readStream.on(\"error\", reject)\n readStream.once(\"end\", () => w(index + 1))\n readStream.on(\"open\", () => {\n readStream.pipe(writeStream, {\n end: false,\n })\n })\n }\n }\n\n writeStream.write(headerBuf, () => w(0))\n })\n }\n}\n\nasync function order(filenames: Array, orderingFile: string, src: string) {\n const orderingFiles = (await readFile(orderingFile, \"utf8\")).split(\"\\n\").map(line => {\n if (line.indexOf(\":\") !== -1) {\n line = line.split(\":\").pop()!\n }\n line = line.trim()\n if (line[0] === \"/\") {\n line = line.slice(1)\n }\n return line\n })\n\n const ordering: Array = []\n for (const file of orderingFiles) {\n const pathComponents = file.split(path.sep)\n for (const pathComponent of pathComponents) {\n ordering.push(path.join(src, pathComponent))\n }\n }\n\n const sortedFiles: Array = []\n let missing = 0\n const total = filenames.length\n for (const file of ordering) {\n if (!sortedFiles.includes(file) && filenames.includes(file)) {\n sortedFiles.push(file)\n }\n }\n for (const file of filenames) {\n if (!sortedFiles.includes(file)) {\n sortedFiles.push(file)\n missing += 1\n }\n }\n log.info({ coverage: ((total - missing) / total) * 100 }, \"ordering files in ASAR archive\")\n return sortedFiles\n}\n\nfunction copyFileOrData(fileCopier: FileCopier, data: string | Buffer | undefined | null, source: string, destination: string, stats: Stats) {\n if (data == null) {\n return fileCopier.copy(source, destination, stats)\n } else {\n return writeFile(destination, data)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/integrity.d.ts b/client/node_modules/app-builder-lib/out/asar/integrity.d.ts new file mode 100644 index 0000000000..01da9f4aba --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/integrity.d.ts @@ -0,0 +1,16 @@ +/// +import { NodeIntegrity } from "./asar"; +export interface AsarIntegrityOptions { + readonly resourcesPath: string; + readonly resourcesRelativePath: string; +} +export interface HeaderHash { + algorithm: "SHA256"; + hash: string; +} +export interface AsarIntegrity { + [key: string]: HeaderHash; +} +export declare function computeData({ resourcesPath, resourcesRelativePath }: AsarIntegrityOptions): Promise; +export declare function hashFile(file: string, blockSize?: number): Promise; +export declare function hashFileContents(contents: Buffer | string, blockSize?: number): NodeIntegrity; diff --git a/client/node_modules/app-builder-lib/out/asar/integrity.js b/client/node_modules/app-builder-lib/out/asar/integrity.js new file mode 100644 index 0000000000..a4b980024d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/integrity.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hashFileContents = exports.hashFile = exports.computeData = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const crypto_1 = require("crypto"); +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const asar_1 = require("./asar"); +async function computeData({ resourcesPath, resourcesRelativePath }) { + // sort to produce constant result + const names = (await promises_1.readdir(resourcesPath)).filter(it => it.endsWith(".asar")).sort(); + const checksums = await bluebird_lst_1.default.map(names, it => hashHeader(path.join(resourcesPath, it))); + const result = {}; + for (let i = 0; i < names.length; i++) { + result[path.join(resourcesRelativePath, names[i])] = checksums[i]; + } + return result; +} +exports.computeData = computeData; +async function hashHeader(file) { + const hash = crypto_1.createHash("sha256"); + const { header } = await asar_1.readAsarHeader(file); + hash.update(header); + return { + algorithm: "SHA256", + hash: hash.digest("hex"), + }; +} +function hashFile(file, blockSize = 4 * 1024 * 1024) { + return new Promise((resolve, reject) => { + const hash = crypto_1.createHash("sha256"); + const blocks = new Array(); + let blockBytes = 0; + let blockHash = crypto_1.createHash("sha256"); + function updateBlockHash(chunk) { + let off = 0; + while (off < chunk.length) { + const toHash = Math.min(blockSize - blockBytes, chunk.length - off); + blockHash.update(chunk.slice(off, off + toHash)); + off += toHash; + blockBytes += toHash; + if (blockBytes === blockSize) { + blocks.push(blockHash.digest("hex")); + blockHash = crypto_1.createHash("sha256"); + blockBytes = 0; + } + } + } + fs_1.createReadStream(file) + .on("data", it => { + // Note that `it` is a Buffer anyway so this cast is a no-op + updateBlockHash(Buffer.from(it)); + hash.update(it); + }) + .on("error", reject) + .on("end", () => { + if (blockBytes !== 0) { + blocks.push(blockHash.digest("hex")); + } + resolve({ + algorithm: "SHA256", + hash: hash.digest("hex"), + blockSize, + blocks, + }); + }); + }); +} +exports.hashFile = hashFile; +function hashFileContents(contents, blockSize = 4 * 1024 * 1024) { + const buffer = Buffer.from(contents); + const hash = crypto_1.createHash("sha256"); + hash.update(buffer); + const blocks = new Array(); + for (let off = 0; off < buffer.length; off += blockSize) { + const blockHash = crypto_1.createHash("sha256"); + blockHash.update(buffer.slice(off, off + blockSize)); + blocks.push(blockHash.digest("hex")); + } + return { + algorithm: "SHA256", + hash: hash.digest("hex"), + blockSize, + blocks, + }; +} +exports.hashFileContents = hashFileContents; +//# sourceMappingURL=integrity.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/integrity.js.map b/client/node_modules/app-builder-lib/out/asar/integrity.js.map new file mode 100644 index 0000000000..bc72f4a81f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/integrity.js.map @@ -0,0 +1 @@ +{"version":3,"file":"integrity.js","sourceRoot":"","sources":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AE;YACd,IAAI,UAAU,KAAK,CAAC,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;aACrC;YACD,OAAO,CAAC;gBACN,SAAS,EAAE,QAAQ;gBACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBACxB,SAAS;gBACT,MAAM;aACP,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACJ,CAAC;AA5CD,4BA4CC;AAED,SAAgB,gBAAgB,CAAC,QAAyB,EAAE,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;IACrF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAEnB,MAAM,MAAM,GAAG,IAAI,KAAK,EAAU,CAAA;IAElC,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,SAAS,EAAE;QACvD,MAAM,SAAS,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;QACtC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;KACrC;IAED,OAAO;QACL,SAAS,EAAE,QAAQ;QACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACxB,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC;AAnBD,4CAmBC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { createHash } from \"crypto\"\nimport { createReadStream } from \"fs\"\nimport { readdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport { readAsarHeader, NodeIntegrity } from \"./asar\"\n\nexport interface AsarIntegrityOptions {\n readonly resourcesPath: string\n readonly resourcesRelativePath: string\n}\n\nexport interface HeaderHash {\n algorithm: \"SHA256\"\n hash: string\n}\n\nexport interface AsarIntegrity {\n [key: string]: HeaderHash\n}\n\nexport async function computeData({ resourcesPath, resourcesRelativePath }: AsarIntegrityOptions): Promise {\n // sort to produce constant result\n const names = (await readdir(resourcesPath)).filter(it => it.endsWith(\".asar\")).sort()\n const checksums = await BluebirdPromise.map(names, it => hashHeader(path.join(resourcesPath, it)))\n\n const result: AsarIntegrity = {}\n for (let i = 0; i < names.length; i++) {\n result[path.join(resourcesRelativePath, names[i])] = checksums[i]\n }\n return result\n}\n\nasync function hashHeader(file: string): Promise {\n const hash = createHash(\"sha256\")\n const { header } = await readAsarHeader(file)\n hash.update(header)\n return {\n algorithm: \"SHA256\",\n hash: hash.digest(\"hex\"),\n }\n}\n\nexport function hashFile(file: string, blockSize = 4 * 1024 * 1024): Promise {\n return new Promise((resolve, reject) => {\n const hash = createHash(\"sha256\")\n\n const blocks = new Array()\n\n let blockBytes = 0\n let blockHash = createHash(\"sha256\")\n\n function updateBlockHash(chunk: Buffer) {\n let off = 0\n while (off < chunk.length) {\n const toHash = Math.min(blockSize - blockBytes, chunk.length - off)\n blockHash.update(chunk.slice(off, off + toHash))\n off += toHash\n blockBytes += toHash\n\n if (blockBytes === blockSize) {\n blocks.push(blockHash.digest(\"hex\"))\n blockHash = createHash(\"sha256\")\n blockBytes = 0\n }\n }\n }\n\n createReadStream(file)\n .on(\"data\", it => {\n // Note that `it` is a Buffer anyway so this cast is a no-op\n updateBlockHash(Buffer.from(it))\n hash.update(it)\n })\n .on(\"error\", reject)\n .on(\"end\", () => {\n if (blockBytes !== 0) {\n blocks.push(blockHash.digest(\"hex\"))\n }\n resolve({\n algorithm: \"SHA256\",\n hash: hash.digest(\"hex\"),\n blockSize,\n blocks,\n })\n })\n })\n}\n\nexport function hashFileContents(contents: Buffer | string, blockSize = 4 * 1024 * 1024): NodeIntegrity {\n const buffer = Buffer.from(contents)\n const hash = createHash(\"sha256\")\n hash.update(buffer)\n\n const blocks = new Array()\n\n for (let off = 0; off < buffer.length; off += blockSize) {\n const blockHash = createHash(\"sha256\")\n blockHash.update(buffer.slice(off, off + blockSize))\n blocks.push(blockHash.digest(\"hex\"))\n }\n\n return {\n algorithm: \"SHA256\",\n hash: hash.digest(\"hex\"),\n blockSize,\n blocks,\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/unpackDetector.d.ts b/client/node_modules/app-builder-lib/out/asar/unpackDetector.d.ts new file mode 100644 index 0000000000..e7e2d19a3a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/unpackDetector.d.ts @@ -0,0 +1 @@ +export declare function isLibOrExe(file: string): boolean; diff --git a/client/node_modules/app-builder-lib/out/asar/unpackDetector.js b/client/node_modules/app-builder-lib/out/asar/unpackDetector.js new file mode 100644 index 0000000000..589bfd9c8d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/unpackDetector.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.detectUnpackedDirs = exports.isLibOrExe = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const isbinaryfile_1 = require("isbinaryfile"); +const path = require("path"); +const fileTransformer_1 = require("../fileTransformer"); +const appFileCopier_1 = require("../util/appFileCopier"); +function addValue(map, key, value) { + let list = map.get(key); + if (list == null) { + list = [value]; + map.set(key, list); + } + else { + list.push(value); + } +} +function isLibOrExe(file) { + return file.endsWith(".dll") || file.endsWith(".exe") || file.endsWith(".dylib") || file.endsWith(".so"); +} +exports.isLibOrExe = isLibOrExe; +/** @internal */ +async function detectUnpackedDirs(fileSet, autoUnpackDirs, unpackedDest, rootForAppFilesWithoutAsar) { + const dirToCreate = new Map(); + const metadata = fileSet.metadata; + function addParents(child, root) { + child = path.dirname(child); + if (autoUnpackDirs.has(child)) { + return; + } + do { + autoUnpackDirs.add(child); + const p = path.dirname(child); + // create parent dir to be able to copy file later without directory existence check + addValue(dirToCreate, p, path.basename(child)); + if (child === root || p === root || autoUnpackDirs.has(p)) { + break; + } + child = p; + } while (true); + autoUnpackDirs.add(root); + } + for (let i = 0, n = fileSet.files.length; i < n; i++) { + const file = fileSet.files[i]; + const index = file.lastIndexOf(fileTransformer_1.NODE_MODULES_PATTERN); + if (index < 0) { + continue; + } + let nextSlashIndex = file.indexOf(path.sep, index + fileTransformer_1.NODE_MODULES_PATTERN.length + 1); + if (nextSlashIndex < 0) { + continue; + } + if (file[index + fileTransformer_1.NODE_MODULES_PATTERN.length] === "@") { + nextSlashIndex = file.indexOf(path.sep, nextSlashIndex + 1); + } + if (!metadata.get(file).isFile()) { + continue; + } + const packageDir = file.substring(0, nextSlashIndex); + const packageDirPathInArchive = path.relative(rootForAppFilesWithoutAsar, appFileCopier_1.getDestinationPath(packageDir, fileSet)); + const pathInArchive = path.relative(rootForAppFilesWithoutAsar, appFileCopier_1.getDestinationPath(file, fileSet)); + if (autoUnpackDirs.has(packageDirPathInArchive)) { + // if package dir is unpacked, any file also unpacked + addParents(pathInArchive, packageDirPathInArchive); + continue; + } + // https://github.com/electron-userland/electron-builder/issues/2679 + let shouldUnpack = false; + // ffprobe-static and ffmpeg-static are known packages to always unpack + const moduleName = path.basename(packageDir); + if (moduleName === "ffprobe-static" || moduleName === "ffmpeg-static" || isLibOrExe(file)) { + shouldUnpack = true; + } + else if (!file.includes(".", nextSlashIndex)) { + shouldUnpack = !!isbinaryfile_1.isBinaryFileSync(file); + } + if (!shouldUnpack) { + continue; + } + if (builder_util_1.log.isDebugEnabled) { + builder_util_1.log.debug({ file: pathInArchive, reason: "contains executable code" }, "not packed into asar archive"); + } + addParents(pathInArchive, packageDirPathInArchive); + } + if (dirToCreate.size > 0) { + await fs_extra_1.mkdir(`${unpackedDest + path.sep}node_modules`, { recursive: true }); + // child directories should be not created asynchronously - parent directories should be created first + await bluebird_lst_1.default.map(dirToCreate.keys(), async (parentDir) => { + const base = unpackedDest + path.sep + parentDir; + await fs_extra_1.mkdir(base, { recursive: true }); + await bluebird_lst_1.default.each(dirToCreate.get(parentDir), (it) => { + if (dirToCreate.has(parentDir + path.sep + it)) { + // already created + return null; + } + else { + return fs_extra_1.mkdir(base + path.sep + it, { recursive: true }); + } + }); + }, fs_1.CONCURRENCY); + } +} +exports.detectUnpackedDirs = detectUnpackedDirs; +//# sourceMappingURL=unpackDetector.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/asar/unpackDetector.js.map b/client/node_modules/app-builder-lib/out/asar/unpackDetector.js.map new file mode 100644 index 0000000000..db2b0a572c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/asar/unpackDetector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unpackDetector.js","sourceRoot":"","sources":["../../src/asar/unpackDetector.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAkC;AAClC,4CAAiD;AACjD,uCAAgC;AAChC,+CAA+C;AAC/C,6BAA4B;AAC5B,wDAAyD;AACzD,yDAA2E;AAE3E,SAAS,QAAQ,CAAC,GAA+B,EAAE,GAAW,EAAE,KAAa;IAC3E,IAAI,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;QACd,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;KACnB;SAAM;QACL,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;KACjB;AACH,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MA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C,EACD,gBAAW,CACZ,CAAA;KACF;AACH,CAAC;AA/FD,gDA+FC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { log } from \"builder-util\"\nimport { CONCURRENCY } from \"builder-util/out/fs\"\nimport { mkdir } from \"fs-extra\"\nimport { isBinaryFileSync } from \"isbinaryfile\"\nimport * as path from \"path\"\nimport { NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { getDestinationPath, ResolvedFileSet } from \"../util/appFileCopier\"\n\nfunction addValue(map: Map>, key: string, value: string) {\n let list = map.get(key)\n if (list == null) {\n list = [value]\n map.set(key, list)\n } else {\n list.push(value)\n }\n}\n\nexport function isLibOrExe(file: string): boolean {\n return file.endsWith(\".dll\") || file.endsWith(\".exe\") || file.endsWith(\".dylib\") || file.endsWith(\".so\")\n}\n\n/** @internal */\nexport async function detectUnpackedDirs(fileSet: ResolvedFileSet, autoUnpackDirs: Set, unpackedDest: string, rootForAppFilesWithoutAsar: string) {\n const dirToCreate = new Map>()\n const metadata = fileSet.metadata\n\n function addParents(child: string, root: string) {\n child = path.dirname(child)\n if (autoUnpackDirs.has(child)) {\n return\n }\n\n do {\n autoUnpackDirs.add(child)\n const p = path.dirname(child)\n // create parent dir to be able to copy file later without directory existence check\n addValue(dirToCreate, p, path.basename(child))\n\n if (child === root || p === root || autoUnpackDirs.has(p)) {\n break\n }\n child = p\n } while (true)\n\n autoUnpackDirs.add(root)\n }\n\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const file = fileSet.files[i]\n const index = file.lastIndexOf(NODE_MODULES_PATTERN)\n if (index < 0) {\n continue\n }\n\n let nextSlashIndex = file.indexOf(path.sep, index + NODE_MODULES_PATTERN.length + 1)\n if (nextSlashIndex < 0) {\n continue\n }\n\n if (file[index + NODE_MODULES_PATTERN.length] === \"@\") {\n nextSlashIndex = file.indexOf(path.sep, nextSlashIndex + 1)\n }\n\n if (!metadata.get(file)!.isFile()) {\n continue\n }\n\n const packageDir = file.substring(0, nextSlashIndex)\n const packageDirPathInArchive = path.relative(rootForAppFilesWithoutAsar, getDestinationPath(packageDir, fileSet))\n const pathInArchive = path.relative(rootForAppFilesWithoutAsar, getDestinationPath(file, fileSet))\n if (autoUnpackDirs.has(packageDirPathInArchive)) {\n // if package dir is unpacked, any file also unpacked\n addParents(pathInArchive, packageDirPathInArchive)\n continue\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2679\n let shouldUnpack = false\n // ffprobe-static and ffmpeg-static are known packages to always unpack\n const moduleName = path.basename(packageDir)\n if (moduleName === \"ffprobe-static\" || moduleName === \"ffmpeg-static\" || isLibOrExe(file)) {\n shouldUnpack = true\n } else if (!file.includes(\".\", nextSlashIndex)) {\n shouldUnpack = !!isBinaryFileSync(file)\n }\n\n if (!shouldUnpack) {\n continue\n }\n\n if (log.isDebugEnabled) {\n log.debug({ file: pathInArchive, reason: \"contains executable code\" }, \"not packed into asar archive\")\n }\n\n addParents(pathInArchive, packageDirPathInArchive)\n }\n\n if (dirToCreate.size > 0) {\n await mkdir(`${unpackedDest + path.sep}node_modules`, { recursive: true })\n // child directories should be not created asynchronously - parent directories should be created first\n await BluebirdPromise.map(\n dirToCreate.keys(),\n async parentDir => {\n const base = unpackedDest + path.sep + parentDir\n await mkdir(base, { recursive: true })\n await BluebirdPromise.each(dirToCreate.get(parentDir)!, (it): any => {\n if (dirToCreate.has(parentDir + path.sep + it)) {\n // already created\n return null\n } else {\n return mkdir(base + path.sep + it, { recursive: true })\n }\n })\n },\n CONCURRENCY\n )\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/binDownload.d.ts b/client/node_modules/app-builder-lib/out/binDownload.d.ts new file mode 100644 index 0000000000..7f5938a007 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/binDownload.d.ts @@ -0,0 +1,4 @@ +export declare function download(url: string, output: string, checksum?: string | null): Promise; +export declare function getBinFromCustomLoc(name: string, version: string, binariesLocUrl: string, checksum: string): Promise; +export declare function getBinFromUrl(name: string, version: string, checksum: string): Promise; +export declare function getBin(name: string, url?: string | null, checksum?: string | null): Promise; diff --git a/client/node_modules/app-builder-lib/out/binDownload.js b/client/node_modules/app-builder-lib/out/binDownload.js new file mode 100644 index 0000000000..4f0a4f02b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/binDownload.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getBin = exports.getBinFromUrl = exports.getBinFromCustomLoc = exports.download = void 0; +const builder_util_1 = require("builder-util"); +const versionToPromise = new Map(); +function download(url, output, checksum) { + const args = ["download", "--url", url, "--output", output]; + if (checksum != null) { + args.push("--sha512", checksum); + } + return builder_util_1.executeAppBuilder(args); +} +exports.download = download; +function getBinFromCustomLoc(name, version, binariesLocUrl, checksum) { + const dirName = `${name}-${version}`; + return getBin(dirName, binariesLocUrl, checksum); +} +exports.getBinFromCustomLoc = getBinFromCustomLoc; +function getBinFromUrl(name, version, checksum) { + const dirName = `${name}-${version}`; + let url; + if (process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL) { + url = process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL + "/" + dirName + ".7z"; + } + else { + const baseUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR || + process.env.npm_config_electron_builder_binaries_mirror || + process.env.npm_package_config_electron_builder_binaries_mirror || + process.env.ELECTRON_BUILDER_BINARIES_MIRROR || + "https://github.com/electron-userland/electron-builder-binaries/releases/download/"; + const middleUrl = process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR || + process.env.npm_config_electron_builder_binaries_custom_dir || + process.env.npm_package_config_electron_builder_binaries_custom_dir || + process.env.ELECTRON_BUILDER_BINARIES_CUSTOM_DIR || + dirName; + const urlSuffix = dirName + ".7z"; + url = `${baseUrl}${middleUrl}/${urlSuffix}`; + } + return getBin(dirName, url, checksum); +} +exports.getBinFromUrl = getBinFromUrl; +function getBin(name, url, checksum) { + // Old cache is ignored if cache environment variable changes + const cacheName = `${process.env.ELECTRON_BUILDER_CACHE}${name}`; + let promise = versionToPromise.get(cacheName); // if rejected, we will try to download again + if (promise != null) { + return promise; + } + promise = doGetBin(name, url, checksum); + versionToPromise.set(cacheName, promise); + return promise; +} +exports.getBin = getBin; +function doGetBin(name, url, checksum) { + const args = ["download-artifact", "--name", name]; + if (url != null) { + args.push("--url", url); + } + if (checksum != null) { + args.push("--sha512", checksum); + } + return builder_util_1.executeAppBuilder(args); +} +//# sourceMappingURL=binDownload.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/binDownload.js.map b/client/node_modules/app-builder-lib/out/binDownload.js.map new file mode 100644 index 0000000000..deb16ac544 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/binDownload.js.map @@ -0,0 +1 @@ +{"version":3,"file":"binDownload.js","sourceRoot":"","sources":["../src/binDownload.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAEhD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAA;AAE3D,SAAgB,QAAQ,CAAC,GAAW,EAAE,MAAc,EAAE,QAAwB;IAC5E,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IAC3D,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;KAChC;IACD,OAAO,gCAAiB,CAAC,IAAI,CAAiB,CAAA;AAChD,CAAC;AAND,4BAMC;AAED,SAAgB,mBAAmB,CAAC,IAAY,EAAE,OAAe,EAAE,cAAsB,EAAE,QAAgB;IACzG,MAAM,OAAO,GAAG,GAAG,IAAI,IAAI,OAAO,EAAE,CAAA;IACpC,OAAO,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAA;AAClD,CAAC;AAHD,kDAGC;AAED,SAAgB,aAAa,CAAC,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,QAAQ,CAAC,CAAA;IACvC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACxC,OAAO,OAAO,CAAA;AAChB,CAAC;AAZD,wBAYC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,GAA8B,EAAE,QAAmC;IACjG,MAAM,IAAI,GAAG,CAAC,mBAAmB,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IAClD,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KACxB;IACD,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;KAChC;IACD,OAAO,gCAAiB,CAAC,IAAI,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import { executeAppBuilder } from \"builder-util\"\n\nconst versionToPromise = new Map>()\n\nexport function download(url: string, output: string, checksum?: string | null): Promise {\n const args = [\"download\", \"--url\", url, \"--output\", output]\n if (checksum != null) {\n args.push(\"--sha512\", checksum)\n }\n return executeAppBuilder(args) as Promise\n}\n\nexport function getBinFromCustomLoc(name: string, version: string, binariesLocUrl: string, checksum: string): Promise {\n const dirName = `${name}-${version}`\n return getBin(dirName, binariesLocUrl, checksum)\n}\n\nexport function getBinFromUrl(name: string, version: string, checksum: string): Promise {\n const dirName = `${name}-${version}`\n let url: string\n if (process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL) {\n url = process.env.ELECTRON_BUILDER_BINARIES_DOWNLOAD_OVERRIDE_URL + \"/\" + dirName + \".7z\"\n } else {\n const baseUrl =\n process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_MIRROR ||\n process.env.npm_config_electron_builder_binaries_mirror ||\n process.env.npm_package_config_electron_builder_binaries_mirror ||\n process.env.ELECTRON_BUILDER_BINARIES_MIRROR ||\n \"https://github.com/electron-userland/electron-builder-binaries/releases/download/\"\n const middleUrl =\n process.env.NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR ||\n process.env.npm_config_electron_builder_binaries_custom_dir ||\n process.env.npm_package_config_electron_builder_binaries_custom_dir ||\n process.env.ELECTRON_BUILDER_BINARIES_CUSTOM_DIR ||\n dirName\n const urlSuffix = dirName + \".7z\"\n url = `${baseUrl}${middleUrl}/${urlSuffix}`\n }\n\n return getBin(dirName, url, checksum)\n}\n\nexport function getBin(name: string, url?: string | null, checksum?: string | null): Promise {\n // Old cache is ignored if cache environment variable changes\n const cacheName = `${process.env.ELECTRON_BUILDER_CACHE}${name}`\n let promise = versionToPromise.get(cacheName) // if rejected, we will try to download again\n\n if (promise != null) {\n return promise\n }\n\n promise = doGetBin(name, url, checksum)\n versionToPromise.set(cacheName, promise)\n return promise\n}\n\nfunction doGetBin(name: string, url: string | undefined | null, checksum: string | null | undefined): Promise {\n const args = [\"download-artifact\", \"--name\", name]\n if (url != null) {\n args.push(\"--url\", url)\n }\n if (checksum != null) {\n args.push(\"--sha512\", checksum)\n }\n return executeAppBuilder(args)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/codesign.d.ts b/client/node_modules/app-builder-lib/out/codeSign/codesign.d.ts new file mode 100644 index 0000000000..8156f34207 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/codesign.d.ts @@ -0,0 +1,3 @@ +import { TmpDir } from "temp-file"; +/** @private */ +export declare function importCertificate(cscLink: string, tmpDir: TmpDir, currentDir: string): Promise; diff --git a/client/node_modules/app-builder-lib/out/codeSign/codesign.js b/client/node_modules/app-builder-lib/out/codeSign/codesign.js new file mode 100644 index 0000000000..908506d6d4 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/codesign.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.importCertificate = void 0; +const fs_extra_1 = require("fs-extra"); +const os_1 = require("os"); +const path = require("path"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const binDownload_1 = require("../binDownload"); +/** @private */ +async function importCertificate(cscLink, tmpDir, currentDir) { + var _a, _b; + cscLink = cscLink.trim(); + let file = null; + if ((cscLink.length > 3 && cscLink[1] === ":") || cscLink.startsWith("/") || cscLink.startsWith(".")) { + file = cscLink; + } + else if (cscLink.startsWith("file://")) { + file = cscLink.substring("file://".length); + } + else if (cscLink.startsWith("~/")) { + file = path.join(os_1.homedir(), cscLink.substring("~/".length)); + } + else if (cscLink.startsWith("https://")) { + const tempFile = await tmpDir.getTempFile({ suffix: ".p12" }); + await binDownload_1.download(cscLink, tempFile); + return tempFile; + } + else { + const mimeType = (_a = /data:.*;base64,/.exec(cscLink)) === null || _a === void 0 ? void 0 : _a[0]; + if (mimeType || cscLink.length > 2048 || cscLink.endsWith("=")) { + const tempFile = await tmpDir.getTempFile({ suffix: ".p12" }); + await fs_extra_1.outputFile(tempFile, Buffer.from(cscLink.substring((_b = mimeType === null || mimeType === void 0 ? void 0 : mimeType.length) !== null && _b !== void 0 ? _b : 0), "base64")); + return tempFile; + } + file = cscLink; + } + file = path.resolve(currentDir, file); + const stat = await fs_1.statOrNull(file); + if (stat == null) { + throw new builder_util_1.InvalidConfigurationError(`${file} doesn't exist`); + } + else if (!stat.isFile()) { + throw new builder_util_1.InvalidConfigurationError(`${file} not a file`); + } + else { + return file; + } +} +exports.importCertificate = importCertificate; +//# sourceMappingURL=codesign.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/codesign.js.map b/client/node_modules/app-builder-lib/out/codeSign/codesign.js.map new file mode 100644 index 0000000000..8bbc014a14 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/codesign.js.map @@ -0,0 +1 @@ +{"version":3,"file":"codesign.js","sourceRoot":"","sources":["../../src/codeSign/codesign.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AACrC,2BAA4B;AAC5B,6BAA4B;AAE5B,+CAAwD;AACxD,4CAA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,EAAE,MAAM,EAAE,CAAC,CAAA;YAC7D,MAAM,qBAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,mCAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;YAC3F,OAAO,QAAQ,CAAA;SAChB;QACD,IAAI,GAAG,OAAO,CAAA;KACf;IAED,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACrC,MAAM,IAAI,GAAG,MAAM,eAAU,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,wCAAyB,CAAC,GAAG,IAAI,gBAAgB,CAAC,CAAA;KAC7D;SAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;QACzB,MAAM,IAAI,wCAAyB,CAAC,GAAG,IAAI,aAAa,CAAC,CAAA;KAC1D;SAAM;QACL,OAAO,IAAI,CAAA;KACZ;AACH,CAAC;AAjCD,8CAiCC","sourcesContent":["import { outputFile } from \"fs-extra\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { TmpDir } from \"temp-file\"\nimport { InvalidConfigurationError } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { download } from \"../binDownload\"\n\n/** @private */\nexport async function importCertificate(cscLink: string, tmpDir: TmpDir, currentDir: string): Promise {\n cscLink = cscLink.trim()\n\n let file: string | null = null\n if ((cscLink.length > 3 && cscLink[1] === \":\") || cscLink.startsWith(\"/\") || cscLink.startsWith(\".\")) {\n file = cscLink\n } else if (cscLink.startsWith(\"file://\")) {\n file = cscLink.substring(\"file://\".length)\n } else if (cscLink.startsWith(\"~/\")) {\n file = path.join(homedir(), cscLink.substring(\"~/\".length))\n } else if (cscLink.startsWith(\"https://\")) {\n const tempFile = await tmpDir.getTempFile({ suffix: \".p12\" })\n await download(cscLink, tempFile)\n return tempFile\n } else {\n const mimeType = /data:.*;base64,/.exec(cscLink)?.[0]\n if (mimeType || cscLink.length > 2048 || cscLink.endsWith(\"=\")) {\n const tempFile = await tmpDir.getTempFile({ suffix: \".p12\" })\n await outputFile(tempFile, Buffer.from(cscLink.substring(mimeType?.length ?? 0), \"base64\"))\n return tempFile\n }\n file = cscLink\n }\n\n file = path.resolve(currentDir, file)\n const stat = await statOrNull(file)\n if (stat == null) {\n throw new InvalidConfigurationError(`${file} doesn't exist`)\n } else if (!stat.isFile()) {\n throw new InvalidConfigurationError(`${file} not a file`)\n } else {\n return file\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.d.ts b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.d.ts new file mode 100644 index 0000000000..4861ea15a8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.d.ts @@ -0,0 +1,27 @@ +import { TmpDir } from "builder-util/out/util"; +export declare const appleCertificatePrefixes: string[]; +export declare type CertType = "Developer ID Application" | "Developer ID Installer" | "3rd Party Mac Developer Application" | "3rd Party Mac Developer Installer" | "Mac Developer" | "Apple Development" | "Apple Distribution"; +export interface CodeSigningInfo { + keychainFile?: string | null; +} +export declare function isSignAllowed(isPrintWarn?: boolean): boolean; +export declare function reportError(isMas: boolean, certificateTypes: CertType[], qualifier: string | null | undefined, keychainFile: string | null | undefined, isForceCodeSigning: boolean): Promise; +export interface CreateKeychainOptions { + tmpDir: TmpDir; + cscLink: string; + cscKeyPassword: string; + cscILink?: string | null; + cscIKeyPassword?: string | null; + currentDir: string; +} +export declare function removeKeychain(keychainFile: string, printWarn?: boolean): Promise; +export declare function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise; +/** @private */ +export declare function sign(path: string, name: string, keychain: string): Promise; +export declare let findIdentityRawResult: Promise> | null; +export declare class Identity { + readonly name: string; + readonly hash: string; + constructor(name: string, hash: string); +} +export declare function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise; diff --git a/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js new file mode 100644 index 0000000000..30752226f8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js @@ -0,0 +1,280 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.findIdentity = exports.findIdentityRawResult = exports.sign = exports.createKeychain = exports.removeKeychain = exports.reportError = exports.isSignAllowed = exports.appleCertificatePrefixes = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const util_1 = require("builder-util/out/util"); +const fs_1 = require("builder-util/out/fs"); +const log_1 = require("builder-util/out/log"); +const crypto_1 = require("crypto"); +const promises_1 = require("fs/promises"); +const lazy_val_1 = require("lazy-val"); +const os_1 = require("os"); +const path = require("path"); +const temp_file_1 = require("temp-file"); +const flags_1 = require("../util/flags"); +const codesign_1 = require("./codesign"); +exports.appleCertificatePrefixes = ["Developer ID Application:", "Developer ID Installer:", "3rd Party Mac Developer Application:", "3rd Party Mac Developer Installer:"]; +function isSignAllowed(isPrintWarn = true) { + if (process.platform !== "darwin") { + if (isPrintWarn) { + util_1.log.warn({ reason: "supported only on macOS" }, "skipped macOS application code signing"); + } + return false; + } + const buildForPrWarning = "There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + + "\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you."; + if (util_1.isPullRequest()) { + if (util_1.isEnvTrue(process.env.CSC_FOR_PULL_REQUEST)) { + if (isPrintWarn) { + util_1.log.warn(buildForPrWarning); + } + } + else { + if (isPrintWarn) { + // https://github.com/electron-userland/electron-builder/issues/1524 + util_1.log.warn("Current build is a part of pull request, code signing will be skipped." + "\nSet env CSC_FOR_PULL_REQUEST to true to force code signing." + `\n${buildForPrWarning}`); + } + return false; + } + } + return true; +} +exports.isSignAllowed = isSignAllowed; +async function reportError(isMas, certificateTypes, qualifier, keychainFile, isForceCodeSigning) { + const logFields = {}; + if (qualifier == null) { + logFields.reason = ""; + if (flags_1.isAutoDiscoveryCodeSignIdentity()) { + logFields.reason += `cannot find valid "${certificateTypes.join(", ")}" identity${isMas ? "" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`}`; + } + logFields.reason += ", see https://electron.build/code-signing"; + if (!flags_1.isAutoDiscoveryCodeSignIdentity()) { + logFields.CSC_IDENTITY_AUTO_DISCOVERY = false; + } + } + else { + logFields.reason = "Identity name is specified, but no valid identity with this name in the keychain"; + logFields.identity = qualifier; + } + const args = ["find-identity"]; + if (keychainFile != null) { + args.push(keychainFile); + } + if (qualifier != null || flags_1.isAutoDiscoveryCodeSignIdentity()) { + logFields.allIdentities = (await util_1.exec("security", args)) + .trim() + .split("\n") + .filter(it => !(it.includes("Policy: X.509 Basic") || it.includes("Matching identities"))) + .join("\n"); + } + if (isMas || isForceCodeSigning) { + throw new Error(log_1.Logger.createMessage("skipped macOS application code signing", logFields, "error", it => it)); + } + else { + util_1.log.warn(logFields, "skipped macOS application code signing"); + } +} +exports.reportError = reportError; +// "Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list." +// but "security list-keychains" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list +// "overly complicated and introduces a race condition." +// https://github.com/electron-userland/electron-builder/issues/398 +const bundledCertKeychainAdded = new lazy_val_1.Lazy(async () => { + // copy to temp and then atomic rename to final path + const cacheDir = getCacheDirectory(); + const tmpKeychainPath = path.join(cacheDir, temp_file_1.getTempName("electron-builder-root-certs")); + const keychainPath = path.join(cacheDir, "electron-builder-root-certs.keychain"); + const results = await Promise.all([ + listUserKeychains(), + fs_1.copyFile(path.join(__dirname, "..", "..", "certs", "root_certs.keychain"), tmpKeychainPath).then(() => promises_1.rename(tmpKeychainPath, keychainPath)), + ]); + const list = results[0]; + if (!list.includes(keychainPath)) { + await util_1.exec("security", ["list-keychains", "-d", "user", "-s", keychainPath].concat(list)); + } +}); +function getCacheDirectory() { + const env = process.env.ELECTRON_BUILDER_CACHE; + return util_1.isEmptyOrSpaces(env) ? path.join(os_1.homedir(), "Library", "Caches", "electron-builder") : path.resolve(env); +} +function listUserKeychains() { + return util_1.exec("security", ["list-keychains", "-d", "user"]).then(it => it + .split("\n") + .map(it => { + const r = it.trim(); + return r.substring(1, r.length - 1); + }) + .filter(it => it.length > 0)); +} +function removeKeychain(keychainFile, printWarn = true) { + return util_1.exec("security", ["delete-keychain", keychainFile]).catch(e => { + if (printWarn) { + util_1.log.warn({ file: keychainFile, error: e.stack || e }, "cannot delete keychain"); + } + return fs_1.unlinkIfExists(keychainFile); + }); +} +exports.removeKeychain = removeKeychain; +async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }) { + // travis has correct AppleWWDRCA cert + if (process.env.TRAVIS !== "true") { + await bundledCertKeychainAdded.value; + } + // https://github.com/electron-userland/electron-builder/issues/3685 + // use constant file + const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || os_1.tmpdir(), `${crypto_1.createHash("sha256").update(currentDir).update("app-builder").digest("hex")}.keychain`); + // noinspection JSUnusedLocalSymbols + // eslint-disable-next-line @typescript-eslint/no-unused-vars + await removeKeychain(keychainFile, false).catch(_ => { + /* ignore*/ + }); + const certLinks = [cscLink]; + if (cscILink != null) { + certLinks.push(cscILink); + } + const certPaths = new Array(certLinks.length); + const keychainPassword = crypto_1.randomBytes(32).toString("base64"); + const securityCommands = [ + ["create-keychain", "-p", keychainPassword, keychainFile], + ["unlock-keychain", "-p", keychainPassword, keychainFile], + ["set-keychain-settings", keychainFile], + ]; + // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored + // https://github.com/electron-userland/electron-builder/issues/1457 + const list = await listUserKeychains(); + if (!list.includes(keychainFile)) { + securityCommands.push(["list-keychains", "-d", "user", "-s", keychainFile].concat(list)); + } + await Promise.all([ + // we do not clear downloaded files - will be removed on tmpDir cleanup automatically. not a security issue since in any case data is available as env variables and protected by password. + bluebird_lst_1.default.map(certLinks, (link, i) => codesign_1.importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))), + bluebird_lst_1.default.mapSeries(securityCommands, it => util_1.exec("security", it)), + ]); + return await importCerts(keychainFile, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null)); +} +exports.createKeychain = createKeychain; +async function importCerts(keychainFile, paths, keyPasswords) { + for (let i = 0; i < paths.length; i++) { + const password = keyPasswords[i]; + await util_1.exec("security", ["import", paths[i], "-k", keychainFile, "-T", "/usr/bin/codesign", "-T", "/usr/bin/productbuild", "-P", password]); + // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p + // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996 + await util_1.exec("security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", password, keychainFile]); + } + return { + keychainFile, + }; +} +/** @private */ +function sign(path, name, keychain) { + const args = ["--deep", "--force", "--sign", name, path]; + if (keychain != null) { + args.push("--keychain", keychain); + } + return util_1.exec("codesign", args); +} +exports.sign = sign; +exports.findIdentityRawResult = null; +async function getValidIdentities(keychain) { + function addKeychain(args) { + if (keychain != null) { + args.push(keychain); + } + return args; + } + let result = exports.findIdentityRawResult; + if (result == null || keychain != null) { + // https://github.com/electron-userland/electron-builder/issues/481 + // https://github.com/electron-userland/electron-builder/issues/535 + result = Promise.all([ + util_1.exec("security", addKeychain(["find-identity", "-v"])).then(it => it + .trim() + .split("\n") + .filter(it => { + for (const prefix of exports.appleCertificatePrefixes) { + if (it.includes(prefix)) { + return true; + } + } + return false; + })), + util_1.exec("security", addKeychain(["find-identity", "-v", "-p", "codesigning"])).then(it => it.trim().split("\n")), + ]).then(it => { + const array = it[0] + .concat(it[1]) + .filter(it => !it.includes("(Missing required extension)") && !it.includes("valid identities found") && !it.includes("iPhone ") && !it.includes("com.apple.idms.appleid.prd.")) + // remove 1) + .map(it => it.substring(it.indexOf(")") + 1).trim()); + return Array.from(new Set(array)); + }); + if (keychain == null) { + exports.findIdentityRawResult = result; + } + } + return result; +} +async function _findIdentity(type, qualifier, keychain) { + // https://github.com/electron-userland/electron-builder/issues/484 + //noinspection SpellCheckingInspection + const lines = await getValidIdentities(keychain); + const namePrefix = `${type}:`; + for (const line of lines) { + if (qualifier != null && !line.includes(qualifier)) { + continue; + } + if (line.includes(namePrefix)) { + return parseIdentity(line); + } + } + if (type === "Developer ID Application") { + // find non-Apple certificate + // https://github.com/electron-userland/electron-builder/issues/458 + l: for (const line of lines) { + if (qualifier != null && !line.includes(qualifier)) { + continue; + } + if (line.includes("Mac Developer:")) { + continue; + } + for (const prefix of exports.appleCertificatePrefixes) { + if (line.includes(prefix)) { + continue l; + } + } + return parseIdentity(line); + } + } + return null; +} +const _Identity = require("electron-osx-sign/util-identities").Identity; +function parseIdentity(line) { + const firstQuoteIndex = line.indexOf('"'); + const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('"')); + const hash = line.substring(0, firstQuoteIndex - 1); + return new _Identity(name, hash); +} +function findIdentity(certType, qualifier, keychain) { + let identity = qualifier || process.env.CSC_NAME; + if (util_1.isEmptyOrSpaces(identity)) { + if (flags_1.isAutoDiscoveryCodeSignIdentity()) { + return _findIdentity(certType, null, keychain); + } + else { + return Promise.resolve(null); + } + } + else { + identity = identity.trim(); + for (const prefix of exports.appleCertificatePrefixes) { + checkPrefix(identity, prefix); + } + return _findIdentity(certType, identity, keychain); + } +} +exports.findIdentity = findIdentity; +function checkPrefix(name, prefix) { + if (name.startsWith(prefix)) { + throw new util_1.InvalidConfigurationError(`Please remove prefix "${prefix}" from the specified name — appropriate certificate will be chosen automatically`); + } +} +//# sourceMappingURL=macCodeSign.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js.map b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js.map new file mode 100644 index 0000000000..4546b93343 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/macCodeSign.js.map @@ -0,0 +1 @@ +{"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/macCodeSign.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,gDAA+H;AAC/H,4CAA8D;AAC9D,8CAAqD;AACrD,mCAAgD;AAChD,0CAAoC;AACpC,uCAA+B;AAC/B,2BAAoC;AACpC,6BAA4B;AAC5B,yCAAuC;AACvC,yCAA+D;AAC/D,yCAA8C;AAEjC,QAAA,wBAAwB,GAAG,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,oCAAoC,CAAC,CAAA;AAe9K,SAAgB,aAAa,CAAC,WAAW,GAAG,IAAI;IAC9C,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACjC,IAAI,WAAW,EAAE;YACf,UAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,wCAAwC,CAAC,CAAA;SAC1F;QACD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,iBAAiB,GACrB,kKAAkK;QAClK,6LAA6L,CAAA;IAE/L,IAAI,oBAAa,EAAE,EAAE;QACnB,IAAI,gBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;YAC/C,IAAI,WAAW,EAAE;gBACf,UAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;aAC5B;SACF;aAAM;YACL,IAAI,WAAW,EAAE;gBACf,oEAAoE;gBACpE,UAAG,CAAC,IAAI,CACN,wEAAwE,GAAG,+DAA+D,GAAG,KAAK,iBAAiB,EAAE,CACtK,CAAA;aACF;YACD,OAAO,KAAK,CAAA;SACb;KACF;IACD,OAAO,IAAI,CAAA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,IAAI,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,SAAgB,YAAY,CAAC,QAAkB,EAAE,SAAyB,EAAE,QAAwB;IAClG,IAAI,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IAChD,IAAI,sBAAe,CAAC,QAAQ,CAAC,EAAE;QAC7B,IAAI,uCAA+B,EAAE,EAAE;YACrC,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;SAC/C;aAAM;YACL,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SAC7B;KACF;SAAM;QACL,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,MAAM,MAAM,IAAI,gCAAwB,EAAE;YAC7C,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;SAC9B;QACD,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;KACnD;AACH,CAAC;AAfD,oCAeC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC3B,MAAM,IAAI,gCAAyB,CAAC,yBAAyB,MAAM,kFAAkF,CAAC,CAAA;KACvJ;AACH,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { exec, InvalidConfigurationError, isEmptyOrSpaces, isEnvTrue, isPullRequest, log, TmpDir } from \"builder-util/out/util\"\nimport { copyFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { Fields, Logger } from \"builder-util/out/log\"\nimport { randomBytes, createHash } from \"crypto\"\nimport { rename } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir, tmpdir } from \"os\"\nimport * as path from \"path\"\nimport { getTempName } from \"temp-file\"\nimport { isAutoDiscoveryCodeSignIdentity } from \"../util/flags\"\nimport { importCertificate } from \"./codesign\"\n\nexport const appleCertificatePrefixes = [\"Developer ID Application:\", \"Developer ID Installer:\", \"3rd Party Mac Developer Application:\", \"3rd Party Mac Developer Installer:\"]\n\nexport type CertType =\n | \"Developer ID Application\"\n | \"Developer ID Installer\"\n | \"3rd Party Mac Developer Application\"\n | \"3rd Party Mac Developer Installer\"\n | \"Mac Developer\"\n | \"Apple Development\"\n | \"Apple Distribution\"\n\nexport interface CodeSigningInfo {\n keychainFile?: string | null\n}\n\nexport function isSignAllowed(isPrintWarn = true): boolean {\n if (process.platform !== \"darwin\") {\n if (isPrintWarn) {\n log.warn({ reason: \"supported only on macOS\" }, \"skipped macOS application code signing\")\n }\n return false\n }\n\n const buildForPrWarning =\n \"There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\n if (isPullRequest()) {\n if (isEnvTrue(process.env.CSC_FOR_PULL_REQUEST)) {\n if (isPrintWarn) {\n log.warn(buildForPrWarning)\n }\n } else {\n if (isPrintWarn) {\n // https://github.com/electron-userland/electron-builder/issues/1524\n log.warn(\n \"Current build is a part of pull request, code signing will be skipped.\" + \"\\nSet env CSC_FOR_PULL_REQUEST to true to force code signing.\" + `\\n${buildForPrWarning}`\n )\n }\n return false\n }\n }\n return true\n}\n\nexport async function reportError(\n isMas: boolean,\n certificateTypes: CertType[],\n qualifier: string | null | undefined,\n keychainFile: string | null | undefined,\n isForceCodeSigning: boolean\n) {\n const logFields: Fields = {}\n if (qualifier == null) {\n logFields.reason = \"\"\n if (isAutoDiscoveryCodeSignIdentity()) {\n logFields.reason += `cannot find valid \"${certificateTypes.join(\", \")}\" identity${\n isMas ? \"\" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`\n }`\n }\n logFields.reason += \", see https://electron.build/code-signing\"\n if (!isAutoDiscoveryCodeSignIdentity()) {\n logFields.CSC_IDENTITY_AUTO_DISCOVERY = false\n }\n } else {\n logFields.reason = \"Identity name is specified, but no valid identity with this name in the keychain\"\n logFields.identity = qualifier\n }\n\n const args = [\"find-identity\"]\n if (keychainFile != null) {\n args.push(keychainFile)\n }\n\n if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {\n logFields.allIdentities = (await exec(\"security\", args))\n .trim()\n .split(\"\\n\")\n .filter(it => !(it.includes(\"Policy: X.509 Basic\") || it.includes(\"Matching identities\")))\n .join(\"\\n\")\n }\n\n if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(\"skipped macOS application code signing\", logFields, \"error\", it => it))\n } else {\n log.warn(logFields, \"skipped macOS application code signing\")\n }\n}\n\n// \"Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list.\"\n// but \"security list-keychains\" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list\n// \"overly complicated and introduces a race condition.\"\n// https://github.com/electron-userland/electron-builder/issues/398\nconst bundledCertKeychainAdded = new Lazy(async () => {\n // copy to temp and then atomic rename to final path\n const cacheDir = getCacheDirectory()\n const tmpKeychainPath = path.join(cacheDir, getTempName(\"electron-builder-root-certs\"))\n const keychainPath = path.join(cacheDir, \"electron-builder-root-certs.keychain\")\n const results = await Promise.all([\n listUserKeychains(),\n copyFile(path.join(__dirname, \"..\", \"..\", \"certs\", \"root_certs.keychain\"), tmpKeychainPath).then(() => rename(tmpKeychainPath, keychainPath)),\n ])\n const list = results[0]\n if (!list.includes(keychainPath)) {\n await exec(\"security\", [\"list-keychains\", \"-d\", \"user\", \"-s\", keychainPath].concat(list))\n }\n})\n\nfunction getCacheDirectory(): string {\n const env = process.env.ELECTRON_BUILDER_CACHE\n return isEmptyOrSpaces(env) ? path.join(homedir(), \"Library\", \"Caches\", \"electron-builder\") : path.resolve(env)\n}\n\nfunction listUserKeychains(): Promise> {\n return exec(\"security\", [\"list-keychains\", \"-d\", \"user\"]).then(it =>\n it\n .split(\"\\n\")\n .map(it => {\n const r = it.trim()\n return r.substring(1, r.length - 1)\n })\n .filter(it => it.length > 0)\n )\n}\n\nexport interface CreateKeychainOptions {\n tmpDir: TmpDir\n cscLink: string\n cscKeyPassword: string\n cscILink?: string | null\n cscIKeyPassword?: string | null\n currentDir: string\n}\n\nexport function removeKeychain(keychainFile: string, printWarn = true): Promise {\n return exec(\"security\", [\"delete-keychain\", keychainFile]).catch(e => {\n if (printWarn) {\n log.warn({ file: keychainFile, error: e.stack || e }, \"cannot delete keychain\")\n }\n return unlinkIfExists(keychainFile)\n })\n}\n\nexport async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise {\n // travis has correct AppleWWDRCA cert\n if (process.env.TRAVIS !== \"true\") {\n await bundledCertKeychainAdded.value\n }\n\n // https://github.com/electron-userland/electron-builder/issues/3685\n // use constant file\n const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash(\"sha256\").update(currentDir).update(\"app-builder\").digest(\"hex\")}.keychain`)\n // noinspection JSUnusedLocalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n await removeKeychain(keychainFile, false).catch(_ => {\n /* ignore*/\n })\n\n const certLinks = [cscLink]\n if (cscILink != null) {\n certLinks.push(cscILink)\n }\n\n const certPaths = new Array(certLinks.length)\n const keychainPassword = randomBytes(32).toString(\"base64\")\n const securityCommands = [\n [\"create-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"unlock-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"set-keychain-settings\", keychainFile],\n ]\n\n // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored\n // https://github.com/electron-userland/electron-builder/issues/1457\n const list = await listUserKeychains()\n if (!list.includes(keychainFile)) {\n securityCommands.push([\"list-keychains\", \"-d\", \"user\", \"-s\", keychainFile].concat(list))\n }\n\n await Promise.all([\n // we do not clear downloaded files - will be removed on tmpDir cleanup automatically. not a security issue since in any case data is available as env variables and protected by password.\n BluebirdPromise.map(certLinks, (link, i) => importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))),\n BluebirdPromise.mapSeries(securityCommands, it => exec(\"security\", it)),\n ])\n return await importCerts(keychainFile, certPaths, [cscKeyPassword, cscIKeyPassword].filter(it => it != null) as Array)\n}\n\nasync function importCerts(keychainFile: string, paths: Array, keyPasswords: Array): Promise {\n for (let i = 0; i < paths.length; i++) {\n const password = keyPasswords[i]\n await exec(\"security\", [\"import\", paths[i], \"-k\", keychainFile, \"-T\", \"/usr/bin/codesign\", \"-T\", \"/usr/bin/productbuild\", \"-P\", password])\n\n // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p\n // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996\n await exec(\"security\", [\"set-key-partition-list\", \"-S\", \"apple-tool:,apple:\", \"-s\", \"-k\", password, keychainFile])\n }\n\n return {\n keychainFile,\n }\n}\n\n/** @private */\nexport function sign(path: string, name: string, keychain: string): Promise {\n const args = [\"--deep\", \"--force\", \"--sign\", name, path]\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n return exec(\"codesign\", args)\n}\n\nexport let findIdentityRawResult: Promise> | null = null\n\nasync function getValidIdentities(keychain?: string | null): Promise> {\n function addKeychain(args: Array) {\n if (keychain != null) {\n args.push(keychain)\n }\n return args\n }\n\n let result = findIdentityRawResult\n if (result == null || keychain != null) {\n // https://github.com/electron-userland/electron-builder/issues/481\n // https://github.com/electron-userland/electron-builder/issues/535\n result = Promise.all>([\n exec(\"security\", addKeychain([\"find-identity\", \"-v\"])).then(it =>\n it\n .trim()\n .split(\"\\n\")\n .filter(it => {\n for (const prefix of appleCertificatePrefixes) {\n if (it.includes(prefix)) {\n return true\n }\n }\n return false\n })\n ),\n exec(\"security\", addKeychain([\"find-identity\", \"-v\", \"-p\", \"codesigning\"])).then(it => it.trim().split(\"\\n\")),\n ]).then(it => {\n const array = it[0]\n .concat(it[1])\n .filter(\n it => !it.includes(\"(Missing required extension)\") && !it.includes(\"valid identities found\") && !it.includes(\"iPhone \") && !it.includes(\"com.apple.idms.appleid.prd.\")\n )\n // remove 1)\n .map(it => it.substring(it.indexOf(\")\") + 1).trim())\n return Array.from(new Set(array))\n })\n\n if (keychain == null) {\n findIdentityRawResult = result\n }\n }\n return result\n}\n\nasync function _findIdentity(type: CertType, qualifier?: string | null, keychain?: string | null): Promise {\n // https://github.com/electron-userland/electron-builder/issues/484\n //noinspection SpellCheckingInspection\n const lines = await getValidIdentities(keychain)\n const namePrefix = `${type}:`\n for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(namePrefix)) {\n return parseIdentity(line)\n }\n }\n\n if (type === \"Developer ID Application\") {\n // find non-Apple certificate\n // https://github.com/electron-userland/electron-builder/issues/458\n l: for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(\"Mac Developer:\")) {\n continue\n }\n\n for (const prefix of appleCertificatePrefixes) {\n if (line.includes(prefix)) {\n continue l\n }\n }\n\n return parseIdentity(line)\n }\n }\n return null\n}\n\nexport declare class Identity {\n readonly name: string\n readonly hash: string\n\n constructor(name: string, hash: string)\n}\n\nconst _Identity = require(\"electron-osx-sign/util-identities\").Identity\n\nfunction parseIdentity(line: string): Identity {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n return new _Identity(name, hash)\n}\n\nexport function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise {\n let identity = qualifier || process.env.CSC_NAME\n if (isEmptyOrSpaces(identity)) {\n if (isAutoDiscoveryCodeSignIdentity()) {\n return _findIdentity(certType, null, keychain)\n } else {\n return Promise.resolve(null)\n }\n } else {\n identity = identity.trim()\n for (const prefix of appleCertificatePrefixes) {\n checkPrefix(identity, prefix)\n }\n return _findIdentity(certType, identity, keychain)\n }\n}\n\nfunction checkPrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n throw new InvalidConfigurationError(`Please remove prefix \"${prefix}\" from the specified name — appropriate certificate will be chosen automatically`)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.d.ts b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.d.ts new file mode 100644 index 0000000000..1ac56517cd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.d.ts @@ -0,0 +1,38 @@ +import { WindowsConfiguration } from "../options/winOptions"; +import { VmManager } from "../vm/vm"; +import { WinPackager } from "../winPackager"; +export declare function getSignVendorPath(): Promise; +export declare type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise; +export interface WindowsSignOptions { + readonly path: string; + readonly name?: string | null; + readonly cscInfo?: FileCodeSigningInfo | CertificateFromStoreInfo | null; + readonly site?: string | null; + readonly options: WindowsConfiguration; +} +export interface WindowsSignTaskConfiguration extends WindowsSignOptions { + resultOutputPath?: string; + hash: string; + isNest: boolean; +} +export interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration { + computeSignToolArgs(isWin: boolean): Array; +} +export declare function sign(options: WindowsSignOptions, packager: WinPackager): Promise; +export interface FileCodeSigningInfo { + readonly file: string; + readonly password: string | null; +} +export declare function getCertInfo(file: string, password: string): Promise; +export interface CertificateInfo { + readonly commonName: string; + readonly bloodyMicrosoftSubjectDn: string; +} +export interface CertificateFromStoreInfo { + thumbprint: string; + subject: string; + store: string; + isLocalMachineStore: boolean; +} +export declare function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise; +export declare function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager): Promise; diff --git a/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js new file mode 100644 index 0000000000..8ddbc6ae85 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js @@ -0,0 +1,251 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isOldWin6 = exports.doSign = exports.getCertificateFromStoreInfo = exports.getCertInfo = exports.sign = exports.getSignVendorPath = void 0; +const util_1 = require("builder-util/out/util"); +const binDownload_1 = require("../binDownload"); +const appBuilder_1 = require("../util/appBuilder"); +const bundledTool_1 = require("../util/bundledTool"); +const fs_extra_1 = require("fs-extra"); +const os = require("os"); +const path = require("path"); +const platformPackager_1 = require("../platformPackager"); +const flags_1 = require("../util/flags"); +const vm_1 = require("../vm/vm"); +function getSignVendorPath() { + return binDownload_1.getBin("winCodeSign"); +} +exports.getSignVendorPath = getSignVendorPath; +async function sign(options, packager) { + let hashes = options.options.signingHashAlgorithms; + // msi does not support dual-signing + if (options.path.endsWith(".msi")) { + hashes = [hashes != null && !hashes.includes("sha1") ? "sha256" : "sha1"]; + } + else if (options.path.endsWith(".appx")) { + hashes = ["sha256"]; + } + else if (hashes == null) { + hashes = ["sha1", "sha256"]; + } + else { + hashes = Array.isArray(hashes) ? hashes : [hashes]; + } + const executor = platformPackager_1.resolveFunction(options.options.sign, "sign") || doSign; + let isNest = false; + for (const hash of hashes) { + const taskConfiguration = { ...options, hash, isNest }; + await Promise.resolve(executor({ + ...taskConfiguration, + computeSignToolArgs: isWin => computeSignToolArgs(taskConfiguration, isWin), + }, packager)); + isNest = true; + if (taskConfiguration.resultOutputPath != null) { + await fs_extra_1.rename(taskConfiguration.resultOutputPath, options.path); + } + } +} +exports.sign = sign; +async function getCertInfo(file, password) { + let result = null; + const errorMessagePrefix = "Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: "; + try { + result = await appBuilder_1.executeAppBuilderAsJson(["certificate-info", "--input", file, "--password", password]); + } + catch (e) { + throw new Error(`${errorMessagePrefix}${e.stack || e}`); + } + if (result.error != null) { + // noinspection ExceptionCaughtLocallyJS + throw new util_1.InvalidConfigurationError(`${errorMessagePrefix}${result.error}`); + } + return result; +} +exports.getCertInfo = getCertInfo; +async function getCertificateFromStoreInfo(options, vm) { + const certificateSubjectName = options.certificateSubjectName; + const certificateSha1 = options.certificateSha1 ? options.certificateSha1.toUpperCase() : options.certificateSha1; + // ExcludeProperty doesn't work, so, we cannot exclude RawData, it is ok + // powershell can return object if the only item + const rawResult = await vm.exec("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + "Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress", + ]); + const certList = rawResult.length === 0 ? [] : util_1.asArray(JSON.parse(rawResult)); + for (const certInfo of certList) { + if ((certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) || + (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)) { + continue; + } + const parentPath = certInfo.PSParentPath; + const store = parentPath.substring(parentPath.lastIndexOf("\\") + 1); + util_1.log.debug({ store, PSParentPath: parentPath }, "auto-detect certificate store"); + // https://github.com/electron-userland/electron-builder/issues/1717 + const isLocalMachineStore = parentPath.includes("Certificate::LocalMachine"); + util_1.log.debug(null, "auto-detect using of LocalMachine store"); + return { + thumbprint: certInfo.Thumbprint, + subject: certInfo.Subject, + store, + isLocalMachineStore, + }; + } + throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`); +} +exports.getCertificateFromStoreInfo = getCertificateFromStoreInfo; +async function doSign(configuration, packager) { + // https://github.com/electron-userland/electron-builder/pull/1944 + const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT, 10) || 10 * 60 * 1000; + // unify logic of signtool path location + const toolInfo = await getToolPath(); + const tool = toolInfo.path; + // decide runtime argument by cases + let args; + let env = process.env; + let vm; + if (configuration.path.endsWith(".appx") || !("file" in configuration.cscInfo) /* certificateSubjectName and other such options */) { + vm = await packager.vm.value; + args = computeSignToolArgs(configuration, true, vm); + } + else { + vm = new vm_1.VmManager(); + args = configuration.computeSignToolArgs(process.platform === "win32"); + if (toolInfo.env != null) { + env = toolInfo.env; + } + } + try { + await vm.exec(tool, args, { timeout, env }); + } + catch (e) { + if (e.message.includes("The file is being used by another process") || e.message.includes("The specified timestamp server either could not be reached")) { + util_1.log.warn(`First attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`); + await new Promise((resolve, reject) => { + setTimeout(() => { + vm.exec(tool, args, { timeout, env }).then(resolve).catch(reject); + }, 15000); + }); + } + throw e; + } +} +exports.doSign = doSign; +// on windows be aware of http://stackoverflow.com/a/32640183/1910191 +function computeSignToolArgs(options, isWin, vm = new vm_1.VmManager()) { + const inputFile = vm.toVmFile(options.path); + const outputPath = isWin ? inputFile : getOutputPath(inputFile, options.hash); + if (!isWin) { + options.resultOutputPath = outputPath; + } + const args = isWin ? ["sign"] : ["-in", inputFile, "-out", outputPath]; + if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") { + const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com"; + if (isWin) { + args.push(options.isNest || options.hash === "sha256" ? "/tr" : "/t", options.isNest || options.hash === "sha256" ? options.options.rfc3161TimeStampServer || "http://timestamp.digicert.com" : timestampingServiceUrl); + } + else { + args.push("-t", timestampingServiceUrl); + } + } + const certificateFile = options.cscInfo.file; + if (certificateFile == null) { + const cscInfo = options.cscInfo; + const subjectName = cscInfo.thumbprint; + if (!isWin) { + throw new Error(`${subjectName == null ? "certificateSha1" : "certificateSubjectName"} supported only on Windows`); + } + args.push("/sha1", cscInfo.thumbprint); + args.push("/s", cscInfo.store); + if (cscInfo.isLocalMachineStore) { + args.push("/sm"); + } + } + else { + const certExtension = path.extname(certificateFile); + if (certExtension === ".p12" || certExtension === ".pfx") { + args.push(isWin ? "/f" : "-pkcs12", vm.toVmFile(certificateFile)); + } + else { + throw new Error(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`); + } + } + if (!isWin || options.hash !== "sha1") { + args.push(isWin ? "/fd" : "-h", options.hash); + if (isWin && process.env.ELECTRON_BUILDER_OFFLINE !== "true") { + args.push("/td", "sha256"); + } + } + if (options.name) { + args.push(isWin ? "/d" : "-n", options.name); + } + if (options.site) { + args.push(isWin ? "/du" : "-i", options.site); + } + // msi does not support dual-signing + if (options.isNest) { + args.push(isWin ? "/as" : "-nest"); + } + const password = options.cscInfo == null ? null : options.cscInfo.password; + if (password) { + args.push(isWin ? "/p" : "-pass", password); + } + if (options.options.additionalCertificateFile) { + args.push(isWin ? "/ac" : "-ac", vm.toVmFile(options.options.additionalCertificateFile)); + } + const httpsProxyFromEnv = process.env.HTTPS_PROXY; + if (!isWin && httpsProxyFromEnv != null && httpsProxyFromEnv.length) { + args.push("-p", httpsProxyFromEnv); + } + if (isWin) { + // https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610 + args.push("/debug"); + // must be last argument + args.push(inputFile); + } + return args; +} +function getOutputPath(inputPath, hash) { + const extension = path.extname(inputPath); + return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`); +} +/** @internal */ +function isOldWin6() { + const winVersion = os.release(); + return winVersion.startsWith("6.") && !winVersion.startsWith("6.3"); +} +exports.isOldWin6 = isOldWin6; +function getWinSignTool(vendorPath) { + // use modern signtool on Windows Server 2012 R2 to be able to sign AppX + if (isOldWin6()) { + return path.join(vendorPath, "windows-6", "signtool.exe"); + } + else { + return path.join(vendorPath, "windows-10", process.arch, "signtool.exe"); + } +} +async function getToolPath() { + if (flags_1.isUseSystemSigncode()) { + return { path: "osslsigncode" }; + } + const result = process.env.SIGNTOOL_PATH; + if (result) { + return { path: result }; + } + const vendorPath = await getSignVendorPath(); + if (process.platform === "win32") { + // use modern signtool on Windows Server 2012 R2 to be able to sign AppX + return { path: getWinSignTool(vendorPath) }; + } + else if (process.platform === "darwin") { + const toolDirPath = path.join(vendorPath, process.platform, "10.12"); + return { + path: path.join(toolDirPath, "osslsigncode"), + env: bundledTool_1.computeToolEnv([path.join(toolDirPath, "lib")]), + }; + } + else { + return { path: path.join(vendorPath, process.platform, "osslsigncode") }; + } +} +//# sourceMappingURL=windowsCodeSign.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js.map b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js.map new file mode 100644 index 0000000000..61b7ebbba0 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/codeSign/windowsCodeSign.js.map @@ -0,0 +1 @@ +{"version":3,"file":"windowsCodeSign.js","sourceRoot":"","sources":["../../src/codeSign/windowsCodeSign.ts"],"names":[],"mappings":";;;AAAA,gDAA+E;AAC/E,gDAAuC;AAEvC,mDAA4D;AAC5D,qDAA8D;AAC9D,uCAAiC;AACjC,yBAAwB;AACxB,6BAA4B;AAC5B,0DAAqD;AACrD,yCAAmD;AACnD,iCAAoC;AAGpC,SAAgB,iBAAiB;IAC/B,OAAO,oBAAM,CAAC,aAAa,CAAC,CAAA;AAC9B,CAAC;AAFD,8CAEC;AA0BM,KAAK,UAAU,IAAI,CAAC,OAA2B,EAAE,QAAqB;IAC3E,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAA;IAClD,oCAAoC;IACpC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjC,MAAM,GAAG,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;KAC1E;SAAM,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACzC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAA;KACpB;SAAM,IAAI,MAAM,IAAI,IAAI,EAAE;QACzB,MAAM,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC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AAA;KACF;SAAM;QACL,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAA;KACzE;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, asArray, log } from \"builder-util/out/util\"\nimport { getBin } from \"../binDownload\"\nimport { WindowsConfiguration } from \"../options/winOptions\"\nimport { executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { computeToolEnv, ToolInfo } from \"../util/bundledTool\"\nimport { rename } from \"fs-extra\"\nimport * as os from \"os\"\nimport * as path from \"path\"\nimport { resolveFunction } from \"../platformPackager\"\nimport { isUseSystemSigncode } from \"../util/flags\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\n\nexport function getSignVendorPath() {\n return getBin(\"winCodeSign\")\n}\n\nexport type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise\n\nexport interface WindowsSignOptions {\n readonly path: string\n\n readonly name?: string | null\n readonly cscInfo?: FileCodeSigningInfo | CertificateFromStoreInfo | null\n readonly site?: string | null\n\n readonly options: WindowsConfiguration\n}\n\nexport interface WindowsSignTaskConfiguration extends WindowsSignOptions {\n // set if output path differs from input (e.g. osslsigncode cannot sign file in-place)\n resultOutputPath?: string\n\n hash: string\n isNest: boolean\n}\n\nexport interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {\n computeSignToolArgs(isWin: boolean): Array\n}\n\nexport async function sign(options: WindowsSignOptions, packager: WinPackager) {\n let hashes = options.options.signingHashAlgorithms\n // msi does not support dual-signing\n if (options.path.endsWith(\".msi\")) {\n hashes = [hashes != null && !hashes.includes(\"sha1\") ? \"sha256\" : \"sha1\"]\n } else if (options.path.endsWith(\".appx\")) {\n hashes = [\"sha256\"]\n } else if (hashes == null) {\n hashes = [\"sha1\", \"sha256\"]\n } else {\n hashes = Array.isArray(hashes) ? hashes : [hashes]\n }\n\n const executor = resolveFunction(options.options.sign, \"sign\") || doSign\n let isNest = false\n for (const hash of hashes) {\n const taskConfiguration: WindowsSignTaskConfiguration = { ...options, hash, isNest }\n await Promise.resolve(\n executor(\n {\n ...taskConfiguration,\n computeSignToolArgs: isWin => computeSignToolArgs(taskConfiguration, isWin),\n },\n packager\n )\n )\n isNest = true\n if (taskConfiguration.resultOutputPath != null) {\n await rename(taskConfiguration.resultOutputPath, options.path)\n }\n }\n}\n\nexport interface FileCodeSigningInfo {\n readonly file: string\n readonly password: string | null\n}\n\nexport async function getCertInfo(file: string, password: string): Promise {\n let result: any = null\n const errorMessagePrefix = \"Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: \"\n try {\n result = await executeAppBuilderAsJson([\"certificate-info\", \"--input\", file, \"--password\", password])\n } catch (e) {\n throw new Error(`${errorMessagePrefix}${e.stack || e}`)\n }\n\n if (result.error != null) {\n // noinspection ExceptionCaughtLocallyJS\n throw new InvalidConfigurationError(`${errorMessagePrefix}${result.error}`)\n }\n return result\n}\n\nexport interface CertificateInfo {\n readonly commonName: string\n readonly bloodyMicrosoftSubjectDn: string\n}\n\nexport interface CertificateFromStoreInfo {\n thumbprint: string\n subject: string\n store: string\n isLocalMachineStore: boolean\n}\n\nexport async function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise {\n const certificateSubjectName = options.certificateSubjectName\n const certificateSha1 = options.certificateSha1 ? options.certificateSha1.toUpperCase() : options.certificateSha1\n // ExcludeProperty doesn't work, so, we cannot exclude RawData, it is ok\n // powershell can return object if the only item\n const rawResult = await vm.exec(\"powershell.exe\", [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress\",\n ])\n const certList = rawResult.length === 0 ? [] : asArray(JSON.parse(rawResult))\n for (const certInfo of certList) {\n if (\n (certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) ||\n (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)\n ) {\n continue\n }\n\n const parentPath = certInfo.PSParentPath\n const store = parentPath.substring(parentPath.lastIndexOf(\"\\\\\") + 1)\n log.debug({ store, PSParentPath: parentPath }, \"auto-detect certificate store\")\n // https://github.com/electron-userland/electron-builder/issues/1717\n const isLocalMachineStore = parentPath.includes(\"Certificate::LocalMachine\")\n log.debug(null, \"auto-detect using of LocalMachine store\")\n return {\n thumbprint: certInfo.Thumbprint,\n subject: certInfo.Subject,\n store,\n isLocalMachineStore,\n }\n }\n\n throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)\n}\n\nexport async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {\n // https://github.com/electron-userland/electron-builder/pull/1944\n const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000\n // unify logic of signtool path location\n const toolInfo = await getToolPath()\n const tool = toolInfo.path\n // decide runtime argument by cases\n let args: Array\n let env = process.env\n let vm: VmManager\n if (configuration.path.endsWith(\".appx\") || !(\"file\" in configuration.cscInfo!) /* certificateSubjectName and other such options */) {\n vm = await packager.vm.value\n args = computeSignToolArgs(configuration, true, vm)\n } else {\n vm = new VmManager()\n args = configuration.computeSignToolArgs(process.platform === \"win32\")\n if (toolInfo.env != null) {\n env = toolInfo.env\n }\n }\n\n try {\n await vm.exec(tool, args, { timeout, env })\n } catch (e) {\n if (e.message.includes(\"The file is being used by another process\") || e.message.includes(\"The specified timestamp server either could not be reached\")) {\n log.warn(`First attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`)\n await new Promise((resolve, reject) => {\n setTimeout(() => {\n vm.exec(tool, args, { timeout, env }).then(resolve).catch(reject)\n }, 15000)\n })\n }\n throw e\n }\n}\n\ninterface CertInfo {\n Subject: string\n Thumbprint: string\n PSParentPath: string\n}\n\n// on windows be aware of http://stackoverflow.com/a/32640183/1910191\nfunction computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm: VmManager = new VmManager()): Array {\n const inputFile = vm.toVmFile(options.path)\n const outputPath = isWin ? inputFile : getOutputPath(inputFile, options.hash)\n if (!isWin) {\n options.resultOutputPath = outputPath\n }\n\n const args = isWin ? [\"sign\"] : [\"-in\", inputFile, \"-out\", outputPath]\n\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const timestampingServiceUrl = options.options.timeStampServer || \"http://timestamp.digicert.com\"\n if (isWin) {\n args.push(\n options.isNest || options.hash === \"sha256\" ? \"/tr\" : \"/t\",\n options.isNest || options.hash === \"sha256\" ? options.options.rfc3161TimeStampServer || \"http://timestamp.digicert.com\" : timestampingServiceUrl\n )\n } else {\n args.push(\"-t\", timestampingServiceUrl)\n }\n }\n\n const certificateFile = (options.cscInfo as FileCodeSigningInfo).file\n if (certificateFile == null) {\n const cscInfo = options.cscInfo as CertificateFromStoreInfo\n const subjectName = cscInfo.thumbprint\n if (!isWin) {\n throw new Error(`${subjectName == null ? \"certificateSha1\" : \"certificateSubjectName\"} supported only on Windows`)\n }\n\n args.push(\"/sha1\", cscInfo.thumbprint)\n args.push(\"/s\", cscInfo.store)\n if (cscInfo.isLocalMachineStore) {\n args.push(\"/sm\")\n }\n } else {\n const certExtension = path.extname(certificateFile)\n if (certExtension === \".p12\" || certExtension === \".pfx\") {\n args.push(isWin ? \"/f\" : \"-pkcs12\", vm.toVmFile(certificateFile))\n } else {\n throw new Error(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`)\n }\n }\n\n if (!isWin || options.hash !== \"sha1\") {\n args.push(isWin ? \"/fd\" : \"-h\", options.hash)\n if (isWin && process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n args.push(\"/td\", \"sha256\")\n }\n }\n\n if (options.name) {\n args.push(isWin ? \"/d\" : \"-n\", options.name)\n }\n\n if (options.site) {\n args.push(isWin ? \"/du\" : \"-i\", options.site)\n }\n\n // msi does not support dual-signing\n if (options.isNest) {\n args.push(isWin ? \"/as\" : \"-nest\")\n }\n\n const password = options.cscInfo == null ? null : (options.cscInfo as FileCodeSigningInfo).password\n if (password) {\n args.push(isWin ? \"/p\" : \"-pass\", password)\n }\n\n if (options.options.additionalCertificateFile) {\n args.push(isWin ? \"/ac\" : \"-ac\", vm.toVmFile(options.options.additionalCertificateFile))\n }\n\n const httpsProxyFromEnv = process.env.HTTPS_PROXY\n if (!isWin && httpsProxyFromEnv != null && httpsProxyFromEnv.length) {\n args.push(\"-p\", httpsProxyFromEnv)\n }\n\n if (isWin) {\n // https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610\n args.push(\"/debug\")\n // must be last argument\n args.push(inputFile)\n }\n\n return args\n}\n\nfunction getOutputPath(inputPath: string, hash: string) {\n const extension = path.extname(inputPath)\n return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`)\n}\n\n/** @internal */\nexport function isOldWin6() {\n const winVersion = os.release()\n return winVersion.startsWith(\"6.\") && !winVersion.startsWith(\"6.3\")\n}\n\nfunction getWinSignTool(vendorPath: string): string {\n // use modern signtool on Windows Server 2012 R2 to be able to sign AppX\n if (isOldWin6()) {\n return path.join(vendorPath, \"windows-6\", \"signtool.exe\")\n } else {\n return path.join(vendorPath, \"windows-10\", process.arch, \"signtool.exe\")\n }\n}\n\nasync function getToolPath(): Promise {\n if (isUseSystemSigncode()) {\n return { path: \"osslsigncode\" }\n }\n\n const result = process.env.SIGNTOOL_PATH\n if (result) {\n return { path: result }\n }\n\n const vendorPath = await getSignVendorPath()\n if (process.platform === \"win32\") {\n // use modern signtool on Windows Server 2012 R2 to be able to sign AppX\n return { path: getWinSignTool(vendorPath) }\n } else if (process.platform === \"darwin\") {\n const toolDirPath = path.join(vendorPath, process.platform, \"10.12\")\n return {\n path: path.join(toolDirPath, \"osslsigncode\"),\n env: computeToolEnv([path.join(toolDirPath, \"lib\")]),\n }\n } else {\n return { path: path.join(vendorPath, process.platform, \"osslsigncode\") }\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/configuration.d.ts b/client/node_modules/app-builder-lib/out/configuration.d.ts new file mode 100644 index 0000000000..ec8ee77ba7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/configuration.d.ts @@ -0,0 +1,274 @@ +import { Arch } from "builder-util"; +import { BeforeBuildContext, Target } from "./core"; +import { ElectronBrandingOptions, ElectronDownloadOptions } from "./electron/ElectronFramework"; +import { PrepareApplicationStageDirectoryOptions } from "./Framework"; +import { AppXOptions } from "./options/AppXOptions"; +import { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from "./options/linuxOptions"; +import { DmgOptions, MacConfiguration, MasConfiguration } from "./options/macOptions"; +import { MsiOptions } from "./options/MsiOptions"; +import { PkgOptions } from "./options/pkgOptions"; +import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions"; +import { SnapOptions } from "./options/SnapOptions"; +import { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions"; +import { WindowsConfiguration } from "./options/winOptions"; +import { BuildResult } from "./packager"; +import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi"; +import { PlatformPackager } from "./platformPackager"; +import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions"; +/** + * Configuration Options + */ +export interface Configuration extends PlatformSpecificBuildOptions { + /** + * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as + * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set. + * @default com.electron.${name} + */ + readonly appId?: string | null; + /** + * As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name). + * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used. + */ + readonly productName?: string | null; + /** + * The human-readable copyright line for the app. + * @default Copyright © year ${author} + */ + readonly copyright?: string | null; + readonly directories?: MetadataDirectories | null; + /** + * Options related to how build macOS targets. + */ + readonly mac?: MacConfiguration | null; + /** + * MAS (Mac Application Store) options. + */ + readonly mas?: MasConfiguration | null; + /** + * MAS (Mac Application Store) development options (`mas-dev` target). + */ + readonly masDev?: MasConfiguration | null; + /** + * macOS DMG options. + */ + readonly dmg?: DmgOptions | null; + /** + * macOS PKG options. + */ + readonly pkg?: PkgOptions | null; + /** + * Options related to how build Windows targets. + */ + readonly win?: WindowsConfiguration | null; + readonly nsis?: NsisOptions | null; + readonly nsisWeb?: NsisWebOptions | null; + readonly portable?: PortableOptions | null; + readonly appx?: AppXOptions | null; + /** @private */ + readonly msi?: MsiOptions | null; + readonly squirrelWindows?: SquirrelWindowsOptions | null; + /** + * Options related to how build Linux targets. + */ + readonly linux?: LinuxConfiguration | null; + /** + * Debian package options. + */ + readonly deb?: DebOptions | null; + /** + * Snap options. + */ + readonly snap?: SnapOptions | null; + /** + * AppImage options. + */ + readonly appImage?: AppImageOptions | null; + /** + * Flatpak options. + */ + readonly flatpak?: FlatpakOptions | null; + readonly pacman?: LinuxTargetSpecificOptions | null; + readonly rpm?: LinuxTargetSpecificOptions | null; + readonly freebsd?: LinuxTargetSpecificOptions | null; + readonly p5p?: LinuxTargetSpecificOptions | null; + readonly apk?: LinuxTargetSpecificOptions | null; + /** + * Whether to include *all* of the submodules node_modules directories + * @default false + */ + includeSubNodeModules?: boolean; + /** + * Whether to build the application native dependencies from source. + * @default false + */ + buildDependenciesFromSource?: boolean; + /** + * Whether to execute `node-gyp rebuild` before starting to package the app. + * + * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead. + * @default false + */ + readonly nodeGypRebuild?: boolean; + /** + * Additional command line arguments to use when installing app native deps. + */ + readonly npmArgs?: Array | string | null; + /** + * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app. + * @default true + */ + readonly npmRebuild?: boolean; + /** + * The build number. Maps to the `--iteration` flag for builds using FPM on Linux. + * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env. + */ + readonly buildNumber?: string | null; + /** + * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`. + * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`). + */ + readonly buildVersion?: string | null; + /** + * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified. + */ + readonly electronCompile?: boolean; + /** + * Returns the path to custom Electron build (e.g. `~/electron/out/R`). Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory + */ + readonly electronDist?: string | ((options: PrepareApplicationStageDirectoryOptions) => string); + /** + * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. + */ + readonly electronDownload?: ElectronDownloadOptions; + /** + * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file. + */ + readonly electronBranding?: ElectronBrandingOptions; + /** + * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency. + */ + electronVersion?: string | null; + /** + * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir). + * + * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns. + * + * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection. + */ + extends?: Array | string | null; + /** + * Inject properties to `package.json`. + */ + readonly extraMetadata?: any; + /** + * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct). + * @default false + */ + readonly forceCodeSigning?: boolean; + /** + * *libui-based frameworks only* The version of NodeJS you are packaging for. + * You can set it to `current` to set the Node.js version that you use to run. + */ + readonly nodeVersion?: string | null; + /** + * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version. + */ + readonly launchUiVersion?: boolean | string | null; + /** + * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`. + */ + readonly framework?: string | null; + /** + * The function (or path to file or module id) to be [run before pack](#beforepack) + */ + readonly beforePack?: ((context: BeforePackContext) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be [run after pack](#afterpack) (but before pack into distributable format and sign). + */ + readonly afterPack?: ((context: AfterPackContext) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format). + */ + readonly afterSign?: ((context: AfterPackContext) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be run on artifact build start. + */ + readonly artifactBuildStarted?: ((context: ArtifactBuildStarted) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be run on artifact build completed. + */ + readonly artifactBuildCompleted?: ((context: ArtifactCreated) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild). + */ + readonly afterAllArtifactBuild?: ((context: BuildResult) => Promise> | Array) | string | null; + /** + * MSI project created on disk - not packed into .msi package yet. + */ + readonly msiProjectCreated?: ((path: string) => Promise | any) | string | null; + /** + * Appx manifest created on disk - not packed into .appx package yet. + */ + readonly appxManifestCreated?: ((path: string) => Promise | any) | string | null; + /** + * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. + */ + readonly onNodeModuleFile?: ((file: string) => void) | string | null; + /** + * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild. + * + * If provided and `node_modules` are missing, it will not invoke production dependencies check. + */ + readonly beforeBuild?: ((context: BeforeBuildContext) => Promise) | string | null; + /** + * Whether to build using Electron Build Service if target not supported on current OS. + * @default true + */ + readonly remoteBuild?: boolean; + /** + * Whether to include PDB files. + * @default false + */ + readonly includePdb?: boolean; + /** + * Whether to remove `scripts` field from `package.json` files. + * + * @default true + */ + readonly removePackageScripts?: boolean; + /** + * Whether to remove `keywords` field from `package.json` files. + * + * @default true + */ + readonly removePackageKeywords?: boolean; +} +interface PackContext { + readonly outDir: string; + readonly appOutDir: string; + readonly packager: PlatformPackager; + readonly electronPlatformName: string; + readonly arch: Arch; + readonly targets: Array; +} +export declare type AfterPackContext = PackContext; +export declare type BeforePackContext = PackContext; +export interface MetadataDirectories { + /** + * The path to build resources. + * + * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `"files": ["**\/*", "build/icon.*"]` + * @default build + */ + readonly buildResources?: string | null; + /** + * The output directory. [File macros](/file-patterns#file-macros) are supported. + * @default dist + */ + readonly output?: string | null; + /** + * The application directory (containing the application package.json), defaults to `app`, `www` or working directory. + */ + readonly app?: string | null; +} +export {}; diff --git a/client/node_modules/app-builder-lib/out/configuration.js b/client/node_modules/app-builder-lib/out/configuration.js new file mode 100644 index 0000000000..c91580447c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/configuration.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=configuration.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/configuration.js.map b/client/node_modules/app-builder-lib/out/configuration.js.map new file mode 100644 index 0000000000..5004ee6bc7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/configuration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { BeforeBuildContext, Target } from \"./core\"\nimport { ElectronBrandingOptions, ElectronDownloadOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from \"./options/linuxOptions\"\nimport { DmgOptions, MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { MsiOptions } from \"./options/MsiOptions\"\nimport { PkgOptions } from \"./options/pkgOptions\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { SnapOptions } from \"./options/SnapOptions\"\nimport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nimport { WindowsConfiguration } from \"./options/winOptions\"\nimport { BuildResult } from \"./packager\"\nimport { ArtifactBuildStarted, ArtifactCreated } from \"./packagerApi\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { NsisOptions, NsisWebOptions, PortableOptions } from \"./targets/nsis/nsisOptions\"\n\n// duplicate appId here because it is important\n/**\n * Configuration Options\n */\nexport interface Configuration extends PlatformSpecificBuildOptions {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\n * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.\n */\n readonly productName?: string | null\n\n /**\n * The human-readable copyright line for the app.\n * @default Copyright © year ${author}\n */\n readonly copyright?: string | null\n\n readonly directories?: MetadataDirectories | null\n\n /**\n * Options related to how build macOS targets.\n */\n readonly mac?: MacConfiguration | null\n /**\n * MAS (Mac Application Store) options.\n */\n readonly mas?: MasConfiguration | null\n /**\n * MAS (Mac Application Store) development options (`mas-dev` target).\n */\n readonly masDev?: MasConfiguration | null\n /**\n * macOS DMG options.\n */\n readonly dmg?: DmgOptions | null\n /**\n * macOS PKG options.\n */\n readonly pkg?: PkgOptions | null\n\n /**\n * Options related to how build Windows targets.\n */\n readonly win?: WindowsConfiguration | null\n readonly nsis?: NsisOptions | null\n readonly nsisWeb?: NsisWebOptions | null\n readonly portable?: PortableOptions | null\n readonly appx?: AppXOptions | null\n /** @private */\n readonly msi?: MsiOptions | null\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n\n /**\n * Options related to how build Linux targets.\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options.\n */\n readonly deb?: DebOptions | null\n /**\n * Snap options.\n */\n readonly snap?: SnapOptions | null\n /**\n * AppImage options.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options.\n */\n readonly flatpak?: FlatpakOptions | null\n readonly pacman?: LinuxTargetSpecificOptions | null\n readonly rpm?: LinuxTargetSpecificOptions | null\n readonly freebsd?: LinuxTargetSpecificOptions | null\n readonly p5p?: LinuxTargetSpecificOptions | null\n readonly apk?: LinuxTargetSpecificOptions | null\n\n /**\n * Whether to include *all* of the submodules node_modules directories\n * @default false\n */\n includeSubNodeModules?: boolean\n\n /**\n * Whether to build the application native dependencies from source.\n * @default false\n */\n buildDependenciesFromSource?: boolean\n /**\n * Whether to execute `node-gyp rebuild` before starting to package the app.\n *\n * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.\n * @default false\n */\n readonly nodeGypRebuild?: boolean\n /**\n * Additional command line arguments to use when installing app native deps.\n */\n readonly npmArgs?: Array | string | null\n /**\n * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.\n * @default true\n */\n readonly npmRebuild?: boolean\n\n /**\n * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\n * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.\n */\n readonly buildNumber?: string | null\n\n /**\n * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\n * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).\n */\n readonly buildVersion?: string | null\n\n /**\n * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.\n */\n readonly electronCompile?: boolean\n\n /**\n * Returns the path to custom Electron build (e.g. `~/electron/out/R`). Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory\n */\n readonly electronDist?: string | ((options: PrepareApplicationStageDirectoryOptions) => string)\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions\n\n /**\n * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.\n */\n readonly electronBranding?: ElectronBrandingOptions\n\n /**\n * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.\n */\n electronVersion?: string | null\n\n /**\n * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n *\n * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n *\n * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.\n */\n extends?: Array | string | null\n\n /**\n * Inject properties to `package.json`.\n */\n readonly extraMetadata?: any\n\n /**\n * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).\n * @default false\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * *libui-based frameworks only* The version of NodeJS you are packaging for.\n * You can set it to `current` to set the Node.js version that you use to run.\n */\n readonly nodeVersion?: string | null\n\n /**\n * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.\n */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\n */\n readonly framework?: string | null\n\n /**\n * The function (or path to file or module id) to be [run before pack](#beforepack)\n */\n readonly beforePack?: ((context: BeforePackContext) => Promise | any) | string | null\n\n /**\n * The function (or path to file or module id) to be [run after pack](#afterpack) (but before pack into distributable format and sign).\n */\n readonly afterPack?: ((context: AfterPackContext) => Promise | any) | string | null\n /**\n * The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format).\n */\n readonly afterSign?: ((context: AfterPackContext) => Promise | any) | string | null\n\n /**\n * The function (or path to file or module id) to be run on artifact build start.\n */\n readonly artifactBuildStarted?: ((context: ArtifactBuildStarted) => Promise | any) | string | null\n /**\n * The function (or path to file or module id) to be run on artifact build completed.\n */\n readonly artifactBuildCompleted?: ((context: ArtifactCreated) => Promise | any) | string | null\n /**\n * The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild).\n */\n readonly afterAllArtifactBuild?: ((context: BuildResult) => Promise> | Array) | string | null\n /**\n * MSI project created on disk - not packed into .msi package yet.\n */\n readonly msiProjectCreated?: ((path: string) => Promise | any) | string | null\n /**\n * Appx manifest created on disk - not packed into .appx package yet.\n */\n readonly appxManifestCreated?: ((path: string) => Promise | any) | string | null\n /**\n * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file.\n */\n readonly onNodeModuleFile?: ((file: string) => void) | string | null\n /**\n * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n *\n * If provided and `node_modules` are missing, it will not invoke production dependencies check.\n */\n readonly beforeBuild?: ((context: BeforeBuildContext) => Promise) | string | null\n\n /**\n * Whether to build using Electron Build Service if target not supported on current OS.\n * @default true\n */\n readonly remoteBuild?: boolean\n\n /**\n * Whether to include PDB files.\n * @default false\n */\n readonly includePdb?: boolean\n\n /**\n * Whether to remove `scripts` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageScripts?: boolean\n\n /**\n * Whether to remove `keywords` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageKeywords?: boolean\n}\n\ninterface PackContext {\n readonly outDir: string\n readonly appOutDir: string\n readonly packager: PlatformPackager\n readonly electronPlatformName: string\n readonly arch: Arch\n readonly targets: Array\n}\nexport type AfterPackContext = PackContext\nexport type BeforePackContext = PackContext\n\nexport interface MetadataDirectories {\n /**\n * The path to build resources.\n *\n * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`\n * @default build\n */\n readonly buildResources?: string | null\n\n /**\n * The output directory. [File macros](/file-patterns#file-macros) are supported.\n * @default dist\n */\n readonly output?: string | null\n\n /**\n * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.\n */\n readonly app?: string | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/core.d.ts b/client/node_modules/app-builder-lib/out/core.d.ts new file mode 100644 index 0000000000..6f836996e0 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/core.d.ts @@ -0,0 +1,60 @@ +/// +import { Arch, ArchType } from "builder-util"; +import { AllPublishOptions } from "builder-util-runtime"; +export declare type Publish = AllPublishOptions | Array | null; +export declare type TargetConfigType = Array | string | TargetConfiguration | null; +export interface TargetConfiguration { + /** + * The target name. e.g. `snap`. + */ + readonly target: string; + /** + * The arch or list of archs. + */ + readonly arch?: Array | ArchType; +} +export declare class Platform { + name: string; + buildConfigurationKey: string; + nodeName: NodeJS.Platform; + static MAC: Platform; + static LINUX: Platform; + static WINDOWS: Platform; + constructor(name: string, buildConfigurationKey: string, nodeName: NodeJS.Platform); + toString(): string; + createTarget(type?: string | Array | null, ...archs: Array): Map>>; + static current(): Platform; + static fromString(name: string): Platform; +} +export declare abstract class Target { + readonly name: string; + readonly isAsyncSupported: boolean; + abstract readonly outDir: string; + abstract readonly options: TargetSpecificOptions | null | undefined; + protected constructor(name: string, isAsyncSupported?: boolean); + checkOptions(): Promise; + abstract build(appOutDir: string, arch: Arch): Promise; + finishBuild(): Promise; +} +export interface TargetSpecificOptions { + /** + The [artifact file name template](/configuration/configuration#artifact-file-name-template). + */ + readonly artifactName?: string | null; + publish?: Publish; +} +export declare const DEFAULT_TARGET = "default"; +export declare const DIR_TARGET = "dir"; +export declare type CompressionLevel = "store" | "normal" | "maximum"; +export interface BeforeBuildContext { + readonly appDir: string; + readonly electronVersion: string; + readonly platform: Platform; + readonly arch: string; +} +export interface SourceRepositoryInfo { + type?: string; + domain?: string; + user: string; + project: string; +} diff --git a/client/node_modules/app-builder-lib/out/core.js b/client/node_modules/app-builder-lib/out/core.js new file mode 100644 index 0000000000..a354773858 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/core.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DIR_TARGET = exports.DEFAULT_TARGET = exports.Target = exports.Platform = void 0; +const builder_util_1 = require("builder-util"); +class Platform { + constructor(name, buildConfigurationKey, nodeName) { + this.name = name; + this.buildConfigurationKey = buildConfigurationKey; + this.nodeName = nodeName; + } + toString() { + return this.name; + } + createTarget(type, ...archs) { + if (type == null && (archs == null || archs.length === 0)) { + return new Map([[this, new Map()]]); + } + const archToType = new Map(); + for (const arch of archs == null || archs.length === 0 ? [builder_util_1.archFromString(process.arch)] : archs) { + archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type]); + } + return new Map([[this, archToType]]); + } + static current() { + return Platform.fromString(process.platform); + } + static fromString(name) { + name = name.toLowerCase(); + switch (name) { + case Platform.MAC.nodeName: + case Platform.MAC.name: + return Platform.MAC; + case Platform.WINDOWS.nodeName: + case Platform.WINDOWS.name: + case Platform.WINDOWS.buildConfigurationKey: + return Platform.WINDOWS; + case Platform.LINUX.nodeName: + return Platform.LINUX; + default: + throw new Error(`Unknown platform: ${name}`); + } + } +} +exports.Platform = Platform; +Platform.MAC = new Platform("mac", "mac", "darwin"); +Platform.LINUX = new Platform("linux", "linux", "linux"); +Platform.WINDOWS = new Platform("windows", "win", "win32"); +class Target { + constructor(name, isAsyncSupported = true) { + this.name = name; + this.isAsyncSupported = isAsyncSupported; + } + async checkOptions() { + // ignore + } + finishBuild() { + return Promise.resolve(); + } +} +exports.Target = Target; +exports.DEFAULT_TARGET = "default"; +exports.DIR_TARGET = "dir"; +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/core.js.map b/client/node_modules/app-builder-lib/out/core.js.map new file mode 100644 index 0000000000..abfab25695 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAoB7D,MAAa,QAAQ;IAKnB,YAAmB,IAAY,EAAS,qBAA6B,EAAS,QAAyB;QAApF,SAAI,GAAJ,IAAI,CAAQ;QAAS,0BAAqB,GAArB,qBAAqB,CAAQ;QAAS,aAAQ,GAAR,QAAQ,CAAiB;IAAG,CAAC;IAE3G,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,YAAY,CAAC,IAAoC,EAAE,GAAG,KAAkB;QACtE,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,I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,CAAA;YAEzB,KAAK,QAAQ,CAAC,KAAK,CAAC,QAAQ;gBAC1B,OAAO,QAAQ,CAAC,KAAK,CAAA;YAEvB;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;SAC/C;IACH,CAAC;;AA9CH,4BA+CC;AA9CQ,YAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1C,cAAK,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAC/C,gBAAO,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AA8C1D,MAAsB,MAAM;IAI1B,YAA+B,IAAY,EAAW,mBAA4B,IAAI;QAAvD,SAAI,GAAJ,IAAI,CAAQ;QAAW,qBAAgB,GAAhB,gBAAgB,CAAgB;IAAG,CAAC;IAE1F,KAAK,CAAC,YAAY;QAChB,SAAS;IACX,CAAC;IAID,WAAW;QACT,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AAfD,wBAeC;AAWY,QAAA,cAAc,GAAG,SAAS,CAAA;AAC1B,QAAA,UAAU,GAAG,KAAK,CAAA","sourcesContent":["import { Arch, archFromString, ArchType } from \"builder-util\"\nimport { AllPublishOptions } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array | null\n\nexport type TargetConfigType = Array | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n /**\n * The target name. e.g. `snap`.\n */\n readonly target: string\n\n /**\n * The arch or list of archs.\n */\n readonly arch?: Array | ArchType\n}\n\nexport class Platform {\n static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n constructor(public name: string, public buildConfigurationKey: string, public nodeName: NodeJS.Platform) {}\n\n toString() {\n return this.name\n }\n\n createTarget(type?: string | Array | null, ...archs: Array): Map>> {\n if (type == null && (archs == null || archs.length === 0)) {\n return new Map([[this, new Map()]])\n }\n\n const archToType = new Map()\n\n for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n }\n return new Map([[this, archToType]])\n }\n\n static current(): Platform {\n return Platform.fromString(process.platform)\n }\n\n static fromString(name: string): Platform {\n name = name.toLowerCase()\n switch (name) {\n case Platform.MAC.nodeName:\n case Platform.MAC.name:\n return Platform.MAC\n\n case Platform.WINDOWS.nodeName:\n case Platform.WINDOWS.name:\n case Platform.WINDOWS.buildConfigurationKey:\n return Platform.WINDOWS\n\n case Platform.LINUX.nodeName:\n return Platform.LINUX\n\n default:\n throw new Error(`Unknown platform: ${name}`)\n }\n }\n}\n\nexport abstract class Target {\n abstract readonly outDir: string\n abstract readonly options: TargetSpecificOptions | null | undefined\n\n protected constructor(readonly name: string, readonly isAsyncSupported: boolean = true) {}\n\n async checkOptions(): Promise {\n // ignore\n }\n\n abstract build(appOutDir: string, arch: Arch): Promise\n\n finishBuild(): Promise {\n return Promise.resolve()\n }\n}\n\nexport interface TargetSpecificOptions {\n /**\n The [artifact file name template](/configuration/configuration#artifact-file-name-template).\n */\n readonly artifactName?: string | null\n\n publish?: Publish\n}\n\nexport const DEFAULT_TARGET = \"default\"\nexport const DIR_TARGET = \"dir\"\n\nexport type CompressionLevel = \"store\" | \"normal\" | \"maximum\"\n\nexport interface BeforeBuildContext {\n readonly appDir: string\n readonly electronVersion: string\n readonly platform: Platform\n readonly arch: string\n}\n\nexport interface SourceRepositoryInfo {\n type?: string\n domain?: string\n user: string\n project: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/ElectronFramework.d.ts b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.d.ts new file mode 100644 index 0000000000..3b3f40894a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.d.ts @@ -0,0 +1,33 @@ +import { Configuration } from "../configuration"; +import { Framework } from "../Framework"; +import { Packager } from "../index"; +export declare type ElectronPlatformName = "darwin" | "linux" | "win32" | "mas"; +/** + * Electron distributables branding options. + * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json). + */ +export interface ElectronBrandingOptions { + projectName?: string; + productName?: string; +} +export declare function createBrandingOpts(opts: Configuration): Required; +export interface ElectronDownloadOptions { + version?: string; + /** + * The [cache location](https://github.com/electron-userland/electron-download#cache-location). + */ + cache?: string | null; + /** + * The mirror. + */ + mirror?: string | null; + /** @private */ + customDir?: string | null; + /** @private */ + customFilename?: string | null; + strictSSL?: boolean; + isVerifyChecksum?: boolean; + platform?: ElectronPlatformName; + arch?: string; +} +export declare function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise; diff --git a/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js new file mode 100644 index 0000000000..b409046b02 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js @@ -0,0 +1,163 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createElectronFrameworkSupport = exports.createBrandingOpts = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const index_1 = require("../index"); +const platformPackager_1 = require("../platformPackager"); +const pathManager_1 = require("../util/pathManager"); +const electronMac_1 = require("./electronMac"); +const electronVersion_1 = require("./electronVersion"); +const fs = require("fs/promises"); +function createBrandingOpts(opts) { + var _a, _b; + return { + projectName: ((_a = opts.electronBranding) === null || _a === void 0 ? void 0 : _a.projectName) || "electron", + productName: ((_b = opts.electronBranding) === null || _b === void 0 ? void 0 : _b.productName) || "Electron", + }; +} +exports.createBrandingOpts = createBrandingOpts; +function createDownloadOpts(opts, platform, arch, electronVersion) { + return { + platform, + arch, + version: electronVersion, + ...opts.electronDownload, + }; +} +async function beforeCopyExtraFiles(options) { + const packager = options.packager; + const appOutDir = options.appOutDir; + const electronBranding = createBrandingOpts(packager.config); + if (packager.platform === index_1.Platform.LINUX) { + if (!platformPackager_1.isSafeToUnpackElectronOnRemoteBuildServer(packager)) { + const linuxPackager = packager; + const executable = path.join(appOutDir, linuxPackager.executableName); + await fs_extra_1.rename(path.join(appOutDir, electronBranding.projectName), executable); + } + } + else if (packager.platform === index_1.Platform.WINDOWS) { + const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`); + await fs_extra_1.rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable); + } + else { + await electronMac_1.createMacApp(packager, appOutDir, options.asarIntegrity, options.platformName === "mas"); + const wantedLanguages = builder_util_1.asArray(packager.platformSpecificBuildOptions.electronLanguages); + if (wantedLanguages.length === 0) { + return; + } + // noinspection SpellCheckingInspection + const langFileExt = ".lproj"; + const resourcesDir = packager.getResourcesDir(appOutDir); + await bluebird_lst_1.default.map(fs_extra_1.readdir(resourcesDir), file => { + if (!file.endsWith(langFileExt)) { + return; + } + const language = file.substring(0, file.length - langFileExt.length); + if (!wantedLanguages.includes(language)) { + return fs.rm(path.join(resourcesDir, file), { recursive: true, force: true }); + } + return; + }, fs_1.CONCURRENCY); + } +} +class ElectronFramework { + constructor(name, version, distMacOsAppName) { + this.name = name; + this.version = version; + this.distMacOsAppName = distMacOsAppName; + // noinspection JSUnusedGlobalSymbols + this.macOsDefaultTargets = ["zip", "dmg"]; + // noinspection JSUnusedGlobalSymbols + this.defaultAppIdPrefix = "com.electron."; + // noinspection JSUnusedGlobalSymbols + this.isCopyElevateHelper = true; + // noinspection JSUnusedGlobalSymbols + this.isNpmRebuildRequired = true; + } + getDefaultIcon(platform) { + if (platform === index_1.Platform.LINUX) { + return path.join(pathManager_1.getTemplatePath("icons"), "electron-linux"); + } + else { + // default icon is embedded into app skeleton + return null; + } + } + prepareApplicationStageDirectory(options) { + return unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName); + } + beforeCopyExtraFiles(options) { + return beforeCopyExtraFiles(options); + } +} +async function createElectronFrameworkSupport(configuration, packager) { + let version = configuration.electronVersion; + if (version == null) { + // for prepacked app asar no dev deps in the app.asar + if (packager.isPrepackedAppAsar) { + version = await electronVersion_1.getElectronVersionFromInstalled(packager.projectDir); + if (version == null) { + throw new Error(`Cannot compute electron version for prepacked asar`); + } + } + else { + version = await electronVersion_1.computeElectronVersion(packager.projectDir, new lazy_val_1.Lazy(() => Promise.resolve(packager.metadata))); + } + configuration.electronVersion = version; + } + const branding = createBrandingOpts(configuration); + return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`); +} +exports.createElectronFrameworkSupport = createElectronFrameworkSupport; +async function unpack(prepareOptions, options, distMacOsAppName) { + const { packager, appOutDir, platformName } = prepareOptions; + const electronDist = packager.config.electronDist; + let dist = typeof electronDist === "function" ? electronDist(prepareOptions) : electronDist; + if (dist != null) { + const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`; + const resolvedDist = path.isAbsolute(dist) ? dist : path.resolve(packager.projectDir, dist); + if ((await fs_1.statOrNull(path.join(resolvedDist, zipFile))) != null) { + builder_util_1.log.info({ resolvedDist, zipFile }, "Resolved electronDist"); + options.cache = resolvedDist; + dist = null; + } + } + let isFullCleanup = false; + if (dist == null) { + if (platformPackager_1.isSafeToUnpackElectronOnRemoteBuildServer(packager)) { + return; + } + await builder_util_1.executeAppBuilder(["unpack-electron", "--configuration", JSON.stringify([options]), "--output", appOutDir, "--distMacOsAppName", distMacOsAppName]); + } + else { + isFullCleanup = true; + const source = packager.getElectronSrcDir(dist); + const destination = packager.getElectronDestinationDir(appOutDir); + builder_util_1.log.info({ source, destination }, "copying Electron"); + await fs_extra_1.emptyDir(appOutDir); + await fs_1.copyDir(source, destination, { + isUseHardLink: fs_1.DO_NOT_USE_HARD_LINKS, + }); + } + await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup); +} +function cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup) { + const out = prepareOptions.appOutDir; + const isMac = prepareOptions.packager.platform === index_1.Platform.MAC; + const resourcesPath = isMac ? path.join(out, distMacOsAppName, "Contents", "Resources") : path.join(out, "resources"); + return Promise.all([ + isFullCleanup ? fs_1.unlinkIfExists(path.join(resourcesPath, "default_app.asar")) : Promise.resolve(), + isFullCleanup ? fs_1.unlinkIfExists(path.join(out, "version")) : Promise.resolve(), + isMac + ? Promise.resolve() + : fs_extra_1.rename(path.join(out, "LICENSE"), path.join(out, "LICENSE.electron.txt")).catch(() => { + /* ignore */ + }), + ]); +} +//# sourceMappingURL=ElectronFramework.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js.map b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js.map new file mode 100644 index 0000000000..2f2a9278f0 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/ElectronFramework.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAA8D;AAC9D,4CAA6G;AAC7G,uCAAoD;AACpD,uCAA+B;AAC/B,6BAA4B;AAG5B,oCAA6C;AAG7C,0DAA+E;AAC/E,qDAAqD;AACrD,+CAA4C;AAC5C,uDAA2F;AAC3F,kCAAiC;AAajC,SAAgB,kBAAkB,CAAC,IAAmB;;IACpD,OAAO;QACL,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;QAC7D,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;KAC9D,CAAA;AACH,CAAC;AALD,gDAKC;AA6BD,SAAS,kBAAkB,CAAC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,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,iBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, executeAppBuilder, log } from \"builder-util\"\nimport { CONCURRENCY, copyDir, DO_NOT_USE_HARD_LINKS, statOrNull, unlinkIfExists } from \"builder-util/out/fs\"\nimport { emptyDir, readdir, rename } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { Packager, Platform } from \"../index\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport MacPackager from \"../macPackager\"\nimport { isSafeToUnpackElectronOnRemoteBuildServer } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { createMacApp } from \"./electronMac\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport * as fs from \"fs/promises\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n strictSSL?: boolean\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n return {\n platform,\n arch,\n version: electronVersion,\n ...opts.electronDownload,\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const packager = options.packager\n const appOutDir = options.appOutDir\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n if (!isSafeToUnpackElectronOnRemoteBuildServer(packager)) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n }\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n\n const wantedLanguages = asArray(packager.platformSpecificBuildOptions.electronLanguages)\n if (wantedLanguages.length === 0) {\n return\n }\n\n // noinspection SpellCheckingInspection\n const langFileExt = \".lproj\"\n const resourcesDir = packager.getResourcesDir(appOutDir)\n await BluebirdPromise.map(\n readdir(resourcesDir),\n file => {\n if (!file.endsWith(langFileExt)) {\n return\n }\n\n const language = file.substring(0, file.length - langFileExt.length)\n if (!wantedLanguages.includes(language)) {\n return fs.rm(path.join(resourcesDir, file), { recursive: true, force: true })\n }\n return\n },\n CONCURRENCY\n )\n }\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(readonly name: string, readonly version: string, readonly distMacOsAppName: string) {}\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n return unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName)\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir, new Lazy(() => Promise.resolve(packager.metadata)))\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`)\n}\n\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, options: ElectronDownloadOptions, distMacOsAppName: string) {\n const { packager, appOutDir, platformName } = prepareOptions\n\n const electronDist = packager.config.electronDist\n let dist: string | undefined | null = typeof electronDist === \"function\" ? electronDist(prepareOptions) : electronDist\n if (dist != null) {\n const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`\n const resolvedDist = path.isAbsolute(dist) ? dist : path.resolve(packager.projectDir, dist)\n if ((await statOrNull(path.join(resolvedDist, zipFile))) != null) {\n log.info({ resolvedDist, zipFile }, \"Resolved electronDist\")\n options.cache = resolvedDist\n dist = null\n }\n }\n\n let isFullCleanup = false\n if (dist == null) {\n if (isSafeToUnpackElectronOnRemoteBuildServer(packager)) {\n return\n }\n await executeAppBuilder([\"unpack-electron\", \"--configuration\", JSON.stringify([options]), \"--output\", appOutDir, \"--distMacOsAppName\", distMacOsAppName])\n } else {\n isFullCleanup = true\n const source = packager.getElectronSrcDir(dist)\n const destination = packager.getElectronDestinationDir(appOutDir)\n log.info({ source, destination }, \"copying Electron\")\n await emptyDir(appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n }\n\n await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/electronMac.d.ts b/client/node_modules/app-builder-lib/out/electron/electronMac.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronMac.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/electron/electronMac.js b/client/node_modules/app-builder-lib/out/electron/electronMac.js new file mode 100644 index 0000000000..cfe3729d1c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronMac.js @@ -0,0 +1,259 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createMacApp = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const appInfo_1 = require("../appInfo"); +const platformPackager_1 = require("../platformPackager"); +const appBuilder_1 = require("../util/appBuilder"); +const ElectronFramework_1 = require("./ElectronFramework"); +function doRename(basePath, oldName, newName) { + return promises_1.rename(path.join(basePath, oldName), path.join(basePath, newName)); +} +function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) { + return bluebird_lst_1.default.map(helperSuffixes, suffix => { + const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, "Contents", "MacOS"); + return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`)); + }); +} +function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist) { + const result = [" Helper"]; + if (helperEHPlist != null) { + result.push(" Helper EH"); + } + if (helperNPPlist != null) { + result.push(" Helper NP"); + } + if (helperRendererPlist != null) { + result.push(" Helper (Renderer)"); + } + if (helperPluginPlist != null) { + result.push(" Helper (Plugin)"); + } + if (helperGPUPlist != null) { + result.push(" Helper (GPU)"); + } + return result; +} +/** @internal */ +async function createMacApp(packager, appOutDir, asarIntegrity, isMas) { + const appInfo = packager.appInfo; + const appFilename = appInfo.productFilename; + const electronBranding = ElectronFramework_1.createBrandingOpts(packager.config); + const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents"); + const frameworksPath = path.join(contentsPath, "Frameworks"); + const loginItemPath = path.join(contentsPath, "Library", "LoginItems"); + const appPlistFilename = path.join(contentsPath, "Info.plist"); + const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, "Contents", "Info.plist"); + const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, "Contents", "Info.plist"); + const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, "Contents", "Info.plist"); + const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, "Contents", "Info.plist"); + const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, "Contents", "Info.plist"); + const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, "Contents", "Info.plist"); + const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, "Contents", "Info.plist"); + const plistContent = await appBuilder_1.executeAppBuilderAsJson([ + "decode-plist", + "-f", + appPlistFilename, + "-f", + helperPlistFilename, + "-f", + helperEHPlistFilename, + "-f", + helperNPPlistFilename, + "-f", + helperRendererPlistFilename, + "-f", + helperPluginPlistFilename, + "-f", + helperGPUPlistFilename, + "-f", + helperLoginPlistFilename, + ]); + if (plistContent[0] == null) { + throw new Error("corrupted Electron dist"); + } + const appPlist = plistContent[0]; + const helperPlist = plistContent[1]; + const helperEHPlist = plistContent[2]; + const helperNPPlist = plistContent[3]; + const helperRendererPlist = plistContent[4]; + const helperPluginPlist = plistContent[5]; + const helperGPUPlist = plistContent[6]; + const helperLoginPlist = plistContent[7]; + // if an extend-info file was supplied, copy its contents in first + if (plistContent[8] != null) { + Object.assign(appPlist, plistContent[8]); + } + const buildMetadata = packager.config; + /** + * Configure bundleIdentifier for the generic Electron Helper process + * + * This was the only Helper in Electron 5 and before. Allow users to configure + * the bundleIdentifier for continuity. + */ + const oldHelperBundleId = buildMetadata["helper-bundle-id"]; + if (oldHelperBundleId != null) { + builder_util_1.log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId"); + } + const helperBundleIdentifier = appInfo_1.filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`); + await packager.applyCommonInfo(appPlist, contentsPath); + // required for electron-updater proxy + if (!isMas) { + configureLocalhostAts(appPlist); + } + helperPlist.CFBundleExecutable = `${appFilename} Helper`; + helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`; + helperPlist.CFBundleIdentifier = helperBundleIdentifier; + helperPlist.CFBundleVersion = appPlist.CFBundleVersion; + /** + * Configure bundleIdentifier for Electron 5+ Helper processes + * + * In Electron 6, parts of the generic Electron Helper process were split into + * individual helper processes. Allow users to configure the bundleIdentifiers + * for continuity, specifically because macOS keychain access relies on + * bundleIdentifiers not changing (i.e. across versions of Electron). + */ + function configureHelper(helper, postfix, userProvidedBundleIdentifier) { + helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`; + helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`; + helper.CFBundleIdentifier = userProvidedBundleIdentifier + ? appInfo_1.filterCFBundleIdentifier(userProvidedBundleIdentifier) + : appInfo_1.filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`); + helper.CFBundleVersion = appPlist.CFBundleVersion; + } + if (helperRendererPlist != null) { + configureHelper(helperRendererPlist, "(Renderer)", packager.platformSpecificBuildOptions.helperRendererBundleId); + } + if (helperPluginPlist != null) { + configureHelper(helperPluginPlist, "(Plugin)", packager.platformSpecificBuildOptions.helperPluginBundleId); + } + if (helperGPUPlist != null) { + configureHelper(helperGPUPlist, "(GPU)", packager.platformSpecificBuildOptions.helperGPUBundleId); + } + if (helperEHPlist != null) { + configureHelper(helperEHPlist, "EH", packager.platformSpecificBuildOptions.helperEHBundleId); + } + if (helperNPPlist != null) { + configureHelper(helperNPPlist, "NP", packager.platformSpecificBuildOptions.helperNPBundleId); + } + if (helperLoginPlist != null) { + helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`; + helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`; + // noinspection SpellCheckingInspection + helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`; + helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion; + } + const protocols = builder_util_1.asArray(buildMetadata.protocols).concat(builder_util_1.asArray(packager.platformSpecificBuildOptions.protocols)); + if (protocols.length > 0) { + appPlist.CFBundleURLTypes = protocols.map(protocol => { + const schemes = builder_util_1.asArray(protocol.schemes); + if (schemes.length === 0) { + throw new builder_util_1.InvalidConfigurationError(`Protocol "${protocol.name}": must be at least one scheme specified`); + } + return { + CFBundleURLName: protocol.name, + CFBundleTypeRole: protocol.role || "Editor", + CFBundleURLSchemes: schemes.slice(), + }; + }); + } + const fileAssociations = packager.fileAssociations; + if (fileAssociations.length > 0) { + appPlist.CFBundleDocumentTypes = await bluebird_lst_1.default.map(fileAssociations, async (fileAssociation) => { + const extensions = builder_util_1.asArray(fileAssociation.ext).map(platformPackager_1.normalizeExt); + const customIcon = await packager.getResource(builder_util_1.getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`); + let iconFile = appPlist.CFBundleIconFile; + if (customIcon != null) { + iconFile = path.basename(customIcon); + await fs_1.copyOrLinkFile(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile)); + } + const result = { + CFBundleTypeExtensions: extensions, + CFBundleTypeName: fileAssociation.name || extensions[0], + CFBundleTypeRole: fileAssociation.role || "Editor", + LSHandlerRank: fileAssociation.rank || "Default", + CFBundleTypeIconFile: iconFile, + }; + if (fileAssociation.isPackage) { + result.LSTypeIsPackage = true; + } + return result; + }); + } + if (asarIntegrity != null) { + appPlist.ElectronAsarIntegrity = asarIntegrity; + } + const plistDataToWrite = { + [appPlistFilename]: appPlist, + [helperPlistFilename]: helperPlist, + }; + if (helperEHPlist != null) { + plistDataToWrite[helperEHPlistFilename] = helperEHPlist; + } + if (helperNPPlist != null) { + plistDataToWrite[helperNPPlistFilename] = helperNPPlist; + } + if (helperRendererPlist != null) { + plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist; + } + if (helperPluginPlist != null) { + plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist; + } + if (helperGPUPlist != null) { + plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist; + } + if (helperLoginPlist != null) { + plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist; + } + await Promise.all([ + appBuilder_1.executeAppBuilderAndWriteJson(["encode-plist"], plistDataToWrite), + doRename(path.join(contentsPath, "MacOS"), electronBranding.productName, appPlist.CFBundleExecutable), + fs_1.unlinkIfExists(path.join(appOutDir, "LICENSE")), + fs_1.unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")), + ]); + await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, electronBranding.productName); + if (helperLoginPlist != null) { + const prefix = electronBranding.productName; + const suffix = " Login Helper"; + const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, "Contents", "MacOS"); + await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`)); + } + const appPath = path.join(appOutDir, `${appFilename}.app`); + await promises_1.rename(path.dirname(contentsPath), appPath); + // https://github.com/electron-userland/electron-builder/issues/840 + const now = Date.now() / 1000; + await promises_1.utimes(appPath, now, now); +} +exports.createMacApp = createMacApp; +function configureLocalhostAts(appPlist) { + // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/ + let ats = appPlist.NSAppTransportSecurity; + if (ats == null) { + ats = {}; + appPlist.NSAppTransportSecurity = ats; + } + ats.NSAllowsLocalNetworking = true; + // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814 + ats.NSAllowsArbitraryLoads = true; + let exceptionDomains = ats.NSExceptionDomains; + if (exceptionDomains == null) { + exceptionDomains = {}; + ats.NSExceptionDomains = exceptionDomains; + } + if (exceptionDomains.localhost == null) { + const allowHttp = { + NSTemporaryExceptionAllowsInsecureHTTPSLoads: false, + NSIncludesSubdomains: false, + NSTemporaryExceptionAllowsInsecureHTTPLoads: true, + NSTemporaryExceptionMinimumTLSVersion: "1.0", + NSTemporaryExceptionRequiresForwardSecrecy: false, + }; + exceptionDomains.localhost = allowHttp; + exceptionDomains["127.0.0.1"] = allowHttp; + } +} +//# sourceMappingURL=electronMac.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/electronMac.js.map b/client/node_modules/app-builder-lib/out/electron/electronMac.js.map new file mode 100644 index 0000000000..6da1aae580 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronMac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"electronMac.js","sourceRoot":"","sources":["../../src/electron/electronMac.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAA+F;AAC/F,4CAAoE;AACpE,0CAA4C;AAC5C,6BAA4B;AAC5B,wCAAqD;AAGrD,0DAAkD;AAClD,mDAA2F;AAC3F,2DAAwD;AAExD,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe,EAAE,OAAe;IAClE,OAAO,iBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,WAAW,CAAC,cAA6B,EAAE,cAAsB,EAAE,OAAe,EAAE,MAAc;IACzG,OAAO,sBAAe,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE;QAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,MAAM,GAAG,MAAM,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACnG,OAAO,QAAQ,CAAC,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,MAAM,GAAG,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,MAAM,MAAM,CAAC,CAAC,CAA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AC,kBAAkB,CAAA;IAC7C,IAAI,gBAAgB,IAAI,IAAI,EAAE;QAC5B,gBAAgB,GAAG,EAAE,CAAA;QACrB,GAAG,CAAC,kBAAkB,GAAG,gBAAgB,CAAA;KAC1C;IAED,IAAI,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE;QACtC,MAAM,SAAS,GAAG;YAChB,4CAA4C,EAAE,KAAK;YACnD,oBAAoB,EAAE,KAAK;YAC3B,2CAA2C,EAAE,IAAI;YACjD,qCAAqC,EAAE,KAAK;YAC5C,0CAA0C,EAAE,KAAK;SAClD,CAAA;QACD,gBAAgB,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;KAC1C;AACH,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, getPlatformIconFileName, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { rename, utimes } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport MacPackager from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { createBrandingOpts } from \"./ElectronFramework\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array, frameworksPath: string, appName: string, prefix: string): Promise {\n return BluebirdPromise.map(helperSuffixes, suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n}\n\nfunction getAvailableHelperSuffixes(\n helperEHPlist: string | null,\n helperNPPlist: string | null,\n helperRendererPlist: string | null,\n helperPluginPlist: string | null,\n helperGPUPlist: string | null\n) {\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n const appFilename = appInfo.productFilename\n const electronBranding = createBrandingOpts(packager.config)\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, \"Contents\", \"Info.plist\")\n\n const plistContent: Array = await executeAppBuilderAsJson([\n \"decode-plist\",\n \"-f\",\n appPlistFilename,\n \"-f\",\n helperPlistFilename,\n \"-f\",\n helperEHPlistFilename,\n \"-f\",\n helperNPPlistFilename,\n \"-f\",\n helperRendererPlistFilename,\n \"-f\",\n helperPluginPlistFilename,\n \"-f\",\n helperGPUPlistFilename,\n \"-f\",\n helperLoginPlistFilename,\n ])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!\n const helperPlist = plistContent[1]!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperRendererPlist = plistContent[4]\n const helperPluginPlist = plistContent[5]\n const helperGPUPlist = plistContent[6]\n const helperLoginPlist = plistContent[7]\n\n // if an extend-info file was supplied, copy its contents in first\n if (plistContent[8] != null) {\n Object.assign(appPlist, plistContent[8])\n }\n\n const buildMetadata = packager.config\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformSpecificBuildOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformSpecificBuildOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformSpecificBuildOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformSpecificBuildOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformSpecificBuildOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice(),\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n appPlist.CFBundleDocumentTypes = await BluebirdPromise.map(fileAssociations, async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile,\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n }\n\n if (asarIntegrity != null) {\n appPlist.ElectronAsarIntegrity = asarIntegrity\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperRendererPlist != null) {\n plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist\n }\n if (helperPluginPlist != null) {\n plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist\n }\n if (helperGPUPlist != null) {\n plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), electronBranding.productName, appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(\n getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist),\n frameworksPath,\n appFilename,\n electronBranding.productName\n )\n\n if (helperLoginPlist != null) {\n const prefix = electronBranding.productName\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false,\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/electronVersion.d.ts b/client/node_modules/app-builder-lib/out/electron/electronVersion.d.ts new file mode 100644 index 0000000000..9337574ce6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronVersion.d.ts @@ -0,0 +1,8 @@ +import { Lazy } from "lazy-val"; +import { Configuration } from "../configuration"; +export declare type MetadataValue = Lazy<{ + [key: string]: any; +} | null>; +export declare function getElectronVersion(projectDir: string, config?: Configuration, projectMetadata?: MetadataValue): Promise; +export declare function getElectronVersionFromInstalled(projectDir: string): Promise; +export declare function getElectronPackage(projectDir: string): Promise; diff --git a/client/node_modules/app-builder-lib/out/electron/electronVersion.js b/client/node_modules/app-builder-lib/out/electron/electronVersion.js new file mode 100644 index 0000000000..d96625cd3a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronVersion.js @@ -0,0 +1,114 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeElectronVersion = exports.getElectronPackage = exports.getElectronVersionFromInstalled = exports.getElectronVersion = void 0; +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const nodeHttpExecutor_1 = require("builder-util/out/nodeHttpExecutor"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const read_config_file_1 = require("read-config-file"); +const semver = require("semver"); +const config_1 = require("../util/config"); +const electronPackages = ["electron", "electron-prebuilt", "electron-prebuilt-compile", "electron-nightly"]; +async function getElectronVersion(projectDir, config, projectMetadata = new lazy_val_1.Lazy(() => read_config_file_1.orNullIfFileNotExist(fs_extra_1.readJson(path.join(projectDir, "package.json"))))) { + if (config == null) { + config = await config_1.getConfig(projectDir, null, null); + } + if (config.electronVersion != null) { + return config.electronVersion; + } + return await computeElectronVersion(projectDir, projectMetadata); +} +exports.getElectronVersion = getElectronVersion; +async function getElectronVersionFromInstalled(projectDir) { + for (const name of electronPackages) { + try { + return (await fs_extra_1.readJson(path.join(projectDir, "node_modules", name, "package.json"))).version; + } + catch (e) { + if (e.code !== "ENOENT") { + builder_util_1.log.warn({ name, error: e }, `cannot read electron version package.json`); + } + } + } + return null; +} +exports.getElectronVersionFromInstalled = getElectronVersionFromInstalled; +async function getElectronPackage(projectDir) { + for (const name of electronPackages) { + try { + return await fs_extra_1.readJson(path.join(projectDir, "node_modules", name, "package.json")); + } + catch (e) { + if (e.code !== "ENOENT") { + builder_util_1.log.warn({ name, error: e }, `cannot find electron in package.json`); + } + } + } + return null; +} +exports.getElectronPackage = getElectronPackage; +/** @internal */ +async function computeElectronVersion(projectDir, projectMetadata) { + const result = await getElectronVersionFromInstalled(projectDir); + if (result != null) { + return result; + } + const dependency = findFromPackageMetadata(await projectMetadata.value); + if ((dependency === null || dependency === void 0 ? void 0 : dependency.name) === "electron-nightly") { + builder_util_1.log.info("You are using a nightly version of electron, be warned that those builds are highly unstable."); + const feedXml = await nodeHttpExecutor_1.httpExecutor.request({ + hostname: "github.com", + path: `/electron/nightlies/releases.atom`, + headers: { + accept: "application/xml, application/atom+xml, text/xml, */*", + }, + }); + const feed = builder_util_runtime_1.parseXml(feedXml); + const latestRelease = feed.element("entry", false, `No published versions on GitHub`); + const v = /\/tag\/v?([^/]+)$/.exec(latestRelease.element("link").attribute("href"))[1]; + return v.startsWith("v") ? v.substring(1) : v; + } + else if ((dependency === null || dependency === void 0 ? void 0 : dependency.version) === "latest") { + builder_util_1.log.warn('Electron version is set to "latest", but it is recommended to set it to some more restricted version range.'); + try { + const releaseInfo = JSON.parse((await nodeHttpExecutor_1.httpExecutor.request({ + hostname: "github.com", + path: `/electron/${dependency.name === "electron-nightly" ? "nightlies" : "electron"}/releases/latest`, + headers: { + accept: "application/json", + }, + }))); + const version = releaseInfo.tag_name.startsWith("v") ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name; + builder_util_1.log.info({ version }, `resolve ${dependency.name}@${dependency.version}`); + return version; + } + catch (e) { + builder_util_1.log.warn(e); + } + throw new builder_util_1.InvalidConfigurationError(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, "package.json")}'`); + } + const version = dependency === null || dependency === void 0 ? void 0 : dependency.version; + if (version == null || !/^\d/.test(version)) { + const versionMessage = version == null ? "" : ` and version ("${version}") is not fixed in project`; + throw new builder_util_1.InvalidConfigurationError(`Cannot compute electron version from installed node modules - none of the possible electron modules are installed${versionMessage}.\nSee https://github.com/electron-userland/electron-builder/issues/3984#issuecomment-504968246`); + } + return semver.coerce(version).toString(); +} +exports.computeElectronVersion = computeElectronVersion; +function findFromPackageMetadata(packageData) { + for (const name of electronPackages) { + const devDependencies = packageData.devDependencies; + let dep = devDependencies == null ? null : devDependencies[name]; + if (dep == null) { + const dependencies = packageData.dependencies; + dep = dependencies == null ? null : dependencies[name]; + } + if (dep != null) { + return { name, version: dep }; + } + } + return null; +} +//# sourceMappingURL=electronVersion.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/electron/electronVersion.js.map b/client/node_modules/app-builder-lib/out/electron/electronVersion.js.map new file mode 100644 index 0000000000..635727cbdf --- /dev/null +++ b/client/node_modules/app-builder-lib/out/electron/electronVersion.js.map @@ -0,0 +1 @@ +{"version":3,"file":"electronVersion.js","sourceRoot":"","sources":["../../src/electron/electronVersion.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,+DAA+C;AAC/C,wEAAgE;AAChE,uCAAmC;AACnC,uCAA+B;AAC/B,6BAA4B;AAC5B,uDAAuD;AACvD,iCAAgC;AAEhC,2CAA0C;AAI1C,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,kBAAkB,CAAC,CAAA;AAEpG,KAAK,UAAU,kBAAkB,CACtC,UAAkB,EAClB,MAAsB,EACtB,kBAAiC,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,uCAAoB,CAAC,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAEtH,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,GAAG,MAAM,kBAAS,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;KACjD;IACD,IAAI,MAAM,CAAC,eAAe,IAAI,IAAI,EAAE;Q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AAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAChE,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA;YAC7C,GAAG,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;SACvD;QACD,IAAI,GAAG,IAAI,IAAI,EAAE;YACf,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAA;SAC9B;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { InvalidConfigurationError, log } from \"builder-util\"\nimport { parseXml } from \"builder-util-runtime\"\nimport { httpExecutor } from \"builder-util/out/nodeHttpExecutor\"\nimport { readJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { orNullIfFileNotExist } from \"read-config-file\"\nimport * as semver from \"semver\"\nimport { Configuration } from \"../configuration\"\nimport { getConfig } from \"../util/config\"\n\nexport type MetadataValue = Lazy<{ [key: string]: any } | null>\n\nconst electronPackages = [\"electron\", \"electron-prebuilt\", \"electron-prebuilt-compile\", \"electron-nightly\"]\n\nexport async function getElectronVersion(\n projectDir: string,\n config?: Configuration,\n projectMetadata: MetadataValue = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, \"package.json\"))))\n): Promise {\n if (config == null) {\n config = await getConfig(projectDir, null, null)\n }\n if (config.electronVersion != null) {\n return config.electronVersion\n }\n return await computeElectronVersion(projectDir, projectMetadata)\n}\n\nexport async function getElectronVersionFromInstalled(projectDir: string) {\n for (const name of electronPackages) {\n try {\n return (await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))).version\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n log.warn({ name, error: e }, `cannot read electron version package.json`)\n }\n }\n }\n return null\n}\n\nexport async function getElectronPackage(projectDir: string) {\n for (const name of electronPackages) {\n try {\n return await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n log.warn({ name, error: e }, `cannot find electron in package.json`)\n }\n }\n }\n return null\n}\n\n/** @internal */\nexport async function computeElectronVersion(projectDir: string, projectMetadata: MetadataValue): Promise {\n const result = await getElectronVersionFromInstalled(projectDir)\n if (result != null) {\n return result\n }\n\n const dependency = findFromPackageMetadata(await projectMetadata.value)\n if (dependency?.name === \"electron-nightly\") {\n log.info(\"You are using a nightly version of electron, be warned that those builds are highly unstable.\")\n const feedXml = await httpExecutor.request({\n hostname: \"github.com\",\n path: `/electron/nightlies/releases.atom`,\n headers: {\n accept: \"application/xml, application/atom+xml, text/xml, */*\",\n },\n })\n const feed = parseXml(feedXml!)\n const latestRelease = feed.element(\"entry\", false, `No published versions on GitHub`)\n const v = /\\/tag\\/v?([^/]+)$/.exec(latestRelease.element(\"link\").attribute(\"href\"))![1]\n return v.startsWith(\"v\") ? v.substring(1) : v\n } else if (dependency?.version === \"latest\") {\n log.warn('Electron version is set to \"latest\", but it is recommended to set it to some more restricted version range.')\n try {\n const releaseInfo = JSON.parse(\n (await httpExecutor.request({\n hostname: \"github.com\",\n path: `/electron/${dependency.name === \"electron-nightly\" ? \"nightlies\" : \"electron\"}/releases/latest`,\n headers: {\n accept: \"application/json\",\n },\n }))!\n )\n const version = releaseInfo.tag_name.startsWith(\"v\") ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name\n log.info({ version }, `resolve ${dependency.name}@${dependency.version}`)\n return version\n } catch (e) {\n log.warn(e)\n }\n\n throw new InvalidConfigurationError(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, \"package.json\")}'`)\n }\n\n const version = dependency?.version\n if (version == null || !/^\\d/.test(version)) {\n const versionMessage = version == null ? \"\" : ` and version (\"${version}\") is not fixed in project`\n throw new InvalidConfigurationError(\n `Cannot compute electron version from installed node modules - none of the possible electron modules are installed${versionMessage}.\\nSee https://github.com/electron-userland/electron-builder/issues/3984#issuecomment-504968246`\n )\n }\n\n return semver.coerce(version)!.toString()\n}\n\ninterface NameAndVersion {\n readonly name: string\n readonly version: string\n}\n\nfunction findFromPackageMetadata(packageData: any): NameAndVersion | null {\n for (const name of electronPackages) {\n const devDependencies = packageData.devDependencies\n let dep = devDependencies == null ? null : devDependencies[name]\n if (dep == null) {\n const dependencies = packageData.dependencies\n dep = dependencies == null ? null : dependencies[name]\n }\n if (dep != null) {\n return { name, version: dep }\n }\n }\n return null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/errorMessages.d.ts b/client/node_modules/app-builder-lib/out/errorMessages.d.ts new file mode 100644 index 0000000000..48042420af --- /dev/null +++ b/client/node_modules/app-builder-lib/out/errorMessages.d.ts @@ -0,0 +1 @@ +export declare const authorEmailIsMissed = "Please specify author 'email' in the application package.json\n\nSee https://docs.npmjs.com/files/package.json#people-fields-author-contributors\n\nIt is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.\n(see https://www.electron.build/configuration/linux).\n"; diff --git a/client/node_modules/app-builder-lib/out/errorMessages.js b/client/node_modules/app-builder-lib/out/errorMessages.js new file mode 100644 index 0000000000..24772748b9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/errorMessages.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.authorEmailIsMissed = void 0; +exports.authorEmailIsMissed = `Please specify author 'email' in the application package.json + +See https://docs.npmjs.com/files/package.json#people-fields-author-contributors + +It is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options. +(see https://www.electron.build/configuration/linux). +`; +//# sourceMappingURL=errorMessages.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/errorMessages.js.map b/client/node_modules/app-builder-lib/out/errorMessages.js.map new file mode 100644 index 0000000000..e24bec54ef --- /dev/null +++ b/client/node_modules/app-builder-lib/out/errorMessages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errorMessages.js","sourceRoot":"","sources":["../src/errorMessages.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;;;;;;CAMlC,CAAA","sourcesContent":["export const authorEmailIsMissed = `Please specify author 'email' in the application package.json\n\nSee https://docs.npmjs.com/files/package.json#people-fields-author-contributors\n\nIt is required to set Linux .deb package maintainer. Or you can set maintainer in the custom linux options.\n(see https://www.electron.build/configuration/linux).\n`\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/fileMatcher.d.ts b/client/node_modules/app-builder-lib/out/fileMatcher.d.ts new file mode 100644 index 0000000000..6213bc48eb --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileMatcher.d.ts @@ -0,0 +1,9 @@ +import { PlatformSpecificBuildOptions } from "./index"; +export declare const excludedNames: string; +export declare const excludedExts = "iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts"; +export interface GetFileMatchersOptions { + readonly macroExpander: (pattern: string) => string; + readonly customBuildOptions: PlatformSpecificBuildOptions; + readonly globalOutDir: string; + readonly defaultSrc: string; +} diff --git a/client/node_modules/app-builder-lib/out/fileMatcher.js b/client/node_modules/app-builder-lib/out/fileMatcher.js new file mode 100644 index 0000000000..9682e4cd1a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileMatcher.js @@ -0,0 +1,282 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.copyFiles = exports.getFileMatchers = exports.getNodeModuleFileMatcher = exports.getMainFileMatchers = exports.FileMatcher = exports.excludedExts = exports.excludedNames = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const promises_1 = require("fs/promises"); +const minimatch_1 = require("minimatch"); +const path = require("path"); +const filter_1 = require("./util/filter"); +// https://github.com/electron-userland/electron-builder/issues/733 +const minimatchOptions = { dot: true }; +// noinspection SpellCheckingInspection +exports.excludedNames = ".git,.hg,.svn,CVS,RCS,SCCS," + + "__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore," + + ".idea,.vs,.flowconfig,.jshintrc,.eslintrc,.circleci," + + ".yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log," + + "appveyor.yml,.travis.yml,circle.yml,.nyc_output"; +exports.excludedExts = "iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts"; +function ensureNoEndSlash(file) { + if (path.sep !== "/") { + file = file.replace(/\//g, path.sep); + } + if (path.sep !== "\\") { + file = file.replace(/\\/g, path.sep); + } + if (file.endsWith(path.sep)) { + return file.substring(0, file.length - 1); + } + else { + return file; + } +} +/** @internal */ +class FileMatcher { + constructor(from, to, macroExpander, patterns) { + this.macroExpander = macroExpander; + this.excludePatterns = null; + this.from = ensureNoEndSlash(macroExpander(from)); + this.to = ensureNoEndSlash(macroExpander(to)); + this.patterns = builder_util_1.asArray(patterns).map(it => this.normalizePattern(it)); + this.isSpecifiedAsEmptyArray = Array.isArray(patterns) && patterns.length === 0; + } + normalizePattern(pattern) { + if (pattern.startsWith("./")) { + pattern = pattern.substring("./".length); + } + return path.posix.normalize(this.macroExpander(pattern.replace(/\\/g, "/"))); + } + addPattern(pattern) { + this.patterns.push(this.normalizePattern(pattern)); + } + prependPattern(pattern) { + this.patterns.unshift(this.normalizePattern(pattern)); + } + isEmpty() { + return this.patterns.length === 0; + } + containsOnlyIgnore() { + return !this.isEmpty() && this.patterns.find(it => !it.startsWith("!")) == null; + } + computeParsedPatterns(result, fromDir) { + const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from); + if (this.patterns.length === 0 && relativeFrom != null) { + // file mappings, from here is a file + result.push(new minimatch_1.Minimatch(relativeFrom, minimatchOptions)); + return; + } + for (let pattern of this.patterns) { + if (relativeFrom != null) { + pattern = path.join(relativeFrom, pattern); + } + const parsedPattern = new minimatch_1.Minimatch(pattern, minimatchOptions); + result.push(parsedPattern); + // do not add if contains dot (possibly file if has extension) + if (!pattern.includes(".") && !filter_1.hasMagic(parsedPattern)) { + // https://github.com/electron-userland/electron-builder/issues/545 + // add **/* + result.push(new minimatch_1.Minimatch(`${pattern}/**/*`, minimatchOptions)); + } + } + } + createFilter() { + const parsedPatterns = []; + this.computeParsedPatterns(parsedPatterns); + return filter_1.createFilter(this.from, parsedPatterns, this.excludePatterns); + } + toString() { + return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(", ")}`; + } +} +exports.FileMatcher = FileMatcher; +/** @internal */ +function getMainFileMatchers(appDir, destination, macroExpander, platformSpecificBuildOptions, platformPackager, outDir, isElectronCompile) { + const packager = platformPackager.info; + const buildResourceDir = path.resolve(packager.projectDir, packager.buildResourcesDir); + let matchers = packager.isPrepackedAppAsar + ? null + : getFileMatchers(packager.config, "files", destination, { + macroExpander, + customBuildOptions: platformSpecificBuildOptions, + globalOutDir: outDir, + defaultSrc: appDir, + }); + if (matchers == null) { + matchers = [new FileMatcher(appDir, destination, macroExpander)]; + } + const matcher = matchers[0]; + // add default patterns, but only if from equals to app dir + if (matcher.from !== appDir) { + return matchers; + } + // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive patterns + const patterns = matcher.patterns; + const customFirstPatterns = []; + // electron-webpack - we need to copy only package.json and node_modules from root dir (and these files are added by default), so, explicit empty array is specified + if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) { + customFirstPatterns.push("**/*"); + } + else if (!patterns.includes("package.json")) { + patterns.push("package.json"); + } + customFirstPatterns.push("!**/node_modules"); + // https://github.com/electron-userland/electron-builder/issues/1482 + const relativeBuildResourceDir = path.relative(matcher.from, buildResourceDir); + if (relativeBuildResourceDir.length !== 0 && !relativeBuildResourceDir.startsWith(".")) { + customFirstPatterns.push(`!${relativeBuildResourceDir}{,/**/*}`); + } + const relativeOutDir = matcher.normalizePattern(path.relative(packager.projectDir, outDir)); + if (!relativeOutDir.startsWith(".")) { + customFirstPatterns.push(`!${relativeOutDir}{,/**/*}`); + } + // add our default exclusions after last user possibly defined "all"/permissive pattern + let insertIndex = 0; + for (let i = patterns.length - 1; i >= 0; i--) { + if (patterns[i].startsWith("**/")) { + insertIndex = i + 1; + break; + } + } + patterns.splice(insertIndex, 0, ...customFirstPatterns); + patterns.push(`!**/*.{${exports.excludedExts}${packager.config.includePdb === true ? "" : ",pdb"}}`); + patterns.push("!**/._*"); + patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml}"); + patterns.push(`!**/{${exports.excludedNames}}`); + if (isElectronCompile) { + patterns.push("!.cache{,/**/*}"); + } + patterns.push("!.yarn{,/**/*}"); + // https://github.com/electron-userland/electron-builder/issues/1969 + // exclude ony for app root, use .yarnclean to clean node_modules + patterns.push("!.editorconfig"); + patterns.push("!.yarnrc.yml"); + const debugLogger = packager.debugLogger; + if (debugLogger.isEnabled) { + //tslint:disable-next-line:no-invalid-template-strings + debugLogger.add(`${macroExpander("${arch}")}.firstOrDefaultFilePatterns`, patterns); + } + return matchers; +} +exports.getMainFileMatchers = getMainFileMatchers; +/** @internal */ +function getNodeModuleFileMatcher(appDir, destination, macroExpander, platformSpecificBuildOptions, packager) { + // https://github.com/electron-userland/electron-builder/pull/2948#issuecomment-392241632 + // grab only excludes + const matcher = new FileMatcher(appDir, destination, macroExpander); + function addPatterns(patterns) { + if (patterns == null) { + return; + } + else if (!Array.isArray(patterns)) { + if (typeof patterns === "string" && patterns.startsWith("!")) { + matcher.addPattern(patterns); + return; + } + // ignore object form + return; + } + for (const pattern of patterns) { + if (typeof pattern === "string") { + if (pattern.startsWith("!")) { + matcher.addPattern(pattern); + } + } + else { + const fileSet = pattern; + if (fileSet.from == null || fileSet.from === ".") { + for (const p of builder_util_1.asArray(fileSet.filter)) { + matcher.addPattern(p); + } + } + } + } + } + addPatterns(packager.config.files); + addPatterns(platformSpecificBuildOptions.files); + if (!matcher.isEmpty()) { + matcher.prependPattern("**/*"); + } + const debugLogger = packager.debugLogger; + if (debugLogger.isEnabled) { + //tslint:disable-next-line:no-invalid-template-strings + debugLogger.add(`${macroExpander("${arch}")}.nodeModuleFilePatterns`, matcher.patterns); + } + return matcher; +} +exports.getNodeModuleFileMatcher = getNodeModuleFileMatcher; +/** @internal */ +function getFileMatchers(config, name, defaultDestination, options) { + const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander); + const fileMatchers = []; + function addPatterns(patterns) { + if (patterns == null) { + return; + } + else if (!Array.isArray(patterns)) { + if (typeof patterns === "string") { + defaultMatcher.addPattern(patterns); + return; + } + patterns = [patterns]; + } + for (const pattern of patterns) { + if (typeof pattern === "string") { + // use normalize to transform ./foo to foo + defaultMatcher.addPattern(pattern); + } + else if (name === "asarUnpack") { + throw new Error(`Advanced file copying not supported for "${name}"`); + } + else { + const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from); + const to = pattern.to == null ? defaultDestination : path.resolve(defaultDestination, pattern.to); + fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter)); + } + } + } + if (name !== "extraDistFiles") { + addPatterns(config[name]); + } + addPatterns(options.customBuildOptions[name]); + if (!defaultMatcher.isEmpty()) { + // default matcher should be first in the array + fileMatchers.unshift(defaultMatcher); + } + // we cannot exclude the whole out dir, because sometimes users want to use some file in the out dir in the patterns + const relativeOutDir = defaultMatcher.normalizePattern(path.relative(options.defaultSrc, options.globalOutDir)); + if (!relativeOutDir.startsWith(".")) { + defaultMatcher.addPattern(`!${relativeOutDir}/*-unpacked{,/**/*}`); + } + return fileMatchers.length === 0 ? null : fileMatchers; +} +exports.getFileMatchers = getFileMatchers; +/** @internal */ +function copyFiles(matchers, transformer, isUseHardLink) { + if (matchers == null || matchers.length === 0) { + return Promise.resolve(); + } + return bluebird_lst_1.default.map(matchers, async (matcher) => { + const fromStat = await fs_1.statOrNull(matcher.from); + if (fromStat == null) { + builder_util_1.log.warn({ from: matcher.from }, `file source doesn't exist`); + return; + } + if (fromStat.isFile()) { + const toStat = await fs_1.statOrNull(matcher.to); + // https://github.com/electron-userland/electron-builder/issues/1245 + if (toStat != null && toStat.isDirectory()) { + return await fs_1.copyOrLinkFile(matcher.from, path.join(matcher.to, path.basename(matcher.from)), fromStat, isUseHardLink); + } + await promises_1.mkdir(path.dirname(matcher.to), { recursive: true }); + return await fs_1.copyOrLinkFile(matcher.from, matcher.to, fromStat); + } + if (matcher.isEmpty() || matcher.containsOnlyIgnore()) { + matcher.prependPattern("**/*"); + } + builder_util_1.log.debug({ matcher }, "copying files using pattern"); + return await fs_1.copyDir(matcher.from, matcher.to, { filter: matcher.createFilter(), transformer, isUseHardLink: isUseHardLink ? fs_1.USE_HARD_LINKS : null }); + }); +} +exports.copyFiles = copyFiles; +//# sourceMappingURL=fileMatcher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/fileMatcher.js.map b/client/node_modules/app-builder-lib/out/fileMatcher.js.map new file mode 100644 index 0000000000..630023e105 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileMatcher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileMatcher.js","sourceRoot":"","sources":["../src/fileMatcher.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAA2C;AAC3C,4CAAkH;AAClH,0CAAmC;AACnC,yCAAqC;AACrC,6BAA4B;AAG5B,0CAAsD;AAEtD,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAEtC,uCAAuC;AAC1B,QAAA,aAAa,GACxB,6BAA6B;IAC7B,gFAAgF;IAChF,sDAAsD;IACtD,+FAA+F;IAC/F,iDAAiD,CAAA;AAEtC,QAAA,YAAY,GAAG,6DAA6D,CAAA;AAEzF,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE;QACpB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;KACrC;IACD,IA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AM,YAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,mBAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IACvJ,CAAC,CAAC,CAAA;AACJ,CAAC;AA7BD,8BA6BC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, log } from \"builder-util\"\nimport { copyDir, copyOrLinkFile, Filter, statOrNull, FileTransformer, USE_HARD_LINKS } from \"builder-util/out/fs\"\nimport { mkdir } from \"fs/promises\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { Configuration, FileSet, Packager, PlatformSpecificBuildOptions } from \"./index\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { createFilter, hasMagic } from \"./util/filter\"\n\n// https://github.com/electron-userland/electron-builder/issues/733\nconst minimatchOptions = { dot: true }\n\n// noinspection SpellCheckingInspection\nexport const excludedNames =\n \".git,.hg,.svn,CVS,RCS,SCCS,\" +\n \"__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore,\" +\n \".idea,.vs,.flowconfig,.jshintrc,.eslintrc,.circleci,\" +\n \".yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log,\" +\n \"appveyor.yml,.travis.yml,circle.yml,.nyc_output\"\n\nexport const excludedExts = \"iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts\"\n\nfunction ensureNoEndSlash(file: string): string {\n if (path.sep !== \"/\") {\n file = file.replace(/\\//g, path.sep)\n }\n if (path.sep !== \"\\\\\") {\n file = file.replace(/\\\\/g, path.sep)\n }\n\n if (file.endsWith(path.sep)) {\n return file.substring(0, file.length - 1)\n } else {\n return file\n }\n}\n\n/** @internal */\nexport class FileMatcher {\n readonly from: string\n readonly to: string\n\n readonly patterns: Array\n\n excludePatterns: Array | null = null\n\n readonly isSpecifiedAsEmptyArray: boolean\n\n constructor(from: string, to: string, readonly macroExpander: (pattern: string) => string, patterns?: Array | string | null | undefined) {\n this.from = ensureNoEndSlash(macroExpander(from))\n this.to = ensureNoEndSlash(macroExpander(to))\n this.patterns = asArray(patterns).map(it => this.normalizePattern(it))\n this.isSpecifiedAsEmptyArray = Array.isArray(patterns) && patterns.length === 0\n }\n\n normalizePattern(pattern: string) {\n if (pattern.startsWith(\"./\")) {\n pattern = pattern.substring(\"./\".length)\n }\n return path.posix.normalize(this.macroExpander(pattern.replace(/\\\\/g, \"/\")))\n }\n\n addPattern(pattern: string) {\n this.patterns.push(this.normalizePattern(pattern))\n }\n\n prependPattern(pattern: string) {\n this.patterns.unshift(this.normalizePattern(pattern))\n }\n\n isEmpty() {\n return this.patterns.length === 0\n }\n\n containsOnlyIgnore(): boolean {\n return !this.isEmpty() && this.patterns.find(it => !it.startsWith(\"!\")) == null\n }\n\n computeParsedPatterns(result: Array, fromDir?: string): void {\n const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from)\n\n if (this.patterns.length === 0 && relativeFrom != null) {\n // file mappings, from here is a file\n result.push(new Minimatch(relativeFrom, minimatchOptions))\n return\n }\n\n for (let pattern of this.patterns) {\n if (relativeFrom != null) {\n pattern = path.join(relativeFrom, pattern)\n }\n\n const parsedPattern = new Minimatch(pattern, minimatchOptions)\n result.push(parsedPattern)\n\n // do not add if contains dot (possibly file if has extension)\n if (!pattern.includes(\".\") && !hasMagic(parsedPattern)) {\n // https://github.com/electron-userland/electron-builder/issues/545\n // add **/*\n result.push(new Minimatch(`${pattern}/**/*`, minimatchOptions))\n }\n }\n }\n\n createFilter(): Filter {\n const parsedPatterns: Array = []\n this.computeParsedPatterns(parsedPatterns)\n return createFilter(this.from, parsedPatterns, this.excludePatterns)\n }\n\n toString() {\n return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(\", \")}`\n }\n}\n\n/** @internal */\nexport function getMainFileMatchers(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n platformPackager: PlatformPackager,\n outDir: string,\n isElectronCompile: boolean\n): Array {\n const packager = platformPackager.info\n const buildResourceDir = path.resolve(packager.projectDir, packager.buildResourcesDir)\n\n let matchers = packager.isPrepackedAppAsar\n ? null\n : getFileMatchers(packager.config, \"files\", destination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: outDir,\n defaultSrc: appDir,\n })\n if (matchers == null) {\n matchers = [new FileMatcher(appDir, destination, macroExpander)]\n }\n\n const matcher = matchers[0]\n // add default patterns, but only if from equals to app dir\n if (matcher.from !== appDir) {\n return matchers\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive patterns\n const patterns = matcher.patterns\n\n const customFirstPatterns: Array = []\n // electron-webpack - we need to copy only package.json and node_modules from root dir (and these files are added by default), so, explicit empty array is specified\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n customFirstPatterns.push(\"**/*\")\n } else if (!patterns.includes(\"package.json\")) {\n patterns.push(\"package.json\")\n }\n\n customFirstPatterns.push(\"!**/node_modules\")\n\n // https://github.com/electron-userland/electron-builder/issues/1482\n const relativeBuildResourceDir = path.relative(matcher.from, buildResourceDir)\n if (relativeBuildResourceDir.length !== 0 && !relativeBuildResourceDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeBuildResourceDir}{,/**/*}`)\n }\n\n const relativeOutDir = matcher.normalizePattern(path.relative(packager.projectDir, outDir))\n if (!relativeOutDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeOutDir}{,/**/*}`)\n }\n\n // add our default exclusions after last user possibly defined \"all\"/permissive pattern\n let insertIndex = 0\n for (let i = patterns.length - 1; i >= 0; i--) {\n if (patterns[i].startsWith(\"**/\")) {\n insertIndex = i + 1\n break\n }\n }\n patterns.splice(insertIndex, 0, ...customFirstPatterns)\n\n patterns.push(`!**/*.{${excludedExts}${packager.config.includePdb === true ? \"\" : \",pdb\"}}`)\n patterns.push(\"!**/._*\")\n patterns.push(\"!**/electron-builder.{yaml,yml,json,json5,toml}\")\n patterns.push(`!**/{${excludedNames}}`)\n\n if (isElectronCompile) {\n patterns.push(\"!.cache{,/**/*}\")\n }\n patterns.push(\"!.yarn{,/**/*}\")\n\n // https://github.com/electron-userland/electron-builder/issues/1969\n // exclude ony for app root, use .yarnclean to clean node_modules\n patterns.push(\"!.editorconfig\")\n patterns.push(\"!.yarnrc.yml\")\n\n const debugLogger = packager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.firstOrDefaultFilePatterns`, patterns)\n }\n return matchers\n}\n\n/** @internal */\nexport function getNodeModuleFileMatcher(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n packager: Packager\n): FileMatcher {\n // https://github.com/electron-userland/electron-builder/pull/2948#issuecomment-392241632\n // grab only excludes\n const matcher = new FileMatcher(appDir, destination, macroExpander)\n\n function addPatterns(patterns: Array | string | null | undefined | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\" && patterns.startsWith(\"!\")) {\n matcher.addPattern(patterns)\n return\n }\n // ignore object form\n return\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n if (pattern.startsWith(\"!\")) {\n matcher.addPattern(pattern)\n }\n } else {\n const fileSet = pattern\n if (fileSet.from == null || fileSet.from === \".\") {\n for (const p of asArray(fileSet.filter)) {\n matcher.addPattern(p)\n }\n }\n }\n }\n }\n\n addPatterns(packager.config.files)\n addPatterns(platformSpecificBuildOptions.files)\n\n if (!matcher.isEmpty()) {\n matcher.prependPattern(\"**/*\")\n }\n\n const debugLogger = packager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.nodeModuleFilePatterns`, matcher.patterns)\n }\n\n return matcher\n}\n\nexport interface GetFileMatchersOptions {\n readonly macroExpander: (pattern: string) => string\n readonly customBuildOptions: PlatformSpecificBuildOptions\n readonly globalOutDir: string\n\n readonly defaultSrc: string\n}\n\n/** @internal */\nexport function getFileMatchers(\n config: Configuration,\n name: \"files\" | \"extraFiles\" | \"extraResources\" | \"asarUnpack\" | \"extraDistFiles\",\n defaultDestination: string,\n options: GetFileMatchersOptions\n): Array | null {\n const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander)\n const fileMatchers: Array = []\n\n function addPatterns(patterns: Array | string | null | undefined | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\") {\n defaultMatcher.addPattern(patterns)\n return\n }\n patterns = [patterns]\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n // use normalize to transform ./foo to foo\n defaultMatcher.addPattern(pattern)\n } else if (name === \"asarUnpack\") {\n throw new Error(`Advanced file copying not supported for \"${name}\"`)\n } else {\n const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from)\n const to = pattern.to == null ? defaultDestination : path.resolve(defaultDestination, pattern.to)\n fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter))\n }\n }\n }\n\n if (name !== \"extraDistFiles\") {\n addPatterns((config as any)[name])\n }\n addPatterns((options.customBuildOptions as any)[name])\n\n if (!defaultMatcher.isEmpty()) {\n // default matcher should be first in the array\n fileMatchers.unshift(defaultMatcher)\n }\n\n // we cannot exclude the whole out dir, because sometimes users want to use some file in the out dir in the patterns\n const relativeOutDir = defaultMatcher.normalizePattern(path.relative(options.defaultSrc, options.globalOutDir))\n if (!relativeOutDir.startsWith(\".\")) {\n defaultMatcher.addPattern(`!${relativeOutDir}/*-unpacked{,/**/*}`)\n }\n\n return fileMatchers.length === 0 ? null : fileMatchers\n}\n\n/** @internal */\nexport function copyFiles(matchers: Array | null, transformer: FileTransformer | null, isUseHardLink?: boolean): Promise {\n if (matchers == null || matchers.length === 0) {\n return Promise.resolve()\n }\n\n return BluebirdPromise.map(matchers, async (matcher: FileMatcher) => {\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.warn({ from: matcher.from }, `file source doesn't exist`)\n return\n }\n\n if (fromStat.isFile()) {\n const toStat = await statOrNull(matcher.to)\n // https://github.com/electron-userland/electron-builder/issues/1245\n if (toStat != null && toStat.isDirectory()) {\n return await copyOrLinkFile(matcher.from, path.join(matcher.to, path.basename(matcher.from)), fromStat, isUseHardLink)\n }\n\n await mkdir(path.dirname(matcher.to), { recursive: true })\n return await copyOrLinkFile(matcher.from, matcher.to, fromStat)\n }\n\n if (matcher.isEmpty() || matcher.containsOnlyIgnore()) {\n matcher.prependPattern(\"**/*\")\n }\n log.debug({ matcher }, \"copying files using pattern\")\n return await copyDir(matcher.from, matcher.to, { filter: matcher.createFilter(), transformer, isUseHardLink: isUseHardLink ? USE_HARD_LINKS : null })\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/fileTransformer.d.ts b/client/node_modules/app-builder-lib/out/fileTransformer.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileTransformer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/fileTransformer.js b/client/node_modules/app-builder-lib/out/fileTransformer.js new file mode 100644 index 0000000000..70f27d1373 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileTransformer.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createElectronCompilerHost = exports.createTransformer = exports.hasDep = exports.isElectronCompileUsed = exports.NODE_MODULES_PATTERN = void 0; +const builder_util_1 = require("builder-util"); +const promises_1 = require("fs/promises"); +const path = require("path"); +/** @internal */ +exports.NODE_MODULES_PATTERN = `${path.sep}node_modules${path.sep}`; +/** @internal */ +function isElectronCompileUsed(info) { + if (info.config.electronCompile != null) { + return info.config.electronCompile; + } + // if in devDependencies - it means that babel is used for precompilation or for some reason user decided to not use electron-compile for production + return hasDep("electron-compile", info); +} +exports.isElectronCompileUsed = isElectronCompileUsed; +/** @internal */ +function hasDep(name, info) { + const deps = info.metadata.dependencies; + return deps != null && name in deps; +} +exports.hasDep = hasDep; +/** @internal */ +function createTransformer(srcDir, configuration, extraMetadata, extraTransformer) { + const mainPackageJson = path.join(srcDir, "package.json"); + const isRemovePackageScripts = configuration.removePackageScripts !== false; + const isRemovePackageKeywords = configuration.removePackageKeywords !== false; + const packageJson = path.sep + "package.json"; + return file => { + if (file === mainPackageJson) { + return modifyMainPackageJson(file, extraMetadata, isRemovePackageScripts, isRemovePackageKeywords); + } + if (file.endsWith(packageJson) && file.includes(exports.NODE_MODULES_PATTERN)) { + return promises_1.readFile(file, "utf-8") + .then(it => cleanupPackageJson(JSON.parse(it), { + isMain: false, + isRemovePackageScripts, + isRemovePackageKeywords, + })) + .catch(e => builder_util_1.log.warn(e)); + } + else if (extraTransformer != null) { + return extraTransformer(file); + } + else { + return null; + } + }; +} +exports.createTransformer = createTransformer; +/** @internal */ +function createElectronCompilerHost(projectDir, cacheDir) { + const electronCompilePath = path.join(projectDir, "node_modules", "electron-compile", "lib"); + return require(path.join(electronCompilePath, "config-parser")).createCompilerHostFromProjectRoot(projectDir, cacheDir); +} +exports.createElectronCompilerHost = createElectronCompilerHost; +const ignoredPackageMetadataProperties = new Set(["dist", "gitHead", "build", "jspm", "ava", "xo", "nyc", "eslintConfig", "contributors", "bundleDependencies", "tags"]); +function cleanupPackageJson(data, options) { + const deps = data.dependencies; + // https://github.com/electron-userland/electron-builder/issues/507#issuecomment-312772099 + const isRemoveBabel = deps != null && typeof deps === "object" && !Object.getOwnPropertyNames(deps).some(it => it.startsWith("babel")); + try { + let changed = false; + for (const prop of Object.getOwnPropertyNames(data)) { + // removing devDependencies from package.json breaks levelup in electron, so, remove it only from main package.json + if (prop[0] === "_" || + ignoredPackageMetadataProperties.has(prop) || + (options.isRemovePackageScripts && prop === "scripts") || + (options.isRemovePackageKeywords && prop === "keywords") || + (options.isMain && prop === "devDependencies") || + (!options.isMain && prop === "bugs") || + (isRemoveBabel && prop === "babel")) { + delete data[prop]; + changed = true; + } + } + if (changed) { + return JSON.stringify(data, null, 2); + } + } + catch (e) { + builder_util_1.debug(e); + } + return null; +} +async function modifyMainPackageJson(file, extraMetadata, isRemovePackageScripts, isRemovePackageKeywords) { + const mainPackageData = JSON.parse(await promises_1.readFile(file, "utf-8")); + if (extraMetadata != null) { + builder_util_1.deepAssign(mainPackageData, extraMetadata); + } + // https://github.com/electron-userland/electron-builder/issues/1212 + const serializedDataIfChanged = cleanupPackageJson(mainPackageData, { + isMain: true, + isRemovePackageScripts, + isRemovePackageKeywords, + }); + if (serializedDataIfChanged != null) { + return serializedDataIfChanged; + } + else if (extraMetadata != null) { + return JSON.stringify(mainPackageData, null, 2); + } + return null; +} +//# sourceMappingURL=fileTransformer.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/fileTransformer.js.map b/client/node_modules/app-builder-lib/out/fileTransformer.js.map new file mode 100644 index 0000000000..9188312ef6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/fileTransformer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fileTransformer.js","sourceRoot":"","sources":["../src/fileTransformer.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,0CAAsC;AACtC,6BAA4B;AAI5B,gBAAgB;AACH,QAAA,oBAAoB,GAAG,GAAG,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,GAAG,EAAE,CAAA;AAExE,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,IAAc;IAClD,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,IAAI,EAAE;QACvC,OAAO,IAAI,CAAC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,IAAI,EAAE,CAAC,CAAC,CAAA;KAChD;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { debug, log, deepAssign } from \"builder-util\"\nimport { FileTransformer } from \"builder-util/out/fs\"\nimport { readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { Configuration } from \"./configuration\"\nimport { Packager } from \"./packager\"\n\n/** @internal */\nexport const NODE_MODULES_PATTERN = `${path.sep}node_modules${path.sep}`\n\n/** @internal */\nexport function isElectronCompileUsed(info: Packager): boolean {\n if (info.config.electronCompile != null) {\n return info.config.electronCompile\n }\n\n // if in devDependencies - it means that babel is used for precompilation or for some reason user decided to not use electron-compile for production\n return hasDep(\"electron-compile\", info)\n}\n\n/** @internal */\nexport function hasDep(name: string, info: Packager) {\n const deps = info.metadata.dependencies\n return deps != null && name in deps\n}\n\n/** @internal */\nexport function createTransformer(srcDir: string, configuration: Configuration, extraMetadata: any, extraTransformer: FileTransformer | null): FileTransformer {\n const mainPackageJson = path.join(srcDir, \"package.json\")\n const isRemovePackageScripts = configuration.removePackageScripts !== false\n const isRemovePackageKeywords = configuration.removePackageKeywords !== false\n const packageJson = path.sep + \"package.json\"\n return file => {\n if (file === mainPackageJson) {\n return modifyMainPackageJson(file, extraMetadata, isRemovePackageScripts, isRemovePackageKeywords)\n }\n\n if (file.endsWith(packageJson) && file.includes(NODE_MODULES_PATTERN)) {\n return readFile(file, \"utf-8\")\n .then(it =>\n cleanupPackageJson(JSON.parse(it), {\n isMain: false,\n isRemovePackageScripts,\n isRemovePackageKeywords,\n })\n )\n .catch(e => log.warn(e))\n } else if (extraTransformer != null) {\n return extraTransformer(file)\n } else {\n return null\n }\n }\n}\n\n/** @internal */\nexport interface CompilerHost {\n compile(file: string): any\n\n saveConfiguration(): Promise\n}\n\n/** @internal */\nexport function createElectronCompilerHost(projectDir: string, cacheDir: string): Promise {\n const electronCompilePath = path.join(projectDir, \"node_modules\", \"electron-compile\", \"lib\")\n return require(path.join(electronCompilePath, \"config-parser\")).createCompilerHostFromProjectRoot(projectDir, cacheDir)\n}\n\nconst ignoredPackageMetadataProperties = new Set([\"dist\", \"gitHead\", \"build\", \"jspm\", \"ava\", \"xo\", \"nyc\", \"eslintConfig\", \"contributors\", \"bundleDependencies\", \"tags\"])\n\ninterface CleanupPackageFileOptions {\n readonly isRemovePackageScripts: boolean\n readonly isRemovePackageKeywords: boolean\n readonly isMain: boolean\n}\n\nfunction cleanupPackageJson(data: any, options: CleanupPackageFileOptions): any {\n const deps = data.dependencies\n // https://github.com/electron-userland/electron-builder/issues/507#issuecomment-312772099\n const isRemoveBabel = deps != null && typeof deps === \"object\" && !Object.getOwnPropertyNames(deps).some(it => it.startsWith(\"babel\"))\n try {\n let changed = false\n for (const prop of Object.getOwnPropertyNames(data)) {\n // removing devDependencies from package.json breaks levelup in electron, so, remove it only from main package.json\n if (\n prop[0] === \"_\" ||\n ignoredPackageMetadataProperties.has(prop) ||\n (options.isRemovePackageScripts && prop === \"scripts\") ||\n (options.isRemovePackageKeywords && prop === \"keywords\") ||\n (options.isMain && prop === \"devDependencies\") ||\n (!options.isMain && prop === \"bugs\") ||\n (isRemoveBabel && prop === \"babel\")\n ) {\n delete data[prop]\n changed = true\n }\n }\n\n if (changed) {\n return JSON.stringify(data, null, 2)\n }\n } catch (e) {\n debug(e)\n }\n\n return null\n}\n\nasync function modifyMainPackageJson(file: string, extraMetadata: any, isRemovePackageScripts: boolean, isRemovePackageKeywords: boolean) {\n const mainPackageData = JSON.parse(await readFile(file, \"utf-8\"))\n if (extraMetadata != null) {\n deepAssign(mainPackageData, extraMetadata)\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1212\n const serializedDataIfChanged = cleanupPackageJson(mainPackageData, {\n isMain: true,\n isRemovePackageScripts,\n isRemovePackageKeywords,\n })\n if (serializedDataIfChanged != null) {\n return serializedDataIfChanged\n } else if (extraMetadata != null) {\n return JSON.stringify(mainPackageData, null, 2)\n }\n return null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/forge-maker.d.ts b/client/node_modules/app-builder-lib/out/forge-maker.d.ts new file mode 100644 index 0000000000..a24495b356 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/forge-maker.d.ts @@ -0,0 +1,5 @@ +import { PackagerOptions } from "./packagerApi"; +export interface ForgeOptions { + readonly dir: string; +} +export declare function buildForge(forgeOptions: ForgeOptions, options: PackagerOptions): Promise; diff --git a/client/node_modules/app-builder-lib/out/forge-maker.js b/client/node_modules/app-builder-lib/out/forge-maker.js new file mode 100644 index 0000000000..feb4d131df --- /dev/null +++ b/client/node_modules/app-builder-lib/out/forge-maker.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.buildForge = void 0; +const path = require("path"); +const index_1 = require("./index"); +function buildForge(forgeOptions, options) { + const appDir = forgeOptions.dir; + return index_1.build({ + prepackaged: appDir, + config: { + directories: { + // https://github.com/electron-userland/electron-forge/blob/master/src/makers/generic/zip.js + output: path.resolve(appDir, "..", "make"), + }, + }, + ...options, + }); +} +exports.buildForge = buildForge; +//# sourceMappingURL=forge-maker.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/forge-maker.js.map b/client/node_modules/app-builder-lib/out/forge-maker.js.map new file mode 100644 index 0000000000..3f728da886 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/forge-maker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"forge-maker.js","sourceRoot":"","sources":["../src/forge-maker.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAC5B,mCAA+B;AAO/B,SAAgB,UAAU,CAAC,YAA0B,EAAE,OAAwB;IAC7E,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAA;IAC/B,OAAO,aAAK,CAAC;QACX,WAAW,EAAE,MAAM;QACnB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,4FAA4F;gBAC5F,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC;aAC3C;SACF;QACD,GAAG,OAAO;KACX,CAAC,CAAA;AACJ,CAAC;AAZD,gCAYC","sourcesContent":["import * as path from \"path\"\nimport { build } from \"./index\"\nimport { PackagerOptions } from \"./packagerApi\"\n\nexport interface ForgeOptions {\n readonly dir: string\n}\n\nexport function buildForge(forgeOptions: ForgeOptions, options: PackagerOptions) {\n const appDir = forgeOptions.dir\n return build({\n prepackaged: appDir,\n config: {\n directories: {\n // https://github.com/electron-userland/electron-forge/blob/master/src/makers/generic/zip.js\n output: path.resolve(appDir, \"..\", \"make\"),\n },\n },\n ...options,\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.d.ts b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.d.ts new file mode 100644 index 0000000000..22a99d6494 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.d.ts @@ -0,0 +1,21 @@ +import { AfterPackContext } from "../configuration"; +import { Platform } from "../core"; +import { Framework, PrepareApplicationStageDirectoryOptions } from "../Framework"; +export declare class LibUiFramework implements Framework { + readonly version: string; + readonly distMacOsAppName: string; + protected readonly isUseLaunchUi: boolean; + readonly name: string; + readonly macOsDefaultTargets: string[]; + readonly defaultAppIdPrefix: string; + readonly isCopyElevateHelper = false; + readonly isNpmRebuildRequired = false; + constructor(version: string, distMacOsAppName: string, isUseLaunchUi: boolean); + prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise; + private prepareMacosApplicationStageDirectory; + private prepareLinuxApplicationStageDirectory; + afterPack(context: AfterPackContext): Promise; + getMainFile(platform: Platform): string | null; + private isUseLaunchUiForPlatform; + getExcludedDependencies(platform: Platform): Array | null; +} diff --git a/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js new file mode 100644 index 0000000000..15fd8e3974 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LibUiFramework = void 0; +const fs_extra_1 = require("fs-extra"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const builder_util_1 = require("builder-util"); +const core_1 = require("../core"); +const appBuilder_1 = require("../util/appBuilder"); +class LibUiFramework { + constructor(version, distMacOsAppName, isUseLaunchUi) { + this.version = version; + this.distMacOsAppName = distMacOsAppName; + this.isUseLaunchUi = isUseLaunchUi; + this.name = "libui"; + // noinspection JSUnusedGlobalSymbols + this.macOsDefaultTargets = ["dmg"]; + this.defaultAppIdPrefix = "com.libui."; + // noinspection JSUnusedGlobalSymbols + this.isCopyElevateHelper = false; + // noinspection JSUnusedGlobalSymbols + this.isNpmRebuildRequired = false; + } + async prepareApplicationStageDirectory(options) { + await fs_extra_1.emptyDir(options.appOutDir); + const packager = options.packager; + const platform = packager.platform; + if (this.isUseLaunchUiForPlatform(platform)) { + const appOutDir = options.appOutDir; + await builder_util_1.executeAppBuilder([ + "proton-native", + "--node-version", + this.version, + "--use-launch-ui", + "--platform", + platform.nodeName, + "--arch", + options.arch, + "--stage", + appOutDir, + "--executable", + `${packager.appInfo.productFilename}${platform === core_1.Platform.WINDOWS ? ".exe" : ""}`, + ]); + return; + } + if (platform === core_1.Platform.MAC) { + await this.prepareMacosApplicationStageDirectory(packager, options); + } + else if (platform === core_1.Platform.LINUX) { + await this.prepareLinuxApplicationStageDirectory(options); + } + } + async prepareMacosApplicationStageDirectory(packager, options) { + const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, "Contents"); + await promises_1.mkdir(path.join(appContentsDir, "Resources"), { recursive: true }); + await promises_1.mkdir(path.join(appContentsDir, "MacOS"), { recursive: true }); + await builder_util_1.executeAppBuilder(["proton-native", "--node-version", this.version, "--platform", "darwin", "--stage", path.join(appContentsDir, "MacOS")]); + const appPlist = { + // https://github.com/albe-rosado/create-proton-app/issues/13 + NSHighResolutionCapable: true, + }; + await packager.applyCommonInfo(appPlist, appContentsDir); + await Promise.all([ + appBuilder_1.executeAppBuilderAndWriteJson(["encode-plist"], { [path.join(appContentsDir, "Info.plist")]: appPlist }), + writeExecutableMain(path.join(appContentsDir, "MacOS", appPlist.CFBundleExecutable), `#!/bin/sh + DIR=$(dirname "$0") + "$DIR/node" "$DIR/../Resources/app/${options.packager.info.metadata.main || "index.js"}" + `), + ]); + } + async prepareLinuxApplicationStageDirectory(options) { + const appOutDir = options.appOutDir; + await builder_util_1.executeAppBuilder(["proton-native", "--node-version", this.version, "--platform", "linux", "--arch", options.arch, "--stage", appOutDir]); + const mainPath = path.join(appOutDir, options.packager.executableName); + await writeExecutableMain(mainPath, `#!/bin/sh + DIR=$(dirname "$0") + "$DIR/node" "$DIR/app/${options.packager.info.metadata.main || "index.js"}" + `); + } + async afterPack(context) { + const packager = context.packager; + if (!this.isUseLaunchUiForPlatform(packager.platform)) { + return; + } + // LaunchUI requires main.js, rename if need + const userMain = packager.info.metadata.main || "index.js"; + if (userMain === "main.js") { + return; + } + await promises_1.rename(path.join(context.appOutDir, "app", userMain), path.join(context.appOutDir, "app", "main.js")); + } + getMainFile(platform) { + return this.isUseLaunchUiForPlatform(platform) ? "main.js" : null; + } + isUseLaunchUiForPlatform(platform) { + return platform === core_1.Platform.WINDOWS || (this.isUseLaunchUi && platform === core_1.Platform.LINUX); + } + getExcludedDependencies(platform) { + // part of launchui + return this.isUseLaunchUiForPlatform(platform) ? ["libui-node"] : null; + } +} +exports.LibUiFramework = LibUiFramework; +async function writeExecutableMain(file, content) { + await promises_1.writeFile(file, content, { mode: 0o755 }); + await promises_1.chmod(file, 0o755); +} +//# sourceMappingURL=LibUiFramework.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js.map b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js.map new file mode 100644 index 0000000000..86cd9d187d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/frameworks/LibUiFramework.js.map @@ -0,0 +1 @@ +{"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AC,CAAA;IAC7G,CAAC;IAED,WAAW,CAAC,QAAkB;QAC5B,OAAO,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;IACnE,CAAC;IAEO,wBAAwB,CAAC,QAAkB;QACjD,OAAO,QAAQ,KAAK,eAAQ,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,QAAQ,KAAK,eAAQ,CAAC,KAAK,CAAC,CAAA;IAC7F,CAAC;IAED,uBAAuB,CAAC,QAAkB;QACxC,mBAAmB;QACnB,OAAO,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACxE,CAAC;CACF;AA9GD,wCA8GC;AAED,KAAK,UAAU,mBAAmB,CAAC,IAAY,EAAE,OAAe;IAC9D,MAAM,oBAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC/C,MAAM,gBAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC","sourcesContent":["import { emptyDir } from \"fs-extra\"\nimport { mkdir, chmod, rename, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { executeAppBuilder } from \"builder-util\"\nimport { AfterPackContext } from \"../configuration\"\nimport { Platform } from \"../core\"\nimport { Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport MacPackager from \"../macPackager\"\nimport { executeAppBuilderAndWriteJson } from \"../util/appBuilder\"\n\nexport class LibUiFramework implements Framework {\n readonly name: string = \"libui\"\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"dmg\"]\n\n readonly defaultAppIdPrefix: string = \"com.libui.\"\n\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = false\n\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = false\n\n constructor(readonly version: string, readonly distMacOsAppName: string, protected readonly isUseLaunchUi: boolean) {}\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await emptyDir(options.appOutDir)\n\n const packager = options.packager\n const platform = packager.platform\n\n if (this.isUseLaunchUiForPlatform(platform)) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\n \"proton-native\",\n \"--node-version\",\n this.version,\n \"--use-launch-ui\",\n \"--platform\",\n platform.nodeName,\n \"--arch\",\n options.arch,\n \"--stage\",\n appOutDir,\n \"--executable\",\n `${packager.appInfo.productFilename}${platform === Platform.WINDOWS ? \".exe\" : \"\"}`,\n ])\n return\n }\n\n if (platform === Platform.MAC) {\n await this.prepareMacosApplicationStageDirectory(packager as MacPackager, options)\n } else if (platform === Platform.LINUX) {\n await this.prepareLinuxApplicationStageDirectory(options)\n }\n }\n\n private async prepareMacosApplicationStageDirectory(packager: MacPackager, options: PrepareApplicationStageDirectoryOptions) {\n const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, \"Contents\")\n await mkdir(path.join(appContentsDir, \"Resources\"), { recursive: true })\n await mkdir(path.join(appContentsDir, \"MacOS\"), { recursive: true })\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"darwin\", \"--stage\", path.join(appContentsDir, \"MacOS\")])\n\n const appPlist: any = {\n // https://github.com/albe-rosado/create-proton-app/issues/13\n NSHighResolutionCapable: true,\n }\n await packager.applyCommonInfo(appPlist, appContentsDir)\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], { [path.join(appContentsDir, \"Info.plist\")]: appPlist }),\n writeExecutableMain(\n path.join(appContentsDir, \"MacOS\", appPlist.CFBundleExecutable),\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/../Resources/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `\n ),\n ])\n }\n\n private async prepareLinuxApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"linux\", \"--arch\", options.arch, \"--stage\", appOutDir])\n const mainPath = path.join(appOutDir, (options.packager as LinuxPackager).executableName)\n await writeExecutableMain(\n mainPath,\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `\n )\n }\n\n async afterPack(context: AfterPackContext) {\n const packager = context.packager\n if (!this.isUseLaunchUiForPlatform(packager.platform)) {\n return\n }\n\n // LaunchUI requires main.js, rename if need\n const userMain = packager.info.metadata.main || \"index.js\"\n if (userMain === \"main.js\") {\n return\n }\n\n await rename(path.join(context.appOutDir, \"app\", userMain), path.join(context.appOutDir, \"app\", \"main.js\"))\n }\n\n getMainFile(platform: Platform): string | null {\n return this.isUseLaunchUiForPlatform(platform) ? \"main.js\" : null\n }\n\n private isUseLaunchUiForPlatform(platform: Platform) {\n return platform === Platform.WINDOWS || (this.isUseLaunchUi && platform === Platform.LINUX)\n }\n\n getExcludedDependencies(platform: Platform): Array | null {\n // part of launchui\n return this.isUseLaunchUiForPlatform(platform) ? [\"libui-node\"] : null\n }\n}\n\nasync function writeExecutableMain(file: string, content: string) {\n await writeFile(file, content, { mode: 0o755 })\n await chmod(file, 0o755)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/index.d.ts b/client/node_modules/app-builder-lib/out/index.d.ts new file mode 100644 index 0000000000..a3eb83915e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/index.d.ts @@ -0,0 +1,32 @@ +import { PublishOptions } from "electron-publish/out/publisher"; +import { Packager } from "./packager"; +import { PackagerOptions } from "./packagerApi"; +export { Packager, BuildResult } from "./packager"; +export { PackagerOptions, ArtifactCreated, ArtifactBuildStarted } from "./packagerApi"; +export { TargetConfiguration, Platform, Target, DIR_TARGET, BeforeBuildContext, SourceRepositoryInfo, TargetSpecificOptions, TargetConfigType, DEFAULT_TARGET, CompressionLevel, } from "./core"; +export { getArchSuffix, Arch, archFromString } from "builder-util"; +export { Configuration, AfterPackContext, MetadataDirectories } from "./configuration"; +export { ElectronBrandingOptions, ElectronDownloadOptions, ElectronPlatformName } from "./electron/ElectronFramework"; +export { PlatformSpecificBuildOptions, AsarOptions, FileSet, Protocol, ReleaseInfo } from "./options/PlatformSpecificBuildOptions"; +export { FileAssociation } from "./options/FileAssociation"; +export { MacConfiguration, DmgOptions, MasConfiguration, MacOsTargetName, DmgContent, DmgWindow } from "./options/macOptions"; +export { PkgOptions, PkgBackgroundOptions, BackgroundAlignment, BackgroundScaling } from "./options/pkgOptions"; +export { WindowsConfiguration } from "./options/winOptions"; +export { AppXOptions } from "./options/AppXOptions"; +export { MsiOptions } from "./options/MsiOptions"; +export { CommonWindowsInstallerConfiguration } from "./options/CommonWindowsInstallerConfiguration"; +export { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions } from "./targets/nsis/nsisOptions"; +export { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions, FlatpakOptions } from "./options/linuxOptions"; +export { SnapOptions } from "./options/SnapOptions"; +export { Metadata, AuthorMetadata, RepositoryInfo } from "./options/metadata"; +export { AppInfo } from "./appInfo"; +export { SquirrelWindowsOptions } from "./options/SquirrelWindowsOptions"; +export { WindowsSignOptions, CustomWindowsSignTaskConfiguration, WindowsSignTaskConfiguration, CustomWindowsSign, FileCodeSigningInfo, CertificateFromStoreInfo, } from "./codeSign/windowsCodeSign"; +export { CancellationToken, ProgressInfo } from "builder-util-runtime"; +export { PublishOptions, UploadTask } from "electron-publish"; +export { PublishManager } from "./publish/PublishManager"; +export { PlatformPackager } from "./platformPackager"; +export { Framework, PrepareApplicationStageDirectoryOptions } from "./Framework"; +export { buildForge, ForgeOptions } from "./forge-maker"; +export declare function checkBuildRequestOptions(options: PackagerOptions & PublishOptions): void; +export declare function build(options: PackagerOptions & PublishOptions, packager?: Packager): Promise>; diff --git a/client/node_modules/app-builder-lib/out/index.js b/client/node_modules/app-builder-lib/out/index.js new file mode 100644 index 0000000000..18003b5bbd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/index.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.build = exports.checkBuildRequestOptions = exports.buildForge = exports.PlatformPackager = exports.PublishManager = exports.CancellationToken = exports.AppInfo = exports.archFromString = exports.Arch = exports.getArchSuffix = exports.DEFAULT_TARGET = exports.DIR_TARGET = exports.Target = exports.Platform = exports.Packager = void 0; +const promise_1 = require("builder-util/out/promise"); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const packager_1 = require("./packager"); +const platformPackager_1 = require("./platformPackager"); +const PublishManager_1 = require("./publish/PublishManager"); +var packager_2 = require("./packager"); +Object.defineProperty(exports, "Packager", { enumerable: true, get: function () { return packager_2.Packager; } }); +var core_1 = require("./core"); +Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return core_1.Platform; } }); +Object.defineProperty(exports, "Target", { enumerable: true, get: function () { return core_1.Target; } }); +Object.defineProperty(exports, "DIR_TARGET", { enumerable: true, get: function () { return core_1.DIR_TARGET; } }); +Object.defineProperty(exports, "DEFAULT_TARGET", { enumerable: true, get: function () { return core_1.DEFAULT_TARGET; } }); +var builder_util_2 = require("builder-util"); +Object.defineProperty(exports, "getArchSuffix", { enumerable: true, get: function () { return builder_util_2.getArchSuffix; } }); +Object.defineProperty(exports, "Arch", { enumerable: true, get: function () { return builder_util_2.Arch; } }); +Object.defineProperty(exports, "archFromString", { enumerable: true, get: function () { return builder_util_2.archFromString; } }); +var appInfo_1 = require("./appInfo"); +Object.defineProperty(exports, "AppInfo", { enumerable: true, get: function () { return appInfo_1.AppInfo; } }); +var builder_util_runtime_2 = require("builder-util-runtime"); +Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return builder_util_runtime_2.CancellationToken; } }); +var PublishManager_2 = require("./publish/PublishManager"); +Object.defineProperty(exports, "PublishManager", { enumerable: true, get: function () { return PublishManager_2.PublishManager; } }); +var platformPackager_2 = require("./platformPackager"); +Object.defineProperty(exports, "PlatformPackager", { enumerable: true, get: function () { return platformPackager_2.PlatformPackager; } }); +var forge_maker_1 = require("./forge-maker"); +Object.defineProperty(exports, "buildForge", { enumerable: true, get: function () { return forge_maker_1.buildForge; } }); +const expectedOptions = new Set(["publish", "targets", "mac", "win", "linux", "projectDir", "platformPackagerFactory", "config", "effectiveOptionComputed", "prepackaged"]); +function checkBuildRequestOptions(options) { + for (const optionName of Object.keys(options)) { + if (!expectedOptions.has(optionName) && options[optionName] !== undefined) { + throw new builder_util_1.InvalidConfigurationError(`Unknown option "${optionName}"`); + } + } +} +exports.checkBuildRequestOptions = checkBuildRequestOptions; +function build(options, packager = new packager_1.Packager(options)) { + checkBuildRequestOptions(options); + const publishManager = new PublishManager_1.PublishManager(packager, options); + const sigIntHandler = () => { + builder_util_1.log.warn("cancelled by SIGINT"); + packager.cancellationToken.cancel(); + publishManager.cancelTasks(); + }; + process.once("SIGINT", sigIntHandler); + const promise = packager.build().then(async (buildResult) => { + const afterAllArtifactBuild = platformPackager_1.resolveFunction(buildResult.configuration.afterAllArtifactBuild, "afterAllArtifactBuild"); + if (afterAllArtifactBuild != null) { + const newArtifacts = builder_util_runtime_1.asArray(await Promise.resolve(afterAllArtifactBuild(buildResult))); + if (newArtifacts.length === 0 || !publishManager.isPublish) { + return buildResult.artifactPaths; + } + const publishConfigurations = await publishManager.getGlobalPublishConfigurations(); + if (publishConfigurations == null || publishConfigurations.length === 0) { + return buildResult.artifactPaths; + } + for (const newArtifact of newArtifacts) { + buildResult.artifactPaths.push(newArtifact); + for (const publishConfiguration of publishConfigurations) { + publishManager.scheduleUpload(publishConfiguration, { + file: newArtifact, + arch: null, + }, packager.appInfo); + } + } + } + return buildResult.artifactPaths; + }); + return promise_1.executeFinally(promise, isErrorOccurred => { + let promise; + if (isErrorOccurred) { + publishManager.cancelTasks(); + promise = Promise.resolve(null); + } + else { + promise = publishManager.awaitTasks(); + } + return promise.then(() => process.removeListener("SIGINT", sigIntHandler)); + }); +} +exports.build = build; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/index.js.map b/client/node_modules/app-builder-lib/out/index.js.map new file mode 100644 index 0000000000..f9f83c6532 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAAyD;AAEzD,+CAA6D;AAC7D,+DAA8C;AAC9C,yCAAqC;AAErC,yDAAoD;AACpD,6DAAyD;AAEzD,uCAAkD;AAAzC,oGAAA,QAAQ,OAAA;AAEjB,+BAWe;AATb,gGAAA,QAAQ,OAAA;AACR,8FAAA,MAAM,OAAA;AACN,kGAAA,UAAU,OAAA;AAKV,sGAAA,cAAc,OAAA;AAGhB,6CAAkE;AAAzD,6GAAA,aAAa,OAAA;AAAE,oGAAA,IAAI,OAAA;AAAE,8GAAA,cAAc,OAAA;AAe5C,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAUhB,6DAAsE;AAA7D,yHAAA,iBAAiB,OAAA;AAE1B,2DAAyD;AAAhD,gHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,oHAAA,gBAAgB,OAAA;AAEzB,6CAAwD;AAA/C,yGAAA,UAAU,OAAA;AAEnB,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,QAAQ,EAAE,yBAAyB,EAAE,aAAa,CAAC,CAAC,CAAA;AAE3K,SAAgB,wBAAwB,CAAC,OAAyC;IAChF,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7C,IAAI,CA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,CAAC,EAAE;gBACvE,OAAO,WAAW,CAAC,aAAa,CAAA;aACjC;YAED,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;gBACtC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;gBAC3C,KAAK,MAAM,oBAAoB,IAAI,qBAAqB,EAAE;oBACxD,cAAc,CAAC,cAAc,CAC3B,oBAAoB,EACpB;wBACE,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,IAAI;qBACX,EACD,QAAQ,CAAC,OAAO,CACjB,CAAA;iBACF;aACF;SACF;QACD,OAAO,WAAW,CAAC,aAAa,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,OAAO,wBAAc,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE;QAC/C,IAAI,OAAqB,CAAA;QACzB,IAAI,eAAe,EAAE;YACnB,cAAc,CAAC,WAAW,EAAE,CAAA;YAC5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SAChC;aAAM;YACL,OAAO,GAAG,cAAc,CAAC,UAAU,EAAE,CAAA;SACtC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;AACJ,CAAC;AApDD,sBAoDC","sourcesContent":["import { executeFinally } from \"builder-util/out/promise\"\nimport { PublishOptions } from \"electron-publish/out/publisher\"\nimport { log, InvalidConfigurationError } from \"builder-util\"\nimport { asArray } from \"builder-util-runtime\"\nimport { Packager } from \"./packager\"\nimport { PackagerOptions } from \"./packagerApi\"\nimport { resolveFunction } from \"./platformPackager\"\nimport { PublishManager } from \"./publish/PublishManager\"\n\nexport { Packager, BuildResult } from \"./packager\"\nexport { PackagerOptions, ArtifactCreated, ArtifactBuildStarted } from \"./packagerApi\"\nexport {\n TargetConfiguration,\n Platform,\n Target,\n DIR_TARGET,\n BeforeBuildContext,\n SourceRepositoryInfo,\n TargetSpecificOptions,\n TargetConfigType,\n DEFAULT_TARGET,\n CompressionLevel,\n} from \"./core\"\nexport { getArchSuffix, Arch, archFromString } from \"builder-util\"\nexport { Configuration, AfterPackContext, MetadataDirectories } from \"./configuration\"\nexport { ElectronBrandingOptions, ElectronDownloadOptions, ElectronPlatformName } from \"./electron/ElectronFramework\"\nexport { PlatformSpecificBuildOptions, AsarOptions, FileSet, Protocol, ReleaseInfo } from \"./options/PlatformSpecificBuildOptions\"\nexport { FileAssociation } from \"./options/FileAssociation\"\nexport { MacConfiguration, DmgOptions, MasConfiguration, MacOsTargetName, DmgContent, DmgWindow } from \"./options/macOptions\"\nexport { PkgOptions, PkgBackgroundOptions, BackgroundAlignment, BackgroundScaling } from \"./options/pkgOptions\"\nexport { WindowsConfiguration } from \"./options/winOptions\"\nexport { AppXOptions } from \"./options/AppXOptions\"\nexport { MsiOptions } from \"./options/MsiOptions\"\nexport { CommonWindowsInstallerConfiguration } from \"./options/CommonWindowsInstallerConfiguration\"\nexport { NsisOptions, NsisWebOptions, PortableOptions, CommonNsisOptions } from \"./targets/nsis/nsisOptions\"\nexport { LinuxConfiguration, DebOptions, CommonLinuxOptions, LinuxTargetSpecificOptions, AppImageOptions, FlatpakOptions } from \"./options/linuxOptions\"\nexport { SnapOptions } from \"./options/SnapOptions\"\nexport { Metadata, AuthorMetadata, RepositoryInfo } from \"./options/metadata\"\nexport { AppInfo } from \"./appInfo\"\nexport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nexport {\n WindowsSignOptions,\n CustomWindowsSignTaskConfiguration,\n WindowsSignTaskConfiguration,\n CustomWindowsSign,\n FileCodeSigningInfo,\n CertificateFromStoreInfo,\n} from \"./codeSign/windowsCodeSign\"\nexport { CancellationToken, ProgressInfo } from \"builder-util-runtime\"\nexport { PublishOptions, UploadTask } from \"electron-publish\"\nexport { PublishManager } from \"./publish/PublishManager\"\nexport { PlatformPackager } from \"./platformPackager\"\nexport { Framework, PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nexport { buildForge, ForgeOptions } from \"./forge-maker\"\n\nconst expectedOptions = new Set([\"publish\", \"targets\", \"mac\", \"win\", \"linux\", \"projectDir\", \"platformPackagerFactory\", \"config\", \"effectiveOptionComputed\", \"prepackaged\"])\n\nexport function checkBuildRequestOptions(options: PackagerOptions & PublishOptions) {\n for (const optionName of Object.keys(options)) {\n if (!expectedOptions.has(optionName) && (options as any)[optionName] !== undefined) {\n throw new InvalidConfigurationError(`Unknown option \"${optionName}\"`)\n }\n }\n}\n\nexport function build(options: PackagerOptions & PublishOptions, packager: Packager = new Packager(options)): Promise> {\n checkBuildRequestOptions(options)\n\n const publishManager = new PublishManager(packager, options)\n const sigIntHandler = () => {\n log.warn(\"cancelled by SIGINT\")\n packager.cancellationToken.cancel()\n publishManager.cancelTasks()\n }\n process.once(\"SIGINT\", sigIntHandler)\n\n const promise = packager.build().then(async buildResult => {\n const afterAllArtifactBuild = resolveFunction(buildResult.configuration.afterAllArtifactBuild, \"afterAllArtifactBuild\")\n if (afterAllArtifactBuild != null) {\n const newArtifacts = asArray(await Promise.resolve(afterAllArtifactBuild(buildResult)))\n if (newArtifacts.length === 0 || !publishManager.isPublish) {\n return buildResult.artifactPaths\n }\n\n const publishConfigurations = await publishManager.getGlobalPublishConfigurations()\n if (publishConfigurations == null || publishConfigurations.length === 0) {\n return buildResult.artifactPaths\n }\n\n for (const newArtifact of newArtifacts) {\n buildResult.artifactPaths.push(newArtifact)\n for (const publishConfiguration of publishConfigurations) {\n publishManager.scheduleUpload(\n publishConfiguration,\n {\n file: newArtifact,\n arch: null,\n },\n packager.appInfo\n )\n }\n }\n }\n return buildResult.artifactPaths\n })\n\n return executeFinally(promise, isErrorOccurred => {\n let promise: Promise\n if (isErrorOccurred) {\n publishManager.cancelTasks()\n promise = Promise.resolve(null)\n } else {\n promise = publishManager.awaitTasks()\n }\n\n return promise.then(() => process.removeListener(\"SIGINT\", sigIntHandler))\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/linuxPackager.d.ts b/client/node_modules/app-builder-lib/out/linuxPackager.d.ts new file mode 100644 index 0000000000..ff2ebbfd95 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/linuxPackager.d.ts @@ -0,0 +1,12 @@ +import { Arch } from "builder-util"; +import { Target } from "./core"; +import { LinuxConfiguration } from "./options/linuxOptions"; +import { Packager } from "./packager"; +import { PlatformPackager } from "./platformPackager"; +export declare class LinuxPackager extends PlatformPackager { + readonly executableName: string; + constructor(info: Packager); + get defaultTarget(): Array; + createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void; +} +export declare function toAppImageOrSnapArch(arch: Arch): string; diff --git a/client/node_modules/app-builder-lib/out/linuxPackager.js b/client/node_modules/app-builder-lib/out/linuxPackager.js new file mode 100644 index 0000000000..f0d0e7a5da --- /dev/null +++ b/client/node_modules/app-builder-lib/out/linuxPackager.js @@ -0,0 +1,114 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toAppImageOrSnapArch = exports.LinuxPackager = void 0; +const builder_util_1 = require("builder-util"); +const core_1 = require("./core"); +const platformPackager_1 = require("./platformPackager"); +const RemoteBuilder_1 = require("./remoteBuilder/RemoteBuilder"); +const LinuxTargetHelper_1 = require("./targets/LinuxTargetHelper"); +const targetFactory_1 = require("./targets/targetFactory"); +const filename_1 = require("./util/filename"); +class LinuxPackager extends platformPackager_1.PlatformPackager { + constructor(info) { + super(info, core_1.Platform.LINUX); + const executableName = this.platformSpecificBuildOptions.executableName; + this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : filename_1.sanitizeFileName(executableName); + } + get defaultTarget() { + return ["snap", "appimage"]; + } + createTargets(targets, mapper) { + let helper; + const getHelper = () => { + if (helper == null) { + helper = new LinuxTargetHelper_1.LinuxTargetHelper(this); + } + return helper; + }; + let remoteBuilder = null; + for (const name of targets) { + if (name === core_1.DIR_TARGET) { + continue; + } + const targetClass = (() => { + switch (name) { + case "appimage": + return require("./targets/AppImageTarget").default; + case "snap": + return require("./targets/snap").default; + case "flatpak": + return require("./targets/FlatpakTarget").default; + case "deb": + case "rpm": + case "sh": + case "freebsd": + case "pacman": + case "apk": + case "p5p": + return require("./targets/fpm").default; + default: + return null; + } + })(); + mapper(name, outDir => { + if (targetClass === null) { + return targetFactory_1.createCommonTarget(name, outDir, this); + } + const target = new targetClass(name, this, getHelper(), outDir); + if (process.platform === "win32" || process.env._REMOTE_BUILD) { + if (remoteBuilder == null) { + remoteBuilder = new RemoteBuilder_1.RemoteBuilder(this); + } + // return remoteBuilder.buildTarget(this, arch, appOutDir, this.packager) + return new RemoteTarget(target, remoteBuilder); + } + return target; + }); + } + } +} +exports.LinuxPackager = LinuxPackager; +class RemoteTarget extends core_1.Target { + constructor(target, remoteBuilder) { + super(target.name, true /* all must be scheduled in time (so, on finishBuild RemoteBuilder will have all targets added - so, we must set isAsyncSupported to true (resolved promise is returned)) */); + this.target = target; + this.remoteBuilder = remoteBuilder; + this.buildTaskManager = new builder_util_1.AsyncTaskManager(this.remoteBuilder.packager.info.cancellationToken); + } + get options() { + return this.target.options; + } + get outDir() { + return this.target.outDir; + } + async finishBuild() { + await this.buildTaskManager.awaitTasks(); + await this.remoteBuilder.build(); + } + build(appOutDir, arch) { + const promise = this.doBuild(appOutDir, arch); + this.buildTaskManager.addTask(promise); + return promise; + } + async doBuild(appOutDir, arch) { + builder_util_1.log.info({ target: this.target.name, arch: builder_util_1.Arch[arch] }, "scheduling remote build"); + await this.target.checkOptions(); + this.remoteBuilder.scheduleBuild(this.target, arch, appOutDir); + } +} +function toAppImageOrSnapArch(arch) { + switch (arch) { + case builder_util_1.Arch.x64: + return "x86_64"; + case builder_util_1.Arch.ia32: + return "i386"; + case builder_util_1.Arch.armv7l: + return "arm"; + case builder_util_1.Arch.arm64: + return "arm_aarch64"; + default: + throw new Error(`Unsupported arch ${arch}`); + } +} +exports.toAppImageOrSnapArch = toAppImageOrSnapArch; +//# sourceMappingURL=linuxPackager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/linuxPackager.js.map b/client/node_modules/app-builder-lib/out/linuxPackager.js.map new file mode 100644 index 0000000000..e7e7a03e7e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/linuxPackager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"linuxPackager.js","sourceRoot":"","sources":["../src/linuxPackager.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAC1D,iCAA4E;AAG5E,yDAAqD;AACrD,iEAA6D;AAI7D,mEAA+D;AAE/D,2DAA4D;AAC5D,8CAAkD;AAElD,MAAa,aAAc,SAAQ,mCAAoC;IAGrE,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,EAAE,eAAQ,CAAC,KAAK,CAAC,CAAA;QAE3B,MAAM,cAAc,GAAG,IAAI,CAAC,4BAA4B,CAAC,cAAc,CAAA;QACvE,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,2BAAgB,CAAC,cAAc,CAAC,CAAA;IAC5H,CAAC;IAED,IAAI,aAAa;QACf,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC7B,CAAC;IAED,aAAa,CAAC,OAAsB,EAAE,MAAmE;QACvG,IAAI,MAAgC,CAAA;QACpC,MAAM,SAAS,GAAG,GAAG,EAAE;YACrB,IAAI,MAAM,IAAI,IAAI,EAAE;gBAClB,MAAM,GAAG,IAAI,qCAAiB,CAAC,IAAI,CAAC,CAAA;aACrC;YACD,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;QAED,IAAI,aAAa,GAAyB,IAAI,CAAA;QAE9C,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YAC1B,IAAI,IAAI,KAAK,iBAAU,EAAE;gBACvB,SAAQ;aACT;YAED,MAAM,WAAW,GAA+F,CAAC,GAAG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AC,GAAG;YACX,OAAO,QAAQ,CAAA;QACjB,KAAK,mBAAI,CAAC,IAAI;YACZ,OAAO,MAAM,CAAA;QACf,KAAK,mBAAI,CAAC,MAAM;YACd,OAAO,KAAK,CAAA;QACd,KAAK,mBAAI,CAAC,KAAK;YACb,OAAO,aAAa,CAAA;QAEtB;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAA;KAC9C;AACH,CAAC;AAdD,oDAcC","sourcesContent":["import { Arch, AsyncTaskManager, log } from \"builder-util\"\nimport { DIR_TARGET, Platform, Target, TargetSpecificOptions } from \"./core\"\nimport { LinuxConfiguration } from \"./options/linuxOptions\"\nimport { Packager } from \"./packager\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { RemoteBuilder } from \"./remoteBuilder/RemoteBuilder\"\nimport AppImageTarget from \"./targets/AppImageTarget\"\nimport FlatpakTarget from \"./targets/FlatpakTarget\"\nimport FpmTarget from \"./targets/fpm\"\nimport { LinuxTargetHelper } from \"./targets/LinuxTargetHelper\"\nimport SnapTarget from \"./targets/snap\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\nimport { sanitizeFileName } from \"./util/filename\"\n\nexport class LinuxPackager extends PlatformPackager {\n readonly executableName: string\n\n constructor(info: Packager) {\n super(info, Platform.LINUX)\n\n const executableName = this.platformSpecificBuildOptions.executableName\n this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : sanitizeFileName(executableName)\n }\n\n get defaultTarget(): Array {\n return [\"snap\", \"appimage\"]\n }\n\n createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let helper: LinuxTargetHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new LinuxTargetHelper(this)\n }\n return helper\n }\n\n let remoteBuilder: RemoteBuilder | null = null\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n const targetClass: typeof AppImageTarget | typeof SnapTarget | typeof FlatpakTarget | typeof FpmTarget | null = (() => {\n switch (name) {\n case \"appimage\":\n return require(\"./targets/AppImageTarget\").default\n case \"snap\":\n return require(\"./targets/snap\").default\n case \"flatpak\":\n return require(\"./targets/FlatpakTarget\").default\n case \"deb\":\n case \"rpm\":\n case \"sh\":\n case \"freebsd\":\n case \"pacman\":\n case \"apk\":\n case \"p5p\":\n return require(\"./targets/fpm\").default\n default:\n return null\n }\n })()\n\n mapper(name, outDir => {\n if (targetClass === null) {\n return createCommonTarget(name, outDir, this)\n }\n\n const target = new targetClass(name, this, getHelper(), outDir)\n if (process.platform === \"win32\" || process.env._REMOTE_BUILD) {\n if (remoteBuilder == null) {\n remoteBuilder = new RemoteBuilder(this)\n }\n // return remoteBuilder.buildTarget(this, arch, appOutDir, this.packager)\n return new RemoteTarget(target, remoteBuilder)\n }\n return target\n })\n }\n }\n}\n\nclass RemoteTarget extends Target {\n private buildTaskManager = new AsyncTaskManager(this.remoteBuilder.packager.info.cancellationToken)\n\n get options(): TargetSpecificOptions | null | undefined {\n return this.target.options\n }\n\n get outDir(): string {\n return this.target.outDir\n }\n\n constructor(private readonly target: Target, private readonly remoteBuilder: RemoteBuilder) {\n super(\n target.name,\n true /* all must be scheduled in time (so, on finishBuild RemoteBuilder will have all targets added - so, we must set isAsyncSupported to true (resolved promise is returned)) */\n )\n }\n\n async finishBuild() {\n await this.buildTaskManager.awaitTasks()\n await this.remoteBuilder.build()\n }\n\n build(appOutDir: string, arch: Arch) {\n const promise = this.doBuild(appOutDir, arch)\n this.buildTaskManager.addTask(promise)\n return promise\n }\n\n private async doBuild(appOutDir: string, arch: Arch) {\n log.info({ target: this.target.name, arch: Arch[arch] }, \"scheduling remote build\")\n await this.target.checkOptions()\n this.remoteBuilder.scheduleBuild(this.target, arch, appOutDir)\n }\n}\n\nexport function toAppImageOrSnapArch(arch: Arch): string {\n switch (arch) {\n case Arch.x64:\n return \"x86_64\"\n case Arch.ia32:\n return \"i386\"\n case Arch.armv7l:\n return \"arm\"\n case Arch.arm64:\n return \"arm_aarch64\"\n\n default:\n throw new Error(`Unsupported arch ${arch}`)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/macPackager.d.ts b/client/node_modules/app-builder-lib/out/macPackager.d.ts new file mode 100644 index 0000000000..d5143f488e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/macPackager.d.ts @@ -0,0 +1,29 @@ +import { Arch, AsyncTaskManager } from "builder-util"; +import { SignOptions } from "electron-osx-sign"; +import { Lazy } from "lazy-val"; +import { AppInfo } from "./appInfo"; +import { CodeSigningInfo, Identity } from "./codeSign/macCodeSign"; +import { Target } from "./core"; +import { AfterPackContext, ElectronPlatformName } from "./index"; +import { MacConfiguration } from "./options/macOptions"; +import { Packager } from "./packager"; +import { PlatformPackager } from "./platformPackager"; +export default class MacPackager extends PlatformPackager { + readonly codeSigningInfo: Lazy; + private _iconPath; + constructor(info: Packager); + get defaultTarget(): Array; + protected prepareAppInfo(appInfo: AppInfo): AppInfo; + getIconPath(): Promise; + createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void; + protected doPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: MacConfiguration, targets: Array): Promise; + pack(outDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): Promise; + private sign; + private adjustSignOptions; + protected doSign(opts: SignOptions): Promise; + protected doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise; + getElectronSrcDir(dist: string): string; + getElectronDestinationDir(appOutDir: string): string; + applyCommonInfo(appPlist: any, contentsPath: string): Promise; + protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/macPackager.js b/client/node_modules/app-builder-lib/out/macPackager.js new file mode 100644 index 0000000000..a8b13003d6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/macPackager.js @@ -0,0 +1,399 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const electron_osx_sign_1 = require("electron-osx-sign"); +const promises_1 = require("fs/promises"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const fs_1 = require("builder-util/out/fs"); +const promise_1 = require("builder-util/out/promise"); +const appInfo_1 = require("./appInfo"); +const macCodeSign_1 = require("./codeSign/macCodeSign"); +const core_1 = require("./core"); +const platformPackager_1 = require("./platformPackager"); +const ArchiveTarget_1 = require("./targets/ArchiveTarget"); +const pkg_1 = require("./targets/pkg"); +const targetFactory_1 = require("./targets/targetFactory"); +const macosVersion_1 = require("./util/macosVersion"); +const pathManager_1 = require("./util/pathManager"); +const fs = require("fs/promises"); +class MacPackager extends platformPackager_1.PlatformPackager { + constructor(info) { + super(info, core_1.Platform.MAC); + this.codeSigningInfo = new lazy_val_1.Lazy(() => { + const cscLink = this.getCscLink(); + if (cscLink == null || process.platform !== "darwin") { + return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null }); + } + return macCodeSign_1.createKeychain({ + tmpDir: this.info.tempDirManager, + cscLink, + cscKeyPassword: this.getCscPassword(), + cscILink: platformPackager_1.chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK), + cscIKeyPassword: platformPackager_1.chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD), + currentDir: this.projectDir, + }).then(result => { + const keychainFile = result.keychainFile; + if (keychainFile != null) { + this.info.disposeOnBuildFinish(() => macCodeSign_1.removeKeychain(keychainFile)); + } + return result; + }); + }); + this._iconPath = new lazy_val_1.Lazy(() => this.getOrConvertIcon("icns")); + } + get defaultTarget() { + return this.info.framework.macOsDefaultTargets; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + prepareAppInfo(appInfo) { + return new appInfo_1.AppInfo(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions); + } + async getIconPath() { + return this._iconPath.value; + } + createTargets(targets, mapper) { + for (const name of targets) { + switch (name) { + case core_1.DIR_TARGET: + break; + case "dmg": { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { DmgTarget } = require("dmg-builder"); + mapper(name, outDir => new DmgTarget(this, outDir)); + break; + } + case "zip": + // https://github.com/electron-userland/electron-builder/issues/2313 + mapper(name, outDir => new ArchiveTarget_1.ArchiveTarget(name, outDir, this, true)); + break; + case "pkg": + mapper(name, outDir => new pkg_1.PkgTarget(this, outDir)); + break; + default: + mapper(name, outDir => (name === "mas" || name === "mas-dev" ? new targetFactory_1.NoOpTarget(name) : targetFactory_1.createCommonTarget(name, outDir, this))); + break; + } + } + } + async doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets) { + var _a; + switch (arch) { + default: { + return super.doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets); + } + case builder_util_1.Arch.universal: { + const x64Arch = builder_util_1.Arch.x64; + const x64AppOutDir = appOutDir + "--" + builder_util_1.Arch[x64Arch]; + await super.doPack(outDir, x64AppOutDir, platformName, x64Arch, platformSpecificBuildOptions, targets, false, true); + const arm64Arch = builder_util_1.Arch.arm64; + const arm64AppOutPath = appOutDir + "--" + builder_util_1.Arch[arm64Arch]; + await super.doPack(outDir, arm64AppOutPath, platformName, arm64Arch, platformSpecificBuildOptions, targets, false, true); + const framework = this.info.framework; + builder_util_1.log.info({ + platform: platformName, + arch: builder_util_1.Arch[arch], + [`${framework.name}`]: framework.version, + appOutDir: builder_util_1.log.filePath(appOutDir), + }, `packaging`); + const appFile = `${this.appInfo.productFilename}.app`; + const { makeUniversalApp } = require("@electron/universal"); + await makeUniversalApp({ + x64AppPath: path.join(x64AppOutDir, appFile), + arm64AppPath: path.join(arm64AppOutPath, appFile), + outAppPath: path.join(appOutDir, appFile), + force: true, + mergeASARs: (_a = platformSpecificBuildOptions.mergeASARs) !== null && _a !== void 0 ? _a : true, + singleArchFiles: platformSpecificBuildOptions.singleArchFiles, + x64ArchFiles: platformSpecificBuildOptions.x64ArchFiles, + }); + await fs.rm(x64AppOutDir, { recursive: true, force: true }); + await fs.rm(arm64AppOutPath, { recursive: true, force: true }); + // Give users a final opportunity to perform things on the combined universal package before signing + const packContext = { + appOutDir, + outDir, + arch, + targets, + packager: this, + electronPlatformName: platformName, + }; + await this.info.afterPack(packContext); + await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets); + break; + } + } + } + async pack(outDir, arch, targets, taskManager) { + let nonMasPromise = null; + const hasMas = targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev"); + const prepackaged = this.packagerOptions.prepackaged; + if (!hasMas || targets.length > 1) { + const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged; + nonMasPromise = (prepackaged + ? Promise.resolve() + : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName, arch, this.platformSpecificBuildOptions, targets)).then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager)); + } + for (const target of targets) { + const targetName = target.name; + if (!(targetName === "mas" || targetName === "mas-dev")) { + continue; + } + const masBuildOptions = builder_util_1.deepAssign({}, this.platformSpecificBuildOptions, this.config.mas); + if (targetName === "mas-dev") { + builder_util_1.deepAssign(masBuildOptions, this.config.masDev, { + type: "development", + }); + } + const targetOutDir = path.join(outDir, `${targetName}${builder_util_1.getArchSuffix(arch)}`); + if (prepackaged == null) { + await this.doPack(outDir, targetOutDir, "mas", arch, masBuildOptions, [target]); + await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions, arch); + } + else { + await this.sign(prepackaged, targetOutDir, masBuildOptions, arch); + } + } + if (nonMasPromise != null) { + await nonMasPromise; + } + } + async sign(appPath, outDir, masOptions, arch) { + if (!macCodeSign_1.isSignAllowed()) { + return; + } + const isMas = masOptions != null; + const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions; + const qualifier = options.identity; + if (!isMas && qualifier === null) { + if (this.forceCodeSigning) { + throw new builder_util_1.InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true"); + } + builder_util_1.log.info({ reason: "identity explicitly is set to null" }, "skipped macOS code signing"); + return; + } + const keychainFile = (await this.codeSigningInfo.value).keychainFile; + const explicitType = options.type; + const type = explicitType || "distribution"; + const isDevelopment = type === "development"; + const certificateTypes = getCertificateTypes(isMas, isDevelopment); + let identity = null; + for (const certificateType of certificateTypes) { + identity = await macCodeSign_1.findIdentity(certificateType, qualifier, keychainFile); + if (identity != null) { + break; + } + } + if (identity == null) { + if (!isMas && !isDevelopment && explicitType !== "distribution") { + identity = await macCodeSign_1.findIdentity("Mac Developer", qualifier, keychainFile); + if (identity != null) { + builder_util_1.log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production"); + } + } + if (identity == null) { + await macCodeSign_1.reportError(isMas, certificateTypes, qualifier, keychainFile, this.forceCodeSigning); + return; + } + } + if (!macosVersion_1.isMacOsHighSierra()) { + throw new builder_util_1.InvalidConfigurationError("macOS High Sierra 10.13.6 is required to sign"); + } + let filter = options.signIgnore; + if (Array.isArray(filter)) { + if (filter.length == 0) { + filter = null; + } + } + else if (filter != null) { + filter = filter.length === 0 ? null : [filter]; + } + const filterRe = filter == null ? null : filter.map(it => new RegExp(it)); + let binaries = options.binaries || undefined; + if (binaries) { + // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path. + binaries = await Promise.all(binaries.map(async (destination) => { + if (await fs_1.statOrNull(destination)) { + return destination; + } + return path.resolve(appPath, destination); + })); + builder_util_1.log.info("Signing addtional user-defined binaries: " + JSON.stringify(binaries, null, 1)); + } + const signOptions = { + "identity-validation": false, + // https://github.com/electron-userland/electron-builder/issues/1699 + // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext. + ignore: (file) => { + if (filterRe != null) { + for (const regExp of filterRe) { + if (regExp.test(file)) { + return true; + } + } + } + return (file.endsWith(".kext") || + file.startsWith("/Contents/PlugIns", appPath.length) || + file.includes("/node_modules/puppeteer/.local-chromium") || + file.includes("/node_modules/playwright-firefox/.local-browsers") || + file.includes("/node_modules/playwright/.local-browsers")); + /* Those are browser automating modules, browser (chromium, nightly) cannot be signed + https://github.com/electron-userland/electron-builder/issues/2010 + https://github.com/electron-userland/electron-builder/issues/5383 + */ + }, + identity: identity, + type, + platform: isMas ? "mas" : "darwin", + version: this.config.electronVersion, + app: appPath, + keychain: keychainFile || undefined, + binaries, + timestamp: isMas ? masOptions === null || masOptions === void 0 ? void 0 : masOptions.timestamp : options.timestamp, + requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements), + // https://github.com/electron-userland/electron-osx-sign/issues/196 + // will fail on 10.14.5+ because a signed but unnotarized app is also rejected. + "gatekeeper-assess": options.gatekeeperAssess === true, + // https://github.com/electron-userland/electron-builder/issues/1480 + "strict-verify": options.strictVerify, + hardenedRuntime: isMas ? masOptions && masOptions.hardenedRuntime === true : options.hardenedRuntime !== false, + }; + await this.adjustSignOptions(signOptions, masOptions); + builder_util_1.log.info({ + file: builder_util_1.log.filePath(appPath), + identityName: identity.name, + identityHash: identity.hash, + provisioningProfile: signOptions["provisioning-profile"] || "none", + }, "signing"); + await this.doSign(signOptions); + // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209 + if (masOptions != null && !isDevelopment) { + const certType = isDevelopment ? "Mac Developer" : "3rd Party Mac Developer Installer"; + const masInstallerIdentity = await macCodeSign_1.findIdentity(certType, masOptions.identity, keychainFile); + if (masInstallerIdentity == null) { + throw new builder_util_1.InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`); + } + // mas uploaded to AppStore, so, use "-" instead of space for name + const artifactName = this.expandArtifactNamePattern(masOptions, "pkg", arch); + const artifactPath = path.join(outDir, artifactName); + await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile); + await this.dispatchArtifactCreated(artifactPath, null, builder_util_1.Arch.x64, this.computeSafeArtifactName(artifactName, "pkg", arch, true, this.platformSpecificBuildOptions.defaultArch)); + } + } + async adjustSignOptions(signOptions, masOptions) { + const resourceList = await this.resourceList; + const customSignOptions = masOptions || this.platformSpecificBuildOptions; + const entitlementsSuffix = masOptions == null ? "mac" : "mas"; + let entitlements = customSignOptions.entitlements; + if (entitlements == null) { + const p = `entitlements.${entitlementsSuffix}.plist`; + if (resourceList.includes(p)) { + entitlements = path.join(this.info.buildResourcesDir, p); + } + else { + entitlements = pathManager_1.getTemplatePath("entitlements.mac.plist"); + } + } + signOptions.entitlements = entitlements; + let entitlementsInherit = customSignOptions.entitlementsInherit; + if (entitlementsInherit == null) { + const p = `entitlements.${entitlementsSuffix}.inherit.plist`; + if (resourceList.includes(p)) { + entitlementsInherit = path.join(this.info.buildResourcesDir, p); + } + else { + entitlementsInherit = pathManager_1.getTemplatePath("entitlements.mac.plist"); + } + } + signOptions["entitlements-inherit"] = entitlementsInherit; + if (customSignOptions.provisioningProfile != null) { + signOptions["provisioning-profile"] = customSignOptions.provisioningProfile; + } + signOptions["entitlements-loginhelper"] = customSignOptions.entitlementsLoginHelper; + } + //noinspection JSMethodCanBeStatic + async doSign(opts) { + return electron_osx_sign_1.signAsync(opts); + } + //noinspection JSMethodCanBeStatic + async doFlat(appPath, outFile, identity, keychain) { + // productbuild doesn't created directory for out file + await promises_1.mkdir(path.dirname(outFile), { recursive: true }); + const args = pkg_1.prepareProductBuildArgs(identity, keychain); + args.push("--component", appPath, "/Applications"); + args.push(outFile); + return await builder_util_1.exec("productbuild", args); + } + getElectronSrcDir(dist) { + return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName); + } + getElectronDestinationDir(appOutDir) { + return path.join(appOutDir, this.info.framework.distMacOsAppName); + } + // todo fileAssociations + async applyCommonInfo(appPlist, contentsPath) { + const appInfo = this.appInfo; + const appFilename = appInfo.productFilename; + // https://github.com/electron-userland/electron-builder/issues/1278 + appPlist.CFBundleExecutable = appFilename.endsWith(" Helper") ? appFilename.substring(0, appFilename.length - " Helper".length) : appFilename; + const icon = await this.getIconPath(); + if (icon != null) { + const oldIcon = appPlist.CFBundleIconFile; + const resourcesPath = path.join(contentsPath, "Resources"); + if (oldIcon != null) { + await fs_1.unlinkIfExists(path.join(resourcesPath, oldIcon)); + } + const iconFileName = "icon.icns"; + appPlist.CFBundleIconFile = iconFileName; + await fs_1.copyFile(icon, path.join(resourcesPath, iconFileName)); + } + appPlist.CFBundleName = appInfo.productName; + appPlist.CFBundleDisplayName = appInfo.productName; + const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion; + if (minimumSystemVersion != null) { + appPlist.LSMinimumSystemVersion = minimumSystemVersion; + } + appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier; + appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version; + appPlist.CFBundleVersion = appInfo.buildVersion; + builder_util_1.use(this.platformSpecificBuildOptions.category || this.config.category, it => (appPlist.LSApplicationCategoryType = it)); + appPlist.NSHumanReadableCopyright = appInfo.copyright; + if (this.platformSpecificBuildOptions.darkModeSupport) { + appPlist.NSRequiresAquaSystemAppearance = false; + } + const extendInfo = this.platformSpecificBuildOptions.extendInfo; + if (extendInfo != null) { + Object.assign(appPlist, extendInfo); + } + } + async signApp(packContext, isAsar) { + const appFileName = `${this.appInfo.productFilename}.app`; + await bluebird_lst_1.default.map(promises_1.readdir(packContext.appOutDir), (file) => { + if (file === appFileName) { + return this.sign(path.join(packContext.appOutDir, file), null, null, null); + } + return null; + }); + if (!isAsar) { + return; + } + const outResourcesDir = path.join(packContext.appOutDir, "resources", "app.asar.unpacked"); + await bluebird_lst_1.default.map(promise_1.orIfFileNotExist(promises_1.readdir(outResourcesDir), []), (file) => { + if (file.endsWith(".app")) { + return this.sign(path.join(outResourcesDir, file), null, null, null); + } + else { + return null; + } + }); + } +} +exports.default = MacPackager; +function getCertificateTypes(isMas, isDevelopment) { + if (isDevelopment) { + return isMas ? ["Mac Developer", "Apple Development"] : ["Mac Developer", "Developer ID Application"]; + } + return isMas ? ["Apple Distribution", "3rd Party Mac Developer Application"] : ["Developer ID Application"]; +} +//# sourceMappingURL=macPackager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/macPackager.js.map b/client/node_modules/app-builder-lib/out/macPackager.js.map new file mode 100644 index 0000000000..a377a85df5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/macPackager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"macPackager.js","sourceRoot":"","sources":["../src/macPackager.ts"],"names":[],"mappings":";;AAAA,+CAA0C;AAC1C,+CAA2H;AAC3H,yDAA0D;AAC1D,0CAA4C;AAC5C,uCAA+B;AAC/B,6BAA4B;AAC5B,4CAA0E;AAC1E,sDAA2D;AAC3D,uCAAmC;AACnC,wDAAsJ;AACtJ,iCAAqD;AAIrD,yDAAoE;AACpE,2DAAuD;AACvD,uCAAkE;AAClE,2DAAwE;AACxE,sDAAuD;AACvD,oDAAoD;AACpD,kCAAiC;AAEjC,MAAqB,WAAY,SAAQ,mCAAkC;IAyBzE,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,EAAE,eAAQ,CAAC,GAAG,CAAC,CAAA;QAzBlB,oBAAe,GAAG,IAAI,eAAI,CAAkB,GAAG,EAAE;YACxD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;YACjC,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACpD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC,CAAA;aAC3E;YAED,OAAO,4BAAc,CAAC;gBACpB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc;gBAChC,OAAO;gBACP,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE;gBACrC,QAAQ,EAAE,gCAAa,CAAC,IAAI,CAAC,4BAA4B,CAAC,gBAAgB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0BAA0B,CAAC,CAAA;KACtG;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,qCAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAA;AAC7G,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { deepAssign, Arch, AsyncTaskManager, exec, InvalidConfigurationError, log, use, getArchSuffix } from \"builder-util\"\nimport { signAsync, SignOptions } from \"electron-osx-sign\"\nimport { mkdir, readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { copyFile, statOrNull, unlinkIfExists } from \"builder-util/out/fs\"\nimport { orIfFileNotExist } from \"builder-util/out/promise\"\nimport { AppInfo } from \"./appInfo\"\nimport { CertType, CodeSigningInfo, createKeychain, findIdentity, Identity, isSignAllowed, removeKeychain, reportError } from \"./codeSign/macCodeSign\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { AfterPackContext, ElectronPlatformName } from \"./index\"\nimport { MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport { ArchiveTarget } from \"./targets/ArchiveTarget\"\nimport { PkgTarget, prepareProductBuildArgs } from \"./targets/pkg\"\nimport { createCommonTarget, NoOpTarget } from \"./targets/targetFactory\"\nimport { isMacOsHighSierra } from \"./util/macosVersion\"\nimport { getTemplatePath } from \"./util/pathManager\"\nimport * as fs from \"fs/promises\"\n\nexport default class MacPackager extends PlatformPackager {\n readonly codeSigningInfo = new Lazy(() => {\n const cscLink = this.getCscLink()\n if (cscLink == null || process.platform !== \"darwin\") {\n return Promise.resolve({ keychainFile: process.env.CSC_KEYCHAIN || null })\n }\n\n return createKeychain({\n tmpDir: this.info.tempDirManager,\n cscLink,\n cscKeyPassword: this.getCscPassword(),\n cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),\n cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),\n currentDir: this.projectDir,\n }).then(result => {\n const keychainFile = result.keychainFile\n if (keychainFile != null) {\n this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))\n }\n return result\n })\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"icns\"))\n\n constructor(info: Packager) {\n super(info, Platform.MAC)\n }\n\n get defaultTarget(): Array {\n return this.info.framework.macOsDefaultTargets\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected prepareAppInfo(appInfo: AppInfo): AppInfo {\n return new AppInfo(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions)\n }\n\n async getIconPath(): Promise {\n return this._iconPath.value\n }\n\n createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n for (const name of targets) {\n switch (name) {\n case DIR_TARGET:\n break\n\n case \"dmg\": {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { DmgTarget } = require(\"dmg-builder\")\n mapper(name, outDir => new DmgTarget(this, outDir))\n break\n }\n\n case \"zip\":\n // https://github.com/electron-userland/electron-builder/issues/2313\n mapper(name, outDir => new ArchiveTarget(name, outDir, this, true))\n break\n\n case \"pkg\":\n mapper(name, outDir => new PkgTarget(this, outDir))\n break\n\n default:\n mapper(name, outDir => (name === \"mas\" || name === \"mas-dev\" ? new NoOpTarget(name) : createCommonTarget(name, outDir, this)))\n break\n }\n }\n }\n\n protected async doPack(\n outDir: string,\n appOutDir: string,\n platformName: ElectronPlatformName,\n arch: Arch,\n platformSpecificBuildOptions: MacConfiguration,\n targets: Array\n ): Promise {\n switch (arch) {\n default: {\n return super.doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)\n }\n case Arch.universal: {\n const x64Arch = Arch.x64\n const x64AppOutDir = appOutDir + \"--\" + Arch[x64Arch]\n await super.doPack(outDir, x64AppOutDir, platformName, x64Arch, platformSpecificBuildOptions, targets, false, true)\n const arm64Arch = Arch.arm64\n const arm64AppOutPath = appOutDir + \"--\" + Arch[arm64Arch]\n await super.doPack(outDir, arm64AppOutPath, platformName, arm64Arch, platformSpecificBuildOptions, targets, false, true)\n const framework = this.info.framework\n log.info(\n {\n platform: platformName,\n arch: Arch[arch],\n [`${framework.name}`]: framework.version,\n appOutDir: log.filePath(appOutDir),\n },\n `packaging`\n )\n const appFile = `${this.appInfo.productFilename}.app`\n const { makeUniversalApp } = require(\"@electron/universal\")\n await makeUniversalApp({\n x64AppPath: path.join(x64AppOutDir, appFile),\n arm64AppPath: path.join(arm64AppOutPath, appFile),\n outAppPath: path.join(appOutDir, appFile),\n force: true,\n mergeASARs: platformSpecificBuildOptions.mergeASARs ?? true,\n singleArchFiles: platformSpecificBuildOptions.singleArchFiles,\n x64ArchFiles: platformSpecificBuildOptions.x64ArchFiles,\n })\n await fs.rm(x64AppOutDir, { recursive: true, force: true })\n await fs.rm(arm64AppOutPath, { recursive: true, force: true })\n\n // Give users a final opportunity to perform things on the combined universal package before signing\n const packContext: AfterPackContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n await this.info.afterPack(packContext)\n\n await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)\n break\n }\n }\n }\n\n async pack(outDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): Promise {\n let nonMasPromise: Promise | null = null\n\n const hasMas = targets.length !== 0 && targets.some(it => it.name === \"mas\" || it.name === \"mas-dev\")\n const prepackaged = this.packagerOptions.prepackaged\n\n if (!hasMas || targets.length > 1) {\n const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged\n nonMasPromise = (\n prepackaged\n ? Promise.resolve()\n : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)\n ).then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))\n }\n\n for (const target of targets) {\n const targetName = target.name\n if (!(targetName === \"mas\" || targetName === \"mas-dev\")) {\n continue\n }\n\n const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, this.config.mas)\n if (targetName === \"mas-dev\") {\n deepAssign(masBuildOptions, this.config.masDev, {\n type: \"development\",\n })\n }\n\n const targetOutDir = path.join(outDir, `${targetName}${getArchSuffix(arch)}`)\n if (prepackaged == null) {\n await this.doPack(outDir, targetOutDir, \"mas\", arch, masBuildOptions, [target])\n await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions, arch)\n } else {\n await this.sign(prepackaged, targetOutDir, masBuildOptions, arch)\n }\n }\n\n if (nonMasPromise != null) {\n await nonMasPromise\n }\n }\n\n private async sign(appPath: string, outDir: string | null, masOptions: MasConfiguration | null, arch: Arch | null): Promise {\n if (!isSignAllowed()) {\n return\n }\n\n const isMas = masOptions != null\n const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions\n const qualifier = options.identity\n\n if (!isMas && qualifier === null) {\n if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n log.info({ reason: \"identity explicitly is set to null\" }, \"skipped macOS code signing\")\n return\n }\n\n const keychainFile = (await this.codeSigningInfo.value).keychainFile\n const explicitType = options.type\n const type = explicitType || \"distribution\"\n const isDevelopment = type === \"development\"\n const certificateTypes = getCertificateTypes(isMas, isDevelopment)\n\n let identity = null\n for (const certificateType of certificateTypes) {\n identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity != null) {\n break\n }\n }\n\n if (identity == null) {\n if (!isMas && !isDevelopment && explicitType !== \"distribution\") {\n identity = await findIdentity(\"Mac Developer\", qualifier, keychainFile)\n if (identity != null) {\n log.warn(\"Mac Developer is used to sign app — it is only for development and testing, not for production\")\n }\n }\n\n if (identity == null) {\n await reportError(isMas, certificateTypes, qualifier, keychainFile, this.forceCodeSigning)\n return\n }\n }\n\n if (!isMacOsHighSierra()) {\n throw new InvalidConfigurationError(\"macOS High Sierra 10.13.6 is required to sign\")\n }\n\n let filter = options.signIgnore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = null\n }\n } else if (filter != null) {\n filter = filter.length === 0 ? null : [filter]\n }\n\n const filterRe = filter == null ? null : filter.map(it => new RegExp(it))\n\n let binaries = options.binaries || undefined\n if (binaries) {\n // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.\n binaries = await Promise.all(\n binaries.map(async destination => {\n if (await statOrNull(destination)) {\n return destination\n }\n return path.resolve(appPath, destination)\n })\n )\n log.info(\"Signing addtional user-defined binaries: \" + JSON.stringify(binaries, null, 1))\n }\n\n const signOptions: any = {\n \"identity-validation\": false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n return (\n file.endsWith(\".kext\") ||\n file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") ||\n file.includes(\"/node_modules/playwright-firefox/.local-browsers\") ||\n file.includes(\"/node_modules/playwright/.local-browsers\")\n )\n\n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010\n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.config.electronVersion,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries,\n timestamp: isMas ? masOptions?.timestamp : options.timestamp,\n requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements),\n // https://github.com/electron-userland/electron-osx-sign/issues/196\n // will fail on 10.14.5+ because a signed but unnotarized app is also rejected.\n \"gatekeeper-assess\": options.gatekeeperAssess === true,\n // https://github.com/electron-userland/electron-builder/issues/1480\n \"strict-verify\": options.strictVerify,\n hardenedRuntime: isMas ? masOptions && masOptions.hardenedRuntime === true : options.hardenedRuntime !== false,\n }\n\n await this.adjustSignOptions(signOptions, masOptions)\n log.info(\n {\n file: log.filePath(appPath),\n identityName: identity.name,\n identityHash: identity.hash,\n provisioningProfile: signOptions[\"provisioning-profile\"] || \"none\",\n },\n \"signing\"\n )\n await this.doSign(signOptions)\n\n // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209\n if (masOptions != null && !isDevelopment) {\n const certType = isDevelopment ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile)\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/code-signing`)\n }\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n const artifactName = this.expandArtifactNamePattern(masOptions, \"pkg\", arch)\n const artifactPath = path.join(outDir!, artifactName)\n await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, \"pkg\", arch, true, this.platformSpecificBuildOptions.defaultArch))\n }\n }\n\n private async adjustSignOptions(signOptions: any, masOptions: MasConfiguration | null) {\n const resourceList = await this.resourceList\n const customSignOptions = masOptions || this.platformSpecificBuildOptions\n const entitlementsSuffix = masOptions == null ? \"mac\" : \"mas\"\n\n let entitlements = customSignOptions.entitlements\n if (entitlements == null) {\n const p = `entitlements.${entitlementsSuffix}.plist`\n if (resourceList.includes(p)) {\n entitlements = path.join(this.info.buildResourcesDir, p)\n } else {\n entitlements = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions.entitlements = entitlements\n\n let entitlementsInherit = customSignOptions.entitlementsInherit\n if (entitlementsInherit == null) {\n const p = `entitlements.${entitlementsSuffix}.inherit.plist`\n if (resourceList.includes(p)) {\n entitlementsInherit = path.join(this.info.buildResourcesDir, p)\n } else {\n entitlementsInherit = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions[\"entitlements-inherit\"] = entitlementsInherit\n\n if (customSignOptions.provisioningProfile != null) {\n signOptions[\"provisioning-profile\"] = customSignOptions.provisioningProfile\n }\n signOptions[\"entitlements-loginhelper\"] = customSignOptions.entitlementsLoginHelper\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doSign(opts: SignOptions): Promise {\n return signAsync(opts)\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise {\n // productbuild doesn't created directory for out file\n await mkdir(path.dirname(outFile), { recursive: true })\n\n const args = prepareProductBuildArgs(identity, keychain)\n args.push(\"--component\", appPath, \"/Applications\")\n args.push(outFile)\n return await exec(\"productbuild\", args)\n }\n\n public getElectronSrcDir(dist: string) {\n return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName)\n }\n\n public getElectronDestinationDir(appOutDir: string) {\n return path.join(appOutDir, this.info.framework.distMacOsAppName)\n }\n\n // todo fileAssociations\n async applyCommonInfo(appPlist: any, contentsPath: string) {\n const appInfo = this.appInfo\n const appFilename = appInfo.productFilename\n\n // https://github.com/electron-userland/electron-builder/issues/1278\n appPlist.CFBundleExecutable = appFilename.endsWith(\" Helper\") ? appFilename.substring(0, appFilename.length - \" Helper\".length) : appFilename\n\n const icon = await this.getIconPath()\n if (icon != null) {\n const oldIcon = appPlist.CFBundleIconFile\n const resourcesPath = path.join(contentsPath, \"Resources\")\n if (oldIcon != null) {\n await unlinkIfExists(path.join(resourcesPath, oldIcon))\n }\n const iconFileName = \"icon.icns\"\n appPlist.CFBundleIconFile = iconFileName\n await copyFile(icon, path.join(resourcesPath, iconFileName))\n }\n appPlist.CFBundleName = appInfo.productName\n appPlist.CFBundleDisplayName = appInfo.productName\n\n const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n appPlist.LSMinimumSystemVersion = minimumSystemVersion\n }\n\n appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier\n\n appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version\n appPlist.CFBundleVersion = appInfo.buildVersion\n\n use(this.platformSpecificBuildOptions.category || (this.config as any).category, it => (appPlist.LSApplicationCategoryType = it))\n appPlist.NSHumanReadableCopyright = appInfo.copyright\n\n if (this.platformSpecificBuildOptions.darkModeSupport) {\n appPlist.NSRequiresAquaSystemAppearance = false\n }\n\n const extendInfo = this.platformSpecificBuildOptions.extendInfo\n if (extendInfo != null) {\n Object.assign(appPlist, extendInfo)\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise {\n const appFileName = `${this.appInfo.productFilename}.app`\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === appFileName) {\n return this.sign(path.join(packContext.appOutDir, file), null, null, null)\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const outResourcesDir = path.join(packContext.appOutDir, \"resources\", \"app.asar.unpacked\")\n await BluebirdPromise.map(orIfFileNotExist(readdir(outResourcesDir), []), (file: string): any => {\n if (file.endsWith(\".app\")) {\n return this.sign(path.join(outResourcesDir, file), null, null, null)\n } else {\n return null\n }\n })\n }\n}\n\nfunction getCertificateTypes(isMas: boolean, isDevelopment: boolean): CertType[] {\n if (isDevelopment) {\n return isMas ? [\"Mac Developer\", \"Apple Development\"] : [\"Mac Developer\", \"Developer ID Application\"]\n }\n return isMas ? [\"Apple Distribution\", \"3rd Party Mac Developer Application\"] : [\"Developer ID Application\"]\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/AppXOptions.d.ts b/client/node_modules/app-builder-lib/out/options/AppXOptions.d.ts new file mode 100644 index 0000000000..69694fb0a7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/AppXOptions.d.ts @@ -0,0 +1,61 @@ +import { TargetSpecificOptions } from "../core"; +export interface AppXOptions extends TargetSpecificOptions { + /** + * The application id. Defaults to `identityName`. Can’t start with numbers. + */ + readonly applicationId?: string; + /** + * The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx). + * @default #464646 + */ + readonly backgroundColor?: string | null; + /** + * A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx). + * Defaults to the application product name. + */ + readonly displayName?: string | null; + /** + * The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](/configuration/configuration#Metadata-name). + */ + readonly identityName?: string | null; + /** + * The Windows Store publisher. Not used if AppX is build for testing. See [AppX Package Code Signing](#appx-package-code-signing) below. + */ + readonly publisher?: string | null; + /** + * A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx). + * Defaults to company name from the application metadata. + */ + readonly publisherDisplayName?: string | null; + /** + * The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store. + * The first entry (index 0) will be the default language. + * Defaults to en-US if omitted. + */ + readonly languages?: Array | string | null; + /** + * Whether to add auto launch extension. Defaults to `true` if [electron-winstore-auto-launch](https://github.com/felixrieseberg/electron-winstore-auto-launch) in the dependencies. + */ + readonly addAutoLaunchExtension?: boolean; + /** + * Relative path to custom extensions xml to be included in an `appmanifest.xml`. + */ + readonly customExtensionsPath?: string; + /** + * Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies. + * @default false + */ + readonly showNameOnTiles?: boolean; + /** + * @private + * @default false + */ + readonly electronUpdaterAware?: boolean; + /** + * Whether to set build number. See https://github.com/electron-userland/electron-builder/issues/3875 + * @default false + */ + readonly setBuildNumber?: boolean; + /** @private */ + readonly makeappxArgs?: Array | null; +} diff --git a/client/node_modules/app-builder-lib/out/options/AppXOptions.js b/client/node_modules/app-builder-lib/out/options/AppXOptions.js new file mode 100644 index 0000000000..9f2ff4a7b7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/AppXOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=AppXOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/AppXOptions.js.map b/client/node_modules/app-builder-lib/out/options/AppXOptions.js.map new file mode 100644 index 0000000000..fae435f2be --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/AppXOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppXOptions.js","sourceRoot":"","sources":["../../src/options/AppXOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\n\nexport interface AppXOptions extends TargetSpecificOptions {\n /**\n * The application id. Defaults to `identityName`. Can’t start with numbers.\n */\n readonly applicationId?: string\n\n /**\n * The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).\n * @default #464646\n */\n readonly backgroundColor?: string | null\n\n /**\n * A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).\n * Defaults to the application product name.\n */\n readonly displayName?: string | null\n\n /**\n * The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](/configuration/configuration#Metadata-name).\n */\n readonly identityName?: string | null\n\n /**\n * The Windows Store publisher. Not used if AppX is build for testing. See [AppX Package Code Signing](#appx-package-code-signing) below.\n */\n readonly publisher?: string | null\n\n /**\n * A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).\n * Defaults to company name from the application metadata.\n */\n readonly publisherDisplayName?: string | null\n\n /**\n * The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store.\n * The first entry (index 0) will be the default language.\n * Defaults to en-US if omitted.\n */\n readonly languages?: Array | string | null\n\n /**\n * Whether to add auto launch extension. Defaults to `true` if [electron-winstore-auto-launch](https://github.com/felixrieseberg/electron-winstore-auto-launch) in the dependencies.\n */\n readonly addAutoLaunchExtension?: boolean\n\n /**\n * Relative path to custom extensions xml to be included in an `appmanifest.xml`.\n */\n readonly customExtensionsPath?: string\n\n /**\n * Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.\n * @default false\n */\n readonly showNameOnTiles?: boolean\n\n /**\n * @private\n * @default false\n */\n readonly electronUpdaterAware?: boolean\n\n /**\n * Whether to set build number. See https://github.com/electron-userland/electron-builder/issues/3875\n * @default false\n */\n readonly setBuildNumber?: boolean\n\n /** @private */\n readonly makeappxArgs?: Array | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.d.ts b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.d.ts new file mode 100644 index 0000000000..20589f32fd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.d.ts @@ -0,0 +1,47 @@ +import { WinPackager } from "../winPackager"; +export interface CommonWindowsInstallerConfiguration { + readonly oneClick?: boolean; + /** + * Whether to install per all users (per-machine). + * @default false + */ + readonly perMachine?: boolean; + /** + * Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed. + * @default true + */ + readonly runAfterFinish?: boolean; + /** + * Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user). + * @default true + */ + readonly createDesktopShortcut?: boolean | "always"; + /** + * Whether to create start menu shortcut. + * @default true + */ + readonly createStartMenuShortcut?: boolean; + /** + * Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value. + * @default false + */ + readonly menuCategory?: boolean | string; + /** + * The name that will be used for all shortcuts. Defaults to the application name. + */ + readonly shortcutName?: string | null; +} +export interface FinalCommonWindowsInstallerOptions { + isAssisted: boolean; + isPerMachine: boolean; + shortcutName: string; + menuCategory: string | null; + isCreateDesktopShortcut: DesktopShortcutCreationPolicy; + isCreateStartMenuShortcut: boolean; +} +export declare function getEffectiveOptions(options: CommonWindowsInstallerConfiguration, packager: WinPackager): FinalCommonWindowsInstallerOptions; +export declare enum DesktopShortcutCreationPolicy { + FRESH_INSTALL = 0, + ALWAYS = 1, + NEVER = 2 +} diff --git a/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js new file mode 100644 index 0000000000..ad64927c2f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DesktopShortcutCreationPolicy = exports.getEffectiveOptions = void 0; +const builder_util_1 = require("builder-util"); +const filename_1 = require("../util/filename"); +function getEffectiveOptions(options, packager) { + const appInfo = packager.appInfo; + let menuCategory = null; + if (options.menuCategory != null && options.menuCategory !== false) { + if (options.menuCategory === true) { + const companyName = packager.appInfo.companyName; + if (companyName == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "author" in the application package.json — it is required because "menuCategory" is set to true.`); + } + menuCategory = filename_1.sanitizeFileName(companyName); + } + else { + menuCategory = options.menuCategory + .split(/[/\\]/) + .map(it => filename_1.sanitizeFileName(it)) + .join("\\"); + } + } + return { + isPerMachine: options.perMachine === true, + isAssisted: options.oneClick === false, + shortcutName: builder_util_1.isEmptyOrSpaces(options.shortcutName) ? appInfo.sanitizedProductName : packager.expandMacro(options.shortcutName), + isCreateDesktopShortcut: convertToDesktopShortcutCreationPolicy(options.createDesktopShortcut), + isCreateStartMenuShortcut: options.createStartMenuShortcut !== false, + menuCategory, + }; +} +exports.getEffectiveOptions = getEffectiveOptions; +function convertToDesktopShortcutCreationPolicy(value) { + if (value === false) { + return DesktopShortcutCreationPolicy.NEVER; + } + else if (value === "always") { + return DesktopShortcutCreationPolicy.ALWAYS; + } + else { + return DesktopShortcutCreationPolicy.FRESH_INSTALL; + } +} +var DesktopShortcutCreationPolicy; +(function (DesktopShortcutCreationPolicy) { + DesktopShortcutCreationPolicy[DesktopShortcutCreationPolicy["FRESH_INSTALL"] = 0] = "FRESH_INSTALL"; + DesktopShortcutCreationPolicy[DesktopShortcutCreationPolicy["ALWAYS"] = 1] = "ALWAYS"; + DesktopShortcutCreationPolicy[DesktopShortcutCreationPolicy["NEVER"] = 2] = "NEVER"; +})(DesktopShortcutCreationPolicy = exports.DesktopShortcutCreationPolicy || (exports.DesktopShortcutCreationPolicy = {})); +//# sourceMappingURL=CommonWindowsInstallerConfiguration.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js.map b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js.map new file mode 100644 index 0000000000..59b450369a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/CommonWindowsInstallerConfiguration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CommonWindowsInstallerConfiguration.js","sourceRoot":"","sources":["../../src/options/CommonWindowsInstallerConfiguration.ts"],"names":[],"mappings":";;;AAAA,+CAAyE;AACzE,+CAAmD;AAqDnD,SAAgB,mBAAmB,CAAC,OAA4C,EAAE,QAAqB;IACrG,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEhC,IAAI,YAAY,GAAkB,IAAI,CAAA;IACtC,IAAI,OAAO,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,CAAC,YAAY,KAA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AAM,CAAA;IACN,mFAAK,CAAA;AACP,CAAC,EAJW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAIxC","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces } from \"builder-util\"\nimport { sanitizeFileName } from \"../util/filename\"\nimport { WinPackager } from \"../winPackager\"\n\nexport interface CommonWindowsInstallerConfiguration {\n readonly oneClick?: boolean\n\n /**\n * Whether to install per all users (per-machine).\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.\n * @default true\n */\n readonly runAfterFinish?: boolean\n\n /**\n * Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).\n * @default true\n */\n readonly createDesktopShortcut?: boolean | \"always\"\n\n /**\n * Whether to create start menu shortcut.\n * @default true\n */\n readonly createStartMenuShortcut?: boolean\n\n /**\n * Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.\n * @default false\n */\n readonly menuCategory?: boolean | string\n\n /**\n * The name that will be used for all shortcuts. Defaults to the application name.\n */\n readonly shortcutName?: string | null\n}\n\nexport interface FinalCommonWindowsInstallerOptions {\n isAssisted: boolean\n isPerMachine: boolean\n\n shortcutName: string\n menuCategory: string | null\n\n isCreateDesktopShortcut: DesktopShortcutCreationPolicy\n isCreateStartMenuShortcut: boolean\n}\n\nexport function getEffectiveOptions(options: CommonWindowsInstallerConfiguration, packager: WinPackager): FinalCommonWindowsInstallerOptions {\n const appInfo = packager.appInfo\n\n let menuCategory: string | null = null\n if (options.menuCategory != null && options.menuCategory !== false) {\n if (options.menuCategory === true) {\n const companyName = packager.appInfo.companyName\n if (companyName == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"menuCategory\" is set to true.`)\n }\n menuCategory = sanitizeFileName(companyName)\n } else {\n menuCategory = options.menuCategory\n .split(/[/\\\\]/)\n .map(it => sanitizeFileName(it))\n .join(\"\\\\\")\n }\n }\n\n return {\n isPerMachine: options.perMachine === true,\n isAssisted: options.oneClick === false,\n\n shortcutName: isEmptyOrSpaces(options.shortcutName) ? appInfo.sanitizedProductName : packager.expandMacro(options.shortcutName),\n isCreateDesktopShortcut: convertToDesktopShortcutCreationPolicy(options.createDesktopShortcut),\n isCreateStartMenuShortcut: options.createStartMenuShortcut !== false,\n menuCategory,\n }\n}\n\nfunction convertToDesktopShortcutCreationPolicy(value: boolean | undefined | string): DesktopShortcutCreationPolicy {\n if (value === false) {\n return DesktopShortcutCreationPolicy.NEVER\n } else if (value === \"always\") {\n return DesktopShortcutCreationPolicy.ALWAYS\n } else {\n return DesktopShortcutCreationPolicy.FRESH_INSTALL\n }\n}\n\nexport enum DesktopShortcutCreationPolicy {\n FRESH_INSTALL,\n ALWAYS,\n NEVER,\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/FileAssociation.d.ts b/client/node_modules/app-builder-lib/out/options/FileAssociation.d.ts new file mode 100644 index 0000000000..07fbbdae71 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/FileAssociation.d.ts @@ -0,0 +1,45 @@ +/** + * File associations. + * + * macOS (corresponds to [CFBundleDocumentTypes](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685)), NSIS, and MSI only. + * + * On Windows (NSIS) works only if [nsis.perMachine](https://electron.build/configuration/configuration#NsisOptions-perMachine) is set to `true`. + */ +export interface FileAssociation { + /** + * The extension (minus the leading period). e.g. `png`. + */ + readonly ext: string | Array; + /** + * The name. e.g. `PNG`. Defaults to `ext`. + */ + readonly name?: string | null; + /** + * *windows-only.* The description. + */ + readonly description?: string | null; + /** + * *linux-only.* The mime-type. + */ + readonly mimeType?: string | null; + /** + * The path to icon (`.icns` for MacOS and `.ico` for Windows), relative to `build` (build resources directory). Defaults to `${firstExt}.icns`/`${firstExt}.ico` (if several extensions specified, first is used) or to application icon. + * + * Not supported on Linux, file issue if need (default icon will be `x-office-document`). Not supported on MSI. + */ + readonly icon?: string | null; + /** + * *macOS-only* The app’s role with respect to the type. The value can be `Editor`, `Viewer`, `Shell`, or `None`. Corresponds to `CFBundleTypeRole`. + * @default Editor + */ + readonly role?: string; + /** + * *macOS-only* Whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file. Corresponds to `LSTypeIsPackage`. + */ + readonly isPackage?: boolean; + /** + * *macOS-only* The app’s rank with respect to the type. The value can be `Owner`, `Default`, `Alternate`, or `None`. Corresponds to `LSHandlerRank`. + * @default Default + */ + readonly rank?: string; +} diff --git a/client/node_modules/app-builder-lib/out/options/FileAssociation.js b/client/node_modules/app-builder-lib/out/options/FileAssociation.js new file mode 100644 index 0000000000..b53652272f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/FileAssociation.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=FileAssociation.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/FileAssociation.js.map b/client/node_modules/app-builder-lib/out/options/FileAssociation.js.map new file mode 100644 index 0000000000..c2911dc3a2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/FileAssociation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FileAssociation.js","sourceRoot":"","sources":["../../src/options/FileAssociation.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * File associations.\n *\n * macOS (corresponds to [CFBundleDocumentTypes](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685)), NSIS, and MSI only.\n *\n * On Windows (NSIS) works only if [nsis.perMachine](https://electron.build/configuration/configuration#NsisOptions-perMachine) is set to `true`.\n */\nexport interface FileAssociation {\n /**\n * The extension (minus the leading period). e.g. `png`.\n */\n readonly ext: string | Array\n\n /**\n * The name. e.g. `PNG`. Defaults to `ext`.\n */\n readonly name?: string | null\n\n /**\n * *windows-only.* The description.\n */\n readonly description?: string | null\n\n /**\n * *linux-only.* The mime-type.\n */\n readonly mimeType?: string | null\n\n /**\n * The path to icon (`.icns` for MacOS and `.ico` for Windows), relative to `build` (build resources directory). Defaults to `${firstExt}.icns`/`${firstExt}.ico` (if several extensions specified, first is used) or to application icon.\n *\n * Not supported on Linux, file issue if need (default icon will be `x-office-document`). Not supported on MSI.\n */\n readonly icon?: string | null\n\n /**\n * *macOS-only* The app’s role with respect to the type. The value can be `Editor`, `Viewer`, `Shell`, or `None`. Corresponds to `CFBundleTypeRole`.\n * @default Editor\n */\n readonly role?: string\n\n /**\n * *macOS-only* Whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file. Corresponds to `LSTypeIsPackage`.\n */\n readonly isPackage?: boolean\n\n /**\n * *macOS-only* The app’s rank with respect to the type. The value can be `Owner`, `Default`, `Alternate`, or `None`. Corresponds to `LSHandlerRank`.\n * @default Default\n */\n readonly rank?: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/MsiOptions.d.ts b/client/node_modules/app-builder-lib/out/options/MsiOptions.d.ts new file mode 100644 index 0000000000..c2bb70e694 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/MsiOptions.d.ts @@ -0,0 +1,22 @@ +import { TargetSpecificOptions } from "../core"; +import { CommonWindowsInstallerConfiguration } from "./CommonWindowsInstallerConfiguration"; +export interface MsiOptions extends CommonWindowsInstallerConfiguration, TargetSpecificOptions { + /** + * One-click installation. + * @default true + */ + readonly oneClick?: boolean; + /** + * The [upgrade code](https://msdn.microsoft.com/en-us/library/windows/desktop/aa372375(v=vs.85).aspx). Optional, by default generated using app id. + */ + readonly upgradeCode?: string | null; + /** + * If `warningsAsErrors` is `true` (default): treat warnings as errors. If `warningsAsErrors` is `false`: allow warnings. + * @default true + */ + readonly warningsAsErrors?: boolean; + /** + * Any additional arguments to be passed to the WiX installer compiler, such as `["-ext", "WixUtilExtension"]` + */ + readonly additionalWixArgs?: Array | null; +} diff --git a/client/node_modules/app-builder-lib/out/options/MsiOptions.js b/client/node_modules/app-builder-lib/out/options/MsiOptions.js new file mode 100644 index 0000000000..b535d19003 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/MsiOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=MsiOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/MsiOptions.js.map b/client/node_modules/app-builder-lib/out/options/MsiOptions.js.map new file mode 100644 index 0000000000..a4fb29e5d6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/MsiOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MsiOptions.js","sourceRoot":"","sources":["../../src/options/MsiOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { CommonWindowsInstallerConfiguration } from \"./CommonWindowsInstallerConfiguration\"\n\nexport interface MsiOptions extends CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * One-click installation.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * The [upgrade code](https://msdn.microsoft.com/en-us/library/windows/desktop/aa372375(v=vs.85).aspx). Optional, by default generated using app id.\n */\n readonly upgradeCode?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): treat warnings as errors. If `warningsAsErrors` is `false`: allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * Any additional arguments to be passed to the WiX installer compiler, such as `[\"-ext\", \"WixUtilExtension\"]`\n */\n readonly additionalWixArgs?: Array | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.d.ts b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.d.ts new file mode 100644 index 0000000000..a01e9b8456 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.d.ts @@ -0,0 +1,140 @@ +import { CompressionLevel, Publish, TargetConfiguration, TargetSpecificOptions } from "../core"; +import { FileAssociation } from "./FileAssociation"; +export interface FileSet { + /** + * The source path relative to the project directory. + */ + from?: string; + /** + * The destination path relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`. + */ + to?: string; + /** + * The [glob patterns](/file-patterns). + */ + filter?: Array | string; +} +export interface AsarOptions { + /** + * Whether to automatically unpack executables files. + * @default true + */ + smartUnpack?: boolean; + ordering?: string | null; +} +export interface PlatformSpecificBuildOptions extends TargetSpecificOptions { + /** + * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as + * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set. + * @default com.electron.${name} + */ + readonly appId?: string | null; + /** + * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options). + */ + readonly artifactName?: string | null; + /** + * The executable name. Defaults to `productName`. + */ + readonly executableName?: string | null; + /** + * The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time. + * @default normal + */ + readonly compression?: CompressionLevel | null; + files?: Array | FileSet | string | null; + extraResources?: Array | FileSet | string | null; + extraFiles?: Array | FileSet | string | null; + /** + * Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/). + * + * Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work. + * @default true + */ + readonly asar?: AsarOptions | boolean | null; + /** + * A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive. + */ + readonly asarUnpack?: Array | string | null; + /** @private */ + readonly icon?: string | null; + /** + * The file associations. + */ + readonly fileAssociations?: Array | FileAssociation; + /** + * The URL protocol schemes. + */ + readonly protocols?: Array | Protocol; + /** + * Whether to fail if app will be not code signed. + */ + readonly forceCodeSigning?: boolean; + /** + * The [electron-updater compatibility](/auto-update#compatibility) semver range. + */ + readonly electronUpdaterCompatibility?: string | null; + publish?: Publish; + /** + * Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`. + * @default true + */ + readonly detectUpdateChannel?: boolean; + /** + * Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139). + * @default false + */ + readonly generateUpdatesFilesForAllChannels?: boolean; + /** + * The release info. Intended for command line usage: + * + * ``` + * -c.releaseInfo.releaseNotes="new features" + * ``` + */ + readonly releaseInfo?: ReleaseInfo; + readonly target?: Array | string | TargetConfiguration | null; + /** @private */ + cscLink?: string | null; + /** @private */ + cscKeyPassword?: string | null; + readonly defaultArch?: string; +} +export interface ReleaseInfo { + /** + * The release name. + */ + releaseName?: string | null; + /** + * The release notes. + */ + releaseNotes?: string | null; + /** + * The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](#MetadataDirectories-buildResources). + */ + releaseNotesFile?: string | null; + /** + * The release date. + */ + releaseDate?: string; +} +/** + * URL Protocol Schemes. Protocols to associate the app with. macOS only. + * + * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos). + */ +export interface Protocol { + /** + * The name. e.g. `IRC server URL`. + */ + readonly name: string; + /** + * The schemes. e.g. `["irc", "ircs"]`. + */ + readonly schemes: Array; + /** + * *macOS-only* The app’s role with respect to the type. + * @default Editor + */ + readonly role?: "Editor" | "Viewer" | "Shell" | "None"; +} diff --git a/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js new file mode 100644 index 0000000000..ef75ccd30e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PlatformSpecificBuildOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js.map b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js.map new file mode 100644 index 0000000000..61a70042c5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/PlatformSpecificBuildOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PlatformSpecificBuildOptions.js","sourceRoot":"","sources":["../../src/options/PlatformSpecificBuildOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CompressionLevel, Publish, TargetConfiguration, TargetSpecificOptions } from \"../core\"\nimport { FileAssociation } from \"./FileAssociation\"\n\nexport interface FileSet {\n /**\n * The source path relative to the project directory.\n */\n from?: string\n /**\n * The destination path relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`.\n */\n to?: string\n /**\n * The [glob patterns](/file-patterns).\n */\n filter?: Array | string\n}\n\nexport interface AsarOptions {\n /**\n * Whether to automatically unpack executables files.\n * @default true\n */\n smartUnpack?: boolean\n\n ordering?: string | null\n}\n\nexport interface PlatformSpecificBuildOptions extends TargetSpecificOptions {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).\n */\n readonly artifactName?: string | null\n\n /**\n * The executable name. Defaults to `productName`.\n */\n readonly executableName?: string | null\n\n /**\n * The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time.\n * @default normal\n */\n readonly compression?: CompressionLevel | null\n\n files?: Array | FileSet | string | null\n extraResources?: Array | FileSet | string | null\n extraFiles?: Array | FileSet | string | null\n\n /**\n * Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n *\n * Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work.\n * @default true\n */\n readonly asar?: AsarOptions | boolean | null\n\n /**\n * A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive.\n */\n readonly asarUnpack?: Array | string | null\n\n /** @private */\n readonly icon?: string | null\n\n /**\n * The file associations.\n */\n readonly fileAssociations?: Array | FileAssociation\n /**\n * The URL protocol schemes.\n */\n readonly protocols?: Array | Protocol\n\n /**\n * Whether to fail if app will be not code signed.\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * The [electron-updater compatibility](/auto-update#compatibility) semver range.\n */\n readonly electronUpdaterCompatibility?: string | null\n\n publish?: Publish\n\n /**\n * Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.\n * @default true\n */\n readonly detectUpdateChannel?: boolean\n\n /**\n * Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).\n * @default false\n */\n readonly generateUpdatesFilesForAllChannels?: boolean\n\n /**\n * The release info. Intended for command line usage:\n *\n * ```\n * -c.releaseInfo.releaseNotes=\"new features\"\n * ```\n */\n readonly releaseInfo?: ReleaseInfo\n\n readonly target?: Array | string | TargetConfiguration | null\n\n /** @private */\n cscLink?: string | null\n\n /** @private */\n cscKeyPassword?: string | null\n\n readonly defaultArch?: string\n}\n\nexport interface ReleaseInfo {\n /**\n * The release name.\n */\n releaseName?: string | null\n\n /**\n * The release notes.\n */\n releaseNotes?: string | null\n\n /**\n * The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](#MetadataDirectories-buildResources).\n */\n releaseNotesFile?: string | null\n\n /**\n * The release date.\n */\n releaseDate?: string\n}\n\n/**\n * URL Protocol Schemes. Protocols to associate the app with. macOS only.\n *\n * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).\n */\nexport interface Protocol {\n /**\n * The name. e.g. `IRC server URL`.\n */\n readonly name: string\n\n /**\n * The schemes. e.g. `[\"irc\", \"ircs\"]`.\n */\n readonly schemes: Array\n\n /**\n * *macOS-only* The app’s role with respect to the type.\n * @default Editor\n */\n readonly role?: \"Editor\" | \"Viewer\" | \"Shell\" | \"None\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/SnapOptions.d.ts b/client/node_modules/app-builder-lib/out/options/SnapOptions.d.ts new file mode 100644 index 0000000000..c11bf8eeec --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SnapOptions.d.ts @@ -0,0 +1,137 @@ +import { TargetSpecificOptions } from "../core"; +import { CommonLinuxOptions } from "./linuxOptions"; +export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions { + /** + * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap. + * @default strict + */ + readonly confinement?: "devmode" | "strict" | "classic" | null; + /** + * The custom environment. Defaults to `{"TMPDIR: "$XDG_RUNTIME_DIR"}`. If you set custom, it will be merged with default. + */ + readonly environment?: { + [key: string]: string; + } | null; + /** + * The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName). + */ + readonly summary?: string | null; + /** + * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels). + * @default stable + */ + readonly grade?: "devel" | "stable" | null; + /** + * The list of features that must be supported by the core in order for this snap to install. + */ + readonly assumes?: Array | string | null; + /** + * The list of debian packages needs to be installed for building this snap. + */ + readonly buildPackages?: Array | null; + /** + * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`. + * Defaults to `["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]`. + * + * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom package `foo` in addition to defaults. + */ + readonly stagePackages?: Array | null; + /** + * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory). + * @default build/snap-hooks + */ + readonly hooks?: string | null; + /** + * The list of [plugs](https://snapcraft.io/docs/reference/interfaces). + * Defaults to `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`. + * + * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom plug `foo` in addition to defaults. + * + * Additional attributes can be specified using object instead of just name of plug: + * ``` + *[ + * { + * "browser-sandbox": { + * "interface": "browser-support", + * "allow-sandbox": true + * }, + * }, + * "another-simple-plug-name" + *] + * ``` + */ + readonly plugs?: Array | PlugDescriptor | null; + /** + * The list of [slots](https://snapcraft.io/docs/reference/interfaces). + * + * Additional attributes can be specified using object instead of just name of slot: + * ``` + *[ + * { + * "mpris": { + * "name": "chromium" + * }, + * } + *] + * + * In case you want your application to be a compliant MPris player, you will need to definie + * The mpris slot with "chromium" name. + * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1), + * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement. + * + */ + readonly slots?: Array | PlugDescriptor | null; + /** + * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part. + * Defaults to `["desktop-gtk2""]`. + * + * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom parts `foo` in addition to defaults. + */ + readonly after?: Array | null; + /** + * Whether to use template snap. Defaults to `true` if `stagePackages` not specified. + */ + readonly useTemplateApp?: boolean; + /** + * Whether or not the snap should automatically start on login. + * @default false + */ + readonly autoStart?: boolean; + /** + * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more. + */ + readonly layout?: { + [key: string]: { + [key: string]: string; + }; + } | null; + /** + * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format. + * + * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29). + */ + readonly appPartStage?: Array | null; + /** + * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format). + */ + readonly title?: string | null; + /** + * Sets the compression type for the snap. Can be xz, lzo, or null. + */ + readonly compression?: "xz" | "lzo" | null; + /** + * Allow running the program with native wayland support with --ozone-platform=wayland. + * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007 + */ + readonly allowNativeWayland?: boolean | null; +} +export interface PlugDescriptor { + [key: string]: { + [key: string]: any; + } | null; +} +export interface SlotDescriptor { + [key: string]: { + [key: string]: any; + } | null; +} diff --git a/client/node_modules/app-builder-lib/out/options/SnapOptions.js b/client/node_modules/app-builder-lib/out/options/SnapOptions.js new file mode 100644 index 0000000000..b0832f04f4 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SnapOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=SnapOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/SnapOptions.js.map b/client/node_modules/app-builder-lib/out/options/SnapOptions.js.map new file mode 100644 index 0000000000..35d289540c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SnapOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SnapOptions.js","sourceRoot":"","sources":["../../src/options/SnapOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { CommonLinuxOptions } from \"./linuxOptions\"\n\nexport interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName).\n */\n readonly summary?: string | null\n\n /**\n * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * The list of features that must be supported by the core in order for this snap to install.\n */\n readonly assumes?: Array | string | null\n\n /**\n * The list of debian packages needs to be installed for building this snap.\n */\n readonly buildPackages?: Array | null\n\n /**\n * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom package `foo` in addition to defaults.\n */\n readonly stagePackages?: Array | null\n\n /**\n * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n\n /**\n * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).\n * Defaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom plug `foo` in addition to defaults.\n *\n * Additional attributes can be specified using object instead of just name of plug:\n * ```\n *[\n * {\n * \"browser-sandbox\": {\n * \"interface\": \"browser-support\",\n * \"allow-sandbox\": true\n * },\n * },\n * \"another-simple-plug-name\"\n *]\n * ```\n */\n readonly plugs?: Array | PlugDescriptor | null\n\n /**\n * The list of [slots](https://snapcraft.io/docs/reference/interfaces).\n *\n * Additional attributes can be specified using object instead of just name of slot:\n * ```\n *[\n * {\n * \"mpris\": {\n * \"name\": \"chromium\"\n * },\n * }\n *]\n *\n * In case you want your application to be a compliant MPris player, you will need to definie\n * The mpris slot with \"chromium\" name.\n * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),\n * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.\n *\n */\n readonly slots?: Array | PlugDescriptor | null\n\n /**\n * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.\n * Defaults to `[\"desktop-gtk2\"\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom parts `foo` in addition to defaults.\n */\n readonly after?: Array | null\n\n /**\n * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.\n */\n readonly useTemplateApp?: boolean\n\n /**\n * Whether or not the snap should automatically start on login.\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n /**\n * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.\n *\n * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).\n */\n readonly appPartStage?: Array | null\n\n /**\n * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Sets the compression type for the snap. Can be xz, lzo, or null.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Allow running the program with native wayland support with --ozone-platform=wayland.\n * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007\n */\n readonly allowNativeWayland?: boolean | null\n}\n\nexport interface PlugDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n\nexport interface SlotDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.d.ts b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.d.ts new file mode 100644 index 0000000000..e8ace81176 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.d.ts @@ -0,0 +1,41 @@ +/** + * Squirrel.Windows options. + */ +import { TargetSpecificOptions } from "../core"; +export interface SquirrelWindowsOptions extends TargetSpecificOptions { + /** + * A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon. + * + * Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http. + * + * If you don't plan to build windows installer, you can omit it. + * If your project repository is public on GitHub, it will be `https://github.com/${u}/${p}/blob/master/build/icon.ico?raw=true` by default. + */ + readonly iconUrl?: string | null; + /** + * The path to a .gif file to display during install. `build/install-spinner.gif` will be used if exists (it is a recommended way to set) + * (otherwise [default](https://github.com/electron/windows-installer/blob/master/resources/install-spinner.gif)). + */ + readonly loadingGif?: string | null; + /** + * Whether to create an MSI installer. Defaults to `false` (MSI is not created). + */ + readonly msi?: boolean; + /** + * A URL to your existing updates. Or `true` to automatically set to your GitHub repository. If given, these will be downloaded to create delta updates. + */ + readonly remoteReleases?: string | boolean | null; + /** + * Authentication token for remote updates + */ + readonly remoteToken?: string | null; + /** + * Use `appId` to identify package instead of `name`. + */ + readonly useAppIdAsId?: boolean; + /** + * https://github.com/electron-userland/electron-builder/issues/1743 + * @private + */ + readonly name?: string; +} diff --git a/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js new file mode 100644 index 0000000000..1f91cc3563 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=SquirrelWindowsOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js.map b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js.map new file mode 100644 index 0000000000..43c987c832 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/SquirrelWindowsOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SquirrelWindowsOptions.js","sourceRoot":"","sources":["../../src/options/SquirrelWindowsOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Squirrel.Windows options.\n */\nimport { TargetSpecificOptions } from \"../core\"\n\nexport interface SquirrelWindowsOptions extends TargetSpecificOptions {\n /**\n * A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon.\n *\n * Please note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.\n *\n * If you don't plan to build windows installer, you can omit it.\n * If your project repository is public on GitHub, it will be `https://github.com/${u}/${p}/blob/master/build/icon.ico?raw=true` by default.\n */\n readonly iconUrl?: string | null\n\n /**\n * The path to a .gif file to display during install. `build/install-spinner.gif` will be used if exists (it is a recommended way to set)\n * (otherwise [default](https://github.com/electron/windows-installer/blob/master/resources/install-spinner.gif)).\n */\n readonly loadingGif?: string | null\n\n /**\n * Whether to create an MSI installer. Defaults to `false` (MSI is not created).\n */\n readonly msi?: boolean\n\n /**\n * A URL to your existing updates. Or `true` to automatically set to your GitHub repository. If given, these will be downloaded to create delta updates.\n */\n readonly remoteReleases?: string | boolean | null\n\n /**\n * Authentication token for remote updates\n */\n readonly remoteToken?: string | null\n\n /**\n * Use `appId` to identify package instead of `name`.\n */\n readonly useAppIdAsId?: boolean\n\n /**\n * https://github.com/electron-userland/electron-builder/issues/1743\n * @private\n */\n readonly name?: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/linuxOptions.d.ts b/client/node_modules/app-builder-lib/out/options/linuxOptions.d.ts new file mode 100644 index 0000000000..3829b8b5dc --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/linuxOptions.d.ts @@ -0,0 +1,197 @@ +import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from "../index"; +export interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions { + /** + * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. + * + * electron-builder [docker image](/multi-platform-build#docker) can be used to build Linux targets on any platform. + * + * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz. + * @default AppImage + */ + readonly target?: TargetConfigType; + /** + * The maintainer. Defaults to [author](/configuration/configuration#Metadata-author). + */ + readonly maintainer?: string | null; + /** + * The vendor. Defaults to [author](/configuration/configuration#Metadata-author). + */ + readonly vendor?: string | null; + /** + * The path to icon set directory or one png file, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon. + * By default will be generated automatically based on the macOS icns file. + */ + readonly icon?: string; + /** + * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place + * @private + */ + readonly packageCategory?: string | null; +} +export interface CommonLinuxOptions { + /** + * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). + */ + readonly synopsis?: string | null; + /** + * As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux. + */ + readonly description?: string | null; + /** + * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry). + */ + readonly category?: string | null; + /** + * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing. + */ + readonly mimeTypes?: Array | null; + /** + * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value). + */ + readonly desktop?: any | null; + /** + * The executable parameters. Pass to executableName + */ + readonly executableArgs?: Array | null; +} +export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions { + /** + * Package dependencies. + */ + readonly depends?: Array | null; + /** + * The compression type. + * @default xz + */ + readonly compression?: "gz" | "bzip2" | "xz" | "lzo" | null; + readonly icon?: string; + /** + * The package category. + */ + readonly packageCategory?: string | null; + /** + * The name of the package. + */ + readonly packageName?: string | null; + readonly vendor?: string | null; + readonly maintainer?: string | null; + readonly afterInstall?: string | null; + readonly afterRemove?: string | null; + /** + * *Advanced only* The [fpm](https://github.com/jordansissel/fpm/wiki#usage) options. + * + * Example: `["--before-install=build/deb-preinstall.sh", "--after-upgrade=build/deb-postinstall.sh"]` + */ + readonly fpm?: Array | null; +} +export interface DebOptions extends LinuxTargetSpecificOptions { + /** + * Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`. + * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037). + * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used by GNOME](https://packages.debian.org/bullseye/gconf2). + */ + readonly depends?: Array | null; + /** + * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). + */ + readonly packageCategory?: string | null; + /** + * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute. + */ + readonly priority?: string | null; +} +export interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions { + /** + * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported. + */ + readonly license?: string | null; +} +export interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions { + /** + * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported. + */ + readonly license?: string | null; + /** + * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly runtime?: string; + /** + * The version of the runtime that the application uses. Defaults to `20.08`. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly runtimeVersion?: string; + /** + * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly sdk?: string; + /** + * Start with the files from the specified application. This can be used to create applications that extend another application. + * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp). + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly base?: string; + /** + * Use this specific version of the application specified in base. Defaults to `20.08`. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly baseVersion?: string; + /** + * The branch to use when exporting the application. Defaults to `master`. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly branch?: string; + /** + * An array of arguments passed to the flatpak build-finish command. Defaults to: + * ```json + * [ + * // Wayland/X11 Rendering + * "--socket=wayland", + * "--socket=x11", + * "--share=ipc", + * // Open GL + * "--device=dri", + * // Audio output + * "--socket=pulseaudio", + * // Read/write home directory access + * "--filesystem=home", + * // Allow communication with network + * "--share=network", + * // System notifications with libnotify + * "--talk-name=org.freedesktop.Notifications", + * ] + * ``` + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly finishArgs?: string[]; + /** + * An array of objects specifying the modules to be built in order. + * + * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest). + */ + readonly modules?: (string | any)[]; + /** + * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/). + * + * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options). + */ + readonly files?: [string, string][]; + /** + * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at. + * + * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options). + */ + readonly symlinks?: [string, string][]; + /** + * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`. + */ + readonly useWaylandFlags?: boolean; +} diff --git a/client/node_modules/app-builder-lib/out/options/linuxOptions.js b/client/node_modules/app-builder-lib/out/options/linuxOptions.js new file mode 100644 index 0000000000..1954671e30 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/linuxOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=linuxOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/linuxOptions.js.map b/client/node_modules/app-builder-lib/out/options/linuxOptions.js.map new file mode 100644 index 0000000000..4b90dec50e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/linuxOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"linuxOptions.js","sourceRoot":"","sources":["../../src/options/linuxOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from \"../index\"\n\nexport interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {\n /**\n * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n *\n * electron-builder [docker image](/multi-platform-build#docker) can be used to build Linux targets on any platform.\n *\n * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz.\n * @default AppImage\n */\n readonly target?: TargetConfigType\n\n /**\n * The maintainer. Defaults to [author](/configuration/configuration#Metadata-author).\n */\n readonly maintainer?: string | null\n\n /**\n * The vendor. Defaults to [author](/configuration/configuration#Metadata-author).\n */\n readonly vendor?: string | null\n\n /**\n * The path to icon set directory or one png file, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\n * By default will be generated automatically based on the macOS icns file.\n */\n readonly icon?: string\n\n /**\n * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place\n * @private\n */\n readonly packageCategory?: string | null\n}\n\nexport interface CommonLinuxOptions {\n /**\n * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).\n */\n readonly synopsis?: string | null\n\n /**\n * As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.\n */\n readonly description?: string | null\n\n /**\n * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).\n */\n readonly category?: string | null\n\n /**\n * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.\n */\n readonly mimeTypes?: Array | null\n\n /**\n * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value).\n */\n readonly desktop?: any | null\n\n /**\n * The executable parameters. Pass to executableName\n */\n readonly executableArgs?: Array | null\n}\n\n// fpm-only specific options\nexport interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * Package dependencies.\n */\n readonly depends?: Array | null\n\n /**\n * The compression type.\n * @default xz\n */\n readonly compression?: \"gz\" | \"bzip2\" | \"xz\" | \"lzo\" | null\n\n readonly icon?: string\n\n /**\n * The package category.\n */\n readonly packageCategory?: string | null\n\n /**\n * The name of the package.\n */\n readonly packageName?: string | null\n\n readonly vendor?: string | null\n readonly maintainer?: string | null\n\n readonly afterInstall?: string | null\n readonly afterRemove?: string | null\n\n /**\n * *Advanced only* The [fpm](https://github.com/jordansissel/fpm/wiki#usage) options.\n *\n * Example: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`\n */\n readonly fpm?: Array | null\n}\nexport interface DebOptions extends LinuxTargetSpecificOptions {\n /**\n * Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\n * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\n * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used by GNOME](https://packages.debian.org/bullseye/gconf2).\n */\n readonly depends?: Array | null\n\n /**\n * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).\n */\n readonly packageCategory?: string | null\n\n /**\n * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.\n */\n readonly priority?: string | null\n}\n\nexport interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n}\n\nexport interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n\n /**\n * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtime?: string\n\n /**\n * The version of the runtime that the application uses. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtimeVersion?: string\n\n /**\n * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly sdk?: string\n\n /**\n * Start with the files from the specified application. This can be used to create applications that extend another application.\n * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly base?: string\n\n /**\n * Use this specific version of the application specified in base. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly baseVersion?: string\n\n /**\n * The branch to use when exporting the application. Defaults to `master`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly branch?: string\n\n /**\n * An array of arguments passed to the flatpak build-finish command. Defaults to:\n * ```json\n * [\n * // Wayland/X11 Rendering\n * \"--socket=wayland\",\n * \"--socket=x11\",\n * \"--share=ipc\",\n * // Open GL\n * \"--device=dri\",\n * // Audio output\n * \"--socket=pulseaudio\",\n * // Read/write home directory access\n * \"--filesystem=home\",\n * // Allow communication with network\n * \"--share=network\",\n * // System notifications with libnotify\n * \"--talk-name=org.freedesktop.Notifications\",\n * ]\n * ```\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly finishArgs?: string[]\n\n /**\n * An array of objects specifying the modules to be built in order.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly modules?: (string | any)[]\n\n /**\n * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly files?: [string, string][]\n\n /**\n * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly symlinks?: [string, string][]\n\n /**\n * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.\n */\n readonly useWaylandFlags?: boolean\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/macOptions.d.ts b/client/node_modules/app-builder-lib/out/options/macOptions.d.ts new file mode 100644 index 0000000000..2a1c0161f5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/macOptions.d.ts @@ -0,0 +1,295 @@ +import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from "../index"; +export declare type MacOsTargetName = "default" | "dmg" | "mas" | "mas-dev" | "pkg" | "7z" | "zip" | "tar.xz" | "tar.lz" | "tar.gz" | "tar.bz2" | "dir"; +export interface MacConfiguration extends PlatformSpecificBuildOptions { + /** + * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory. + * + * For example, `"category": "public.app-category.developer-tools"` will set the application category to *Developer Tools*. + * + * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8). + */ + readonly category?: string | null; + /** + * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac). + */ + readonly target?: Array | MacOsTargetName | TargetConfiguration | null; + /** + * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option. + * MAS installer identity is specified in the [mas](/configuration/mas). + */ + readonly identity?: string | null; + /** + * The path to application icon. + * @default build/icon.icns + */ + readonly icon?: string | null; + /** + * The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set). + * MAS entitlements is specified in the [mas](/configuration/mas). + * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples. + * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+. + * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information. + */ + readonly entitlements?: string | null; + /** + * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set). + * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples. + * + * This option only applies when signing with `entitlements` provided. + */ + readonly entitlementsInherit?: string | null; + /** + * Path to login helper entitlement file. + * When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable. + * Defaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided. + */ + readonly entitlementsLoginHelper?: string | null; + /** + * The path to the provisioning profile to use when signing, absolute or relative to the app root. + */ + readonly provisioningProfile?: string | null; + /** + * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643). + */ + readonly bundleVersion?: string | null; + /** + * The `CFBundleShortVersionString`. Do not use it unless you need to. + */ + readonly bundleShortVersion?: string | null; + /** + * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting. + * @default false + */ + readonly darkModeSupport?: boolean; + /** + * The bundle identifier to use in the application helper's plist. + * @default ${appBundleIdentifier}.helper + */ + readonly helperBundleId?: string | null; + /** + * The bundle identifier to use in the Renderer helper's plist. + * @default ${appBundleIdentifier}.helper.Renderer + */ + readonly helperRendererBundleId?: string | null; + /** + * The bundle identifier to use in the Plugin helper's plist. + * @default ${appBundleIdentifier}.helper.Plugin + */ + readonly helperPluginBundleId?: string | null; + /** + * The bundle identifier to use in the GPU helper's plist. + * @default ${appBundleIdentifier}.helper.GPU + */ + readonly helperGPUBundleId?: string | null; + /** + * The bundle identifier to use in the EH helper's plist. + * @default ${appBundleIdentifier}.helper.EH + */ + readonly helperEHBundleId?: string | null; + /** + * The bundle identifier to use in the NP helper's plist. + * @default ${appBundleIdentifier}.helper.NP + */ + readonly helperNPBundleId?: string | null; + /** + * Whether to sign app for development or for distribution. + * @default distribution + */ + readonly type?: "distribution" | "development" | null; + /** + * The extra entries for `Info.plist`. + */ + readonly extendInfo?: any; + /** + * Paths of any extra binaries that need to be signed. + */ + readonly binaries?: Array | null; + /** + * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`. + */ + readonly minimumSystemVersion?: string | null; + /** + * Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS. + */ + readonly requirements?: string | null; + /** + * The electron locales. By default Electron locales used as is. + */ + readonly electronLanguages?: Array | string; + /** @private */ + readonly cscInstallerLink?: string | null; + /** @private */ + readonly cscInstallerKeyPassword?: string | null; + /** + * Extra files to put in archive. Not applicable for `tar.*`. + */ + readonly extraDistFiles?: Array | string | null; + /** + * Whether your app has to be signed with hardened runtime. + * @default true + */ + readonly hardenedRuntime?: boolean; + /** + * Whether to let electron-osx-sign validate the signing or not. + * @default false + */ + readonly gatekeeperAssess?: boolean; + /** + * Whether to let electron-osx-sign verify the contents or not. + * @default true + */ + readonly strictVerify?: Array | string | boolean; + /** + * Regex or an array of regex's that signal skipping signing a file. + */ + readonly signIgnore?: Array | string | null; + /** + * Specify the URL of the timestamp authority server + */ + readonly timestamp?: string | null; + /** + * Whether to merge ASAR files for different architectures or not. + * + * This option has no effect unless building for "universal" arch. + * @default true + */ + readonly mergeASARs?: boolean; + /** + * Minimatch pattern of paths that are allowed to be present in one of the + * ASAR files, but not in the other. + * + * This option has no effect unless building for "universal" arch and applies + * only if `mergeASARs` is `true`. + */ + readonly singleArchFiles?: string; + /** + * Minimatch pattern of paths that are allowed to be x64 binaries in both + * ASAR files + * + * This option has no effect unless building for "universal" arch and applies + * only if `mergeASARs` is `true`. + */ + readonly x64ArchFiles?: string; +} +export interface DmgOptions extends TargetSpecificOptions { + /** + * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window. + * If background is not specified, use `window.size`. Default locations expected background size to be 540x380. + * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191). + */ + background?: string | null; + /** + * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image. + */ + backgroundColor?: string | null; + /** + * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to the application icon (`build/icon.icns`). + */ + icon?: string | null; + /** + * The size of all the icons inside the DMG. + * @default 80 + */ + readonly iconSize?: number | null; + /** + * The size of all the icon texts inside the DMG. + * @default 12 + */ + readonly iconTextSize?: number | null; + /** + * The title of the produced DMG, which will be shown when mounted (volume name). + * + * Macro `${productName}`, `${version}` and `${name}` are supported. + * @default ${productName} ${version} + */ + readonly title?: string | null; + /** + * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account. + */ + contents?: Array; + /** + * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)). + * @default UDZO + */ + format?: "UDRW" | "UDRO" | "UDCO" | "UDZO" | "UDBZ" | "ULFO"; + /** + * The DMG window position and size. With y co-ordinates running from bottom to top. + * + * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `"x": 0, "y": 100000` as the x, y co-ordinates. + * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen. + */ + window?: DmgWindow; + /** + * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file). + * @default false + */ + readonly internetEnabled?: boolean; + /** + * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements. + * @default false + */ + readonly sign?: boolean; + /** + * @private + * @default true + */ + writeUpdateInfo?: boolean; +} +export interface DmgWindow { + /** + * The X position relative to left of the screen. + * @default 400 + */ + x?: number; + /** + * The Y position relative to bottom of the screen. + * @default 100 + */ + y?: number; + /** + * The width. Defaults to background image width or 540. + */ + width?: number; + /** + * The height. Defaults to background image height or 380. + */ + height?: number; +} +export interface DmgContent { + /** + * The device-independent pixel offset from the left of the window to the **center** of the icon. + */ + x: number; + /** + * The device-independent pixel offset from the top of the window to the **center** of the icon. + */ + y: number; + type?: "link" | "file" | "dir"; + /** + * The name of the file within the DMG. Defaults to basename of `path`. + */ + name?: string; + /** + * The path of the file within the DMG. + */ + path?: string; +} +export interface MasConfiguration extends MacConfiguration { + /** + * The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set). + * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples. + * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+. + * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information. + */ + readonly entitlements?: string | null; + /** + * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set). + * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples. + */ + readonly entitlementsInherit?: string | null; + /** + * Paths of any extra binaries that need to be signed. + */ + readonly binaries?: Array | null; +} diff --git a/client/node_modules/app-builder-lib/out/options/macOptions.js b/client/node_modules/app-builder-lib/out/options/macOptions.js new file mode 100644 index 0000000000..ec972e6c52 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/macOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=macOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/macOptions.js.map b/client/node_modules/app-builder-lib/out/options/macOptions.js.map new file mode 100644 index 0000000000..1669483bc1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/macOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"macOptions.js","sourceRoot":"","sources":["../../src/options/macOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from \"../index\"\n\nexport type MacOsTargetName = \"default\" | \"dmg\" | \"mas\" | \"mas-dev\" | \"pkg\" | \"7z\" | \"zip\" | \"tar.xz\" | \"tar.lz\" | \"tar.gz\" | \"tar.bz2\" | \"dir\"\n\nexport interface MacConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n *\n * For example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n *\n * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).\n */\n readonly category?: string | null\n\n /**\n * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac).\n */\n readonly target?: Array | MacOsTargetName | TargetConfiguration | null\n\n /**\n * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.\n * MAS installer identity is specified in the [mas](/configuration/mas).\n */\n readonly identity?: string | null\n\n /**\n * The path to application icon.\n * @default build/icon.icns\n */\n readonly icon?: string | null\n\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set).\n * MAS entitlements is specified in the [mas](/configuration/mas).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n *\n * This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Path to login helper entitlement file.\n * When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.\n * Defaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsLoginHelper?: string | null\n\n /**\n * The path to the provisioning profile to use when signing, absolute or relative to the app root.\n */\n readonly provisioningProfile?: string | null\n\n /**\n * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).\n */\n readonly bundleVersion?: string | null\n\n /**\n * The `CFBundleShortVersionString`. Do not use it unless you need to.\n */\n readonly bundleShortVersion?: string | null\n\n /**\n * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.\n * @default false\n */\n readonly darkModeSupport?: boolean\n\n /**\n * The bundle identifier to use in the application helper's plist.\n * @default ${appBundleIdentifier}.helper\n */\n readonly helperBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Renderer helper's plist.\n * @default ${appBundleIdentifier}.helper.Renderer\n */\n readonly helperRendererBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Plugin helper's plist.\n * @default ${appBundleIdentifier}.helper.Plugin\n */\n readonly helperPluginBundleId?: string | null\n\n /**\n * The bundle identifier to use in the GPU helper's plist.\n * @default ${appBundleIdentifier}.helper.GPU\n */\n readonly helperGPUBundleId?: string | null\n\n /**\n * The bundle identifier to use in the EH helper's plist.\n * @default ${appBundleIdentifier}.helper.EH\n */\n readonly helperEHBundleId?: string | null\n\n /**\n * The bundle identifier to use in the NP helper's plist.\n * @default ${appBundleIdentifier}.helper.NP\n */\n readonly helperNPBundleId?: string | null\n\n /**\n * Whether to sign app for development or for distribution.\n * @default distribution\n */\n readonly type?: \"distribution\" | \"development\" | null\n\n /**\n * The extra entries for `Info.plist`.\n */\n readonly extendInfo?: any\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array | null\n\n /**\n * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.\n */\n readonly minimumSystemVersion?: string | null\n\n /**\n * Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.\n */\n readonly requirements?: string | null\n\n /**\n * The electron locales. By default Electron locales used as is.\n */\n readonly electronLanguages?: Array | string\n\n /** @private */\n readonly cscInstallerLink?: string | null\n /** @private */\n readonly cscInstallerKeyPassword?: string | null\n\n /**\n * Extra files to put in archive. Not applicable for `tar.*`.\n */\n readonly extraDistFiles?: Array | string | null\n\n /**\n * Whether your app has to be signed with hardened runtime.\n * @default true\n */\n readonly hardenedRuntime?: boolean\n\n /**\n * Whether to let electron-osx-sign validate the signing or not.\n * @default false\n */\n readonly gatekeeperAssess?: boolean\n\n /**\n * Whether to let electron-osx-sign verify the contents or not.\n * @default true\n */\n readonly strictVerify?: Array | string | boolean\n\n /**\n * Regex or an array of regex's that signal skipping signing a file.\n */\n readonly signIgnore?: Array | string | null\n\n /**\n * Specify the URL of the timestamp authority server\n */\n readonly timestamp?: string | null\n\n /**\n * Whether to merge ASAR files for different architectures or not.\n *\n * This option has no effect unless building for \"universal\" arch.\n * @default true\n */\n readonly mergeASARs?: boolean\n\n /**\n * Minimatch pattern of paths that are allowed to be present in one of the\n * ASAR files, but not in the other.\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly singleArchFiles?: string\n\n /**\n * Minimatch pattern of paths that are allowed to be x64 binaries in both\n * ASAR files\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly x64ArchFiles?: string\n}\n\nexport interface DmgOptions extends TargetSpecificOptions {\n /**\n * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\n * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.\n * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).\n */\n background?: string | null\n\n /**\n * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.\n */\n backgroundColor?: string | null\n\n /**\n * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to the application icon (`build/icon.icns`).\n */\n icon?: string | null\n\n /**\n * The size of all the icons inside the DMG.\n * @default 80\n */\n readonly iconSize?: number | null\n\n /**\n * The size of all the icon texts inside the DMG.\n * @default 12\n */\n readonly iconTextSize?: number | null\n\n /**\n * The title of the produced DMG, which will be shown when mounted (volume name).\n *\n * Macro `${productName}`, `${version}` and `${name}` are supported.\n * @default ${productName} ${version}\n */\n readonly title?: string | null\n\n /**\n * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.\n */\n contents?: Array\n\n /**\n * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).\n * @default UDZO\n */\n format?: \"UDRW\" | \"UDRO\" | \"UDCO\" | \"UDZO\" | \"UDBZ\" | \"ULFO\"\n\n /**\n * The DMG window position and size. With y co-ordinates running from bottom to top.\n *\n * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\n * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.\n */\n window?: DmgWindow\n\n /**\n * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).\n * @default false\n */\n readonly internetEnabled?: boolean\n\n /**\n * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.\n * @default false\n */\n readonly sign?: boolean\n\n /**\n * @private\n * @default true\n */\n writeUpdateInfo?: boolean\n}\n\nexport interface DmgWindow {\n /**\n * The X position relative to left of the screen.\n * @default 400\n */\n x?: number\n\n /**\n * The Y position relative to bottom of the screen.\n * @default 100\n */\n y?: number\n\n /**\n * The width. Defaults to background image width or 540.\n */\n width?: number\n\n /**\n * The height. Defaults to background image height or 380.\n */\n height?: number\n}\n\nexport interface DmgContent {\n /**\n * The device-independent pixel offset from the left of the window to the **center** of the icon.\n */\n x: number\n /**\n * The device-independent pixel offset from the top of the window to the **center** of the icon.\n */\n y: number\n type?: \"link\" | \"file\" | \"dir\"\n\n /**\n * The name of the file within the DMG. Defaults to basename of `path`.\n */\n name?: string\n\n /**\n * The path of the file within the DMG.\n */\n path?: string\n}\n\nexport interface MasConfiguration extends MacConfiguration {\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/metadata.d.ts b/client/node_modules/app-builder-lib/out/options/metadata.d.ts new file mode 100644 index 0000000000..5ecfbdfe16 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/metadata.d.ts @@ -0,0 +1,52 @@ +import { Configuration } from "../configuration"; +export interface Metadata { + /** + * The application name. + * @required + */ + readonly name?: string; + /** + * The application description. + */ + readonly description?: string; + /** + * The url to the project [homepage](https://docs.npmjs.com/files/package.json#homepage) (NuGet Package `projectUrl` (optional) or Linux Package URL (required)). + * + * If not specified and your project repository is public on GitHub, it will be `https://github.com/${user}/${project}` by default. + */ + readonly homepage?: string | null; + /** + * *linux-only.* The [license](https://docs.npmjs.com/files/package.json#license) name. + */ + readonly license?: string | null; + readonly author?: AuthorMetadata | null; + /** + * The [repository](https://docs.npmjs.com/files/package.json#repository). + */ + readonly repository?: string | RepositoryInfo | null; + /** + * The electron-builder configuration. + */ + readonly build?: Configuration; + /** @private */ + readonly dependencies?: { + [key: string]: string; + }; + /** @private */ + readonly version?: string; + /** @private */ + readonly shortVersion?: string | null; + /** @private */ + readonly shortVersionWindows?: string | null; + /** @private */ + readonly productName?: string | null; + /** @private */ + readonly main?: string | null; +} +export interface AuthorMetadata { + readonly name: string; + readonly email?: string; +} +export interface RepositoryInfo { + readonly url: string; +} diff --git a/client/node_modules/app-builder-lib/out/options/metadata.js b/client/node_modules/app-builder-lib/out/options/metadata.js new file mode 100644 index 0000000000..53ddc111b7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/metadata.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/metadata.js.map b/client/node_modules/app-builder-lib/out/options/metadata.js.map new file mode 100644 index 0000000000..db71915fe4 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/options/metadata.ts"],"names":[],"mappings":"","sourcesContent":["import { Configuration } from \"../configuration\"\n\nexport interface Metadata {\n /**\n * The application name.\n * @required\n */\n readonly name?: string\n\n /**\n * The application description.\n */\n readonly description?: string\n\n /**\n * The url to the project [homepage](https://docs.npmjs.com/files/package.json#homepage) (NuGet Package `projectUrl` (optional) or Linux Package URL (required)).\n *\n * If not specified and your project repository is public on GitHub, it will be `https://github.com/${user}/${project}` by default.\n */\n readonly homepage?: string | null\n\n /**\n * *linux-only.* The [license](https://docs.npmjs.com/files/package.json#license) name.\n */\n readonly license?: string | null\n\n readonly author?: AuthorMetadata | null\n\n /**\n * The [repository](https://docs.npmjs.com/files/package.json#repository).\n */\n readonly repository?: string | RepositoryInfo | null\n\n /**\n * The electron-builder configuration.\n */\n readonly build?: Configuration\n\n /** @private */\n readonly dependencies?: { [key: string]: string }\n /** @private */\n readonly version?: string\n /** @private */\n readonly shortVersion?: string | null\n /** @private */\n readonly shortVersionWindows?: string | null\n /** @private */\n readonly productName?: string | null\n /** @private */\n readonly main?: string | null\n}\n\nexport interface AuthorMetadata {\n readonly name: string\n readonly email?: string\n}\n\nexport interface RepositoryInfo {\n readonly url: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/pkgOptions.d.ts b/client/node_modules/app-builder-lib/out/options/pkgOptions.d.ts new file mode 100644 index 0000000000..02c3fa86c5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/pkgOptions.d.ts @@ -0,0 +1,131 @@ +import { TargetSpecificOptions } from "../core"; +export declare type BackgroundAlignment = "center" | "left" | "right" | "top" | "bottom" | "topleft" | "topright" | "bottomleft" | "bottomright"; +export declare type BackgroundScaling = "tofit" | "none" | "proportional"; +/** + * macOS product archive options. + */ +export interface PkgOptions extends TargetSpecificOptions { + /** + * The scripts directory, relative to `build` (build resources directory). + * The scripts can be in any language so long as the files are marked executable and have the appropriate shebang indicating the path to the interpreter. + * Scripts are required to be executable (`chmod +x file`). + * @default build/pkg-scripts + * @see [Scripting in installer packages](http://macinstallers.blogspot.de/2012/07/scripting-in-installer-packages.html). + */ + readonly scripts?: string | null; + /** + * should be not documented, only to experiment + * @private + */ + readonly productbuild?: Array | null; + /** + * The install location. [Do not use it](https://stackoverflow.com/questions/12863944/how-do-you-specify-a-default-install-location-to-home-with-pkgbuild) to create per-user package. + * Mostly never you will need to change this option. `/Applications` would install it as expected into `/Applications` if the local system domain is chosen, or into `$HOME/Applications` if the home installation is chosen. + * @default /Applications + */ + readonly installLocation?: string | null; + /** + * Whether can be installed at the root of any volume, including non-system volumes. Otherwise, it cannot be installed at the root of a volume. + * + * Corresponds to [enable_anywhere](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70). + * @default true + */ + readonly allowAnywhere?: boolean | null; + /** + * Whether can be installed into the current user’s home directory. + * A home directory installation is done as the current user (not as root), and it cannot write outside of the home directory. + * If the product cannot be installed in the user’s home directory and be not completely functional from user’s home directory. + * + * Corresponds to [enable_currentUserHome](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70). + * @default true + */ + readonly allowCurrentUserHome?: boolean | null; + /** + * Whether can be installed into the root directory. Should usually be `true` unless the product can be installed only to the user’s home directory. + * + * Corresponds to [enable_localSystem](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70). + * @default true + */ + readonly allowRootDirectory?: boolean | null; + /** + * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option. + */ + readonly identity?: string | null; + /** + * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target="_blank"` for links). + */ + readonly license?: string | null; + /** + * Options for the background image for the installer. + */ + readonly background?: PkgBackgroundOptions | null; + /** + * The path to the welcome file. This may be used to customize the text on the Introduction page of the installer. + */ + readonly welcome?: string | null; + /** + * Identifies applications that must be closed before the package is installed. + * + * Corresponds to [must-close](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW77). + */ + readonly mustClose?: Array | null; + /** + * The path to the conclusion file. This may be used to customize the text on the final "Summary" page of the installer. + */ + readonly conclusion?: string | null; + /** + * Install bundle over previous version if moved by user? + * @default true + */ + readonly isRelocatable?: boolean | null; + /** + * Don't install bundle if newer version on disk? + * @default true + */ + readonly isVersionChecked?: boolean | null; + /** + * Require identical bundle identifiers at install path? + * @default true + */ + readonly hasStrictIdentifier?: boolean | null; + /** + * Specifies how an existing version of the bundle on disk should be handled when the version in + * the package is installed. + * + * If you specify upgrade, the bundle in the package atomi-cally replaces any version on disk; + * this has the effect of deleting old paths that no longer exist in the new version of + * the bundle. + * + * If you specify update, the bundle in the package overwrites the version on disk, and any files + * not contained in the package will be left intact; this is appropriate when you are delivering + * an update-only package. + * + * Another effect of update is that the package bundle will not be installed at all if there is + * not already a version on disk; this allows a package to deliver an update for an app that + * the user might have deleted. + * + * @default upgrade + */ + readonly overwriteAction?: "upgrade" | "update" | null; +} +/** + * Options for the background image in a PKG installer + */ +export interface PkgBackgroundOptions { + /** + * Path to the image to use as an installer background. + */ + file?: string; + /** + * Alignment of the background image. + * Options are: center, left, right, top, bottom, topleft, topright, bottomleft, bottomright + * @default center + */ + alignment?: BackgroundAlignment | null; + /** + * Scaling of the background image. + * Options are: tofit, none, proportional + * @default tofit + */ + scaling?: BackgroundScaling | null; +} diff --git a/client/node_modules/app-builder-lib/out/options/pkgOptions.js b/client/node_modules/app-builder-lib/out/options/pkgOptions.js new file mode 100644 index 0000000000..13249f2fd5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/pkgOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=pkgOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/pkgOptions.js.map b/client/node_modules/app-builder-lib/out/options/pkgOptions.js.map new file mode 100644 index 0000000000..ccffdd1155 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/pkgOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pkgOptions.js","sourceRoot":"","sources":["../../src/options/pkgOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\n\n// noinspection SpellCheckingInspection\nexport type BackgroundAlignment = \"center\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"topleft\" | \"topright\" | \"bottomleft\" | \"bottomright\"\n// noinspection SpellCheckingInspection\nexport type BackgroundScaling = \"tofit\" | \"none\" | \"proportional\"\n\n/**\n * macOS product archive options.\n */\nexport interface PkgOptions extends TargetSpecificOptions {\n /**\n * The scripts directory, relative to `build` (build resources directory).\n * The scripts can be in any language so long as the files are marked executable and have the appropriate shebang indicating the path to the interpreter.\n * Scripts are required to be executable (`chmod +x file`).\n * @default build/pkg-scripts\n * @see [Scripting in installer packages](http://macinstallers.blogspot.de/2012/07/scripting-in-installer-packages.html).\n */\n readonly scripts?: string | null\n\n /**\n * should be not documented, only to experiment\n * @private\n */\n readonly productbuild?: Array | null\n\n /**\n * The install location. [Do not use it](https://stackoverflow.com/questions/12863944/how-do-you-specify-a-default-install-location-to-home-with-pkgbuild) to create per-user package.\n * Mostly never you will need to change this option. `/Applications` would install it as expected into `/Applications` if the local system domain is chosen, or into `$HOME/Applications` if the home installation is chosen.\n * @default /Applications\n */\n readonly installLocation?: string | null\n\n /**\n * Whether can be installed at the root of any volume, including non-system volumes. Otherwise, it cannot be installed at the root of a volume.\n *\n * Corresponds to [enable_anywhere](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).\n * @default true\n */\n readonly allowAnywhere?: boolean | null\n\n /**\n * Whether can be installed into the current user’s home directory.\n * A home directory installation is done as the current user (not as root), and it cannot write outside of the home directory.\n * If the product cannot be installed in the user’s home directory and be not completely functional from user’s home directory.\n *\n * Corresponds to [enable_currentUserHome](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).\n * @default true\n */\n readonly allowCurrentUserHome?: boolean | null\n\n /**\n * Whether can be installed into the root directory. Should usually be `true` unless the product can be installed only to the user’s home directory.\n *\n * Corresponds to [enable_localSystem](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).\n * @default true\n */\n readonly allowRootDirectory?: boolean | null\n\n /**\n * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.\n */\n readonly identity?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n */\n readonly license?: string | null\n\n /**\n * Options for the background image for the installer.\n */\n readonly background?: PkgBackgroundOptions | null\n\n /**\n * The path to the welcome file. This may be used to customize the text on the Introduction page of the installer.\n */\n readonly welcome?: string | null\n\n /**\n * Identifies applications that must be closed before the package is installed.\n *\n * Corresponds to [must-close](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW77).\n */\n readonly mustClose?: Array | null\n\n /**\n * The path to the conclusion file. This may be used to customize the text on the final \"Summary\" page of the installer.\n */\n readonly conclusion?: string | null\n\n /**\n * Install bundle over previous version if moved by user?\n * @default true\n */\n readonly isRelocatable?: boolean | null\n\n /**\n * Don't install bundle if newer version on disk?\n * @default true\n */\n readonly isVersionChecked?: boolean | null\n\n /**\n * Require identical bundle identifiers at install path?\n * @default true\n */\n readonly hasStrictIdentifier?: boolean | null\n\n /**\n * Specifies how an existing version of the bundle on disk should be handled when the version in\n * the package is installed.\n *\n * If you specify upgrade, the bundle in the package atomi-cally replaces any version on disk;\n * this has the effect of deleting old paths that no longer exist in the new version of\n * the bundle.\n *\n * If you specify update, the bundle in the package overwrites the version on disk, and any files\n * not contained in the package will be left intact; this is appropriate when you are delivering\n * an update-only package.\n *\n * Another effect of update is that the package bundle will not be installed at all if there is\n * not already a version on disk; this allows a package to deliver an update for an app that\n * the user might have deleted.\n *\n * @default upgrade\n */\n readonly overwriteAction?: \"upgrade\" | \"update\" | null\n}\n\n/**\n * Options for the background image in a PKG installer\n */\nexport interface PkgBackgroundOptions {\n /**\n * Path to the image to use as an installer background.\n */\n file?: string\n\n /**\n * Alignment of the background image.\n * Options are: center, left, right, top, bottom, topleft, topright, bottomleft, bottomright\n * @default center\n */\n alignment?: BackgroundAlignment | null\n\n /**\n * Scaling of the background image.\n * Options are: tofit, none, proportional\n * @default tofit\n */\n scaling?: BackgroundScaling | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/winOptions.d.ts b/client/node_modules/app-builder-lib/out/options/winOptions.d.ts new file mode 100644 index 0000000000..5be1da6782 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/winOptions.d.ts @@ -0,0 +1,93 @@ +import { PlatformSpecificBuildOptions, TargetConfigType } from "../index"; +import { CustomWindowsSign } from "../codeSign/windowsCodeSign"; +export interface WindowsConfiguration extends PlatformSpecificBuildOptions { + /** + * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable](/configuration/nsis#portable) app without installation), `appx`, `msi`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. + * AppX package can be built only on Windows 10. + * + * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency. + * + * @default nsis + */ + readonly target?: TargetConfigType; + /** + * The path to application icon. + * @default build/icon.ico + */ + readonly icon?: string | null; + /** + * The trademarks and registered trademarks. + */ + readonly legalTrademarks?: string | null; + /** + * Array of signing algorithms used. For AppX `sha256` is always used. + * @default ['sha1', 'sha256'] + */ + readonly signingHashAlgorithms?: Array<"sha1" | "sha256"> | null; + /** + * The custom function (or path to file or module id) to sign Windows executable. + */ + readonly sign?: CustomWindowsSign | string | null; + /** + * The path to the *.pfx certificate you want to sign with. Please use it only if you cannot use env variable `CSC_LINK` (`WIN_CSC_LINK`) for some reason. + * Please see [Code Signing](/code-signing). + */ + readonly certificateFile?: string | null; + /** + * The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason. + * Please see [Code Signing](/code-signing). + */ + readonly certificatePassword?: string | null; + /** + * The name of the subject of the signing certificate, which is often labeled with the field name `issued to`. Required only for EV Code Signing and works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits). + */ + readonly certificateSubjectName?: string | null; + /** + * The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits). + */ + readonly certificateSha1?: string | null; + /** + * The path to an additional certificate file you want to add to the signature block. + */ + readonly additionalCertificateFile?: string | null; + /** + * The URL of the RFC 3161 time stamp server. + * @default http://timestamp.digicert.com + */ + readonly rfc3161TimeStampServer?: string | null; + /** + * The URL of the time stamp server. + * @default http://timestamp.digicert.com + */ + readonly timeStampServer?: string | null; + /** + * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided. + * Defaults to common name from your code signing certificate. + */ + readonly publisherName?: string | Array | null; + /** + * Whether to verify the signature of an available update before installation. + * The [publisher name](#publisherName) will be used for the signature verification. + * + * @default true + */ + readonly verifyUpdateCodeSignature?: boolean; + /** + * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed. + * Cannot be specified per target, allowed only in the `win`. + * @default asInvoker + */ + readonly requestedExecutionLevel?: RequestedExecutionLevel | null; + /** + * Whether to sign and add metadata to executable. Advanced option. + * @default true + */ + readonly signAndEditExecutable?: boolean; + /** + * Whether to sign DLL files. Advanced option. + * @see https://github.com/electron-userland/electron-builder/issues/3101#issuecomment-404212384 + * @default false + */ + readonly signDlls?: boolean; +} +export declare type RequestedExecutionLevel = "asInvoker" | "highestAvailable" | "requireAdministrator"; diff --git a/client/node_modules/app-builder-lib/out/options/winOptions.js b/client/node_modules/app-builder-lib/out/options/winOptions.js new file mode 100644 index 0000000000..afe3802302 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/winOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=winOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/options/winOptions.js.map b/client/node_modules/app-builder-lib/out/options/winOptions.js.map new file mode 100644 index 0000000000..ba09f12267 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/options/winOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType } from \"../index\"\nimport { CustomWindowsSign } from \"../codeSign/windowsCodeSign\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable](/configuration/nsis#portable) app without installation), `appx`, `msi`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX package can be built only on Windows 10.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Array of signing algorithms used. For AppX `sha256` is always used.\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n /**\n * The custom function (or path to file or module id) to sign Windows executable.\n */\n readonly sign?: CustomWindowsSign | string | null\n /**\n * The path to the *.pfx certificate you want to sign with. Please use it only if you cannot use env variable `CSC_LINK` (`WIN_CSC_LINK`) for some reason.\n * Please see [Code Signing](/code-signing).\n */\n readonly certificateFile?: string | null\n /**\n * The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason.\n * Please see [Code Signing](/code-signing).\n */\n readonly certificatePassword?: string | null\n /**\n * The name of the subject of the signing certificate, which is often labeled with the field name `issued to`. Required only for EV Code Signing and works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSubjectName?: string | null\n /**\n * The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSha1?: string | null\n /**\n * The path to an additional certificate file you want to add to the signature block.\n */\n readonly additionalCertificateFile?: string | null\n /**\n * The URL of the RFC 3161 time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n /**\n * The URL of the time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n * Defaults to common name from your code signing certificate.\n */\n readonly publisherName?: string | Array | null\n\n /**\n * Whether to verify the signature of an available update before installation.\n * The [publisher name](#publisherName) will be used for the signature verification.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Whether to sign and add metadata to executable. Advanced option.\n * @default true\n */\n readonly signAndEditExecutable?: boolean\n\n /**\n * Whether to sign DLL files. Advanced option.\n * @see https://github.com/electron-userland/electron-builder/issues/3101#issuecomment-404212384\n * @default false\n */\n readonly signDlls?: boolean\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/packager.d.ts b/client/node_modules/app-builder-lib/out/packager.d.ts new file mode 100644 index 0000000000..4ceafe1d79 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packager.d.ts @@ -0,0 +1,73 @@ +/// +import { Arch, DebugLogger, TmpDir } from "builder-util"; +import { CancellationToken } from "builder-util-runtime"; +import { EventEmitter } from "events"; +import { Lazy } from "lazy-val"; +import { AppInfo } from "./appInfo"; +import { AfterPackContext, Configuration } from "./configuration"; +import { Platform, SourceRepositoryInfo, Target } from "./core"; +import { Framework } from "./Framework"; +import { Metadata } from "./options/metadata"; +import { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from "./packagerApi"; +import { PlatformPackager } from "./platformPackager"; +import { NodeModuleDirInfo } from "./util/packageDependencies"; +export declare class Packager { + readonly cancellationToken: CancellationToken; + readonly projectDir: string; + private _appDir; + get appDir(): string; + private _metadata; + get metadata(): Metadata; + private _nodeModulesHandledExternally; + get areNodeModulesHandledExternally(): boolean; + private _isPrepackedAppAsar; + get isPrepackedAppAsar(): boolean; + private _devMetadata; + get devMetadata(): Metadata | null; + private _configuration; + get config(): Configuration; + isTwoPackageJsonProjectLayoutUsed: boolean; + readonly eventEmitter: EventEmitter; + _appInfo: AppInfo | null; + get appInfo(): AppInfo; + readonly tempDirManager: TmpDir; + private _repositoryInfo; + private readonly afterPackHandlers; + readonly options: PackagerOptions; + readonly debugLogger: DebugLogger; + get repositoryInfo(): Promise; + private nodeDependencyInfo; + getNodeDependencyInfo(platform: Platform | null): Lazy>; + stageDirPathCustomizer: (target: Target, packager: PlatformPackager, arch: Arch) => string; + private _buildResourcesDir; + get buildResourcesDir(): string; + get relativeBuildResourcesDirname(): string; + private _framework; + get framework(): Framework; + private readonly toDispose; + disposeOnBuildFinish(disposer: () => Promise): void; + constructor(options: PackagerOptions, cancellationToken?: CancellationToken); + addAfterPackHandler(handler: (context: AfterPackContext) => Promise | null): void; + artifactCreated(handler: (event: ArtifactCreated) => void): Packager; + callArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any): Promise; + /** + * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`. + */ + dispatchArtifactCreated(event: ArtifactCreated): void; + callArtifactBuildCompleted(event: ArtifactCreated): Promise; + callAppxManifestCreated(path: string): Promise; + callMsiProjectCreated(path: string): Promise; + build(): Promise; + _build(configuration: Configuration, metadata: Metadata, devMetadata: Metadata | null, repositoryInfo?: SourceRepositoryInfo): Promise; + private readProjectMetadataIfTwoPackageStructureOrPrepacked; + private doBuild; + private createHelper; + installAppDependencies(platform: Platform, arch: Arch): Promise; + afterPack(context: AfterPackContext): Promise; +} +export interface BuildResult { + readonly outDir: string; + readonly artifactPaths: Array; + readonly platformToTargets: Map>; + readonly configuration: Configuration; +} diff --git a/client/node_modules/app-builder-lib/out/packager.js b/client/node_modules/app-builder-lib/out/packager.js new file mode 100644 index 0000000000..6cbacb9c1f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packager.js @@ -0,0 +1,472 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Packager = void 0; +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const promise_1 = require("builder-util/out/promise"); +const events_1 = require("events"); +const fs_extra_1 = require("fs-extra"); +const isCI = require("is-ci"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const arch_1 = require("builder-util/out/arch"); +const appInfo_1 = require("./appInfo"); +const asar_1 = require("./asar/asar"); +const core_1 = require("./core"); +const ElectronFramework_1 = require("./electron/ElectronFramework"); +const LibUiFramework_1 = require("./frameworks/LibUiFramework"); +const platformPackager_1 = require("./platformPackager"); +const ProtonFramework_1 = require("./ProtonFramework"); +const targetFactory_1 = require("./targets/targetFactory"); +const config_1 = require("./util/config"); +const macroExpander_1 = require("./util/macroExpander"); +const packageDependencies_1 = require("./util/packageDependencies"); +const packageMetadata_1 = require("./util/packageMetadata"); +const repositoryInfo_1 = require("./util/repositoryInfo"); +const yarn_1 = require("./util/yarn"); +const version_1 = require("./version"); +const os_1 = require("os"); +function addHandler(emitter, event, handler) { + emitter.on(event, handler); +} +async function createFrameworkInfo(configuration, packager) { + let framework = configuration.framework; + if (framework != null) { + framework = framework.toLowerCase(); + } + let nodeVersion = configuration.nodeVersion; + if (framework === "electron" || framework == null) { + return await ElectronFramework_1.createElectronFrameworkSupport(configuration, packager); + } + if (nodeVersion == null || nodeVersion === "current") { + nodeVersion = process.versions.node; + } + const distMacOsName = `${packager.appInfo.productFilename}.app`; + const isUseLaunchUi = configuration.launchUiVersion !== false; + if (framework === "proton" || framework === "proton-native") { + return new ProtonFramework_1.ProtonFramework(nodeVersion, distMacOsName, isUseLaunchUi); + } + else if (framework === "libui") { + return new LibUiFramework_1.LibUiFramework(nodeVersion, distMacOsName, isUseLaunchUi); + } + else { + throw new builder_util_1.InvalidConfigurationError(`Unknown framework: ${framework}`); + } +} +class Packager { + //noinspection JSUnusedGlobalSymbols + constructor(options, cancellationToken = new builder_util_runtime_1.CancellationToken()) { + this.cancellationToken = cancellationToken; + this._metadata = null; + this._nodeModulesHandledExternally = false; + this._isPrepackedAppAsar = false; + this._devMetadata = null; + this._configuration = null; + this.isTwoPackageJsonProjectLayoutUsed = false; + this.eventEmitter = new events_1.EventEmitter(); + this._appInfo = null; + this.tempDirManager = new builder_util_1.TmpDir("packager"); + this._repositoryInfo = new lazy_val_1.Lazy(() => repositoryInfo_1.getRepositoryInfo(this.projectDir, this.metadata, this.devMetadata)); + this.afterPackHandlers = []; + this.debugLogger = new builder_util_1.DebugLogger(builder_util_1.log.isDebugEnabled); + this.nodeDependencyInfo = new Map(); + this.stageDirPathCustomizer = (target, packager, arch) => { + return path.join(target.outDir, `__${target.name}-${arch_1.getArtifactArchName(arch, target.name)}`); + }; + this._buildResourcesDir = null; + this._framework = null; + this.toDispose = []; + if ("devMetadata" in options) { + throw new builder_util_1.InvalidConfigurationError("devMetadata in the options is deprecated, please use config instead"); + } + if ("extraMetadata" in options) { + throw new builder_util_1.InvalidConfigurationError("extraMetadata in the options is deprecated, please use config.extraMetadata instead"); + } + const targets = options.targets || new Map(); + if (options.targets == null) { + options.targets = targets; + } + function processTargets(platform, types) { + function commonArch(currentIfNotSpecified) { + const result = Array(); + return result.length === 0 && currentIfNotSpecified ? [builder_util_1.archFromString(process.arch)] : result; + } + let archToType = targets.get(platform); + if (archToType == null) { + archToType = new Map(); + targets.set(platform, archToType); + } + if (types.length === 0) { + for (const arch of commonArch(false)) { + archToType.set(arch, []); + } + return; + } + for (const type of types) { + const suffixPos = type.lastIndexOf(":"); + if (suffixPos > 0) { + builder_util_1.addValue(archToType, builder_util_1.archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos)); + } + else { + for (const arch of commonArch(true)) { + builder_util_1.addValue(archToType, arch, type); + } + } + } + } + if (options.mac != null) { + processTargets(core_1.Platform.MAC, options.mac); + } + if (options.linux != null) { + processTargets(core_1.Platform.LINUX, options.linux); + } + if (options.win != null) { + processTargets(core_1.Platform.WINDOWS, options.win); + } + this.projectDir = options.projectDir == null ? process.cwd() : path.resolve(options.projectDir); + this._appDir = this.projectDir; + this.options = { + ...options, + prepackaged: options.prepackaged == null ? null : path.resolve(this.projectDir, options.prepackaged), + }; + try { + builder_util_1.log.info({ version: version_1.PACKAGE_VERSION, os: os_1.release() }, "electron-builder"); + } + catch (e) { + // error in dev mode without babel + if (!(e instanceof ReferenceError)) { + throw e; + } + } + } + get appDir() { + return this._appDir; + } + get metadata() { + return this._metadata; + } + get areNodeModulesHandledExternally() { + return this._nodeModulesHandledExternally; + } + get isPrepackedAppAsar() { + return this._isPrepackedAppAsar; + } + get devMetadata() { + return this._devMetadata; + } + get config() { + return this._configuration; + } + get appInfo() { + return this._appInfo; + } + get repositoryInfo() { + return this._repositoryInfo.value; + } + getNodeDependencyInfo(platform) { + let key = ""; + let excludedDependencies = null; + if (platform != null && this.framework.getExcludedDependencies != null) { + excludedDependencies = this.framework.getExcludedDependencies(platform); + if (excludedDependencies != null) { + key += `-${platform.name}`; + } + } + let result = this.nodeDependencyInfo.get(key); + if (result == null) { + result = packageDependencies_1.createLazyProductionDeps(this.appDir, excludedDependencies); + this.nodeDependencyInfo.set(key, result); + } + return result; + } + get buildResourcesDir() { + let result = this._buildResourcesDir; + if (result == null) { + result = path.resolve(this.projectDir, this.relativeBuildResourcesDirname); + this._buildResourcesDir = result; + } + return result; + } + get relativeBuildResourcesDirname() { + return this.config.directories.buildResources; + } + get framework() { + return this._framework; + } + disposeOnBuildFinish(disposer) { + this.toDispose.push(disposer); + } + addAfterPackHandler(handler) { + this.afterPackHandlers.push(handler); + } + artifactCreated(handler) { + addHandler(this.eventEmitter, "artifactCreated", handler); + return this; + } + async callArtifactBuildStarted(event, logFields) { + builder_util_1.log.info(logFields || { + target: event.targetPresentableName, + arch: event.arch == null ? null : builder_util_1.Arch[event.arch], + file: builder_util_1.log.filePath(event.file), + }, "building"); + const handler = platformPackager_1.resolveFunction(this.config.artifactBuildStarted, "artifactBuildStarted"); + if (handler != null) { + await Promise.resolve(handler(event)); + } + } + /** + * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`. + */ + dispatchArtifactCreated(event) { + this.eventEmitter.emit("artifactCreated", event); + } + async callArtifactBuildCompleted(event) { + const handler = platformPackager_1.resolveFunction(this.config.artifactBuildCompleted, "artifactBuildCompleted"); + if (handler != null) { + await Promise.resolve(handler(event)); + } + this.dispatchArtifactCreated(event); + } + async callAppxManifestCreated(path) { + const handler = platformPackager_1.resolveFunction(this.config.appxManifestCreated, "appxManifestCreated"); + if (handler != null) { + await Promise.resolve(handler(path)); + } + } + async callMsiProjectCreated(path) { + const handler = platformPackager_1.resolveFunction(this.config.msiProjectCreated, "msiProjectCreated"); + if (handler != null) { + await Promise.resolve(handler(path)); + } + } + async build() { + let configPath = null; + let configFromOptions = this.options.config; + if (typeof configFromOptions === "string") { + // it is a path to config file + configPath = configFromOptions; + configFromOptions = null; + } + else if (configFromOptions != null && typeof configFromOptions.extends === "string" && configFromOptions.extends.includes(".")) { + configPath = configFromOptions.extends; + delete configFromOptions.extends; + } + const projectDir = this.projectDir; + const devPackageFile = path.join(projectDir, "package.json"); + this._devMetadata = await promise_1.orNullIfFileNotExist(packageMetadata_1.readPackageJson(devPackageFile)); + const devMetadata = this.devMetadata; + const configuration = await config_1.getConfig(projectDir, configPath, configFromOptions, new lazy_val_1.Lazy(() => Promise.resolve(devMetadata))); + if (builder_util_1.log.isDebugEnabled) { + builder_util_1.log.debug({ config: getSafeEffectiveConfig(configuration) }, "effective config"); + } + this._appDir = await config_1.computeDefaultAppDirectory(projectDir, configuration.directories.app); + this.isTwoPackageJsonProjectLayoutUsed = this._appDir !== projectDir; + const appPackageFile = this.isTwoPackageJsonProjectLayoutUsed ? path.join(this.appDir, "package.json") : devPackageFile; + // tslint:disable:prefer-conditional-expression + if (this.devMetadata != null && !this.isTwoPackageJsonProjectLayoutUsed) { + this._metadata = this.devMetadata; + } + else { + this._metadata = await this.readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile); + } + builder_util_1.deepAssign(this.metadata, configuration.extraMetadata); + if (this.isTwoPackageJsonProjectLayoutUsed) { + builder_util_1.log.debug({ devPackageFile, appPackageFile }, "two package.json structure is used"); + } + packageMetadata_1.checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile); + return await this._build(configuration, this._metadata, this._devMetadata); + } + // external caller of this method always uses isTwoPackageJsonProjectLayoutUsed=false and appDir=projectDir, no way (and need) to use another values + async _build(configuration, metadata, devMetadata, repositoryInfo) { + await config_1.validateConfig(configuration, this.debugLogger); + this._configuration = configuration; + this._metadata = metadata; + this._devMetadata = devMetadata; + if (repositoryInfo != null) { + this._repositoryInfo.value = Promise.resolve(repositoryInfo); + } + this._appInfo = new appInfo_1.AppInfo(this, null); + this._framework = await createFrameworkInfo(this.config, this); + const commonOutDirWithoutPossibleOsMacro = path.resolve(this.projectDir, macroExpander_1.expandMacro(configuration.directories.output, null, this._appInfo, { + os: "", + })); + if (!isCI && process.stdout.isTTY) { + const effectiveConfigFile = path.join(commonOutDirWithoutPossibleOsMacro, "builder-effective-config.yaml"); + builder_util_1.log.info({ file: builder_util_1.log.filePath(effectiveConfigFile) }, "writing effective config"); + await fs_extra_1.outputFile(effectiveConfigFile, getSafeEffectiveConfig(configuration)); + } + // because artifact event maybe dispatched several times for different publish providers + const artifactPaths = new Set(); + this.artifactCreated(event => { + if (event.file != null) { + artifactPaths.add(event.file); + } + }); + this.disposeOnBuildFinish(() => this.tempDirManager.cleanup()); + const platformToTargets = await promise_1.executeFinally(this.doBuild(), async () => { + if (this.debugLogger.isEnabled) { + await this.debugLogger.save(path.join(commonOutDirWithoutPossibleOsMacro, "builder-debug.yml")); + } + const toDispose = this.toDispose.slice(); + this.toDispose.length = 0; + for (const disposer of toDispose) { + await disposer().catch(e => { + builder_util_1.log.warn({ error: e }, "cannot dispose"); + }); + } + }); + return { + outDir: commonOutDirWithoutPossibleOsMacro, + artifactPaths: Array.from(artifactPaths), + platformToTargets, + configuration, + }; + } + async readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile) { + let data = await promise_1.orNullIfFileNotExist(packageMetadata_1.readPackageJson(appPackageFile)); + if (data != null) { + return data; + } + data = await promise_1.orNullIfFileNotExist(asar_1.readAsarJson(path.join(this.projectDir, "app.asar"), "package.json")); + if (data != null) { + this._isPrepackedAppAsar = true; + return data; + } + throw new Error(`Cannot find package.json in the ${path.dirname(appPackageFile)}`); + } + async doBuild() { + const taskManager = new builder_util_1.AsyncTaskManager(this.cancellationToken); + const platformToTarget = new Map(); + const createdOutDirs = new Set(); + for (const [platform, archToType] of this.options.targets) { + if (this.cancellationToken.cancelled) { + break; + } + if (platform === core_1.Platform.MAC && process.platform === core_1.Platform.WINDOWS.nodeName) { + throw new builder_util_1.InvalidConfigurationError("Build for macOS is supported only on macOS, please see https://electron.build/multi-platform-build"); + } + const packager = await this.createHelper(platform); + const nameToTarget = new Map(); + platformToTarget.set(platform, nameToTarget); + for (const [arch, targetNames] of targetFactory_1.computeArchToTargetNamesMap(archToType, packager, platform)) { + if (this.cancellationToken.cancelled) { + break; + } + // support os and arch macro in output value + const outDir = path.resolve(this.projectDir, packager.expandMacro(this._configuration.directories.output, builder_util_1.Arch[arch])); + const targetList = targetFactory_1.createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager); + await createOutDirIfNeed(targetList, createdOutDirs); + await packager.pack(outDir, arch, targetList, taskManager); + } + if (this.cancellationToken.cancelled) { + break; + } + for (const target of nameToTarget.values()) { + taskManager.addTask(target.finishBuild()); + } + } + await taskManager.awaitTasks(); + return platformToTarget; + } + async createHelper(platform) { + if (this.options.platformPackagerFactory != null) { + return this.options.platformPackagerFactory(this, platform); + } + switch (platform) { + case core_1.Platform.MAC: { + const helperClass = (await Promise.resolve().then(() => require("./macPackager"))).default; + return new helperClass(this); + } + case core_1.Platform.WINDOWS: { + const helperClass = (await Promise.resolve().then(() => require("./winPackager"))).WinPackager; + return new helperClass(this); + } + case core_1.Platform.LINUX: + return new (await Promise.resolve().then(() => require("./linuxPackager"))).LinuxPackager(this); + default: + throw new Error(`Unknown platform: ${platform}`); + } + } + async installAppDependencies(platform, arch) { + if (this.options.prepackaged != null || !this.framework.isNpmRebuildRequired) { + return; + } + const frameworkInfo = { version: this.framework.version, useCustomDist: true }; + const config = this.config; + if (config.nodeGypRebuild === true) { + await yarn_1.nodeGypRebuild(platform.nodeName, builder_util_1.Arch[arch], frameworkInfo); + } + if (config.npmRebuild === false) { + builder_util_1.log.info({ reason: "npmRebuild is set to false" }, "skipped dependencies rebuild"); + return; + } + const beforeBuild = platformPackager_1.resolveFunction(config.beforeBuild, "beforeBuild"); + if (beforeBuild != null) { + const performDependenciesInstallOrRebuild = await beforeBuild({ + appDir: this.appDir, + electronVersion: this.config.electronVersion, + platform, + arch: builder_util_1.Arch[arch], + }); + // If beforeBuild resolves to false, it means that handling node_modules is done outside of electron-builder. + this._nodeModulesHandledExternally = !performDependenciesInstallOrRebuild; + if (!performDependenciesInstallOrRebuild) { + return; + } + } + if (config.buildDependenciesFromSource === true && platform.nodeName !== process.platform) { + builder_util_1.log.info({ reason: "platform is different and buildDependenciesFromSource is set to true" }, "skipped dependencies rebuild"); + } + else { + await yarn_1.installOrRebuild(config, this.appDir, { + frameworkInfo, + platform: platform.nodeName, + arch: builder_util_1.Arch[arch], + productionDeps: this.getNodeDependencyInfo(null), + }); + } + } + async afterPack(context) { + const afterPack = platformPackager_1.resolveFunction(this.config.afterPack, "afterPack"); + const handlers = this.afterPackHandlers.slice(); + if (afterPack != null) { + // user handler should be last + handlers.push(afterPack); + } + for (const handler of handlers) { + await Promise.resolve(handler(context)); + } + } +} +exports.Packager = Packager; +function createOutDirIfNeed(targetList, createdOutDirs) { + const ourDirs = new Set(); + for (const target of targetList) { + // noinspection SuspiciousInstanceOfGuard + if (target instanceof targetFactory_1.NoOpTarget) { + continue; + } + const outDir = target.outDir; + if (!createdOutDirs.has(outDir)) { + ourDirs.add(outDir); + } + } + if (ourDirs.size === 0) { + return Promise.resolve(); + } + return Promise.all(Array.from(ourDirs) + .sort() + .map(dir => { + return fs_extra_1.mkdirs(dir) + .then(() => fs_extra_1.chmod(dir, 0o755) /* set explicitly */) + .then(() => createdOutDirs.add(dir)); + })); +} +function getSafeEffectiveConfig(configuration) { + const o = JSON.parse(builder_util_1.safeStringifyJson(configuration)); + if (o.cscLink != null) { + o.cscLink = ""; + } + return builder_util_1.serializeToYaml(o, true); +} +//# sourceMappingURL=packager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/packager.js.map b/client/node_modules/app-builder-lib/out/packager.js.map new file mode 100644 index 0000000000..4c3e4589f5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"packager.js","sourceRoot":"","sources":["../src/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G,MAAM,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;SACpB;KACF;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;KACzB;IAED,OAAO,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;SAChB,IAAI,EAAE;SACN,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,iBAAM,CAAC,GAAG,CAAC;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,oBAAoB,CAAC;aAClD,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CACL,CAAA;AACH,CAAC;AASD,SAAS,sBAAsB,CAAC,aAA4B;IAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,gCAAiB,CAAC,aAAa,CAAC,CAAC,CAAA;IACtD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,EAAE;QACrB,CAAC,CAAC,OAAO,GAAG,qBAAqB,CAAA;KAClC;IACD,OAAO,8BAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import { addValue, Arch, archFromString, AsyncTaskManager, DebugLogger, deepAssign, InvalidConfigurationError, log, safeStringifyJson, serializeToYaml, TmpDir } from \"builder-util\"\nimport { CancellationToken } from \"builder-util-runtime\"\nimport { executeFinally, orNullIfFileNotExist } from \"builder-util/out/promise\"\nimport { EventEmitter } from \"events\"\nimport { mkdirs, chmod, outputFile } from \"fs-extra\"\nimport * as isCI from \"is-ci\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { getArtifactArchName } from \"builder-util/out/arch\"\nimport { AppInfo } from \"./appInfo\"\nimport { readAsarJson } from \"./asar/asar\"\nimport { AfterPackContext, Configuration } from \"./configuration\"\nimport { Platform, SourceRepositoryInfo, Target } from \"./core\"\nimport { createElectronFrameworkSupport } from \"./electron/ElectronFramework\"\nimport { Framework } from \"./Framework\"\nimport { LibUiFramework } from \"./frameworks/LibUiFramework\"\nimport { Metadata } from \"./options/metadata\"\nimport { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from \"./packagerApi\"\nimport { PlatformPackager, resolveFunction } from \"./platformPackager\"\nimport { ProtonFramework } from \"./ProtonFramework\"\nimport { computeArchToTargetNamesMap, createTargets, NoOpTarget } from \"./targets/targetFactory\"\nimport { computeDefaultAppDirectory, getConfig, validateConfig } from \"./util/config\"\nimport { expandMacro } from \"./util/macroExpander\"\nimport { createLazyProductionDeps, NodeModuleDirInfo } from \"./util/packageDependencies\"\nimport { checkMetadata, readPackageJson } from \"./util/packageMetadata\"\nimport { getRepositoryInfo } from \"./util/repositoryInfo\"\nimport { installOrRebuild, nodeGypRebuild } from \"./util/yarn\"\nimport { PACKAGE_VERSION } from \"./version\"\nimport { release as getOsRelease } from \"os\"\n\nfunction addHandler(emitter: EventEmitter, event: string, handler: (...args: Array) => void) {\n emitter.on(event, handler)\n}\n\nasync function createFrameworkInfo(configuration: Configuration, packager: Packager): Promise {\n let framework = configuration.framework\n if (framework != null) {\n framework = framework.toLowerCase()\n }\n\n let nodeVersion = configuration.nodeVersion\n if (framework === \"electron\" || framework == null) {\n return await createElectronFrameworkSupport(configuration, packager)\n }\n\n if (nodeVersion == null || nodeVersion === \"current\") {\n nodeVersion = process.versions.node\n }\n\n const distMacOsName = `${packager.appInfo.productFilename}.app`\n const isUseLaunchUi = configuration.launchUiVersion !== false\n if (framework === \"proton\" || framework === \"proton-native\") {\n return new ProtonFramework(nodeVersion, distMacOsName, isUseLaunchUi)\n } else if (framework === \"libui\") {\n return new LibUiFramework(nodeVersion, distMacOsName, isUseLaunchUi)\n } else {\n throw new InvalidConfigurationError(`Unknown framework: ${framework}`)\n }\n}\n\nexport class Packager {\n readonly projectDir: string\n\n private _appDir: string\n get appDir(): string {\n return this._appDir\n }\n\n private _metadata: Metadata | null = null\n get metadata(): Metadata {\n return this._metadata!\n }\n\n private _nodeModulesHandledExternally = false\n\n get areNodeModulesHandledExternally(): boolean {\n return this._nodeModulesHandledExternally\n }\n\n private _isPrepackedAppAsar = false\n\n get isPrepackedAppAsar(): boolean {\n return this._isPrepackedAppAsar\n }\n\n private _devMetadata: Metadata | null = null\n get devMetadata(): Metadata | null {\n return this._devMetadata\n }\n\n private _configuration: Configuration | null = null\n\n get config(): Configuration {\n return this._configuration!\n }\n\n isTwoPackageJsonProjectLayoutUsed = false\n\n readonly eventEmitter = new EventEmitter()\n\n _appInfo: AppInfo | null = null\n get appInfo(): AppInfo {\n return this._appInfo!\n }\n\n readonly tempDirManager = new TmpDir(\"packager\")\n\n private _repositoryInfo = new Lazy(() => getRepositoryInfo(this.projectDir, this.metadata, this.devMetadata))\n\n private readonly afterPackHandlers: Array<(context: AfterPackContext) => Promise | null> = []\n\n readonly options: PackagerOptions\n\n readonly debugLogger = new DebugLogger(log.isDebugEnabled)\n\n get repositoryInfo(): Promise {\n return this._repositoryInfo.value\n }\n\n private nodeDependencyInfo = new Map>>()\n\n getNodeDependencyInfo(platform: Platform | null): Lazy> {\n let key = \"\"\n let excludedDependencies: Array | null = null\n if (platform != null && this.framework.getExcludedDependencies != null) {\n excludedDependencies = this.framework.getExcludedDependencies(platform)\n if (excludedDependencies != null) {\n key += `-${platform.name}`\n }\n }\n\n let result = this.nodeDependencyInfo.get(key)\n if (result == null) {\n result = createLazyProductionDeps(this.appDir, excludedDependencies)\n this.nodeDependencyInfo.set(key, result)\n }\n return result\n }\n\n stageDirPathCustomizer: (target: Target, packager: PlatformPackager, arch: Arch) => string = (target, packager, arch) => {\n return path.join(target.outDir, `__${target.name}-${getArtifactArchName(arch, target.name)}`)\n }\n\n private _buildResourcesDir: string | null = null\n\n get buildResourcesDir(): string {\n let result = this._buildResourcesDir\n if (result == null) {\n result = path.resolve(this.projectDir, this.relativeBuildResourcesDirname)\n this._buildResourcesDir = result\n }\n return result\n }\n\n get relativeBuildResourcesDirname(): string {\n return this.config.directories!.buildResources!\n }\n\n private _framework: Framework | null = null\n get framework(): Framework {\n return this._framework!\n }\n\n private readonly toDispose: Array<() => Promise> = []\n\n disposeOnBuildFinish(disposer: () => Promise) {\n this.toDispose.push(disposer)\n }\n\n //noinspection JSUnusedGlobalSymbols\n constructor(options: PackagerOptions, readonly cancellationToken = new CancellationToken()) {\n if (\"devMetadata\" in options) {\n throw new InvalidConfigurationError(\"devMetadata in the options is deprecated, please use config instead\")\n }\n if (\"extraMetadata\" in options) {\n throw new InvalidConfigurationError(\"extraMetadata in the options is deprecated, please use config.extraMetadata instead\")\n }\n\n const targets = options.targets || new Map>>()\n if (options.targets == null) {\n options.targets = targets\n }\n\n function processTargets(platform: Platform, types: Array) {\n function commonArch(currentIfNotSpecified: boolean): Array {\n const result = Array()\n return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result\n }\n\n let archToType = targets.get(platform)\n if (archToType == null) {\n archToType = new Map>()\n targets.set(platform, archToType)\n }\n\n if (types.length === 0) {\n for (const arch of commonArch(false)) {\n archToType.set(arch, [])\n }\n return\n }\n\n for (const type of types) {\n const suffixPos = type.lastIndexOf(\":\")\n if (suffixPos > 0) {\n addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))\n } else {\n for (const arch of commonArch(true)) {\n addValue(archToType, arch, type)\n }\n }\n }\n }\n\n if (options.mac != null) {\n processTargets(Platform.MAC, options.mac)\n }\n if (options.linux != null) {\n processTargets(Platform.LINUX, options.linux)\n }\n if (options.win != null) {\n processTargets(Platform.WINDOWS, options.win)\n }\n\n this.projectDir = options.projectDir == null ? process.cwd() : path.resolve(options.projectDir)\n this._appDir = this.projectDir\n this.options = {\n ...options,\n prepackaged: options.prepackaged == null ? null : path.resolve(this.projectDir, options.prepackaged),\n }\n\n try {\n log.info({ version: PACKAGE_VERSION, os: getOsRelease() }, \"electron-builder\")\n } catch (e) {\n // error in dev mode without babel\n if (!(e instanceof ReferenceError)) {\n throw e\n }\n }\n }\n\n addAfterPackHandler(handler: (context: AfterPackContext) => Promise | null) {\n this.afterPackHandlers.push(handler)\n }\n\n artifactCreated(handler: (event: ArtifactCreated) => void): Packager {\n addHandler(this.eventEmitter, \"artifactCreated\", handler)\n return this\n }\n\n async callArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any): Promise {\n log.info(\n logFields || {\n target: event.targetPresentableName,\n arch: event.arch == null ? null : Arch[event.arch],\n file: log.filePath(event.file),\n },\n \"building\"\n )\n const handler = resolveFunction(this.config.artifactBuildStarted, \"artifactBuildStarted\")\n if (handler != null) {\n await Promise.resolve(handler(event))\n }\n }\n\n /**\n * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`.\n */\n dispatchArtifactCreated(event: ArtifactCreated): void {\n this.eventEmitter.emit(\"artifactCreated\", event)\n }\n\n async callArtifactBuildCompleted(event: ArtifactCreated): Promise {\n const handler = resolveFunction(this.config.artifactBuildCompleted, \"artifactBuildCompleted\")\n if (handler != null) {\n await Promise.resolve(handler(event))\n }\n\n this.dispatchArtifactCreated(event)\n }\n\n async callAppxManifestCreated(path: string): Promise {\n const handler = resolveFunction(this.config.appxManifestCreated, \"appxManifestCreated\")\n if (handler != null) {\n await Promise.resolve(handler(path))\n }\n }\n\n async callMsiProjectCreated(path: string): Promise {\n const handler = resolveFunction(this.config.msiProjectCreated, \"msiProjectCreated\")\n if (handler != null) {\n await Promise.resolve(handler(path))\n }\n }\n\n async build(): Promise {\n let configPath: string | null = null\n let configFromOptions = this.options.config\n if (typeof configFromOptions === \"string\") {\n // it is a path to config file\n configPath = configFromOptions\n configFromOptions = null\n } else if (configFromOptions != null && typeof configFromOptions.extends === \"string\" && configFromOptions.extends.includes(\".\")) {\n configPath = configFromOptions.extends\n delete configFromOptions.extends\n }\n\n const projectDir = this.projectDir\n\n const devPackageFile = path.join(projectDir, \"package.json\")\n this._devMetadata = await orNullIfFileNotExist(readPackageJson(devPackageFile))\n\n const devMetadata = this.devMetadata\n const configuration = await getConfig(projectDir, configPath, configFromOptions, new Lazy(() => Promise.resolve(devMetadata)))\n if (log.isDebugEnabled) {\n log.debug({ config: getSafeEffectiveConfig(configuration) }, \"effective config\")\n }\n\n this._appDir = await computeDefaultAppDirectory(projectDir, configuration.directories!.app)\n this.isTwoPackageJsonProjectLayoutUsed = this._appDir !== projectDir\n\n const appPackageFile = this.isTwoPackageJsonProjectLayoutUsed ? path.join(this.appDir, \"package.json\") : devPackageFile\n\n // tslint:disable:prefer-conditional-expression\n if (this.devMetadata != null && !this.isTwoPackageJsonProjectLayoutUsed) {\n this._metadata = this.devMetadata\n } else {\n this._metadata = await this.readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile)\n }\n deepAssign(this.metadata, configuration.extraMetadata)\n\n if (this.isTwoPackageJsonProjectLayoutUsed) {\n log.debug({ devPackageFile, appPackageFile }, \"two package.json structure is used\")\n }\n checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile)\n\n return await this._build(configuration, this._metadata, this._devMetadata)\n }\n\n // external caller of this method always uses isTwoPackageJsonProjectLayoutUsed=false and appDir=projectDir, no way (and need) to use another values\n async _build(configuration: Configuration, metadata: Metadata, devMetadata: Metadata | null, repositoryInfo?: SourceRepositoryInfo): Promise {\n await validateConfig(configuration, this.debugLogger)\n this._configuration = configuration\n this._metadata = metadata\n this._devMetadata = devMetadata\n\n if (repositoryInfo != null) {\n this._repositoryInfo.value = Promise.resolve(repositoryInfo)\n }\n\n this._appInfo = new AppInfo(this, null)\n this._framework = await createFrameworkInfo(this.config, this)\n\n const commonOutDirWithoutPossibleOsMacro = path.resolve(\n this.projectDir,\n expandMacro(configuration.directories!.output!, null, this._appInfo, {\n os: \"\",\n })\n )\n\n if (!isCI && (process.stdout as any).isTTY) {\n const effectiveConfigFile = path.join(commonOutDirWithoutPossibleOsMacro, \"builder-effective-config.yaml\")\n log.info({ file: log.filePath(effectiveConfigFile) }, \"writing effective config\")\n await outputFile(effectiveConfigFile, getSafeEffectiveConfig(configuration))\n }\n\n // because artifact event maybe dispatched several times for different publish providers\n const artifactPaths = new Set()\n this.artifactCreated(event => {\n if (event.file != null) {\n artifactPaths.add(event.file)\n }\n })\n\n this.disposeOnBuildFinish(() => this.tempDirManager.cleanup())\n const platformToTargets = await executeFinally(this.doBuild(), async () => {\n if (this.debugLogger.isEnabled) {\n await this.debugLogger.save(path.join(commonOutDirWithoutPossibleOsMacro, \"builder-debug.yml\"))\n }\n\n const toDispose = this.toDispose.slice()\n this.toDispose.length = 0\n for (const disposer of toDispose) {\n await disposer().catch(e => {\n log.warn({ error: e }, \"cannot dispose\")\n })\n }\n })\n\n return {\n outDir: commonOutDirWithoutPossibleOsMacro,\n artifactPaths: Array.from(artifactPaths),\n platformToTargets,\n configuration,\n }\n }\n\n private async readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile: string): Promise {\n let data = await orNullIfFileNotExist(readPackageJson(appPackageFile))\n if (data != null) {\n return data\n }\n\n data = await orNullIfFileNotExist(readAsarJson(path.join(this.projectDir, \"app.asar\"), \"package.json\"))\n if (data != null) {\n this._isPrepackedAppAsar = true\n return data\n }\n\n throw new Error(`Cannot find package.json in the ${path.dirname(appPackageFile)}`)\n }\n\n private async doBuild(): Promise>> {\n const taskManager = new AsyncTaskManager(this.cancellationToken)\n\n const platformToTarget = new Map>()\n const createdOutDirs = new Set()\n\n for (const [platform, archToType] of this.options.targets!) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n if (platform === Platform.MAC && process.platform === Platform.WINDOWS.nodeName) {\n throw new InvalidConfigurationError(\"Build for macOS is supported only on macOS, please see https://electron.build/multi-platform-build\")\n }\n\n const packager = await this.createHelper(platform)\n const nameToTarget: Map = new Map()\n platformToTarget.set(platform, nameToTarget)\n\n for (const [arch, targetNames] of computeArchToTargetNamesMap(archToType, packager, platform)) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n // support os and arch macro in output value\n const outDir = path.resolve(this.projectDir, packager.expandMacro(this._configuration!.directories!.output!, Arch[arch]))\n const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager)\n await createOutDirIfNeed(targetList, createdOutDirs)\n await packager.pack(outDir, arch, targetList, taskManager)\n }\n\n if (this.cancellationToken.cancelled) {\n break\n }\n\n for (const target of nameToTarget.values()) {\n taskManager.addTask(target.finishBuild())\n }\n }\n\n await taskManager.awaitTasks()\n return platformToTarget\n }\n\n private async createHelper(platform: Platform): Promise> {\n if (this.options.platformPackagerFactory != null) {\n return this.options.platformPackagerFactory(this, platform)\n }\n\n switch (platform) {\n case Platform.MAC: {\n const helperClass = (await import(\"./macPackager\")).default\n return new helperClass(this)\n }\n\n case Platform.WINDOWS: {\n const helperClass = (await import(\"./winPackager\")).WinPackager\n return new helperClass(this)\n }\n\n case Platform.LINUX:\n return new (await import(\"./linuxPackager\")).LinuxPackager(this)\n\n default:\n throw new Error(`Unknown platform: ${platform}`)\n }\n }\n\n public async installAppDependencies(platform: Platform, arch: Arch): Promise {\n if (this.options.prepackaged != null || !this.framework.isNpmRebuildRequired) {\n return\n }\n\n const frameworkInfo = { version: this.framework.version, useCustomDist: true }\n const config = this.config\n if (config.nodeGypRebuild === true) {\n await nodeGypRebuild(platform.nodeName, Arch[arch], frameworkInfo)\n }\n\n if (config.npmRebuild === false) {\n log.info({ reason: \"npmRebuild is set to false\" }, \"skipped dependencies rebuild\")\n return\n }\n\n const beforeBuild = resolveFunction(config.beforeBuild, \"beforeBuild\")\n if (beforeBuild != null) {\n const performDependenciesInstallOrRebuild = await beforeBuild({\n appDir: this.appDir,\n electronVersion: this.config.electronVersion!,\n platform,\n arch: Arch[arch],\n })\n\n // If beforeBuild resolves to false, it means that handling node_modules is done outside of electron-builder.\n this._nodeModulesHandledExternally = !performDependenciesInstallOrRebuild\n if (!performDependenciesInstallOrRebuild) {\n return\n }\n }\n\n if (config.buildDependenciesFromSource === true && platform.nodeName !== process.platform) {\n log.info({ reason: \"platform is different and buildDependenciesFromSource is set to true\" }, \"skipped dependencies rebuild\")\n } else {\n await installOrRebuild(config, this.appDir, {\n frameworkInfo,\n platform: platform.nodeName,\n arch: Arch[arch],\n productionDeps: this.getNodeDependencyInfo(null),\n })\n }\n }\n\n async afterPack(context: AfterPackContext): Promise {\n const afterPack = resolveFunction(this.config.afterPack, \"afterPack\")\n const handlers = this.afterPackHandlers.slice()\n if (afterPack != null) {\n // user handler should be last\n handlers.push(afterPack)\n }\n\n for (const handler of handlers) {\n await Promise.resolve(handler(context))\n }\n }\n}\n\nfunction createOutDirIfNeed(targetList: Array, createdOutDirs: Set): Promise {\n const ourDirs = new Set()\n for (const target of targetList) {\n // noinspection SuspiciousInstanceOfGuard\n if (target instanceof NoOpTarget) {\n continue\n }\n\n const outDir = target.outDir\n if (!createdOutDirs.has(outDir)) {\n ourDirs.add(outDir)\n }\n }\n\n if (ourDirs.size === 0) {\n return Promise.resolve()\n }\n\n return Promise.all(\n Array.from(ourDirs)\n .sort()\n .map(dir => {\n return mkdirs(dir)\n .then(() => chmod(dir, 0o755) /* set explicitly */)\n .then(() => createdOutDirs.add(dir))\n })\n )\n}\n\nexport interface BuildResult {\n readonly outDir: string\n readonly artifactPaths: Array\n readonly platformToTargets: Map>\n readonly configuration: Configuration\n}\n\nfunction getSafeEffectiveConfig(configuration: Configuration): string {\n const o = JSON.parse(safeStringifyJson(configuration))\n if (o.cscLink != null) {\n o.cscLink = \"\"\n }\n return serializeToYaml(o, true)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/packagerApi.d.ts b/client/node_modules/app-builder-lib/out/packagerApi.d.ts new file mode 100644 index 0000000000..e1c62bdf30 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packagerApi.d.ts @@ -0,0 +1,31 @@ +import { Arch } from "builder-util"; +import { PublishConfiguration } from "builder-util-runtime"; +import { Configuration } from "./configuration"; +import { Platform, Target } from "./core"; +import { Packager } from "./packager"; +import { PlatformPackager } from "./platformPackager"; +import { UploadTask } from "electron-publish"; +export interface PackagerOptions { + targets?: Map>>; + mac?: Array; + linux?: Array; + win?: Array; + projectDir?: string | null; + platformPackagerFactory?: ((info: Packager, platform: Platform) => PlatformPackager) | null; + readonly config?: Configuration | string | null; + readonly effectiveOptionComputed?: (options: any) => Promise; + readonly prepackaged?: string | null; +} +export interface ArtifactCreated extends UploadTask { + readonly packager: PlatformPackager; + readonly target: Target | null; + updateInfo?: any; + readonly safeArtifactName?: string | null; + readonly publishConfig?: PublishConfiguration | null; + readonly isWriteUpdateInfo?: boolean; +} +export interface ArtifactBuildStarted { + readonly targetPresentableName: string; + readonly file: string; + readonly arch: Arch | null; +} diff --git a/client/node_modules/app-builder-lib/out/packagerApi.js b/client/node_modules/app-builder-lib/out/packagerApi.js new file mode 100644 index 0000000000..7b1adaad77 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packagerApi.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=packagerApi.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/packagerApi.js.map b/client/node_modules/app-builder-lib/out/packagerApi.js.map new file mode 100644 index 0000000000..8b34d8e37d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/packagerApi.js.map @@ -0,0 +1 @@ +{"version":3,"file":"packagerApi.js","sourceRoot":"","sources":["../src/packagerApi.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { PublishConfiguration } from \"builder-util-runtime\"\nimport { Configuration } from \"./configuration\"\nimport { Platform, Target } from \"./core\"\nimport { Packager } from \"./packager\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { UploadTask } from \"electron-publish\"\n\nexport interface PackagerOptions {\n targets?: Map>>\n\n mac?: Array\n linux?: Array\n win?: Array\n\n projectDir?: string | null\n\n platformPackagerFactory?: ((info: Packager, platform: Platform) => PlatformPackager) | null\n\n readonly config?: Configuration | string | null\n\n readonly effectiveOptionComputed?: (options: any) => Promise\n\n readonly prepackaged?: string | null\n}\n\nexport interface ArtifactCreated extends UploadTask {\n readonly packager: PlatformPackager\n readonly target: Target | null\n\n updateInfo?: any\n\n readonly safeArtifactName?: string | null\n\n readonly publishConfig?: PublishConfiguration | null\n\n readonly isWriteUpdateInfo?: boolean\n}\n\nexport interface ArtifactBuildStarted {\n readonly targetPresentableName: string\n\n readonly file: string\n // null for NSIS\n readonly arch: Arch | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/platformPackager.d.ts b/client/node_modules/app-builder-lib/out/platformPackager.d.ts new file mode 100644 index 0000000000..ee1160afc3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/platformPackager.d.ts @@ -0,0 +1,75 @@ +import { Arch, AsyncTaskManager, DebugLogger } from "builder-util"; +import { FileTransformer } from "builder-util/out/fs"; +import { AppInfo } from "./appInfo"; +import { GetFileMatchersOptions } from "./fileMatcher"; +import { AfterPackContext, CompressionLevel, Configuration, ElectronPlatformName, FileAssociation, Packager, PackagerOptions, Platform, PlatformSpecificBuildOptions, Target, TargetSpecificOptions } from "./index"; +export declare abstract class PlatformPackager { + readonly info: Packager; + readonly platform: Platform; + get packagerOptions(): PackagerOptions; + get buildResourcesDir(): string; + get projectDir(): string; + get config(): Configuration; + readonly platformSpecificBuildOptions: DC; + get resourceList(): Promise>; + private readonly _resourceList; + readonly appInfo: AppInfo; + protected constructor(info: Packager, platform: Platform); + get compression(): CompressionLevel; + get debugLogger(): DebugLogger; + abstract get defaultTarget(): Array; + protected prepareAppInfo(appInfo: AppInfo): AppInfo; + private static normalizePlatformSpecificBuildOptions; + abstract createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void; + protected getCscPassword(): string; + protected getCscLink(extraEnvName?: string | null): string | null | undefined; + protected doGetCscPassword(): string | null | undefined; + protected computeAppOutDir(outDir: string, arch: Arch): string; + dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise; + pack(outDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): Promise; + protected packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): void; + private static buildAsyncTargets; + private getExtraFileMatchers; + createGetFileMatchersOptions(outDir: string, arch: Arch, customBuildOptions: PlatformSpecificBuildOptions): GetFileMatchersOptions; + protected doPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array, sign?: boolean, disableAsarIntegrity?: boolean): Promise; + protected doSignAfterPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array): Promise; + protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null; + private copyAppFiles; + protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise; + getIconPath(): Promise; + private computeAsarOptions; + getElectronSrcDir(dist: string): string; + getElectronDestinationDir(appOutDir: string): string; + getResourcesDir(appOutDir: string): string; + getMacOsResourcesDir(appOutDir: string): string; + private checkFileInPackage; + private sanityCheckPackage; + computeSafeArtifactName(suggestedName: string | null, ext: string, arch?: Arch | null, skipDefaultArch?: boolean, defaultArch?: string, safePattern?: string): string | null; + expandArtifactNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null, defaultPattern?: string, skipDefaultArch?: boolean, defaultArch?: string): string; + artifactPatternConfig(targetSpecificOptions: TargetSpecificOptions | null | undefined, defaultPattern: string | undefined): { + isUserForced: boolean; + pattern: string; + }; + expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string; + private computeArtifactName; + expandMacro(pattern: string, arch?: string | null, extra?: any, isProductNameSanitized?: boolean): string; + generateName2(ext: string | null, classifier: string | null | undefined, deployment: boolean): string; + getTempFile(suffix: string): Promise; + get fileAssociations(): Array; + getResource(custom: string | null | undefined, ...names: Array): Promise; + get forceCodeSigning(): boolean; + protected getOrConvertIcon(format: IconFormat): Promise; + getDefaultFrameworkIcon(): string | null; + resolveIcon(sources: Array, fallbackSources: Array, outputFormat: IconFormat): Promise>; +} +export interface IconInfo { + file: string; + size: number; +} +export declare type IconFormat = "icns" | "ico" | "set"; +export declare function isSafeGithubName(name: string): boolean; +export declare function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null; +export declare function normalizeExt(ext: string): string; +export declare function resolveFunction(executor: T | string, name: string): T; +export declare function chooseNotNull(v1: string | null | undefined, v2: string | null | undefined): string | null | undefined; +export declare function isSafeToUnpackElectronOnRemoteBuildServer(packager: PlatformPackager): boolean; diff --git a/client/node_modules/app-builder-lib/out/platformPackager.js b/client/node_modules/app-builder-lib/out/platformPackager.js new file mode 100644 index 0000000000..b691dc10c2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/platformPackager.js @@ -0,0 +1,624 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isSafeToUnpackElectronOnRemoteBuildServer = exports.chooseNotNull = exports.resolveFunction = exports.normalizeExt = exports.computeSafeArtifactNameIfNeeded = exports.isSafeGithubName = exports.PlatformPackager = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const arch_1 = require("builder-util/out/arch"); +const fs_1 = require("builder-util/out/fs"); +const promise_1 = require("builder-util/out/promise"); +const promises_1 = require("fs/promises"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const appInfo_1 = require("./appInfo"); +const asarFileChecker_1 = require("./asar/asarFileChecker"); +const asarUtil_1 = require("./asar/asarUtil"); +const integrity_1 = require("./asar/integrity"); +const fileMatcher_1 = require("./fileMatcher"); +const fileTransformer_1 = require("./fileTransformer"); +const Framework_1 = require("./Framework"); +const index_1 = require("./index"); +const appBuilder_1 = require("./util/appBuilder"); +const appFileCopier_1 = require("./util/appFileCopier"); +const macroExpander_1 = require("./util/macroExpander"); +class PlatformPackager { + constructor(info, platform) { + this.info = info; + this.platform = platform; + this._resourceList = new lazy_val_1.Lazy(() => promise_1.orIfFileNotExist(promises_1.readdir(this.info.buildResourcesDir), [])); + this.platformSpecificBuildOptions = PlatformPackager.normalizePlatformSpecificBuildOptions(this.config[platform.buildConfigurationKey]); + this.appInfo = this.prepareAppInfo(info.appInfo); + } + get packagerOptions() { + return this.info.options; + } + get buildResourcesDir() { + return this.info.buildResourcesDir; + } + get projectDir() { + return this.info.projectDir; + } + get config() { + return this.info.config; + } + get resourceList() { + return this._resourceList.value; + } + get compression() { + const compression = this.platformSpecificBuildOptions.compression; + // explicitly set to null - request to use default value instead of parent (in the config) + if (compression === null) { + return "normal"; + } + return compression || this.config.compression || "normal"; + } + get debugLogger() { + return this.info.debugLogger; + } + // eslint-disable-next-line + prepareAppInfo(appInfo) { + return new appInfo_1.AppInfo(this.info, null, this.platformSpecificBuildOptions); + } + static normalizePlatformSpecificBuildOptions(options) { + return options == null ? Object.create(null) : options; + } + getCscPassword() { + const password = this.doGetCscPassword(); + if (builder_util_1.isEmptyOrSpaces(password)) { + builder_util_1.log.info({ reason: "CSC_KEY_PASSWORD is not defined" }, "empty password will be used for code signing"); + return ""; + } + else { + return password.trim(); + } + } + getCscLink(extraEnvName) { + // allow to specify as empty string + const envValue = chooseNotNull(extraEnvName == null ? null : process.env[extraEnvName], process.env.CSC_LINK); + return chooseNotNull(chooseNotNull(this.info.config.cscLink, this.platformSpecificBuildOptions.cscLink), envValue); + } + doGetCscPassword() { + // allow to specify as empty string + return chooseNotNull(chooseNotNull(this.info.config.cscKeyPassword, this.platformSpecificBuildOptions.cscKeyPassword), process.env.CSC_KEY_PASSWORD); + } + computeAppOutDir(outDir, arch) { + return (this.packagerOptions.prepackaged || + path.join(outDir, `${this.platform.buildConfigurationKey}${builder_util_1.getArchSuffix(arch, this.platformSpecificBuildOptions.defaultArch)}${this.platform === index_1.Platform.MAC ? "" : "-unpacked"}`)); + } + dispatchArtifactCreated(file, target, arch, safeArtifactName) { + return this.info.callArtifactBuildCompleted({ + file, + safeArtifactName, + target, + arch, + packager: this, + }); + } + async pack(outDir, arch, targets, taskManager) { + const appOutDir = this.computeAppOutDir(outDir, arch); + await this.doPack(outDir, appOutDir, this.platform.nodeName, arch, this.platformSpecificBuildOptions, targets); + this.packageInDistributableFormat(appOutDir, arch, targets, taskManager); + } + packageInDistributableFormat(appOutDir, arch, targets, taskManager) { + if (targets.find(it => !it.isAsyncSupported) == null) { + PlatformPackager.buildAsyncTargets(targets, taskManager, appOutDir, arch); + return; + } + taskManager.add(async () => { + // BluebirdPromise.map doesn't invoke target.build immediately, but for RemoteTarget it is very critical to call build() before finishBuild() + const subTaskManager = new builder_util_1.AsyncTaskManager(this.info.cancellationToken); + PlatformPackager.buildAsyncTargets(targets, subTaskManager, appOutDir, arch); + await subTaskManager.awaitTasks(); + for (const target of targets) { + if (!target.isAsyncSupported) { + await target.build(appOutDir, arch); + } + } + }); + } + static buildAsyncTargets(targets, taskManager, appOutDir, arch) { + for (const target of targets) { + if (target.isAsyncSupported) { + taskManager.addTask(target.build(appOutDir, arch)); + } + } + } + getExtraFileMatchers(isResources, appOutDir, options) { + const base = isResources + ? this.getResourcesDir(appOutDir) + : this.platform === index_1.Platform.MAC + ? path.join(appOutDir, `${this.appInfo.productFilename}.app`, "Contents") + : appOutDir; + return fileMatcher_1.getFileMatchers(this.config, isResources ? "extraResources" : "extraFiles", base, options); + } + createGetFileMatchersOptions(outDir, arch, customBuildOptions) { + return { + macroExpander: it => this.expandMacro(it, arch == null ? null : builder_util_1.Arch[arch], { "/*": "{,/**/*}" }), + customBuildOptions, + globalOutDir: outDir, + defaultSrc: this.projectDir, + }; + } + async doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets, sign = true, disableAsarIntegrity = false) { + if (this.packagerOptions.prepackaged != null) { + return; + } + if (this.info.cancellationToken.cancelled) { + return; + } + const beforePack = resolveFunction(this.config.beforePack, "beforePack"); + if (beforePack != null) { + await beforePack({ + appOutDir, + outDir, + arch, + targets, + packager: this, + electronPlatformName: platformName, + }); + } + await this.info.installAppDependencies(this.platform, arch); + if (this.info.cancellationToken.cancelled) { + return; + } + const framework = this.info.framework; + builder_util_1.log.info({ + platform: platformName, + arch: builder_util_1.Arch[arch], + [`${framework.name}`]: framework.version, + appOutDir: builder_util_1.log.filePath(appOutDir), + }, `packaging`); + await framework.prepareApplicationStageDirectory({ + packager: this, + appOutDir, + platformName, + arch: builder_util_1.Arch[arch], + version: framework.version, + }); + const excludePatterns = []; + const computeParsedPatterns = (patterns) => { + if (patterns != null) { + for (const pattern of patterns) { + pattern.computeParsedPatterns(excludePatterns, this.info.projectDir); + } + } + }; + const getFileMatchersOptions = this.createGetFileMatchersOptions(outDir, arch, platformSpecificBuildOptions); + const macroExpander = getFileMatchersOptions.macroExpander; + const extraResourceMatchers = this.getExtraFileMatchers(true, appOutDir, getFileMatchersOptions); + computeParsedPatterns(extraResourceMatchers); + const extraFileMatchers = this.getExtraFileMatchers(false, appOutDir, getFileMatchersOptions); + computeParsedPatterns(extraFileMatchers); + const packContext = { + appOutDir, + outDir, + arch, + targets, + packager: this, + electronPlatformName: platformName, + }; + const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions); + const resourcesPath = this.platform === index_1.Platform.MAC + ? path.join(appOutDir, framework.distMacOsAppName, "Contents", "Resources") + : Framework_1.isElectronBased(framework) + ? path.join(appOutDir, "resources") + : appOutDir; + const taskManager = new builder_util_1.AsyncTaskManager(this.info.cancellationToken); + this.copyAppFiles(taskManager, asarOptions, resourcesPath, path.join(resourcesPath, "app"), packContext, platformSpecificBuildOptions, excludePatterns, macroExpander); + await taskManager.awaitTasks(); + if (this.info.cancellationToken.cancelled) { + return; + } + if (framework.beforeCopyExtraFiles != null) { + const resourcesRelativePath = this.platform === index_1.Platform.MAC ? "Resources" : Framework_1.isElectronBased(framework) ? "resources" : ""; + await framework.beforeCopyExtraFiles({ + packager: this, + appOutDir, + asarIntegrity: asarOptions == null || disableAsarIntegrity ? null : await integrity_1.computeData({ resourcesPath, resourcesRelativePath }), + platformName, + }); + } + if (this.info.cancellationToken.cancelled) { + return; + } + const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext); + await fileMatcher_1.copyFiles(extraResourceMatchers, transformerForExtraFiles); + await fileMatcher_1.copyFiles(extraFileMatchers, transformerForExtraFiles); + if (this.info.cancellationToken.cancelled) { + return; + } + await this.info.afterPack(packContext); + if (framework.afterPack != null) { + await framework.afterPack(packContext); + } + const isAsar = asarOptions != null; + await this.sanityCheckPackage(appOutDir, isAsar, framework); + if (sign) { + await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets); + } + } + async doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets) { + const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions); + const isAsar = asarOptions != null; + const packContext = { + appOutDir, + outDir, + arch, + targets, + packager: this, + electronPlatformName: platformName, + }; + await this.signApp(packContext, isAsar); + const afterSign = resolveFunction(this.config.afterSign, "afterSign"); + if (afterSign != null) { + await Promise.resolve(afterSign(packContext)); + } + } + // eslint-disable-next-line + createTransformerForExtraFiles(packContext) { + return null; + } + copyAppFiles(taskManager, asarOptions, resourcePath, defaultDestination, packContext, platformSpecificBuildOptions, excludePatterns, macroExpander) { + const appDir = this.info.appDir; + const config = this.config; + const isElectronCompile = asarOptions != null && fileTransformer_1.isElectronCompileUsed(this.info); + const mainMatchers = fileMatcher_1.getMainFileMatchers(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this, packContext.outDir, isElectronCompile); + if (excludePatterns.length > 0) { + for (const matcher of mainMatchers) { + matcher.excludePatterns = excludePatterns; + } + } + const framework = this.info.framework; + const transformer = fileTransformer_1.createTransformer(appDir, config, isElectronCompile + ? { + originalMain: this.info.metadata.main, + main: appFileCopier_1.ELECTRON_COMPILE_SHIM_FILENAME, + ...config.extraMetadata, + } + : config.extraMetadata, framework.createTransformer == null ? null : framework.createTransformer()); + const _computeFileSets = (matchers) => { + return appFileCopier_1.computeFileSets(matchers, this.info.isPrepackedAppAsar ? null : transformer, this, isElectronCompile).then(async (result) => { + if (!this.info.isPrepackedAppAsar && !this.info.areNodeModulesHandledExternally) { + const moduleFileMatcher = fileMatcher_1.getNodeModuleFileMatcher(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this.info); + result = result.concat(await appFileCopier_1.computeNodeModuleFileSets(this, moduleFileMatcher)); + } + return result.filter(it => it.files.length > 0); + }); + }; + if (this.info.isPrepackedAppAsar) { + taskManager.addTask(bluebird_lst_1.default.each(_computeFileSets([new fileMatcher_1.FileMatcher(appDir, resourcePath, macroExpander)]), it => appFileCopier_1.copyAppFiles(it, this.info, transformer))); + } + else if (asarOptions == null) { + // for ASAR all asar unpacked files will be extra transformed (e.g. sign of EXE and DLL) later, + // for prepackaged asar extra transformation not supported yet, + // so, extra transform if asar is disabled + const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext); + const combinedTransformer = file => { + if (transformerForExtraFiles != null) { + const result = transformerForExtraFiles(file); + if (result != null) { + return result; + } + } + return transformer(file); + }; + taskManager.addTask(bluebird_lst_1.default.each(_computeFileSets(mainMatchers), it => appFileCopier_1.copyAppFiles(it, this.info, combinedTransformer))); + } + else { + const unpackPattern = fileMatcher_1.getFileMatchers(config, "asarUnpack", defaultDestination, { + macroExpander, + customBuildOptions: platformSpecificBuildOptions, + globalOutDir: packContext.outDir, + defaultSrc: appDir, + }); + const fileMatcher = unpackPattern == null ? null : unpackPattern[0]; + taskManager.addTask(_computeFileSets(mainMatchers).then(async (fileSets) => { + for (const fileSet of fileSets) { + await appFileCopier_1.transformFiles(transformer, fileSet); + } + await new asarUtil_1.AsarPackager(appDir, resourcePath, asarOptions, fileMatcher == null ? null : fileMatcher.createFilter()).pack(fileSets, this); + })); + } + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + signApp(packContext, isAsar) { + return Promise.resolve(); + } + getIconPath() { + return Promise.resolve(null); + } + async computeAsarOptions(customBuildOptions) { + if (!Framework_1.isElectronBased(this.info.framework)) { + return null; + } + function errorMessage(name) { + return `${name} is deprecated is deprecated and not supported — please use asarUnpack`; + } + const buildMetadata = this.config; + if (buildMetadata["asar-unpack"] != null) { + throw new Error(errorMessage("asar-unpack")); + } + if (buildMetadata["asar-unpack-dir"] != null) { + throw new Error(errorMessage("asar-unpack-dir")); + } + const platformSpecific = customBuildOptions.asar; + const result = platformSpecific == null ? this.config.asar : platformSpecific; + if (result === false) { + const appAsarStat = await fs_1.statOrNull(path.join(this.info.appDir, "app.asar")); + //noinspection ES6MissingAwait + if (appAsarStat == null || !appAsarStat.isFile()) { + builder_util_1.log.warn({ + solution: "enable asar and use asarUnpack to unpack files that must be externally available", + }, "asar usage is disabled — this is strongly not recommended"); + } + return null; + } + if (result == null || result === true) { + return {}; + } + for (const name of ["unpackDir", "unpack"]) { + if (result[name] != null) { + throw new Error(errorMessage(`asar.${name}`)); + } + } + return builder_util_1.deepAssign({}, result); + } + getElectronSrcDir(dist) { + return path.resolve(this.projectDir, dist); + } + getElectronDestinationDir(appOutDir) { + return appOutDir; + } + getResourcesDir(appOutDir) { + if (this.platform === index_1.Platform.MAC) { + return this.getMacOsResourcesDir(appOutDir); + } + else if (Framework_1.isElectronBased(this.info.framework)) { + return path.join(appOutDir, "resources"); + } + else { + return appOutDir; + } + } + getMacOsResourcesDir(appOutDir) { + return path.join(appOutDir, `${this.appInfo.productFilename}.app`, "Contents", "Resources"); + } + async checkFileInPackage(resourcesDir, file, messagePrefix, isAsar) { + const relativeFile = path.relative(this.info.appDir, path.resolve(this.info.appDir, file)); + if (isAsar) { + await asarFileChecker_1.checkFileInArchive(path.join(resourcesDir, "app.asar"), relativeFile, messagePrefix); + return; + } + const pathParsed = path.parse(file); + // Even when packaging to asar is disabled, it does not imply that the main file can not be inside an .asar archive. + // This may occur when the packaging is done manually before processing with electron-builder. + if (pathParsed.dir.includes(".asar")) { + // The path needs to be split to the part with an asar archive which acts like a directory and the part with + // the path to main file itself. (e.g. path/arch.asar/dir/index.js -> path/arch.asar, dir/index.js) + // noinspection TypeScriptValidateJSTypes + const pathSplit = pathParsed.dir.split(path.sep); + let partWithAsarIndex = 0; + pathSplit.some((pathPart, index) => { + partWithAsarIndex = index; + return pathPart.endsWith(".asar"); + }); + const asarPath = path.join(...pathSplit.slice(0, partWithAsarIndex + 1)); + let mainPath = pathSplit.length > partWithAsarIndex + 1 ? path.join.apply(pathSplit.slice(partWithAsarIndex + 1)) : ""; + mainPath += path.join(mainPath, pathParsed.base); + await asarFileChecker_1.checkFileInArchive(path.join(resourcesDir, "app", asarPath), mainPath, messagePrefix); + } + else { + const fullPath = path.join(resourcesDir, "app", relativeFile); + const outStat = await fs_1.statOrNull(fullPath); + if (outStat == null) { + throw new Error(`${messagePrefix} "${fullPath}" does not exist. Seems like a wrong configuration.`); + } + else { + //noinspection ES6MissingAwait + if (!outStat.isFile()) { + throw new Error(`${messagePrefix} "${fullPath}" is not a file. Seems like a wrong configuration.`); + } + } + } + } + async sanityCheckPackage(appOutDir, isAsar, framework) { + const outStat = await fs_1.statOrNull(appOutDir); + if (outStat == null) { + throw new Error(`Output directory "${appOutDir}" does not exist. Seems like a wrong configuration.`); + } + else { + //noinspection ES6MissingAwait + if (!outStat.isDirectory()) { + throw new Error(`Output directory "${appOutDir}" is not a directory. Seems like a wrong configuration.`); + } + } + const resourcesDir = this.getResourcesDir(appOutDir); + const mainFile = (framework.getMainFile == null ? null : framework.getMainFile(this.platform)) || this.info.metadata.main || "index.js"; + await this.checkFileInPackage(resourcesDir, mainFile, "Application entry file", isAsar); + await this.checkFileInPackage(resourcesDir, "package.json", "Application", isAsar); + } + // tslint:disable-next-line:no-invalid-template-strings + computeSafeArtifactName(suggestedName, ext, arch, skipDefaultArch = true, defaultArch, safePattern = "${name}-${version}-${arch}.${ext}") { + return computeSafeArtifactNameIfNeeded(suggestedName, () => this.computeArtifactName(safePattern, ext, skipDefaultArch && arch === arch_1.defaultArchFromString(defaultArch) ? null : arch)); + } + expandArtifactNamePattern(targetSpecificOptions, ext, arch, defaultPattern, skipDefaultArch = true, defaultArch) { + const { pattern, isUserForced } = this.artifactPatternConfig(targetSpecificOptions, defaultPattern); + return this.computeArtifactName(pattern, ext, !isUserForced && skipDefaultArch && arch === arch_1.defaultArchFromString(defaultArch) ? null : arch); + } + artifactPatternConfig(targetSpecificOptions, defaultPattern) { + const userSpecifiedPattern = (targetSpecificOptions === null || targetSpecificOptions === void 0 ? void 0 : targetSpecificOptions.artifactName) || this.platformSpecificBuildOptions.artifactName || this.config.artifactName; + return { + isUserForced: !!userSpecifiedPattern, + pattern: userSpecifiedPattern || defaultPattern || "${productName}-${version}-${arch}.${ext}", + }; + } + expandArtifactBeautyNamePattern(targetSpecificOptions, ext, arch) { + // tslint:disable-next-line:no-invalid-template-strings + return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, "${productName} ${version} ${arch}.${ext}", true); + } + computeArtifactName(pattern, ext, arch) { + const archName = arch == null ? null : arch_1.getArtifactArchName(arch, ext); + return this.expandMacro(pattern, archName, { + ext, + }); + } + expandMacro(pattern, arch, extra = {}, isProductNameSanitized = true) { + return macroExpander_1.expandMacro(pattern, arch, this.appInfo, { os: this.platform.buildConfigurationKey, ...extra }, isProductNameSanitized); + } + generateName2(ext, classifier, deployment) { + const dotExt = ext == null ? "" : `.${ext}`; + const separator = ext === "deb" ? "_" : "-"; + return `${deployment ? this.appInfo.name : this.appInfo.productFilename}${separator}${this.appInfo.version}${classifier == null ? "" : `${separator}${classifier}`}${dotExt}`; + } + getTempFile(suffix) { + return this.info.tempDirManager.getTempFile({ suffix }); + } + get fileAssociations() { + return builder_util_1.asArray(this.config.fileAssociations).concat(builder_util_1.asArray(this.platformSpecificBuildOptions.fileAssociations)); + } + async getResource(custom, ...names) { + const resourcesDir = this.info.buildResourcesDir; + if (custom === undefined) { + const resourceList = await this.resourceList; + for (const name of names) { + if (resourceList.includes(name)) { + return path.join(resourcesDir, name); + } + } + } + else if (custom != null && !builder_util_1.isEmptyOrSpaces(custom)) { + const resourceList = await this.resourceList; + if (resourceList.includes(custom)) { + return path.join(resourcesDir, custom); + } + let p = path.resolve(resourcesDir, custom); + if ((await fs_1.statOrNull(p)) == null) { + p = path.resolve(this.projectDir, custom); + if ((await fs_1.statOrNull(p)) == null) { + throw new builder_util_1.InvalidConfigurationError(`cannot find specified resource "${custom}", nor relative to "${resourcesDir}", neither relative to project dir ("${this.projectDir}")`); + } + } + return p; + } + return null; + } + get forceCodeSigning() { + const forceCodeSigningPlatform = this.platformSpecificBuildOptions.forceCodeSigning; + return (forceCodeSigningPlatform == null ? this.config.forceCodeSigning : forceCodeSigningPlatform) || false; + } + async getOrConvertIcon(format) { + const result = await this.resolveIcon(builder_util_1.asArray(this.platformSpecificBuildOptions.icon || this.config.icon), [], format); + if (result.length === 0) { + const framework = this.info.framework; + if (framework.getDefaultIcon != null) { + return framework.getDefaultIcon(this.platform); + } + builder_util_1.log.warn({ reason: "application icon is not set" }, `default ${capitalizeFirstLetter(framework.name)} icon is used`); + return this.getDefaultFrameworkIcon(); + } + else { + return result[0].file; + } + } + getDefaultFrameworkIcon() { + const framework = this.info.framework; + return framework.getDefaultIcon == null ? null : framework.getDefaultIcon(this.platform); + } + // convert if need, validate size (it is a reason why tool is called even if file has target extension (already specified as foo.icns for example)) + async resolveIcon(sources, fallbackSources, outputFormat) { + const args = [ + "icon", + "--format", + outputFormat, + "--root", + this.buildResourcesDir, + "--root", + this.projectDir, + "--out", + path.resolve(this.projectDir, this.config.directories.output, `.icon-${outputFormat}`), + ]; + for (const source of sources) { + args.push("--input", source); + } + for (const source of fallbackSources) { + args.push("--fallback-input", source); + } + const result = await appBuilder_1.executeAppBuilderAsJson(args); + const errorMessage = result.error; + if (errorMessage != null) { + throw new builder_util_1.InvalidConfigurationError(errorMessage, result.errorCode); + } + if (result.isFallback) { + builder_util_1.log.warn({ reason: "application icon is not set" }, `default ${capitalizeFirstLetter(this.info.framework.name)} icon is used`); + } + return result.icons || []; + } +} +exports.PlatformPackager = PlatformPackager; +function isSafeGithubName(name) { + return /^[0-9A-Za-z._-]+$/.test(name); +} +exports.isSafeGithubName = isSafeGithubName; +function computeSafeArtifactNameIfNeeded(suggestedName, safeNameProducer) { + // GitHub only allows the listed characters in file names. + if (suggestedName != null) { + if (isSafeGithubName(suggestedName)) { + return null; + } + // prefer to use suggested name - so, if space is the only problem, just replace only space to dash + suggestedName = suggestedName.replace(/ /g, "-"); + if (isSafeGithubName(suggestedName)) { + return suggestedName; + } + } + return safeNameProducer(); +} +exports.computeSafeArtifactNameIfNeeded = computeSafeArtifactNameIfNeeded; +// remove leading dot +function normalizeExt(ext) { + return ext.startsWith(".") ? ext.substring(1) : ext; +} +exports.normalizeExt = normalizeExt; +function resolveFunction(executor, name) { + if (executor == null || typeof executor !== "string") { + return executor; + } + let p = executor; + if (p.startsWith(".")) { + p = path.resolve(p); + } + try { + p = require.resolve(p); + } + catch (e) { + builder_util_1.debug(e); + p = path.resolve(p); + } + // eslint-disable-next-line @typescript-eslint/no-var-requires + const m = require(p); + const namedExport = m[name]; + if (namedExport == null) { + return m.default || m; + } + else { + return namedExport; + } +} +exports.resolveFunction = resolveFunction; +function chooseNotNull(v1, v2) { + return v1 == null ? v2 : v1; +} +exports.chooseNotNull = chooseNotNull; +function capitalizeFirstLetter(text) { + return text.charAt(0).toUpperCase() + text.slice(1); +} +function isSafeToUnpackElectronOnRemoteBuildServer(packager) { + if (packager.platform !== index_1.Platform.LINUX || packager.config.remoteBuild === false) { + return false; + } + if (process.platform === "win32" || builder_util_1.isEnvTrue(process.env._REMOTE_BUILD)) { + return packager.config.electronDist == null && packager.config.electronDownload == null; + } + return false; +} +exports.isSafeToUnpackElectronOnRemoteBuildServer = isSafeToUnpackElectronOnRemoteBuildServer; +//# sourceMappingURL=platformPackager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/platformPackager.js.map b/client/node_modules/app-builder-lib/out/platformPackager.js.map new file mode 100644 index 0000000000..bba5a2408f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/platformPackager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"platformPackager.js","sourceRoot":"","sources":["../src/platformPackager.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAyK;AACzK,gDAAkF;AAClF,4CAAiE;AACjE,sDAA2D;AAC3D,0CAAqC;AACrC,uCAA+B;AAE/B,6BAA4B;AAC5B,uCAAmC;AACnC,4DAA2D;AAC3D,8CAA8C;AAC9C,gDAA8C;AAC9C,+CAA8I;AAC9I,uDAA4E;AAC5E,2CAAwD;AACxD,mCAagB;AAChB,kDAA2D;AAC3D,wDAA+I;AAC/I,wDAAmE;AAEnE,MAAsB,gBAAgB;IA2BpC,YAA+B,IAAc,EAAW,QAAkB;QAA3C,SAAI,GAAJ,IAAI,CAAU;QAAW,aAAQ,GAAR,QAAQ,CAAU;QAJzD,kBAAa,GAAG,IAAI,eAAI,CAAgB,GAAG,EAAE,CAAC,0BAAgB,CAAC,kBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QAKxH,IAAI,CAAC,4BAA4B,GAAG,gBAAgB,CAAC,qCAAqC,CAAE,IAAI,CAAC,MAAc,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAA;QAChJ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClD,CAAC;IA7BD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;IAC1B,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAA;IACpC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAA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F,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AAC7B,CAAC;AAFD,sCAEC;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC;AAED,SAAgB,yCAAyC,CAAC,QAA+B;IACvF,IAAI,QAAQ,CAAC,QAAQ,KAAK,gBAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE;QACjF,OAAO,KAAK,CAAA;KACb;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,wBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;QACxE,OAAO,QAAQ,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAA;KACxF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AATD,8FASC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, debug, DebugLogger, deepAssign, getArchSuffix, InvalidConfigurationError, isEmptyOrSpaces, log, isEnvTrue } from \"builder-util\"\nimport { defaultArchFromString, getArtifactArchName } from \"builder-util/out/arch\"\nimport { FileTransformer, statOrNull } from \"builder-util/out/fs\"\nimport { orIfFileNotExist } from \"builder-util/out/promise\"\nimport { readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { AppInfo } from \"./appInfo\"\nimport { checkFileInArchive } from \"./asar/asarFileChecker\"\nimport { AsarPackager } from \"./asar/asarUtil\"\nimport { computeData } from \"./asar/integrity\"\nimport { copyFiles, FileMatcher, getFileMatchers, GetFileMatchersOptions, getMainFileMatchers, getNodeModuleFileMatcher } from \"./fileMatcher\"\nimport { createTransformer, isElectronCompileUsed } from \"./fileTransformer\"\nimport { Framework, isElectronBased } from \"./Framework\"\nimport {\n AfterPackContext,\n AsarOptions,\n CompressionLevel,\n Configuration,\n ElectronPlatformName,\n FileAssociation,\n Packager,\n PackagerOptions,\n Platform,\n PlatformSpecificBuildOptions,\n Target,\n TargetSpecificOptions,\n} from \"./index\"\nimport { executeAppBuilderAsJson } from \"./util/appBuilder\"\nimport { computeFileSets, computeNodeModuleFileSets, copyAppFiles, ELECTRON_COMPILE_SHIM_FILENAME, transformFiles } from \"./util/appFileCopier\"\nimport { expandMacro as doExpandMacro } from \"./util/macroExpander\"\n\nexport abstract class PlatformPackager {\n get packagerOptions(): PackagerOptions {\n return this.info.options\n }\n\n get buildResourcesDir(): string {\n return this.info.buildResourcesDir\n }\n\n get projectDir(): string {\n return this.info.projectDir\n }\n\n get config(): Configuration {\n return this.info.config\n }\n\n readonly platformSpecificBuildOptions: DC\n\n get resourceList(): Promise> {\n return this._resourceList.value\n }\n\n private readonly _resourceList = new Lazy>(() => orIfFileNotExist(readdir(this.info.buildResourcesDir), []))\n\n readonly appInfo: AppInfo\n\n protected constructor(readonly info: Packager, readonly platform: Platform) {\n this.platformSpecificBuildOptions = PlatformPackager.normalizePlatformSpecificBuildOptions((this.config as any)[platform.buildConfigurationKey])\n this.appInfo = this.prepareAppInfo(info.appInfo)\n }\n\n get compression(): CompressionLevel {\n const compression = this.platformSpecificBuildOptions.compression\n // explicitly set to null - request to use default value instead of parent (in the config)\n if (compression === null) {\n return \"normal\"\n }\n return compression || this.config.compression || \"normal\"\n }\n\n get debugLogger(): DebugLogger {\n return this.info.debugLogger\n }\n\n abstract get defaultTarget(): Array\n\n // eslint-disable-next-line\n protected prepareAppInfo(appInfo: AppInfo) {\n return new AppInfo(this.info, null, this.platformSpecificBuildOptions)\n }\n\n private static normalizePlatformSpecificBuildOptions(options: any | null | undefined): any {\n return options == null ? Object.create(null) : options\n }\n\n abstract createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void\n\n protected getCscPassword(): string {\n const password = this.doGetCscPassword()\n if (isEmptyOrSpaces(password)) {\n log.info({ reason: \"CSC_KEY_PASSWORD is not defined\" }, \"empty password will be used for code signing\")\n return \"\"\n } else {\n return password.trim()\n }\n }\n\n protected getCscLink(extraEnvName?: string | null): string | null | undefined {\n // allow to specify as empty string\n const envValue = chooseNotNull(extraEnvName == null ? null : process.env[extraEnvName], process.env.CSC_LINK)\n return chooseNotNull(chooseNotNull(this.info.config.cscLink, this.platformSpecificBuildOptions.cscLink), envValue)\n }\n\n protected doGetCscPassword(): string | null | undefined {\n // allow to specify as empty string\n return chooseNotNull(chooseNotNull(this.info.config.cscKeyPassword, this.platformSpecificBuildOptions.cscKeyPassword), process.env.CSC_KEY_PASSWORD)\n }\n\n protected computeAppOutDir(outDir: string, arch: Arch): string {\n return (\n this.packagerOptions.prepackaged ||\n path.join(\n outDir,\n `${this.platform.buildConfigurationKey}${getArchSuffix(arch, this.platformSpecificBuildOptions.defaultArch)}${this.platform === Platform.MAC ? \"\" : \"-unpacked\"}`\n )\n )\n }\n\n dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise {\n return this.info.callArtifactBuildCompleted({\n file,\n safeArtifactName,\n target,\n arch,\n packager: this,\n })\n }\n\n async pack(outDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): Promise {\n const appOutDir = this.computeAppOutDir(outDir, arch)\n await this.doPack(outDir, appOutDir, this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)\n this.packageInDistributableFormat(appOutDir, arch, targets, taskManager)\n }\n\n protected packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array, taskManager: AsyncTaskManager): void {\n if (targets.find(it => !it.isAsyncSupported) == null) {\n PlatformPackager.buildAsyncTargets(targets, taskManager, appOutDir, arch)\n return\n }\n\n taskManager.add(async () => {\n // BluebirdPromise.map doesn't invoke target.build immediately, but for RemoteTarget it is very critical to call build() before finishBuild()\n const subTaskManager = new AsyncTaskManager(this.info.cancellationToken)\n PlatformPackager.buildAsyncTargets(targets, subTaskManager, appOutDir, arch)\n await subTaskManager.awaitTasks()\n\n for (const target of targets) {\n if (!target.isAsyncSupported) {\n await target.build(appOutDir, arch)\n }\n }\n })\n }\n\n private static buildAsyncTargets(targets: Array, taskManager: AsyncTaskManager, appOutDir: string, arch: Arch) {\n for (const target of targets) {\n if (target.isAsyncSupported) {\n taskManager.addTask(target.build(appOutDir, arch))\n }\n }\n }\n\n private getExtraFileMatchers(isResources: boolean, appOutDir: string, options: GetFileMatchersOptions): Array | null {\n const base = isResources\n ? this.getResourcesDir(appOutDir)\n : this.platform === Platform.MAC\n ? path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\")\n : appOutDir\n return getFileMatchers(this.config, isResources ? \"extraResources\" : \"extraFiles\", base, options)\n }\n\n createGetFileMatchersOptions(outDir: string, arch: Arch, customBuildOptions: PlatformSpecificBuildOptions): GetFileMatchersOptions {\n return {\n macroExpander: it => this.expandMacro(it, arch == null ? null : Arch[arch], { \"/*\": \"{,/**/*}\" }),\n customBuildOptions,\n globalOutDir: outDir,\n defaultSrc: this.projectDir,\n }\n }\n\n protected async doPack(\n outDir: string,\n appOutDir: string,\n platformName: ElectronPlatformName,\n arch: Arch,\n platformSpecificBuildOptions: DC,\n targets: Array,\n sign = true,\n disableAsarIntegrity = false\n ) {\n if (this.packagerOptions.prepackaged != null) {\n return\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const beforePack = resolveFunction(this.config.beforePack, \"beforePack\")\n if (beforePack != null) {\n await beforePack({\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n })\n }\n\n await this.info.installAppDependencies(this.platform, arch)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const framework = this.info.framework\n log.info(\n {\n platform: platformName,\n arch: Arch[arch],\n [`${framework.name}`]: framework.version,\n appOutDir: log.filePath(appOutDir),\n },\n `packaging`\n )\n\n await framework.prepareApplicationStageDirectory({\n packager: this,\n appOutDir,\n platformName,\n arch: Arch[arch],\n version: framework.version,\n })\n\n const excludePatterns: Array = []\n\n const computeParsedPatterns = (patterns: Array | null) => {\n if (patterns != null) {\n for (const pattern of patterns) {\n pattern.computeParsedPatterns(excludePatterns, this.info.projectDir)\n }\n }\n }\n\n const getFileMatchersOptions = this.createGetFileMatchersOptions(outDir, arch, platformSpecificBuildOptions)\n const macroExpander = getFileMatchersOptions.macroExpander\n const extraResourceMatchers = this.getExtraFileMatchers(true, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraResourceMatchers)\n const extraFileMatchers = this.getExtraFileMatchers(false, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraFileMatchers)\n\n const packContext: AfterPackContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const resourcesPath =\n this.platform === Platform.MAC\n ? path.join(appOutDir, framework.distMacOsAppName, \"Contents\", \"Resources\")\n : isElectronBased(framework)\n ? path.join(appOutDir, \"resources\")\n : appOutDir\n const taskManager = new AsyncTaskManager(this.info.cancellationToken)\n this.copyAppFiles(taskManager, asarOptions, resourcesPath, path.join(resourcesPath, \"app\"), packContext, platformSpecificBuildOptions, excludePatterns, macroExpander)\n await taskManager.awaitTasks()\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n if (framework.beforeCopyExtraFiles != null) {\n const resourcesRelativePath = this.platform === Platform.MAC ? \"Resources\" : isElectronBased(framework) ? \"resources\" : \"\"\n\n await framework.beforeCopyExtraFiles({\n packager: this,\n appOutDir,\n asarIntegrity: asarOptions == null || disableAsarIntegrity ? null : await computeData({ resourcesPath, resourcesRelativePath }),\n platformName,\n })\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n await copyFiles(extraResourceMatchers, transformerForExtraFiles)\n await copyFiles(extraFileMatchers, transformerForExtraFiles)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n await this.info.afterPack(packContext)\n\n if (framework.afterPack != null) {\n await framework.afterPack(packContext)\n }\n\n const isAsar = asarOptions != null\n await this.sanityCheckPackage(appOutDir, isAsar, framework)\n if (sign) {\n await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)\n }\n }\n\n protected async doSignAfterPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array) {\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const isAsar = asarOptions != null\n const packContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n await this.signApp(packContext, isAsar)\n const afterSign = resolveFunction(this.config.afterSign, \"afterSign\")\n if (afterSign != null) {\n await Promise.resolve(afterSign(packContext))\n }\n }\n\n // eslint-disable-next-line\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n return null\n }\n\n private copyAppFiles(\n taskManager: AsyncTaskManager,\n asarOptions: AsarOptions | null,\n resourcePath: string,\n defaultDestination: string,\n packContext: AfterPackContext,\n platformSpecificBuildOptions: DC,\n excludePatterns: Array,\n macroExpander: (it: string) => string\n ) {\n const appDir = this.info.appDir\n const config = this.config\n const isElectronCompile = asarOptions != null && isElectronCompileUsed(this.info)\n\n const mainMatchers = getMainFileMatchers(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this, packContext.outDir, isElectronCompile)\n if (excludePatterns.length > 0) {\n for (const matcher of mainMatchers) {\n matcher.excludePatterns = excludePatterns\n }\n }\n\n const framework = this.info.framework\n const transformer = createTransformer(\n appDir,\n config,\n isElectronCompile\n ? {\n originalMain: this.info.metadata.main,\n main: ELECTRON_COMPILE_SHIM_FILENAME,\n ...config.extraMetadata,\n }\n : config.extraMetadata,\n framework.createTransformer == null ? null : framework.createTransformer()\n )\n\n const _computeFileSets = (matchers: Array) => {\n return computeFileSets(matchers, this.info.isPrepackedAppAsar ? null : transformer, this, isElectronCompile).then(async result => {\n if (!this.info.isPrepackedAppAsar && !this.info.areNodeModulesHandledExternally) {\n const moduleFileMatcher = getNodeModuleFileMatcher(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this.info)\n result = result.concat(await computeNodeModuleFileSets(this, moduleFileMatcher))\n }\n return result.filter(it => it.files.length > 0)\n })\n }\n\n if (this.info.isPrepackedAppAsar) {\n taskManager.addTask(BluebirdPromise.each(_computeFileSets([new FileMatcher(appDir, resourcePath, macroExpander)]), it => copyAppFiles(it, this.info, transformer)))\n } else if (asarOptions == null) {\n // for ASAR all asar unpacked files will be extra transformed (e.g. sign of EXE and DLL) later,\n // for prepackaged asar extra transformation not supported yet,\n // so, extra transform if asar is disabled\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n const combinedTransformer: FileTransformer = file => {\n if (transformerForExtraFiles != null) {\n const result = transformerForExtraFiles(file)\n if (result != null) {\n return result\n }\n }\n return transformer(file)\n }\n\n taskManager.addTask(BluebirdPromise.each(_computeFileSets(mainMatchers), it => copyAppFiles(it, this.info, combinedTransformer)))\n } else {\n const unpackPattern = getFileMatchers(config, \"asarUnpack\", defaultDestination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: packContext.outDir,\n defaultSrc: appDir,\n })\n const fileMatcher = unpackPattern == null ? null : unpackPattern[0]\n taskManager.addTask(\n _computeFileSets(mainMatchers).then(async fileSets => {\n for (const fileSet of fileSets) {\n await transformFiles(transformer, fileSet)\n }\n\n await new AsarPackager(appDir, resourcePath, asarOptions, fileMatcher == null ? null : fileMatcher.createFilter()).pack(fileSets, this)\n })\n )\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise {\n return Promise.resolve()\n }\n\n getIconPath(): Promise {\n return Promise.resolve(null)\n }\n\n private async computeAsarOptions(customBuildOptions: DC): Promise {\n if (!isElectronBased(this.info.framework)) {\n return null\n }\n\n function errorMessage(name: string) {\n return `${name} is deprecated is deprecated and not supported — please use asarUnpack`\n }\n\n const buildMetadata = this.config as any\n if (buildMetadata[\"asar-unpack\"] != null) {\n throw new Error(errorMessage(\"asar-unpack\"))\n }\n if (buildMetadata[\"asar-unpack-dir\"] != null) {\n throw new Error(errorMessage(\"asar-unpack-dir\"))\n }\n\n const platformSpecific = customBuildOptions.asar\n const result = platformSpecific == null ? this.config.asar : platformSpecific\n if (result === false) {\n const appAsarStat = await statOrNull(path.join(this.info.appDir, \"app.asar\"))\n //noinspection ES6MissingAwait\n if (appAsarStat == null || !appAsarStat.isFile()) {\n log.warn(\n {\n solution: \"enable asar and use asarUnpack to unpack files that must be externally available\",\n },\n \"asar usage is disabled — this is strongly not recommended\"\n )\n }\n return null\n }\n\n if (result == null || result === true) {\n return {}\n }\n\n for (const name of [\"unpackDir\", \"unpack\"]) {\n if ((result as any)[name] != null) {\n throw new Error(errorMessage(`asar.${name}`))\n }\n }\n return deepAssign({}, result)\n }\n\n public getElectronSrcDir(dist: string): string {\n return path.resolve(this.projectDir, dist)\n }\n\n public getElectronDestinationDir(appOutDir: string): string {\n return appOutDir\n }\n\n getResourcesDir(appOutDir: string): string {\n if (this.platform === Platform.MAC) {\n return this.getMacOsResourcesDir(appOutDir)\n } else if (isElectronBased(this.info.framework)) {\n return path.join(appOutDir, \"resources\")\n } else {\n return appOutDir\n }\n }\n\n public getMacOsResourcesDir(appOutDir: string): string {\n return path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\", \"Resources\")\n }\n\n private async checkFileInPackage(resourcesDir: string, file: string, messagePrefix: string, isAsar: boolean) {\n const relativeFile = path.relative(this.info.appDir, path.resolve(this.info.appDir, file))\n if (isAsar) {\n await checkFileInArchive(path.join(resourcesDir, \"app.asar\"), relativeFile, messagePrefix)\n return\n }\n\n const pathParsed = path.parse(file)\n // Even when packaging to asar is disabled, it does not imply that the main file can not be inside an .asar archive.\n // This may occur when the packaging is done manually before processing with electron-builder.\n if (pathParsed.dir.includes(\".asar\")) {\n // The path needs to be split to the part with an asar archive which acts like a directory and the part with\n // the path to main file itself. (e.g. path/arch.asar/dir/index.js -> path/arch.asar, dir/index.js)\n // noinspection TypeScriptValidateJSTypes\n const pathSplit: Array = pathParsed.dir.split(path.sep)\n let partWithAsarIndex = 0\n pathSplit.some((pathPart: string, index: number) => {\n partWithAsarIndex = index\n return pathPart.endsWith(\".asar\")\n })\n const asarPath = path.join(...pathSplit.slice(0, partWithAsarIndex + 1))\n let mainPath = pathSplit.length > partWithAsarIndex + 1 ? path.join.apply(pathSplit.slice(partWithAsarIndex + 1)) : \"\"\n mainPath += path.join(mainPath, pathParsed.base)\n await checkFileInArchive(path.join(resourcesDir, \"app\", asarPath), mainPath, messagePrefix)\n } else {\n const fullPath = path.join(resourcesDir, \"app\", relativeFile)\n const outStat = await statOrNull(fullPath)\n if (outStat == null) {\n throw new Error(`${messagePrefix} \"${fullPath}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isFile()) {\n throw new Error(`${messagePrefix} \"${fullPath}\" is not a file. Seems like a wrong configuration.`)\n }\n }\n }\n }\n\n private async sanityCheckPackage(appOutDir: string, isAsar: boolean, framework: Framework): Promise {\n const outStat = await statOrNull(appOutDir)\n if (outStat == null) {\n throw new Error(`Output directory \"${appOutDir}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isDirectory()) {\n throw new Error(`Output directory \"${appOutDir}\" is not a directory. Seems like a wrong configuration.`)\n }\n }\n\n const resourcesDir = this.getResourcesDir(appOutDir)\n const mainFile = (framework.getMainFile == null ? null : framework.getMainFile(this.platform)) || this.info.metadata.main || \"index.js\"\n await this.checkFileInPackage(resourcesDir, mainFile, \"Application entry file\", isAsar)\n await this.checkFileInPackage(resourcesDir, \"package.json\", \"Application\", isAsar)\n }\n\n // tslint:disable-next-line:no-invalid-template-strings\n computeSafeArtifactName(\n suggestedName: string | null,\n ext: string,\n arch?: Arch | null,\n skipDefaultArch = true,\n defaultArch?: string,\n safePattern = \"${name}-${version}-${arch}.${ext}\"\n ): string | null {\n return computeSafeArtifactNameIfNeeded(suggestedName, () =>\n this.computeArtifactName(safePattern, ext, skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n )\n }\n\n expandArtifactNamePattern(\n targetSpecificOptions: TargetSpecificOptions | null | undefined,\n ext: string,\n arch?: Arch | null,\n defaultPattern?: string,\n skipDefaultArch = true,\n defaultArch?: string\n ): string {\n const { pattern, isUserForced } = this.artifactPatternConfig(targetSpecificOptions, defaultPattern)\n return this.computeArtifactName(pattern, ext, !isUserForced && skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n }\n\n artifactPatternConfig(targetSpecificOptions: TargetSpecificOptions | null | undefined, defaultPattern: string | undefined) {\n const userSpecifiedPattern = targetSpecificOptions?.artifactName || this.platformSpecificBuildOptions.artifactName || this.config.artifactName\n return {\n isUserForced: !!userSpecifiedPattern,\n pattern: userSpecifiedPattern || defaultPattern || \"${productName}-${version}-${arch}.${ext}\",\n }\n }\n\n expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string {\n // tslint:disable-next-line:no-invalid-template-strings\n return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, \"${productName} ${version} ${arch}.${ext}\", true)\n }\n\n private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined): string {\n const archName = arch == null ? null : getArtifactArchName(arch, ext)\n return this.expandMacro(pattern, archName, {\n ext,\n })\n }\n\n expandMacro(pattern: string, arch?: string | null, extra: any = {}, isProductNameSanitized = true): string {\n return doExpandMacro(pattern, arch, this.appInfo, { os: this.platform.buildConfigurationKey, ...extra }, isProductNameSanitized)\n }\n\n generateName2(ext: string | null, classifier: string | null | undefined, deployment: boolean): string {\n const dotExt = ext == null ? \"\" : `.${ext}`\n const separator = ext === \"deb\" ? \"_\" : \"-\"\n return `${deployment ? this.appInfo.name : this.appInfo.productFilename}${separator}${this.appInfo.version}${classifier == null ? \"\" : `${separator}${classifier}`}${dotExt}`\n }\n\n getTempFile(suffix: string): Promise {\n return this.info.tempDirManager.getTempFile({ suffix })\n }\n\n get fileAssociations(): Array {\n return asArray(this.config.fileAssociations).concat(asArray(this.platformSpecificBuildOptions.fileAssociations))\n }\n\n async getResource(custom: string | null | undefined, ...names: Array): Promise {\n const resourcesDir = this.info.buildResourcesDir\n if (custom === undefined) {\n const resourceList = await this.resourceList\n for (const name of names) {\n if (resourceList.includes(name)) {\n return path.join(resourcesDir, name)\n }\n }\n } else if (custom != null && !isEmptyOrSpaces(custom)) {\n const resourceList = await this.resourceList\n if (resourceList.includes(custom)) {\n return path.join(resourcesDir, custom)\n }\n\n let p = path.resolve(resourcesDir, custom)\n if ((await statOrNull(p)) == null) {\n p = path.resolve(this.projectDir, custom)\n if ((await statOrNull(p)) == null) {\n throw new InvalidConfigurationError(\n `cannot find specified resource \"${custom}\", nor relative to \"${resourcesDir}\", neither relative to project dir (\"${this.projectDir}\")`\n )\n }\n }\n return p\n }\n return null\n }\n\n get forceCodeSigning(): boolean {\n const forceCodeSigningPlatform = this.platformSpecificBuildOptions.forceCodeSigning\n return (forceCodeSigningPlatform == null ? this.config.forceCodeSigning : forceCodeSigningPlatform) || false\n }\n\n protected async getOrConvertIcon(format: IconFormat): Promise {\n const result = await this.resolveIcon(asArray(this.platformSpecificBuildOptions.icon || this.config.icon), [], format)\n if (result.length === 0) {\n const framework = this.info.framework\n if (framework.getDefaultIcon != null) {\n return framework.getDefaultIcon(this.platform)\n }\n\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(framework.name)} icon is used`)\n return this.getDefaultFrameworkIcon()\n } else {\n return result[0].file\n }\n }\n\n getDefaultFrameworkIcon(): string | null {\n const framework = this.info.framework\n return framework.getDefaultIcon == null ? null : framework.getDefaultIcon(this.platform)\n }\n\n // convert if need, validate size (it is a reason why tool is called even if file has target extension (already specified as foo.icns for example))\n async resolveIcon(sources: Array, fallbackSources: Array, outputFormat: IconFormat): Promise> {\n const args = [\n \"icon\",\n \"--format\",\n outputFormat,\n \"--root\",\n this.buildResourcesDir,\n \"--root\",\n this.projectDir,\n \"--out\",\n path.resolve(this.projectDir, this.config.directories!.output!, `.icon-${outputFormat}`),\n ]\n for (const source of sources) {\n args.push(\"--input\", source)\n }\n for (const source of fallbackSources) {\n args.push(\"--fallback-input\", source)\n }\n\n const result: IconConvertResult = await executeAppBuilderAsJson(args)\n const errorMessage = result.error\n if (errorMessage != null) {\n throw new InvalidConfigurationError(errorMessage, result.errorCode)\n }\n\n if (result.isFallback) {\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(this.info.framework.name)} icon is used`)\n }\n\n return result.icons || []\n }\n}\n\nexport interface IconInfo {\n file: string\n size: number\n}\n\ninterface IconConvertResult {\n icons?: Array\n\n error?: string\n errorCode?: string\n isFallback?: boolean\n}\n\nexport type IconFormat = \"icns\" | \"ico\" | \"set\"\n\nexport function isSafeGithubName(name: string) {\n return /^[0-9A-Za-z._-]+$/.test(name)\n}\n\nexport function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null {\n // GitHub only allows the listed characters in file names.\n if (suggestedName != null) {\n if (isSafeGithubName(suggestedName)) {\n return null\n }\n\n // prefer to use suggested name - so, if space is the only problem, just replace only space to dash\n suggestedName = suggestedName.replace(/ /g, \"-\")\n if (isSafeGithubName(suggestedName)) {\n return suggestedName\n }\n }\n\n return safeNameProducer()\n}\n\n// remove leading dot\nexport function normalizeExt(ext: string) {\n return ext.startsWith(\".\") ? ext.substring(1) : ext\n}\n\nexport function resolveFunction(executor: T | string, name: string): T {\n if (executor == null || typeof executor !== \"string\") {\n return executor\n }\n\n let p = executor as string\n if (p.startsWith(\".\")) {\n p = path.resolve(p)\n }\n\n try {\n p = require.resolve(p)\n } catch (e) {\n debug(e)\n p = path.resolve(p)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const m = require(p)\n const namedExport = m[name]\n if (namedExport == null) {\n return m.default || m\n } else {\n return namedExport\n }\n}\n\nexport function chooseNotNull(v1: string | null | undefined, v2: string | null | undefined): string | null | undefined {\n return v1 == null ? v2 : v1\n}\n\nfunction capitalizeFirstLetter(text: string) {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n\nexport function isSafeToUnpackElectronOnRemoteBuildServer(packager: PlatformPackager) {\n if (packager.platform !== Platform.LINUX || packager.config.remoteBuild === false) {\n return false\n }\n\n if (process.platform === \"win32\" || isEnvTrue(process.env._REMOTE_BUILD)) {\n return packager.config.electronDist == null && packager.config.electronDownload == null\n }\n return false\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/presets/rectCra.d.ts b/client/node_modules/app-builder-lib/out/presets/rectCra.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/presets/rectCra.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/presets/rectCra.js b/client/node_modules/app-builder-lib/out/presets/rectCra.js new file mode 100644 index 0000000000..b55db5c2de --- /dev/null +++ b/client/node_modules/app-builder-lib/out/presets/rectCra.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reactCra = void 0; +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const path = require("path"); +/** @internal */ +async function reactCra(projectDir) { + if ((await fs_1.statOrNull(path.join(projectDir, "public", "electron.js"))) == null) { + // noinspection SpellCheckingInspection + builder_util_1.log.warn("public/electron.js not found. Please see https://medium.com/@kitze/%EF%B8%8F-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3"); + } + return { + directories: { + buildResources: "assets", + }, + files: ["build/**/*"], + extraMetadata: { + main: "build/electron.js", + }, + }; +} +exports.reactCra = reactCra; +//# sourceMappingURL=rectCra.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/presets/rectCra.js.map b/client/node_modules/app-builder-lib/out/presets/rectCra.js.map new file mode 100644 index 0000000000..de74ba331a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/presets/rectCra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rectCra.js","sourceRoot":"","sources":["../../src/presets/rectCra.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAClC,4CAAgD;AAChD,6BAA4B;AAG5B,gBAAgB;AACT,KAAK,UAAU,QAAQ,CAAC,UAAkB;IAC/C,IAAI,CAAC,MAAM,eAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;QAC9E,uCAAuC;QACvC,kBAAG,CAAC,IAAI,CAAC,8IAA8I,CAAC,CAAA;KACzJ;IAED,OAAO;QACL,WAAW,EAAE;YACX,cAAc,EAAE,QAAQ;SACzB;QACD,KAAK,EAAE,CAAC,YAAY,CAAC;QACrB,aAAa,EAAE;YACb,IAAI,EAAE,mBAAmB;SAC1B;KACF,CAAA;AACH,CAAC;AAfD,4BAeC","sourcesContent":["import { log } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\n\n/** @internal */\nexport async function reactCra(projectDir: string): Promise {\n if ((await statOrNull(path.join(projectDir, \"public\", \"electron.js\"))) == null) {\n // noinspection SpellCheckingInspection\n log.warn(\"public/electron.js not found. Please see https://medium.com/@kitze/%EF%B8%8F-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3\")\n }\n\n return {\n directories: {\n buildResources: \"assets\",\n },\n files: [\"build/**/*\"],\n extraMetadata: {\n main: \"build/electron.js\",\n },\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.d.ts b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.d.ts new file mode 100644 index 0000000000..a38566d4c9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.d.ts @@ -0,0 +1,17 @@ +/// +import { Arch } from "builder-util"; +import { ClientRequest } from "http"; +import { HttpPublisher, PublishContext } from "electron-publish"; +import { BitbucketOptions } from "builder-util-runtime/out/publishOptions"; +export declare class BitbucketPublisher extends HttpPublisher { + readonly providerName = "bitbucket"; + readonly hostname = "api.bitbucket.org"; + private readonly info; + private readonly auth; + private readonly basePath; + constructor(context: PublishContext, info: BitbucketOptions); + protected doUpload(fileName: string, _arch: Arch, _dataLength: number, _requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, file: string): Promise; + deleteRelease(filename: string): Promise; + toString(): string; + static convertAppPassword(username: string, token: string): string; +} diff --git a/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js new file mode 100644 index 0000000000..b304c4bef8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BitbucketPublisher = void 0; +const builder_util_1 = require("builder-util"); +const nodeHttpExecutor_1 = require("builder-util/out/nodeHttpExecutor"); +const electron_publish_1 = require("electron-publish"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const FormData = require("form-data"); +const fs_extra_1 = require("fs-extra"); +class BitbucketPublisher extends electron_publish_1.HttpPublisher { + constructor(context, info) { + super(context); + this.providerName = "bitbucket"; + this.hostname = "api.bitbucket.org"; + const token = info.token || process.env.BITBUCKET_TOKEN || null; + const username = info.username || process.env.BITBUCKET_USERNAME || null; + if (builder_util_1.isEmptyOrSpaces(token)) { + throw new builder_util_1.InvalidConfigurationError(`Bitbucket token is not set using env "BITBUCKET_TOKEN" (see https://www.electron.build/configuration/publish#BitbucketOptions)`); + } + if (builder_util_1.isEmptyOrSpaces(username)) { + builder_util_1.log.warn('No Bitbucket username provided via "BITBUCKET_USERNAME". Defaulting to use repo owner.'); + } + this.info = info; + this.auth = BitbucketPublisher.convertAppPassword(username !== null && username !== void 0 ? username : this.info.owner, token); + this.basePath = `/2.0/repositories/${this.info.owner}/${this.info.slug}/downloads`; + } + doUpload(fileName, _arch, _dataLength, _requestProcessor, file) { + return builder_util_runtime_1.HttpExecutor.retryOnServerError(async () => { + const fileContent = await fs_extra_1.readFile(file); + const form = new FormData(); + form.append("files", fileContent, fileName); + const upload = { + hostname: this.hostname, + path: this.basePath, + headers: form.getHeaders(), + timeout: this.info.timeout || undefined, + }; + await nodeHttpExecutor_1.httpExecutor.doApiRequest(builder_util_runtime_1.configureRequestOptions(upload, this.auth, "POST"), this.context.cancellationToken, it => form.pipe(it)); + return fileName; + }); + } + async deleteRelease(filename) { + const req = { + hostname: this.hostname, + path: `${this.basePath}/${filename}`, + timeout: this.info.timeout || undefined, + }; + await nodeHttpExecutor_1.httpExecutor.request(builder_util_runtime_1.configureRequestOptions(req, this.auth, "DELETE"), this.context.cancellationToken); + } + toString() { + const { owner, slug, channel } = this.info; + return `Bitbucket (owner: ${owner}, slug: ${slug}, channel: ${channel})`; + } + static convertAppPassword(username, token) { + const base64encodedData = Buffer.from(`${username}:${token.trim()}`).toString("base64"); + return `Basic ${base64encodedData}`; + } +} +exports.BitbucketPublisher = BitbucketPublisher; +//# sourceMappingURL=BitbucketPublisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js.map b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js.map new file mode 100644 index 0000000000..46496ddae5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/BitbucketPublisher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BitbucketPublisher.js","sourceRoot":"","sources":["../../src/publish/BitbucketPublisher.ts"],"names":[],"mappings":";;;AAAA,+CAAoF;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AAC,GAAG,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACvF,OAAO,SAAS,iBAAiB,EAAE,CAAA;IACrC,CAAC;CACF;AAnED,gDAmEC","sourcesContent":["import { Arch, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { httpExecutor } from \"builder-util/out/nodeHttpExecutor\"\nimport { ClientRequest, RequestOptions } from \"http\"\nimport { HttpPublisher, PublishContext } from \"electron-publish\"\nimport { BitbucketOptions } from \"builder-util-runtime/out/publishOptions\"\nimport { configureRequestOptions, HttpExecutor } from \"builder-util-runtime\"\nimport * as FormData from \"form-data\"\nimport { readFile } from \"fs-extra\"\n\nexport class BitbucketPublisher extends HttpPublisher {\n readonly providerName = \"bitbucket\"\n readonly hostname = \"api.bitbucket.org\"\n\n private readonly info: BitbucketOptions\n private readonly auth: string\n private readonly basePath: string\n\n constructor(context: PublishContext, info: BitbucketOptions) {\n super(context)\n\n const token = info.token || process.env.BITBUCKET_TOKEN || null\n const username = info.username || process.env.BITBUCKET_USERNAME || null\n\n if (isEmptyOrSpaces(token)) {\n throw new InvalidConfigurationError(`Bitbucket token is not set using env \"BITBUCKET_TOKEN\" (see https://www.electron.build/configuration/publish#BitbucketOptions)`)\n }\n\n if (isEmptyOrSpaces(username)) {\n log.warn('No Bitbucket username provided via \"BITBUCKET_USERNAME\". Defaulting to use repo owner.')\n }\n\n this.info = info\n this.auth = BitbucketPublisher.convertAppPassword(username ?? this.info.owner, token)\n this.basePath = `/2.0/repositories/${this.info.owner}/${this.info.slug}/downloads`\n }\n\n protected doUpload(\n fileName: string,\n _arch: Arch,\n _dataLength: number,\n _requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,\n file: string\n ): Promise {\n return HttpExecutor.retryOnServerError(async () => {\n const fileContent = await readFile(file)\n const form = new FormData()\n form.append(\"files\", fileContent, fileName)\n const upload: RequestOptions = {\n hostname: this.hostname,\n path: this.basePath,\n headers: form.getHeaders(),\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.doApiRequest(configureRequestOptions(upload, this.auth, \"POST\"), this.context.cancellationToken, it => form.pipe(it))\n return fileName\n })\n }\n\n async deleteRelease(filename: string): Promise {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/${filename}`,\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.request(configureRequestOptions(req, this.auth, \"DELETE\"), this.context.cancellationToken)\n }\n\n toString() {\n const { owner, slug, channel } = this.info\n return `Bitbucket (owner: ${owner}, slug: ${slug}, channel: ${channel})`\n }\n\n static convertAppPassword(username: string, token: string) {\n const base64encodedData = Buffer.from(`${username}:${token.trim()}`).toString(\"base64\")\n return `Basic ${base64encodedData}`\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.d.ts b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.d.ts new file mode 100644 index 0000000000..f28628fd17 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.d.ts @@ -0,0 +1,102 @@ +/// +import { Arch } from "builder-util"; +import { ClientRequest } from "http"; +import { HttpPublisher, PublishContext } from "electron-publish"; +import { KeygenOptions } from "builder-util-runtime/out/publishOptions"; +export interface KeygenError { + title: string; + detail: string; + code: string; +} +export interface KeygenRelease { + id: string; + type: "releases"; + attributes: { + name: string | null; + description: string | null; + channel: "stable" | "rc" | "beta" | "alpha" | "dev"; + status: "DRAFT" | "PUBLISHED" | "YANKED"; + tag: string; + version: string; + semver: { + major: number; + minor: number; + patch: number; + prerelease: string | null; + build: string | null; + }; + metadata: { + [s: string]: any; + }; + created: string; + updated: string; + yanked: string | null; + }; + relationships: { + account: { + data: { + type: "accounts"; + id: string; + }; + }; + product: { + data: { + type: "products"; + id: string; + }; + }; + }; +} +export interface KeygenArtifact { + id: string; + type: "artifacts"; + attributes: { + filename: string; + filetype: string | null; + filesize: number | null; + platform: string | null; + arch: string | null; + signature: string | null; + checksum: string | null; + status: "WAITING" | "UPLOADED" | "FAILED" | "YANKED"; + metadata: { + [s: string]: any; + }; + created: string; + updated: string; + }; + relationships: { + account: { + data: { + type: "accounts"; + id: string; + }; + }; + release: { + data: { + type: "releases"; + id: string; + }; + }; + }; + links: { + redirect: string; + }; +} +export declare class KeygenPublisher extends HttpPublisher { + readonly providerName = "keygen"; + readonly hostname = "api.keygen.sh"; + private readonly info; + private readonly auth; + private readonly version; + private readonly basePath; + constructor(context: PublishContext, info: KeygenOptions, version: string); + protected doUpload(fileName: string, _arch: Arch, dataLength: number, requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, _file: string): Promise; + private uploadArtifact; + private createArtifact; + private getOrCreateRelease; + private getRelease; + private createRelease; + deleteRelease(releaseId: string): Promise; + toString(): string; +} diff --git a/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js new file mode 100644 index 0000000000..7b10d156a3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js @@ -0,0 +1,167 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.KeygenPublisher = void 0; +const builder_util_1 = require("builder-util"); +const nodeHttpExecutor_1 = require("builder-util/out/nodeHttpExecutor"); +const electron_publish_1 = require("electron-publish"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const filename_1 = require("../util/filename"); +class KeygenPublisher extends electron_publish_1.HttpPublisher { + constructor(context, info, version) { + super(context); + this.providerName = "keygen"; + this.hostname = "api.keygen.sh"; + const token = process.env.KEYGEN_TOKEN; + if (builder_util_1.isEmptyOrSpaces(token)) { + throw new builder_util_1.InvalidConfigurationError(`Keygen token is not set using env "KEYGEN_TOKEN" (see https://www.electron.build/configuration/publish#KeygenOptions)`); + } + this.info = info; + this.auth = `Bearer ${token.trim()}`; + this.version = version; + this.basePath = `/v1/accounts/${this.info.account}`; + } + doUpload(fileName, _arch, dataLength, requestProcessor, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _file) { + return builder_util_runtime_1.HttpExecutor.retryOnServerError(async () => { + const { data, errors } = await this.getOrCreateRelease(); + if (errors) { + throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`); + } + await this.uploadArtifact(data.id, fileName, dataLength, requestProcessor); + return data.id; + }); + } + async uploadArtifact(releaseId, fileName, dataLength, requestProcessor) { + const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength); + if (errors) { + throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`); + } + // Follow the redirect and upload directly to S3-equivalent storage provider + const url = new URL(data.links.redirect); + const upload = { + hostname: url.hostname, + path: url.pathname + url.search, + headers: { + "Content-Length": dataLength, + }, + timeout: this.info.timeout || undefined, + }; + await nodeHttpExecutor_1.httpExecutor.doApiRequest(builder_util_runtime_1.configureRequestOptions(upload, null, "PUT"), this.context.cancellationToken, requestProcessor); + } + async createArtifact(releaseId, fileName, dataLength) { + const upload = { + hostname: this.hostname, + path: `${this.basePath}/artifacts`, + headers: { + "Content-Type": "application/vnd.api+json", + Accept: "application/vnd.api+json", + "Keygen-Version": "1.1", + Prefer: "no-redirect", + }, + timeout: this.info.timeout || undefined, + }; + const data = { + type: "artifacts", + attributes: { + filename: fileName, + filetype: filename_1.getCompleteExtname(fileName), + filesize: dataLength, + platform: this.info.platform, + }, + relationships: { + release: { + data: { + type: "releases", + id: releaseId, + }, + }, + }, + }; + builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create artifact"); + return builder_util_runtime_1.parseJson(nodeHttpExecutor_1.httpExecutor.request(builder_util_runtime_1.configureRequestOptions(upload, this.auth, "POST"), this.context.cancellationToken, { data })); + } + async getOrCreateRelease() { + try { + // First, we'll attempt to fetch the release. + return await this.getRelease(); + } + catch (e) { + if (e.statusCode !== 404) { + throw e; + } + try { + // Next, if the release doesn't exist, we'll attempt to create it. + return await this.createRelease(); + } + catch (e) { + if (e.statusCode !== 409 && e.statusCode !== 422) { + throw e; + } + // Lastly, when a conflict occurs (in the case of parallel uploads), + // we'll try to fetch it one last time. + return this.getRelease(); + } + } + } + async getRelease() { + const req = { + hostname: this.hostname, + path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`, + headers: { + Accept: "application/vnd.api+json", + "Keygen-Version": "1.1", + }, + timeout: this.info.timeout || undefined, + }; + return builder_util_runtime_1.parseJson(nodeHttpExecutor_1.httpExecutor.request(builder_util_runtime_1.configureRequestOptions(req, this.auth, "GET"), this.context.cancellationToken, null)); + } + async createRelease() { + const req = { + hostname: this.hostname, + path: `${this.basePath}/releases`, + headers: { + "Content-Type": "application/vnd.api+json", + Accept: "application/vnd.api+json", + "Keygen-Version": "1.1", + }, + timeout: this.info.timeout || undefined, + }; + const data = { + type: "releases", + attributes: { + version: this.version, + channel: this.info.channel || "stable", + status: "PUBLISHED", + }, + relationships: { + product: { + data: { + type: "products", + id: this.info.product, + }, + }, + }, + }; + builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create release"); + return builder_util_runtime_1.parseJson(nodeHttpExecutor_1.httpExecutor.request(builder_util_runtime_1.configureRequestOptions(req, this.auth, "POST"), this.context.cancellationToken, { data })); + } + async deleteRelease(releaseId) { + const req = { + hostname: this.hostname, + path: `${this.basePath}/releases/${releaseId}`, + headers: { + Accept: "application/vnd.api+json", + "Keygen-Version": "1.1", + }, + timeout: this.info.timeout || undefined, + }; + await nodeHttpExecutor_1.httpExecutor.request(builder_util_runtime_1.configureRequestOptions(req, this.auth, "DELETE"), this.context.cancellationToken); + } + toString() { + const { account, product, platform } = this.info; + return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`; + } +} +exports.KeygenPublisher = KeygenPublisher; +//# sourceMappingURL=KeygenPublisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js.map b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js.map new file mode 100644 index 0000000000..2eee54aea0 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/KeygenPublisher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"KeygenPublisher.js","sourceRoot":"","sources":["../../src/publish/KeygenPublisher.ts"],"names":[],"mappings":";;;AAAA,+CAAoF;AACpF,wEAAgE;AAEhE,uDAAgE;AAEhE,+DAAuF;AACvF,+CAAqD;AAyErD,MAAa,eAAgB,SAAQ,gCAAa;IAShD,YAAY,OAAuB,EAAE,IAAmB,EAAE,OAAe;QACvE,KAAK,CAAC,OAAO,CAAC,CAAA;QATP,iBAAY,GAAG,QAAQ,CAAA;QACvB,aAAQ,GAAG,eAAe,CAAA;QAUjC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;QACtC,IAAI,8BAAe,CAAC,KAAK,CAAC,EAAE;YAC1B,MAAM,IAAI,wCAAyB,CAAC,uHAAuH,CAAC,CAAA;SAC7J;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,UAAU,KAAK,CAAC,IAAI,EAAE,EAAE,CAAA;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,gBAAgB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAA;IACrD,CAAC;IAES,QAAQ,CAChB,QAAgB,EAChB,KAAW,EACX,UAAkB,EAClB,gBAAkF;IAClF,6DAA6D;IAC7D,KAAa;QAEb,OAAO,mCAAY,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE;YAChD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAA;YACxD,IAAI,MAAM,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,8CAA8C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;aACxF;YAED,MAAM,IAAI,CAAC,cAAc,CAAC,IAAK,CAAC,EAAE,EAAE,QAA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I,CAAC,IAAI,CAAC,OAAO;qBACtB;iBACF;aACF;SACF,CAAA;QAED,kBAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,uBAAuB,CAAC,CAAA;QAElE,OAAO,gCAAS,CAAC,+BAAY,CAAC,OAAO,CAAC,8CAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACnI,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,GAAG,GAAmB;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,aAAa,SAAS,EAAE;YAC9C,OAAO,EAAE;gBACP,MAAM,EAAE,0BAA0B;gBAClC,gBAAgB,EAAE,KAAK;aACxB;YACD,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS;SACxC,CAAA;QACD,MAAM,+BAAY,CAAC,OAAO,CAAC,8CAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC/G,CAAC;IAED,QAAQ;QACN,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAChD,OAAO,oBAAoB,OAAO,cAAc,OAAO,eAAe,QAAQ,cAAc,IAAI,CAAC,OAAO,GAAG,CAAA;IAC7G,CAAC;CACF;AAjMD,0CAiMC","sourcesContent":["import { Arch, InvalidConfigurationError, log, isEmptyOrSpaces } from \"builder-util\"\nimport { httpExecutor } from \"builder-util/out/nodeHttpExecutor\"\nimport { ClientRequest, RequestOptions } from \"http\"\nimport { HttpPublisher, PublishContext } from \"electron-publish\"\nimport { KeygenOptions } from \"builder-util-runtime/out/publishOptions\"\nimport { configureRequestOptions, HttpExecutor, parseJson } from \"builder-util-runtime\"\nimport { getCompleteExtname } from \"../util/filename\"\n\ntype RecursivePartial = {\n [P in keyof T]?: RecursivePartial\n}\n\nexport interface KeygenError {\n title: string\n detail: string\n code: string\n}\n\nexport interface KeygenRelease {\n id: string\n type: \"releases\"\n attributes: {\n name: string | null\n description: string | null\n channel: \"stable\" | \"rc\" | \"beta\" | \"alpha\" | \"dev\"\n status: \"DRAFT\" | \"PUBLISHED\" | \"YANKED\"\n tag: string\n version: string\n semver: {\n major: number\n minor: number\n patch: number\n prerelease: string | null\n build: string | null\n }\n metadata: { [s: string]: any }\n created: string\n updated: string\n yanked: string | null\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n product: {\n data: { type: \"products\"; id: string }\n }\n }\n}\n\nexport interface KeygenArtifact {\n id: string\n type: \"artifacts\"\n attributes: {\n filename: string\n filetype: string | null\n filesize: number | null\n platform: string | null\n arch: string | null\n signature: string | null\n checksum: string | null\n status: \"WAITING\" | \"UPLOADED\" | \"FAILED\" | \"YANKED\"\n metadata: { [s: string]: any }\n created: string\n updated: string\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n release: {\n data: { type: \"releases\"; id: string }\n }\n }\n links: {\n redirect: string\n }\n}\n\nexport class KeygenPublisher extends HttpPublisher {\n readonly providerName = \"keygen\"\n readonly hostname = \"api.keygen.sh\"\n\n private readonly info: KeygenOptions\n private readonly auth: string\n private readonly version: string\n private readonly basePath: string\n\n constructor(context: PublishContext, info: KeygenOptions, version: string) {\n super(context)\n\n const token = process.env.KEYGEN_TOKEN\n if (isEmptyOrSpaces(token)) {\n throw new InvalidConfigurationError(`Keygen token is not set using env \"KEYGEN_TOKEN\" (see https://www.electron.build/configuration/publish#KeygenOptions)`)\n }\n\n this.info = info\n this.auth = `Bearer ${token.trim()}`\n this.version = version\n this.basePath = `/v1/accounts/${this.info.account}`\n }\n\n protected doUpload(\n fileName: string,\n _arch: Arch,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _file: string\n ): Promise {\n return HttpExecutor.retryOnServerError(async () => {\n const { data, errors } = await this.getOrCreateRelease()\n if (errors) {\n throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`)\n }\n\n await this.uploadArtifact(data!.id, fileName, dataLength, requestProcessor)\n\n return data!.id\n })\n }\n\n private async uploadArtifact(\n releaseId: any,\n fileName: string,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void\n ): Promise {\n const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength)\n if (errors) {\n throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`)\n }\n\n // Follow the redirect and upload directly to S3-equivalent storage provider\n const url = new URL(data!.links.redirect)\n const upload: RequestOptions = {\n hostname: url.hostname,\n path: url.pathname + url.search,\n headers: {\n \"Content-Length\": dataLength,\n },\n timeout: this.info.timeout || undefined,\n }\n\n await httpExecutor.doApiRequest(configureRequestOptions(upload, null, \"PUT\"), this.context.cancellationToken, requestProcessor)\n }\n\n private async createArtifact(releaseId: any, fileName: string, dataLength: number): Promise<{ data?: KeygenArtifact; errors?: KeygenError[] }> {\n const upload: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/artifacts`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n Prefer: \"no-redirect\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial = {\n type: \"artifacts\",\n attributes: {\n filename: fileName,\n filetype: getCompleteExtname(fileName),\n filesize: dataLength,\n platform: this.info.platform,\n },\n relationships: {\n release: {\n data: {\n type: \"releases\",\n id: releaseId,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create artifact\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(upload, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n private async getOrCreateRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n try {\n // First, we'll attempt to fetch the release.\n return await this.getRelease()\n } catch (e) {\n if (e.statusCode !== 404) {\n throw e\n }\n\n try {\n // Next, if the release doesn't exist, we'll attempt to create it.\n return await this.createRelease()\n } catch (e) {\n if (e.statusCode !== 409 && e.statusCode !== 422) {\n throw e\n }\n\n // Lastly, when a conflict occurs (in the case of parallel uploads),\n // we'll try to fetch it one last time.\n return this.getRelease()\n }\n }\n }\n\n private async getRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"GET\"), this.context.cancellationToken, null))\n }\n\n private async createRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial = {\n type: \"releases\",\n attributes: {\n version: this.version,\n channel: this.info.channel || \"stable\",\n status: \"PUBLISHED\",\n },\n relationships: {\n product: {\n data: {\n type: \"products\",\n id: this.info.product,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create release\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n async deleteRelease(releaseId: string): Promise {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${releaseId}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.request(configureRequestOptions(req, this.auth, \"DELETE\"), this.context.cancellationToken)\n }\n\n toString() {\n const { account, product, platform } = this.info\n return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/PublishManager.d.ts b/client/node_modules/app-builder-lib/out/publish/PublishManager.d.ts new file mode 100644 index 0000000000..504cd09e2b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/PublishManager.d.ts @@ -0,0 +1,37 @@ +/// +import { Arch } from "builder-util"; +import { CancellationToken, PublishConfiguration, PublishProvider } from "builder-util-runtime"; +import { PublishContext, Publisher, PublishOptions } from "electron-publish"; +import { MultiProgress } from "electron-publish/out/multiProgress"; +import { PlatformSpecificBuildOptions } from "../index"; +import { Packager } from "../packager"; +import { PlatformPackager } from "../platformPackager"; +export declare class PublishManager implements PublishContext { + private readonly packager; + private readonly publishOptions; + readonly cancellationToken: CancellationToken; + private readonly nameToPublisher; + private readonly taskManager; + readonly isPublish: boolean; + readonly progress: MultiProgress | null; + private readonly updateFileWriteTask; + constructor(packager: Packager, publishOptions: PublishOptions, cancellationToken?: CancellationToken); + private getAppInfo; + getGlobalPublishConfigurations(): Promise | null>; + private artifactCreatedWithoutExplicitPublishConfig; + private getOrCreatePublisher; + cancelTasks(): void; + awaitTasks(): Promise; +} +export declare function getAppUpdatePublishConfiguration(packager: PlatformPackager, arch: Arch, errorIfCannot: boolean): Promise<{ + updaterCacheDirName: string; + provider: PublishProvider; + publisherName?: string[] | null | undefined; + publishAutoUpdate?: boolean | undefined; + requestHeaders?: import("http").OutgoingHttpHeaders | undefined; + timeout?: number | null | undefined; +} | null>; +export declare function getPublishConfigsForUpdateInfo(packager: PlatformPackager, publishConfigs: Array | null, arch: Arch | null): Promise | null>; +export declare function createPublisher(context: PublishContext, version: string, publishConfig: PublishConfiguration, options: PublishOptions, packager: Packager): Publisher | null; +export declare function computeDownloadUrl(publishConfiguration: PublishConfiguration, fileName: string | null, packager: PlatformPackager): string; +export declare function getPublishConfigs(platformPackager: PlatformPackager, targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined, arch: Arch | null, errorIfCannot: boolean): Promise | null>; diff --git a/client/node_modules/app-builder-lib/out/publish/PublishManager.js b/client/node_modules/app-builder-lib/out/publish/PublishManager.js new file mode 100644 index 0000000000..2d923e9346 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/PublishManager.js @@ -0,0 +1,471 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getPublishConfigs = exports.computeDownloadUrl = exports.createPublisher = exports.getPublishConfigsForUpdateInfo = exports.getAppUpdatePublishConfiguration = exports.PublishManager = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const debug_1 = require("debug"); +const electron_publish_1 = require("electron-publish"); +const gitHubPublisher_1 = require("electron-publish/out/gitHubPublisher"); +const multiProgress_1 = require("electron-publish/out/multiProgress"); +const s3Publisher_1 = require("./s3/s3Publisher"); +const spacesPublisher_1 = require("./s3/spacesPublisher"); +const promises_1 = require("fs/promises"); +const isCi = require("is-ci"); +const path = require("path"); +const url = require("url"); +const index_1 = require("../index"); +const macroExpander_1 = require("../util/macroExpander"); +const SnapStorePublisher_1 = require("./SnapStorePublisher"); +const updateInfoBuilder_1 = require("./updateInfoBuilder"); +const KeygenPublisher_1 = require("./KeygenPublisher"); +const BitbucketPublisher_1 = require("./BitbucketPublisher"); +const publishForPrWarning = "There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)" + + "\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you."; +const debug = debug_1.default("electron-builder:publish"); +function checkOptions(publishPolicy) { + if (publishPolicy != null && publishPolicy !== "onTag" && publishPolicy !== "onTagOrDraft" && publishPolicy !== "always" && publishPolicy !== "never") { + if (typeof publishPolicy === "string") { + throw new builder_util_1.InvalidConfigurationError(`Expected one of "onTag", "onTagOrDraft", "always", "never", but got ${JSON.stringify(publishPolicy)}.\nPlease note that publish configuration should be specified under "config"`); + } + } +} +class PublishManager { + constructor(packager, publishOptions, cancellationToken = packager.cancellationToken) { + this.packager = packager; + this.publishOptions = publishOptions; + this.cancellationToken = cancellationToken; + this.nameToPublisher = new Map(); + this.isPublish = false; + this.progress = process.stdout.isTTY ? new multiProgress_1.MultiProgress() : null; + this.updateFileWriteTask = []; + checkOptions(publishOptions.publish); + this.taskManager = new builder_util_1.AsyncTaskManager(cancellationToken); + const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true"; + if (!builder_util_1.isPullRequest() || forcePublishForPr) { + if (publishOptions.publish === undefined) { + if (process.env.npm_lifecycle_event === "release") { + publishOptions.publish = "always"; + } + else { + const tag = electron_publish_1.getCiTag(); + if (tag != null) { + builder_util_1.log.info({ reason: "tag is defined", tag }, "artifacts will be published"); + publishOptions.publish = "onTag"; + } + else if (isCi) { + builder_util_1.log.info({ reason: "CI detected" }, "artifacts will be published if draft release exists"); + publishOptions.publish = "onTagOrDraft"; + } + } + } + const publishPolicy = publishOptions.publish; + this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || electron_publish_1.getCiTag() != null); + if (this.isPublish && forcePublishForPr) { + builder_util_1.log.warn(publishForPrWarning); + } + } + else if (publishOptions.publish !== "never") { + builder_util_1.log.info({ + reason: "current build is a part of pull request", + solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\n${publishForPrWarning}`, + }, "publishing will be skipped"); + } + packager.addAfterPackHandler(async (event) => { + const packager = event.packager; + if (event.electronPlatformName === "darwin") { + if (!event.targets.some(it => it.name === "dmg" || it.name === "zip")) { + return; + } + } + else if (packager.platform === index_1.Platform.WINDOWS) { + if (!event.targets.some(it => isSuitableWindowsTarget(it))) { + return; + } + } + else { + // AppImage writes data to AppImage stage dir, not to linux-unpacked + return; + } + const publishConfig = await getAppUpdatePublishConfiguration(packager, event.arch, this.isPublish); + if (publishConfig != null) { + await promises_1.writeFile(path.join(packager.getResourcesDir(event.appOutDir), "app-update.yml"), builder_util_1.serializeToYaml(publishConfig)); + } + }); + packager.artifactCreated(event => { + const publishConfiguration = event.publishConfig; + if (publishConfiguration == null) { + this.taskManager.addTask(this.artifactCreatedWithoutExplicitPublishConfig(event)); + } + else if (this.isPublish) { + if (debug.enabled) { + debug(`artifactCreated (isPublish: ${this.isPublish}): ${builder_util_1.safeStringifyJson(event, new Set(["packager"]))},\n publishConfig: ${builder_util_1.safeStringifyJson(publishConfiguration)}`); + } + this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager)); + } + }); + } + getAppInfo(platformPackager) { + return platformPackager == null ? this.packager.appInfo : platformPackager.appInfo; + } + async getGlobalPublishConfigurations() { + const publishers = this.packager.config.publish; + return await resolvePublishConfigurations(publishers, null, this.packager, null, true); + } + /** @internal */ + scheduleUpload(publishConfig, event, appInfo) { + if (publishConfig.provider === "generic") { + return; + } + const publisher = this.getOrCreatePublisher(publishConfig, appInfo); + if (publisher == null) { + builder_util_1.log.debug({ + file: event.file, + reason: "publisher is null", + publishConfig: builder_util_1.safeStringifyJson(publishConfig), + }, "not published"); + return; + } + const providerName = publisher.providerName; + if (this.publishOptions.publish === "onTagOrDraft" && electron_publish_1.getCiTag() == null && providerName !== "bitbucket" && providerName !== "github") { + builder_util_1.log.info({ file: event.file, reason: "current build is not for a git tag", publishPolicy: "onTagOrDraft" }, `not published to ${providerName}`); + return; + } + if (publishConfig.timeout) { + event.timeout = publishConfig.timeout; + } + this.taskManager.addTask(publisher.upload(event)); + } + async artifactCreatedWithoutExplicitPublishConfig(event) { + const platformPackager = event.packager; + const target = event.target; + const publishConfigs = await getPublishConfigs(platformPackager, target == null ? null : target.options, event.arch, this.isPublish); + if (debug.enabled) { + debug(`artifactCreated (isPublish: ${this.isPublish}): ${builder_util_1.safeStringifyJson(event, new Set(["packager"]))},\n publishConfigs: ${builder_util_1.safeStringifyJson(publishConfigs)}`); + } + const eventFile = event.file; + if (publishConfigs == null) { + if (this.isPublish) { + builder_util_1.log.debug({ file: eventFile, reason: "no publish configs" }, "not published"); + } + return; + } + if (this.isPublish) { + for (const publishConfig of publishConfigs) { + if (this.cancellationToken.cancelled) { + builder_util_1.log.debug({ file: event.file, reason: "cancelled" }, "not published"); + break; + } + this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager)); + } + } + if (event.isWriteUpdateInfo && + target != null && + eventFile != null && + !this.cancellationToken.cancelled && + (platformPackager.platform !== index_1.Platform.WINDOWS || isSuitableWindowsTarget(target))) { + this.taskManager.addTask(updateInfoBuilder_1.createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it))); + } + } + getOrCreatePublisher(publishConfig, appInfo) { + // to not include token into cache key + const providerCacheKey = builder_util_1.safeStringifyJson(publishConfig); + let publisher = this.nameToPublisher.get(providerCacheKey); + if (publisher == null) { + publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager); + this.nameToPublisher.set(providerCacheKey, publisher); + builder_util_1.log.info({ publisher: publisher.toString() }, "publishing"); + } + return publisher; + } + // noinspection JSUnusedGlobalSymbols + cancelTasks() { + this.taskManager.cancelTasks(); + this.nameToPublisher.clear(); + } + async awaitTasks() { + await this.taskManager.awaitTasks(); + const updateInfoFileTasks = this.updateFileWriteTask; + if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) { + return; + } + await updateInfoBuilder_1.writeUpdateInfoFiles(updateInfoFileTasks, this.packager); + await this.taskManager.awaitTasks(); + } +} +exports.PublishManager = PublishManager; +async function getAppUpdatePublishConfiguration(packager, arch, errorIfCannot) { + const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, arch, errorIfCannot), arch); + if (publishConfigs == null || publishConfigs.length === 0) { + return null; + } + const publishConfig = { + ...publishConfigs[0], + updaterCacheDirName: packager.appInfo.updaterCacheDirName, + }; + if (packager.platform === index_1.Platform.WINDOWS && publishConfig.publisherName == null) { + const winPackager = packager; + const publisherName = winPackager.isForceCodeSigningVerification ? await winPackager.computedPublisherName.value : undefined; + if (publisherName != null) { + publishConfig.publisherName = publisherName; + } + } + return publishConfig; +} +exports.getAppUpdatePublishConfiguration = getAppUpdatePublishConfiguration; +async function getPublishConfigsForUpdateInfo(packager, publishConfigs, arch) { + if (publishConfigs === null) { + return null; + } + if (publishConfigs.length === 0) { + builder_util_1.log.debug(null, "getPublishConfigsForUpdateInfo: no publishConfigs, detect using repository info"); + // https://github.com/electron-userland/electron-builder/issues/925#issuecomment-261732378 + // default publish config is github, file should be generated regardless of publish state (user can test installer locally or manage the release process manually) + const repositoryInfo = await packager.info.repositoryInfo; + debug(`getPublishConfigsForUpdateInfo: ${builder_util_1.safeStringifyJson(repositoryInfo)}`); + if (repositoryInfo != null && repositoryInfo.type === "github") { + const resolvedPublishConfig = await getResolvedPublishConfig(packager, packager.info, { provider: repositoryInfo.type }, arch, false); + if (resolvedPublishConfig != null) { + debug(`getPublishConfigsForUpdateInfo: resolve to publish config ${builder_util_1.safeStringifyJson(resolvedPublishConfig)}`); + return [resolvedPublishConfig]; + } + } + } + return publishConfigs; +} +exports.getPublishConfigsForUpdateInfo = getPublishConfigsForUpdateInfo; +function createPublisher(context, version, publishConfig, options, packager) { + if (debug.enabled) { + debug(`Create publisher: ${builder_util_1.safeStringifyJson(publishConfig)}`); + } + const provider = publishConfig.provider; + switch (provider) { + case "github": + return new gitHubPublisher_1.GitHubPublisher(context, publishConfig, version, options); + case "keygen": + return new KeygenPublisher_1.KeygenPublisher(context, publishConfig, version); + case "snapStore": + return new SnapStorePublisher_1.SnapStorePublisher(context, publishConfig); + case "generic": + return null; + default: { + const clazz = requireProviderClass(provider, packager); + return clazz == null ? null : new clazz(context, publishConfig); + } + } +} +exports.createPublisher = createPublisher; +function requireProviderClass(provider, packager) { + switch (provider) { + case "github": + return gitHubPublisher_1.GitHubPublisher; + case "generic": + return null; + case "keygen": + return KeygenPublisher_1.KeygenPublisher; + case "s3": + return s3Publisher_1.default; + case "snapStore": + return SnapStorePublisher_1.SnapStorePublisher; + case "spaces": + return spacesPublisher_1.default; + case "bitbucket": + return BitbucketPublisher_1.BitbucketPublisher; + default: { + const name = `electron-publisher-${provider}`; + let module = null; + try { + module = require(path.join(packager.buildResourcesDir, name + ".js")); + } + catch (ignored) { + console.log(ignored); + } + if (module == null) { + module = require(name); + } + return module.default || module; + } + } +} +function computeDownloadUrl(publishConfiguration, fileName, packager) { + if (publishConfiguration.provider === "generic") { + const baseUrlString = publishConfiguration.url; + if (fileName == null) { + return baseUrlString; + } + const baseUrl = url.parse(baseUrlString); + return url.format({ ...baseUrl, pathname: path.posix.resolve(baseUrl.pathname || "/", encodeURI(fileName)) }); + } + let baseUrl; + if (publishConfiguration.provider === "github") { + const gh = publishConfiguration; + baseUrl = `${builder_util_runtime_1.githubUrl(gh)}/${gh.owner}/${gh.repo}/releases/download/${gh.vPrefixedTagName === false ? "" : "v"}${packager.appInfo.version}`; + } + else { + baseUrl = builder_util_runtime_1.getS3LikeProviderBaseUrl(publishConfiguration); + } + if (fileName == null) { + return baseUrl; + } + return `${baseUrl}/${encodeURI(fileName)}`; +} +exports.computeDownloadUrl = computeDownloadUrl; +async function getPublishConfigs(platformPackager, targetSpecificOptions, arch, errorIfCannot) { + let publishers; + // check build.nsis (target) + if (targetSpecificOptions != null) { + publishers = targetSpecificOptions.publish; + // if explicitly set to null - do not publish + if (publishers === null) { + return null; + } + } + // check build.win (platform) + if (publishers == null) { + publishers = platformPackager.platformSpecificBuildOptions.publish; + if (publishers === null) { + return null; + } + } + if (publishers == null) { + publishers = platformPackager.config.publish; + if (publishers === null) { + return null; + } + } + return await resolvePublishConfigurations(publishers, platformPackager, platformPackager.info, arch, errorIfCannot); +} +exports.getPublishConfigs = getPublishConfigs; +async function resolvePublishConfigurations(publishers, platformPackager, packager, arch, errorIfCannot) { + if (publishers == null) { + let serviceName = null; + if (!builder_util_1.isEmptyOrSpaces(process.env.GH_TOKEN) || !builder_util_1.isEmptyOrSpaces(process.env.GITHUB_TOKEN)) { + serviceName = "github"; + } + else if (!builder_util_1.isEmptyOrSpaces(process.env.KEYGEN_TOKEN)) { + serviceName = "keygen"; + } + else if (!builder_util_1.isEmptyOrSpaces(process.env.BITBUCKET_TOKEN)) { + serviceName = "bitbucket"; + } + else if (!builder_util_1.isEmptyOrSpaces(process.env.BT_TOKEN)) { + throw new Error("Bintray has been sunset and is no longer supported by electron-builder. Ref: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/"); + } + if (serviceName != null) { + builder_util_1.log.debug(null, `detect ${serviceName} as publish provider`); + return [(await getResolvedPublishConfig(platformPackager, packager, { provider: serviceName }, arch, errorIfCannot))]; + } + } + if (publishers == null) { + return []; + } + debug(`Explicit publish provider: ${builder_util_1.safeStringifyJson(publishers)}`); + return await bluebird_lst_1.default.map(builder_util_1.asArray(publishers), it => getResolvedPublishConfig(platformPackager, packager, typeof it === "string" ? { provider: it } : it, arch, errorIfCannot)); +} +function isSuitableWindowsTarget(target) { + if (target.name === "appx" && target.options != null && target.options.electronUpdaterAware) { + return true; + } + return target.name === "nsis" || target.name.startsWith("nsis-"); +} +function expandPublishConfig(options, platformPackager, packager, arch) { + for (const name of Object.keys(options)) { + const value = options[name]; + if (typeof value === "string") { + const archValue = arch == null ? null : builder_util_1.Arch[arch]; + const expanded = platformPackager == null ? macroExpander_1.expandMacro(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue); + if (expanded !== value) { + options[name] = expanded; + } + } + } +} +function isDetectUpdateChannel(platformSpecificConfiguration, configuration) { + const value = platformSpecificConfiguration == null ? null : platformSpecificConfiguration.detectUpdateChannel; + return value == null ? configuration.detectUpdateChannel !== false : value; +} +async function getResolvedPublishConfig(platformPackager, packager, options, arch, errorIfCannot) { + options = { ...options }; + expandPublishConfig(options, platformPackager, packager, arch); + let channelFromAppVersion = null; + if (options.channel == null && + isDetectUpdateChannel(platformPackager == null ? null : platformPackager.platformSpecificBuildOptions, packager.config)) { + channelFromAppVersion = packager.appInfo.channel; + } + const provider = options.provider; + if (provider === "generic") { + const o = options; + if (o.url == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "url" for "generic" update server`); + } + if (channelFromAppVersion != null) { + ; + o.channel = channelFromAppVersion; + } + return options; + } + const providerClass = requireProviderClass(options.provider, packager); + if (providerClass != null && providerClass.checkAndResolveOptions != null) { + await providerClass.checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot); + return options; + } + if (provider === "keygen") { + return { + ...options, + platform: platformPackager === null || platformPackager === void 0 ? void 0 : platformPackager.platform.name, + }; + } + const isGithub = provider === "github"; + if (!isGithub && provider !== "bitbucket") { + return options; + } + let owner = isGithub ? options.owner : options.owner; + let project = isGithub ? options.repo : options.slug; + if (isGithub && owner == null && project != null) { + const index = project.indexOf("/"); + if (index > 0) { + const repo = project; + project = repo.substring(0, index); + owner = repo.substring(index + 1); + } + } + async function getInfo() { + const info = await packager.repositoryInfo; + if (info != null) { + return info; + } + const message = `Cannot detect repository by .git/config. Please specify "repository" in the package.json (https://docs.npmjs.com/files/package.json#repository).\nPlease see https://electron.build/configuration/publish`; + if (errorIfCannot) { + throw new Error(message); + } + else { + builder_util_1.log.warn(message); + return null; + } + } + if (!owner || !project) { + builder_util_1.log.debug({ reason: "owner or project is not specified explicitly", provider, owner, project }, "calling getInfo"); + const info = await getInfo(); + if (info == null) { + return null; + } + if (!owner) { + owner = info.user; + } + if (!project) { + project = info.project; + } + } + if (isGithub) { + if (options.token != null && !options.private) { + builder_util_1.log.warn('"token" specified in the github publish options. It should be used only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL).'); + } + //tslint:disable-next-line:no-object-literal-type-assertion + return { owner, repo: project, ...options }; + } + else { + //tslint:disable-next-line:no-object-literal-type-assertion + return { owner, slug: project, ...options }; + } +} +//# sourceMappingURL=PublishManager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/PublishManager.js.map b/client/node_modules/app-builder-lib/out/publish/PublishManager.js.map new file mode 100644 index 0000000000..f5e46efa13 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/PublishManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PublishManager.js","sourceRoot":"","sources":["../../src/publish/PublishManager.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAkK;AAClK,+DAW6B;AAC7B,iCAA0B;AAC1B,uDAAkG;AAClG,0EAAsE;AACtE,sEAAkE;AAClE,kDAA0C;AAC1C,0DAAkD;AAClD,0CAAuC;AACvC,8BAA6B;AAC7B,6BAA4B;AAE5B,2BAA0B;AAC1B,oCAAkH;AAGlH,yDAAmD;AAEnD,6DAAyD;AACzD,2DAAqG;AACrG,uDAAmD;AACnD,6DAAyD;AAEzD,MAAM,mBAAmB,GACvB,sKAAsK;IACtK,6LAA6L,CAAA;AAE/L,MAAM,KAAK,GAAG,eAAM,CAAC,0BAA0B,CAAC,CAAA;AAEhD,SAAS,YAAY,CAAC,aAAkB;IACtC,IAAI,aAAa,IAAI,IAAI,IAAI,aAAa,KAAK,OAAO,IAAI,aAAa,KAAK,cAAc,IAAI,aAAa,KAAK,QAAQ,IAAI,aAAa,KAAK,OAAO,EAAE;QACrJ,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,MAAM,IAAI,wCAAyB,CACjC,uEAAuE,IAAI,CAAC,SAAS,CACnF,aAAa,CACd,8EAA8E,CAChF,CAAA;SACF;KACF;AACH,CAAC;AAED,MAAa,cAAc;IAWzB,YAA6B,QAAkB,EAAmB,cAA8B,EAAW,oBAAuC,QAAQ,CAAC,iBAAiB;QAA/I,aAAQ,GAAR,QAAQ,CAAU;QAAmB,mBAAc,G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OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,EAAsB,CAAA;KAChE;AACH,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, InvalidConfigurationError, isEmptyOrSpaces, isPullRequest, log, safeStringifyJson, serializeToYaml } from \"builder-util\"\nimport {\n CancellationToken,\n GenericServerOptions,\n getS3LikeProviderBaseUrl,\n GithubOptions,\n githubUrl,\n KeygenOptions,\n SnapStoreOptions,\n PublishConfiguration,\n PublishProvider,\n BitbucketOptions,\n} from \"builder-util-runtime\"\nimport _debug from \"debug\"\nimport { getCiTag, PublishContext, Publisher, PublishOptions, UploadTask } from \"electron-publish\"\nimport { GitHubPublisher } from \"electron-publish/out/gitHubPublisher\"\nimport { MultiProgress } from \"electron-publish/out/multiProgress\"\nimport S3Publisher from \"./s3/s3Publisher\"\nimport SpacesPublisher from \"./s3/spacesPublisher\"\nimport { writeFile } from \"fs/promises\"\nimport * as isCi from \"is-ci\"\nimport * as path from \"path\"\nimport { WriteStream as TtyWriteStream } from \"tty\"\nimport * as url from \"url\"\nimport { AppInfo, ArtifactCreated, Configuration, Platform, PlatformSpecificBuildOptions, Target } from \"../index\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { expandMacro } from \"../util/macroExpander\"\nimport { WinPackager } from \"../winPackager\"\nimport { SnapStorePublisher } from \"./SnapStorePublisher\"\nimport { createUpdateInfoTasks, UpdateInfoFileTask, writeUpdateInfoFiles } from \"./updateInfoBuilder\"\nimport { KeygenPublisher } from \"./KeygenPublisher\"\nimport { BitbucketPublisher } from \"./BitbucketPublisher\"\n\nconst publishForPrWarning =\n \"There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\nconst debug = _debug(\"electron-builder:publish\")\n\nfunction checkOptions(publishPolicy: any) {\n if (publishPolicy != null && publishPolicy !== \"onTag\" && publishPolicy !== \"onTagOrDraft\" && publishPolicy !== \"always\" && publishPolicy !== \"never\") {\n if (typeof publishPolicy === \"string\") {\n throw new InvalidConfigurationError(\n `Expected one of \"onTag\", \"onTagOrDraft\", \"always\", \"never\", but got ${JSON.stringify(\n publishPolicy\n )}.\\nPlease note that publish configuration should be specified under \"config\"`\n )\n }\n }\n}\n\nexport class PublishManager implements PublishContext {\n private readonly nameToPublisher = new Map()\n\n private readonly taskManager: AsyncTaskManager\n\n readonly isPublish: boolean = false\n\n readonly progress = (process.stdout as TtyWriteStream).isTTY ? new MultiProgress() : null\n\n private readonly updateFileWriteTask: Array = []\n\n constructor(private readonly packager: Packager, private readonly publishOptions: PublishOptions, readonly cancellationToken: CancellationToken = packager.cancellationToken) {\n checkOptions(publishOptions.publish)\n\n this.taskManager = new AsyncTaskManager(cancellationToken)\n\n const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === \"true\"\n if (!isPullRequest() || forcePublishForPr) {\n if (publishOptions.publish === undefined) {\n if (process.env.npm_lifecycle_event === \"release\") {\n publishOptions.publish = \"always\"\n } else {\n const tag = getCiTag()\n if (tag != null) {\n log.info({ reason: \"tag is defined\", tag }, \"artifacts will be published\")\n publishOptions.publish = \"onTag\"\n } else if (isCi) {\n log.info({ reason: \"CI detected\" }, \"artifacts will be published if draft release exists\")\n publishOptions.publish = \"onTagOrDraft\"\n }\n }\n }\n\n const publishPolicy = publishOptions.publish\n this.isPublish = publishPolicy != null && publishOptions.publish !== \"never\" && (publishPolicy !== \"onTag\" || getCiTag() != null)\n if (this.isPublish && forcePublishForPr) {\n log.warn(publishForPrWarning)\n }\n } else if (publishOptions.publish !== \"never\") {\n log.info(\n {\n reason: \"current build is a part of pull request\",\n solution: `set env PUBLISH_FOR_PULL_REQUEST to true to force code signing\\n${publishForPrWarning}`,\n },\n \"publishing will be skipped\"\n )\n }\n\n packager.addAfterPackHandler(async event => {\n const packager = event.packager\n if (event.electronPlatformName === \"darwin\") {\n if (!event.targets.some(it => it.name === \"dmg\" || it.name === \"zip\")) {\n return\n }\n } else if (packager.platform === Platform.WINDOWS) {\n if (!event.targets.some(it => isSuitableWindowsTarget(it))) {\n return\n }\n } else {\n // AppImage writes data to AppImage stage dir, not to linux-unpacked\n return\n }\n\n const publishConfig = await getAppUpdatePublishConfiguration(packager, event.arch, this.isPublish)\n if (publishConfig != null) {\n await writeFile(path.join(packager.getResourcesDir(event.appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n })\n\n packager.artifactCreated(event => {\n const publishConfiguration = event.publishConfig\n if (publishConfiguration == null) {\n this.taskManager.addTask(this.artifactCreatedWithoutExplicitPublishConfig(event))\n } else if (this.isPublish) {\n if (debug.enabled) {\n debug(`artifactCreated (isPublish: ${this.isPublish}): ${safeStringifyJson(event, new Set([\"packager\"]))},\\n publishConfig: ${safeStringifyJson(publishConfiguration)}`)\n }\n this.scheduleUpload(publishConfiguration, event, this.getAppInfo(event.packager))\n }\n })\n }\n\n private getAppInfo(platformPackager: PlatformPackager | null) {\n return platformPackager == null ? this.packager.appInfo : platformPackager.appInfo\n }\n\n async getGlobalPublishConfigurations(): Promise | null> {\n const publishers = this.packager.config.publish\n return await resolvePublishConfigurations(publishers, null, this.packager, null, true)\n }\n\n /** @internal */\n scheduleUpload(publishConfig: PublishConfiguration, event: UploadTask, appInfo: AppInfo): void {\n if (publishConfig.provider === \"generic\") {\n return\n }\n\n const publisher = this.getOrCreatePublisher(publishConfig, appInfo)\n if (publisher == null) {\n log.debug(\n {\n file: event.file,\n reason: \"publisher is null\",\n publishConfig: safeStringifyJson(publishConfig),\n },\n \"not published\"\n )\n return\n }\n\n const providerName = publisher.providerName\n if (this.publishOptions.publish === \"onTagOrDraft\" && getCiTag() == null && providerName !== \"bitbucket\" && providerName !== \"github\") {\n log.info({ file: event.file, reason: \"current build is not for a git tag\", publishPolicy: \"onTagOrDraft\" }, `not published to ${providerName}`)\n return\n }\n\n if (publishConfig.timeout) {\n event.timeout = publishConfig.timeout\n }\n\n this.taskManager.addTask(publisher.upload(event))\n }\n\n private async artifactCreatedWithoutExplicitPublishConfig(event: ArtifactCreated) {\n const platformPackager = event.packager\n const target = event.target\n const publishConfigs = await getPublishConfigs(platformPackager, target == null ? null : target.options, event.arch, this.isPublish)\n\n if (debug.enabled) {\n debug(`artifactCreated (isPublish: ${this.isPublish}): ${safeStringifyJson(event, new Set([\"packager\"]))},\\n publishConfigs: ${safeStringifyJson(publishConfigs)}`)\n }\n\n const eventFile = event.file\n if (publishConfigs == null) {\n if (this.isPublish) {\n log.debug({ file: eventFile, reason: \"no publish configs\" }, \"not published\")\n }\n return\n }\n\n if (this.isPublish) {\n for (const publishConfig of publishConfigs) {\n if (this.cancellationToken.cancelled) {\n log.debug({ file: event.file, reason: \"cancelled\" }, \"not published\")\n break\n }\n\n this.scheduleUpload(publishConfig, event, this.getAppInfo(platformPackager))\n }\n }\n\n if (\n event.isWriteUpdateInfo &&\n target != null &&\n eventFile != null &&\n !this.cancellationToken.cancelled &&\n (platformPackager.platform !== Platform.WINDOWS || isSuitableWindowsTarget(target))\n ) {\n this.taskManager.addTask(createUpdateInfoTasks(event, publishConfigs).then(it => this.updateFileWriteTask.push(...it)))\n }\n }\n\n private getOrCreatePublisher(publishConfig: PublishConfiguration, appInfo: AppInfo): Publisher | null {\n // to not include token into cache key\n const providerCacheKey = safeStringifyJson(publishConfig)\n let publisher = this.nameToPublisher.get(providerCacheKey)\n if (publisher == null) {\n publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager)\n this.nameToPublisher.set(providerCacheKey, publisher)\n log.info({ publisher: publisher!.toString() }, \"publishing\")\n }\n return publisher\n }\n\n // noinspection JSUnusedGlobalSymbols\n cancelTasks() {\n this.taskManager.cancelTasks()\n this.nameToPublisher.clear()\n }\n\n async awaitTasks(): Promise {\n await this.taskManager.awaitTasks()\n\n const updateInfoFileTasks = this.updateFileWriteTask\n if (this.cancellationToken.cancelled || updateInfoFileTasks.length === 0) {\n return\n }\n\n await writeUpdateInfoFiles(updateInfoFileTasks, this.packager)\n await this.taskManager.awaitTasks()\n }\n}\n\nexport async function getAppUpdatePublishConfiguration(packager: PlatformPackager, arch: Arch, errorIfCannot: boolean) {\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, null, arch, errorIfCannot), arch)\n if (publishConfigs == null || publishConfigs.length === 0) {\n return null\n }\n\n const publishConfig = {\n ...publishConfigs[0],\n updaterCacheDirName: packager.appInfo.updaterCacheDirName,\n }\n\n if (packager.platform === Platform.WINDOWS && publishConfig.publisherName == null) {\n const winPackager = packager as WinPackager\n const publisherName = winPackager.isForceCodeSigningVerification ? await winPackager.computedPublisherName.value : undefined\n if (publisherName != null) {\n publishConfig.publisherName = publisherName\n }\n }\n return publishConfig\n}\n\nexport async function getPublishConfigsForUpdateInfo(\n packager: PlatformPackager,\n publishConfigs: Array | null,\n arch: Arch | null\n): Promise | null> {\n if (publishConfigs === null) {\n return null\n }\n\n if (publishConfigs.length === 0) {\n log.debug(null, \"getPublishConfigsForUpdateInfo: no publishConfigs, detect using repository info\")\n // https://github.com/electron-userland/electron-builder/issues/925#issuecomment-261732378\n // default publish config is github, file should be generated regardless of publish state (user can test installer locally or manage the release process manually)\n const repositoryInfo = await packager.info.repositoryInfo\n debug(`getPublishConfigsForUpdateInfo: ${safeStringifyJson(repositoryInfo)}`)\n if (repositoryInfo != null && repositoryInfo.type === \"github\") {\n const resolvedPublishConfig = await getResolvedPublishConfig(packager, packager.info, { provider: repositoryInfo.type }, arch, false)\n if (resolvedPublishConfig != null) {\n debug(`getPublishConfigsForUpdateInfo: resolve to publish config ${safeStringifyJson(resolvedPublishConfig)}`)\n return [resolvedPublishConfig]\n }\n }\n }\n return publishConfigs\n}\n\nexport function createPublisher(context: PublishContext, version: string, publishConfig: PublishConfiguration, options: PublishOptions, packager: Packager): Publisher | null {\n if (debug.enabled) {\n debug(`Create publisher: ${safeStringifyJson(publishConfig)}`)\n }\n\n const provider = publishConfig.provider\n switch (provider) {\n case \"github\":\n return new GitHubPublisher(context, publishConfig as GithubOptions, version, options)\n\n case \"keygen\":\n return new KeygenPublisher(context, publishConfig as KeygenOptions, version)\n\n case \"snapStore\":\n return new SnapStorePublisher(context, publishConfig as SnapStoreOptions)\n\n case \"generic\":\n return null\n\n default: {\n const clazz = requireProviderClass(provider, packager)\n return clazz == null ? null : new clazz(context, publishConfig)\n }\n }\n}\n\nfunction requireProviderClass(provider: string, packager: Packager): any | null {\n switch (provider) {\n case \"github\":\n return GitHubPublisher\n\n case \"generic\":\n return null\n\n case \"keygen\":\n return KeygenPublisher\n\n case \"s3\":\n return S3Publisher\n\n case \"snapStore\":\n return SnapStorePublisher\n\n case \"spaces\":\n return SpacesPublisher\n\n case \"bitbucket\":\n return BitbucketPublisher\n\n default: {\n const name = `electron-publisher-${provider}`\n let module: any = null\n try {\n module = require(path.join(packager.buildResourcesDir, name + \".js\"))\n } catch (ignored) {\n console.log(ignored)\n }\n\n if (module == null) {\n module = require(name)\n }\n return module.default || module\n }\n }\n}\n\nexport function computeDownloadUrl(publishConfiguration: PublishConfiguration, fileName: string | null, packager: PlatformPackager) {\n if (publishConfiguration.provider === \"generic\") {\n const baseUrlString = (publishConfiguration as GenericServerOptions).url\n if (fileName == null) {\n return baseUrlString\n }\n\n const baseUrl = url.parse(baseUrlString)\n return url.format({ ...(baseUrl as url.UrlObject), pathname: path.posix.resolve(baseUrl.pathname || \"/\", encodeURI(fileName)) })\n }\n\n let baseUrl\n if (publishConfiguration.provider === \"github\") {\n const gh = publishConfiguration as GithubOptions\n baseUrl = `${githubUrl(gh)}/${gh.owner}/${gh.repo}/releases/download/${gh.vPrefixedTagName === false ? \"\" : \"v\"}${packager.appInfo.version}`\n } else {\n baseUrl = getS3LikeProviderBaseUrl(publishConfiguration)\n }\n\n if (fileName == null) {\n return baseUrl\n }\n return `${baseUrl}/${encodeURI(fileName)}`\n}\n\nexport async function getPublishConfigs(\n platformPackager: PlatformPackager,\n targetSpecificOptions: PlatformSpecificBuildOptions | null | undefined,\n arch: Arch | null,\n errorIfCannot: boolean\n): Promise | null> {\n let publishers\n\n // check build.nsis (target)\n if (targetSpecificOptions != null) {\n publishers = targetSpecificOptions.publish\n // if explicitly set to null - do not publish\n if (publishers === null) {\n return null\n }\n }\n\n // check build.win (platform)\n if (publishers == null) {\n publishers = platformPackager.platformSpecificBuildOptions.publish\n if (publishers === null) {\n return null\n }\n }\n\n if (publishers == null) {\n publishers = platformPackager.config.publish\n if (publishers === null) {\n return null\n }\n }\n return await resolvePublishConfigurations(publishers, platformPackager, platformPackager.info, arch, errorIfCannot)\n}\n\nasync function resolvePublishConfigurations(\n publishers: any,\n platformPackager: PlatformPackager | null,\n packager: Packager,\n arch: Arch | null,\n errorIfCannot: boolean\n): Promise | null> {\n if (publishers == null) {\n let serviceName: PublishProvider | null = null\n if (!isEmptyOrSpaces(process.env.GH_TOKEN) || !isEmptyOrSpaces(process.env.GITHUB_TOKEN)) {\n serviceName = \"github\"\n } else if (!isEmptyOrSpaces(process.env.KEYGEN_TOKEN)) {\n serviceName = \"keygen\"\n } else if (!isEmptyOrSpaces(process.env.BITBUCKET_TOKEN)) {\n serviceName = \"bitbucket\"\n } else if (!isEmptyOrSpaces(process.env.BT_TOKEN)) {\n throw new Error(\n \"Bintray has been sunset and is no longer supported by electron-builder. Ref: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/\"\n )\n }\n\n if (serviceName != null) {\n log.debug(null, `detect ${serviceName} as publish provider`)\n return [(await getResolvedPublishConfig(platformPackager, packager, { provider: serviceName }, arch, errorIfCannot))!]\n }\n }\n\n if (publishers == null) {\n return []\n }\n\n debug(`Explicit publish provider: ${safeStringifyJson(publishers)}`)\n return await (BluebirdPromise.map(asArray(publishers), it =>\n getResolvedPublishConfig(platformPackager, packager, typeof it === \"string\" ? { provider: it } : it, arch, errorIfCannot)\n ) as Promise>)\n}\n\nfunction isSuitableWindowsTarget(target: Target) {\n if (target.name === \"appx\" && target.options != null && (target.options as any).electronUpdaterAware) {\n return true\n }\n return target.name === \"nsis\" || target.name.startsWith(\"nsis-\")\n}\n\nfunction expandPublishConfig(options: any, platformPackager: PlatformPackager | null, packager: Packager, arch: Arch | null): void {\n for (const name of Object.keys(options)) {\n const value = options[name]\n if (typeof value === \"string\") {\n const archValue = arch == null ? null : Arch[arch]\n const expanded = platformPackager == null ? expandMacro(value, archValue, packager.appInfo) : platformPackager.expandMacro(value, archValue)\n if (expanded !== value) {\n options[name] = expanded\n }\n }\n }\n}\n\nfunction isDetectUpdateChannel(platformSpecificConfiguration: PlatformSpecificBuildOptions | null, configuration: Configuration) {\n const value = platformSpecificConfiguration == null ? null : platformSpecificConfiguration.detectUpdateChannel\n return value == null ? configuration.detectUpdateChannel !== false : value\n}\n\nasync function getResolvedPublishConfig(\n platformPackager: PlatformPackager | null,\n packager: Packager,\n options: PublishConfiguration,\n arch: Arch | null,\n errorIfCannot: boolean\n): Promise {\n options = { ...options }\n expandPublishConfig(options, platformPackager, packager, arch)\n\n let channelFromAppVersion: string | null = null\n if (\n (options as GenericServerOptions).channel == null &&\n isDetectUpdateChannel(platformPackager == null ? null : platformPackager.platformSpecificBuildOptions, packager.config)\n ) {\n channelFromAppVersion = packager.appInfo.channel\n }\n\n const provider = options.provider\n if (provider === \"generic\") {\n const o = options as GenericServerOptions\n if (o.url == null) {\n throw new InvalidConfigurationError(`Please specify \"url\" for \"generic\" update server`)\n }\n\n if (channelFromAppVersion != null) {\n ;(o as any).channel = channelFromAppVersion\n }\n return options\n }\n\n const providerClass = requireProviderClass(options.provider, packager)\n if (providerClass != null && providerClass.checkAndResolveOptions != null) {\n await providerClass.checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot)\n return options\n }\n\n if (provider === \"keygen\") {\n return {\n ...options,\n platform: platformPackager?.platform.name,\n } as KeygenOptions\n }\n\n const isGithub = provider === \"github\"\n if (!isGithub && provider !== \"bitbucket\") {\n return options\n }\n\n let owner = isGithub ? (options as GithubOptions).owner : (options as BitbucketOptions).owner\n let project = isGithub ? (options as GithubOptions).repo : (options as BitbucketOptions).slug\n\n if (isGithub && owner == null && project != null) {\n const index = project.indexOf(\"/\")\n if (index > 0) {\n const repo = project\n project = repo.substring(0, index)\n owner = repo.substring(index + 1)\n }\n }\n\n async function getInfo() {\n const info = await packager.repositoryInfo\n if (info != null) {\n return info\n }\n\n const message = `Cannot detect repository by .git/config. Please specify \"repository\" in the package.json (https://docs.npmjs.com/files/package.json#repository).\\nPlease see https://electron.build/configuration/publish`\n if (errorIfCannot) {\n throw new Error(message)\n } else {\n log.warn(message)\n return null\n }\n }\n\n if (!owner || !project) {\n log.debug({ reason: \"owner or project is not specified explicitly\", provider, owner, project }, \"calling getInfo\")\n const info = await getInfo()\n if (info == null) {\n return null\n }\n\n if (!owner) {\n owner = info.user\n }\n if (!project) {\n project = info.project\n }\n }\n\n if (isGithub) {\n if ((options as GithubOptions).token != null && !(options as GithubOptions).private) {\n log.warn('\"token\" specified in the github publish options. It should be used only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL).')\n }\n //tslint:disable-next-line:no-object-literal-type-assertion\n return { owner, repo: project, ...options } as GithubOptions\n } else {\n //tslint:disable-next-line:no-object-literal-type-assertion\n return { owner, slug: project, ...options } as BitbucketOptions\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.d.ts b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.d.ts new file mode 100644 index 0000000000..71b4eb5ef3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.d.ts @@ -0,0 +1,9 @@ +import { Publisher, UploadTask, PublishContext } from "electron-publish"; +import { SnapStoreOptions } from "builder-util-runtime/out/publishOptions"; +export declare class SnapStorePublisher extends Publisher { + private options; + readonly providerName = "snapStore"; + constructor(context: PublishContext, options: SnapStoreOptions); + upload(task: UploadTask): Promise; + toString(): string; +} diff --git a/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js new file mode 100644 index 0000000000..f2350d2021 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SnapStorePublisher = void 0; +const electron_publish_1 = require("electron-publish"); +const builder_util_1 = require("builder-util"); +const path = require("path"); +class SnapStorePublisher extends electron_publish_1.Publisher { + constructor(context, options) { + super(context); + this.options = options; + this.providerName = "snapStore"; + } + upload(task) { + this.createProgressBar(path.basename(task.file), -1); + const args = ["publish-snap", "-f", task.file]; + let channels = this.options.channels; + if (channels == null) { + channels = ["edge"]; + } + else { + if (typeof channels === "string") { + channels = channels.split(","); + } + } + for (const channel of channels) { + args.push("-c", channel); + } + return builder_util_1.executeAppBuilder(args); + } + toString() { + return "Snap Store"; + } +} +exports.SnapStorePublisher = SnapStorePublisher; +//# sourceMappingURL=SnapStorePublisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js.map b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js.map new file mode 100644 index 0000000000..e2b570bf71 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/SnapStorePublisher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SnapStorePublisher.js","sourceRoot":"","sources":["../../src/publish/SnapStorePublisher.ts"],"names":[],"mappings":";;;AAAA,uDAAwE;AACxE,+CAAgD;AAChD,6BAA4B;AAG5B,MAAa,kBAAmB,SAAQ,4BAAS;IAG/C,YAAY,OAAuB,EAAU,OAAyB;QACpE,KAAK,CAAC,OAAO,CAAC,CAAA;QAD6B,YAAO,GAAP,OAAO,CAAkB;QAF7D,iBAAY,GAAG,WAAW,CAAA;IAInC,CAAC;IAED,MAAM,CAAC,IAAgB;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEpD,MAAM,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAE9C,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;QACpC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAA;SACpB;aAAM;YACL,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;gBAChC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aAC/B;SACF;QAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;SACzB;QAED,OAAO,gCAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ;QACN,OAAO,YAAY,CAAA;IACrB,CAAC;CACF;AA/BD,gDA+BC","sourcesContent":["import { Publisher, UploadTask, PublishContext } from \"electron-publish\"\nimport { executeAppBuilder } from \"builder-util\"\nimport * as path from \"path\"\nimport { SnapStoreOptions } from \"builder-util-runtime/out/publishOptions\"\n\nexport class SnapStorePublisher extends Publisher {\n readonly providerName = \"snapStore\"\n\n constructor(context: PublishContext, private options: SnapStoreOptions) {\n super(context)\n }\n\n upload(task: UploadTask): Promise {\n this.createProgressBar(path.basename(task.file), -1)\n\n const args = [\"publish-snap\", \"-f\", task.file]\n\n let channels = this.options.channels\n if (channels == null) {\n channels = [\"edge\"]\n } else {\n if (typeof channels === \"string\") {\n channels = channels.split(\",\")\n }\n }\n\n for (const channel of channels) {\n args.push(\"-c\", channel)\n }\n\n return executeAppBuilder(args)\n }\n\n toString(): string {\n return \"Snap Store\"\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.d.ts b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.d.ts new file mode 100644 index 0000000000..2ef73ab8f8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.d.ts @@ -0,0 +1,10 @@ +import { BaseS3Options } from "builder-util-runtime"; +import { PublishContext, Publisher, UploadTask } from "electron-publish"; +export declare abstract class BaseS3Publisher extends Publisher { + private options; + protected constructor(context: PublishContext, options: BaseS3Options); + protected abstract getBucketName(): string; + protected configureS3Options(args: Array): void; + upload(task: UploadTask): Promise; + toString(): string; +} diff --git a/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js new file mode 100644 index 0000000000..f640d298e9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BaseS3Publisher = void 0; +const builder_util_1 = require("builder-util"); +const electron_publish_1 = require("electron-publish"); +const promises_1 = require("fs/promises"); +const path = require("path"); +class BaseS3Publisher extends electron_publish_1.Publisher { + constructor(context, options) { + super(context); + this.options = options; + } + configureS3Options(args) { + // if explicitly set to null, do not add + if (this.options.acl !== null) { + args.push("--acl", this.options.acl || "public-read"); + } + } + // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html + async upload(task) { + const fileName = path.basename(task.file); + const cancellationToken = this.context.cancellationToken; + const target = (this.options.path == null ? "" : `${this.options.path}/`) + fileName; + const args = ["publish-s3", "--bucket", this.getBucketName(), "--key", target, "--file", task.file]; + this.configureS3Options(args); + if (process.env.__TEST_S3_PUBLISHER__ != null) { + const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target); + await promises_1.mkdir(path.dirname(testFile), { recursive: true }); + await promises_1.symlink(task.file, testFile); + return; + } + // https://github.com/aws/aws-sdk-go/issues/279 + this.createProgressBar(fileName, -1); + // if (progressBar != null) { + // const callback = new ProgressCallback(progressBar) + // uploader.on("progress", () => { + // if (!cancellationToken.cancelled) { + // callback.update(uploader.loaded, uploader.contentLength) + // } + // }) + // } + return await cancellationToken.createPromise((resolve, reject, onCancel) => { + builder_util_1.executeAppBuilder(args, process => { + onCancel(() => { + process.kill("SIGINT"); + }); + }) + .then(() => { + try { + builder_util_1.log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, "uploaded"); + } + finally { + resolve(undefined); + } + }) + .catch(reject); + }); + } + toString() { + return `${this.providerName} (bucket: ${this.getBucketName()})`; + } +} +exports.BaseS3Publisher = BaseS3Publisher; +//# sourceMappingURL=BaseS3Publisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js.map b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js.map new file mode 100644 index 0000000000..1dd2d84473 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/BaseS3Publisher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"BaseS3Publisher.js","sourceRoot":"","sources":["../../../src/publish/s3/BaseS3Publisher.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,uDAAwE;AACxE,0CAA4C;AAC5C,6BAA4B;AAE5B,MAAsB,eAAgB,SAAQ,4BAAS;IACrD,YAAsB,OAAuB,EAAU,OAAsB;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAA;QADuC,YAAO,GAAP,OAAO,CAAe;IAE7E,CAAC;IAIS,kBAAkB,CAAC,IAAmB;QAC9C,wCAAwC;QACxC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,aAAa,CAAC,CAAA;SACtD;IACH,CAAC;IAED,oGAAoG;IACpG,KAAK,C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IAAI,EAAE,OAAO,CAAC,EAAE;gBAChC,QAAQ,CAAC,GAAG,EAAE;oBACZ,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC;iBACC,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI;oBACF,kBAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,UAAU,CAAC,CAAA;iBACrG;wBAAS;oBACR,OAAO,CAAC,SAAS,CAAC,CAAA;iBACnB;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,aAAa,EAAE,GAAG,CAAA;IACjE,CAAC;CACF;AA9DD,0CA8DC","sourcesContent":["import { log, executeAppBuilder } from \"builder-util\"\nimport { BaseS3Options } from \"builder-util-runtime\"\nimport { PublishContext, Publisher, UploadTask } from \"electron-publish\"\nimport { mkdir, symlink } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport abstract class BaseS3Publisher extends Publisher {\n protected constructor(context: PublishContext, private options: BaseS3Options) {\n super(context)\n }\n\n protected abstract getBucketName(): string\n\n protected configureS3Options(args: Array) {\n // if explicitly set to null, do not add\n if (this.options.acl !== null) {\n args.push(\"--acl\", this.options.acl || \"public-read\")\n }\n }\n\n // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html\n async upload(task: UploadTask): Promise {\n const fileName = path.basename(task.file)\n const cancellationToken = this.context.cancellationToken\n\n const target = (this.options.path == null ? \"\" : `${this.options.path}/`) + fileName\n\n const args = [\"publish-s3\", \"--bucket\", this.getBucketName(), \"--key\", target, \"--file\", task.file]\n this.configureS3Options(args)\n\n if (process.env.__TEST_S3_PUBLISHER__ != null) {\n const testFile = path.join(process.env.__TEST_S3_PUBLISHER__!, target)\n await mkdir(path.dirname(testFile), { recursive: true })\n await symlink(task.file, testFile)\n return\n }\n\n // https://github.com/aws/aws-sdk-go/issues/279\n this.createProgressBar(fileName, -1)\n // if (progressBar != null) {\n // const callback = new ProgressCallback(progressBar)\n // uploader.on(\"progress\", () => {\n // if (!cancellationToken.cancelled) {\n // callback.update(uploader.loaded, uploader.contentLength)\n // }\n // })\n // }\n\n return await cancellationToken.createPromise((resolve, reject, onCancel) => {\n executeAppBuilder(args, process => {\n onCancel(() => {\n process.kill(\"SIGINT\")\n })\n })\n .then(() => {\n try {\n log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, \"uploaded\")\n } finally {\n resolve(undefined)\n }\n })\n .catch(reject)\n })\n }\n\n toString() {\n return `${this.providerName} (bucket: ${this.getBucketName()})`\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.d.ts b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.d.ts new file mode 100644 index 0000000000..2c7688a279 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.d.ts @@ -0,0 +1,12 @@ +import { S3Options } from "builder-util-runtime"; +import { PublishContext } from "electron-publish"; +import { BaseS3Publisher } from "./BaseS3Publisher"; +export default class S3Publisher extends BaseS3Publisher { + private readonly info; + readonly providerName = "s3"; + constructor(context: PublishContext, info: S3Options); + static checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise; + protected getBucketName(): string; + protected configureS3Options(args: Array): void; + toString(): string; +} diff --git a/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js new file mode 100644 index 0000000000..41e0efa797 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const builder_util_1 = require("builder-util"); +const BaseS3Publisher_1 = require("./BaseS3Publisher"); +class S3Publisher extends BaseS3Publisher_1.BaseS3Publisher { + constructor(context, info) { + super(context, info); + this.info = info; + this.providerName = "s3"; + } + static async checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) { + const bucket = options.bucket; + if (bucket == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "bucket" for "s3" publish provider`); + } + if (options.endpoint == null && bucket.includes(".") && options.region == null) { + // on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region. + try { + options.region = await builder_util_1.executeAppBuilder(["get-bucket-location", "--bucket", bucket]); + } + catch (e) { + if (errorIfCannot) { + throw e; + } + else { + builder_util_1.log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`); + } + } + } + if (options.channel == null && channelFromAppVersion != null) { + options.channel = channelFromAppVersion; + } + if (options.endpoint != null && options.endpoint.endsWith("/")) { + ; + options.endpoint = options.endpoint.slice(0, -1); + } + } + getBucketName() { + return this.info.bucket; + } + configureS3Options(args) { + super.configureS3Options(args); + if (this.info.endpoint != null) { + args.push("--endpoint", this.info.endpoint); + } + if (this.info.region != null) { + args.push("--region", this.info.region); + } + if (this.info.storageClass != null) { + args.push("--storageClass", this.info.storageClass); + } + if (this.info.encryption != null) { + args.push("--encryption", this.info.encryption); + } + } + toString() { + const result = super.toString(); + const endpoint = this.info.endpoint; + if (endpoint != null) { + return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`; + } + return result; + } +} +exports.default = S3Publisher; +//# sourceMappingURL=s3Publisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js.map b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js.map new file mode 100644 index 0000000000..a27dac83ad --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/s3Publisher.js.map @@ -0,0 +1 @@ +{"version":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urationError, log } from \"builder-util\"\nimport { S3Options } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class S3Publisher extends BaseS3Publisher {\n readonly providerName = \"s3\"\n\n constructor(context: PublishContext, private readonly info: S3Options) {\n super(context, info)\n }\n\n static async checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n const bucket = options.bucket\n if (bucket == null) {\n throw new InvalidConfigurationError(`Please specify \"bucket\" for \"s3\" publish provider`)\n }\n\n if (options.endpoint == null && bucket.includes(\".\") && options.region == null) {\n // on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region.\n try {\n options.region = await executeAppBuilder([\"get-bucket-location\", \"--bucket\", bucket])\n } catch (e) {\n if (errorIfCannot) {\n throw e\n } else {\n log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`)\n }\n }\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n\n if (options.endpoint != null && options.endpoint.endsWith(\"/\")) {\n ;(options as any).endpoint = options.endpoint.slice(0, -1)\n }\n }\n\n protected getBucketName(): string {\n return this.info.bucket\n }\n\n protected configureS3Options(args: Array): void {\n super.configureS3Options(args)\n\n if (this.info.endpoint != null) {\n args.push(\"--endpoint\", this.info.endpoint)\n }\n if (this.info.region != null) {\n args.push(\"--region\", this.info.region)\n }\n\n if (this.info.storageClass != null) {\n args.push(\"--storageClass\", this.info.storageClass)\n }\n if (this.info.encryption != null) {\n args.push(\"--encryption\", this.info.encryption)\n }\n }\n\n toString() {\n const result = super.toString()\n const endpoint = this.info.endpoint\n if (endpoint != null) {\n return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`\n }\n return result\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.d.ts b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.d.ts new file mode 100644 index 0000000000..541efed45f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.d.ts @@ -0,0 +1,11 @@ +import { SpacesOptions } from "builder-util-runtime"; +import { PublishContext } from "electron-publish"; +import { BaseS3Publisher } from "./BaseS3Publisher"; +export default class SpacesPublisher extends BaseS3Publisher { + private readonly info; + readonly providerName = "spaces"; + constructor(context: PublishContext, info: SpacesOptions); + static checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise; + protected getBucketName(): string; + protected configureS3Options(args: Array): void; +} diff --git a/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js new file mode 100644 index 0000000000..6c1a477281 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const builder_util_1 = require("builder-util"); +const BaseS3Publisher_1 = require("./BaseS3Publisher"); +class SpacesPublisher extends BaseS3Publisher_1.BaseS3Publisher { + constructor(context, info) { + super(context, info); + this.info = info; + this.providerName = "spaces"; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) { + if (options.name == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "name" for "spaces" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`); + } + if (options.region == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "region" for "spaces" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`); + } + if (options.channel == null && channelFromAppVersion != null) { + options.channel = channelFromAppVersion; + } + return Promise.resolve(); + } + getBucketName() { + return this.info.name; + } + configureS3Options(args) { + super.configureS3Options(args); + args.push("--endpoint", `${this.info.region}.digitaloceanspaces.com`); + args.push("--region", this.info.region); + const accessKey = process.env.DO_KEY_ID; + const secretKey = process.env.DO_SECRET_KEY; + if (builder_util_1.isEmptyOrSpaces(accessKey)) { + throw new builder_util_1.InvalidConfigurationError("Please set env DO_KEY_ID (see https://www.electron.build/configuration/publish#spacesoptions)"); + } + if (builder_util_1.isEmptyOrSpaces(secretKey)) { + throw new builder_util_1.InvalidConfigurationError("Please set env DO_SECRET_KEY (see https://www.electron.build/configuration/publish#spacesoptions)"); + } + args.push("--accessKey", accessKey); + args.push("--secretKey", secretKey); + } +} +exports.default = SpacesPublisher; +//# sourceMappingURL=spacesPublisher.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js.map b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js.map new file mode 100644 index 0000000000..95b19070e7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/s3/spacesPublisher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"spacesPublisher.js","sourceRoot":"","sources":["../../../src/publish/s3/spacesPublisher.ts"],"names":[],"mappings":";;AAAA,+CAAyE;AAGzE,uDAAmD;AAEnD,MAAqB,eAAgB,SAAQ,iCAAe;IAG1D,YAAY,OAAuB,EAAmB,IAAmB;QACvE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QADgC,SAAI,GAAJ,IAAI,CAAe;QAFhE,iBAAY,GAAG,QAAQ,CAAA;IAIhC,CAAC;IAED,6DAA6D;IAC7D,MAAM,CAAC,sBAAsB,CAAC,OAAsB,EAAE,qBAAoC,EAAE,aAAsB;QAChH,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE;YACxB,MAAM,IAAI,wCAAyB,CAAC,0HAA0H,CAAC,CAAA;SAChK;QACD,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1B,MAAM,IAAI,wCAAyB,CAAC,4HAA4H,CAAC,CAAA;SAClK;QAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,IAAI,qBAAqB,IAAI,IAAI,EAAE;YAC5D,OAAO,CAAC,OAAO,GAAG,qBAAqB,CAAA;SACxC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;IAES,kBAAkB,CAAC,IAAmB;QAC9C,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,yBAAyB,CAAC,CAAA;QACrE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAA;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAA;QAC3C,IAAI,8BAAe,CAAC,SAAS,CAAC,EAAE;YAC9B,MAAM,IAAI,wCAAyB,CAAC,+FAA+F,CAAC,CAAA;SACrI;QACD,IAAI,8BAAe,CAAC,SAAS,CAAC,EAAE;YAC9B,MAAM,IAAI,wCAAyB,CAAC,mGAAmG,CAAC,CAAA;SACzI;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;IACrC,CAAC;CACF;AA3CD,kCA2CC","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces } from \"builder-util\"\nimport { SpacesOptions } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class SpacesPublisher extends BaseS3Publisher {\n readonly providerName = \"spaces\"\n\n constructor(context: PublishContext, private readonly info: SpacesOptions) {\n super(context, info)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n if (options.name == null) {\n throw new InvalidConfigurationError(`Please specify \"name\" for \"spaces\" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`)\n }\n if (options.region == null) {\n throw new InvalidConfigurationError(`Please specify \"region\" for \"spaces\" publish provider (see https://www.electron.build/configuration/publish#spacesoptions)`)\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n return Promise.resolve()\n }\n\n protected getBucketName(): string {\n return this.info.name\n }\n\n protected configureS3Options(args: Array): void {\n super.configureS3Options(args)\n\n args.push(\"--endpoint\", `${this.info.region}.digitaloceanspaces.com`)\n args.push(\"--region\", this.info.region)\n\n const accessKey = process.env.DO_KEY_ID\n const secretKey = process.env.DO_SECRET_KEY\n if (isEmptyOrSpaces(accessKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_KEY_ID (see https://www.electron.build/configuration/publish#spacesoptions)\")\n }\n if (isEmptyOrSpaces(secretKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_SECRET_KEY (see https://www.electron.build/configuration/publish#spacesoptions)\")\n }\n args.push(\"--accessKey\", accessKey)\n args.push(\"--secretKey\", secretKey)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.d.ts b/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.d.ts new file mode 100644 index 0000000000..aec4f34224 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.d.ts @@ -0,0 +1,10 @@ +import { PublishConfiguration, UpdateInfo } from "builder-util-runtime"; +import { Packager } from "../packager"; +import { PlatformPackager } from "../platformPackager"; +export interface UpdateInfoFileTask { + readonly file: string; + readonly info: UpdateInfo; + readonly publishConfiguration: PublishConfiguration; + readonly packager: PlatformPackager; +} +export declare function writeUpdateInfoFiles(updateInfoFileTasks: Array, packager: Packager): Promise; diff --git a/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js b/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js new file mode 100644 index 0000000000..7cf1b95d82 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js @@ -0,0 +1,214 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.writeUpdateInfoFiles = exports.createUpdateInfoTasks = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const semver = require("semver"); +const core_1 = require("../core"); +const hash_1 = require("../util/hash"); +const PublishManager_1 = require("./PublishManager"); +async function getReleaseInfo(packager) { + const releaseInfo = { ...(packager.platformSpecificBuildOptions.releaseInfo || packager.config.releaseInfo) }; + if (releaseInfo.releaseNotes == null) { + const releaseNotesFile = await packager.getResource(releaseInfo.releaseNotesFile, `release-notes-${packager.platform.buildConfigurationKey}.md`, `release-notes-${packager.platform.name}.md`, `release-notes-${packager.platform.nodeName}.md`, "release-notes.md"); + const releaseNotes = releaseNotesFile == null ? null : await fs_extra_1.readFile(releaseNotesFile, "utf-8"); + // to avoid undefined in the file, check for null + if (releaseNotes != null) { + releaseInfo.releaseNotes = releaseNotes; + } + } + delete releaseInfo.releaseNotesFile; + return releaseInfo; +} +function isGenerateUpdatesFilesForAllChannels(packager) { + const value = packager.platformSpecificBuildOptions.generateUpdatesFilesForAllChannels; + return value == null ? packager.config.generateUpdatesFilesForAllChannels : value; +} +/** + if this is an "alpha" version, we need to generate only the "alpha" .yml file + if this is a "beta" version, we need to generate both the "alpha" and "beta" .yml file + if this is a "stable" version, we need to generate all the "alpha", "beta" and "stable" .yml file + */ +function computeChannelNames(packager, publishConfig) { + const currentChannel = publishConfig.channel || "latest"; + // for GitHub should be pre-release way be used + if (currentChannel === "alpha" || publishConfig.provider === "github" || !isGenerateUpdatesFilesForAllChannels(packager)) { + return [currentChannel]; + } + switch (currentChannel) { + case "beta": + return [currentChannel, "alpha"]; + case "latest": + return [currentChannel, "alpha", "beta"]; + default: + return [currentChannel]; + } +} +function getUpdateInfoFileName(channel, packager, arch) { + const osSuffix = packager.platform === core_1.Platform.WINDOWS ? "" : `-${packager.platform.buildConfigurationKey}`; + return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`; +} +function getArchPrefixForUpdateFile(arch, packager) { + if (arch == null || arch === builder_util_1.Arch.x64 || packager.platform !== core_1.Platform.LINUX) { + return ""; + } + return arch === builder_util_1.Arch.armv7l ? "-arm" : `-${builder_util_1.Arch[arch]}`; +} +function computeIsisElectronUpdater1xCompatibility(updaterCompatibility, publishConfiguration, packager) { + if (updaterCompatibility != null) { + return semver.satisfies("1.0.0", updaterCompatibility); + } + // spaces is a new publish provider, no need to keep backward compatibility + if (publishConfiguration.provider === "spaces") { + return false; + } + const updaterVersion = packager.metadata.dependencies == null ? null : packager.metadata.dependencies["electron-updater"]; + return updaterVersion == null || semver.lt(updaterVersion, "4.0.0"); +} +/** @internal */ +async function createUpdateInfoTasks(event, _publishConfigs) { + const packager = event.packager; + const publishConfigs = await PublishManager_1.getPublishConfigsForUpdateInfo(packager, _publishConfigs, event.arch); + if (publishConfigs == null || publishConfigs.length === 0) { + return []; + } + const outDir = event.target.outDir; + const version = packager.appInfo.version; + const sha2 = new lazy_val_1.Lazy(() => hash_1.hashFile(event.file, "sha256", "hex")); + const isMac = packager.platform === core_1.Platform.MAC; + const createdFiles = new Set(); + const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager)); + const tasks = []; + const electronUpdaterCompatibility = packager.platformSpecificBuildOptions.electronUpdaterCompatibility || packager.config.electronUpdaterCompatibility || ">=2.15"; + for (const publishConfiguration of publishConfigs) { + let dir = outDir; + if (publishConfigs.length > 1 && publishConfiguration !== publishConfigs[0]) { + dir = path.join(outDir, publishConfiguration.provider); + } + let isElectronUpdater1xCompatibility = computeIsisElectronUpdater1xCompatibility(electronUpdaterCompatibility, publishConfiguration, packager.info); + let info = sharedInfo; + // noinspection JSDeprecatedSymbols + if (isElectronUpdater1xCompatibility && packager.platform === core_1.Platform.WINDOWS) { + info = { + ...info, + }; + info.sha2 = await sha2.value; + } + if (event.safeArtifactName != null && publishConfiguration.provider === "github") { + const newFiles = info.files.slice(); + newFiles[0].url = event.safeArtifactName; + info = { + ...info, + files: newFiles, + path: event.safeArtifactName, + }; + } + for (const channel of computeChannelNames(packager, publishConfiguration)) { + if (isMac && isElectronUpdater1xCompatibility && event.file.endsWith(".zip")) { + // write only for first channel (generateUpdatesFilesForAllChannels is a new functionality, no need to generate old mac update info file) + isElectronUpdater1xCompatibility = false; + await writeOldMacInfo(publishConfiguration, outDir, dir, channel, createdFiles, version, packager); + } + const updateInfoFile = path.join(dir, getUpdateInfoFileName(channel, packager, event.arch)); + if (createdFiles.has(updateInfoFile)) { + continue; + } + createdFiles.add(updateInfoFile); + // artifact should be uploaded only to designated publish provider + tasks.push({ + file: updateInfoFile, + info, + publishConfiguration, + packager, + }); + } + } + return tasks; +} +exports.createUpdateInfoTasks = createUpdateInfoTasks; +async function createUpdateInfo(version, event, releaseInfo) { + const customUpdateInfo = event.updateInfo; + const url = path.basename(event.file); + const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hash_1.hashFile(event.file)); + const files = [{ url, sha512 }]; + const result = { + // @ts-ignore + version, + // @ts-ignore + files, + // @ts-ignore + path: url /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */, + // @ts-ignore + sha512 /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */, + ...releaseInfo, + }; + if (customUpdateInfo != null) { + // file info or nsis web installer packages info + Object.assign("sha512" in customUpdateInfo ? files[0] : result, customUpdateInfo); + } + return result; +} +async function writeUpdateInfoFiles(updateInfoFileTasks, packager) { + // zip must be first and zip info must be used for old path/sha512 properties in the update info + updateInfoFileTasks.sort((a, b) => (a.info.files[0].url.endsWith(".zip") ? 0 : 100) - (b.info.files[0].url.endsWith(".zip") ? 0 : 100)); + const updateChannelFileToInfo = new Map(); + for (const task of updateInfoFileTasks) { + // https://github.com/electron-userland/electron-builder/pull/2994 + const key = `${task.file}@${builder_util_1.safeStringifyJson(task.publishConfiguration, new Set(["releaseType"]))}`; + const existingTask = updateChannelFileToInfo.get(key); + if (existingTask == null) { + updateChannelFileToInfo.set(key, task); + continue; + } + existingTask.info.files.push(...task.info.files); + } + const releaseDate = new Date().toISOString(); + await bluebird_lst_1.default.map(updateChannelFileToInfo.values(), async (task) => { + const publishConfig = task.publishConfiguration; + if (publishConfig.publishAutoUpdate === false) { + builder_util_1.log.debug({ + provider: publishConfig.provider, + reason: "publishAutoUpdate is set to false", + }, "auto update metadata file not published"); + return; + } + if (task.info.releaseDate == null) { + task.info.releaseDate = releaseDate; + } + const fileContent = Buffer.from(builder_util_1.serializeToYaml(task.info, false, true)); + await fs_extra_1.outputFile(task.file, fileContent); + packager.dispatchArtifactCreated({ + file: task.file, + fileContent, + arch: null, + packager: task.packager, + target: null, + publishConfig, + }); + }, { concurrency: 4 }); +} +exports.writeUpdateInfoFiles = writeUpdateInfoFiles; +// backward compatibility - write json file +async function writeOldMacInfo(publishConfig, outDir, dir, channel, createdFiles, version, packager) { + const isGitHub = publishConfig.provider === "github"; + const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, "github", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`); + if (!createdFiles.has(updateInfoFile)) { + createdFiles.add(updateInfoFile); + await fs_extra_1.outputJson(updateInfoFile, { + version, + releaseDate: new Date().toISOString(), + url: PublishManager_1.computeDownloadUrl(publishConfig, packager.generateName2("zip", "mac", isGitHub), packager), + }, { spaces: 2 }); + packager.info.dispatchArtifactCreated({ + file: updateInfoFile, + arch: null, + packager, + target: null, + publishConfig, + }); + } +} +//# sourceMappingURL=updateInfoBuilder.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js.map b/client/node_modules/app-builder-lib/out/publish/updateInfoBuilder.js.map new file mode 100644 index 0000000000..3802ebb120 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/publish/upd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,CAAA;AACH,CAAC;AAlDD,oDAkDC;AAED,2CAA2C;AAC3C,KAAK,UAAU,eAAe,CAC5B,aAAmC,EACnC,MAAc,EACd,GAAW,EACX,OAAe,EACf,YAAyB,EACzB,OAAe,EACf,QAA+B;IAE/B,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,KAAK,QAAQ,CAAA;IACpD,MAAM,cAAc,GAAG,QAAQ,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,WAAW,CAAC,CAAA;IAC3I,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;QACrC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAChC,MAAM,qBAAU,CACd,cAAc,EACd;YACE,OAAO;YACP,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,GAAG,EAAE,mCAAkB,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACjG,EACD,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAA;QAED,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAC;YACpC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM,EAAE,IAAI;YACZ,aAAa;SACd,CAAC,CAAA;KACH;AACH,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, log, safeStringifyJson, serializeToYaml } from \"builder-util\"\nimport { GenericServerOptions, PublishConfiguration, UpdateInfo, WindowsUpdateInfo } from \"builder-util-runtime\"\nimport { outputFile, outputJson, readFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Platform } from \"../core\"\nimport { ReleaseInfo } from \"../options/PlatformSpecificBuildOptions\"\nimport { Packager } from \"../packager\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { hashFile } from \"../util/hash\"\nimport { computeDownloadUrl, getPublishConfigsForUpdateInfo } from \"./PublishManager\"\n\nasync function getReleaseInfo(packager: PlatformPackager) {\n const releaseInfo: ReleaseInfo = { ...(packager.platformSpecificBuildOptions.releaseInfo || packager.config.releaseInfo) }\n if (releaseInfo.releaseNotes == null) {\n const releaseNotesFile = await packager.getResource(\n releaseInfo.releaseNotesFile,\n `release-notes-${packager.platform.buildConfigurationKey}.md`,\n `release-notes-${packager.platform.name}.md`,\n `release-notes-${packager.platform.nodeName}.md`,\n \"release-notes.md\"\n )\n const releaseNotes = releaseNotesFile == null ? null : await readFile(releaseNotesFile, \"utf-8\")\n // to avoid undefined in the file, check for null\n if (releaseNotes != null) {\n releaseInfo.releaseNotes = releaseNotes\n }\n }\n delete releaseInfo.releaseNotesFile\n return releaseInfo\n}\n\nfunction isGenerateUpdatesFilesForAllChannels(packager: PlatformPackager) {\n const value = packager.platformSpecificBuildOptions.generateUpdatesFilesForAllChannels\n return value == null ? packager.config.generateUpdatesFilesForAllChannels : value\n}\n\n/**\n if this is an \"alpha\" version, we need to generate only the \"alpha\" .yml file\n if this is a \"beta\" version, we need to generate both the \"alpha\" and \"beta\" .yml file\n if this is a \"stable\" version, we need to generate all the \"alpha\", \"beta\" and \"stable\" .yml file\n */\nfunction computeChannelNames(packager: PlatformPackager, publishConfig: PublishConfiguration): Array {\n const currentChannel: string = (publishConfig as GenericServerOptions).channel || \"latest\"\n // for GitHub should be pre-release way be used\n if (currentChannel === \"alpha\" || publishConfig.provider === \"github\" || !isGenerateUpdatesFilesForAllChannels(packager)) {\n return [currentChannel]\n }\n\n switch (currentChannel) {\n case \"beta\":\n return [currentChannel, \"alpha\"]\n\n case \"latest\":\n return [currentChannel, \"alpha\", \"beta\"]\n\n default:\n return [currentChannel]\n }\n}\n\nfunction getUpdateInfoFileName(channel: string, packager: PlatformPackager, arch: Arch | null): string {\n const osSuffix = packager.platform === Platform.WINDOWS ? \"\" : `-${packager.platform.buildConfigurationKey}`\n return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`\n}\n\nfunction getArchPrefixForUpdateFile(arch: Arch | null, packager: PlatformPackager) {\n if (arch == null || arch === Arch.x64 || packager.platform !== Platform.LINUX) {\n return \"\"\n }\n return arch === Arch.armv7l ? \"-arm\" : `-${Arch[arch]}`\n}\n\nexport interface UpdateInfoFileTask {\n readonly file: string\n readonly info: UpdateInfo\n readonly publishConfiguration: PublishConfiguration\n\n readonly packager: PlatformPackager\n}\n\nfunction computeIsisElectronUpdater1xCompatibility(updaterCompatibility: string | null, publishConfiguration: PublishConfiguration, packager: Packager) {\n if (updaterCompatibility != null) {\n return semver.satisfies(\"1.0.0\", updaterCompatibility)\n }\n\n // spaces is a new publish provider, no need to keep backward compatibility\n if (publishConfiguration.provider === \"spaces\") {\n return false\n }\n\n const updaterVersion = packager.metadata.dependencies == null ? null : packager.metadata.dependencies[\"electron-updater\"]\n return updaterVersion == null || semver.lt(updaterVersion, \"4.0.0\")\n}\n\n/** @internal */\nexport async function createUpdateInfoTasks(event: ArtifactCreated, _publishConfigs: Array): Promise> {\n const packager = event.packager\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, _publishConfigs, event.arch)\n if (publishConfigs == null || publishConfigs.length === 0) {\n return []\n }\n\n const outDir = event.target!.outDir\n const version = packager.appInfo.version\n const sha2 = new Lazy(() => hashFile(event.file, \"sha256\", \"hex\"))\n const isMac = packager.platform === Platform.MAC\n const createdFiles = new Set()\n const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager))\n const tasks: Array = []\n const electronUpdaterCompatibility = packager.platformSpecificBuildOptions.electronUpdaterCompatibility || packager.config.electronUpdaterCompatibility || \">=2.15\"\n for (const publishConfiguration of publishConfigs) {\n let dir = outDir\n if (publishConfigs.length > 1 && publishConfiguration !== publishConfigs[0]) {\n dir = path.join(outDir, publishConfiguration.provider)\n }\n\n let isElectronUpdater1xCompatibility = computeIsisElectronUpdater1xCompatibility(electronUpdaterCompatibility, publishConfiguration, packager.info)\n\n let info = sharedInfo\n // noinspection JSDeprecatedSymbols\n if (isElectronUpdater1xCompatibility && packager.platform === Platform.WINDOWS) {\n info = {\n ...info,\n }\n // noinspection JSDeprecatedSymbols\n ;(info as WindowsUpdateInfo).sha2 = await sha2.value\n }\n\n if (event.safeArtifactName != null && publishConfiguration.provider === \"github\") {\n const newFiles = info.files.slice()\n newFiles[0].url = event.safeArtifactName\n info = {\n ...info,\n files: newFiles,\n path: event.safeArtifactName,\n }\n }\n\n for (const channel of computeChannelNames(packager, publishConfiguration)) {\n if (isMac && isElectronUpdater1xCompatibility && event.file.endsWith(\".zip\")) {\n // write only for first channel (generateUpdatesFilesForAllChannels is a new functionality, no need to generate old mac update info file)\n isElectronUpdater1xCompatibility = false\n await writeOldMacInfo(publishConfiguration, outDir, dir, channel, createdFiles, version, packager)\n }\n\n const updateInfoFile = path.join(dir, getUpdateInfoFileName(channel, packager, event.arch))\n if (createdFiles.has(updateInfoFile)) {\n continue\n }\n\n createdFiles.add(updateInfoFile)\n\n // artifact should be uploaded only to designated publish provider\n tasks.push({\n file: updateInfoFile,\n info,\n publishConfiguration,\n packager,\n })\n }\n }\n return tasks\n}\n\nasync function createUpdateInfo(version: string, event: ArtifactCreated, releaseInfo: ReleaseInfo): Promise {\n const customUpdateInfo = event.updateInfo\n const url = path.basename(event.file)\n const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hashFile(event.file))\n const files = [{ url, sha512 }]\n const result: UpdateInfo = {\n // @ts-ignore\n version,\n // @ts-ignore\n files,\n // @ts-ignore\n path: url /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */,\n // @ts-ignore\n sha512 /* backward compatibility, electron-updater 1.x - electron-updater 2.15.0 */,\n ...(releaseInfo as UpdateInfo),\n }\n\n if (customUpdateInfo != null) {\n // file info or nsis web installer packages info\n Object.assign(\"sha512\" in customUpdateInfo ? files[0] : result, customUpdateInfo)\n }\n return result\n}\n\nexport async function writeUpdateInfoFiles(updateInfoFileTasks: Array, packager: Packager) {\n // zip must be first and zip info must be used for old path/sha512 properties in the update info\n updateInfoFileTasks.sort((a, b) => (a.info.files[0].url.endsWith(\".zip\") ? 0 : 100) - (b.info.files[0].url.endsWith(\".zip\") ? 0 : 100))\n\n const updateChannelFileToInfo = new Map()\n for (const task of updateInfoFileTasks) {\n // https://github.com/electron-userland/electron-builder/pull/2994\n const key = `${task.file}@${safeStringifyJson(task.publishConfiguration, new Set([\"releaseType\"]))}`\n const existingTask = updateChannelFileToInfo.get(key)\n if (existingTask == null) {\n updateChannelFileToInfo.set(key, task)\n continue\n }\n\n existingTask.info.files.push(...task.info.files)\n }\n\n const releaseDate = new Date().toISOString()\n await BluebirdPromise.map(\n updateChannelFileToInfo.values(),\n async task => {\n const publishConfig = task.publishConfiguration\n if (publishConfig.publishAutoUpdate === false) {\n log.debug(\n {\n provider: publishConfig.provider,\n reason: \"publishAutoUpdate is set to false\",\n },\n \"auto update metadata file not published\"\n )\n return\n }\n\n if (task.info.releaseDate == null) {\n task.info.releaseDate = releaseDate\n }\n\n const fileContent = Buffer.from(serializeToYaml(task.info, false, true))\n await outputFile(task.file, fileContent)\n packager.dispatchArtifactCreated({\n file: task.file,\n fileContent,\n arch: null,\n packager: task.packager,\n target: null,\n publishConfig,\n })\n },\n { concurrency: 4 }\n )\n}\n\n// backward compatibility - write json file\nasync function writeOldMacInfo(\n publishConfig: PublishConfiguration,\n outDir: string,\n dir: string,\n channel: string,\n createdFiles: Set,\n version: string,\n packager: PlatformPackager\n) {\n const isGitHub = publishConfig.provider === \"github\"\n const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, \"github\", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`)\n if (!createdFiles.has(updateInfoFile)) {\n createdFiles.add(updateInfoFile)\n await outputJson(\n updateInfoFile,\n {\n version,\n releaseDate: new Date().toISOString(),\n url: computeDownloadUrl(publishConfig, packager.generateName2(\"zip\", \"mac\", isGitHub), packager),\n },\n { spaces: 2 }\n )\n\n packager.info.dispatchArtifactCreated({\n file: updateInfoFile,\n arch: null,\n packager,\n target: null,\n publishConfig,\n })\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.d.ts b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.d.ts new file mode 100644 index 0000000000..a8d70e83ca --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.d.ts @@ -0,0 +1,8 @@ +import { Lazy } from "lazy-val"; +import { Packager } from "../packager"; +export declare class ProjectInfoManager { + readonly packager: Packager; + readonly infoFile: Lazy; + constructor(packager: Packager); + private saveConfigurationAndMetadata; +} diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js new file mode 100644 index 0000000000..982df9261c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ProjectInfoManager = void 0; +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +class ProjectInfoManager { + constructor(packager) { + this.packager = packager; + this.infoFile = new lazy_val_1.Lazy(() => this.saveConfigurationAndMetadata()); + } + async saveConfigurationAndMetadata() { + const packager = this.packager; + const tempDir = await packager.tempDirManager.createTempDir({ prefix: "remote-build-metadata" }); + // we cannot use getTempFile because file name must be constant + const info = { + metadata: packager.metadata, + configuration: packager.config, + repositoryInfo: await packager.repositoryInfo, + buildResourceDirName: path.basename(packager.buildResourcesDir), + }; + if (packager.metadata !== packager.devMetadata && packager.devMetadata != null) { + info.devMetadata = packager.devMetadata; + } + const file = path.join(tempDir, "info.json"); + await fs_extra_1.outputJson(file, info); + return file; + } +} +exports.ProjectInfoManager = ProjectInfoManager; +//# sourceMappingURL=ProjectInfoManager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js.map b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js.map new file mode 100644 index 0000000000..4930e7a4db --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/ProjectInfoManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProjectInfoManager.js","sourceRoot":"","sources":["../../src/remoteBuilder/ProjectInfoManager.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAG5B,MAAa,kBAAkB;IAG7B,YAAqB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAF9B,aAAQ,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAA;IAE7B,CAAC;IAEnC,KAAK,CAAC,4BAA4B;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAA;QAChG,+DAA+D;QAC/D,MAAM,IAAI,GAAQ;YAChB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,aAAa,EAAE,QAAQ,CAAC,MAAM;YAC9B,cAAc,EAAE,MAAM,QAAQ,CAAC,cAAc;YAC7C,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;SAChE,CAAA;QACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,IAAI,IAAI,EAAE;YAC9E,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAA;SACxC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QAC5C,MAAM,qBAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAtBD,gDAsBC","sourcesContent":["import { outputJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Packager } from \"../packager\"\n\nexport class ProjectInfoManager {\n readonly infoFile = new Lazy(() => this.saveConfigurationAndMetadata())\n\n constructor(readonly packager: Packager) {}\n\n private async saveConfigurationAndMetadata() {\n const packager = this.packager\n const tempDir = await packager.tempDirManager.createTempDir({ prefix: \"remote-build-metadata\" })\n // we cannot use getTempFile because file name must be constant\n const info: any = {\n metadata: packager.metadata,\n configuration: packager.config,\n repositoryInfo: await packager.repositoryInfo,\n buildResourceDirName: path.basename(packager.buildResourcesDir),\n }\n if (packager.metadata !== packager.devMetadata && packager.devMetadata != null) {\n info.devMetadata = packager.devMetadata\n }\n const file = path.join(tempDir, \"info.json\")\n await outputJson(file, info)\n return file\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.d.ts b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.d.ts new file mode 100644 index 0000000000..e3ed91ed83 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.d.ts @@ -0,0 +1,13 @@ +import { Arch } from "builder-util"; +import { Target } from "../core"; +import { PlatformPackager } from "../platformPackager"; +export declare class RemoteBuilder { + readonly packager: PlatformPackager; + private readonly toBuild; + private buildStarted; + constructor(packager: PlatformPackager); + scheduleBuild(target: Target, arch: Arch, unpackedDirectory: string): void; + build(): Promise; + private _build; + private artifactInfoToArtifactCreatedEvent; +} diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js new file mode 100644 index 0000000000..636df83b2e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RemoteBuilder = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const path = require("path"); +const core_1 = require("../core"); +const platformPackager_1 = require("../platformPackager"); +const appBuilder_1 = require("../util/appBuilder"); +const ProjectInfoManager_1 = require("./ProjectInfoManager"); +class RemoteBuilder { + constructor(packager) { + this.packager = packager; + this.toBuild = new Map(); + this.buildStarted = false; + } + scheduleBuild(target, arch, unpackedDirectory) { + if (!builder_util_1.isEnvTrue(process.env._REMOTE_BUILD) && this.packager.config.remoteBuild === false) { + throw new builder_util_1.InvalidConfigurationError('Target is not supported on your OS and using of Electron Build Service is disabled ("remoteBuild" option)'); + } + let list = this.toBuild.get(arch); + if (list == null) { + list = []; + this.toBuild.set(arch, list); + } + list.push({ + name: target.name, + arch: builder_util_1.Arch[arch], + unpackedDirectory, + outDir: target.outDir, + }); + } + build() { + if (this.buildStarted) { + return Promise.resolve(); + } + this.buildStarted = true; + return bluebird_lst_1.default.mapSeries(Array.from(this.toBuild.keys()), (arch) => { + return this._build(this.toBuild.get(arch), this.packager); + }); + } + // noinspection JSMethodCanBeStatic + async _build(targets, packager) { + if (builder_util_1.log.isDebugEnabled) { + builder_util_1.log.debug({ remoteTargets: JSON.stringify(targets, null, 2) }, "remote building"); + } + const projectInfoManager = new ProjectInfoManager_1.ProjectInfoManager(packager.info); + const buildRequest = { + targets: targets.map(it => { + return { + name: it.name, + arch: it.arch, + unpackedDirName: path.basename(it.unpackedDirectory), + }; + }), + platform: packager.platform.buildConfigurationKey, + }; + if (platformPackager_1.isSafeToUnpackElectronOnRemoteBuildServer(packager)) { + buildRequest.electronDownload = { + version: packager.info.framework.version, + platform: core_1.Platform.LINUX.nodeName, + arch: targets[0].arch, + }; + const linuxPackager = packager; + buildRequest.executableName = linuxPackager.executableName; + } + const req = Buffer.from(JSON.stringify(buildRequest)).toString("base64"); + const outDir = targets[0].outDir; + const args = ["remote-build", "--request", req, "--output", outDir]; + args.push("--file", targets[0].unpackedDirectory); + args.push("--file", await projectInfoManager.infoFile.value); + const buildResourcesDir = packager.buildResourcesDir; + if (buildResourcesDir === packager.projectDir) { + throw new builder_util_1.InvalidConfigurationError(`Build resources dir equals to project dir and so, not sent to remote build agent. It will lead to incorrect results.\nPlease set "directories.buildResources" to separate dir or leave default ("build" directory in the project root)`); + } + args.push("--build-resource-dir", buildResourcesDir); + const result = await appBuilder_1.executeAppBuilderAsJson(args); + if (result.error != null) { + throw new builder_util_1.InvalidConfigurationError(`Remote builder error (if you think that it is not your application misconfiguration issue, please file issue to https://github.com/electron-userland/electron-builder/issues):\n\n${result.error}`, "REMOTE_BUILDER_ERROR"); + } + else if (result.files != null) { + for (const artifact of result.files) { + const localFile = path.join(outDir, artifact.file); + const artifactCreatedEvent = this.artifactInfoToArtifactCreatedEvent(artifact, localFile, outDir); + // PublishManager uses outDir and options, real (the same as for local build) values must be used + await this.packager.info.callArtifactBuildCompleted(artifactCreatedEvent); + } + } + } + artifactInfoToArtifactCreatedEvent(artifact, localFile, outDir) { + const target = artifact.target; + // noinspection SpellCheckingInspection + return { + ...artifact, + file: localFile, + target: target == null ? null : new FakeTarget(target, outDir, this.packager.config[target]), + packager: this.packager, + }; + } +} +exports.RemoteBuilder = RemoteBuilder; +class FakeTarget extends core_1.Target { + constructor(name, outDir, options) { + super(name); + this.outDir = outDir; + this.options = options; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async build(appOutDir, arch) { + // no build + } +} +//# sourceMappingURL=RemoteBuilder.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js.map b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js.map new file mode 100644 index 0000000000..1a3dc2333d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/RemoteBuilder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RemoteBuilder.js","sourceRoot":"","sources":["../../src/remoteBuilder/RemoteBuilder.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAA8E;AAC9E,6BAA4B;AAE5B,kCAAiE;AAGjE,0DAAiG;AACjG,mDAA4D;AAC5D,6DAAyD;AASzD,MAAa,aAAa;IAIxB,YAAqB,QAA+B;QAA/B,aAAQ,GAAR,QAAQ,CAAuB;QAHnC,YAAO,GAAG,IAAI,GAAG,EAA2B,CAAA;QACrD,iBAAY,GAAG,KAAK,CAAA;IAE2B,CAAC;IAExD,aAAa,CAAC,MAAc,EAAE,IAAU,EAAE,iBAAyB;QACjE,IAAI,CAAC,wBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE;YACvF,MAAM,IAAI,wCAAyB,CAAC,2GAA2G,CAAC,CAAA;SACjJ;QAED,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,IAAI,IAAI,IAAI,EAAE;YAChB,IAAI,GAAG,EAAE,CAAA;YACT,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAC7B;QAED,IAAI,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,mBAAI,CAAC,IAAI,CAAC;YAChB,iBAAiB;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;SACzB;QAED,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,CAAA;gBAClD,MAAM,oBAAoB,GAAG,IAAI,CAAC,kCAAkC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;gBACjG,iGAAiG;gBACjG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAA;aAC1E;SACF;IACH,CAAC;IAEO,kCAAkC,CAAC,QAAsB,EAAE,SAAiB,EAAE,MAAc;QAClG,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAA;QAC9B,uCAAuC;QACvC,OAAO;YACL,GAAG,QAAQ;YACX,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAG,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,MAAM,CAAC,CAAC;YACrG,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC;CACF;AA7GD,sCA6GC;AAED,MAAM,UAAW,SAAQ,aAAM;IAC7B,YAAY,IAAY,EAAW,MAAc,EAAW,OAAiD;QAC3G,KAAK,CAAC,IAAI,CAAC,CAAA;QADsB,WAAM,GAAN,MAAM,CAAQ;QAAW,YAAO,GAAP,OAAO,CAA0C;IAE7G,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,IAAU;QACvC,WAAW;IACb,CAAC;CACF","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, isEnvTrue, log, InvalidConfigurationError } from \"builder-util\"\nimport * as path from \"path\"\nimport { UploadTask } from \"electron-publish/out/publisher\"\nimport { Platform, Target, TargetSpecificOptions } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { isSafeToUnpackElectronOnRemoteBuildServer, PlatformPackager } from \"../platformPackager\"\nimport { executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { ProjectInfoManager } from \"./ProjectInfoManager\"\n\ninterface TargetInfo {\n name: string\n arch: string\n unpackedDirectory: string\n outDir: string\n}\n\nexport class RemoteBuilder {\n private readonly toBuild = new Map>()\n private buildStarted = false\n\n constructor(readonly packager: PlatformPackager) {}\n\n scheduleBuild(target: Target, arch: Arch, unpackedDirectory: string) {\n if (!isEnvTrue(process.env._REMOTE_BUILD) && this.packager.config.remoteBuild === false) {\n throw new InvalidConfigurationError('Target is not supported on your OS and using of Electron Build Service is disabled (\"remoteBuild\" option)')\n }\n\n let list = this.toBuild.get(arch)\n if (list == null) {\n list = []\n this.toBuild.set(arch, list)\n }\n\n list.push({\n name: target.name,\n arch: Arch[arch],\n unpackedDirectory,\n outDir: target.outDir,\n })\n }\n\n build(): Promise {\n if (this.buildStarted) {\n return Promise.resolve()\n }\n\n this.buildStarted = true\n\n return BluebirdPromise.mapSeries(Array.from(this.toBuild.keys()), (arch: Arch) => {\n return this._build(this.toBuild.get(arch)!, this.packager)\n })\n }\n\n // noinspection JSMethodCanBeStatic\n private async _build(targets: Array, packager: PlatformPackager): Promise {\n if (log.isDebugEnabled) {\n log.debug({ remoteTargets: JSON.stringify(targets, null, 2) }, \"remote building\")\n }\n\n const projectInfoManager = new ProjectInfoManager(packager.info)\n\n const buildRequest: any = {\n targets: targets.map(it => {\n return {\n name: it.name,\n arch: it.arch,\n unpackedDirName: path.basename(it.unpackedDirectory),\n }\n }),\n platform: packager.platform.buildConfigurationKey,\n }\n\n if (isSafeToUnpackElectronOnRemoteBuildServer(packager)) {\n buildRequest.electronDownload = {\n version: packager.info.framework.version,\n platform: Platform.LINUX.nodeName,\n arch: targets[0].arch,\n }\n\n const linuxPackager = packager as LinuxPackager\n buildRequest.executableName = linuxPackager.executableName\n }\n\n const req = Buffer.from(JSON.stringify(buildRequest)).toString(\"base64\")\n const outDir = targets[0].outDir\n const args = [\"remote-build\", \"--request\", req, \"--output\", outDir]\n\n args.push(\"--file\", targets[0].unpackedDirectory)\n args.push(\"--file\", await projectInfoManager.infoFile.value)\n\n const buildResourcesDir = packager.buildResourcesDir\n if (buildResourcesDir === packager.projectDir) {\n throw new InvalidConfigurationError(\n `Build resources dir equals to project dir and so, not sent to remote build agent. It will lead to incorrect results.\\nPlease set \"directories.buildResources\" to separate dir or leave default (\"build\" directory in the project root)`\n )\n }\n\n args.push(\"--build-resource-dir\", buildResourcesDir)\n\n const result: any = await executeAppBuilderAsJson(args)\n if (result.error != null) {\n throw new InvalidConfigurationError(\n `Remote builder error (if you think that it is not your application misconfiguration issue, please file issue to https://github.com/electron-userland/electron-builder/issues):\\n\\n${result.error}`,\n \"REMOTE_BUILDER_ERROR\"\n )\n } else if (result.files != null) {\n for (const artifact of result.files) {\n const localFile = path.join(outDir, artifact.file)\n const artifactCreatedEvent = this.artifactInfoToArtifactCreatedEvent(artifact, localFile, outDir)\n // PublishManager uses outDir and options, real (the same as for local build) values must be used\n await this.packager.info.callArtifactBuildCompleted(artifactCreatedEvent)\n }\n }\n }\n\n private artifactInfoToArtifactCreatedEvent(artifact: ArtifactInfo, localFile: string, outDir: string): ArtifactCreated {\n const target = artifact.target\n // noinspection SpellCheckingInspection\n return {\n ...artifact,\n file: localFile,\n target: target == null ? null : new FakeTarget(target, outDir, (this.packager.config as any)[target]),\n packager: this.packager,\n }\n }\n}\n\nclass FakeTarget extends Target {\n constructor(name: string, readonly outDir: string, readonly options: TargetSpecificOptions | null | undefined) {\n super(name)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async build(appOutDir: string, arch: Arch) {\n // no build\n }\n}\n\ninterface ArtifactInfo extends UploadTask {\n target: string | null\n\n readonly isWriteUpdateInfo?: boolean\n readonly updateInfo?: any\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.d.ts b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js new file mode 100644 index 0000000000..b984fb19b2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const builder_util_1 = require("builder-util"); +const packager_1 = require("../packager"); +if (process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG == null) { + process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG = "true"; +} +async function doBuild(data) { + if (process.env.APP_BUILDER_TMP_DIR == null) { + throw new builder_util_1.InvalidConfigurationError("Env APP_BUILDER_TMP_DIR must be set for builder process"); + } + const projectDir = process.env.PROJECT_DIR; + if (projectDir == null) { + throw new builder_util_1.InvalidConfigurationError("Env PROJECT_DIR must be set for builder process"); + } + const targets = data.targets; + if (data.platform == null) { + throw new builder_util_1.InvalidConfigurationError("platform not specified"); + } + if (targets == null) { + throw new builder_util_1.InvalidConfigurationError("targets path not specified"); + } + if (!Array.isArray(targets)) { + throw new builder_util_1.InvalidConfigurationError("targets must be array of target name"); + } + const infoFile = projectDir + path.sep + "info.json"; + const info = await fs_extra_1.readJson(infoFile); + const projectOutDir = process.env.PROJECT_OUT_DIR; + if (projectDir == null) { + throw new builder_util_1.InvalidConfigurationError("Env PROJECT_OUT_DIR must be set for builder process"); + } + // yes, for now we expect the only target + const prepackaged = projectDir + path.sep + targets[0].unpackedDirName; + // do not use build function because we don't need to publish artifacts + const options = { + prepackaged, + projectDir, + [data.platform]: targets.map(it => it.name + ":" + it.arch), + publish: "never", + }; + const packager = new packager_1.Packager(options); + const artifacts = []; + const relativePathOffset = projectOutDir.length + 1; + packager.artifactCreated(event => { + if (event.file == null) { + return; + } + artifacts.push({ + file: event.file.substring(relativePathOffset), + target: event.target == null ? null : event.target.name, + arch: event.arch, + safeArtifactName: event.safeArtifactName, + isWriteUpdateInfo: event.isWriteUpdateInfo === true, + updateInfo: event.updateInfo, + }); + }); + packager.stageDirPathCustomizer = (target, packager, arch) => { + // snap creates a lot of files and so, we cannot use tmpfs to avoid out of memory error + const parentDir = target.name === "snap" && !target.isUseTemplateApp ? projectOutDir : projectDir; + return `${parentDir}${path.sep}__${target.name}-${builder_util_1.Arch[arch]}`; + }; + // _build method expects final effective configuration - packager.options.config is ignored + await packager._build({ + ...info.configuration, + publish: null, + beforeBuild: null, + afterPack: null, + afterSign: null, + afterAllArtifactBuild: null, + onNodeModuleFile: null, + directories: { + output: projectOutDir, + buildResources: `${projectDir}${path.sep}${info.buildResourceDirName}`, + }, + }, info.metadata, info.devMetadata, info.repositoryInfo); + // writeJson must be not used because it adds unwanted \n as last file symbol + await fs_extra_1.writeFile(path.join(process.env.APP_BUILDER_TMP_DIR, "__build-result.json"), JSON.stringify(artifacts)); +} +doBuild(JSON.parse(process.argv[2])).catch(error => { + process.exitCode = 0; + return fs_extra_1.writeFile(path.join(process.env.APP_BUILDER_TMP_DIR, "__build-result.json"), (error.stack || error).toString()); +}); +//# sourceMappingURL=builder-cli.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js.map b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js.map new file mode 100644 index 0000000000..10a63f92ed --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/builder-cli.js.map @@ -0,0 +1 @@ +{"version":3,"file":"builder-cli.js","sourceRoot":"","sources":["../../src/remoteBuilder/builder-cli.ts"],"names":[],"mappings":";;AACA,uCAA8C;AAC9C,6BAA4B;AAC5B,+CAA8D;AAC9D,0CAAsC;AAItC,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,IAAI,IAAI,EAAE;IAC1D,OAAO,CAAC,GAAG,CAAC,k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A2F;IAC3F,MAAM,QAAQ,CAAC,MAAM,CACnB;QACE,GAAG,IAAI,CAAC,aAAa;QACrB,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,qBAAqB,EAAE,IAAI;QAC3B,gBAAgB,EAAE,IAAI;QACtB,WAAW,EAAE;YACX,MAAM,EAAE,aAAa;YACrB,cAAc,EAAE,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,oBAAoB,EAAE;SACvE;KACF,EACD,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,cAAc,CACpB,CAAA;IAED,6EAA6E;IAC7E,MAAM,oBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAoB,EAAE,qBAAqB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;AAChH,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACpB,OAAO,oBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAoB,EAAE,qBAAqB,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AACzH,CAAC,CAAC,CAAA","sourcesContent":["import { PublishOptions, UploadTask } from \"electron-publish\"\nimport { readJson, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { Arch, InvalidConfigurationError } from \"builder-util\"\nimport { Packager } from \"../packager\"\nimport { PackagerOptions } from \"../packagerApi\"\nimport SnapTarget from \"../targets/snap\"\n\nif (process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG == null) {\n process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG = \"true\"\n}\n\nasync function doBuild(data: BuildTask): Promise {\n if (process.env.APP_BUILDER_TMP_DIR == null) {\n throw new InvalidConfigurationError(\"Env APP_BUILDER_TMP_DIR must be set for builder process\")\n }\n\n const projectDir = process.env.PROJECT_DIR\n if (projectDir == null) {\n throw new InvalidConfigurationError(\"Env PROJECT_DIR must be set for builder process\")\n }\n\n const targets = data.targets\n if (data.platform == null) {\n throw new InvalidConfigurationError(\"platform not specified\")\n }\n if (targets == null) {\n throw new InvalidConfigurationError(\"targets path not specified\")\n }\n if (!Array.isArray(targets)) {\n throw new InvalidConfigurationError(\"targets must be array of target name\")\n }\n\n const infoFile = projectDir + path.sep + \"info.json\"\n const info = await readJson(infoFile)\n\n const projectOutDir = process.env.PROJECT_OUT_DIR\n if (projectDir == null) {\n throw new InvalidConfigurationError(\"Env PROJECT_OUT_DIR must be set for builder process\")\n }\n\n // yes, for now we expect the only target\n const prepackaged = projectDir + path.sep + targets[0].unpackedDirName\n // do not use build function because we don't need to publish artifacts\n const options: PackagerOptions & PublishOptions = {\n prepackaged,\n projectDir,\n [data.platform]: targets.map(it => it.name + \":\" + it.arch),\n publish: \"never\",\n }\n const packager = new Packager(options)\n\n const artifacts: Array = []\n const relativePathOffset = projectOutDir!.length + 1\n packager.artifactCreated(event => {\n if (event.file == null) {\n return\n }\n\n artifacts.push({\n file: event.file.substring(relativePathOffset),\n target: event.target == null ? null : event.target.name,\n arch: event.arch,\n safeArtifactName: event.safeArtifactName,\n isWriteUpdateInfo: event.isWriteUpdateInfo === true,\n updateInfo: event.updateInfo,\n })\n })\n\n packager.stageDirPathCustomizer = (target, packager, arch) => {\n // snap creates a lot of files and so, we cannot use tmpfs to avoid out of memory error\n const parentDir = target.name === \"snap\" && !(target as SnapTarget).isUseTemplateApp ? projectOutDir : projectDir\n return `${parentDir}${path.sep}__${target.name}-${Arch[arch]}`\n }\n\n // _build method expects final effective configuration - packager.options.config is ignored\n await packager._build(\n {\n ...info.configuration,\n publish: null,\n beforeBuild: null,\n afterPack: null,\n afterSign: null,\n afterAllArtifactBuild: null,\n onNodeModuleFile: null,\n directories: {\n output: projectOutDir,\n buildResources: `${projectDir}${path.sep}${info.buildResourceDirName}`,\n },\n },\n info.metadata,\n info.devMetadata,\n info.repositoryInfo\n )\n\n // writeJson must be not used because it adds unwanted \\n as last file symbol\n await writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!, \"__build-result.json\"), JSON.stringify(artifacts))\n}\n\ndoBuild(JSON.parse(process.argv[2])).catch(error => {\n process.exitCode = 0\n return writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!, \"__build-result.json\"), (error.stack || error).toString())\n})\n\ninterface TargetInfo {\n name: string\n arch: string\n unpackedDirName: string\n}\n\ninterface ArtifactInfo extends UploadTask {\n target: string | null\n\n readonly isWriteUpdateInfo?: boolean\n readonly updateInfo?: any\n}\n\ninterface BuildTask {\n platform: string\n targets: Array\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.d.ts b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.d.ts new file mode 100644 index 0000000000..c13b0c622f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.d.ts @@ -0,0 +1,3 @@ +/// +export declare const ELECTRON_BUILD_SERVICE_LOCAL_CA_CERT: Buffer; +export declare const ELECTRON_BUILD_SERVICE_CA_CERT: Buffer; diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js new file mode 100644 index 0000000000..824eaffdd2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ELECTRON_BUILD_SERVICE_CA_CERT = exports.ELECTRON_BUILD_SERVICE_LOCAL_CA_CERT = void 0; +// noinspection SpellCheckingInspection +exports.ELECTRON_BUILD_SERVICE_LOCAL_CA_CERT = Buffer.from(`-----BEGIN CERTIFICATE----- +MIIBiDCCAS+gAwIBAgIRAPHSzTRLcN2nElhQdaRP47IwCgYIKoZIzj0EAwIwJDEi +MCAGA1UEAxMZZWxlY3Ryb24uYnVpbGQubG9jYWwgcm9vdDAeFw0xNzExMTMxNzI4 +NDFaFw0yNzExMTExNzI4NDFaMCQxIjAgBgNVBAMTGWVsZWN0cm9uLmJ1aWxkLmxv +Y2FsIHJvb3QwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQVyduuCT2acuk2QH06 +yal/b6O7eTTpOHk3Ucjc+ZZta2vC2+c1IKcSAwimKbTbK+nRxWWJl9ZYx9RTwbRf +QjD6o0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUlm08vBe4CUNAOTQN5Z1RNTfJjjYwCgYIKoZIzj0EAwIDRwAwRAIgMXlT6YM8 +4pQtnhUjijVMz+NlcYafS1CEbNBMaWhP87YCIGXUmu7ON9hRLanXzBNBlrtTQG+i +l/NT6REwZA64/lNy +-----END CERTIFICATE----- +`); +// noinspection SpellCheckingInspection +exports.ELECTRON_BUILD_SERVICE_CA_CERT = Buffer.from(`-----BEGIN CERTIFICATE----- +MIIBfTCCASOgAwIBAgIRAIdieK1+3C4abgOvQ7pVVqAwCgYIKoZIzj0EAwIwHjEc +MBoGA1UEAxMTZWxlY3Ryb24uYnVpbGQgcm9vdDAeFw0xNzExMTMxNzI4NDFaFw0x +ODExMTMxNzI4NDFaMB4xHDAaBgNVBAMTE2VsZWN0cm9uLmJ1aWxkIHJvb3QwWTAT +BgcqhkjOPQIBBggqhkjOPQMBBwNCAAR+4b6twzizN/z27yvwrCV5kinGUrfo+W7n +L/l28ErscNe1BDSyh/IYrnMWb1rDMSLGhvkgI9Cfex1whNPHR101o0IwQDAOBgNV +HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU6Dq8kK7tQlrt +zkIYrYiTZGpHEp0wCgYIKoZIzj0EAwIDSAAwRQIgKSfjAQbYlY/S1wMLUi84r8QN +hhMnUwsOmlDan0xPalICIQDLIAXAIyArVtH38a4aizvhH8YeXrxzpJh3U8RolBZF +SA== +-----END CERTIFICATE----- +`); +//# sourceMappingURL=remote-builder-certs.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js.map b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js.map new file mode 100644 index 0000000000..060d6d6f46 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/remoteBuilder/remote-builder-certs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remote-builder-certs.js","sourceRoot":"","sources":["../../src/remoteBuilder/remote-builder-certs.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAC1B,QAAA,oCAAoC,GAAG,MAAM,CAAC,IAAI,CAAC;;;;;;;;;;;CAW/D,CAAC,CAAA;AAEF,uCAAuC;AAC1B,QAAA,8BAA8B,GAAG,MAAM,CAAC,IAAI,CAAC;;;;;;;;;;;CAWzD,CAAC,CAAA","sourcesContent":["// noinspection SpellCheckingInspection\nexport const ELECTRON_BUILD_SERVICE_LOCAL_CA_CERT = Buffer.from(`-----BEGIN CERTIFICATE-----\nMIIBiDCCAS+gAwIBAgIRAPHSzTRLcN2nElhQdaRP47IwCgYIKoZIzj0EAwIwJDEi\nMCAGA1UEAxMZZWxlY3Ryb24uYnVpbGQubG9jYWwgcm9vdDAeFw0xNzExMTMxNzI4\nNDFaFw0yNzExMTExNzI4NDFaMCQxIjAgBgNVBAMTGWVsZWN0cm9uLmJ1aWxkLmxv\nY2FsIHJvb3QwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQVyduuCT2acuk2QH06\nyal/b6O7eTTpOHk3Ucjc+ZZta2vC2+c1IKcSAwimKbTbK+nRxWWJl9ZYx9RTwbRf\nQjD6o0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E\nFgQUlm08vBe4CUNAOTQN5Z1RNTfJjjYwCgYIKoZIzj0EAwIDRwAwRAIgMXlT6YM8\n4pQtnhUjijVMz+NlcYafS1CEbNBMaWhP87YCIGXUmu7ON9hRLanXzBNBlrtTQG+i\nl/NT6REwZA64/lNy\n-----END CERTIFICATE-----\n`)\n\n// noinspection SpellCheckingInspection\nexport const ELECTRON_BUILD_SERVICE_CA_CERT = Buffer.from(`-----BEGIN CERTIFICATE-----\nMIIBfTCCASOgAwIBAgIRAIdieK1+3C4abgOvQ7pVVqAwCgYIKoZIzj0EAwIwHjEc\nMBoGA1UEAxMTZWxlY3Ryb24uYnVpbGQgcm9vdDAeFw0xNzExMTMxNzI4NDFaFw0x\nODExMTMxNzI4NDFaMB4xHDAaBgNVBAMTE2VsZWN0cm9uLmJ1aWxkIHJvb3QwWTAT\nBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR+4b6twzizN/z27yvwrCV5kinGUrfo+W7n\nL/l28ErscNe1BDSyh/IYrnMWb1rDMSLGhvkgI9Cfex1whNPHR101o0IwQDAOBgNV\nHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU6Dq8kK7tQlrt\nzkIYrYiTZGpHEp0wCgYIKoZIzj0EAwIDSAAwRQIgKSfjAQbYlY/S1wMLUi84r8QN\nhhMnUwsOmlDan0xPalICIQDLIAXAIyArVtH38a4aizvhH8YeXrxzpJh3U8RolBZF\nSA==\n-----END CERTIFICATE-----\n`)\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/AppImageTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.d.ts new file mode 100644 index 0000000000..12e51de0d4 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.d.ts @@ -0,0 +1,14 @@ +import { Arch } from "builder-util"; +import { Target } from "../core"; +import { LinuxPackager } from "../linuxPackager"; +import { AppImageOptions } from "../options/linuxOptions"; +import { LinuxTargetHelper } from "./LinuxTargetHelper"; +export default class AppImageTarget extends Target { + private readonly packager; + private readonly helper; + readonly outDir: string; + readonly options: AppImageOptions; + private readonly desktopEntry; + constructor(ignored: string, packager: LinuxPackager, helper: LinuxTargetHelper, outDir: string); + build(appOutDir: string, arch: Arch): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js new file mode 100644 index 0000000000..31344b32f4 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const core_1 = require("../core"); +const PublishManager_1 = require("../publish/PublishManager"); +const appBuilder_1 = require("../util/appBuilder"); +const license_1 = require("../util/license"); +const targetUtil_1 = require("./targetUtil"); +// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file +class AppImageTarget extends core_1.Target { + constructor(ignored, packager, helper, outDir) { + super("appImage"); + this.packager = packager; + this.helper = helper; + this.outDir = outDir; + this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config[this.name] }; + this.desktopEntry = new lazy_val_1.Lazy(() => { + var _a; + const args = ((_a = this.options.executableArgs) === null || _a === void 0 ? void 0 : _a.join(" ")) || "--no-sandbox"; + return helper.computeDesktopEntry(this.options, `AppRun ${args} %U`, { + "X-AppImage-Version": `${packager.appInfo.buildVersion}`, + }); + }); + } + async build(appOutDir, arch) { + const packager = this.packager; + const options = this.options; + // https://github.com/electron-userland/electron-builder/issues/775 + // https://github.com/electron-userland/electron-builder/issues/1726 + // tslint:disable-next-line:no-invalid-template-strings + const artifactName = packager.expandArtifactNamePattern(options, "AppImage", arch); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "AppImage", + file: artifactPath, + arch, + }); + const c = await Promise.all([ + this.desktopEntry.value, + this.helper.icons, + PublishManager_1.getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */), + license_1.getNotLocalizedLicenseFile(options.license, this.packager, ["txt", "html"]), + targetUtil_1.createStageDir(this, packager, arch), + ]); + const license = c[3]; + const stageDir = c[4]; + const publishConfig = c[2]; + if (publishConfig != null) { + await fs_extra_1.outputFile(path.join(packager.getResourcesDir(stageDir.dir), "app-update.yml"), builder_util_1.serializeToYaml(publishConfig)); + } + if (this.packager.packagerOptions.effectiveOptionComputed != null && + (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: await this.desktopEntry.value }))) { + return; + } + const args = [ + "appimage", + "--stage", + stageDir.dir, + "--arch", + builder_util_1.Arch[arch], + "--output", + artifactPath, + "--app", + appOutDir, + "--configuration", + JSON.stringify({ + productName: this.packager.appInfo.productName, + productFilename: this.packager.appInfo.productFilename, + desktopEntry: c[0], + executableName: this.packager.executableName, + icons: c[1], + fileAssociations: this.packager.fileAssociations, + ...options, + }), + ]; + appBuilder_1.objectToArgs(args, { + license, + }); + if (packager.compression === "maximum") { + args.push("--compression", "xz"); + } + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + safeArtifactName: packager.computeSafeArtifactName(artifactName, "AppImage", arch, false), + target: this, + arch, + packager, + isWriteUpdateInfo: true, + updateInfo: await appBuilder_1.executeAppBuilderAsJson(args), + }); + } +} +exports.default = AppImageTarget; +//# sourceMappingURL=AppImageTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js.map b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js.map new file mode 100644 index 0000000000..b0eb133871 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppImageTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppIm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M;SACP;QAED,MAAM,IAAI,GAAG;YACX,UAAU;YACV,SAAS;YACT,QAAQ,CAAC,GAAG;YACZ,QAAQ;YACR,mBAAI,CAAC,IAAI,CAAC;YACV,UAAU;YACV,YAAY;YACZ,OAAO;YACP,SAAS;YACT,iBAAiB;YACjB,IAAI,CAAC,SAAS,CAAC;gBACb,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW;gBAC9C,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe;gBACtD,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;gBAClB,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc;gBAC5C,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;gBACX,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB;gBAChD,GAAG,OAAO;aACX,CAAC;SACH,CAAA;QACD,yBAAY,CAAC,IAAI,EAAE;YACjB,OAAO;SACR,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;SACjC;QAED,MAAM,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC;YAC7C,IAAI,EAAE,YAAY;YAClB,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;YACzF,MAAM,EAAE,IAAI;YACZ,IAAI;YACJ,QAAQ;YACR,iBAAiB,EAAE,IAAI;YACvB,UAAU,EAAE,MAAM,oCAAuB,CAAC,IAAI,CAAC;SAChD,CAAC,CAAA;IACJ,CAAC;CACF;AAzFD,iCAyFC","sourcesContent":["import { Arch, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { AppImageOptions } from \"../options/linuxOptions\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { executeAppBuilderAsJson, objectToArgs } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDir } from \"./targetUtil\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n private readonly desktopEntry: Lazy\n\n constructor(ignored: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy(() => {\n const args = this.options.executableArgs?.join(\" \") || \"--no-sandbox\"\n return helper.computeDesktopEntry(this.options, `AppRun ${args} %U`, {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n })\n })\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const packager = this.packager\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n // tslint:disable-next-line:no-invalid-template-strings\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n const c = await Promise.all([\n this.desktopEntry.value,\n this.helper.icons,\n getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */),\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n createStageDir(this, packager, arch),\n ])\n const license = c[3]\n const stageDir = c[4]!\n\n const publishConfig = c[2]\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(stageDir.dir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n if (\n this.packager.packagerOptions.effectiveOptionComputed != null &&\n (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: await this.desktopEntry.value }))\n ) {\n return\n }\n\n const args = [\n \"appimage\",\n \"--stage\",\n stageDir.dir,\n \"--arch\",\n Arch[arch],\n \"--output\",\n artifactPath,\n \"--app\",\n appOutDir,\n \"--configuration\",\n JSON.stringify({\n productName: this.packager.appInfo.productName,\n productFilename: this.packager.appInfo.productFilename,\n desktopEntry: c[0],\n executableName: this.packager.executableName,\n icons: c[1],\n fileAssociations: this.packager.fileAssociations,\n ...options,\n }),\n ]\n objectToArgs(args, {\n license,\n })\n if (packager.compression === \"maximum\") {\n args.push(\"--compression\", \"xz\")\n }\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo: await executeAppBuilderAsJson(args),\n })\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/AppxTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/AppxTarget.d.ts new file mode 100644 index 0000000000..ad6edc3ec8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppxTarget.d.ts @@ -0,0 +1,15 @@ +import { Arch } from "builder-util"; +import { AppXOptions } from "../"; +import { Target } from "../core"; +import { WinPackager } from "../winPackager"; +export default class AppXTarget extends Target { + private readonly packager; + readonly outDir: string; + readonly options: AppXOptions; + constructor(packager: WinPackager, outDir: string); + build(appOutDir: string, arch: Arch): Promise; + private static computeUserAssets; + private computePublisherName; + private writeManifest; + private getExtensions; +} diff --git a/client/node_modules/app-builder-lib/out/targets/AppxTarget.js b/client/node_modules/app-builder-lib/out/targets/AppxTarget.js new file mode 100644 index 0000000000..0cafafcf8b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppxTarget.js @@ -0,0 +1,315 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const windowsCodeSign_1 = require("../codeSign/windowsCodeSign"); +const core_1 = require("../core"); +const pathManager_1 = require("../util/pathManager"); +const targetUtil_1 = require("./targetUtil"); +const APPX_ASSETS_DIR_NAME = "appx"; +const vendorAssetsForDefaultAssets = { + "StoreLogo.png": "SampleAppx.50x50.png", + "Square150x150Logo.png": "SampleAppx.150x150.png", + "Square44x44Logo.png": "SampleAppx.44x44.png", + "Wide310x150Logo.png": "SampleAppx.310x150.png", +}; +const DEFAULT_RESOURCE_LANG = "en-US"; +class AppXTarget extends core_1.Target { + constructor(packager, outDir) { + super("appx"); + this.packager = packager; + this.outDir = outDir; + this.options = builder_util_1.deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx); + if (process.platform !== "darwin" && (process.platform !== "win32" || windowsCodeSign_1.isOldWin6())) { + throw new Error("AppX is supported only on Windows 10 or Windows Server 2012 R2 (version number 6.3+)"); + } + } + // https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files + async build(appOutDir, arch) { + const packager = this.packager; + const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "appx", arch); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "AppX", + file: artifactPath, + arch, + }); + const vendorPath = await windowsCodeSign_1.getSignVendorPath(); + const vm = await packager.vm.value; + const stageDir = await targetUtil_1.createStageDir(this, packager, arch); + const mappingFile = stageDir.getTempFile("mapping.txt"); + const makeAppXArgs = ["pack", "/o" /* overwrite the output file if it exists */, "/f", vm.toVmFile(mappingFile), "/p", vm.toVmFile(artifactPath)]; + if (packager.compression === "store") { + makeAppXArgs.push("/nc"); + } + const mappingList = []; + mappingList.push(await bluebird_lst_1.default.map(fs_1.walk(appOutDir), file => { + let appxPath = file.substring(appOutDir.length + 1); + if (path.sep !== "\\") { + appxPath = appxPath.replace(/\//g, "\\"); + } + return `"${vm.toVmFile(file)}" "app\\${appxPath}"`; + })); + const userAssetDir = await this.packager.getResource(undefined, APPX_ASSETS_DIR_NAME); + const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath, userAssetDir); + const userAssets = assetInfo.userAssets; + const manifestFile = stageDir.getTempFile("AppxManifest.xml"); + await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets); + await packager.info.callAppxManifestCreated(manifestFile); + mappingList.push(assetInfo.mappings); + mappingList.push([`"${vm.toVmFile(manifestFile)}" "AppxManifest.xml"`]); + const signToolArch = arch === builder_util_1.Arch.arm64 ? "x64" : builder_util_1.Arch[arch]; + if (isScaledAssetsProvided(userAssets)) { + const outFile = vm.toVmFile(stageDir.getTempFile("resources.pri")); + const makePriPath = vm.toVmFile(path.join(vendorPath, "windows-10", signToolArch, "makepri.exe")); + const assetRoot = stageDir.getTempFile("appx/assets"); + await fs_extra_1.emptyDir(assetRoot); + await bluebird_lst_1.default.map(assetInfo.allAssets, it => fs_1.copyOrLinkFile(it, path.join(assetRoot, path.basename(it)))); + await vm.exec(makePriPath, [ + "new", + "/Overwrite", + "/Manifest", + vm.toVmFile(manifestFile), + "/ProjectRoot", + vm.toVmFile(path.dirname(assetRoot)), + "/ConfigXml", + vm.toVmFile(path.join(pathManager_1.getTemplatePath("appx"), "priconfig.xml")), + "/OutputFile", + outFile, + ]); + // in addition to resources.pri, resources.scale-140.pri and other such files will be generated + for (const resourceFile of (await fs_extra_1.readdir(stageDir.dir)).filter(it => it.startsWith("resources.")).sort()) { + mappingList.push([`"${vm.toVmFile(stageDir.getTempFile(resourceFile))}" "${resourceFile}"`]); + } + makeAppXArgs.push("/l"); + } + let mapping = "[Files]"; + for (const list of mappingList) { + mapping += "\r\n" + list.join("\r\n"); + } + await fs_extra_1.writeFile(mappingFile, mapping); + packager.debugLogger.add("appx.mapping", mapping); + if (this.options.makeappxArgs != null) { + makeAppXArgs.push(...this.options.makeappxArgs); + } + await vm.exec(vm.toVmFile(path.join(vendorPath, "windows-10", signToolArch, "makeappx.exe")), makeAppXArgs); + await packager.sign(artifactPath); + await stageDir.cleanup(); + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + packager, + arch, + safeArtifactName: packager.computeSafeArtifactName(artifactName, "appx"), + target: this, + isWriteUpdateInfo: this.options.electronUpdaterAware, + }); + } + static async computeUserAssets(vm, vendorPath, userAssetDir) { + const mappings = []; + let userAssets; + const allAssets = []; + if (userAssetDir == null) { + userAssets = []; + } + else { + userAssets = (await fs_extra_1.readdir(userAssetDir)).filter(it => !it.startsWith(".") && !it.endsWith(".db") && it.includes(".")); + for (const name of userAssets) { + mappings.push(`"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}" "assets\\${name}"`); + allAssets.push(path.join(userAssetDir, name)); + } + } + for (const defaultAsset of Object.keys(vendorAssetsForDefaultAssets)) { + if (userAssets.length === 0 || !isDefaultAssetIncluded(userAssets, defaultAsset)) { + const file = path.join(vendorPath, "appxAssets", vendorAssetsForDefaultAssets[defaultAsset]); + mappings.push(`"${vm.toVmFile(file)}" "assets\\${defaultAsset}"`); + allAssets.push(file); + } + } + // we do not use process.arch to build path to tools, because even if you are on x64, ia32 appx tool must be used if you build appx for ia32 + return { userAssets, mappings, allAssets }; + } + // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711 + async computePublisherName() { + if ((await this.packager.cscInfo.value) == null) { + builder_util_1.log.info({ reason: "Windows Store only build" }, "AppX is not signed"); + return this.options.publisher || "CN=ms"; + } + const certInfo = await this.packager.lazyCertInfo.value; + const publisher = this.options.publisher || (certInfo == null ? null : certInfo.bloodyMicrosoftSubjectDn); + if (publisher == null) { + throw new Error("Internal error: cannot compute subject using certificate info"); + } + return publisher; + } + async writeManifest(outFile, arch, publisher, userAssets) { + const appInfo = this.packager.appInfo; + const options = this.options; + const executable = `app\\${appInfo.productFilename}.exe`; + const displayName = options.displayName || appInfo.productName; + const extensions = await this.getExtensions(executable, displayName); + const manifest = (await fs_extra_1.readFile(path.join(pathManager_1.getTemplatePath("appx"), "appxmanifest.xml"), "utf8")).replace(/\${([a-zA-Z0-9]+)}/g, (match, p1) => { + switch (p1) { + case "publisher": + return publisher; + case "publisherDisplayName": { + const name = options.publisherDisplayName || appInfo.companyName; + if (name == null) { + throw new builder_util_1.InvalidConfigurationError(`Please specify "author" in the application package.json — it is required because "appx.publisherDisplayName" is not set.`); + } + return name; + } + case "version": + return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true); + case "applicationId": { + const result = options.applicationId || options.identityName || appInfo.name; + if (!isNaN(parseInt(result[0], 10))) { + let message = `AppX Application.Id can’t start with numbers: "${result}"`; + if (options.applicationId == null) { + message += `\nPlease set appx.applicationId (or correct appx.identityName or name)`; + } + throw new builder_util_1.InvalidConfigurationError(message); + } + return result; + } + case "identityName": + return options.identityName || appInfo.name; + case "executable": + return executable; + case "displayName": + return displayName; + case "description": + return appInfo.description || appInfo.productName; + case "backgroundColor": + return options.backgroundColor || "#464646"; + case "logo": + return "assets\\StoreLogo.png"; + case "square150x150Logo": + return "assets\\Square150x150Logo.png"; + case "square44x44Logo": + return "assets\\Square44x44Logo.png"; + case "lockScreen": + return lockScreenTag(userAssets); + case "defaultTile": + return defaultTileTag(userAssets, options.showNameOnTiles || false); + case "splashScreen": + return splashScreenTag(userAssets); + case "arch": + return arch === builder_util_1.Arch.ia32 ? "x86" : arch === builder_util_1.Arch.arm64 ? "arm64" : "x64"; + case "resourceLanguages": + return resourceLanguageTag(builder_util_1.asArray(options.languages)); + case "extensions": + return extensions; + case "minVersion": + return arch === builder_util_1.Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"; + case "maxVersionTested": + return arch === builder_util_1.Arch.arm64 ? "10.0.16299.0" : "10.0.14316.0"; + default: + throw new Error(`Macro ${p1} is not defined`); + } + }); + await fs_extra_1.writeFile(outFile, manifest); + } + async getExtensions(executable, displayName) { + const uriSchemes = builder_util_1.asArray(this.packager.config.protocols).concat(builder_util_1.asArray(this.packager.platformSpecificBuildOptions.protocols)); + const fileAssociations = builder_util_1.asArray(this.packager.config.fileAssociations).concat(builder_util_1.asArray(this.packager.platformSpecificBuildOptions.fileAssociations)); + let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension; + if (isAddAutoLaunchExtension === undefined) { + const deps = this.packager.info.metadata.dependencies; + isAddAutoLaunchExtension = deps != null && deps["electron-winstore-auto-launch"] != null; + } + if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0 && this.options.customExtensionsPath === undefined) { + return ""; + } + let extensions = ""; + if (isAddAutoLaunchExtension) { + extensions += ` + + + `; + } + for (const protocol of uriSchemes) { + for (const scheme of builder_util_1.asArray(protocol.schemes)) { + extensions += ` + + + ${protocol.name} + + `; + } + } + for (const fileAssociation of fileAssociations) { + for (const ext of builder_util_1.asArray(fileAssociation.ext)) { + extensions += ` + + + + .${ext} + + + `; + } + } + if (this.options.customExtensionsPath !== undefined) { + const extensionsPath = path.resolve(this.packager.info.appDir, this.options.customExtensionsPath); + extensions += await fs_extra_1.readFile(extensionsPath, "utf8"); + } + extensions += ""; + return extensions; + } +} +exports.default = AppXTarget; +// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest +function resourceLanguageTag(userLanguages) { + if (userLanguages == null || userLanguages.length === 0) { + userLanguages = [DEFAULT_RESOURCE_LANG]; + } + return userLanguages.map(it => ``).join("\n"); +} +function lockScreenTag(userAssets) { + if (isDefaultAssetIncluded(userAssets, "BadgeLogo.png")) { + return ''; + } + else { + return ""; + } +} +function defaultTileTag(userAssets, showNameOnTiles) { + const defaultTiles = [""); + defaultTiles.push(""); + defaultTiles.push(""); + defaultTiles.push(""); + defaultTiles.push(""); + defaultTiles.push(""); + } + else { + defaultTiles.push("/>"); + } + return defaultTiles.join(" "); +} +function splashScreenTag(userAssets) { + if (isDefaultAssetIncluded(userAssets, "SplashScreen.png")) { + return ''; + } + else { + return ""; + } +} +function isDefaultAssetIncluded(userAssets, defaultAsset) { + const defaultAssetName = defaultAsset.substring(0, defaultAsset.indexOf(".")); + return userAssets.some(it => it.includes(defaultAssetName)); +} +function isScaledAssetsProvided(userAssets) { + return userAssets.some(it => it.includes(".scale-") || it.includes(".targetsize-")); +} +//# sourceMappingURL=AppxTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/AppxTarget.js.map b/client/node_modules/app-builder-lib/out/targets/AppxTarget.js.map new file mode 100644 index 0000000000..c7faae14c9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/AppxTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppxTarget.js","sourceRoot":"","sources":["../../src/targets/AppxTarget.ts"],"names":[],"mappings":";;AAAA,+CAA0C;AAC1C,+CAAwF;AACxF,4CAA0D;AAC1D,uCAAiE;AACjE,6BAA4B;AAE5B,iEAA0E;AAC1E,kCAAgC;AAChC,qDAAqD;AAGrD,6CAA6C;AAE7C,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEnC,MAAM,4BAA4B,GAA8B;IAC9D,eAAe,EAAE,sBAAsB;IACvC,uBAAuB,EAAE,wBAAwB;IACjD,qBAAqB,EAAE,sBAAsB;IAC7C,qBAAqB,EAAE,wBAAwB;CAChD,CAAA;AAED,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAErC,MAAqB,UAAW,SAAQ,aAAM;IAG5C,YAA6B,QAAqB,EAAW,MAAc;QACzE,KAAK,CAAC,MAAM,CAAC,CAAA;QADc,aAAQ,GAAR,QAAQ,CAAa;QAAW,WAAM,GAAN,MAAM,CAAQ;QAFlE,YAAO,GAAgB,yBAAU,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAKnH,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO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validConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, walk } from \"builder-util/out/fs\"\nimport { emptyDir, readdir, readFile, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { AppXOptions } from \"../\"\nimport { getSignVendorPath, isOldWin6 } from \"../codeSign/windowsCodeSign\"\nimport { Target } from \"../core\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir } from \"./targetUtil\"\n\nconst APPX_ASSETS_DIR_NAME = \"appx\"\n\nconst vendorAssetsForDefaultAssets: { [key: string]: string } = {\n \"StoreLogo.png\": \"SampleAppx.50x50.png\",\n \"Square150x150Logo.png\": \"SampleAppx.150x150.png\",\n \"Square44x44Logo.png\": \"SampleAppx.44x44.png\",\n \"Wide310x150Logo.png\": \"SampleAppx.310x150.png\",\n}\n\nconst DEFAULT_RESOURCE_LANG = \"en-US\"\n\nexport default class AppXTarget extends Target {\n readonly options: AppXOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx)\n\n constructor(private readonly packager: WinPackager, readonly outDir: string) {\n super(\"appx\")\n\n if (process.platform !== \"darwin\" && (process.platform !== \"win32\" || isOldWin6())) {\n throw new Error(\"AppX is supported only on Windows 10 or Windows Server 2012 R2 (version number 6.3+)\")\n }\n }\n\n // https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files\n async build(appOutDir: string, arch: Arch): Promise {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"appx\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"AppX\",\n file: artifactPath,\n arch,\n })\n\n const vendorPath = await getSignVendorPath()\n const vm = await packager.vm.value\n\n const stageDir = await createStageDir(this, packager, arch)\n\n const mappingFile = stageDir.getTempFile(\"mapping.txt\")\n const makeAppXArgs = [\"pack\", \"/o\" /* overwrite the output file if it exists */, \"/f\", vm.toVmFile(mappingFile), \"/p\", vm.toVmFile(artifactPath)]\n if (packager.compression === \"store\") {\n makeAppXArgs.push(\"/nc\")\n }\n\n const mappingList: Array> = []\n mappingList.push(\n await BluebirdPromise.map(walk(appOutDir), file => {\n let appxPath = file.substring(appOutDir.length + 1)\n if (path.sep !== \"\\\\\") {\n appxPath = appxPath.replace(/\\//g, \"\\\\\")\n }\n return `\"${vm.toVmFile(file)}\" \"app\\\\${appxPath}\"`\n })\n )\n\n const userAssetDir = await this.packager.getResource(undefined, APPX_ASSETS_DIR_NAME)\n const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath, userAssetDir)\n const userAssets = assetInfo.userAssets\n\n const manifestFile = stageDir.getTempFile(\"AppxManifest.xml\")\n await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets)\n await packager.info.callAppxManifestCreated(manifestFile)\n mappingList.push(assetInfo.mappings)\n mappingList.push([`\"${vm.toVmFile(manifestFile)}\" \"AppxManifest.xml\"`])\n const signToolArch = arch === Arch.arm64 ? \"x64\" : Arch[arch]\n\n if (isScaledAssetsProvided(userAssets)) {\n const outFile = vm.toVmFile(stageDir.getTempFile(\"resources.pri\"))\n const makePriPath = vm.toVmFile(path.join(vendorPath, \"windows-10\", signToolArch, \"makepri.exe\"))\n\n const assetRoot = stageDir.getTempFile(\"appx/assets\")\n await emptyDir(assetRoot)\n await BluebirdPromise.map(assetInfo.allAssets, it => copyOrLinkFile(it, path.join(assetRoot, path.basename(it))))\n\n await vm.exec(makePriPath, [\n \"new\",\n \"/Overwrite\",\n \"/Manifest\",\n vm.toVmFile(manifestFile),\n \"/ProjectRoot\",\n vm.toVmFile(path.dirname(assetRoot)),\n \"/ConfigXml\",\n vm.toVmFile(path.join(getTemplatePath(\"appx\"), \"priconfig.xml\")),\n \"/OutputFile\",\n outFile,\n ])\n\n // in addition to resources.pri, resources.scale-140.pri and other such files will be generated\n for (const resourceFile of (await readdir(stageDir.dir)).filter(it => it.startsWith(\"resources.\")).sort()) {\n mappingList.push([`\"${vm.toVmFile(stageDir.getTempFile(resourceFile))}\" \"${resourceFile}\"`])\n }\n makeAppXArgs.push(\"/l\")\n }\n\n let mapping = \"[Files]\"\n for (const list of mappingList) {\n mapping += \"\\r\\n\" + list.join(\"\\r\\n\")\n }\n await writeFile(mappingFile, mapping)\n packager.debugLogger.add(\"appx.mapping\", mapping)\n\n if (this.options.makeappxArgs != null) {\n makeAppXArgs.push(...this.options.makeappxArgs)\n }\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"windows-10\", signToolArch, \"makeappx.exe\")), makeAppXArgs)\n await packager.sign(artifactPath)\n\n await stageDir.cleanup()\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"appx\"),\n target: this,\n isWriteUpdateInfo: this.options.electronUpdaterAware,\n })\n }\n\n private static async computeUserAssets(vm: VmManager, vendorPath: string, userAssetDir: string | null) {\n const mappings: Array = []\n let userAssets: Array\n const allAssets: Array = []\n if (userAssetDir == null) {\n userAssets = []\n } else {\n userAssets = (await readdir(userAssetDir)).filter(it => !it.startsWith(\".\") && !it.endsWith(\".db\") && it.includes(\".\"))\n for (const name of userAssets) {\n mappings.push(`\"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}\" \"assets\\\\${name}\"`)\n allAssets.push(path.join(userAssetDir, name))\n }\n }\n\n for (const defaultAsset of Object.keys(vendorAssetsForDefaultAssets)) {\n if (userAssets.length === 0 || !isDefaultAssetIncluded(userAssets, defaultAsset)) {\n const file = path.join(vendorPath, \"appxAssets\", vendorAssetsForDefaultAssets[defaultAsset])\n mappings.push(`\"${vm.toVmFile(file)}\" \"assets\\\\${defaultAsset}\"`)\n allAssets.push(file)\n }\n }\n\n // we do not use process.arch to build path to tools, because even if you are on x64, ia32 appx tool must be used if you build appx for ia32\n return { userAssets, mappings, allAssets }\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n private async computePublisherName() {\n if ((await this.packager.cscInfo.value) == null) {\n log.info({ reason: \"Windows Store only build\" }, \"AppX is not signed\")\n return this.options.publisher || \"CN=ms\"\n }\n\n const certInfo = await this.packager.lazyCertInfo.value\n const publisher = this.options.publisher || (certInfo == null ? null : certInfo.bloodyMicrosoftSubjectDn)\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n private async writeManifest(outFile: string, arch: Arch, publisher: string, userAssets: Array) {\n const appInfo = this.packager.appInfo\n const options = this.options\n const executable = `app\\\\${appInfo.productFilename}.exe`\n const displayName = options.displayName || appInfo.productName\n const extensions = await this.getExtensions(executable, displayName)\n\n const manifest = (await readFile(path.join(getTemplatePath(\"appx\"), \"appxmanifest.xml\"), \"utf8\")).replace(/\\${([a-zA-Z0-9]+)}/g, (match, p1): string => {\n switch (p1) {\n case \"publisher\":\n return publisher\n\n case \"publisherDisplayName\": {\n const name = options.publisherDisplayName || appInfo.companyName\n if (name == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"appx.publisherDisplayName\" is not set.`)\n }\n return name\n }\n\n case \"version\":\n return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true)\n\n case \"applicationId\": {\n const result = options.applicationId || options.identityName || appInfo.name\n if (!isNaN(parseInt(result[0], 10))) {\n let message = `AppX Application.Id can’t start with numbers: \"${result}\"`\n if (options.applicationId == null) {\n message += `\\nPlease set appx.applicationId (or correct appx.identityName or name)`\n }\n throw new InvalidConfigurationError(message)\n }\n return result\n }\n\n case \"identityName\":\n return options.identityName || appInfo.name\n\n case \"executable\":\n return executable\n\n case \"displayName\":\n return displayName\n\n case \"description\":\n return appInfo.description || appInfo.productName\n\n case \"backgroundColor\":\n return options.backgroundColor || \"#464646\"\n\n case \"logo\":\n return \"assets\\\\StoreLogo.png\"\n\n case \"square150x150Logo\":\n return \"assets\\\\Square150x150Logo.png\"\n\n case \"square44x44Logo\":\n return \"assets\\\\Square44x44Logo.png\"\n\n case \"lockScreen\":\n return lockScreenTag(userAssets)\n\n case \"defaultTile\":\n return defaultTileTag(userAssets, options.showNameOnTiles || false)\n\n case \"splashScreen\":\n return splashScreenTag(userAssets)\n\n case \"arch\":\n return arch === Arch.ia32 ? \"x86\" : arch === Arch.arm64 ? \"arm64\" : \"x64\"\n\n case \"resourceLanguages\":\n return resourceLanguageTag(asArray(options.languages))\n\n case \"extensions\":\n return extensions\n\n case \"minVersion\":\n return arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n\n case \"maxVersionTested\":\n return arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n\n default:\n throw new Error(`Macro ${p1} is not defined`)\n }\n })\n await writeFile(outFile, manifest)\n }\n\n private async getExtensions(executable: string, displayName: string): Promise {\n const uriSchemes = asArray(this.packager.config.protocols).concat(asArray(this.packager.platformSpecificBuildOptions.protocols))\n\n const fileAssociations = asArray(this.packager.config.fileAssociations).concat(asArray(this.packager.platformSpecificBuildOptions.fileAssociations))\n\n let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension\n if (isAddAutoLaunchExtension === undefined) {\n const deps = this.packager.info.metadata.dependencies\n isAddAutoLaunchExtension = deps != null && deps[\"electron-winstore-auto-launch\"] != null\n }\n\n if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0 && this.options.customExtensionsPath === undefined) {\n return \"\"\n }\n\n let extensions = \"\"\n\n if (isAddAutoLaunchExtension) {\n extensions += `\n \n \n `\n }\n\n for (const protocol of uriSchemes) {\n for (const scheme of asArray(protocol.schemes)) {\n extensions += `\n \n \n ${protocol.name}\n \n `\n }\n }\n\n for (const fileAssociation of fileAssociations) {\n for (const ext of asArray(fileAssociation.ext)) {\n extensions += `\n \n \n \n .${ext}\n \n \n `\n }\n }\n\n if (this.options.customExtensionsPath !== undefined) {\n const extensionsPath = path.resolve(this.packager.info.appDir, this.options.customExtensionsPath)\n extensions += await readFile(extensionsPath, \"utf8\")\n }\n\n extensions += \"\"\n return extensions\n }\n}\n\n// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest\nfunction resourceLanguageTag(userLanguages: Array | null | undefined): string {\n if (userLanguages == null || userLanguages.length === 0) {\n userLanguages = [DEFAULT_RESOURCE_LANG]\n }\n return userLanguages.map(it => ``).join(\"\\n\")\n}\n\nfunction lockScreenTag(userAssets: Array): string {\n if (isDefaultAssetIncluded(userAssets, \"BadgeLogo.png\")) {\n return ''\n } else {\n return \"\"\n }\n}\n\nfunction defaultTileTag(userAssets: Array, showNameOnTiles: boolean): string {\n const defaultTiles: Array = [\"\")\n defaultTiles.push(\"\")\n defaultTiles.push(\"\")\n defaultTiles.push(\"\")\n defaultTiles.push(\"\")\n defaultTiles.push(\"\")\n } else {\n defaultTiles.push(\"/>\")\n }\n return defaultTiles.join(\" \")\n}\n\nfunction splashScreenTag(userAssets: Array): string {\n if (isDefaultAssetIncluded(userAssets, \"SplashScreen.png\")) {\n return ''\n } else {\n return \"\"\n }\n}\n\nfunction isDefaultAssetIncluded(userAssets: Array, defaultAsset: string) {\n const defaultAssetName = defaultAsset.substring(0, defaultAsset.indexOf(\".\"))\n return userAssets.some(it => it.includes(defaultAssetName))\n}\n\nfunction isScaledAssetsProvided(userAssets: Array) {\n return userAssets.some(it => it.includes(\".scale-\") || it.includes(\".targetsize-\"))\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.d.ts new file mode 100644 index 0000000000..c8718942a3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.d.ts @@ -0,0 +1,11 @@ +import { Arch } from "builder-util"; +import { Target, TargetSpecificOptions } from "../core"; +import { PlatformPackager } from "../platformPackager"; +export declare class ArchiveTarget extends Target { + readonly outDir: string; + private readonly packager; + private readonly isWriteUpdateInfo; + readonly options: TargetSpecificOptions; + constructor(name: string, outDir: string, packager: PlatformPackager, isWriteUpdateInfo?: boolean); + build(appOutDir: string, arch: Arch): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js new file mode 100644 index 0000000000..8f44518657 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ArchiveTarget = void 0; +const builder_util_1 = require("builder-util"); +const path = require("path"); +const core_1 = require("../core"); +const fileMatcher_1 = require("../fileMatcher"); +const archive_1 = require("./archive"); +const differentialUpdateInfoBuilder_1 = require("./differentialUpdateInfoBuilder"); +class ArchiveTarget extends core_1.Target { + constructor(name, outDir, packager, isWriteUpdateInfo = false) { + super(name); + this.outDir = outDir; + this.packager = packager; + this.isWriteUpdateInfo = isWriteUpdateInfo; + this.options = this.packager.config[this.name]; + } + async build(appOutDir, arch) { + const packager = this.packager; + const isMac = packager.platform === core_1.Platform.MAC; + const format = this.name; + let defaultPattern; + const defaultArch = builder_util_1.defaultArchFromString(packager.platformSpecificBuildOptions.defaultArch); + if (packager.platform === core_1.Platform.LINUX) { + // tslint:disable-next-line:no-invalid-template-strings + defaultPattern = "${name}-${version}" + (arch === defaultArch ? "" : "-${arch}") + ".${ext}"; + } + else { + // tslint:disable-next-line:no-invalid-template-strings + defaultPattern = "${productName}-${version}" + (arch === defaultArch ? "" : "-${arch}") + "-${os}.${ext}"; + } + const artifactName = packager.expandArtifactNamePattern(this.options, format, arch, defaultPattern, false); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: `${isMac ? "macOS " : ""}${format}`, + file: artifactPath, + arch, + }); + let updateInfo = null; + if (format.startsWith("tar.")) { + await archive_1.tar(packager.compression, format, artifactPath, appOutDir, isMac, packager.info.tempDirManager); + } + else { + let withoutDir = !isMac; + let dirToArchive = appOutDir; + if (isMac) { + dirToArchive = path.dirname(appOutDir); + const fileMatchers = fileMatcher_1.getFileMatchers(packager.config, "extraDistFiles", dirToArchive, packager.createGetFileMatchersOptions(this.outDir, arch, packager.platformSpecificBuildOptions)); + if (fileMatchers == null) { + dirToArchive = appOutDir; + } + else { + await fileMatcher_1.copyFiles(fileMatchers, null, true); + withoutDir = true; + } + } + const archiveOptions = { + compression: packager.compression, + withoutDir, + }; + await archive_1.archive(format, artifactPath, dirToArchive, archiveOptions); + if (this.isWriteUpdateInfo && format === "zip") { + if (isMac) { + updateInfo = await differentialUpdateInfoBuilder_1.createBlockmap(artifactPath, this, packager, artifactName); + } + else { + updateInfo = await differentialUpdateInfoBuilder_1.appendBlockmap(artifactPath); + } + } + } + await packager.info.callArtifactBuildCompleted({ + updateInfo, + file: artifactPath, + // tslint:disable-next-line:no-invalid-template-strings + safeArtifactName: packager.computeSafeArtifactName(artifactName, format, arch, false, packager.platformSpecificBuildOptions.defaultArch, defaultPattern.replace("${productName}", "${name}")), + target: this, + arch, + packager, + isWriteUpdateInfo: this.isWriteUpdateInfo, + }); + } +} +exports.ArchiveTarget = ArchiveTarget; +//# sourceMappingURL=ArchiveTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js.map b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js.map new file mode 100644 index 0000000000..9983b0a57d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/ArchiveTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ArchiveTarget.js","sourceRoot":"","sources":["../../src/targets/ArchiveTarget.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAC1D,6BAA4B;AAC5B,kCAAiE;AACjE,gDAA2D;AAE3D,uCAAwC;AACxC,mFAAgF;AAEhF,MAAa,aAAc,SAAQ,aAAM;IAGvC,YAAY,IAAY,EAAW,MAAc,EAAmB,QAA+B,EAAmB,oBAAoB,KAAK;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,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;iBAC9E;qBAAM;oBACL,UAAU,GAAG,MAAM,8CAAc,CAAC,YAAY,CAAC,CAAA;iBAChD;aACF;SACF;QAED,MAAM,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC;YAC7C,UAAU;YACV,IAAI,EAAE,YAAY;YAClB,uDAAuD;YACvD,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB,CAChD,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,QAAQ,CAAC,4BAA4B,CAAC,WAAW,EACjD,cAAc,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,CAAC,CACpD;YACD,MAAM,EAAE,IAAI;YACZ,IAAI;YACJ,QAAQ;YACR,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CAAA;IACJ,CAAC;CACF;AArFD,sCAqFC","sourcesContent":["import { Arch, defaultArchFromString } from \"builder-util\"\nimport * as path from \"path\"\nimport { Platform, Target, TargetSpecificOptions } from \"../core\"\nimport { copyFiles, getFileMatchers } from \"../fileMatcher\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { archive, tar } from \"./archive\"\nimport { appendBlockmap, createBlockmap } from \"./differentialUpdateInfoBuilder\"\n\nexport class ArchiveTarget extends Target {\n readonly options: TargetSpecificOptions = (this.packager.config as any)[this.name]\n\n constructor(name: string, readonly outDir: string, private readonly packager: PlatformPackager, private readonly isWriteUpdateInfo = false) {\n super(name)\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const packager = this.packager\n const isMac = packager.platform === Platform.MAC\n const format = this.name\n\n let defaultPattern: string\n const defaultArch: Arch = defaultArchFromString(packager.platformSpecificBuildOptions.defaultArch)\n if (packager.platform === Platform.LINUX) {\n // tslint:disable-next-line:no-invalid-template-strings\n defaultPattern = \"${name}-${version}\" + (arch === defaultArch ? \"\" : \"-${arch}\") + \".${ext}\"\n } else {\n // tslint:disable-next-line:no-invalid-template-strings\n defaultPattern = \"${productName}-${version}\" + (arch === defaultArch ? \"\" : \"-${arch}\") + \"-${os}.${ext}\"\n }\n\n const artifactName = packager.expandArtifactNamePattern(this.options, format, arch, defaultPattern, false)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: `${isMac ? \"macOS \" : \"\"}${format}`,\n file: artifactPath,\n arch,\n })\n let updateInfo: any = null\n if (format.startsWith(\"tar.\")) {\n await tar(packager.compression, format, artifactPath, appOutDir, isMac, packager.info.tempDirManager)\n } else {\n let withoutDir = !isMac\n let dirToArchive = appOutDir\n if (isMac) {\n dirToArchive = path.dirname(appOutDir)\n const fileMatchers = getFileMatchers(\n packager.config,\n \"extraDistFiles\",\n dirToArchive,\n packager.createGetFileMatchersOptions(this.outDir, arch, packager.platformSpecificBuildOptions)\n )\n if (fileMatchers == null) {\n dirToArchive = appOutDir\n } else {\n await copyFiles(fileMatchers, null, true)\n withoutDir = true\n }\n }\n\n const archiveOptions = {\n compression: packager.compression,\n withoutDir,\n }\n await archive(format, artifactPath, dirToArchive, archiveOptions)\n\n if (this.isWriteUpdateInfo && format === \"zip\") {\n if (isMac) {\n updateInfo = await createBlockmap(artifactPath, this, packager, artifactName)\n } else {\n updateInfo = await appendBlockmap(artifactPath)\n }\n }\n }\n\n await packager.info.callArtifactBuildCompleted({\n updateInfo,\n file: artifactPath,\n // tslint:disable-next-line:no-invalid-template-strings\n safeArtifactName: packager.computeSafeArtifactName(\n artifactName,\n format,\n arch,\n false,\n packager.platformSpecificBuildOptions.defaultArch,\n defaultPattern.replace(\"${productName}\", \"${name}\")\n ),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: this.isWriteUpdateInfo,\n })\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.d.ts new file mode 100644 index 0000000000..044eee67a7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.d.ts @@ -0,0 +1,20 @@ +import { Arch } from "builder-util"; +import { Target } from "../core"; +import { LinuxPackager } from "../linuxPackager"; +import { FlatpakOptions } from "../options/linuxOptions"; +import { LinuxTargetHelper } from "./LinuxTargetHelper"; +export default class FlatpakTarget extends Target { + private readonly packager; + private helper; + readonly outDir: string; + readonly options: FlatpakOptions; + constructor(name: string, packager: LinuxPackager, helper: LinuxTargetHelper, outDir: string); + get appId(): string; + build(appOutDir: string, arch: Arch): Promise; + private prepareStageDir; + private createSandboxBinWrapper; + private createDesktopFile; + private copyLicenseFile; + private copyIcons; + private getFlatpakBuilderOptions; +} diff --git a/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js new file mode 100644 index 0000000000..f05dd733e9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const flatpak_bundler_1 = require("@malept/flatpak-bundler"); +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const core_1 = require("../core"); +const license_1 = require("../util/license"); +const targetUtil_1 = require("./targetUtil"); +class FlatpakTarget extends core_1.Target { + constructor(name, packager, helper, outDir) { + super(name); + this.packager = packager; + this.helper = helper; + this.outDir = outDir; + this.options = { + ...this.packager.platformSpecificBuildOptions, + ...this.packager.config[this.name], + }; + } + get appId() { + return filterFlatpakAppIdentifier(this.packager.appInfo.id); + } + async build(appOutDir, arch) { + const { packager, options } = this; + const artifactName = packager.expandArtifactNamePattern(options, "flatpak", arch, undefined, false); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "flatpak", + file: artifactPath, + arch, + }); + const stageDir = await this.prepareStageDir(arch); + const { manifest, buildOptions } = this.getFlatpakBuilderOptions(appOutDir, stageDir.dir, artifactName, arch); + await flatpak_bundler_1.bundle(manifest, buildOptions); + await stageDir.cleanup(); + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + safeArtifactName: packager.computeSafeArtifactName(artifactName, "flatpak", arch, false), + target: this, + arch, + packager, + isWriteUpdateInfo: false, + }); + } + async prepareStageDir(arch) { + const stageDir = await targetUtil_1.createStageDir(this, this.packager, arch); + await Promise.all([this.createSandboxBinWrapper(stageDir), this.createDesktopFile(stageDir), this.copyLicenseFile(stageDir), this.copyIcons(stageDir)]); + return stageDir; + } + async createSandboxBinWrapper(stageDir) { + const useWaylandFlags = !!this.options.useWaylandFlags; + const electronWrapperPath = stageDir.getTempFile(path.join("bin", "electron-wrapper")); + await fs_extra_1.outputFile(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, useWaylandFlags)); + await fs_extra_1.chmod(electronWrapperPath, 0o755); + } + async createDesktopFile(stageDir) { + const appIdentifier = this.appId; + const desktopFile = stageDir.getTempFile(path.join("share", "applications", `${appIdentifier}.desktop`)); + await this.helper.writeDesktopEntry(this.options, "electron-wrapper %U", desktopFile, { Icon: appIdentifier }); + } + async copyLicenseFile(stageDir) { + const licenseSrc = await license_1.getNotLocalizedLicenseFile(this.options.license, this.packager, ["txt", "html"]); + if (licenseSrc) { + const licenseDst = stageDir.getTempFile(path.join("share", "doc", this.appId, "copyright")); + await builder_util_1.copyFile(licenseSrc, licenseDst); + } + } + async copyIcons(stageDir) { + const icons = await this.helper.icons; + const copyIcons = icons.map(async (icon) => { + const extWithDot = path.extname(icon.file); + const sizeName = extWithDot === ".svg" ? "scalable" : `${icon.size}x${icon.size}`; + const iconDst = stageDir.getTempFile(path.join("share", "icons", "hicolor", sizeName, "apps", `${this.appId}${extWithDot}`)); + return builder_util_1.copyFile(icon.file, iconDst); + }); + await Promise.all(copyIcons); + } + getFlatpakBuilderOptions(appOutDir, stageDir, artifactName, arch) { + const appIdentifier = this.appId; + const { executableName } = this.packager; + const flatpakArch = builder_util_1.toLinuxArchString(arch, "flatpak"); + const manifest = { + id: appIdentifier, + command: "electron-wrapper", + runtime: this.options.runtime || flatpakBuilderDefaults.runtime, + runtimeVersion: this.options.runtimeVersion || flatpakBuilderDefaults.runtimeVersion, + sdk: this.options.sdk || flatpakBuilderDefaults.sdk, + base: this.options.base || flatpakBuilderDefaults.base, + baseVersion: this.options.baseVersion || flatpakBuilderDefaults.baseVersion, + finishArgs: this.options.finishArgs || flatpakBuilderDefaults.finishArgs, + branch: this.options.branch, + modules: this.options.modules, + }; + const buildOptions = { + baseFlatpakref: `app/${manifest.base}/${flatpakArch}/${manifest.baseVersion}`, + runtimeFlatpakref: `runtime/${manifest.runtime}/${flatpakArch}/${manifest.runtimeVersion}`, + sdkFlatpakref: `runtime/${manifest.sdk}/${flatpakArch}/${manifest.runtimeVersion}`, + arch: flatpakArch, + bundlePath: path.join(this.outDir, artifactName), + files: [[stageDir, "/"], [appOutDir, path.join("/lib", appIdentifier)], ...(this.options.files || [])], + symlinks: [[path.join("/lib", appIdentifier, executableName), path.join("/bin", executableName)], ...(this.options.symlinks || [])], + }; + return { manifest, buildOptions }; + } +} +exports.default = FlatpakTarget; +const flatpakBuilderDefaults = { + runtime: "org.freedesktop.Platform", + runtimeVersion: "20.08", + sdk: "org.freedesktop.Sdk", + base: "org.electronjs.Electron2.BaseApp", + baseVersion: "20.08", + finishArgs: [ + // Wayland/X11 Rendering + "--socket=wayland", + "--socket=x11", + "--share=ipc", + // Open GL + "--device=dri", + // Audio output + "--socket=pulseaudio", + // Read/write home directory access + "--filesystem=home", + // Allow communication with network + "--share=network", + // System notifications with libnotify + "--talk-name=org.freedesktop.Notifications", + ], +}; +function getElectronWrapperScript(executableName, useWaylandFlags) { + return useWaylandFlags + ? `#!/bin/sh + +export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID" + +if [ "\${XDG_SESSION_TYPE}" == "wayland" ]; then + zypak-wrapper "${executableName}" --enable-features=UseOzonePlatform --ozone-platform=wayland "$@" +else + zypak-wrapper "${executableName}" "$@" +fi +` + : `#!/bin/sh + +export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID" + +zypak-wrapper "${executableName}" "$@" +`; +} +function filterFlatpakAppIdentifier(identifier) { + // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), underscore (_), and period (.) + // Flatpak documentation: https://docs.flatpak.org/en/latest/conventions.html#application-ids + return identifier.replace(/-/g, "_").replace(/[^a-zA-Z0-9._]/g, ""); +} +//# sourceMappingURL=FlatpakTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js.map b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js.map new file mode 100644 index 0000000000..e024117cb9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/FlatpakTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FlatpakTarget.js","sourceRoot":"","sources":["../../src/targets/FlatpakTarget.ts"],"names":[],"mappings":";;AAAA,6DAA8G;AAC9G,+CAAgE;AAChE,uCAA4C;AAC5C,6BAA4B;AAC5B,kCAAgC;AAGhC,6CAA4D;AAE5D,6CAAuD;AAEvD,MAAqB,aAAc,SAAQ,aAAM;IAM/C,YAAY,IAAY,EAAmB,QAAuB,EAAU,MAAyB,EAAW,MAAc;QAC5H,KAAK,CAAC,IAAI,CAAC,CAAA;QAD8B,aAAQ,GAAR,QAAQ,CAAe;QAAU,WAAM,GAAN,MAAM,CAAmB;QAAW,WAAM,GAAN,MAAM,CAAQ;QALrH,YAAO,GAAmB;YACjC,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B;YAC7C,GAAI,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,IAAI,CAAC,IAAI,CAAC;SAC5C,CAAA;IAID,CAAC;IAED,IAAI,KAAK;QACP,OAAO,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,IAAU;QACvC,MAAM,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,aAAa,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;SACpI,CAAA;QAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;IACnC,CAAC;CACF;AAjHD,gCAiHC;AAED,MAAM,sBAAsB,GAA4C;IACtE,OAAO,EAAE,0BAA0B;IACnC,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,qBAAqB;IAC1B,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE;QACV,wBAAwB;QACxB,kBAAkB;QAClB,cAAc;QACd,aAAa;QACb,UAAU;QACV,cAAc;QACd,eAAe;QACf,qBAAqB;QACrB,mCAAmC;QACnC,mBAAmB;QACnB,mCAAmC;QACnC,iBAAiB;QACjB,sCAAsC;QACtC,2CAA2C;KAC5C;CACF,CAAA;AAED,SAAS,wBAAwB,CAAC,cAAsB,EAAE,eAAwB;IAChF,OAAO,eAAe;QACpB,CAAC,CAAC;;;;;qBAKe,cAAc;;qBAEd,cAAc;;CAElC;QACG,CAAC,CAAC;;;;iBAIW,cAAc;CAC9B,CAAA;AACD,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAkB;IACpD,sGAAsG;IACtG,6FAA6F;IAC7F,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;AACrE,CAAC","sourcesContent":["import { bundle as bundleFlatpak, FlatpakBundlerBuildOptions, FlatpakManifest } from \"@malept/flatpak-bundler\"\nimport { Arch, copyFile, toLinuxArchString } from \"builder-util\"\nimport { chmod, outputFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { FlatpakOptions } from \"../options/linuxOptions\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDir, StageDir } from \"./targetUtil\"\n\nexport default class FlatpakTarget extends Target {\n readonly options: FlatpakOptions = {\n ...this.packager.platformSpecificBuildOptions,\n ...(this.packager.config as any)[this.name],\n }\n\n constructor(name: string, private readonly packager: LinuxPackager, private helper: LinuxTargetHelper, readonly outDir: string) {\n super(name)\n }\n\n get appId(): string {\n return filterFlatpakAppIdentifier(this.packager.appInfo.id)\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const { packager, options } = this\n const artifactName = packager.expandArtifactNamePattern(options, \"flatpak\", arch, undefined, false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"flatpak\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await this.prepareStageDir(arch)\n\n const { manifest, buildOptions } = this.getFlatpakBuilderOptions(appOutDir, stageDir.dir, artifactName, arch)\n await bundleFlatpak(manifest, buildOptions)\n\n await stageDir.cleanup()\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"flatpak\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: false,\n })\n }\n\n private async prepareStageDir(arch: Arch): Promise {\n const stageDir = await createStageDir(this, this.packager, arch)\n\n await Promise.all([this.createSandboxBinWrapper(stageDir), this.createDesktopFile(stageDir), this.copyLicenseFile(stageDir), this.copyIcons(stageDir)])\n\n return stageDir\n }\n\n private async createSandboxBinWrapper(stageDir: StageDir) {\n const useWaylandFlags = !!this.options.useWaylandFlags\n const electronWrapperPath = stageDir.getTempFile(path.join(\"bin\", \"electron-wrapper\"))\n await outputFile(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, useWaylandFlags))\n await chmod(electronWrapperPath, 0o755)\n }\n\n private async createDesktopFile(stageDir: StageDir) {\n const appIdentifier = this.appId\n const desktopFile = stageDir.getTempFile(path.join(\"share\", \"applications\", `${appIdentifier}.desktop`))\n await this.helper.writeDesktopEntry(this.options, \"electron-wrapper %U\", desktopFile, { Icon: appIdentifier })\n }\n\n private async copyLicenseFile(stageDir: StageDir) {\n const licenseSrc = await getNotLocalizedLicenseFile(this.options.license, this.packager, [\"txt\", \"html\"])\n if (licenseSrc) {\n const licenseDst = stageDir.getTempFile(path.join(\"share\", \"doc\", this.appId, \"copyright\"))\n await copyFile(licenseSrc, licenseDst)\n }\n }\n\n private async copyIcons(stageDir: StageDir) {\n const icons = await this.helper.icons\n const copyIcons = icons.map(async icon => {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n const iconDst = stageDir.getTempFile(path.join(\"share\", \"icons\", \"hicolor\", sizeName, \"apps\", `${this.appId}${extWithDot}`))\n\n return copyFile(icon.file, iconDst)\n })\n\n await Promise.all(copyIcons)\n }\n\n private getFlatpakBuilderOptions(appOutDir: string, stageDir: string, artifactName: string, arch: Arch): { manifest: FlatpakManifest; buildOptions: FlatpakBundlerBuildOptions } {\n const appIdentifier = this.appId\n const { executableName } = this.packager\n const flatpakArch = toLinuxArchString(arch, \"flatpak\")\n\n const manifest: FlatpakManifest = {\n id: appIdentifier,\n command: \"electron-wrapper\",\n runtime: this.options.runtime || flatpakBuilderDefaults.runtime,\n runtimeVersion: this.options.runtimeVersion || flatpakBuilderDefaults.runtimeVersion,\n sdk: this.options.sdk || flatpakBuilderDefaults.sdk,\n base: this.options.base || flatpakBuilderDefaults.base,\n baseVersion: this.options.baseVersion || flatpakBuilderDefaults.baseVersion,\n finishArgs: this.options.finishArgs || flatpakBuilderDefaults.finishArgs,\n branch: this.options.branch,\n modules: this.options.modules,\n }\n\n const buildOptions: FlatpakBundlerBuildOptions = {\n baseFlatpakref: `app/${manifest.base}/${flatpakArch}/${manifest.baseVersion}`,\n runtimeFlatpakref: `runtime/${manifest.runtime}/${flatpakArch}/${manifest.runtimeVersion}`,\n sdkFlatpakref: `runtime/${manifest.sdk}/${flatpakArch}/${manifest.runtimeVersion}`,\n arch: flatpakArch as any,\n bundlePath: path.join(this.outDir, artifactName),\n files: [[stageDir, \"/\"], [appOutDir, path.join(\"/lib\", appIdentifier)], ...(this.options.files || [])],\n symlinks: [[path.join(\"/lib\", appIdentifier, executableName), path.join(\"/bin\", executableName)], ...(this.options.symlinks || [])],\n }\n\n return { manifest, buildOptions }\n }\n}\n\nconst flatpakBuilderDefaults: Omit = {\n runtime: \"org.freedesktop.Platform\",\n runtimeVersion: \"20.08\",\n sdk: \"org.freedesktop.Sdk\",\n base: \"org.electronjs.Electron2.BaseApp\",\n baseVersion: \"20.08\",\n finishArgs: [\n // Wayland/X11 Rendering\n \"--socket=wayland\",\n \"--socket=x11\",\n \"--share=ipc\",\n // Open GL\n \"--device=dri\",\n // Audio output\n \"--socket=pulseaudio\",\n // Read/write home directory access\n \"--filesystem=home\",\n // Allow communication with network\n \"--share=network\",\n // System notifications with libnotify\n \"--talk-name=org.freedesktop.Notifications\",\n ],\n}\n\nfunction getElectronWrapperScript(executableName: string, useWaylandFlags: boolean): string {\n return useWaylandFlags\n ? `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nif [ \"\\${XDG_SESSION_TYPE}\" == \"wayland\" ]; then\n zypak-wrapper \"${executableName}\" --enable-features=UseOzonePlatform --ozone-platform=wayland \"$@\"\nelse\n zypak-wrapper \"${executableName}\" \"$@\"\nfi\n`\n : `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nzypak-wrapper \"${executableName}\" \"$@\"\n`\n}\n\nfunction filterFlatpakAppIdentifier(identifier: string) {\n // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), underscore (_), and period (.)\n // Flatpak documentation: https://docs.flatpak.org/en/latest/conventions.html#application-ids\n return identifier.replace(/-/g, \"_\").replace(/[^a-zA-Z0-9._]/g, \"\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.d.ts b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.d.ts new file mode 100644 index 0000000000..c3c6533310 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.d.ts @@ -0,0 +1,22 @@ +import { LinuxPackager } from "../linuxPackager"; +import { LinuxTargetSpecificOptions } from "../options/linuxOptions"; +import { IconInfo } from "../platformPackager"; +export declare const installPrefix = "/opt"; +export declare class LinuxTargetHelper { + private packager; + private readonly iconPromise; + private readonly mimeTypeFilesPromise; + maxIconPath: string | null; + constructor(packager: LinuxPackager); + get icons(): Promise>; + get mimeTypeFiles(): Promise; + private computeMimeTypeFiles; + private computeDesktopIcons; + getDescription(options: LinuxTargetSpecificOptions): string; + writeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { + [key: string]: string; + }): Promise; + computeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, extra?: { + [key: string]: string; + }): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js new file mode 100644 index 0000000000..ffcc8bd80d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js @@ -0,0 +1,165 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LinuxTargetHelper = exports.installPrefix = void 0; +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path_1 = require("path"); +exports.installPrefix = "/opt"; +class LinuxTargetHelper { + constructor(packager) { + this.packager = packager; + this.iconPromise = new lazy_val_1.Lazy(() => this.computeDesktopIcons()); + this.mimeTypeFilesPromise = new lazy_val_1.Lazy(() => this.computeMimeTypeFiles()); + this.maxIconPath = null; + } + get icons() { + return this.iconPromise.value; + } + get mimeTypeFiles() { + return this.mimeTypeFilesPromise.value; + } + async computeMimeTypeFiles() { + const items = []; + for (const fileAssociation of this.packager.fileAssociations) { + if (!fileAssociation.mimeType) { + continue; + } + const data = ` + + ${fileAssociation.description ? `${fileAssociation.description}` : ""} + +`; + items.push(data); + } + if (items.length === 0) { + return null; + } + const file = await this.packager.getTempFile(".xml"); + await fs_extra_1.outputFile(file, '\n\n' + items.join("\n") + "\n"); + return file; + } + // must be name without spaces and other special characters, but not product name used + async computeDesktopIcons() { + var _a, _b, _c; + const packager = this.packager; + const { platformSpecificBuildOptions, config } = packager; + const sources = [platformSpecificBuildOptions.icon, (_b = (_a = config.mac) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : config.icon].filter(str => !!str); + // If no explicit sources are defined, fallback to buildResources directory, then default framework icon + let fallbackSources = [...builder_util_1.asArray(packager.getDefaultFrameworkIcon())]; + const buildResources = (_c = config.directories) === null || _c === void 0 ? void 0 : _c.buildResources; + if (buildResources && (await builder_util_1.exists(path_1.join(buildResources, "icons")))) { + fallbackSources = [buildResources, ...fallbackSources]; + } + // need to put here and not as default because need to resolve image size + const result = await packager.resolveIcon(sources, fallbackSources, "set"); + this.maxIconPath = result[result.length - 1].file; + return result; + } + getDescription(options) { + return options.description || this.packager.appInfo.description; + } + async writeDesktopEntry(targetSpecificOptions, exec, destination, extra) { + const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra); + const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`)); + await fs_extra_1.outputFile(file, data); + return file; + } + computeDesktopEntry(targetSpecificOptions, exec, extra) { + if (exec != null && exec.length === 0) { + throw new Error("Specified exec is empty"); + } + // https://github.com/electron-userland/electron-builder/issues/3418 + if (targetSpecificOptions.desktop != null && targetSpecificOptions.desktop.Exec != null) { + throw new Error("Please specify executable name as linux.executableName instead of linux.desktop.Exec"); + } + const packager = this.packager; + const appInfo = packager.appInfo; + const executableArgs = targetSpecificOptions.executableArgs; + if (exec == null) { + exec = `${exports.installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`; + if (!/^[/0-9A-Za-z._-]+$/.test(exec)) { + exec = `"${exec}"`; + } + if (executableArgs) { + exec += " "; + exec += executableArgs.join(" "); + } + // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables + const execCodes = ["%f", "%u", "%F", "%U"]; + if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) { + exec += " %U"; + } + } + const desktopMeta = { + Name: appInfo.productName, + Exec: exec, + Terminal: "false", + Type: "Application", + Icon: packager.executableName, + // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file + // must be set to package.json name (because it is Electron set WM_CLASS) + // to get WM_CLASS of running window: xprop WM_CLASS + // StartupWMClass doesn't work for unicode + // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226 + StartupWMClass: appInfo.productName, + ...extra, + ...targetSpecificOptions.desktop, + }; + const description = this.getDescription(targetSpecificOptions); + if (!builder_util_1.isEmptyOrSpaces(description)) { + desktopMeta.Comment = description; + } + const mimeTypes = builder_util_1.asArray(targetSpecificOptions.mimeTypes); + for (const fileAssociation of packager.fileAssociations) { + if (fileAssociation.mimeType != null) { + mimeTypes.push(fileAssociation.mimeType); + } + } + for (const protocol of builder_util_1.asArray(packager.config.protocols).concat(builder_util_1.asArray(packager.platformSpecificBuildOptions.protocols))) { + for (const scheme of builder_util_1.asArray(protocol.schemes)) { + mimeTypes.push(`x-scheme-handler/${scheme}`); + } + } + if (mimeTypes.length !== 0) { + desktopMeta.MimeType = mimeTypes.join(";") + ";"; + } + let category = targetSpecificOptions.category; + if (builder_util_1.isEmptyOrSpaces(category)) { + const macCategory = (packager.config.mac || {}).category; + if (macCategory != null) { + category = macToLinuxCategory[macCategory]; + } + if (category == null) { + // https://github.com/develar/onshape-desktop-shell/issues/48 + if (macCategory != null) { + builder_util_1.log.warn({ macCategory }, "cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it."); + } + builder_util_1.log.warn({ + reason: "linux.category is not set and cannot map from macOS", + docs: "https://www.electron.build/configuration/linux", + }, 'application Linux category is set to default "Utility"'); + category = "Utility"; + } + } + desktopMeta.Categories = `${category}${category.endsWith(";") ? "" : ";"}`; + let data = `[Desktop Entry]`; + for (const name of Object.keys(desktopMeta)) { + data += `\n${name}=${desktopMeta[name]}`; + } + data += "\n"; + return Promise.resolve(data); + } +} +exports.LinuxTargetHelper = LinuxTargetHelper; +const macToLinuxCategory = { + "public.app-category.graphics-design": "Graphics", + "public.app-category.developer-tools": "Development", + "public.app-category.education": "Education", + "public.app-category.games": "Game", + "public.app-category.video": "Video;AudioVideo", + "public.app-category.utilities": "Utility", + "public.app-category.social-networking": "Network;Chat", + "public.app-category.finance": "Office;Finance", +}; +//# sourceMappingURL=LinuxTargetHelper.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js.map b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js.map new file mode 100644 index 0000000000..b765d4957b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LinuxTargetHelper.js","sourceRoot":"","sources":["../../src/targets/LinuxTargetHelper.ts"],"names":[],"mappings":";;;AAAA,+CAAoE;AACpE,uCAAqC;AACrC,uCAA+B;AAI/B,+BAA2B;AAEd,QAAA,aAAa,GAAG,MAAM,CAAA;AAEnC,MAAa,iBAAiB;IAO5B,YAAoB,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;QAN1B,gBAAW,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAA;QAExD,yBAAoB,GAAG,IAAI,eAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAA;QAEnF,gBAAW,GAAkB,IAAI,CAAA;IAEa,CA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ptyOrSpaces, log, exists } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { IconInfo } from \"../platformPackager\"\nimport { join } from \"path\"\n\nexport const installPrefix = \"/opt\"\n\nexport class LinuxTargetHelper {\n private readonly iconPromise = new Lazy(() => this.computeDesktopIcons())\n\n private readonly mimeTypeFilesPromise = new Lazy(() => this.computeMimeTypeFiles())\n\n maxIconPath: string | null = null\n\n constructor(private packager: LinuxPackager) {}\n\n get icons(): Promise> {\n return this.iconPromise.value\n }\n\n get mimeTypeFiles(): Promise {\n return this.mimeTypeFilesPromise.value\n }\n\n private async computeMimeTypeFiles(): Promise {\n const items: Array = []\n for (const fileAssociation of this.packager.fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n const data = `\n \n ${fileAssociation.description ? `${fileAssociation.description}` : \"\"}\n \n`\n items.push(data)\n }\n\n if (items.length === 0) {\n return null\n }\n\n const file = await this.packager.getTempFile(\".xml\")\n await outputFile(\n file,\n '\\n\\n' + items.join(\"\\n\") + \"\\n\"\n )\n return file\n }\n\n // must be name without spaces and other special characters, but not product name used\n private async computeDesktopIcons(): Promise> {\n const packager = this.packager\n const { platformSpecificBuildOptions, config } = packager\n\n const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]\n\n // If no explicit sources are defined, fallback to buildResources directory, then default framework icon\n let fallbackSources = [...asArray(packager.getDefaultFrameworkIcon())]\n const buildResources = config.directories?.buildResources\n if (buildResources && (await exists(join(buildResources, \"icons\")))) {\n fallbackSources = [buildResources, ...fallbackSources]\n }\n\n // need to put here and not as default because need to resolve image size\n const result = await packager.resolveIcon(sources, fallbackSources, \"set\")\n this.maxIconPath = result[result.length - 1].file\n return result\n }\n\n getDescription(options: LinuxTargetSpecificOptions) {\n return options.description || this.packager.appInfo.description\n }\n\n async writeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string }): Promise {\n const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)\n const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))\n await outputFile(file, data)\n return file\n }\n\n computeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, extra?: { [key: string]: string }): Promise {\n if (exec != null && exec.length === 0) {\n throw new Error(\"Specified exec is empty\")\n }\n // https://github.com/electron-userland/electron-builder/issues/3418\n if (targetSpecificOptions.desktop != null && targetSpecificOptions.desktop.Exec != null) {\n throw new Error(\"Please specify executable name as linux.executableName instead of linux.desktop.Exec\")\n }\n\n const packager = this.packager\n const appInfo = packager.appInfo\n\n const executableArgs = targetSpecificOptions.executableArgs\n if (exec == null) {\n exec = `${installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`\n if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {\n exec = `\"${exec}\"`\n }\n if (executableArgs) {\n exec += \" \"\n exec += executableArgs.join(\" \")\n }\n // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n const execCodes = [\"%f\", \"%u\", \"%F\", \"%U\"]\n if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) {\n exec += \" %U\"\n }\n }\n\n const desktopMeta: any = {\n Name: appInfo.productName,\n Exec: exec,\n Terminal: \"false\",\n Type: \"Application\",\n Icon: packager.executableName,\n // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file\n // must be set to package.json name (because it is Electron set WM_CLASS)\n // to get WM_CLASS of running window: xprop WM_CLASS\n // StartupWMClass doesn't work for unicode\n // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226\n StartupWMClass: appInfo.productName,\n ...extra,\n ...targetSpecificOptions.desktop,\n }\n\n const description = this.getDescription(targetSpecificOptions)\n if (!isEmptyOrSpaces(description)) {\n desktopMeta.Comment = description\n }\n\n const mimeTypes: Array = asArray(targetSpecificOptions.mimeTypes)\n for (const fileAssociation of packager.fileAssociations) {\n if (fileAssociation.mimeType != null) {\n mimeTypes.push(fileAssociation.mimeType)\n }\n }\n\n for (const protocol of asArray(packager.config.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))) {\n for (const scheme of asArray(protocol.schemes)) {\n mimeTypes.push(`x-scheme-handler/${scheme}`)\n }\n }\n\n if (mimeTypes.length !== 0) {\n desktopMeta.MimeType = mimeTypes.join(\";\") + \";\"\n }\n\n let category = targetSpecificOptions.category\n if (isEmptyOrSpaces(category)) {\n const macCategory = (packager.config.mac || {}).category\n if (macCategory != null) {\n category = macToLinuxCategory[macCategory]\n }\n\n if (category == null) {\n // https://github.com/develar/onshape-desktop-shell/issues/48\n if (macCategory != null) {\n log.warn({ macCategory }, \"cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it.\")\n }\n log.warn(\n {\n reason: \"linux.category is not set and cannot map from macOS\",\n docs: \"https://www.electron.build/configuration/linux\",\n },\n 'application Linux category is set to default \"Utility\"'\n )\n category = \"Utility\"\n }\n }\n desktopMeta.Categories = `${category}${category.endsWith(\";\") ? \"\" : \";\"}`\n\n let data = `[Desktop Entry]`\n for (const name of Object.keys(desktopMeta)) {\n data += `\\n${name}=${desktopMeta[name]}`\n }\n data += \"\\n\"\n return Promise.resolve(data)\n }\n}\n\nconst macToLinuxCategory: any = {\n \"public.app-category.graphics-design\": \"Graphics\",\n \"public.app-category.developer-tools\": \"Development\",\n \"public.app-category.education\": \"Education\",\n \"public.app-category.games\": \"Game\",\n \"public.app-category.video\": \"Video;AudioVideo\",\n \"public.app-category.utilities\": \"Utility\",\n \"public.app-category.social-networking\": \"Network;Chat\",\n \"public.app-category.finance\": \"Office;Finance\",\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/MsiTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/MsiTarget.d.ts new file mode 100644 index 0000000000..da2218394f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/MsiTarget.d.ts @@ -0,0 +1,22 @@ +import { Arch } from "builder-util"; +import { MsiOptions } from "../"; +import { Target } from "../core"; +import { WinPackager } from "../winPackager"; +export default class MsiTarget extends Target { + private readonly packager; + readonly outDir: string; + private readonly vm; + readonly options: MsiOptions; + constructor(packager: WinPackager, outDir: string); + /** + * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier). + */ + private get productMsiIdPrefix(); + private get iconId(); + private get upgradeCode(); + build(appOutDir: string, arch: Arch): Promise; + private light; + private getCommonWixArgs; + private writeManifest; + private computeFileDeclaration; +} diff --git a/client/node_modules/app-builder-lib/out/targets/MsiTarget.js b/client/node_modules/app-builder-lib/out/targets/MsiTarget.js new file mode 100644 index 0000000000..6ea082a309 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/MsiTarget.js @@ -0,0 +1,246 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const binDownload_1 = require("../binDownload"); +const fs_1 = require("builder-util/out/fs"); +const crypto_1 = require("crypto"); +const ejs = require("ejs"); +const promises_1 = require("fs/promises"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const core_1 = require("../core"); +const CommonWindowsInstallerConfiguration_1 = require("../options/CommonWindowsInstallerConfiguration"); +const platformPackager_1 = require("../platformPackager"); +const pathManager_1 = require("../util/pathManager"); +const vm_1 = require("../vm/vm"); +const WineVm_1 = require("../vm/WineVm"); +const targetUtil_1 = require("./targetUtil"); +const ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = builder_util_runtime_1.UUID.parse("d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc"); +const ROOT_DIR_ID = "APPLICATIONFOLDER"; +const projectTemplate = new lazy_val_1.Lazy(async () => { + const template = (await promises_1.readFile(path.join(pathManager_1.getTemplatePath("msi"), "template.xml"), "utf8")) + .replace(/{{/g, "<%") + .replace(/}}/g, "%>") + .replace(/\${([^}]+)}/g, "<%=$1%>"); + return ejs.compile(template); +}); +// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine) +class MsiTarget extends core_1.Target { + constructor(packager, outDir) { + super("msi"); + this.packager = packager; + this.outDir = outDir; + this.vm = process.platform === "win32" ? new vm_1.VmManager() : new WineVm_1.WineVmManager(); + this.options = builder_util_1.deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi); + } + /** + * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier). + */ + get productMsiIdPrefix() { + const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\w.]/g, "").replace(/^[^A-Za-z_]+/, ""); + return sanitizedId.length > 0 ? sanitizedId : "App" + this.upgradeCode.replace(/-/g, ""); + } + get iconId() { + return `${this.productMsiIdPrefix}Icon.exe`; + } + get upgradeCode() { + return (this.options.upgradeCode || builder_util_runtime_1.UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase(); + } + async build(appOutDir, arch) { + const packager = this.packager; + const artifactName = packager.expandArtifactBeautyNamePattern(this.options, "msi", arch); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "MSI", + file: artifactPath, + arch, + }); + const stageDir = await targetUtil_1.createStageDir(this, packager, arch); + const vm = this.vm; + const commonOptions = CommonWindowsInstallerConfiguration_1.getEffectiveOptions(this.options, this.packager); + const projectFile = stageDir.getTempFile("project.wxs"); + const objectFiles = ["project.wixobj"]; + await promises_1.writeFile(projectFile, await this.writeManifest(appOutDir, arch, commonOptions)); + await packager.info.callMsiProjectCreated(projectFile); + // noinspection SpellCheckingInspection + const vendorPath = await binDownload_1.getBinFromUrl("wix", "4.0.0.5512.2", "/X5poahdCc3199Vt6AP7gluTlT1nxi9cbbHhZhCMEu+ngyP1LiBMn+oZX7QAZVaKeBMc2SjVp7fJqNLqsUnPNQ=="); + // noinspection SpellCheckingInspection + const candleArgs = ["-arch", arch === builder_util_1.Arch.ia32 ? "x86" : arch === builder_util_1.Arch.arm64 ? "arm64" : "x64", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs()); + candleArgs.push("project.wxs"); + await vm.exec(vm.toVmFile(path.join(vendorPath, "candle.exe")), candleArgs, { + cwd: stageDir.dir, + }); + await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir); + await stageDir.cleanup(); + await packager.sign(artifactPath); + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + packager, + arch, + safeArtifactName: packager.computeSafeArtifactName(artifactName, "msi"), + target: this, + isWriteUpdateInfo: false, + }); + } + async light(objectFiles, vm, artifactPath, appOutDir, vendorPath, tempDir) { + // noinspection SpellCheckingInspection + const lightArgs = [ + "-out", + vm.toVmFile(artifactPath), + "-v", + // https://github.com/wixtoolset/issues/issues/5169 + "-spdb", + // https://sourceforge.net/p/wix/bugs/2405/ + // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42) + "-sw1076", + `-dappDir=${vm.toVmFile(appOutDir)}`, + // "-dcl:high", + ].concat(this.getCommonWixArgs()); + // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html + if (process.platform !== "win32") { + // noinspection SpellCheckingInspection + lightArgs.push("-sval"); + } + if (this.options.oneClick === false) { + lightArgs.push("-ext", "WixUIExtension"); + } + // objectFiles - only filenames, we set current directory to our temp stage dir + lightArgs.push(...objectFiles); + await vm.exec(vm.toVmFile(path.join(vendorPath, "light.exe")), lightArgs, { + cwd: tempDir, + }); + } + getCommonWixArgs() { + const args = ["-pedantic"]; + if (this.options.warningsAsErrors !== false) { + args.push("-wx"); + } + if (this.options.additionalWixArgs != null) { + args.push(...this.options.additionalWixArgs); + } + return args; + } + async writeManifest(appOutDir, arch, commonOptions) { + const appInfo = this.packager.appInfo; + const { files, dirs } = await this.computeFileDeclaration(appOutDir); + const companyName = appInfo.companyName; + if (!companyName) { + builder_util_1.log.warn(`Manufacturer is not set for MSI — please set "author" in the package.json`); + } + const compression = this.packager.compression; + const options = this.options; + const iconPath = await this.packager.getIconPath(); + return (await projectTemplate.value)({ + ...commonOptions, + isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== CommonWindowsInstallerConfiguration_1.DesktopShortcutCreationPolicy.NEVER, + isRunAfterFinish: options.runAfterFinish !== false, + iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath), + iconId: this.iconId, + compressionLevel: compression === "store" ? "none" : "high", + version: appInfo.getVersionInWeirdWindowsForm(), + productName: appInfo.productName, + upgradeCode: this.upgradeCode, + manufacturer: companyName || appInfo.productName, + appDescription: appInfo.description, + // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory + programFilesId: arch === builder_util_1.Arch.x64 ? "ProgramFiles64Folder" : "ProgramFilesFolder", + // wix in the name because special wix format can be used in the name + installationDirectoryWixName: targetUtil_1.getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true), + dirs, + files, + }); + } + async computeFileDeclaration(appOutDir) { + const appInfo = this.packager.appInfo; + let isRootDirAddedToRemoveTable = false; + const dirNames = new Set(); + const dirs = []; + const fileSpace = " ".repeat(6); + const commonOptions = CommonWindowsInstallerConfiguration_1.getEffectiveOptions(this.options, this.packager); + const files = await bluebird_lst_1.default.map(fs_1.walk(appOutDir), file => { + const packagePath = file.substring(appOutDir.length + 1); + const lastSlash = packagePath.lastIndexOf(path.sep); + const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath; + let directoryId = null; + let dirName = ""; + // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion + if (lastSlash > 0) { + // This Name attribute may also define multiple directories using the inline directory syntax. + // For example, "ProgramFilesFolder:\My Company\My Product\bin" would create a reference to a Directory element with Id="ProgramFilesFolder" then create directories named "My Company" then "My Product" then "bin" nested beneath each other. + // This syntax is a shortcut to defining each directory in an individual Directory element. + dirName = packagePath.substring(0, lastSlash); + // https://github.com/electron-userland/electron-builder/issues/3027 + directoryId = "d" + crypto_1.createHash("md5").update(dirName).digest("base64").replace(/\//g, "_").replace(/\+/g, ".").replace(/=+$/, ""); + if (!dirNames.has(dirName)) { + dirNames.add(dirName); + dirs.push(``); + } + } + else if (!isRootDirAddedToRemoveTable) { + isRootDirAddedToRemoveTable = true; + } + // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid + // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix + let result = ``; + result += `\n${fileSpace} \n`; + const shortcutName = commonOptions.shortcutName; + if (isCreateDesktopShortcut) { + result += `${fileSpace} \n`; + } + const hasMenuCategory = commonOptions.menuCategory != null; + const startMenuShortcutDirectoryId = hasMenuCategory ? "AppProgramMenuDir" : "ProgramMenuFolder"; + if (commonOptions.isCreateStartMenuShortcut) { + if (hasMenuCategory) { + dirs.push(``); + } + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + } + result += `${fileSpace}`; + if (hasMenuCategory) { + result += `\n`; + } + } + else { + result += `/>`; + } + const fileAssociations = this.packager.fileAssociations; + if (isMainExecutable && fileAssociations.length !== 0) { + for (const item of fileAssociations) { + const extensions = builder_util_1.asArray(item.ext).map(platformPackager_1.normalizeExt); + for (const ext of extensions) { + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + result += `${fileSpace} \n`; + } + } + } + return `${result}\n${fileSpace}`; + }); + return { dirs: listToString(dirs, 2), files: listToString(files, 3) }; + } +} +exports.default = MsiTarget; +function listToString(list, indentLevel) { + const space = " ".repeat(indentLevel * 2); + return list.join(`\n${space}`); +} +function xmlAttr(str) { + return str.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); +} +//# sourceMappingURL=MsiTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/MsiTarget.js.map b/client/node_modules/app-builder-lib/out/targets/MsiTarget.js.map new file mode 100644 index 0000000000..08ce490e31 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/MsiTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAA0C;AAC1C,+CAA6D;AAC7D,+DAA2C;AAC3C,gDAA8C;AAC9C,4CAA0C;AAC1C,mCAAmC;AACnC,2BAA0B;AAC1B,0CAAiD;AACjD,uCAA+B;AAC/B,6BAA4B;AAE5B,kCAAgC;AAChC,wGAAuJ;AACvJ,0DAAkD;AAClD,qDAAqD;AACrD,iCAAoC;AACpC,yCAA4C;AAE5C,6CAA4E;AAE5E,MAAM,qCAAqC,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAChG,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,MAAM,eAAe,GAAG,IAAI,eAAI,CAAwB,KAAK,IAAI,EAAE;IACjE,MAAM,QAAQ,GAAG,CAAC,MAAM,mBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,6BAAe,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;SACzF,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC9B,CAAC,CAAC,CAAA;AAEF,mHAAmH;AACnH,MAAqB,SAAU,SAAQ,aA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MAAM,IAAI,GAAG,SAAS,sBAAsB,GAAG,sBAAsB,CAAA;wBACrE,MAAM,IAAI,GAAG,SAAS,4CAA4C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,iCAAiC,CAAA;wBAC7I,MAAM,IAAI,GAAG,SAAS,oBAAoB,CAAA;wBAC1C,MAAM,IAAI,GAAG,SAAS,eAAe,CAAA;qBACtC;iBACF;aACF;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAjPD,4BAiPC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, log, deepAssign } from \"builder-util\"\nimport { UUID } from \"builder-util-runtime\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { walk } from \"builder-util/out/fs\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\nconst projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(\"msi\"), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n})\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n private readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager()\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(private readonly packager: WinPackager, readonly outDir: string) {\n super(\"msi\")\n }\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n private get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n private get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, arch, commonOptions))\n\n await packager.info.callMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix\", \"4.0.0.5512.2\", \"/X5poahdCc3199Vt6AP7gluTlT1nxi9cbbHhZhCMEu+ngyP1LiBMn+oZX7QAZVaKeBMc2SjVp7fJqNLqsUnPNQ==\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", arch === Arch.ia32 ? \"x86\" : arch === Arch.arm64 ? \"arm64\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n\n await stageDir.cleanup()\n\n await packager.sign(artifactPath)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ].concat(this.getCommonWixArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getCommonWixArgs() {\n const args: Array = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n private async writeManifest(appOutDir: string, arch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n const compression = this.packager.compression\n const options = this.options\n const iconPath = await this.packager.getIconPath()\n return (await projectTemplate.value)({\n ...commonOptions,\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: arch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set()\n const dirs: Array = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = await BluebirdPromise.map(walk(appOutDir), file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(``)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = ``\n result += `\\n${fileSpace} \\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} \\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(``)\n }\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n }\n result += `${fileSpace}`\n\n if (hasMenuCategory) {\n result += `\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n result += `${fileSpace} \\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \"&\").replace(//g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/archive.d.ts b/client/node_modules/app-builder-lib/out/targets/archive.d.ts new file mode 100644 index 0000000000..9703df110a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/archive.d.ts @@ -0,0 +1,21 @@ +import { CompressionLevel } from "../core"; +export interface ArchiveOptions { + compression?: CompressionLevel | null; + /** + * @default false + */ + withoutDir?: boolean; + /** + * @default true + */ + solid?: boolean; + /** + * @default true + */ + isArchiveHeaderCompressed?: boolean; + dictSize?: number; + excluded?: Array | null; + method?: "Copy" | "LZMA" | "Deflate" | "DEFAULT"; + isRegularFile?: boolean; +} +export declare function compute7zCompressArgs(format: string, options?: ArchiveOptions): string[]; diff --git a/client/node_modules/app-builder-lib/out/targets/archive.js b/client/node_modules/app-builder-lib/out/targets/archive.js new file mode 100644 index 0000000000..7726d502cb --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/archive.js @@ -0,0 +1,146 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.archive = exports.compute7zCompressArgs = exports.tar = void 0; +const _7zip_bin_1 = require("7zip-bin"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const tar_1 = require("tar"); +const tools_1 = require("./tools"); +/** @internal */ +async function tar(compression, format, outFile, dirToArchive, isMacApp, tempDirManager) { + const tarFile = await tempDirManager.getTempFile({ suffix: ".tar" }); + const tarArgs = { + file: tarFile, + portable: true, + cwd: dirToArchive, + prefix: path.basename(outFile, `.${format}`), + }; + let tarDirectory = "."; + if (isMacApp) { + delete tarArgs.prefix; + tarArgs.cwd = path.dirname(dirToArchive); + tarDirectory = path.basename(dirToArchive); + } + await Promise.all([ + tar_1.create(tarArgs, [tarDirectory]), + // remove file before - 7z doesn't overwrite file, but update + fs_1.unlinkIfExists(outFile), + ]); + if (format === "tar.lz") { + // noinspection SpellCheckingInspection + let lzipPath = "lzip"; + if (process.platform === "darwin") { + lzipPath = path.join(await tools_1.getLinuxToolsPath(), "bin", lzipPath); + } + await builder_util_1.exec(lzipPath, [compression === "store" ? "-1" : "-9", "--keep" /* keep (don't delete) input files */, tarFile]); + // bloody lzip creates file in the same dir where input file with postfix `.lz`, option --output doesn't work + await fs_extra_1.move(`${tarFile}.lz`, outFile); + return; + } + const args = compute7zCompressArgs(format === "tar.xz" ? "xz" : format === "tar.bz2" ? "bzip2" : "gzip", { + isRegularFile: true, + method: "DEFAULT", + compression, + }); + args.push(outFile, tarFile); + await builder_util_1.exec(_7zip_bin_1.path7za, args, { + cwd: path.dirname(dirToArchive), + }, builder_util_1.debug7z.enabled); +} +exports.tar = tar; +function compute7zCompressArgs(format, options = {}) { + let storeOnly = options.compression === "store"; + const args = debug7zArgs("a"); + let isLevelSet = false; + if (process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL != null) { + storeOnly = false; + args.push(`-mx=${process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL}`); + isLevelSet = true; + } + const isZip = format === "zip"; + if (!storeOnly) { + if (isZip && options.compression === "maximum") { + // http://superuser.com/a/742034 + args.push("-mfb=258", "-mpass=15"); + } + if (!isLevelSet) { + // https://github.com/electron-userland/electron-builder/pull/3032 + args.push("-mx=" + (!isZip || options.compression === "maximum" ? "9" : "7")); + } + } + if (options.dictSize != null) { + args.push(`-md=${options.dictSize}m`); + } + // https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm#7Z + // https://stackoverflow.com/questions/27136783/7zip-produces-different-output-from-identical-input + // tc and ta are off by default, but to be sure, we explicitly set it to off + // disable "Stores NTFS timestamps for files: Modification time, Creation time, Last access time." to produce the same archive for the same data + if (!options.isRegularFile) { + args.push("-mtc=off"); + } + if (format === "7z" || format.endsWith(".7z")) { + if (options.solid === false) { + args.push("-ms=off"); + } + if (options.isArchiveHeaderCompressed === false) { + args.push("-mhc=off"); + } + // args valid only for 7z + // -mtm=off disable "Stores last Modified timestamps for files." + args.push("-mtm=off", "-mta=off"); + } + if (options.method != null) { + if (options.method !== "DEFAULT") { + args.push(`-mm=${options.method}`); + } + } + else if (isZip || storeOnly) { + args.push(`-mm=${storeOnly ? "Copy" : "Deflate"}`); + } + if (isZip) { + // -mcu switch: 7-Zip uses UTF-8, if there are non-ASCII symbols. + // because default mode: 7-Zip uses UTF-8, if the local code page doesn't contain required symbols. + // but archive should be the same regardless where produced + args.push("-mcu"); + } + return args; +} +exports.compute7zCompressArgs = compute7zCompressArgs; +// 7z is very fast, so, use ultra compression +/** @internal */ +async function archive(format, outFile, dirToArchive, options = {}) { + const args = compute7zCompressArgs(format, options); + // remove file before - 7z doesn't overwrite file, but update + await fs_1.unlinkIfExists(outFile); + args.push(outFile, options.withoutDir ? "." : path.basename(dirToArchive)); + if (options.excluded != null) { + for (const mask of options.excluded) { + args.push(`-xr!${mask}`); + } + } + try { + await builder_util_1.exec(_7zip_bin_1.path7za, args, { + cwd: options.withoutDir ? dirToArchive : path.dirname(dirToArchive), + }, builder_util_1.debug7z.enabled); + } + catch (e) { + if (e.code === "ENOENT" && !(await fs_1.exists(dirToArchive))) { + throw new Error(`Cannot create archive: "${dirToArchive}" doesn't exist`); + } + else { + throw e; + } + } + return outFile; +} +exports.archive = archive; +function debug7zArgs(command) { + const args = [command, "-bd"]; + if (builder_util_1.debug7z.enabled) { + args.push("-bb"); + } + return args; +} +//# sourceMappingURL=archive.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/archive.js.map b/client/node_modules/app-builder-lib/out/targets/archive.js.map new file mode 100644 index 0000000000..dd9c3ef592 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/archive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/targets/archive.ts"],"names":[],"mappings":";;;AAAA,wCAAkC;AAClC,+CAA4C;AAC5C,4CAA4D;AAC5D,uCAA+B;AAC/B,6BAA4B;AAC5B,6BAAwD;AAGxD,mCAA2C;AAE3C,gBAAgB;AACT,KAAK,UAAU,GAAG,CACvB,WAAyC,EACzC,MAAc,EACd,OAAe,EACf,YAAoB,EACpB,QAAiB,EACjB,cAAsB;IAEtB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACpE,MAAM,OAAO,GAAgC;QAC3C,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,YAAY;QACjB,MAAM,EAAE,IA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CAAC,OAAO,CAAC,CAAA;IAE7B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAA;IAC1E,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;QAC5B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;SACzB;KACF;IAED,IAAI;QACF,MAAM,mBAAI,CACR,mBAAO,EACP,IAAI,EACJ;YACE,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;SACpE,EACD,sBAAO,CAAC,OAAO,CAChB,CAAA;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,WAAM,CAAC,YAAY,CAAC,CAAC,EAAE;YACxD,MAAM,IAAI,KAAK,CAAC,2BAA2B,YAAY,iBAAiB,CAAC,CAAA;SAC1E;aAAM;YACL,MAAM,CAAC,CAAA;SACR;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AA9BD,0BA8BC;AAED,SAAS,WAAW,CAAC,OAAkB;IACrC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC7B,IAAI,sBAAO,CAAC,OAAO,EAAE;QACnB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;KACjB;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport { debug7z, exec } from \"builder-util\"\nimport { exists, unlinkIfExists } from \"builder-util/out/fs\"\nimport { move } from \"fs-extra\"\nimport * as path from \"path\"\nimport { create, CreateOptions, FileOptions } from \"tar\"\nimport { TmpDir } from \"temp-file\"\nimport { CompressionLevel } from \"../core\"\nimport { getLinuxToolsPath } from \"./tools\"\n\n/** @internal */\nexport async function tar(\n compression: CompressionLevel | any | any,\n format: string,\n outFile: string,\n dirToArchive: string,\n isMacApp: boolean,\n tempDirManager: TmpDir\n): Promise {\n const tarFile = await tempDirManager.getTempFile({ suffix: \".tar\" })\n const tarArgs: CreateOptions & FileOptions = {\n file: tarFile,\n portable: true,\n cwd: dirToArchive,\n prefix: path.basename(outFile, `.${format}`),\n }\n let tarDirectory = \".\"\n if (isMacApp) {\n delete tarArgs.prefix\n tarArgs.cwd = path.dirname(dirToArchive)\n tarDirectory = path.basename(dirToArchive)\n }\n\n await Promise.all([\n create(tarArgs, [tarDirectory]),\n // remove file before - 7z doesn't overwrite file, but update\n unlinkIfExists(outFile),\n ])\n\n if (format === \"tar.lz\") {\n // noinspection SpellCheckingInspection\n let lzipPath = \"lzip\"\n if (process.platform === \"darwin\") {\n lzipPath = path.join(await getLinuxToolsPath(), \"bin\", lzipPath)\n }\n await exec(lzipPath, [compression === \"store\" ? \"-1\" : \"-9\", \"--keep\" /* keep (don't delete) input files */, tarFile])\n // bloody lzip creates file in the same dir where input file with postfix `.lz`, option --output doesn't work\n await move(`${tarFile}.lz`, outFile)\n return\n }\n\n const args = compute7zCompressArgs(format === \"tar.xz\" ? \"xz\" : format === \"tar.bz2\" ? \"bzip2\" : \"gzip\", {\n isRegularFile: true,\n method: \"DEFAULT\",\n compression,\n })\n args.push(outFile, tarFile)\n await exec(\n path7za,\n args,\n {\n cwd: path.dirname(dirToArchive),\n },\n debug7z.enabled\n )\n}\n\nexport interface ArchiveOptions {\n compression?: CompressionLevel | null\n\n /**\n * @default false\n */\n withoutDir?: boolean\n\n /**\n * @default true\n */\n solid?: boolean\n\n /**\n * @default true\n */\n isArchiveHeaderCompressed?: boolean\n\n dictSize?: number\n excluded?: Array | null\n\n // DEFAULT allows to disable custom logic and do not pass method switch at all\n method?: \"Copy\" | \"LZMA\" | \"Deflate\" | \"DEFAULT\"\n\n isRegularFile?: boolean\n}\n\nexport function compute7zCompressArgs(format: string, options: ArchiveOptions = {}) {\n let storeOnly = options.compression === \"store\"\n const args = debug7zArgs(\"a\")\n\n let isLevelSet = false\n if (process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL != null) {\n storeOnly = false\n args.push(`-mx=${process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL}`)\n isLevelSet = true\n }\n\n const isZip = format === \"zip\"\n if (!storeOnly) {\n if (isZip && options.compression === \"maximum\") {\n // http://superuser.com/a/742034\n args.push(\"-mfb=258\", \"-mpass=15\")\n }\n\n if (!isLevelSet) {\n // https://github.com/electron-userland/electron-builder/pull/3032\n args.push(\"-mx=\" + (!isZip || options.compression === \"maximum\" ? \"9\" : \"7\"))\n }\n }\n\n if (options.dictSize != null) {\n args.push(`-md=${options.dictSize}m`)\n }\n\n // https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm#7Z\n // https://stackoverflow.com/questions/27136783/7zip-produces-different-output-from-identical-input\n // tc and ta are off by default, but to be sure, we explicitly set it to off\n // disable \"Stores NTFS timestamps for files: Modification time, Creation time, Last access time.\" to produce the same archive for the same data\n if (!options.isRegularFile) {\n args.push(\"-mtc=off\")\n }\n\n if (format === \"7z\" || format.endsWith(\".7z\")) {\n if (options.solid === false) {\n args.push(\"-ms=off\")\n }\n\n if (options.isArchiveHeaderCompressed === false) {\n args.push(\"-mhc=off\")\n }\n\n // args valid only for 7z\n // -mtm=off disable \"Stores last Modified timestamps for files.\"\n args.push(\"-mtm=off\", \"-mta=off\")\n }\n\n if (options.method != null) {\n if (options.method !== \"DEFAULT\") {\n args.push(`-mm=${options.method}`)\n }\n } else if (isZip || storeOnly) {\n args.push(`-mm=${storeOnly ? \"Copy\" : \"Deflate\"}`)\n }\n\n if (isZip) {\n // -mcu switch: 7-Zip uses UTF-8, if there are non-ASCII symbols.\n // because default mode: 7-Zip uses UTF-8, if the local code page doesn't contain required symbols.\n // but archive should be the same regardless where produced\n args.push(\"-mcu\")\n }\n return args\n}\n\n// 7z is very fast, so, use ultra compression\n/** @internal */\nexport async function archive(format: string, outFile: string, dirToArchive: string, options: ArchiveOptions = {}): Promise {\n const args = compute7zCompressArgs(format, options)\n // remove file before - 7z doesn't overwrite file, but update\n await unlinkIfExists(outFile)\n\n args.push(outFile, options.withoutDir ? \".\" : path.basename(dirToArchive))\n if (options.excluded != null) {\n for (const mask of options.excluded) {\n args.push(`-xr!${mask}`)\n }\n }\n\n try {\n await exec(\n path7za,\n args,\n {\n cwd: options.withoutDir ? dirToArchive : path.dirname(dirToArchive),\n },\n debug7z.enabled\n )\n } catch (e) {\n if (e.code === \"ENOENT\" && !(await exists(dirToArchive))) {\n throw new Error(`Cannot create archive: \"${dirToArchive}\" doesn't exist`)\n } else {\n throw e\n }\n }\n\n return outFile\n}\n\nfunction debug7zArgs(command: \"a\" | \"x\"): Array {\n const args = [command, \"-bd\"]\n if (debug7z.enabled) {\n args.push(\"-bb\")\n }\n return args\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.d.ts b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.d.ts new file mode 100644 index 0000000000..0c0d1ab1bb --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.d.ts @@ -0,0 +1,15 @@ +import { BlockMapDataHolder, PackageFileInfo } from "builder-util-runtime"; +import { Target } from "../core"; +import { PlatformPackager } from "../platformPackager"; +import { ArchiveOptions } from "./archive"; +export declare const BLOCK_MAP_FILE_SUFFIX = ".blockmap"; +export declare function createNsisWebDifferentialUpdateInfo(artifactPath: string, packageFiles: { + [arch: string]: PackageFileInfo; +}): { + packages: { + [arch: string]: PackageFileInfo; + }; +} | null; +export declare function configureDifferentialAwareArchiveOptions(archiveOptions: ArchiveOptions): ArchiveOptions; +export declare function appendBlockmap(file: string): Promise; +export declare function createBlockmap(file: string, target: Target, packager: PlatformPackager, safeArtifactName: string | null): Promise; diff --git a/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js new file mode 100644 index 0000000000..27657f5305 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createBlockmap = exports.appendBlockmap = exports.configureDifferentialAwareArchiveOptions = exports.createNsisWebDifferentialUpdateInfo = exports.BLOCK_MAP_FILE_SUFFIX = void 0; +const builder_util_1 = require("builder-util"); +const path = require("path"); +const appBuilder_1 = require("../util/appBuilder"); +exports.BLOCK_MAP_FILE_SUFFIX = ".blockmap"; +function createNsisWebDifferentialUpdateInfo(artifactPath, packageFiles) { + if (packageFiles == null) { + return null; + } + const keys = Object.keys(packageFiles); + if (keys.length <= 0) { + return null; + } + const packages = {}; + for (const arch of keys) { + const packageFileInfo = packageFiles[arch]; + const file = path.basename(packageFileInfo.path); + packages[arch] = { + ...packageFileInfo, + path: file, + // https://github.com/electron-userland/electron-builder/issues/2583 + file, + }; + } + return { packages }; +} +exports.createNsisWebDifferentialUpdateInfo = createNsisWebDifferentialUpdateInfo; +function configureDifferentialAwareArchiveOptions(archiveOptions) { + /* + * dict size 64 MB: Full: 33,744.88 KB, To download: 17,630.3 KB (52%) + * dict size 16 MB: Full: 33,936.84 KB, To download: 16,175.9 KB (48%) + * dict size 8 MB: Full: 34,187.59 KB, To download: 8,229.9 KB (24%) + * dict size 4 MB: Full: 34,628.73 KB, To download: 3,782.97 KB (11%) + + as we can see, if file changed in one place, all block is invalidated (and update size approximately equals to dict size) + + 1 MB is used: + + 1MB: + + 2018/01/11 11:54:41:0045 File has 59 changed blocks + 2018/01/11 11:54:41:0050 Full: 71,588.59 KB, To download: 1,243.39 KB (2%) + + 4MB: + + 2018/01/11 11:31:43:0440 Full: 70,303.55 KB, To download: 4,843.27 KB (7%) + 2018/01/11 11:31:43:0435 File has 234 changed blocks + + */ + archiveOptions.dictSize = 1; + // solid compression leads to a lot of changed blocks + archiveOptions.solid = false; + // do not allow to change compression level to avoid different packages + archiveOptions.compression = "normal"; + return archiveOptions; +} +exports.configureDifferentialAwareArchiveOptions = configureDifferentialAwareArchiveOptions; +async function appendBlockmap(file) { + builder_util_1.log.info({ file: builder_util_1.log.filePath(file) }, "building embedded block map"); + return await appBuilder_1.executeAppBuilderAsJson(["blockmap", "--input", file, "--compression", "deflate"]); +} +exports.appendBlockmap = appendBlockmap; +async function createBlockmap(file, target, packager, safeArtifactName) { + const blockMapFile = `${file}${exports.BLOCK_MAP_FILE_SUFFIX}`; + builder_util_1.log.info({ blockMapFile: builder_util_1.log.filePath(blockMapFile) }, "building block map"); + const updateInfo = await appBuilder_1.executeAppBuilderAsJson(["blockmap", "--input", file, "--output", blockMapFile]); + await packager.info.callArtifactBuildCompleted({ + file: blockMapFile, + safeArtifactName: safeArtifactName == null ? null : `${safeArtifactName}${exports.BLOCK_MAP_FILE_SUFFIX}`, + target, + arch: null, + packager, + updateInfo, + }); + return updateInfo; +} +exports.createBlockmap = createBlockmap; +//# sourceMappingURL=differentialUpdateInfoBuilder.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js.map b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js.map new file mode 100644 index 0000000000..184493c966 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/differentialUpdateInfoBuilder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"differentialUpdateInfoBuilder.js","sourceRoot":"","sources":["../../src/targets/differentialUpdateInfoBuilder.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAElC,6BAA4B;AAG5B,mDAA4D;AAG/C,QAAA,qBAAqB,GAAG,WAAW,CAAA;AAEhD,SAAgB,mCAAmC,CAAC,YAAoB,EAAE,YAAiD;IACzH,IAAI,YAAY,IAA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+B;IACjI,MAAM,YAAY,GAAG,GAAG,IAAI,GAAG,6BAAqB,EAAE,CAAA;IACtD,kBAAG,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,kBAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,oBAAoB,CAAC,CAAA;IAC5E,MAAM,UAAU,GAAG,MAAM,oCAAuB,CAAqB,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;IAC7H,MAAM,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC;QAC7C,IAAI,EAAE,YAAY;QAClB,gBAAgB,EAAE,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,GAAG,6BAAqB,EAAE;QACjG,MAAM;QACN,IAAI,EAAE,IAAI;QACV,QAAQ;QACR,UAAU;KACX,CAAC,CAAA;IACF,OAAO,UAAU,CAAA;AACnB,CAAC;AAbD,wCAaC","sourcesContent":["import { log } from \"builder-util\"\nimport { BlockMapDataHolder, PackageFileInfo } from \"builder-util-runtime\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { ArchiveOptions } from \"./archive\"\n\nexport const BLOCK_MAP_FILE_SUFFIX = \".blockmap\"\n\nexport function createNsisWebDifferentialUpdateInfo(artifactPath: string, packageFiles: { [arch: string]: PackageFileInfo }) {\n if (packageFiles == null) {\n return null\n }\n\n const keys = Object.keys(packageFiles)\n if (keys.length <= 0) {\n return null\n }\n\n const packages: { [arch: string]: PackageFileInfo } = {}\n for (const arch of keys) {\n const packageFileInfo = packageFiles[arch]\n const file = path.basename(packageFileInfo.path)\n packages[arch] = {\n ...packageFileInfo,\n path: file,\n // https://github.com/electron-userland/electron-builder/issues/2583\n file,\n } as any\n }\n return { packages }\n}\n\nexport function configureDifferentialAwareArchiveOptions(archiveOptions: ArchiveOptions): ArchiveOptions {\n /*\n * dict size 64 MB: Full: 33,744.88 KB, To download: 17,630.3 KB (52%)\n * dict size 16 MB: Full: 33,936.84 KB, To download: 16,175.9 KB (48%)\n * dict size 8 MB: Full: 34,187.59 KB, To download: 8,229.9 KB (24%)\n * dict size 4 MB: Full: 34,628.73 KB, To download: 3,782.97 KB (11%)\n\n as we can see, if file changed in one place, all block is invalidated (and update size approximately equals to dict size)\n\n 1 MB is used:\n\n 1MB:\n\n 2018/01/11 11:54:41:0045 File has 59 changed blocks\n 2018/01/11 11:54:41:0050 Full: 71,588.59 KB, To download: 1,243.39 KB (2%)\n\n 4MB:\n\n 2018/01/11 11:31:43:0440 Full: 70,303.55 KB, To download: 4,843.27 KB (7%)\n 2018/01/11 11:31:43:0435 File has 234 changed blocks\n\n */\n archiveOptions.dictSize = 1\n // solid compression leads to a lot of changed blocks\n archiveOptions.solid = false\n // do not allow to change compression level to avoid different packages\n archiveOptions.compression = \"normal\"\n return archiveOptions\n}\n\nexport async function appendBlockmap(file: string): Promise {\n log.info({ file: log.filePath(file) }, \"building embedded block map\")\n return await executeAppBuilderAsJson([\"blockmap\", \"--input\", file, \"--compression\", \"deflate\"])\n}\n\nexport async function createBlockmap(file: string, target: Target, packager: PlatformPackager, safeArtifactName: string | null): Promise {\n const blockMapFile = `${file}${BLOCK_MAP_FILE_SUFFIX}`\n log.info({ blockMapFile: log.filePath(blockMapFile) }, \"building block map\")\n const updateInfo = await executeAppBuilderAsJson([\"blockmap\", \"--input\", file, \"--output\", blockMapFile])\n await packager.info.callArtifactBuildCompleted({\n file: blockMapFile,\n safeArtifactName: safeArtifactName == null ? null : `${safeArtifactName}${BLOCK_MAP_FILE_SUFFIX}`,\n target,\n arch: null,\n packager,\n updateInfo,\n })\n return updateInfo\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/fpm.d.ts b/client/node_modules/app-builder-lib/out/targets/fpm.d.ts new file mode 100644 index 0000000000..4cacc0e325 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/fpm.d.ts @@ -0,0 +1,17 @@ +import { Arch } from "builder-util"; +import { Target } from "../core"; +import { LinuxPackager } from "../linuxPackager"; +import { LinuxTargetSpecificOptions } from "../options/linuxOptions"; +import { LinuxTargetHelper } from "./LinuxTargetHelper"; +export default class FpmTarget extends Target { + private readonly packager; + private readonly helper; + readonly outDir: string; + readonly options: LinuxTargetSpecificOptions; + private readonly scriptFiles; + constructor(name: string, packager: LinuxPackager, helper: LinuxTargetHelper, outDir: string); + private createScripts; + checkOptions(): Promise; + private computeFpmMetaInfoOptions; + build(appOutDir: string, arch: Arch): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/fpm.js b/client/node_modules/app-builder-lib/out/targets/fpm.js new file mode 100644 index 0000000000..085b3604d3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/fpm.js @@ -0,0 +1,217 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const _7zip_bin_1 = require("7zip-bin"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const appInfo_1 = require("../appInfo"); +const core_1 = require("../core"); +const errorMessages = require("../errorMessages"); +const appBuilder_1 = require("../util/appBuilder"); +const bundledTool_1 = require("../util/bundledTool"); +const macosVersion_1 = require("../util/macosVersion"); +const pathManager_1 = require("../util/pathManager"); +const LinuxTargetHelper_1 = require("./LinuxTargetHelper"); +const tools_1 = require("./tools"); +class FpmTarget extends core_1.Target { + constructor(name, packager, helper, outDir) { + super(name, false); + this.packager = packager; + this.helper = helper; + this.outDir = outDir; + this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config[this.name] }; + this.scriptFiles = this.createScripts(); + } + async createScripts() { + const defaultTemplatesDir = pathManager_1.getTemplatePath("linux"); + const packager = this.packager; + const templateOptions = { + // old API compatibility + executable: packager.executableName, + sanitizedProductName: packager.appInfo.sanitizedProductName, + productFilename: packager.appInfo.productFilename, + ...packager.platformSpecificBuildOptions, + }; + function getResource(value, defaultFile) { + if (value == null) { + return path.join(defaultTemplatesDir, defaultFile); + } + return path.resolve(packager.projectDir, value); + } + return await Promise.all([ + writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, "after-install.tpl"), templateOptions), + writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, "after-remove.tpl"), templateOptions), + ]); + } + checkOptions() { + return this.computeFpmMetaInfoOptions(); + } + async computeFpmMetaInfoOptions() { + var _a; + const packager = this.packager; + const projectUrl = await packager.appInfo.computePackageUrl(); + const errors = []; + if (projectUrl == null) { + errors.push("Please specify project homepage, see https://electron.build/configuration/configuration#Metadata-homepage"); + } + const options = this.options; + let author = options.maintainer; + if (author == null) { + const a = packager.info.metadata.author; + if (a == null || a.email == null) { + errors.push(errorMessages.authorEmailIsMissed); + } + else { + author = `${a.name} <${a.email}>`; + } + } + if (errors.length > 0) { + throw new Error(errors.join("\n\n")); + } + return { + name: (_a = options.packageName) !== null && _a !== void 0 ? _a : this.packager.appInfo.linuxPackageName, + maintainer: author, + url: projectUrl, + vendor: options.vendor || author, + }; + } + async build(appOutDir, arch) { + var _a; + const target = this.name; + // tslint:disable:no-invalid-template-strings + let nameFormat = "${name}-${version}-${arch}.${ext}"; + let isUseArchIfX64 = false; + if (target === "deb") { + nameFormat = "${name}_${version}_${arch}.${ext}"; + isUseArchIfX64 = true; + } + else if (target === "rpm") { + nameFormat = "${name}-${version}.${arch}.${ext}"; + isUseArchIfX64 = true; + } + const packager = this.packager; + const artifactPath = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: target, + file: artifactPath, + arch, + }); + await fs_1.unlinkIfExists(artifactPath); + if (packager.packagerOptions.prepackaged != null) { + await promises_1.mkdir(this.outDir, { recursive: true }); + } + const scripts = await this.scriptFiles; + const appInfo = packager.appInfo; + const options = this.options; + const synopsis = options.synopsis; + const args = [ + "--architecture", + builder_util_1.toLinuxArchString(arch, target), + "--after-install", + scripts[0], + "--after-remove", + scripts[1], + "--description", + appInfo_1.smarten(target === "rpm" ? this.helper.getDescription(options) : `${synopsis || ""}\n ${this.helper.getDescription(options)}`), + "--version", + appInfo.version, + "--package", + artifactPath, + ]; + appBuilder_1.objectToArgs(args, (await this.computeFpmMetaInfoOptions())); + const packageCategory = options.packageCategory; + if (packageCategory != null) { + args.push("--category", packageCategory); + } + if (target === "deb") { + args.push("--deb-priority", (_a = options.priority) !== null && _a !== void 0 ? _a : "optional"); + } + else if (target === "rpm") { + if (synopsis != null) { + args.push("--rpm-summary", appInfo_1.smarten(synopsis)); + } + } + const fpmConfiguration = { + args, + target, + }; + if (options.compression != null) { + fpmConfiguration.compression = options.compression; + } + // noinspection JSDeprecatedSymbols + const depends = options.depends; + if (depends != null) { + if (Array.isArray(depends)) { + fpmConfiguration.customDepends = depends; + } + else { + // noinspection SuspiciousTypeOfGuard + if (typeof depends === "string") { + fpmConfiguration.customDepends = [depends]; + } + else { + throw new Error(`depends must be Array or String, but specified as: ${depends}`); + } + } + } + builder_util_1.use(packager.info.metadata.license, it => args.push("--license", it)); + builder_util_1.use(appInfo.buildNumber, it => args.push("--iteration", + // dashes are not supported for iteration in older versions of fpm + // https://github.com/jordansissel/fpm/issues/1833 + it.split("-").join("_"))); + builder_util_1.use(options.fpm, it => args.push(...it)); + args.push(`${appOutDir}/=${LinuxTargetHelper_1.installPrefix}/${appInfo.sanitizedProductName}`); + for (const icon of await this.helper.icons) { + const extWithDot = path.extname(icon.file); + const sizeName = extWithDot === ".svg" ? "scalable" : `${icon.size}x${icon.size}`; + args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`); + } + const mimeTypeFilePath = await this.helper.mimeTypeFiles; + if (mimeTypeFilePath != null) { + args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`); + } + const desktopFilePath = await this.helper.writeDesktopEntry(this.options); + args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`); + if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) { + return; + } + const env = { + ...process.env, + SZA_PATH: _7zip_bin_1.path7za, + SZA_COMPRESSION_LEVEL: packager.compression === "store" ? "0" : "9", + }; + // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary) + // so, for now, brew install rpm is still required. + if (target !== "rpm" && (await macosVersion_1.isMacOsSierra())) { + const linuxToolsPath = await tools_1.getLinuxToolsPath(); + Object.assign(env, { + PATH: bundledTool_1.computeEnv(process.env.PATH, [path.join(linuxToolsPath, "bin")]), + DYLD_LIBRARY_PATH: bundledTool_1.computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, "lib")]), + }); + } + await builder_util_1.executeAppBuilder(["fpm", "--configuration", JSON.stringify(fpmConfiguration)], undefined, { env }); + await packager.dispatchArtifactCreated(artifactPath, this, arch); + } +} +exports.default = FpmTarget; +async function writeConfigFile(tmpDir, templatePath, options) { + //noinspection JSUnusedLocalSymbols + function replacer(match, p1) { + if (p1 in options) { + return options[p1]; + } + else { + throw new Error(`Macro ${p1} is not defined`); + } + } + const config = (await promises_1.readFile(templatePath, "utf8")).replace(/\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => { + builder_util_1.log.warn("<%= varName %> is deprecated, please use ${varName} instead"); + return replacer(match, p1.trim()); + }); + const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, ".tpl") }); + await fs_extra_1.outputFile(outputPath, config); + return outputPath; +} +//# sourceMappingURL=fpm.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/fpm.js.map b/client/node_modules/app-builder-lib/out/targets/fpm.js.map new file mode 100644 index 0000000000..482e0adf8f --- /dev/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CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACrI,kBAAG,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;QACvE,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5F,MAAM,qBAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport { Arch, executeAppBuilder, log, TmpDir, toLinuxArchString, use } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util/out/fs\"\nimport { outputFile } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\n\ninterface FpmOptions {\n name: string\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly scriptFiles: Promise>\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n sanitizedProductName: packager.appInfo.sanitizedProductName,\n productFilename: packager.appInfo.productFilename,\n ...packager.platformSpecificBuildOptions,\n }\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions),\n ])\n }\n\n checkOptions(): Promise {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build/configuration/configuration#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n } else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n name: options.packageName ?? this.packager.appInfo.linuxPackageName,\n maintainer: author!,\n url: projectUrl!,\n vendor: options.vendor || author!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n } else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactPath = path.join(this.outDir, packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64))\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await mkdir(this.outDir, { recursive: true })\n }\n\n const scripts = await this.scriptFiles\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\",\n toLinuxArchString(arch, target),\n \"--after-install\",\n scripts[0],\n \"--after-remove\",\n scripts[1],\n \"--description\",\n smarten(target === \"rpm\" ? this.helper.getDescription(options)! : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\",\n appInfo.version,\n \"--package\",\n artifactPath,\n ]\n\n objectToArgs(args, (await this.computeFpmMetaInfoOptions()) as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n args.push(\"--deb-priority\", (options as DebOptions).priority ?? \"optional\")\n } else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args,\n target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n } else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n } else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it))\n use(appInfo.buildNumber, it =>\n args.push(\n \"--iteration\",\n // dashes are not supported for iteration in older versions of fpm\n // https://github.com/jordansissel/fpm/issues/1833\n it.split(\"-\").join(\"_\")\n )\n )\n\n use(options.fpm, it => args.push(...it))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.sanitizedProductName}`)\n for (const icon of await this.helper.icons) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: path7za,\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && (await isMacOsSierra())) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, { env })\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array\n customDepends?: Array\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n } else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\")).replace(/\\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, \".tpl\") })\n await outputFile(outputPath, config)\n return outputPath\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Commands.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.d.ts new file mode 100644 index 0000000000..c4bb7b6435 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.d.ts @@ -0,0 +1,9 @@ +export declare type Commands = { + OutFile: string; + VIProductVersion?: string; + VIAddVersionKey: Array; + Unicode: boolean; + Icon?: string; + SetCompress?: "off"; + SetCompressor?: "zlib"; +}; diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js new file mode 100644 index 0000000000..fc59fa74de --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Commands.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js.map new file mode 100644 index 0000000000..1f97722b2a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Commands.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Commands.js","sourceRoot":"","sources":["../../../src/targets/nsis/Commands.ts"],"names":[],"mappings":"","sourcesContent":["export type Commands = {\n OutFile: string\n VIProductVersion?: string\n VIAddVersionKey: Array\n Unicode: boolean\n Icon?: string\n SetCompress?: \"off\"\n SetCompressor?: \"zlib\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Defines.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.d.ts new file mode 100644 index 0000000000..a41f160052 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.d.ts @@ -0,0 +1,74 @@ +/// +import { PortableOptions } from "./nsisOptions"; +import { PathLike } from "fs"; +/** + * Parameters declared as environment variables in NSIS scripts. + * The documentation vaguely explains "All other electron-builder specific flags (e.g. ONE_CLICK) are still defined." + * Parameters with null values in TypeScript can be treated as Boolean values using "!Ifdef" in NSIS Script. + */ +export declare type Defines = { + APP_ID: string; + APP_GUID: unknown; + UNINSTALL_APP_KEY: unknown; + PRODUCT_NAME: string; + PRODUCT_FILENAME: string; + APP_FILENAME: string; + APP_DESCRIPTION: string; + VERSION: string; + PROJECT_DIR: string; + BUILD_RESOURCES_DIR: string; + APP_PACKAGE_NAME: string; + ENABLE_LOGGING_ELECTRON_BUILDER?: null; + UNINSTALL_REGISTRY_KEY_2?: string; + MUI_ICON?: unknown; + MUI_UNICON?: unknown; + APP_DIR_64?: string; + APP_DIR_ARM64?: string; + APP_DIR_32?: string; + APP_BUILD_DIR?: string; + APP_64?: string; + APP_ARM64?: string; + APP_32?: string; + APP_64_NAME?: string; + APP_ARM64_NAME?: string; + APP_32_NAME?: string; + APP_64_HASH?: string; + APP_ARM64_HASH?: string; + APP_32_HASH?: string; + REQUEST_EXECUTION_LEVEL?: PortableOptions["requestExecutionLevel"]; + UNPACK_DIR_NAME?: string | false; + SPLASH_IMAGE?: unknown; + ESTIMATED_SIZE?: number; + COMPRESS?: "auto"; + BUILD_UNINSTALLER?: null; + UNINSTALLER_OUT_FILE?: PathLike; + ONE_CLICK?: null; + RUN_AFTER_FINISH?: null; + HEADER_ICO?: string; + HIDE_RUN_AFTER_FINISH?: null; + MUI_HEADERIMAGE?: null; + MUI_HEADERIMAGE_RIGHT?: null; + MUI_HEADERIMAGE_BITMAP?: string; + MUI_WELCOMEFINISHPAGE_BITMAP?: string; + MUI_UNWELCOMEFINISHPAGE_BITMAP?: string; + MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null; + INSTALL_MODE_PER_ALL_USERS?: null; + INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null; + allowToChangeInstallationDirectory?: null; + removeDefaultUninstallWelcomePage?: null; + MENU_FILENAME?: string; + SHORTCUT_NAME?: string; + DELETE_APP_DATA_ON_UNINSTALL?: null; + UNINSTALLER_ICON?: string; + UNINSTALL_DISPLAY_NAME?: string; + RECREATE_DESKTOP_SHORTCUT?: null; + DO_NOT_CREATE_DESKTOP_SHORTCUT?: null; + DO_NOT_CREATE_START_MENU_SHORTCUT?: null; + DISPLAY_LANG_SELECTOR?: null; + COMPANY_NAME?: string; + APP_PRODUCT_FILENAME?: string; + APP_PACKAGE_STORE_FILE?: string; + APP_INSTALLER_STORE_FILE?: string; + ZIP_COMPRESSION?: null; + COMPRESSION_METHOD?: "zip" | "7z"; +}; diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js new file mode 100644 index 0000000000..5839751847 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Defines.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js.map new file mode 100644 index 0000000000..d37fb9a3de --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/Defines.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Defines.js","sourceRoot":"","sources":["../../../src/targets/nsis/Defines.ts"],"names":[],"mappings":"","sourcesContent":["import { PortableOptions } from \"./nsisOptions\"\nimport { PathLike } from \"fs\"\n/**\n * Parameters declared as environment variables in NSIS scripts.\n * The documentation vaguely explains \"All other electron-builder specific flags (e.g. ONE_CLICK) are still defined.\"\n * Parameters with null values in TypeScript can be treated as Boolean values using \"!Ifdef\" in NSIS Script.\n */\nexport type Defines = {\n APP_ID: string\n APP_GUID: unknown\n UNINSTALL_APP_KEY: unknown\n PRODUCT_NAME: string\n PRODUCT_FILENAME: string\n APP_FILENAME: string\n APP_DESCRIPTION: string\n VERSION: string\n\n PROJECT_DIR: string\n BUILD_RESOURCES_DIR: string\n\n APP_PACKAGE_NAME: string\n\n ENABLE_LOGGING_ELECTRON_BUILDER?: null\n UNINSTALL_REGISTRY_KEY_2?: string\n\n MUI_ICON?: unknown\n MUI_UNICON?: unknown\n\n APP_DIR_64?: string\n APP_DIR_ARM64?: string\n APP_DIR_32?: string\n\n APP_BUILD_DIR?: string\n\n APP_64?: string\n APP_ARM64?: string\n APP_32?: string\n\n APP_64_NAME?: string\n APP_ARM64_NAME?: string\n APP_32_NAME?: string\n\n APP_64_HASH?: string\n APP_ARM64_HASH?: string\n APP_32_HASH?: string\n\n REQUEST_EXECUTION_LEVEL?: PortableOptions[\"requestExecutionLevel\"]\n\n UNPACK_DIR_NAME?: string | false\n\n SPLASH_IMAGE?: unknown\n\n ESTIMATED_SIZE?: number\n\n COMPRESS?: \"auto\"\n\n BUILD_UNINSTALLER?: null\n UNINSTALLER_OUT_FILE?: PathLike\n\n ONE_CLICK?: null\n RUN_AFTER_FINISH?: null\n HEADER_ICO?: string\n HIDE_RUN_AFTER_FINISH?: null\n\n MUI_HEADERIMAGE?: null\n MUI_HEADERIMAGE_RIGHT?: null\n MUI_HEADERIMAGE_BITMAP?: string\n\n MUI_WELCOMEFINISHPAGE_BITMAP?: string\n MUI_UNWELCOMEFINISHPAGE_BITMAP?: string\n\n MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null\n\n INSTALL_MODE_PER_ALL_USERS?: null\n INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null\n\n allowToChangeInstallationDirectory?: null\n\n removeDefaultUninstallWelcomePage?: null\n\n MENU_FILENAME?: string\n\n SHORTCUT_NAME?: string\n\n DELETE_APP_DATA_ON_UNINSTALL?: null\n\n UNINSTALLER_ICON?: string\n UNINSTALL_DISPLAY_NAME?: string\n\n RECREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_START_MENU_SHORTCUT?: null\n\n DISPLAY_LANG_SELECTOR?: null\n\n COMPANY_NAME?: string\n\n APP_PRODUCT_FILENAME?: string\n\n APP_PACKAGE_STORE_FILE?: string\n\n APP_INSTALLER_STORE_FILE?: string\n\n ZIP_COMPRESSION?: null\n\n COMPRESSION_METHOD?: \"zip\" | \"7z\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.d.ts new file mode 100644 index 0000000000..f62c4c9d51 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.d.ts @@ -0,0 +1,35 @@ +import { Arch } from "builder-util"; +import { PackageFileInfo } from "builder-util-runtime"; +import { Target } from "../../core"; +import { WinPackager } from "../../winPackager"; +import { Defines } from "./Defines"; +import { NsisOptions } from "./nsisOptions"; +import { AppPackageHelper } from "./nsisUtil"; +export declare class NsisTarget extends Target { + readonly packager: WinPackager; + readonly outDir: string; + protected readonly packageHelper: AppPackageHelper; + readonly options: NsisOptions; + /** @private */ + readonly archs: Map; + constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper); + build(appOutDir: string, arch: Arch): Promise; + get isBuildDifferentialAware(): boolean; + private getPreCompressedFileExtensions; + /** @private */ + buildAppPackage(appOutDir: string, arch: Arch): Promise; + protected get installerFilenamePattern(): string; + private get isPortable(); + finishBuild(): Promise; + private buildInstaller; + protected generateGitHubInstallerName(): string; + private get isUnicodeEnabled(); + get isWebInstaller(): boolean; + private computeScriptAndSignUninstaller; + private computeVersionKey; + protected configureDefines(oneClick: boolean, defines: Defines): Promise; + private configureDefinesForAllTypeOfInstaller; + private executeMakensis; + private computeCommonInstallerScriptHeader; + private computeFinalScript; +} diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js new file mode 100644 index 0000000000..be7fb70852 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js @@ -0,0 +1,674 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NsisTarget = void 0; +const _7zip_bin_1 = require("7zip-bin"); +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const fs_1 = require("builder-util/out/fs"); +const debug_1 = require("debug"); +const fs = require("fs"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const binDownload_1 = require("../../binDownload"); +const core_1 = require("../../core"); +const CommonWindowsInstallerConfiguration_1 = require("../../options/CommonWindowsInstallerConfiguration"); +const platformPackager_1 = require("../../platformPackager"); +const hash_1 = require("../../util/hash"); +const macosVersion_1 = require("../../util/macosVersion"); +const timer_1 = require("../../util/timer"); +const wine_1 = require("../../wine"); +const archive_1 = require("../archive"); +const differentialUpdateInfoBuilder_1 = require("../differentialUpdateInfoBuilder"); +const targetUtil_1 = require("../targetUtil"); +const nsisLang_1 = require("./nsisLang"); +const nsisLicense_1 = require("./nsisLicense"); +const nsisScriptGenerator_1 = require("./nsisScriptGenerator"); +const nsisUtil_1 = require("./nsisUtil"); +const debug = debug_1.default("electron-builder:nsis"); +// noinspection SpellCheckingInspection +const ELECTRON_BUILDER_NS_UUID = builder_util_runtime_1.UUID.parse("50e065bc-3134-11e6-9bab-38c9862bdaf3"); +// noinspection SpellCheckingInspection +const nsisResourcePathPromise = () => binDownload_1.getBinFromUrl("nsis-resources", "3.4.1", "Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q=="); +const USE_NSIS_BUILT_IN_COMPRESSOR = false; +class NsisTarget extends core_1.Target { + constructor(packager, outDir, targetName, packageHelper) { + super(targetName); + this.packager = packager; + this.outDir = outDir; + this.packageHelper = packageHelper; + /** @private */ + this.archs = new Map(); + this.packageHelper.refCount++; + this.options = + targetName === "portable" + ? Object.create(null) + : { + preCompressedFileExtensions: [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"], + ...this.packager.config.nsis, + }; + if (targetName !== "nsis") { + Object.assign(this.options, this.packager.config[targetName === "nsis-web" ? "nsisWeb" : targetName]); + } + const deps = packager.info.metadata.dependencies; + if (deps != null && deps["electron-squirrel-startup"] != null) { + builder_util_1.log.warn('"electron-squirrel-startup" dependency is not required for NSIS'); + } + nsisUtil_1.NsisTargetOptions.resolve(this.options); + } + build(appOutDir, arch) { + this.archs.set(arch, appOutDir); + return Promise.resolve(); + } + get isBuildDifferentialAware() { + return !this.isPortable && this.options.differentialPackage !== false; + } + getPreCompressedFileExtensions() { + const result = this.isWebInstaller ? null : this.options.preCompressedFileExtensions; + return result == null ? null : builder_util_1.asArray(result).map(it => (it.startsWith(".") ? it : `.${it}`)); + } + /** @private */ + async buildAppPackage(appOutDir, arch) { + const options = this.options; + const packager = this.packager; + const isBuildDifferentialAware = this.isBuildDifferentialAware; + const format = !isBuildDifferentialAware && options.useZip ? "zip" : "7z"; + const archiveFile = path.join(this.outDir, `${packager.appInfo.sanitizedName}-${packager.appInfo.version}-${builder_util_1.Arch[arch]}.nsis.${format}`); + const preCompressedFileExtensions = this.getPreCompressedFileExtensions(); + const archiveOptions = { + withoutDir: true, + compression: packager.compression, + excluded: preCompressedFileExtensions == null ? null : preCompressedFileExtensions.map(it => `*${it}`), + }; + const timer = timer_1.time(`nsis package, ${builder_util_1.Arch[arch]}`); + await archive_1.archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? differentialUpdateInfoBuilder_1.configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions); + timer.end(); + if (isBuildDifferentialAware && this.isWebInstaller) { + const data = await differentialUpdateInfoBuilder_1.appendBlockmap(archiveFile); + return { + ...data, + path: archiveFile, + }; + } + else { + return await createPackageFileInfo(archiveFile); + } + } + get installerFilenamePattern() { + // tslint:disable:no-invalid-template-strings + return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}.${ext}"; + } + get isPortable() { + return this.name === "portable"; + } + async finishBuild() { + try { + const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern); + const builds = new Set([this.archs]); + if (pattern.includes("${arch}") && this.archs.size > 1) { + ; + [...this.archs].forEach(([arch, appOutDir]) => builds.add(new Map().set(arch, appOutDir))); + } + const doBuildArchs = builds.values(); + for (const archs of doBuildArchs) { + await this.buildInstaller(archs); + } + } + finally { + await this.packageHelper.finishBuild(); + } + } + async buildInstaller(archs) { + var _a; + const primaryArch = archs.size === 1 ? archs.keys().next().value : null; + const packager = this.packager; + const appInfo = packager.appInfo; + const options = this.options; + const installerFilename = packager.expandArtifactNamePattern(options, "exe", primaryArch, this.installerFilenamePattern, false, this.packager.platformSpecificBuildOptions.defaultArch); + const oneClick = options.oneClick !== false; + const installerPath = path.join(this.outDir, installerFilename); + const logFields = { + target: this.name, + file: builder_util_1.log.filePath(installerPath), + archs: Array.from(archs.keys()) + .map(it => builder_util_1.Arch[it]) + .join(", "), + }; + const isPerMachine = options.perMachine === true; + if (!this.isPortable) { + logFields.oneClick = oneClick; + logFields.perMachine = isPerMachine; + } + await packager.info.callArtifactBuildStarted({ + targetPresentableName: this.name, + file: installerPath, + arch: primaryArch, + }, logFields); + const guid = options.guid || builder_util_runtime_1.UUID.v5(appInfo.id, ELECTRON_BUILDER_NS_UUID); + const uninstallAppKey = guid.replace(/\\/g, " - "); + const defines = { + APP_ID: appInfo.id, + APP_GUID: guid, + // Windows bug - entry in Software\Microsoft\Windows\CurrentVersion\Uninstall cannot have \ symbols (dir) + UNINSTALL_APP_KEY: uninstallAppKey, + PRODUCT_NAME: appInfo.productName, + PRODUCT_FILENAME: appInfo.productFilename, + APP_FILENAME: targetUtil_1.getWindowsInstallationDirName(appInfo, !oneClick || isPerMachine), + APP_DESCRIPTION: appInfo.description, + VERSION: appInfo.version, + PROJECT_DIR: packager.projectDir, + BUILD_RESOURCES_DIR: packager.info.buildResourcesDir, + APP_PACKAGE_NAME: targetUtil_1.getWindowsInstallationAppPackageName(appInfo.name), + }; + if ((_a = options.customNsisBinary) === null || _a === void 0 ? void 0 : _a.debugLogging) { + defines.ENABLE_LOGGING_ELECTRON_BUILDER = null; + } + if (uninstallAppKey !== guid) { + defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${guid}`; + } + const commands = { + OutFile: `"${installerPath}"`, + VIProductVersion: appInfo.getVersionInWeirdWindowsForm(), + VIAddVersionKey: this.computeVersionKey(), + Unicode: this.isUnicodeEnabled, + }; + const isPortable = this.isPortable; + const iconPath = (isPortable ? null : await packager.getResource(options.installerIcon, "installerIcon.ico")) || (await packager.getIconPath()); + if (iconPath != null) { + if (isPortable) { + commands.Icon = `"${iconPath}"`; + } + else { + defines.MUI_ICON = iconPath; + defines.MUI_UNICON = iconPath; + } + } + const packageFiles = {}; + let estimatedSize = 0; + if (this.isPortable && options.useZip) { + for (const [arch, dir] of archs.entries()) { + defines[arch === builder_util_1.Arch.x64 ? "APP_DIR_64" : arch === builder_util_1.Arch.arm64 ? "APP_DIR_ARM64" : "APP_DIR_32"] = dir; + } + } + else if (USE_NSIS_BUILT_IN_COMPRESSOR && archs.size === 1) { + defines.APP_BUILD_DIR = archs.get(archs.keys().next().value); + } + else { + await bluebird_lst_1.default.map(archs.keys(), async (arch) => { + const fileInfo = await this.packageHelper.packArch(arch, this); + const file = fileInfo.path; + const defineKey = arch === builder_util_1.Arch.x64 ? "APP_64" : arch === builder_util_1.Arch.arm64 ? "APP_ARM64" : "APP_32"; + defines[defineKey] = file; + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const defineNameKey = `${defineKey}_NAME`; + defines[defineNameKey] = path.basename(file); + // nsis expect a hexadecimal string + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + const defineHashKey = `${defineKey}_HASH`; + defines[defineHashKey] = Buffer.from(fileInfo.sha512, "base64").toString("hex").toUpperCase(); + if (this.isWebInstaller) { + await packager.dispatchArtifactCreated(file, this, arch); + packageFiles[builder_util_1.Arch[arch]] = fileInfo; + } + const archiveInfo = (await builder_util_1.exec(_7zip_bin_1.path7za, ["l", file])).trim(); + // after adding blockmap data will be "Warnings: 1" in the end of output + const match = /(\d+)\s+\d+\s+\d+\s+files/.exec(archiveInfo); + if (match == null) { + builder_util_1.log.warn({ output: archiveInfo }, "cannot compute size of app package"); + } + else { + estimatedSize += parseInt(match[1], 10); + } + }); + } + this.configureDefinesForAllTypeOfInstaller(defines); + if (isPortable) { + const { unpackDirName, requestExecutionLevel, splashImage } = options; + defines.REQUEST_EXECUTION_LEVEL = requestExecutionLevel || "user"; + // https://github.com/electron-userland/electron-builder/issues/5764 + if (typeof unpackDirName === "string" || !unpackDirName) { + defines.UNPACK_DIR_NAME = unpackDirName || (await builder_util_1.executeAppBuilder(["ksuid"])); + } + if (splashImage != null) { + defines.SPLASH_IMAGE = path.resolve(packager.projectDir, splashImage); + } + } + else { + await this.configureDefines(oneClick, defines); + } + if (estimatedSize !== 0) { + // in kb + defines.ESTIMATED_SIZE = Math.round(estimatedSize / 1024); + } + if (packager.compression === "store") { + commands.SetCompress = "off"; + } + else { + // difference - 33.540 vs 33.601, only 61 KB (but zip is faster to decompress) + // do not use /SOLID - "With solid compression, files are uncompressed to temporary file before they are copied to their final destination", + // it is not good for portable installer (where built-in NSIS compression is used). http://forums.winamp.com/showpost.php?p=2982902&postcount=6 + commands.SetCompressor = "zlib"; + if (!this.isWebInstaller) { + defines.COMPRESS = "auto"; + } + } + debug(defines); + debug(commands); + if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([defines, commands]))) { + return; + } + // prepare short-version variants of defines and commands, to make an uninstaller that doesn't differ much from the previous one + const definesUninstaller = { ...defines }; + const commandsUninstaller = { ...commands }; + if (appInfo.shortVersion != null) { + definesUninstaller.VERSION = appInfo.shortVersion; + commandsUninstaller.VIProductVersion = appInfo.shortVersionWindows; + commandsUninstaller.VIAddVersionKey = this.computeVersionKey(true); + } + const sharedHeader = await this.computeCommonInstallerScriptHeader(); + const script = isPortable + ? await fs_extra_1.readFile(path.join(nsisUtil_1.nsisTemplatesDir, "portable.nsi"), "utf8") + : await this.computeScriptAndSignUninstaller(definesUninstaller, commandsUninstaller, installerPath, sharedHeader, archs); + // copy outfile name into main options, as the computeScriptAndSignUninstaller function was kind enough to add important data to temporary defines. + defines.UNINSTALLER_OUT_FILE = definesUninstaller.UNINSTALLER_OUT_FILE; + await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, true, archs))); + await Promise.all([packager.sign(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : fs_extra_1.unlink(defines.UNINSTALLER_OUT_FILE)]); + const safeArtifactName = platformPackager_1.computeSafeArtifactNameIfNeeded(installerFilename, () => this.generateGitHubInstallerName()); + let updateInfo; + if (this.isWebInstaller) { + updateInfo = differentialUpdateInfoBuilder_1.createNsisWebDifferentialUpdateInfo(installerPath, packageFiles); + } + else if (this.isBuildDifferentialAware) { + updateInfo = await differentialUpdateInfoBuilder_1.createBlockmap(installerPath, this, packager, safeArtifactName); + } + if (updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper)) { + updateInfo.isAdminRightsRequired = true; + } + await packager.info.callArtifactBuildCompleted({ + file: installerPath, + updateInfo, + target: this, + packager, + arch: primaryArch, + safeArtifactName, + isWriteUpdateInfo: !this.isPortable, + }); + } + generateGitHubInstallerName() { + const appInfo = this.packager.appInfo; + const classifier = appInfo.name.toLowerCase() === appInfo.name ? "setup-" : "Setup-"; + return `${appInfo.name}-${this.isPortable ? "" : classifier}${appInfo.version}.exe`; + } + get isUnicodeEnabled() { + return this.options.unicode !== false; + } + get isWebInstaller() { + return false; + } + async computeScriptAndSignUninstaller(defines, commands, installerPath, sharedHeader, archs) { + const packager = this.packager; + const customScriptPath = await packager.getResource(this.options.script, "installer.nsi"); + const script = await fs_extra_1.readFile(customScriptPath || path.join(nsisUtil_1.nsisTemplatesDir, "installer.nsi"), "utf8"); + if (customScriptPath != null) { + builder_util_1.log.info({ reason: "custom NSIS script is used" }, "uninstaller is not signed by electron-builder"); + return script; + } + // https://github.com/electron-userland/electron-builder/issues/2103 + // it is more safe and reliable to write uninstaller to our out dir + const uninstallerPath = path.join(this.outDir, `__uninstaller-${this.name}-${this.packager.appInfo.sanitizedName}.exe`); + const isWin = process.platform === "win32"; + defines.BUILD_UNINSTALLER = null; + defines.UNINSTALLER_OUT_FILE = isWin ? uninstallerPath : path.win32.join("Z:", uninstallerPath); + await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, false, archs))); + // http://forums.winamp.com/showthread.php?p=3078545 + if (macosVersion_1.isMacOsCatalina()) { + try { + await nsisUtil_1.UninstallerReader.exec(installerPath, uninstallerPath); + } + catch (error) { + builder_util_1.log.warn(`packager.vm is used: ${error.message}`); + const vm = await packager.vm.value; + await vm.exec(installerPath, []); + // Parallels VM can exit after command execution, but NSIS continue to be running + let i = 0; + while (!(await fs_1.exists(uninstallerPath)) && i++ < 100) { + // noinspection JSUnusedLocalSymbols + // eslint-disable-next-line @typescript-eslint/no-unused-vars + await new Promise((resolve, _reject) => setTimeout(resolve, 300)); + } + } + } + else { + await wine_1.execWine(installerPath, null, [], { env: { __COMPAT_LAYER: "RunAsInvoker" } }); + } + await packager.sign(uninstallerPath, " Signing NSIS uninstaller"); + delete defines.BUILD_UNINSTALLER; + // platform-specific path, not wine + defines.UNINSTALLER_OUT_FILE = uninstallerPath; + return script; + } + computeVersionKey(short = false) { + // Error: invalid VIProductVersion format, should be X.X.X.X + // so, we must strip beta + const localeId = this.options.language || "1033"; + const appInfo = this.packager.appInfo; + const versionKey = [ + `/LANG=${localeId} ProductName "${appInfo.productName}"`, + `/LANG=${localeId} ProductVersion "${appInfo.version}"`, + `/LANG=${localeId} LegalCopyright "${appInfo.copyright}"`, + `/LANG=${localeId} FileDescription "${appInfo.description}"`, + `/LANG=${localeId} FileVersion "${appInfo.buildVersion}"`, + ]; + if (short) { + versionKey[1] = `/LANG=${localeId} ProductVersion "${appInfo.shortVersion}"`; + versionKey[4] = `/LANG=${localeId} FileVersion "${appInfo.shortVersion}"`; + } + builder_util_1.use(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks "${it}"`)); + builder_util_1.use(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName "${it}"`)); + return versionKey; + } + configureDefines(oneClick, defines) { + const packager = this.packager; + const options = this.options; + const asyncTaskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken); + if (oneClick) { + defines.ONE_CLICK = null; + if (options.runAfterFinish !== false) { + defines.RUN_AFTER_FINISH = null; + } + asyncTaskManager.add(async () => { + const installerHeaderIcon = await packager.getResource(options.installerHeaderIcon, "installerHeaderIcon.ico"); + if (installerHeaderIcon != null) { + defines.HEADER_ICO = installerHeaderIcon; + } + }); + } + else { + if (options.runAfterFinish === false) { + defines.HIDE_RUN_AFTER_FINISH = null; + } + asyncTaskManager.add(async () => { + const installerHeader = await packager.getResource(options.installerHeader, "installerHeader.bmp"); + if (installerHeader != null) { + defines.MUI_HEADERIMAGE = null; + defines.MUI_HEADERIMAGE_RIGHT = null; + defines.MUI_HEADERIMAGE_BITMAP = installerHeader; + } + }); + asyncTaskManager.add(async () => { + const bitmap = (await packager.getResource(options.installerSidebar, "installerSidebar.bmp")) || "${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp"; + defines.MUI_WELCOMEFINISHPAGE_BITMAP = bitmap; + defines.MUI_UNWELCOMEFINISHPAGE_BITMAP = (await packager.getResource(options.uninstallerSidebar, "uninstallerSidebar.bmp")) || bitmap; + }); + if (options.allowElevation !== false) { + defines.MULTIUSER_INSTALLMODE_ALLOW_ELEVATION = null; + } + } + if (options.perMachine === true) { + defines.INSTALL_MODE_PER_ALL_USERS = null; + } + if (!oneClick || options.perMachine === true) { + defines.INSTALL_MODE_PER_ALL_USERS_REQUIRED = null; + } + if (options.allowToChangeInstallationDirectory) { + if (oneClick) { + throw new builder_util_1.InvalidConfigurationError("allowToChangeInstallationDirectory makes sense only for assisted installer (please set oneClick to false)"); + } + defines.allowToChangeInstallationDirectory = null; + } + if (options.removeDefaultUninstallWelcomePage) { + defines.removeDefaultUninstallWelcomePage = null; + } + const commonOptions = CommonWindowsInstallerConfiguration_1.getEffectiveOptions(options, packager); + if (commonOptions.menuCategory != null) { + defines.MENU_FILENAME = commonOptions.menuCategory; + } + defines.SHORTCUT_NAME = commonOptions.shortcutName; + if (options.deleteAppDataOnUninstall) { + defines.DELETE_APP_DATA_ON_UNINSTALL = null; + } + asyncTaskManager.add(async () => { + const uninstallerIcon = await packager.getResource(options.uninstallerIcon, "uninstallerIcon.ico"); + if (uninstallerIcon != null) { + // we don't need to copy MUI_UNICON (defaults to app icon), so, we have 2 defines + defines.UNINSTALLER_ICON = uninstallerIcon; + defines.MUI_UNICON = uninstallerIcon; + } + }); + defines.UNINSTALL_DISPLAY_NAME = packager.expandMacro(options.uninstallDisplayName || "${productName} ${version}", null, {}, false); + if (commonOptions.isCreateDesktopShortcut === CommonWindowsInstallerConfiguration_1.DesktopShortcutCreationPolicy.NEVER) { + defines.DO_NOT_CREATE_DESKTOP_SHORTCUT = null; + } + if (commonOptions.isCreateDesktopShortcut === CommonWindowsInstallerConfiguration_1.DesktopShortcutCreationPolicy.ALWAYS) { + defines.RECREATE_DESKTOP_SHORTCUT = null; + } + if (!commonOptions.isCreateStartMenuShortcut) { + defines.DO_NOT_CREATE_START_MENU_SHORTCUT = null; + } + if (options.displayLanguageSelector === true) { + defines.DISPLAY_LANG_SELECTOR = null; + } + return asyncTaskManager.awaitTasks(); + } + configureDefinesForAllTypeOfInstaller(defines) { + const appInfo = this.packager.appInfo; + const companyName = appInfo.companyName; + if (companyName != null) { + defines.COMPANY_NAME = companyName; + } + // electron uses product file name as app data, define it as well to remove on uninstall + if (defines.APP_FILENAME !== appInfo.productFilename) { + defines.APP_PRODUCT_FILENAME = appInfo.productFilename; + } + if (this.isWebInstaller) { + defines.APP_PACKAGE_STORE_FILE = `${appInfo.updaterCacheDirName}\\${builder_util_runtime_1.CURRENT_APP_PACKAGE_FILE_NAME}`; + } + else { + defines.APP_INSTALLER_STORE_FILE = `${appInfo.updaterCacheDirName}\\${builder_util_runtime_1.CURRENT_APP_INSTALLER_FILE_NAME}`; + } + if (!this.isWebInstaller && defines.APP_BUILD_DIR == null) { + const options = this.options; + if (options.useZip) { + defines.ZIP_COMPRESSION = null; + } + defines.COMPRESSION_METHOD = options.useZip ? "zip" : "7z"; + } + } + async executeMakensis(defines, commands, script) { + const args = this.options.warningsAsErrors === false ? [] : ["-WX"]; + args.push("-INPUTCHARSET", "UTF8"); + for (const name of Object.keys(defines)) { + const value = defines[name]; + if (value == null) { + args.push(`-D${name}`); + } + else { + args.push(`-D${name}=${value}`); + } + } + for (const name of Object.keys(commands)) { + const value = commands[name]; + if (Array.isArray(value)) { + for (const c of value) { + args.push(`-X${name} ${c}`); + } + } + else { + args.push(`-X${name} ${value}`); + } + } + args.push("-"); + if (this.packager.debugLogger.isEnabled) { + this.packager.debugLogger.add("nsis.script", script); + } + const nsisPath = await nsisUtil_1.NSIS_PATH(); + const command = path.join(nsisPath, process.platform === "darwin" ? "mac" : process.platform === "win32" ? "Bin" : "linux", process.platform === "win32" ? "makensis.exe" : "makensis"); + // if (process.platform === "win32") { + // fix for an issue caused by virus scanners, locking the file during write + // https://github.com/electron-userland/electron-builder/issues/5005 + await ensureNotBusy(commands["OutFile"].replace(/"/g, "")); + // } + await builder_util_1.spawnAndWrite(command, args, script, { + // we use NSIS_CONFIG_CONST_DATA_PATH=no to build makensis on Linux, but in any case it doesn't use stubs as MacOS/Windows version, so, we explicitly set NSISDIR + env: { ...process.env, NSISDIR: nsisPath }, + cwd: nsisUtil_1.nsisTemplatesDir, + }); + } + async computeCommonInstallerScriptHeader() { + const packager = this.packager; + const options = this.options; + const scriptGenerator = new nsisScriptGenerator_1.NsisScriptGenerator(); + const langConfigurator = new nsisLang_1.LangConfigurator(options); + scriptGenerator.include(path.join(nsisUtil_1.nsisTemplatesDir, "include", "StdUtils.nsh")); + const includeDir = path.join(nsisUtil_1.nsisTemplatesDir, "include"); + scriptGenerator.addIncludeDir(includeDir); + scriptGenerator.flags(["updated", "force-run", "keep-shortcuts", "no-desktop-shortcut", "delete-app-data", "allusers", "currentuser"]); + nsisLang_1.createAddLangsMacro(scriptGenerator, langConfigurator); + const taskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken); + const pluginArch = this.isUnicodeEnabled ? "x86-unicode" : "x86-ansi"; + taskManager.add(async () => { + scriptGenerator.addPluginDir(pluginArch, path.join(await nsisResourcePathPromise(), "plugins", pluginArch)); + }); + taskManager.add(async () => { + const userPluginDir = path.join(packager.info.buildResourcesDir, pluginArch); + const stat = await fs_1.statOrNull(userPluginDir); + if (stat != null && stat.isDirectory()) { + scriptGenerator.addPluginDir(pluginArch, userPluginDir); + } + }); + taskManager.addTask(nsisLang_1.addCustomMessageFileInclude("messages.yml", packager, scriptGenerator, langConfigurator)); + if (!this.isPortable) { + if (options.oneClick === false) { + taskManager.addTask(nsisLang_1.addCustomMessageFileInclude("assistedMessages.yml", packager, scriptGenerator, langConfigurator)); + } + taskManager.add(async () => { + const customInclude = await packager.getResource(this.options.include, "installer.nsh"); + if (customInclude != null) { + scriptGenerator.addIncludeDir(packager.info.buildResourcesDir); + scriptGenerator.include(customInclude); + } + }); + } + await taskManager.awaitTasks(); + return scriptGenerator.build(); + } + async computeFinalScript(originalScript, isInstaller, archs) { + const packager = this.packager; + const options = this.options; + const langConfigurator = new nsisLang_1.LangConfigurator(options); + const scriptGenerator = new nsisScriptGenerator_1.NsisScriptGenerator(); + const taskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken); + if (isInstaller) { + // http://stackoverflow.com/questions/997456/nsis-license-file-based-on-language-selection + taskManager.add(() => nsisLicense_1.computeLicensePage(packager, options, scriptGenerator, langConfigurator.langs)); + } + await taskManager.awaitTasks(); + if (this.isPortable) { + return scriptGenerator.build() + originalScript; + } + const preCompressedFileExtensions = this.getPreCompressedFileExtensions(); + if (preCompressedFileExtensions != null && preCompressedFileExtensions.length !== 0) { + for (const [arch, dir] of archs.entries()) { + await generateForPreCompressed(preCompressedFileExtensions, dir, arch, scriptGenerator); + } + } + const fileAssociations = packager.fileAssociations; + if (fileAssociations.length !== 0) { + scriptGenerator.include(path.join(path.join(nsisUtil_1.nsisTemplatesDir, "include"), "FileAssociation.nsh")); + if (isInstaller) { + const registerFileAssociationsScript = new nsisScriptGenerator_1.NsisScriptGenerator(); + for (const item of fileAssociations) { + const extensions = builder_util_1.asArray(item.ext).map(platformPackager_1.normalizeExt); + for (const ext of extensions) { + const customIcon = await packager.getResource(builder_util_1.getPlatformIconFileName(item.icon, false), `${extensions[0]}.ico`); + let installedIconPath = "$appExe,0"; + if (customIcon != null) { + installedIconPath = `$INSTDIR\\resources\\${path.basename(customIcon)}`; + registerFileAssociationsScript.file(installedIconPath, customIcon); + } + const icon = `"${installedIconPath}"`; + const commandText = `"Open with ${packager.appInfo.productName}"`; + const command = '"$appExe $\\"%1$\\""'; + registerFileAssociationsScript.insertMacro("APP_ASSOCIATE", `"${ext}" "${item.name || ext}" "${item.description || ""}" ${icon} ${commandText} ${command}`); + } + } + scriptGenerator.macro("registerFileAssociations", registerFileAssociationsScript); + } + else { + const unregisterFileAssociationsScript = new nsisScriptGenerator_1.NsisScriptGenerator(); + for (const item of fileAssociations) { + for (const ext of builder_util_1.asArray(item.ext)) { + unregisterFileAssociationsScript.insertMacro("APP_UNASSOCIATE", `"${platformPackager_1.normalizeExt(ext)}" "${item.name || ext}"`); + } + } + scriptGenerator.macro("unregisterFileAssociations", unregisterFileAssociationsScript); + } + } + return scriptGenerator.build() + originalScript; + } +} +exports.NsisTarget = NsisTarget; +async function generateForPreCompressed(preCompressedFileExtensions, dir, arch, scriptGenerator) { + const resourcesDir = path.join(dir, "resources"); + const dirInfo = await fs_1.statOrNull(resourcesDir); + if (dirInfo == null || !dirInfo.isDirectory()) { + return; + } + const nodeModules = `${path.sep}node_modules`; + const preCompressedAssets = await fs_1.walk(resourcesDir, (file, stat) => { + if (stat.isDirectory()) { + return !file.endsWith(nodeModules); + } + else { + return preCompressedFileExtensions.some(it => file.endsWith(it)); + } + }); + if (preCompressedAssets.length !== 0) { + const macro = new nsisScriptGenerator_1.NsisScriptGenerator(); + for (const file of preCompressedAssets) { + macro.file(`$INSTDIR\\${path.relative(dir, file).replace(/\//g, "\\")}`, file); + } + scriptGenerator.macro(`customFiles_${builder_util_1.Arch[arch]}`, macro); + } +} +async function ensureNotBusy(outFile) { + function isBusy(wasBusyBefore) { + return new Promise((resolve, reject) => { + fs.open(outFile, "r+", (error, fd) => { + try { + if (error != null && error.code === "EBUSY") { + if (!wasBusyBefore) { + builder_util_1.log.info({}, "output file is locked for writing (maybe by virus scanner) => waiting for unlock..."); + } + resolve(false); + } + else if (fd == null) { + resolve(true); + } + else { + fs.close(fd, () => resolve(true)); + } + } + catch (error) { + reject(error); + } + }); + }).then(result => { + if (result) { + return true; + } + else { + return new Promise(resolve => setTimeout(resolve, 2000)).then(() => isBusy(true)); + } + }); + } + await isBusy(false); +} +async function createPackageFileInfo(file) { + return { + path: file, + size: (await fs_extra_1.stat(file)).size, + sha512: await hash_1.hashFile(file), + }; +} +//# sourceMappingURL=NsisTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js.map new file mode 100644 index 0000000000..a65be11f7a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NsisTarget.js","sourceRoot":"","sources":["../../../src/targets/nsis/NsisTarget.ts"],"names":[],"mappings":";;;AAAA,wCAAkC;AAClC,+CAA0C;AAC1C,+CAAoK;AACpK,+DAA4H;AAC5H,4CAA8D;AAC9D,iCAA0B;AAC1B,yBAAwB;AACxB,uCAAiD;AACjD,6BAA4B;AAC5B,mDAAiD;AACjD,qCAAmC;AACnC,2GAAsH;AACtH,6DAAsF;AACtF,0CAA0C;AAC1C,0DAAyD;AACzD,4CAAuC;AACvC,qCAAqC;AAErC,wCAAoD;AACpD,oFAAgK;AAChK,8CAAmG;AAGnG,yCAA+F;AAC/F,+CAAkD;AAElD,+DAA2D;AAC3D,yCAAgH;AAEhH,MAAM,KAAK,GAAG,eAAM,CAAC,uBAAuB,CAAC,CAAA;AAE7C,uCAAuC;AACvC,MAAM,wBAAwB,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAEnF,uCAAuC;AACvC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,2BAAa,CAAC,gBAAgB,EAAE,OAAO,EAAE,0FAA0F,CAAC,CAAA;AAE1K,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAE1C,MAAa,UAAW,SAAQ,aAAM;IAMpC,YAAqB,QAAqB,EAAW,MAAc,EAAE,UAAkB,EAAqB,aAA+B;QACzI,KAAK,CAAC,UAAU,CAAC,CAAA;QADE,aAAQ,GAAR,QAAQ,CAAa;QAAW,WAAM,GAAN,MAAM,CAAQ;QAAyC,kBAAa,GAAb,aAAa,CAAkB;QAH3I,eAAe;QACN,UAAK,GAAsB,IAAI,GAAG,EAAE,CAAA;QAK3C,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAA;QAE7B,IAAI,CAAC,OAAO;YACV,UAAU,KAAK,UAAU;gBACvB,CAAC,CAAC,MAAM,CAAC,MAA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M,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,IAAY;IAC/C,OAAO;QACL,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,CAAC,MAAM,eAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC7B,MAAM,EAAE,MAAM,eAAQ,CAAC,IAAI,CAAC;KAC7B,CAAA;AACH,CAAC","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, exec, executeAppBuilder, getPlatformIconFileName, InvalidConfigurationError, log, spawnAndWrite, use } from \"builder-util\"\nimport { CURRENT_APP_INSTALLER_FILE_NAME, CURRENT_APP_PACKAGE_FILE_NAME, PackageFileInfo, UUID } from \"builder-util-runtime\"\nimport { exists, statOrNull, walk } from \"builder-util/out/fs\"\nimport _debug from \"debug\"\nimport * as fs from \"fs\"\nimport { readFile, stat, unlink } from \"fs-extra\"\nimport * as path from \"path\"\nimport { getBinFromUrl } from \"../../binDownload\"\nimport { Target } from \"../../core\"\nimport { DesktopShortcutCreationPolicy, getEffectiveOptions } from \"../../options/CommonWindowsInstallerConfiguration\"\nimport { computeSafeArtifactNameIfNeeded, normalizeExt } from \"../../platformPackager\"\nimport { hashFile } from \"../../util/hash\"\nimport { isMacOsCatalina } from \"../../util/macosVersion\"\nimport { time } from \"../../util/timer\"\nimport { execWine } from \"../../wine\"\nimport { WinPackager } from \"../../winPackager\"\nimport { archive, ArchiveOptions } from \"../archive\"\nimport { appendBlockmap, configureDifferentialAwareArchiveOptions, createBlockmap, createNsisWebDifferentialUpdateInfo } from \"../differentialUpdateInfoBuilder\"\nimport { getWindowsInstallationAppPackageName, getWindowsInstallationDirName } from \"../targetUtil\"\nimport { Commands } from \"./Commands\"\nimport { Defines } from \"./Defines\"\nimport { addCustomMessageFileInclude, createAddLangsMacro, LangConfigurator } from \"./nsisLang\"\nimport { computeLicensePage } from \"./nsisLicense\"\nimport { NsisOptions, PortableOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { AppPackageHelper, nsisTemplatesDir, NSIS_PATH, UninstallerReader, NsisTargetOptions } from \"./nsisUtil\"\n\nconst debug = _debug(\"electron-builder:nsis\")\n\n// noinspection SpellCheckingInspection\nconst ELECTRON_BUILDER_NS_UUID = UUID.parse(\"50e065bc-3134-11e6-9bab-38c9862bdaf3\")\n\n// noinspection SpellCheckingInspection\nconst nsisResourcePathPromise = () => getBinFromUrl(\"nsis-resources\", \"3.4.1\", \"Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==\")\n\nconst USE_NSIS_BUILT_IN_COMPRESSOR = false\n\nexport class NsisTarget extends Target {\n readonly options: NsisOptions\n\n /** @private */\n readonly archs: Map = new Map()\n\n constructor(readonly packager: WinPackager, readonly outDir: string, targetName: string, protected readonly packageHelper: AppPackageHelper) {\n super(targetName)\n\n this.packageHelper.refCount++\n\n this.options =\n targetName === \"portable\"\n ? Object.create(null)\n : {\n preCompressedFileExtensions: [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"],\n ...this.packager.config.nsis,\n }\n\n if (targetName !== \"nsis\") {\n Object.assign(this.options, (this.packager.config as any)[targetName === \"nsis-web\" ? \"nsisWeb\" : targetName])\n }\n\n const deps = packager.info.metadata.dependencies\n if (deps != null && deps[\"electron-squirrel-startup\"] != null) {\n log.warn('\"electron-squirrel-startup\" dependency is not required for NSIS')\n }\n\n NsisTargetOptions.resolve(this.options)\n }\n\n build(appOutDir: string, arch: Arch) {\n this.archs.set(arch, appOutDir)\n return Promise.resolve()\n }\n\n get isBuildDifferentialAware(): boolean {\n return !this.isPortable && this.options.differentialPackage !== false\n }\n\n private getPreCompressedFileExtensions(): Array | null {\n const result = this.isWebInstaller ? null : this.options.preCompressedFileExtensions\n return result == null ? null : asArray(result).map(it => (it.startsWith(\".\") ? it : `.${it}`))\n }\n\n /** @private */\n async buildAppPackage(appOutDir: string, arch: Arch): Promise {\n const options = this.options\n const packager = this.packager\n\n const isBuildDifferentialAware = this.isBuildDifferentialAware\n const format = !isBuildDifferentialAware && options.useZip ? \"zip\" : \"7z\"\n const archiveFile = path.join(this.outDir, `${packager.appInfo.sanitizedName}-${packager.appInfo.version}-${Arch[arch]}.nsis.${format}`)\n const preCompressedFileExtensions = this.getPreCompressedFileExtensions()\n const archiveOptions: ArchiveOptions = {\n withoutDir: true,\n compression: packager.compression,\n excluded: preCompressedFileExtensions == null ? null : preCompressedFileExtensions.map(it => `*${it}`),\n }\n\n const timer = time(`nsis package, ${Arch[arch]}`)\n await archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions)\n timer.end()\n\n if (isBuildDifferentialAware && this.isWebInstaller) {\n const data = await appendBlockmap(archiveFile)\n return {\n ...data,\n path: archiveFile,\n }\n } else {\n return await createPackageFileInfo(archiveFile)\n }\n }\n\n protected get installerFilenamePattern(): string {\n // tslint:disable:no-invalid-template-strings\n return \"${productName} \" + (this.isPortable ? \"\" : \"Setup \") + \"${version}.${ext}\"\n }\n\n private get isPortable(): boolean {\n return this.name === \"portable\"\n }\n\n async finishBuild(): Promise {\n try {\n const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern)\n const builds = new Set([this.archs])\n if (pattern.includes(\"${arch}\") && this.archs.size > 1) {\n ;[...this.archs].forEach(([arch, appOutDir]) => builds.add(new Map().set(arch, appOutDir)))\n }\n const doBuildArchs = builds.values()\n for (const archs of doBuildArchs) {\n await this.buildInstaller(archs)\n }\n } finally {\n await this.packageHelper.finishBuild()\n }\n }\n\n private async buildInstaller(archs: Map): Promise {\n const primaryArch = archs.size === 1 ? archs.keys().next().value : null\n const packager = this.packager\n const appInfo = packager.appInfo\n const options = this.options\n const installerFilename = packager.expandArtifactNamePattern(\n options,\n \"exe\",\n primaryArch,\n this.installerFilenamePattern,\n false,\n this.packager.platformSpecificBuildOptions.defaultArch\n )\n const oneClick = options.oneClick !== false\n const installerPath = path.join(this.outDir, installerFilename)\n\n const logFields: any = {\n target: this.name,\n file: log.filePath(installerPath),\n archs: Array.from(archs.keys())\n .map(it => Arch[it])\n .join(\", \"),\n }\n const isPerMachine = options.perMachine === true\n\n if (!this.isPortable) {\n logFields.oneClick = oneClick\n logFields.perMachine = isPerMachine\n }\n\n await packager.info.callArtifactBuildStarted(\n {\n targetPresentableName: this.name,\n file: installerPath,\n arch: primaryArch,\n },\n logFields\n )\n\n const guid = options.guid || UUID.v5(appInfo.id, ELECTRON_BUILDER_NS_UUID)\n const uninstallAppKey = guid.replace(/\\\\/g, \" - \")\n const defines: Defines = {\n APP_ID: appInfo.id,\n APP_GUID: guid,\n // Windows bug - entry in Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall cannot have \\ symbols (dir)\n UNINSTALL_APP_KEY: uninstallAppKey,\n PRODUCT_NAME: appInfo.productName,\n PRODUCT_FILENAME: appInfo.productFilename,\n APP_FILENAME: getWindowsInstallationDirName(appInfo, !oneClick || isPerMachine),\n APP_DESCRIPTION: appInfo.description,\n VERSION: appInfo.version,\n\n PROJECT_DIR: packager.projectDir,\n BUILD_RESOURCES_DIR: packager.info.buildResourcesDir,\n\n APP_PACKAGE_NAME: getWindowsInstallationAppPackageName(appInfo.name),\n }\n if (options.customNsisBinary?.debugLogging) {\n defines.ENABLE_LOGGING_ELECTRON_BUILDER = null\n }\n if (uninstallAppKey !== guid) {\n defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\${guid}`\n }\n\n const commands: Commands = {\n OutFile: `\"${installerPath}\"`,\n VIProductVersion: appInfo.getVersionInWeirdWindowsForm(),\n VIAddVersionKey: this.computeVersionKey(),\n Unicode: this.isUnicodeEnabled,\n }\n\n const isPortable = this.isPortable\n const iconPath = (isPortable ? null : await packager.getResource(options.installerIcon, \"installerIcon.ico\")) || (await packager.getIconPath())\n if (iconPath != null) {\n if (isPortable) {\n commands.Icon = `\"${iconPath}\"`\n } else {\n defines.MUI_ICON = iconPath\n defines.MUI_UNICON = iconPath\n }\n }\n\n const packageFiles: { [arch: string]: PackageFileInfo } = {}\n let estimatedSize = 0\n if (this.isPortable && options.useZip) {\n for (const [arch, dir] of archs.entries()) {\n defines[arch === Arch.x64 ? \"APP_DIR_64\" : arch === Arch.arm64 ? \"APP_DIR_ARM64\" : \"APP_DIR_32\"] = dir\n }\n } else if (USE_NSIS_BUILT_IN_COMPRESSOR && archs.size === 1) {\n defines.APP_BUILD_DIR = archs.get(archs.keys().next().value)\n } else {\n await BluebirdPromise.map(archs.keys(), async arch => {\n const fileInfo = await this.packageHelper.packArch(arch, this)\n const file = fileInfo.path\n const defineKey = arch === Arch.x64 ? \"APP_64\" : arch === Arch.arm64 ? \"APP_ARM64\" : \"APP_32\"\n defines[defineKey] = file\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const defineNameKey = `${defineKey}_NAME` as \"APP_64_NAME\" | \"APP_ARM64_NAME\" | \"APP_32_NAME\"\n defines[defineNameKey] = path.basename(file)\n // nsis expect a hexadecimal string\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const defineHashKey = `${defineKey}_HASH` as \"APP_64_HASH\" | \"APP_ARM64_HASH\" | \"APP_32_HASH\"\n defines[defineHashKey] = Buffer.from(fileInfo.sha512, \"base64\").toString(\"hex\").toUpperCase()\n\n if (this.isWebInstaller) {\n await packager.dispatchArtifactCreated(file, this, arch)\n packageFiles[Arch[arch]] = fileInfo\n }\n\n const archiveInfo = (await exec(path7za, [\"l\", file])).trim()\n // after adding blockmap data will be \"Warnings: 1\" in the end of output\n const match = /(\\d+)\\s+\\d+\\s+\\d+\\s+files/.exec(archiveInfo)\n if (match == null) {\n log.warn({ output: archiveInfo }, \"cannot compute size of app package\")\n } else {\n estimatedSize += parseInt(match[1], 10)\n }\n })\n }\n\n this.configureDefinesForAllTypeOfInstaller(defines)\n if (isPortable) {\n const { unpackDirName, requestExecutionLevel, splashImage } = options as PortableOptions\n defines.REQUEST_EXECUTION_LEVEL = requestExecutionLevel || \"user\"\n\n // https://github.com/electron-userland/electron-builder/issues/5764\n if (typeof unpackDirName === \"string\" || !unpackDirName) {\n defines.UNPACK_DIR_NAME = unpackDirName || (await executeAppBuilder([\"ksuid\"]))\n }\n\n if (splashImage != null) {\n defines.SPLASH_IMAGE = path.resolve(packager.projectDir, splashImage)\n }\n } else {\n await this.configureDefines(oneClick, defines)\n }\n\n if (estimatedSize !== 0) {\n // in kb\n defines.ESTIMATED_SIZE = Math.round(estimatedSize / 1024)\n }\n\n if (packager.compression === \"store\") {\n commands.SetCompress = \"off\"\n } else {\n // difference - 33.540 vs 33.601, only 61 KB (but zip is faster to decompress)\n // do not use /SOLID - \"With solid compression, files are uncompressed to temporary file before they are copied to their final destination\",\n // it is not good for portable installer (where built-in NSIS compression is used). http://forums.winamp.com/showpost.php?p=2982902&postcount=6\n commands.SetCompressor = \"zlib\"\n if (!this.isWebInstaller) {\n defines.COMPRESS = \"auto\"\n }\n }\n\n debug(defines)\n debug(commands)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([defines, commands]))) {\n return\n }\n\n // prepare short-version variants of defines and commands, to make an uninstaller that doesn't differ much from the previous one\n const definesUninstaller = { ...defines }\n const commandsUninstaller = { ...commands }\n if (appInfo.shortVersion != null) {\n definesUninstaller.VERSION = appInfo.shortVersion\n commandsUninstaller.VIProductVersion = appInfo.shortVersionWindows\n commandsUninstaller.VIAddVersionKey = this.computeVersionKey(true)\n }\n\n const sharedHeader = await this.computeCommonInstallerScriptHeader()\n const script = isPortable\n ? await readFile(path.join(nsisTemplatesDir, \"portable.nsi\"), \"utf8\")\n : await this.computeScriptAndSignUninstaller(definesUninstaller, commandsUninstaller, installerPath, sharedHeader, archs)\n\n // copy outfile name into main options, as the computeScriptAndSignUninstaller function was kind enough to add important data to temporary defines.\n defines.UNINSTALLER_OUT_FILE = definesUninstaller.UNINSTALLER_OUT_FILE\n\n await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, true, archs)))\n await Promise.all([packager.sign(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : unlink(defines.UNINSTALLER_OUT_FILE)])\n\n const safeArtifactName = computeSafeArtifactNameIfNeeded(installerFilename, () => this.generateGitHubInstallerName())\n let updateInfo: any\n if (this.isWebInstaller) {\n updateInfo = createNsisWebDifferentialUpdateInfo(installerPath, packageFiles)\n } else if (this.isBuildDifferentialAware) {\n updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName)\n }\n\n if (updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper)) {\n updateInfo.isAdminRightsRequired = true\n }\n\n await packager.info.callArtifactBuildCompleted({\n file: installerPath,\n updateInfo,\n target: this,\n packager,\n arch: primaryArch,\n safeArtifactName,\n isWriteUpdateInfo: !this.isPortable,\n })\n }\n\n protected generateGitHubInstallerName(): string {\n const appInfo = this.packager.appInfo\n const classifier = appInfo.name.toLowerCase() === appInfo.name ? \"setup-\" : \"Setup-\"\n return `${appInfo.name}-${this.isPortable ? \"\" : classifier}${appInfo.version}.exe`\n }\n\n private get isUnicodeEnabled(): boolean {\n return this.options.unicode !== false\n }\n\n get isWebInstaller(): boolean {\n return false\n }\n\n private async computeScriptAndSignUninstaller(defines: Defines, commands: Commands, installerPath: string, sharedHeader: string, archs: Map): Promise {\n const packager = this.packager\n const customScriptPath = await packager.getResource(this.options.script, \"installer.nsi\")\n const script = await readFile(customScriptPath || path.join(nsisTemplatesDir, \"installer.nsi\"), \"utf8\")\n\n if (customScriptPath != null) {\n log.info({ reason: \"custom NSIS script is used\" }, \"uninstaller is not signed by electron-builder\")\n return script\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2103\n // it is more safe and reliable to write uninstaller to our out dir\n const uninstallerPath = path.join(this.outDir, `__uninstaller-${this.name}-${this.packager.appInfo.sanitizedName}.exe`)\n const isWin = process.platform === \"win32\"\n defines.BUILD_UNINSTALLER = null\n defines.UNINSTALLER_OUT_FILE = isWin ? uninstallerPath : path.win32.join(\"Z:\", uninstallerPath)\n await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, false, archs)))\n\n // http://forums.winamp.com/showthread.php?p=3078545\n if (isMacOsCatalina()) {\n try {\n await UninstallerReader.exec(installerPath, uninstallerPath)\n } catch (error: any) {\n log.warn(`packager.vm is used: ${error.message}`)\n\n const vm = await packager.vm.value\n await vm.exec(installerPath, [])\n // Parallels VM can exit after command execution, but NSIS continue to be running\n let i = 0\n while (!(await exists(uninstallerPath)) && i++ < 100) {\n // noinspection JSUnusedLocalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n await new Promise((resolve, _reject) => setTimeout(resolve, 300))\n }\n }\n } else {\n await execWine(installerPath, null, [], { env: { __COMPAT_LAYER: \"RunAsInvoker\" } })\n }\n await packager.sign(uninstallerPath, \" Signing NSIS uninstaller\")\n\n delete defines.BUILD_UNINSTALLER\n // platform-specific path, not wine\n defines.UNINSTALLER_OUT_FILE = uninstallerPath\n return script\n }\n\n private computeVersionKey(short = false) {\n // Error: invalid VIProductVersion format, should be X.X.X.X\n // so, we must strip beta\n const localeId = this.options.language || \"1033\"\n const appInfo = this.packager.appInfo\n const versionKey = [\n `/LANG=${localeId} ProductName \"${appInfo.productName}\"`,\n `/LANG=${localeId} ProductVersion \"${appInfo.version}\"`,\n `/LANG=${localeId} LegalCopyright \"${appInfo.copyright}\"`,\n `/LANG=${localeId} FileDescription \"${appInfo.description}\"`,\n `/LANG=${localeId} FileVersion \"${appInfo.buildVersion}\"`,\n ]\n if (short) {\n versionKey[1] = `/LANG=${localeId} ProductVersion \"${appInfo.shortVersion}\"`\n versionKey[4] = `/LANG=${localeId} FileVersion \"${appInfo.shortVersion}\"`\n }\n use(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks \"${it}\"`))\n use(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName \"${it}\"`))\n return versionKey\n }\n\n protected configureDefines(oneClick: boolean, defines: Defines): Promise {\n const packager = this.packager\n const options = this.options\n\n const asyncTaskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n if (oneClick) {\n defines.ONE_CLICK = null\n\n if (options.runAfterFinish !== false) {\n defines.RUN_AFTER_FINISH = null\n }\n\n asyncTaskManager.add(async () => {\n const installerHeaderIcon = await packager.getResource(options.installerHeaderIcon, \"installerHeaderIcon.ico\")\n if (installerHeaderIcon != null) {\n defines.HEADER_ICO = installerHeaderIcon\n }\n })\n } else {\n if (options.runAfterFinish === false) {\n defines.HIDE_RUN_AFTER_FINISH = null\n }\n\n asyncTaskManager.add(async () => {\n const installerHeader = await packager.getResource(options.installerHeader, \"installerHeader.bmp\")\n if (installerHeader != null) {\n defines.MUI_HEADERIMAGE = null\n defines.MUI_HEADERIMAGE_RIGHT = null\n defines.MUI_HEADERIMAGE_BITMAP = installerHeader\n }\n })\n\n asyncTaskManager.add(async () => {\n const bitmap = (await packager.getResource(options.installerSidebar, \"installerSidebar.bmp\")) || \"${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp\"\n defines.MUI_WELCOMEFINISHPAGE_BITMAP = bitmap\n defines.MUI_UNWELCOMEFINISHPAGE_BITMAP = (await packager.getResource(options.uninstallerSidebar, \"uninstallerSidebar.bmp\")) || bitmap\n })\n\n if (options.allowElevation !== false) {\n defines.MULTIUSER_INSTALLMODE_ALLOW_ELEVATION = null\n }\n }\n\n if (options.perMachine === true) {\n defines.INSTALL_MODE_PER_ALL_USERS = null\n }\n\n if (!oneClick || options.perMachine === true) {\n defines.INSTALL_MODE_PER_ALL_USERS_REQUIRED = null\n }\n\n if (options.allowToChangeInstallationDirectory) {\n if (oneClick) {\n throw new InvalidConfigurationError(\"allowToChangeInstallationDirectory makes sense only for assisted installer (please set oneClick to false)\")\n }\n defines.allowToChangeInstallationDirectory = null\n }\n\n if (options.removeDefaultUninstallWelcomePage) {\n defines.removeDefaultUninstallWelcomePage = null\n }\n\n const commonOptions = getEffectiveOptions(options, packager)\n\n if (commonOptions.menuCategory != null) {\n defines.MENU_FILENAME = commonOptions.menuCategory\n }\n\n defines.SHORTCUT_NAME = commonOptions.shortcutName\n\n if (options.deleteAppDataOnUninstall) {\n defines.DELETE_APP_DATA_ON_UNINSTALL = null\n }\n\n asyncTaskManager.add(async () => {\n const uninstallerIcon = await packager.getResource(options.uninstallerIcon, \"uninstallerIcon.ico\")\n if (uninstallerIcon != null) {\n // we don't need to copy MUI_UNICON (defaults to app icon), so, we have 2 defines\n defines.UNINSTALLER_ICON = uninstallerIcon\n defines.MUI_UNICON = uninstallerIcon\n }\n })\n\n defines.UNINSTALL_DISPLAY_NAME = packager.expandMacro(options.uninstallDisplayName || \"${productName} ${version}\", null, {}, false)\n if (commonOptions.isCreateDesktopShortcut === DesktopShortcutCreationPolicy.NEVER) {\n defines.DO_NOT_CREATE_DESKTOP_SHORTCUT = null\n }\n if (commonOptions.isCreateDesktopShortcut === DesktopShortcutCreationPolicy.ALWAYS) {\n defines.RECREATE_DESKTOP_SHORTCUT = null\n }\n if (!commonOptions.isCreateStartMenuShortcut) {\n defines.DO_NOT_CREATE_START_MENU_SHORTCUT = null\n }\n\n if (options.displayLanguageSelector === true) {\n defines.DISPLAY_LANG_SELECTOR = null\n }\n\n return asyncTaskManager.awaitTasks()\n }\n\n private configureDefinesForAllTypeOfInstaller(defines: Defines): void {\n const appInfo = this.packager.appInfo\n const companyName = appInfo.companyName\n if (companyName != null) {\n defines.COMPANY_NAME = companyName\n }\n\n // electron uses product file name as app data, define it as well to remove on uninstall\n if (defines.APP_FILENAME !== appInfo.productFilename) {\n defines.APP_PRODUCT_FILENAME = appInfo.productFilename\n }\n\n if (this.isWebInstaller) {\n defines.APP_PACKAGE_STORE_FILE = `${appInfo.updaterCacheDirName}\\\\${CURRENT_APP_PACKAGE_FILE_NAME}`\n } else {\n defines.APP_INSTALLER_STORE_FILE = `${appInfo.updaterCacheDirName}\\\\${CURRENT_APP_INSTALLER_FILE_NAME}`\n }\n\n if (!this.isWebInstaller && defines.APP_BUILD_DIR == null) {\n const options = this.options\n if (options.useZip) {\n defines.ZIP_COMPRESSION = null\n }\n\n defines.COMPRESSION_METHOD = options.useZip ? \"zip\" : \"7z\"\n }\n }\n\n private async executeMakensis(defines: Defines, commands: Commands, script: string): Promise {\n const args: Array = this.options.warningsAsErrors === false ? [] : [\"-WX\"]\n args.push(\"-INPUTCHARSET\", \"UTF8\")\n for (const name of Object.keys(defines)) {\n const value = defines[name as keyof Defines]\n if (value == null) {\n args.push(`-D${name}`)\n } else {\n args.push(`-D${name}=${value}`)\n }\n }\n\n for (const name of Object.keys(commands)) {\n const value = commands[name as keyof Commands]\n if (Array.isArray(value)) {\n for (const c of value) {\n args.push(`-X${name} ${c}`)\n }\n } else {\n args.push(`-X${name} ${value}`)\n }\n }\n\n args.push(\"-\")\n\n if (this.packager.debugLogger.isEnabled) {\n this.packager.debugLogger.add(\"nsis.script\", script)\n }\n\n const nsisPath = await NSIS_PATH()\n const command = path.join(\n nsisPath,\n process.platform === \"darwin\" ? \"mac\" : process.platform === \"win32\" ? \"Bin\" : \"linux\",\n process.platform === \"win32\" ? \"makensis.exe\" : \"makensis\"\n )\n\n // if (process.platform === \"win32\") {\n // fix for an issue caused by virus scanners, locking the file during write\n // https://github.com/electron-userland/electron-builder/issues/5005\n await ensureNotBusy(commands[\"OutFile\"].replace(/\"/g, \"\"))\n // }\n\n await spawnAndWrite(command, args, script, {\n // we use NSIS_CONFIG_CONST_DATA_PATH=no to build makensis on Linux, but in any case it doesn't use stubs as MacOS/Windows version, so, we explicitly set NSISDIR\n env: { ...process.env, NSISDIR: nsisPath },\n cwd: nsisTemplatesDir,\n })\n }\n\n private async computeCommonInstallerScriptHeader(): Promise {\n const packager = this.packager\n const options = this.options\n const scriptGenerator = new NsisScriptGenerator()\n const langConfigurator = new LangConfigurator(options)\n\n scriptGenerator.include(path.join(nsisTemplatesDir, \"include\", \"StdUtils.nsh\"))\n\n const includeDir = path.join(nsisTemplatesDir, \"include\")\n scriptGenerator.addIncludeDir(includeDir)\n scriptGenerator.flags([\"updated\", \"force-run\", \"keep-shortcuts\", \"no-desktop-shortcut\", \"delete-app-data\", \"allusers\", \"currentuser\"])\n\n createAddLangsMacro(scriptGenerator, langConfigurator)\n\n const taskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n const pluginArch = this.isUnicodeEnabled ? \"x86-unicode\" : \"x86-ansi\"\n taskManager.add(async () => {\n scriptGenerator.addPluginDir(pluginArch, path.join(await nsisResourcePathPromise(), \"plugins\", pluginArch))\n })\n\n taskManager.add(async () => {\n const userPluginDir = path.join(packager.info.buildResourcesDir, pluginArch)\n const stat = await statOrNull(userPluginDir)\n if (stat != null && stat.isDirectory()) {\n scriptGenerator.addPluginDir(pluginArch, userPluginDir)\n }\n })\n\n taskManager.addTask(addCustomMessageFileInclude(\"messages.yml\", packager, scriptGenerator, langConfigurator))\n\n if (!this.isPortable) {\n if (options.oneClick === false) {\n taskManager.addTask(addCustomMessageFileInclude(\"assistedMessages.yml\", packager, scriptGenerator, langConfigurator))\n }\n\n taskManager.add(async () => {\n const customInclude = await packager.getResource(this.options.include, \"installer.nsh\")\n if (customInclude != null) {\n scriptGenerator.addIncludeDir(packager.info.buildResourcesDir)\n scriptGenerator.include(customInclude)\n }\n })\n }\n\n await taskManager.awaitTasks()\n return scriptGenerator.build()\n }\n\n private async computeFinalScript(originalScript: string, isInstaller: boolean, archs: Map): Promise {\n const packager = this.packager\n const options = this.options\n const langConfigurator = new LangConfigurator(options)\n\n const scriptGenerator = new NsisScriptGenerator()\n const taskManager = new AsyncTaskManager(packager.info.cancellationToken)\n\n if (isInstaller) {\n // http://stackoverflow.com/questions/997456/nsis-license-file-based-on-language-selection\n taskManager.add(() => computeLicensePage(packager, options, scriptGenerator, langConfigurator.langs))\n }\n\n await taskManager.awaitTasks()\n\n if (this.isPortable) {\n return scriptGenerator.build() + originalScript\n }\n\n const preCompressedFileExtensions = this.getPreCompressedFileExtensions()\n if (preCompressedFileExtensions != null && preCompressedFileExtensions.length !== 0) {\n for (const [arch, dir] of archs.entries()) {\n await generateForPreCompressed(preCompressedFileExtensions, dir, arch, scriptGenerator)\n }\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length !== 0) {\n scriptGenerator.include(path.join(path.join(nsisTemplatesDir, \"include\"), \"FileAssociation.nsh\"))\n if (isInstaller) {\n const registerFileAssociationsScript = new NsisScriptGenerator()\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n const customIcon = await packager.getResource(getPlatformIconFileName(item.icon, false), `${extensions[0]}.ico`)\n let installedIconPath = \"$appExe,0\"\n if (customIcon != null) {\n installedIconPath = `$INSTDIR\\\\resources\\\\${path.basename(customIcon)}`\n registerFileAssociationsScript.file(installedIconPath, customIcon)\n }\n\n const icon = `\"${installedIconPath}\"`\n const commandText = `\"Open with ${packager.appInfo.productName}\"`\n const command = '\"$appExe $\\\\\"%1$\\\\\"\"'\n registerFileAssociationsScript.insertMacro(\"APP_ASSOCIATE\", `\"${ext}\" \"${item.name || ext}\" \"${item.description || \"\"}\" ${icon} ${commandText} ${command}`)\n }\n }\n scriptGenerator.macro(\"registerFileAssociations\", registerFileAssociationsScript)\n } else {\n const unregisterFileAssociationsScript = new NsisScriptGenerator()\n for (const item of fileAssociations) {\n for (const ext of asArray(item.ext)) {\n unregisterFileAssociationsScript.insertMacro(\"APP_UNASSOCIATE\", `\"${normalizeExt(ext)}\" \"${item.name || ext}\"`)\n }\n }\n scriptGenerator.macro(\"unregisterFileAssociations\", unregisterFileAssociationsScript)\n }\n }\n\n return scriptGenerator.build() + originalScript\n }\n}\n\nasync function generateForPreCompressed(preCompressedFileExtensions: Array, dir: string, arch: Arch, scriptGenerator: NsisScriptGenerator): Promise {\n const resourcesDir = path.join(dir, \"resources\")\n const dirInfo = await statOrNull(resourcesDir)\n if (dirInfo == null || !dirInfo.isDirectory()) {\n return\n }\n\n const nodeModules = `${path.sep}node_modules`\n const preCompressedAssets = await walk(resourcesDir, (file, stat) => {\n if (stat.isDirectory()) {\n return !file.endsWith(nodeModules)\n } else {\n return preCompressedFileExtensions.some(it => file.endsWith(it))\n }\n })\n\n if (preCompressedAssets.length !== 0) {\n const macro = new NsisScriptGenerator()\n for (const file of preCompressedAssets) {\n macro.file(`$INSTDIR\\\\${path.relative(dir, file).replace(/\\//g, \"\\\\\")}`, file)\n }\n scriptGenerator.macro(`customFiles_${Arch[arch]}`, macro)\n }\n}\n\nasync function ensureNotBusy(outFile: string): Promise {\n function isBusy(wasBusyBefore: boolean): Promise {\n return new Promise((resolve, reject) => {\n fs.open(outFile, \"r+\", (error, fd) => {\n try {\n if (error != null && error.code === \"EBUSY\") {\n if (!wasBusyBefore) {\n log.info({}, \"output file is locked for writing (maybe by virus scanner) => waiting for unlock...\")\n }\n resolve(false)\n } else if (fd == null) {\n resolve(true)\n } else {\n fs.close(fd, () => resolve(true))\n }\n } catch (error) {\n reject(error)\n }\n })\n }).then(result => {\n if (result) {\n return true\n } else {\n return new Promise(resolve => setTimeout(resolve, 2000)).then(() => isBusy(true))\n }\n })\n }\n\n await isBusy(false)\n}\n\nasync function createPackageFileInfo(file: string): Promise {\n return {\n path: file,\n size: (await stat(file)).size,\n sha512: await hashFile(file),\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.d.ts new file mode 100644 index 0000000000..867733144b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.d.ts @@ -0,0 +1,11 @@ +import { WinPackager } from "../../winPackager"; +import { NsisTarget } from "./NsisTarget"; +import { AppPackageHelper } from "./nsisUtil"; +/** @private */ +export declare class WebInstallerTarget extends NsisTarget { + constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper); + get isWebInstaller(): boolean; + protected configureDefines(oneClick: boolean, defines: any): Promise; + protected get installerFilenamePattern(): string; + protected generateGitHubInstallerName(): string; +} diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js new file mode 100644 index 0000000000..f0ef26670d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebInstallerTarget = void 0; +const PublishManager_1 = require("../../publish/PublishManager"); +const NsisTarget_1 = require("./NsisTarget"); +/** @private */ +class WebInstallerTarget extends NsisTarget_1.NsisTarget { + constructor(packager, outDir, targetName, packageHelper) { + super(packager, outDir, targetName, packageHelper); + } + get isWebInstaller() { + return true; + } + async configureDefines(oneClick, defines) { + //noinspection ES6MissingAwait + await NsisTarget_1.NsisTarget.prototype.configureDefines.call(this, oneClick, defines); + const packager = this.packager; + const options = this.options; + let appPackageUrl = options.appPackageUrl; + if (appPackageUrl == null) { + const publishConfigs = await PublishManager_1.getPublishConfigsForUpdateInfo(packager, await PublishManager_1.getPublishConfigs(packager, packager.info.config, null, false), null); + if (publishConfigs == null || publishConfigs.length === 0) { + throw new Error("Cannot compute app package download URL"); + } + appPackageUrl = PublishManager_1.computeDownloadUrl(publishConfigs[0], null, packager); + } + defines.APP_PACKAGE_URL_IS_INCOMPLETE = null; + defines.APP_PACKAGE_URL = appPackageUrl; + } + get installerFilenamePattern() { + // tslint:disable:no-invalid-template-strings + return "${productName} Web Setup ${version}.${ext}"; + } + generateGitHubInstallerName() { + const appInfo = this.packager.appInfo; + const classifier = appInfo.name.toLowerCase() === appInfo.name ? "web-setup" : "WebSetup"; + return `${appInfo.name}-${classifier}-${appInfo.version}.exe`; + } +} +exports.WebInstallerTarget = WebInstallerTarget; +//# sourceMappingURL=WebInstallerTarget.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js.map new file mode 100644 index 0000000000..23c42358b6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js.map @@ -0,0 +1 @@ +{"version":3,"file":"WebInstallerTarget.js","sourceRoot":"","sources":["../../../src/targets/nsis/WebInstallerTarget.ts"],"names":[],"mappings":";;;AAAA,iEAAoH;AAGpH,6CAAyC;AAGzC,eAAe;AACf,MAAa,kBAAmB,SAAQ,uBAAU;IAChD,YAAY,QAAqB,EAAE,MAAc,EAAE,UAAkB,EAAE,aAA+B;QACpG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,QAAiB,EAAE,OAAY;QAC9D,8BAA8B;QAC9B,MAAO,uBAAU,CAAC,SAAgC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QAEjG,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAyB,CAAA;QAE9C,IAAI,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;QACzC,IAAI,aAAa,IAAI,IAAI,EAAE;YACzB,MAAM,cAAc,GAAG,MAAM,+CAA8B,CAAC,QAAQ,EAAE,MAAM,kCAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;YACjJ,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;aAC3D;YAED,aAAa,GAAG,mCAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;SACtE;QAED,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAA;QAC5C,OAAO,CAAC,eAAe,GAAG,aAAa,CAAA;IACzC,CAAC;IAED,IAAc,wBAAwB;QACpC,6CAA6C;QAC7C,OAAO,4CAA4C,CAAA;IACrD,CAAC;IAES,2BAA2B;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAA;QACrC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAA;QACzF,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,IAAI,OAAO,CAAC,OAAO,MAAM,CAAA;IAC/D,CAAC;CACF;AAxCD,gDAwCC","sourcesContent":["import { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from \"../../publish/PublishManager\"\nimport { WinPackager } from \"../../winPackager\"\nimport { NsisWebOptions } from \"./nsisOptions\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport { AppPackageHelper } from \"./nsisUtil\"\n\n/** @private */\nexport class WebInstallerTarget extends NsisTarget {\n constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper) {\n super(packager, outDir, targetName, packageHelper)\n }\n\n get isWebInstaller(): boolean {\n return true\n }\n\n protected async configureDefines(oneClick: boolean, defines: any): Promise {\n //noinspection ES6MissingAwait\n await (NsisTarget.prototype as WebInstallerTarget).configureDefines.call(this, oneClick, defines)\n\n const packager = this.packager\n const options = this.options as NsisWebOptions\n\n let appPackageUrl = options.appPackageUrl\n if (appPackageUrl == null) {\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, packager.info.config, null, false), null)\n if (publishConfigs == null || publishConfigs.length === 0) {\n throw new Error(\"Cannot compute app package download URL\")\n }\n\n appPackageUrl = computeDownloadUrl(publishConfigs[0], null, packager)\n }\n\n defines.APP_PACKAGE_URL_IS_INCOMPLETE = null\n defines.APP_PACKAGE_URL = appPackageUrl\n }\n\n protected get installerFilenamePattern(): string {\n // tslint:disable:no-invalid-template-strings\n return \"${productName} Web Setup ${version}.${ext}\"\n }\n\n protected generateGitHubInstallerName(): string {\n const appInfo = this.packager.appInfo\n const classifier = appInfo.name.toLowerCase() === appInfo.name ? \"web-setup\" : \"WebSetup\"\n return `${appInfo.name}-${classifier}-${appInfo.version}.exe`\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.d.ts new file mode 100644 index 0000000000..4e653109eb --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.d.ts @@ -0,0 +1,10 @@ +import { PlatformPackager } from "../../platformPackager"; +import { NsisOptions } from "./nsisOptions"; +import { NsisScriptGenerator } from "./nsisScriptGenerator"; +export declare class LangConfigurator { + readonly isMultiLang: boolean; + readonly langs: Array; + constructor(options: NsisOptions); +} +export declare function createAddLangsMacro(scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator): void; +export declare function addCustomMessageFileInclude(input: string, packager: PlatformPackager, scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator): Promise; diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js new file mode 100644 index 0000000000..ed81d0a3b1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.addCustomMessageFileInclude = exports.createAddLangsMacro = exports.LangConfigurator = void 0; +const builder_util_1 = require("builder-util"); +const langs_1 = require("../../util/langs"); +const debug_1 = require("debug"); +const fs_extra_1 = require("fs-extra"); +const js_yaml_1 = require("js-yaml"); +const path = require("path"); +const nsisUtil_1 = require("./nsisUtil"); +const debug = debug_1.default("electron-builder:nsis"); +class LangConfigurator { + constructor(options) { + const rawList = options.installerLanguages; + if (options.unicode === false || rawList === null || (Array.isArray(rawList) && rawList.length === 0)) { + this.isMultiLang = false; + } + else { + this.isMultiLang = options.multiLanguageInstaller !== false; + } + if (this.isMultiLang) { + this.langs = rawList == null ? langs_1.bundledLanguages.slice() : builder_util_1.asArray(rawList).map(it => langs_1.toLangWithRegion(it.replace("-", "_"))); + } + else { + this.langs = ["en_US"]; + } + } +} +exports.LangConfigurator = LangConfigurator; +function createAddLangsMacro(scriptGenerator, langConfigurator) { + const result = []; + for (const langWithRegion of langConfigurator.langs) { + let name; + if (langWithRegion === "zh_CN") { + name = "SimpChinese"; + } + else if (langWithRegion === "zh_TW") { + name = "TradChinese"; + } + else if (langWithRegion === "nb_NO") { + name = "Norwegian"; + } + else if (langWithRegion === "pt_BR") { + name = "PortugueseBR"; + } + else { + const lang = langWithRegion.substring(0, langWithRegion.indexOf("_")); + name = langs_1.langIdToName[lang]; + if (name == null) { + throw new Error(`Language name is unknown for ${lang}`); + } + if (name === "Spanish") { + name = "SpanishInternational"; + } + } + result.push(`!insertmacro MUI_LANGUAGE "${name}"`); + } + scriptGenerator.macro("addLangs", result); +} +exports.createAddLangsMacro = createAddLangsMacro; +async function writeCustomLangFile(data, packager) { + const file = await packager.getTempFile("messages.nsh"); + await fs_extra_1.outputFile(file, data); + return file; +} +async function addCustomMessageFileInclude(input, packager, scriptGenerator, langConfigurator) { + const data = js_yaml_1.load(await fs_extra_1.readFile(path.join(nsisUtil_1.nsisTemplatesDir, input), "utf-8")); + const instructions = computeCustomMessageTranslations(data, langConfigurator).join("\n"); + debug(instructions); + scriptGenerator.include(await writeCustomLangFile(instructions, packager)); +} +exports.addCustomMessageFileInclude = addCustomMessageFileInclude; +function computeCustomMessageTranslations(messages, langConfigurator) { + const result = []; + const includedLangs = new Set(langConfigurator.langs); + for (const messageId of Object.keys(messages)) { + const langToTranslations = messages[messageId]; + const unspecifiedLangs = new Set(langConfigurator.langs); + for (const lang of Object.keys(langToTranslations)) { + const langWithRegion = langs_1.toLangWithRegion(lang); + if (!includedLangs.has(langWithRegion)) { + continue; + } + const value = langToTranslations[lang]; + if (value == null) { + throw new Error(`${messageId} not specified for ${lang}`); + } + result.push(`LangString ${messageId} ${langs_1.lcid[langWithRegion]} "${value.replace(/\n/g, "$\\r$\\n")}"`); + unspecifiedLangs.delete(langWithRegion); + } + if (langConfigurator.isMultiLang) { + const defaultTranslation = langToTranslations.en.replace(/\n/g, "$\\r$\\n"); + for (const langWithRegion of unspecifiedLangs) { + result.push(`LangString ${messageId} ${langs_1.lcid[langWithRegion]} "${defaultTranslation}"`); + } + } + } + return result; +} +//# sourceMappingURL=nsisLang.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js.map new file mode 100644 index 0000000000..de03ef5157 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nsisLang.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisLang.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,4CAAyF;AACzF,iCAA0B;AAC1B,uCAA+C;AAC/C,qCAA8B;AAC9B,6BAA4B;AAI5B,yCAA6C;AAE7C,MAAM,KAAK,GAAG,eAAM,CAAC,uBAAuB,CAAC,CAAA;AAE7C,MAAa,gBAAgB;IAI3B,YAAY,OAAoB;QAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAA;QAE1C,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK,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AAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7C,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAA;QAC9C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;QACxD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE;YAClD,MAAM,cAAc,GAAG,wBAAgB,CAAC,IAAI,CAAC,CAAA;YAE7C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;gBACtC,SAAQ;aACT;YAED,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;YACtC,IAAI,KAAK,IAAI,IAAI,EAAE;gBACjB,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,sBAAsB,IAAI,EAAE,CAAC,CAAA;aAC1D;YAED,MAAM,CAAC,IAAI,CAAC,cAAc,SAAS,IAAI,YAAI,CAAC,cAAc,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAA;YACpG,gBAAgB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;SACxC;QAED,IAAI,gBAAgB,CAAC,WAAW,EAAE;YAChC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YAC3E,KAAK,MAAM,cAAc,IAAI,gBAAgB,EAAE;gBAC7C,MAAM,CAAC,IAAI,CAAC,cAAc,SAAS,IAAI,YAAI,CAAC,cAAc,CAAC,KAAK,kBAAkB,GAAG,CAAC,CAAA;aACvF;SACF;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { asArray } from \"builder-util\"\nimport { bundledLanguages, langIdToName, lcid, toLangWithRegion } from \"../../util/langs\"\nimport _debug from \"debug\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport { PlatformPackager } from \"../../platformPackager\"\nimport { NsisOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { nsisTemplatesDir } from \"./nsisUtil\"\n\nconst debug = _debug(\"electron-builder:nsis\")\n\nexport class LangConfigurator {\n readonly isMultiLang: boolean\n readonly langs: Array\n\n constructor(options: NsisOptions) {\n const rawList = options.installerLanguages\n\n if (options.unicode === false || rawList === null || (Array.isArray(rawList) && rawList.length === 0)) {\n this.isMultiLang = false\n } else {\n this.isMultiLang = options.multiLanguageInstaller !== false\n }\n\n if (this.isMultiLang) {\n this.langs = rawList == null ? bundledLanguages.slice() : asArray(rawList).map(it => toLangWithRegion(it.replace(\"-\", \"_\")))\n } else {\n this.langs = [\"en_US\"]\n }\n }\n}\n\nexport function createAddLangsMacro(scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator) {\n const result: Array = []\n for (const langWithRegion of langConfigurator.langs) {\n let name: string\n if (langWithRegion === \"zh_CN\") {\n name = \"SimpChinese\"\n } else if (langWithRegion === \"zh_TW\") {\n name = \"TradChinese\"\n } else if (langWithRegion === \"nb_NO\") {\n name = \"Norwegian\"\n } else if (langWithRegion === \"pt_BR\") {\n name = \"PortugueseBR\"\n } else {\n const lang = langWithRegion.substring(0, langWithRegion.indexOf(\"_\"))\n name = (langIdToName as any)[lang]\n if (name == null) {\n throw new Error(`Language name is unknown for ${lang}`)\n }\n\n if (name === \"Spanish\") {\n name = \"SpanishInternational\"\n }\n }\n result.push(`!insertmacro MUI_LANGUAGE \"${name}\"`)\n }\n\n scriptGenerator.macro(\"addLangs\", result)\n}\n\nasync function writeCustomLangFile(data: string, packager: PlatformPackager) {\n const file = await packager.getTempFile(\"messages.nsh\")\n await outputFile(file, data)\n return file\n}\n\nexport async function addCustomMessageFileInclude(input: string, packager: PlatformPackager, scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator) {\n const data = load(await readFile(path.join(nsisTemplatesDir, input), \"utf-8\"))\n const instructions = computeCustomMessageTranslations(data, langConfigurator).join(\"\\n\")\n debug(instructions)\n scriptGenerator.include(await writeCustomLangFile(instructions, packager))\n}\n\nfunction computeCustomMessageTranslations(messages: any, langConfigurator: LangConfigurator): Array {\n const result: Array = []\n const includedLangs = new Set(langConfigurator.langs)\n for (const messageId of Object.keys(messages)) {\n const langToTranslations = messages[messageId]\n const unspecifiedLangs = new Set(langConfigurator.langs)\n for (const lang of Object.keys(langToTranslations)) {\n const langWithRegion = toLangWithRegion(lang)\n\n if (!includedLangs.has(langWithRegion)) {\n continue\n }\n\n const value = langToTranslations[lang]\n if (value == null) {\n throw new Error(`${messageId} not specified for ${lang}`)\n }\n\n result.push(`LangString ${messageId} ${lcid[langWithRegion]} \"${value.replace(/\\n/g, \"$\\\\r$\\\\n\")}\"`)\n unspecifiedLangs.delete(langWithRegion)\n }\n\n if (langConfigurator.isMultiLang) {\n const defaultTranslation = langToTranslations.en.replace(/\\n/g, \"$\\\\r$\\\\n\")\n for (const langWithRegion of unspecifiedLangs) {\n result.push(`LangString ${messageId} ${lcid[langWithRegion]} \"${defaultTranslation}\"`)\n }\n }\n }\n return result\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.d.ts new file mode 100644 index 0000000000..fedb716f7a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.d.ts @@ -0,0 +1,4 @@ +import { WinPackager } from "../../winPackager"; +import { NsisOptions } from "./nsisOptions"; +import { NsisScriptGenerator } from "./nsisScriptGenerator"; +export declare function computeLicensePage(packager: WinPackager, options: NsisOptions, scriptGenerator: NsisScriptGenerator, languages: Array): Promise; diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js new file mode 100644 index 0000000000..58b7c31fa1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeLicensePage = void 0; +const langs_1 = require("../../util/langs"); +const license_1 = require("../../util/license"); +const path = require("path"); +const nsisUtil_1 = require("./nsisUtil"); +async function computeLicensePage(packager, options, scriptGenerator, languages) { + const license = await license_1.getNotLocalizedLicenseFile(options.license, packager); + if (license != null) { + let licensePage; + if (license.endsWith(".html")) { + licensePage = [ + "!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow", + "Function LicenseShow", + " FindWindow $R0 `#32770` `` $HWNDPARENT", + " GetDlgItem $R0 $R0 1000", + "EmbedHTML::Load /replace $R0 file://$PLUGINSDIR\\license.html", + "FunctionEnd", + `!insertmacro MUI_PAGE_LICENSE "${path.join(nsisUtil_1.nsisTemplatesDir, "empty-license.txt")}"`, + ]; + } + else { + licensePage = [`!insertmacro MUI_PAGE_LICENSE "${license}"`]; + } + scriptGenerator.macro("licensePage", licensePage); + if (license.endsWith(".html")) { + scriptGenerator.macro("addLicenseFiles", [`File /oname=$PLUGINSDIR\\license.html "${license}"`]); + } + return; + } + const licenseFiles = await license_1.getLicenseFiles(packager); + if (licenseFiles.length === 0) { + return; + } + const licensePage = []; + const unspecifiedLangs = new Set(languages); + let defaultFile = null; + for (const item of licenseFiles) { + unspecifiedLangs.delete(item.langWithRegion); + if (defaultFile == null) { + defaultFile = item.file; + } + licensePage.push(`LicenseLangString MUILicense ${langs_1.lcid[item.langWithRegion] || item.lang} "${item.file}"`); + } + for (const l of unspecifiedLangs) { + licensePage.push(`LicenseLangString MUILicense ${langs_1.lcid[l]} "${defaultFile}"`); + } + licensePage.push('!insertmacro MUI_PAGE_LICENSE "$(MUILicense)"'); + scriptGenerator.macro("licensePage", licensePage); +} +exports.computeLicensePage = computeLicensePage; +//# sourceMappingURL=nsisLicense.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js.map new file mode 100644 index 0000000000..0db9d3fbbd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nsisLicense.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisLicense.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,gDAAgF;AAChF,6BAA4B;AAI5B,yCAA6C;AAEtC,KAAK,UAAU,kBAAkB,CAAC,QAAqB,EAAE,OAAoB,EAAE,eAAoC,EAAE,SAAwB;IAClJ,MAAM,OAAO,GAAG,MAAM,oCAA0B,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC3E,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,IAAI,WAA0B,CAAA;QAC9B,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC7B,WAAW,GAAG;gBACZ,kDAAkD;gBAClD,sBAAsB;gBACtB,0CAA0C;gBAC1C,2BAA2B;gBAC3B,+DAA+D;gBAC/D,aAAa;gBAEb,kCAAkC,IAAI,CAAC,IAAI,CAAC,2BAAgB,EAAE,mBAAmB,CAAC,GAAG;aACtF,CAAA;SACF;aAAM;YACL,WAAW,GAAG,CAAC,kCAAkC,OAAO,GAAG,CAAC,CAAA;SAC7D;QAED,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;QACjD,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC7B,eAAe,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,0CAA0C,OAAO,GAAG,CAAC,CAAC,CAAA;SACjG;QACD,OAAM;KACP;IAED,MAAM,YAAY,GAAG,MAAM,yBAAe,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAM;KACP;IAED,MAAM,WAAW,GAAkB,EAAE,CAAA;IACrC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;IAE3C,IAAI,WAAW,GAAkB,IAAI,CAAA;IACrC,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE;QAC/B,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC5C,IAAI,WAAW,IAAI,IAAI,EAAE;YACvB,WAAW,GAAG,IAAI,CAAC,IAAI,CAAA;SACxB;QACD,WAAW,CAAC,IAAI,CAAC,gCAAgC,YAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;KAC1G;IAED,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;QAChC,WAAW,CAAC,IAAI,CAAC,gCAAgC,YAAI,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG,CAAC,CAAA;KAC7E;IAED,WAAW,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;IACjE,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACnD,CAAC;AAjDD,gDAiDC","sourcesContent":["import { lcid } from \"../../util/langs\"\nimport { getLicenseFiles, getNotLocalizedLicenseFile } from \"../../util/license\"\nimport * as path from \"path\"\nimport { WinPackager } from \"../../winPackager\"\nimport { NsisOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { nsisTemplatesDir } from \"./nsisUtil\"\n\nexport async function computeLicensePage(packager: WinPackager, options: NsisOptions, scriptGenerator: NsisScriptGenerator, languages: Array): Promise {\n const license = await getNotLocalizedLicenseFile(options.license, packager)\n if (license != null) {\n let licensePage: Array\n if (license.endsWith(\".html\")) {\n licensePage = [\n \"!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow\",\n \"Function LicenseShow\",\n \" FindWindow $R0 `#32770` `` $HWNDPARENT\",\n \" GetDlgItem $R0 $R0 1000\",\n \"EmbedHTML::Load /replace $R0 file://$PLUGINSDIR\\\\license.html\",\n \"FunctionEnd\",\n\n `!insertmacro MUI_PAGE_LICENSE \"${path.join(nsisTemplatesDir, \"empty-license.txt\")}\"`,\n ]\n } else {\n licensePage = [`!insertmacro MUI_PAGE_LICENSE \"${license}\"`]\n }\n\n scriptGenerator.macro(\"licensePage\", licensePage)\n if (license.endsWith(\".html\")) {\n scriptGenerator.macro(\"addLicenseFiles\", [`File /oname=$PLUGINSDIR\\\\license.html \"${license}\"`])\n }\n return\n }\n\n const licenseFiles = await getLicenseFiles(packager)\n if (licenseFiles.length === 0) {\n return\n }\n\n const licensePage: Array = []\n const unspecifiedLangs = new Set(languages)\n\n let defaultFile: string | null = null\n for (const item of licenseFiles) {\n unspecifiedLangs.delete(item.langWithRegion)\n if (defaultFile == null) {\n defaultFile = item.file\n }\n licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} \"${item.file}\"`)\n }\n\n for (const l of unspecifiedLangs) {\n licensePage.push(`LicenseLangString MUILicense ${lcid[l]} \"${defaultFile}\"`)\n }\n\n licensePage.push('!insertmacro MUI_PAGE_LICENSE \"$(MUILicense)\"')\n scriptGenerator.macro(\"licensePage\", licensePage)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.d.ts new file mode 100644 index 0000000000..2cdb3ed82a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.d.ts @@ -0,0 +1,215 @@ +import { TargetSpecificOptions } from "../../core"; +import { CommonWindowsInstallerConfiguration } from "../.."; +interface CustomNsisBinary { + /** + * @default https://github.com/electron-userland/electron-builder-binaries/releases/download + */ + readonly url: string | null; + /** + * @default VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q== + */ + readonly checksum?: string | null; + /** + * @default 3.0.4.1 + */ + readonly version?: string | null; + /** + * Whether or not to enable NSIS logging for debugging. + * Note: Requires a debug-enabled NSIS build. + * electron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary` + * In your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText` + */ + readonly debugLogging?: boolean | null; +} +export interface CommonNsisOptions { + /** + * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode). + * @default true + */ + readonly unicode?: boolean; + /** + * See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name). + */ + readonly guid?: string | null; + /** + * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings. + * @default true + */ + readonly warningsAsErrors?: boolean; + /** + * @private + * @default false + */ + readonly useZip?: boolean; + /** + * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`) + */ + readonly customNsisBinary?: CustomNsisBinary | null; +} +export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions { + /** + * Whether to create one-click installer or assisted. + * @default true + */ + readonly oneClick?: boolean; + /** + * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine). + * + * If `oneClick` is `true` (default): Whether to install per all users (per-machine). + * + * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine. + * + * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page. + * @default false + */ + readonly perMachine?: boolean; + /** + * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions. + * @default true + */ + readonly allowElevation?: boolean; + /** + * *assisted installer only.* Whether to allow user to change installation directory. + * @default false + */ + readonly allowToChangeInstallationDirectory?: boolean; + /** + * *assisted installer only.* remove the default uninstall welcome page. + * @default false + */ + readonly removeDefaultUninstallWelcomePage?: boolean; + /** + * The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to `build/installerIcon.ico` or application icon. + */ + readonly installerIcon?: string | null; + /** + * The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to `build/uninstallerIcon.ico` or application icon. + */ + readonly uninstallerIcon?: string | null; + /** + * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * @default build/installerHeader.bmp + */ + readonly installerHeader?: string | null; + /** + * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to `build/installerHeaderIcon.ico` or application icon. + */ + readonly installerHeaderIcon?: string | null; + /** + * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`. Image size 164 × 314 pixels. + */ + readonly installerSidebar?: string | null; + /** + * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. + * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp` + */ + readonly uninstallerSidebar?: string | null; + /** + * The uninstaller display name in the control panel. + * @default ${productName} ${version} + */ + readonly uninstallDisplayName?: string; + /** + * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script). + */ + readonly include?: string | null; + /** + * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script). + */ + readonly script?: string | null; + /** + * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target="_blank"` for links). + * + * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources. + * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js). + * + * Appropriate license file will be selected by user OS language. + */ + readonly license?: string | null; + /** + * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`. + */ + readonly artifactName?: string | null; + /** + * *one-click installer only.* Whether to delete app data on uninstall. + * @default false + */ + readonly deleteAppDataOnUninstall?: boolean; + /** + * @private + */ + differentialPackage?: boolean; + /** + * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language). + * @default false + */ + readonly displayLanguageSelector?: boolean; + /** + * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what. + */ + readonly installerLanguages?: Array | string | null; + /** + * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`). + */ + readonly language?: string | null; + /** + * Whether to create multi-language installer. Defaults to `unicode` option value. + */ + readonly multiLanguageInstaller?: boolean; + /** + * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`. + * @default true + */ + readonly packElevateHelper?: boolean; + /** + * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files. + * @default [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"] + */ + readonly preCompressedFileExtensions?: Array | string | null; +} +/** + * Portable options. + */ +export interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions { + /** + * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows. + * @default user + */ + readonly requestExecutionLevel?: "user" | "highest" | "admin"; + /** + * The unpack directory for the portable app resources. + * + * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory + * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application. + * + * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable). + */ + readonly unpackDirName?: string | boolean; + /** + * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image. + */ + readonly splashImage?: string | null; +} +/** + * Web Installer options. + */ +export interface NsisWebOptions extends NsisOptions { + /** + * The application package download URL. Optional — by default computed using publish configuration. + * + * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package). + * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878). + * + * Custom `X-Arch` http header is set to `32` or `64`. + */ + readonly appPackageUrl?: string | null; + /** + * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`. + */ + readonly artifactName?: string | null; +} +export {}; diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js new file mode 100644 index 0000000000..b738304700 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=nsisOptions.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js.map new file mode 100644 index 0000000000..39ab711a52 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nsisOptions.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../../core\"\nimport { CommonWindowsInstallerConfiguration } from \"../..\"\n\ninterface CustomNsisBinary {\n /**\n * @default https://github.com/electron-userland/electron-builder-binaries/releases/download\n */\n readonly url: string | null\n\n /**\n * @default VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\n */\n readonly checksum?: string | null\n\n /**\n * @default 3.0.4.1\n */\n readonly version?: string | null\n\n /**\n * Whether or not to enable NSIS logging for debugging.\n * Note: Requires a debug-enabled NSIS build.\n * electron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary`\n * In your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText`\n */\n readonly debugLogging?: boolean | null\n}\nexport interface CommonNsisOptions {\n /**\n * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).\n * @default true\n */\n readonly unicode?: boolean\n\n /**\n * See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).\n */\n readonly guid?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * @private\n * @default false\n */\n readonly useZip?: boolean\n\n /**\n * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)\n */\n readonly customNsisBinary?: CustomNsisBinary | null\n}\n\nexport interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * Whether to create one-click installer or assisted.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n *\n * If `oneClick` is `true` (default): Whether to install per all users (per-machine).\n *\n * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n *\n * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.\n * @default true\n */\n readonly allowElevation?: boolean\n\n /**\n * *assisted installer only.* Whether to allow user to change installation directory.\n * @default false\n */\n readonly allowToChangeInstallationDirectory?: boolean\n\n /**\n * *assisted installer only.* remove the default uninstall welcome page.\n * @default false\n */\n readonly removeDefaultUninstallWelcomePage?: boolean\n\n /**\n * The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to `build/installerIcon.ico` or application icon.\n */\n readonly installerIcon?: string | null\n /**\n * The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to `build/uninstallerIcon.ico` or application icon.\n */\n readonly uninstallerIcon?: string | null\n /**\n * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * @default build/installerHeader.bmp\n */\n readonly installerHeader?: string | null\n /**\n * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to `build/installerHeaderIcon.ico` or application icon.\n */\n readonly installerHeaderIcon?: string | null\n /**\n * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.\n */\n readonly installerSidebar?: string | null\n /**\n * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\n * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`\n */\n readonly uninstallerSidebar?: string | null\n /**\n * The uninstaller display name in the control panel.\n * @default ${productName} ${version}\n */\n readonly uninstallDisplayName?: string\n\n /**\n * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly include?: string | null\n /**\n * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly script?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n *\n * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\n * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n *\n * Appropriate license file will be selected by user OS language.\n */\n readonly license?: string | null\n\n /**\n * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * *one-click installer only.* Whether to delete app data on uninstall.\n * @default false\n */\n readonly deleteAppDataOnUninstall?: boolean\n\n /**\n * @private\n */\n differentialPackage?: boolean\n\n /**\n * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).\n * @default false\n */\n readonly displayLanguageSelector?: boolean\n /**\n * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.\n */\n readonly installerLanguages?: Array | string | null\n /**\n * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).\n */\n readonly language?: string | null\n /**\n * Whether to create multi-language installer. Defaults to `unicode` option value.\n */\n readonly multiLanguageInstaller?: boolean\n /**\n * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.\n * @default true\n */\n readonly packElevateHelper?: boolean\n\n /**\n * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.\n * @default [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"]\n */\n readonly preCompressedFileExtensions?: Array | string | null\n}\n\n/**\n * Portable options.\n */\nexport interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {\n /**\n * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.\n * @default user\n */\n readonly requestExecutionLevel?: \"user\" | \"highest\" | \"admin\"\n\n /**\n * The unpack directory for the portable app resources.\n *\n * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\n * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n *\n * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).\n */\n readonly unpackDirName?: string | boolean\n\n /**\n * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.\n */\n readonly splashImage?: string | null\n}\n\n/**\n * Web Installer options.\n */\nexport interface NsisWebOptions extends NsisOptions {\n /**\n * The application package download URL. Optional — by default computed using publish configuration.\n *\n * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\n * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n *\n * Custom `X-Arch` http header is set to `32` or `64`.\n */\n readonly appPackageUrl?: string | null\n\n /**\n * The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.d.ts new file mode 100644 index 0000000000..51d7648de0 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.d.ts @@ -0,0 +1,11 @@ +export declare class NsisScriptGenerator { + private readonly lines; + addIncludeDir(file: string): void; + addPluginDir(pluginArch: string, dir: string): void; + include(file: string): void; + macro(name: string, lines: Array | NsisScriptGenerator): void; + file(outputName: string | null, file: string): void; + insertMacro(name: string, parameters: string): void; + flags(flags: Array): void; + build(): string; +} diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js new file mode 100644 index 0000000000..19f4b8595e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NsisScriptGenerator = void 0; +class NsisScriptGenerator { + constructor() { + this.lines = []; + } + addIncludeDir(file) { + this.lines.push(`!addincludedir "${file}"`); + } + addPluginDir(pluginArch, dir) { + this.lines.push(`!addplugindir /${pluginArch} "${dir}"`); + } + include(file) { + this.lines.push(`!include "${file}"`); + } + macro(name, lines) { + this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join("\n ")}`, `!macroend\n`); + } + file(outputName, file) { + this.lines.push(`File${outputName == null ? "" : ` "/oname=${outputName}"`} "${file}"`); + } + insertMacro(name, parameters) { + this.lines.push(`!insertmacro ${name} ${parameters}`); + } + // without -- !!! + flags(flags) { + for (const flagName of flags) { + const variableName = getVarNameForFlag(flagName).replace(/[-]+(\w|$)/g, (m, p1) => p1.toUpperCase()); + this.lines.push(`!macro _${variableName} _a _b _t _f + $\{StdUtils.TestParameter} $R9 "${flagName}" + StrCmp "$R9" "true" \`$\{_t}\` \`$\{_f}\` +!macroend +!define ${variableName} \`"" ${variableName} ""\` +`); + } + } + build() { + return this.lines.join("\n") + "\n"; + } +} +exports.NsisScriptGenerator = NsisScriptGenerator; +function getVarNameForFlag(flagName) { + if (flagName === "allusers") { + return "isForAllUsers"; + } + if (flagName === "currentuser") { + return "isForCurrentUser"; + } + return "is" + flagName[0].toUpperCase() + flagName.substring(1); +} +//# sourceMappingURL=nsisScriptGenerator.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js.map new file mode 100644 index 0000000000..7f1669b23d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nsisScriptGenerator.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAAhC;QACmB,UAAK,GAAkB,EAAE,CAAA;IA0C5C,CAAC;IAxCC,aAAa,CAAC,IAAY;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,KAAK,GAAG,GAAG,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,KAA0C;QAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IACpH,CAAC;IAED,IAAI,CAAC,UAAyB,EAAE,IAAY;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,UAAU,GAAG,KAAK,IAAI,GAAG,CAAC,CAAA;IACzF,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,UAAkB;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,UAAU,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,iBAAiB;IACjB,KAAK,CAAC,KAAoB;QACxB,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC5B,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;YACpG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,YAAY;oCACT,QAAQ;;;UAGlC,YAAY,SAAS,YAAY;CAC1C,CAAC,CAAA;SACG;IACH,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACrC,CAAC;CACF;AA3CD,kDA2CC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,eAAe,CAAA;KACvB;IACD,IAAI,QAAQ,KAAK,aAAa,EAAE;QAC9B,OAAO,kBAAkB,CAAA;KAC1B;IACD,OAAO,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["export class NsisScriptGenerator {\n private readonly lines: Array = []\n\n addIncludeDir(file: string) {\n this.lines.push(`!addincludedir \"${file}\"`)\n }\n\n addPluginDir(pluginArch: string, dir: string) {\n this.lines.push(`!addplugindir /${pluginArch} \"${dir}\"`)\n }\n\n include(file: string) {\n this.lines.push(`!include \"${file}\"`)\n }\n\n macro(name: string, lines: Array | NsisScriptGenerator) {\n this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join(\"\\n \")}`, `!macroend\\n`)\n }\n\n file(outputName: string | null, file: string) {\n this.lines.push(`File${outputName == null ? \"\" : ` \"/oname=${outputName}\"`} \"${file}\"`)\n }\n\n insertMacro(name: string, parameters: string) {\n this.lines.push(`!insertmacro ${name} ${parameters}`)\n }\n\n // without -- !!!\n flags(flags: Array) {\n for (const flagName of flags) {\n const variableName = getVarNameForFlag(flagName).replace(/[-]+(\\w|$)/g, (m, p1) => p1.toUpperCase())\n this.lines.push(`!macro _${variableName} _a _b _t _f\n $\\{StdUtils.TestParameter} $R9 \"${flagName}\"\n StrCmp \"$R9\" \"true\" \\`$\\{_t}\\` \\`$\\{_f}\\`\n!macroend\n!define ${variableName} \\`\"\" ${variableName} \"\"\\`\n`)\n }\n }\n\n build() {\n return this.lines.join(\"\\n\") + \"\\n\"\n }\n}\n\nfunction getVarNameForFlag(flagName: string): string {\n if (flagName === \"allusers\") {\n return \"isForAllUsers\"\n }\n if (flagName === \"currentuser\") {\n return \"isForCurrentUser\"\n }\n return \"is\" + flagName[0].toUpperCase() + flagName.substring(1)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.d.ts b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.d.ts new file mode 100644 index 0000000000..9f82295aea --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.d.ts @@ -0,0 +1,27 @@ +import { Arch } from "builder-util"; +import { PackageFileInfo } from "builder-util-runtime"; +import { NsisTarget } from "./NsisTarget"; +import { NsisOptions } from "./nsisOptions"; +export declare const nsisTemplatesDir: string; +export declare const NsisTargetOptions: { + then: (callback: (options: NsisOptions) => any) => Promise; + resolve: (options: NsisOptions) => any; +}; +export declare const NSIS_PATH: () => Promise; +export declare class AppPackageHelper { + private readonly elevateHelper; + private readonly archToFileInfo; + private readonly infoToIsDelete; + /** @private */ + refCount: number; + constructor(elevateHelper: CopyElevateHelper); + packArch(arch: Arch, target: NsisTarget): Promise; + finishBuild(): Promise; +} +export declare class CopyElevateHelper { + private readonly copied; + copy(appOutDir: string, target: NsisTarget): Promise; +} +export declare class UninstallerReader { + static exec(installerPath: string, uninstallerPath: string): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js new file mode 100644 index 0000000000..a63a02f255 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js @@ -0,0 +1,244 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UninstallerReader = exports.CopyElevateHelper = exports.AppPackageHelper = exports.NSIS_PATH = exports.NsisTargetOptions = exports.nsisTemplatesDir = void 0; +const builder_util_1 = require("builder-util"); +const binDownload_1 = require("../../binDownload"); +const fs_1 = require("builder-util/out/fs"); +const path = require("path"); +const pathManager_1 = require("../../util/pathManager"); +const fs = require("fs/promises"); +const zlib = require("zlib"); +exports.nsisTemplatesDir = pathManager_1.getTemplatePath("nsis"); +exports.NsisTargetOptions = (() => { + let _resolve; + const promise = new Promise(resolve => (_resolve = resolve)); + return { + then: (callback) => promise.then(callback), + resolve: (options) => _resolve(options), + }; +})(); +const NSIS_PATH = () => { + const custom = process.env.ELECTRON_BUILDER_NSIS_DIR; + if (custom != null && custom.length > 0) { + return Promise.resolve(custom.trim()); + } + return exports.NsisTargetOptions.then((options) => { + if (options.customNsisBinary) { + const { checksum, url, version } = options.customNsisBinary; + if (checksum && url) { + const binaryVersion = version || checksum.substr(0, 8); + return binDownload_1.getBinFromCustomLoc("nsis", binaryVersion, url, checksum); + } + } + // Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334 + // noinspection SpellCheckingInspection + return binDownload_1.getBinFromUrl("nsis", "3.0.4.1", "VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q=="); + }); +}; +exports.NSIS_PATH = NSIS_PATH; +class AppPackageHelper { + constructor(elevateHelper) { + this.elevateHelper = elevateHelper; + this.archToFileInfo = new Map(); + this.infoToIsDelete = new Map(); + /** @private */ + this.refCount = 0; + } + async packArch(arch, target) { + let infoPromise = this.archToFileInfo.get(arch); + if (infoPromise == null) { + const appOutDir = target.archs.get(arch); + infoPromise = this.elevateHelper.copy(appOutDir, target).then(() => target.buildAppPackage(appOutDir, arch)); + this.archToFileInfo.set(arch, infoPromise); + } + const info = await infoPromise; + if (target.isWebInstaller) { + this.infoToIsDelete.set(info, false); + } + else if (!this.infoToIsDelete.has(info)) { + this.infoToIsDelete.set(info, true); + } + return info; + } + async finishBuild() { + if (--this.refCount > 0) { + return; + } + const filesToDelete = []; + for (const [info, isDelete] of this.infoToIsDelete.entries()) { + if (isDelete) { + filesToDelete.push(info.path); + } + } + await Promise.all(filesToDelete.map(it => fs.unlink(it))); + } +} +exports.AppPackageHelper = AppPackageHelper; +class CopyElevateHelper { + constructor() { + this.copied = new Map(); + } + copy(appOutDir, target) { + if (!target.packager.info.framework.isCopyElevateHelper) { + return Promise.resolve(); + } + let isPackElevateHelper = target.options.packElevateHelper; + if (isPackElevateHelper === false && target.options.perMachine === true) { + isPackElevateHelper = true; + builder_util_1.log.warn("`packElevateHelper = false` is ignored, because `perMachine` is set to `true`"); + } + if (isPackElevateHelper === false) { + return Promise.resolve(); + } + let promise = this.copied.get(appOutDir); + if (promise != null) { + return promise; + } + promise = exports.NSIS_PATH().then(it => { + const outFile = path.join(appOutDir, "resources", "elevate.exe"); + const promise = fs_1.copyFile(path.join(it, "elevate.exe"), outFile, false); + if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) { + return promise.then(() => target.packager.sign(outFile)); + } + return promise; + }); + this.copied.set(appOutDir, promise); + return promise; + } +} +exports.CopyElevateHelper = CopyElevateHelper; +class BinaryReader { + constructor(buffer) { + this._buffer = buffer; + this._position = 0; + } + get length() { + return this._buffer.length; + } + get position() { + return this._position; + } + match(signature) { + if (signature.every((v, i) => this._buffer[this._position + i] === v)) { + this._position += signature.length; + return true; + } + return false; + } + skip(offset) { + this._position += offset; + } + bytes(size) { + const value = this._buffer.subarray(this._position, this._position + size); + this._position += size; + return value; + } + uint16() { + const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8); + this._position += 2; + return value; + } + uint32() { + return this.uint16() | (this.uint16() << 16); + } + string(length) { + let value = ""; + for (let i = 0; i < length; i++) { + const c = this._buffer[this._position + i]; + if (c === 0x00) { + break; + } + value += String.fromCharCode(c); + } + this._position += length; + return value; + } +} +class UninstallerReader { + // noinspection SpellCheckingInspection + static async exec(installerPath, uninstallerPath) { + const buffer = await fs.readFile(installerPath); + const reader = new BinaryReader(buffer); + // IMAGE_DOS_HEADER + if (!reader.match([0x4d, 0x5a])) { + throw new Error("Invalid 'MZ' signature."); + } + reader.skip(58); + // e_lfanew + reader.skip(reader.uint32() - reader.position); + // IMAGE_FILE_HEADER + if (!reader.match([0x50, 0x45, 0x00, 0x00])) { + throw new Error("Invalid 'PE' signature."); + } + reader.skip(2); + const numberOfSections = reader.uint16(); + reader.skip(12); + const sizeOfOptionalHeader = reader.uint16(); + reader.skip(2); + reader.skip(sizeOfOptionalHeader); + // IMAGE_SECTION_HEADER + let nsisOffset = 0; + for (let i = 0; i < numberOfSections; i++) { + const name = reader.string(8); + reader.skip(8); + const rawSize = reader.uint32(); + const rawPointer = reader.uint32(); + reader.skip(16); + switch (name) { + case ".text": + case ".rdata": + case ".data": + case ".rsrc": { + nsisOffset = Math.max(rawPointer + rawSize, nsisOffset); + break; + } + default: { + if (rawPointer !== 0 && rawSize !== 0) { + throw new Error("Unsupported section '" + name + "'."); + } + break; + } + } + } + const executable = buffer.subarray(0, nsisOffset); + const nsisSize = buffer.length - nsisOffset; + const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize)); + const nsisSignature = [0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74]; + nsisReader.uint32(); // ? + if (!nsisReader.match(nsisSignature)) { + throw new Error("Invalid signature."); + } + nsisReader.uint32(); // ? + if (nsisSize !== nsisReader.uint32()) { + throw new Error("Size mismatch."); + } + let innerBuffer = null; + while (true) { + let size = nsisReader.uint32(); + const compressed = (size & 0x80000000) !== 0; + size = size & 0x7fffffff; + if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) { + break; + } + let buffer = nsisReader.bytes(size); + if (compressed) { + buffer = zlib.inflateRawSync(buffer); + } + const innerReader = new BinaryReader(buffer); + innerReader.uint32(); // ? + if (innerReader.match(nsisSignature)) { + if (innerBuffer) { + throw new Error("Multiple inner blocks."); + } + innerBuffer = buffer; + } + } + if (!innerBuffer) { + throw new Error("Inner block not found."); + } + await fs.writeFile(uninstallerPath, executable); + await fs.appendFile(uninstallerPath, innerBuffer); + } +} +exports.UninstallerReader = UninstallerReader; +//# sourceMappingURL=nsisUtil.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js.map b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js.map new file mode 100644 index 0000000000..39b69952e5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nsisUtil.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisUtil.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,mDAAsE;AACtE,4CAA8C;AAC9C,6BAA4B;AAC5B,wDAAwD;AAExD,kCAAiC;AACjC,6BAA4B;AAGf,QAAA,gBAAgB,GAAG,6BAAe,CAAC,MAAM,CAAC,CAAA;AAE1C,QAAA,iBAAiB,GAAG,CAAC,GAAG,EAAE;IACrC,IAAI,QAAuC,CAAA;IAC3C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAc,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAA;IACzE,OA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AAC,QAAQ,GAAG,IAAI,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,MAAM,EAAE;gBAC5G,MAAK;aACN;YACD,IAAI,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACnC,IAAI,UAAU,EAAE;gBACd,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;aACrC;YACD,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;YAC5C,WAAW,CAAC,MAAM,EAAE,CAAA,CAAC,IAAI;YACzB,IAAI,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBACpC,IAAI,WAAW,EAAE;oBACf,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;iBAC1C;gBACD,WAAW,GAAG,MAAM,CAAA;aACrB;SACF;QACD,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;SAC1C;QACD,MAAM,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QAC/C,MAAM,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IACnD,CAAC;CACF;AAtFD,8CAsFC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { PackageFileInfo } from \"builder-util-runtime\"\nimport { getBinFromUrl, getBinFromCustomLoc } from \"../../binDownload\"\nimport { copyFile } from \"builder-util/out/fs\"\nimport * as path from \"path\"\nimport { getTemplatePath } from \"../../util/pathManager\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport * as fs from \"fs/promises\"\nimport * as zlib from \"zlib\"\nimport { NsisOptions } from \"./nsisOptions\"\n\nexport const nsisTemplatesDir = getTemplatePath(\"nsis\")\n\nexport const NsisTargetOptions = (() => {\n let _resolve: (options: NsisOptions) => any\n const promise = new Promise(resolve => (_resolve = resolve))\n return {\n then: (callback: (options: NsisOptions) => any): Promise => promise.then(callback),\n resolve: (options: NsisOptions): any => _resolve(options),\n }\n})()\n\nexport const NSIS_PATH = () => {\n const custom = process.env.ELECTRON_BUILDER_NSIS_DIR\n if (custom != null && custom.length > 0) {\n return Promise.resolve(custom.trim())\n }\n return NsisTargetOptions.then((options: NsisOptions) => {\n if (options.customNsisBinary) {\n const { checksum, url, version } = options.customNsisBinary\n if (checksum && url) {\n const binaryVersion = version || checksum.substr(0, 8)\n return getBinFromCustomLoc(\"nsis\", binaryVersion, url, checksum)\n }\n }\n // Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334\n // noinspection SpellCheckingInspection\n return getBinFromUrl(\"nsis\", \"3.0.4.1\", \"VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\")\n })\n}\n\nexport class AppPackageHelper {\n private readonly archToFileInfo = new Map>()\n private readonly infoToIsDelete = new Map()\n\n /** @private */\n refCount = 0\n\n constructor(private readonly elevateHelper: CopyElevateHelper) {}\n\n async packArch(arch: Arch, target: NsisTarget): Promise {\n let infoPromise = this.archToFileInfo.get(arch)\n if (infoPromise == null) {\n const appOutDir = target.archs.get(arch)!\n infoPromise = this.elevateHelper.copy(appOutDir, target).then(() => target.buildAppPackage(appOutDir, arch))\n this.archToFileInfo.set(arch, infoPromise)\n }\n\n const info = await infoPromise\n if (target.isWebInstaller) {\n this.infoToIsDelete.set(info, false)\n } else if (!this.infoToIsDelete.has(info)) {\n this.infoToIsDelete.set(info, true)\n }\n return info\n }\n\n async finishBuild(): Promise {\n if (--this.refCount > 0) {\n return\n }\n\n const filesToDelete: Array = []\n for (const [info, isDelete] of this.infoToIsDelete.entries()) {\n if (isDelete) {\n filesToDelete.push(info.path)\n }\n }\n\n await Promise.all(filesToDelete.map(it => fs.unlink(it)))\n }\n}\n\nexport class CopyElevateHelper {\n private readonly copied = new Map>()\n\n copy(appOutDir: string, target: NsisTarget): Promise {\n if (!target.packager.info.framework.isCopyElevateHelper) {\n return Promise.resolve()\n }\n\n let isPackElevateHelper = target.options.packElevateHelper\n if (isPackElevateHelper === false && target.options.perMachine === true) {\n isPackElevateHelper = true\n log.warn(\"`packElevateHelper = false` is ignored, because `perMachine` is set to `true`\")\n }\n\n if (isPackElevateHelper === false) {\n return Promise.resolve()\n }\n\n let promise = this.copied.get(appOutDir)\n if (promise != null) {\n return promise\n }\n\n promise = NSIS_PATH().then(it => {\n const outFile = path.join(appOutDir, \"resources\", \"elevate.exe\")\n const promise = copyFile(path.join(it, \"elevate.exe\"), outFile, false)\n if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) {\n return promise.then(() => target.packager.sign(outFile))\n }\n return promise\n })\n this.copied.set(appOutDir, promise)\n return promise\n }\n}\n\nclass BinaryReader {\n private readonly _buffer: Buffer\n private _position: number\n\n constructor(buffer: Buffer) {\n this._buffer = buffer\n this._position = 0\n }\n\n get length(): number {\n return this._buffer.length\n }\n\n get position(): number {\n return this._position\n }\n\n match(signature: Array): boolean {\n if (signature.every((v, i) => this._buffer[this._position + i] === v)) {\n this._position += signature.length\n return true\n }\n return false\n }\n\n skip(offset: number) {\n this._position += offset\n }\n\n bytes(size: number): Buffer {\n const value = this._buffer.subarray(this._position, this._position + size)\n this._position += size\n return value\n }\n\n uint16(): number {\n const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8)\n this._position += 2\n return value\n }\n\n uint32(): number {\n return this.uint16() | (this.uint16() << 16)\n }\n\n string(length: number): string {\n let value = \"\"\n for (let i = 0; i < length; i++) {\n const c = this._buffer[this._position + i]\n if (c === 0x00) {\n break\n }\n value += String.fromCharCode(c)\n }\n this._position += length\n return value\n }\n}\n\nexport class UninstallerReader {\n // noinspection SpellCheckingInspection\n static async exec(installerPath: string, uninstallerPath: string) {\n const buffer = await fs.readFile(installerPath)\n const reader = new BinaryReader(buffer)\n // IMAGE_DOS_HEADER\n if (!reader.match([0x4d, 0x5a])) {\n throw new Error(\"Invalid 'MZ' signature.\")\n }\n reader.skip(58)\n // e_lfanew\n reader.skip(reader.uint32() - reader.position)\n // IMAGE_FILE_HEADER\n if (!reader.match([0x50, 0x45, 0x00, 0x00])) {\n throw new Error(\"Invalid 'PE' signature.\")\n }\n reader.skip(2)\n const numberOfSections = reader.uint16()\n reader.skip(12)\n const sizeOfOptionalHeader = reader.uint16()\n reader.skip(2)\n reader.skip(sizeOfOptionalHeader)\n // IMAGE_SECTION_HEADER\n let nsisOffset = 0\n for (let i = 0; i < numberOfSections; i++) {\n const name = reader.string(8)\n reader.skip(8)\n const rawSize = reader.uint32()\n const rawPointer = reader.uint32()\n reader.skip(16)\n switch (name) {\n case \".text\":\n case \".rdata\":\n case \".data\":\n case \".rsrc\": {\n nsisOffset = Math.max(rawPointer + rawSize, nsisOffset)\n break\n }\n default: {\n if (rawPointer !== 0 && rawSize !== 0) {\n throw new Error(\"Unsupported section '\" + name + \"'.\")\n }\n break\n }\n }\n }\n const executable = buffer.subarray(0, nsisOffset)\n const nsisSize = buffer.length - nsisOffset\n const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize))\n const nsisSignature = [0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74]\n nsisReader.uint32() // ?\n if (!nsisReader.match(nsisSignature)) {\n throw new Error(\"Invalid signature.\")\n }\n nsisReader.uint32() // ?\n if (nsisSize !== nsisReader.uint32()) {\n throw new Error(\"Size mismatch.\")\n }\n\n let innerBuffer = null\n while (true) {\n let size = nsisReader.uint32()\n const compressed = (size & 0x80000000) !== 0\n size = size & 0x7fffffff\n if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) {\n break\n }\n let buffer = nsisReader.bytes(size)\n if (compressed) {\n buffer = zlib.inflateRawSync(buffer)\n }\n const innerReader = new BinaryReader(buffer)\n innerReader.uint32() // ?\n if (innerReader.match(nsisSignature)) {\n if (innerBuffer) {\n throw new Error(\"Multiple inner blocks.\")\n }\n innerBuffer = buffer\n }\n }\n if (!innerBuffer) {\n throw new Error(\"Inner block not found.\")\n }\n await fs.writeFile(uninstallerPath, executable)\n await fs.appendFile(uninstallerPath, innerBuffer)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/pkg.d.ts b/client/node_modules/app-builder-lib/out/targets/pkg.d.ts new file mode 100644 index 0000000000..8d8d303f10 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/pkg.d.ts @@ -0,0 +1,15 @@ +import { Arch } from "builder-util"; +import { PkgOptions } from "../options/pkgOptions"; +import { Identity } from "../codeSign/macCodeSign"; +import { Target } from "../core"; +import MacPackager from "../macPackager"; +export declare class PkgTarget extends Target { + private readonly packager; + readonly outDir: string; + readonly options: PkgOptions; + constructor(packager: MacPackager, outDir: string); + build(appPath: string, arch: Arch): Promise; + private customizeDistributionConfiguration; + private buildComponentPackage; +} +export declare function prepareProductBuildArgs(identity: Identity | null, keychain: string | null | undefined): Array; diff --git a/client/node_modules/app-builder-lib/out/targets/pkg.js b/client/node_modules/app-builder-lib/out/targets/pkg.js new file mode 100644 index 0000000000..be8af119ee --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/pkg.js @@ -0,0 +1,174 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prepareProductBuildArgs = exports.PkgTarget = void 0; +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const appBuilder_1 = require("../util/appBuilder"); +const license_1 = require("../util/license"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const appInfo_1 = require("../appInfo"); +const macCodeSign_1 = require("../codeSign/macCodeSign"); +const core_1 = require("../core"); +const certType = "Developer ID Installer"; +// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/ +// to use --scripts, we must build .app bundle separately using pkgbuild +// productbuild --scripts doesn't work (because scripts in this case not added to our package) +// https://github.com/electron-userland/electron-osx-sign/issues/96#issuecomment-274986942 +class PkgTarget extends core_1.Target { + constructor(packager, outDir) { + super("pkg"); + this.packager = packager; + this.outDir = outDir; + this.options = { + allowAnywhere: true, + allowCurrentUserHome: true, + allowRootDirectory: true, + ...this.packager.config.pkg, + }; + } + async build(appPath, arch) { + const packager = this.packager; + const options = this.options; + const appInfo = packager.appInfo; + // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg) + const artifactName = packager.expandArtifactNamePattern(options, "pkg", arch); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "pkg", + file: artifactPath, + arch, + }); + const keychainFile = (await packager.codeSigningInfo.value).keychainFile; + const appOutDir = this.outDir; + // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html + const distInfoFile = path.join(appOutDir, "distribution.xml"); + const innerPackageFile = path.join(appOutDir, `${appInfo_1.filterCFBundleIdentifier(appInfo.id)}.pkg`); + const componentPropertyListFile = path.join(appOutDir, `${appInfo_1.filterCFBundleIdentifier(appInfo.id)}.plist`); + const identity = (await Promise.all([ + macCodeSign_1.findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile), + this.customizeDistributionConfiguration(distInfoFile, appPath), + this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile), + ]))[0]; + if (identity == null && packager.forceCodeSigning) { + throw new Error(`Cannot find valid "${certType}" to sign standalone installer, please see https://electron.build/code-signing`); + } + const args = prepareProductBuildArgs(identity, keychainFile); + args.push("--distribution", distInfoFile); + args.push(artifactPath); + builder_util_1.use(options.productbuild, it => args.push(...it)); + await builder_util_1.exec("productbuild", args, { + cwd: appOutDir, + }); + await Promise.all([promises_1.unlink(innerPackageFile), promises_1.unlink(distInfoFile)]); + await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "pkg", arch)); + } + async customizeDistributionConfiguration(distInfoFile, appPath) { + await builder_util_1.exec("productbuild", ["--synthesize", "--component", appPath, distInfoFile], { + cwd: this.outDir, + }); + const options = this.options; + let distInfo = await promises_1.readFile(distInfoFile, "utf-8"); + if (options.mustClose != null && options.mustClose.length !== 0) { + const startContent = ` \n \n`; + const endContent = " \n \n"; + let mustCloseContent = ""; + options.mustClose.forEach(appId => { + mustCloseContent += ` \n`; + }); + distInfo = distInfo.replace("", `${startContent}${mustCloseContent}${endContent}`); + } + const insertIndex = distInfo.lastIndexOf(""); + distInfo = + distInfo.substring(0, insertIndex) + + ` \n` + + distInfo.substring(insertIndex); + if (options.background != null) { + const background = await this.packager.getResource(options.background.file); + if (background != null) { + const alignment = options.background.alignment || "center"; + // noinspection SpellCheckingInspection + const scaling = options.background.scaling || "tofit"; + distInfo = distInfo.substring(0, insertIndex) + ` \n` + distInfo.substring(insertIndex); + distInfo = + distInfo.substring(0, insertIndex) + ` \n` + distInfo.substring(insertIndex); + } + } + const welcome = await this.packager.getResource(options.welcome); + if (welcome != null) { + distInfo = distInfo.substring(0, insertIndex) + ` \n` + distInfo.substring(insertIndex); + } + const license = await license_1.getNotLocalizedLicenseFile(options.license, this.packager); + if (license != null) { + distInfo = distInfo.substring(0, insertIndex) + ` \n` + distInfo.substring(insertIndex); + } + const conclusion = await this.packager.getResource(options.conclusion); + if (conclusion != null) { + distInfo = distInfo.substring(0, insertIndex) + ` \n` + distInfo.substring(insertIndex); + } + builder_util_1.debug(distInfo); + await promises_1.writeFile(distInfoFile, distInfo); + } + async buildComponentPackage(appPath, propertyListOutputFile, packageOutputFile) { + const options = this.options; + const rootPath = path.dirname(appPath); + // first produce a component plist template + await builder_util_1.exec("pkgbuild", ["--analyze", "--root", rootPath, propertyListOutputFile]); + // process the template plist + const plistInfo = (await appBuilder_1.executeAppBuilderAsJson(["decode-plist", "-f", propertyListOutputFile]))[0].filter((it) => it.RootRelativeBundlePath !== "Electron.dSYM"); + if (plistInfo.length > 0) { + const packageInfo = plistInfo[0]; + // ChildBundles lists all of electron binaries within the .app. + // There is no particular reason for removing that key, except to be as close as possible to + // the PackageInfo generated by previous versions of electron-builder. + delete packageInfo.ChildBundles; + if (options.isRelocatable != null) { + packageInfo.BundleIsRelocatable = options.isRelocatable; + } + if (options.isVersionChecked != null) { + packageInfo.BundleIsVersionChecked = options.isVersionChecked; + } + if (options.hasStrictIdentifier != null) { + packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier; + } + if (options.overwriteAction != null) { + packageInfo.BundleOverwriteAction = options.overwriteAction; + } + await appBuilder_1.executeAppBuilderAndWriteJson(["encode-plist"], { [propertyListOutputFile]: plistInfo }); + } + // now build the package + const args = [ + "--root", + rootPath, + // "--identifier", this.packager.appInfo.id, + "--component-plist", + propertyListOutputFile, + ]; + builder_util_1.use(this.options.installLocation || "/Applications", it => args.push("--install-location", it)); + if (options.scripts != null) { + args.push("--scripts", path.resolve(this.packager.info.buildResourcesDir, options.scripts)); + } + else if (options.scripts !== null) { + const dir = path.join(this.packager.info.buildResourcesDir, "pkg-scripts"); + const stat = await fs_1.statOrNull(dir); + if (stat != null && stat.isDirectory()) { + args.push("--scripts", dir); + } + } + args.push(packageOutputFile); + await builder_util_1.exec("pkgbuild", args); + } +} +exports.PkgTarget = PkgTarget; +function prepareProductBuildArgs(identity, keychain) { + const args = []; + if (identity != null) { + args.push("--sign", identity.hash); + if (keychain != null) { + args.push("--keychain", keychain); + } + } + return args; +} +exports.prepareProductBuildArgs = prepareProductBuildArgs; +//# sourceMappingURL=pkg.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/pkg.js.map b/client/node_modules/app-builder-lib/out/targets/pkg.js.map new file mode 100644 index 0000000000..7b56e304c8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/pkg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../src/targets/pkg.ts"],"names":[],"mappings":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,KAAK,IAAI,EAAE;YACnC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAA;YAC1E,MAAM,IAAI,GAAG,MAAM,eAAU,CAAC,GAAG,CAAC,CAAA;YAClC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;gBACtC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;aAC5B;SACF;QAED,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAE5B,MAAM,mBAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AAhLD,8BAgLC;AAED,SAAgB,uBAAuB,CAAC,QAAyB,EAAE,QAAmC;IACpG,MAAM,IAAI,GAAkB,EAAE,CAAA;IAC9B,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;SAClC;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AATD,0DASC","sourcesContent":["import { Arch, debug, exec, use } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport MacPackager from \"../macPackager\"\n\nconst certType = \"Developer ID Installer\"\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/electron-osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(private readonly packager: MacPackager, readonly outDir: string) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, \"pkg\", arch))\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) {\n await exec(\"productbuild\", [\"--synthesize\", \"--component\", appPath, distInfoFile], {\n cwd: this.outDir,\n })\n\n const options = this.options\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` \\n \\n`\n const endContent = \" \\n \\n\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` \\n`\n })\n distInfo = distInfo.replace(\"\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n const insertIndex = distInfo.lastIndexOf(\"\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` \\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` \\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` \\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` \\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` \\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` \\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await executeAppBuilderAsJson>([\"decode-plist\", \"-f\", propertyListOutputFile]))[0].filter(\n (it: any) => it.RootRelativeBundlePath !== \"Electron.dSYM\"\n )\n if (plistInfo.length > 0) {\n const packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n\n await executeAppBuilderAndWriteJson([\"encode-plist\"], { [propertyListOutputFile]: plistInfo })\n }\n\n // now build the package\n const args = [\n \"--root\",\n rootPath,\n // \"--identifier\", this.packager.appInfo.id,\n \"--component-plist\",\n propertyListOutputFile,\n ]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n if (options.scripts != null) {\n args.push(\"--scripts\", path.resolve(this.packager.info.buildResourcesDir, options.scripts))\n } else if (options.scripts !== null) {\n const dir = path.join(this.packager.info.buildResourcesDir, \"pkg-scripts\")\n const stat = await statOrNull(dir)\n if (stat != null && stat.isDirectory()) {\n args.push(\"--scripts\", dir)\n }\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | null | undefined): Array {\n const args: Array = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/snap.d.ts b/client/node_modules/app-builder-lib/out/targets/snap.d.ts new file mode 100644 index 0000000000..4772cd2740 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/snap.d.ts @@ -0,0 +1,17 @@ +import { Arch } from "builder-util"; +import { Target } from "../core"; +import { LinuxPackager } from "../linuxPackager"; +import { SnapOptions } from "../options/SnapOptions"; +import { LinuxTargetHelper } from "./LinuxTargetHelper"; +export default class SnapTarget extends Target { + private readonly packager; + private readonly helper; + readonly outDir: string; + readonly options: SnapOptions; + isUseTemplateApp: boolean; + constructor(name: string, packager: LinuxPackager, helper: LinuxTargetHelper, outDir: string); + private replaceDefault; + private createDescriptor; + build(appOutDir: string, arch: Arch): Promise; + private isElectronVersionGreaterOrEqualThan; +} diff --git a/client/node_modules/app-builder-lib/out/targets/snap.js b/client/node_modules/app-builder-lib/out/targets/snap.js new file mode 100644 index 0000000000..4fc30a79fe --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/snap.js @@ -0,0 +1,267 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const fs_extra_1 = require("fs-extra"); +const js_yaml_1 = require("js-yaml"); +const path = require("path"); +const semver = require("semver"); +const core_1 = require("../core"); +const pathManager_1 = require("../util/pathManager"); +const targetUtil_1 = require("./targetUtil"); +const defaultPlugs = ["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]; +class SnapTarget extends core_1.Target { + constructor(name, packager, helper, outDir) { + super(name); + this.packager = packager; + this.helper = helper; + this.outDir = outDir; + this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config[this.name] }; + this.isUseTemplateApp = false; + } + replaceDefault(inList, defaultList) { + const result = builder_util_1.replaceDefault(inList, defaultList); + if (result !== defaultList) { + this.isUseTemplateApp = false; + } + return result; + } + async createDescriptor(arch) { + if (!this.isElectronVersionGreaterOrEqualThan("4.0.0")) { + if (!this.isElectronVersionGreaterOrEqualThan("2.0.0-beta.1")) { + throw new builder_util_1.InvalidConfigurationError("Electron 2 and higher is required to build Snap"); + } + builder_util_1.log.warn("Electron 4 and higher is highly recommended for Snap"); + } + const appInfo = this.packager.appInfo; + const snapName = this.packager.executableName.toLowerCase(); + const options = this.options; + const plugs = normalizePlugConfiguration(this.options.plugs); + const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs); + const slots = normalizePlugConfiguration(this.options.slots); + const buildPackages = builder_util_runtime_1.asArray(options.buildPackages); + const defaultStagePackages = getDefaultStagePackages(); + const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages); + this.isUseTemplateApp = + this.options.useTemplateApp !== false && + (arch === builder_util_1.Arch.x64 || arch === builder_util_1.Arch.armv7l) && + buildPackages.length === 0 && + isArrayEqualRegardlessOfSort(stagePackages, defaultStagePackages); + const appDescriptor = { + command: "command.sh", + plugs: plugNames, + adapter: "none", + }; + const snap = js_yaml_1.load(await fs_extra_1.readFile(path.join(pathManager_1.getTemplatePath("snap"), "snapcraft.yaml"), "utf-8")); + if (this.isUseTemplateApp) { + delete appDescriptor.adapter; + } + if (options.grade != null) { + snap.grade = options.grade; + } + if (options.confinement != null) { + snap.confinement = options.confinement; + } + if (options.appPartStage != null) { + snap.parts.app.stage = options.appPartStage; + } + if (options.layout != null) { + snap.layout = options.layout; + } + if (slots != null) { + appDescriptor.slots = Object.getOwnPropertyNames(slots); + for (const slotName of appDescriptor.slots) { + const slotOptions = slots[slotName]; + if (slotOptions == null) { + continue; + } + if (!snap.slots) { + snap.slots = {}; + } + snap.slots[slotName] = slotOptions; + } + } + builder_util_1.deepAssign(snap, { + name: snapName, + version: appInfo.version, + title: options.title || appInfo.productName, + summary: options.summary || appInfo.productName, + compression: options.compression, + description: this.helper.getDescription(options), + architectures: [builder_util_1.toLinuxArchString(arch, "snap")], + apps: { + [snapName]: appDescriptor, + }, + parts: { + app: { + "stage-packages": stagePackages, + }, + }, + }); + if (options.autoStart) { + appDescriptor.autostart = `${snap.name}.desktop`; + } + if (options.confinement === "classic") { + delete appDescriptor.plugs; + delete snap.plugs; + } + else { + const archTriplet = archNameToTriplet(arch); + appDescriptor.environment = { + DISABLE_WAYLAND: options.allowNativeWayland ? "" : "1", + PATH: "$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH", + SNAP_DESKTOP_RUNTIME: "$SNAP/gnome-platform", + LD_LIBRARY_PATH: [ + "$SNAP_LIBRARY_PATH", + "$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/" + archTriplet + ":$SNAP/usr/lib/" + archTriplet, + "$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib", + "$SNAP/lib/" + archTriplet + ":$SNAP/usr/lib/" + archTriplet, + ].join(":"), + ...options.environment, + }; + if (plugs != null) { + for (const plugName of plugNames) { + const plugOptions = plugs[plugName]; + if (plugOptions == null) { + continue; + } + snap.plugs[plugName] = plugOptions; + } + } + } + if (buildPackages.length > 0) { + snap.parts.app["build-packages"] = buildPackages; + } + if (options.after != null) { + snap.parts.app.after = options.after; + } + if (options.assumes != null) { + snap.assumes = builder_util_runtime_1.asArray(options.assumes); + } + return snap; + } + async build(appOutDir, arch) { + const packager = this.packager; + const options = this.options; + // tslint:disable-next-line:no-invalid-template-strings + const artifactName = packager.expandArtifactNamePattern(this.options, "snap", arch, "${name}_${version}_${arch}.${ext}", false); + const artifactPath = path.join(this.outDir, artifactName); + await packager.info.callArtifactBuildStarted({ + targetPresentableName: "snap", + file: artifactPath, + arch, + }); + const snap = await this.createDescriptor(arch); + const stageDir = await targetUtil_1.createStageDirPath(this, packager, arch); + const snapArch = builder_util_1.toLinuxArchString(arch, "snap"); + const args = ["snap", "--app", appOutDir, "--stage", stageDir, "--arch", snapArch, "--output", artifactPath, "--executable", this.packager.executableName]; + await this.helper.icons; + if (this.helper.maxIconPath != null) { + if (!this.isUseTemplateApp) { + snap.icon = "snap/gui/icon.png"; + } + args.push("--icon", this.helper.maxIconPath); + } + // snapcraft.yaml inside a snap directory + const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? "meta" : "snap"); + const desktopFile = path.join(snapMetaDir, "gui", `${snap.name}.desktop`); + await this.helper.writeDesktopEntry(this.options, packager.executableName + " %U", desktopFile, { + // tslint:disable:no-invalid-template-strings + Icon: "${SNAP}/meta/gui/icon.png", + }); + if (this.isElectronVersionGreaterOrEqualThan("5.0.0") && !isBrowserSandboxAllowed(snap)) { + args.push("--extraAppArgs=--no-sandbox"); + if (this.isUseTemplateApp) { + args.push("--exclude", "chrome-sandbox"); + } + } + if (snap.compression != null) { + args.push("--compression", snap.compression); + } + if (this.isUseTemplateApp) { + // remove fields that are valid in snapcraft.yaml, but not snap.yaml + const fieldsToStrip = ["compression", "contact", "donation", "issues", "parts", "source-code", "website"]; + for (const field of fieldsToStrip) { + delete snap[field]; + } + } + if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed({ snap, desktopFile, args }))) { + return; + } + await fs_extra_1.outputFile(path.join(snapMetaDir, this.isUseTemplateApp ? "snap.yaml" : "snapcraft.yaml"), builder_util_1.serializeToYaml(snap)); + const hooksDir = await packager.getResource(options.hooks, "snap-hooks"); + if (hooksDir != null) { + args.push("--hooks", hooksDir); + } + if (this.isUseTemplateApp) { + args.push("--template-url", `electron4:${snapArch}`); + } + await builder_util_1.executeAppBuilder(args); + await packager.info.callArtifactBuildCompleted({ + file: artifactPath, + safeArtifactName: packager.computeSafeArtifactName(artifactName, "snap", arch, false), + target: this, + arch, + packager, + publishConfig: options.publish == null ? { provider: "snapStore" } : null, + }); + } + isElectronVersionGreaterOrEqualThan(version) { + return semver.gte(this.packager.config.electronVersion || "7.0.0", version); + } +} +exports.default = SnapTarget; +function archNameToTriplet(arch) { + switch (arch) { + case builder_util_1.Arch.x64: + return "x86_64-linux-gnu"; + case builder_util_1.Arch.ia32: + return "i386-linux-gnu"; + case builder_util_1.Arch.armv7l: + // noinspection SpellCheckingInspection + return "arm-linux-gnueabihf"; + case builder_util_1.Arch.arm64: + return "aarch64-linux-gnu"; + default: + throw new Error(`Unsupported arch ${arch}`); + } +} +function isArrayEqualRegardlessOfSort(a, b) { + a = a.slice(); + b = b.slice(); + a.sort(); + b.sort(); + return a.length === b.length && a.every((value, index) => value === b[index]); +} +function normalizePlugConfiguration(raw) { + if (raw == null) { + return null; + } + const result = {}; + for (const item of Array.isArray(raw) ? raw : [raw]) { + if (typeof item === "string") { + result[item] = null; + } + else { + Object.assign(result, item); + } + } + return result; +} +function isBrowserSandboxAllowed(snap) { + if (snap.plugs != null) { + for (const plugName of Object.keys(snap.plugs)) { + const plug = snap.plugs[plugName]; + if (plug.interface === "browser-support" && plug["allow-sandbox"] === true) { + return true; + } + } + } + return false; +} +function getDefaultStagePackages() { + // libxss1 - was "error while loading shared libraries: libXss.so.1" on Xubuntu 16.04 + // noinspection SpellCheckingInspection + return ["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]; +} +//# sourceMappingURL=snap.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/snap.js.map b/client/node_modules/app-builder-lib/out/targets/snap.js.map new file mode 100644 index 0000000000..f94caabc68 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/snap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"snap.js","sourceRoot":"","sources":["../../src/targets/snap.ts"],"names":[],"mappings":";;AAAA,+CAAyK;AACzK,+DAA8C;AAC9C,uCAA+C;AAC/C,qCAA8B;AAC9B,6BAA4B;AAC5B,iCAAgC;AAChC,kCAAgC;AAGhC,qDAAqD;AAErD,6CAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAi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C,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;QACnD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;SACpB;aAAM;YACL,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;SAC5B;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAS;IACxC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE;QACtB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACjC,IAAI,IAAI,CAAC,SAAS,KAAK,iBAAiB,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE;gBAC1E,OAAO,IAAI,CAAA;aACZ;SACF;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,uBAAuB;IAC9B,qFAAqF;IACrF,uCAAuC;IACvC,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAA;AAClF,CAAC","sourcesContent":["import { Arch, deepAssign, executeAppBuilder, InvalidConfigurationError, log, replaceDefault as _replaceDefault, serializeToYaml, toLinuxArchString } from \"builder-util\"\nimport { asArray } from \"builder-util-runtime\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Target } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { PlugDescriptor, SnapOptions } from \"../options/SnapOptions\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { createStageDirPath } from \"./targetUtil\"\n\nconst defaultPlugs = [\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]\n\nexport default class SnapTarget extends Target {\n readonly options: SnapOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n public isUseTemplateApp = false\n\n constructor(name: string, private readonly packager: LinuxPackager, private readonly helper: LinuxTargetHelper, readonly outDir: string) {\n super(name)\n }\n\n private replaceDefault(inList: Array | null | undefined, defaultList: Array) {\n const result = _replaceDefault(inList, defaultList)\n if (result !== defaultList) {\n this.isUseTemplateApp = false\n }\n return result\n }\n\n private async createDescriptor(arch: Arch): Promise {\n if (!this.isElectronVersionGreaterOrEqualThan(\"4.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"2.0.0-beta.1\")) {\n throw new InvalidConfigurationError(\"Electron 2 and higher is required to build Snap\")\n }\n\n log.warn(\"Electron 4 and higher is highly recommended for Snap\")\n }\n\n const appInfo = this.packager.appInfo\n const snapName = this.packager.executableName.toLowerCase()\n const options = this.options\n\n const plugs = normalizePlugConfiguration(this.options.plugs)\n\n const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs)\n\n const slots = normalizePlugConfiguration(this.options.slots)\n\n const buildPackages = asArray(options.buildPackages)\n const defaultStagePackages = getDefaultStagePackages()\n const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages)\n\n this.isUseTemplateApp =\n this.options.useTemplateApp !== false &&\n (arch === Arch.x64 || arch === Arch.armv7l) &&\n buildPackages.length === 0 &&\n isArrayEqualRegardlessOfSort(stagePackages, defaultStagePackages)\n\n const appDescriptor: any = {\n command: \"command.sh\",\n plugs: plugNames,\n adapter: \"none\",\n }\n\n const snap: any = load(await readFile(path.join(getTemplatePath(\"snap\"), \"snapcraft.yaml\"), \"utf-8\"))\n if (this.isUseTemplateApp) {\n delete appDescriptor.adapter\n }\n if (options.grade != null) {\n snap.grade = options.grade\n }\n if (options.confinement != null) {\n snap.confinement = options.confinement\n }\n if (options.appPartStage != null) {\n snap.parts.app.stage = options.appPartStage\n }\n if (options.layout != null) {\n snap.layout = options.layout\n }\n if (slots != null) {\n appDescriptor.slots = Object.getOwnPropertyNames(slots)\n for (const slotName of appDescriptor.slots) {\n const slotOptions = slots[slotName]\n if (slotOptions == null) {\n continue\n }\n if (!snap.slots) {\n snap.slots = {}\n }\n snap.slots[slotName] = slotOptions\n }\n }\n\n deepAssign(snap, {\n name: snapName,\n version: appInfo.version,\n title: options.title || appInfo.productName,\n summary: options.summary || appInfo.productName,\n compression: options.compression,\n description: this.helper.getDescription(options),\n architectures: [toLinuxArchString(arch, \"snap\")],\n apps: {\n [snapName]: appDescriptor,\n },\n parts: {\n app: {\n \"stage-packages\": stagePackages,\n },\n },\n })\n\n if (options.autoStart) {\n appDescriptor.autostart = `${snap.name}.desktop`\n }\n\n if (options.confinement === \"classic\") {\n delete appDescriptor.plugs\n delete snap.plugs\n } else {\n const archTriplet = archNameToTriplet(arch)\n appDescriptor.environment = {\n DISABLE_WAYLAND: options.allowNativeWayland ? \"\" : \"1\",\n PATH: \"$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH\",\n SNAP_DESKTOP_RUNTIME: \"$SNAP/gnome-platform\",\n LD_LIBRARY_PATH: [\n \"$SNAP_LIBRARY_PATH\",\n \"$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n \"$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib\",\n \"$SNAP/lib/\" + archTriplet + \":$SNAP/usr/lib/\" + archTriplet,\n ].join(\":\"),\n ...options.environment,\n }\n\n if (plugs != null) {\n for (const plugName of plugNames) {\n const plugOptions = plugs[plugName]\n if (plugOptions == null) {\n continue\n }\n\n snap.plugs[plugName] = plugOptions\n }\n }\n }\n\n if (buildPackages.length > 0) {\n snap.parts.app[\"build-packages\"] = buildPackages\n }\n if (options.after != null) {\n snap.parts.app.after = options.after\n }\n\n if (options.assumes != null) {\n snap.assumes = asArray(options.assumes)\n }\n\n return snap\n }\n\n async build(appOutDir: string, arch: Arch): Promise {\n const packager = this.packager\n const options = this.options\n // tslint:disable-next-line:no-invalid-template-strings\n const artifactName = packager.expandArtifactNamePattern(this.options, \"snap\", arch, \"${name}_${version}_${arch}.${ext}\", false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"snap\",\n file: artifactPath,\n arch,\n })\n\n const snap = await this.createDescriptor(arch)\n\n const stageDir = await createStageDirPath(this, packager, arch)\n const snapArch = toLinuxArchString(arch, \"snap\")\n const args = [\"snap\", \"--app\", appOutDir, \"--stage\", stageDir, \"--arch\", snapArch, \"--output\", artifactPath, \"--executable\", this.packager.executableName]\n\n await this.helper.icons\n if (this.helper.maxIconPath != null) {\n if (!this.isUseTemplateApp) {\n snap.icon = \"snap/gui/icon.png\"\n }\n args.push(\"--icon\", this.helper.maxIconPath)\n }\n\n // snapcraft.yaml inside a snap directory\n const snapMetaDir = path.join(stageDir, this.isUseTemplateApp ? \"meta\" : \"snap\")\n const desktopFile = path.join(snapMetaDir, \"gui\", `${snap.name}.desktop`)\n await this.helper.writeDesktopEntry(this.options, packager.executableName + \" %U\", desktopFile, {\n // tslint:disable:no-invalid-template-strings\n Icon: \"${SNAP}/meta/gui/icon.png\",\n })\n\n if (this.isElectronVersionGreaterOrEqualThan(\"5.0.0\") && !isBrowserSandboxAllowed(snap)) {\n args.push(\"--extraAppArgs=--no-sandbox\")\n if (this.isUseTemplateApp) {\n args.push(\"--exclude\", \"chrome-sandbox\")\n }\n }\n\n if (snap.compression != null) {\n args.push(\"--compression\", snap.compression)\n }\n\n if (this.isUseTemplateApp) {\n // remove fields that are valid in snapcraft.yaml, but not snap.yaml\n const fieldsToStrip = [\"compression\", \"contact\", \"donation\", \"issues\", \"parts\", \"source-code\", \"website\"]\n for (const field of fieldsToStrip) {\n delete snap[field]\n }\n }\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed({ snap, desktopFile, args }))) {\n return\n }\n\n await outputFile(path.join(snapMetaDir, this.isUseTemplateApp ? \"snap.yaml\" : \"snapcraft.yaml\"), serializeToYaml(snap))\n\n const hooksDir = await packager.getResource(options.hooks, \"snap-hooks\")\n if (hooksDir != null) {\n args.push(\"--hooks\", hooksDir)\n }\n\n if (this.isUseTemplateApp) {\n args.push(\"--template-url\", `electron4:${snapArch}`)\n }\n\n await executeAppBuilder(args)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"snap\", arch, false),\n target: this,\n arch,\n packager,\n publishConfig: options.publish == null ? { provider: \"snapStore\" } : null,\n })\n }\n\n private isElectronVersionGreaterOrEqualThan(version: string) {\n return semver.gte(this.packager.config.electronVersion || \"7.0.0\", version)\n }\n}\n\nfunction archNameToTriplet(arch: Arch): string {\n switch (arch) {\n case Arch.x64:\n return \"x86_64-linux-gnu\"\n case Arch.ia32:\n return \"i386-linux-gnu\"\n case Arch.armv7l:\n // noinspection SpellCheckingInspection\n return \"arm-linux-gnueabihf\"\n case Arch.arm64:\n return \"aarch64-linux-gnu\"\n\n default:\n throw new Error(`Unsupported arch ${arch}`)\n }\n}\n\nfunction isArrayEqualRegardlessOfSort(a: Array, b: Array) {\n a = a.slice()\n b = b.slice()\n a.sort()\n b.sort()\n return a.length === b.length && a.every((value, index) => value === b[index])\n}\n\nfunction normalizePlugConfiguration(raw: Array | PlugDescriptor | null | undefined): { [key: string]: { [name: string]: any } | null } | null {\n if (raw == null) {\n return null\n }\n\n const result: any = {}\n for (const item of Array.isArray(raw) ? raw : [raw]) {\n if (typeof item === \"string\") {\n result[item] = null\n } else {\n Object.assign(result, item)\n }\n }\n return result\n}\n\nfunction isBrowserSandboxAllowed(snap: any): boolean {\n if (snap.plugs != null) {\n for (const plugName of Object.keys(snap.plugs)) {\n const plug = snap.plugs[plugName]\n if (plug.interface === \"browser-support\" && plug[\"allow-sandbox\"] === true) {\n return true\n }\n }\n }\n return false\n}\n\nfunction getDefaultStagePackages() {\n // libxss1 - was \"error while loading shared libraries: libXss.so.1\" on Xubuntu 16.04\n // noinspection SpellCheckingInspection\n return [\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/targetFactory.d.ts b/client/node_modules/app-builder-lib/out/targets/targetFactory.d.ts new file mode 100644 index 0000000000..0139575705 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetFactory.d.ts @@ -0,0 +1,12 @@ +import { Arch } from "builder-util"; +import { Platform, Target } from "../core"; +import { PlatformPackager } from "../platformPackager"; +export declare function computeArchToTargetNamesMap(raw: Map>, platformPackager: PlatformPackager, platform: Platform): Map>; +export declare function createTargets(nameToTarget: Map, rawList: Array, outDir: string, packager: PlatformPackager): Array; +export declare function createCommonTarget(target: string, outDir: string, packager: PlatformPackager): Target; +export declare class NoOpTarget extends Target { + readonly options: null; + constructor(name: string); + get outDir(): string; + build(appOutDir: string, arch: Arch): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/targets/targetFactory.js b/client/node_modules/app-builder-lib/out/targets/targetFactory.js new file mode 100644 index 0000000000..d1f3c556d5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetFactory.js @@ -0,0 +1,101 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NoOpTarget = exports.createCommonTarget = exports.createTargets = exports.computeArchToTargetNamesMap = void 0; +const builder_util_1 = require("builder-util"); +const core_1 = require("../core"); +const ArchiveTarget_1 = require("./ArchiveTarget"); +const archiveTargets = new Set(["zip", "7z", "tar.xz", "tar.lz", "tar.gz", "tar.bz2"]); +function computeArchToTargetNamesMap(raw, platformPackager, platform) { + for (const targetNames of raw.values()) { + if (targetNames.length > 0) { + // https://github.com/electron-userland/electron-builder/issues/1355 + return raw; + } + } + const defaultArchs = raw.size === 0 ? [process.arch] : Array.from(raw.keys()).map(it => builder_util_1.Arch[it]); + const result = new Map(raw); + for (const target of builder_util_1.asArray(platformPackager.platformSpecificBuildOptions.target).map(it => (typeof it === "string" ? { target: it } : it))) { + let name = target.target; + let archs = target.arch; + const suffixPos = name.lastIndexOf(":"); + if (suffixPos > 0) { + name = target.target.substring(0, suffixPos); + if (archs == null) { + archs = target.target.substring(suffixPos + 1); + } + } + for (const arch of archs == null ? defaultArchs : builder_util_1.asArray(archs)) { + builder_util_1.addValue(result, builder_util_1.archFromString(arch), name); + } + } + if (result.size === 0) { + const defaultTarget = platformPackager.defaultTarget; + if (raw.size === 0 && platform === core_1.Platform.LINUX && (process.platform === "darwin" || process.platform === "win32")) { + result.set(builder_util_1.Arch.x64, defaultTarget); + // cannot enable arm because of native dependencies - e.g. keytar doesn't provide pre-builds for arm + // result.set(Arch.armv7l, ["snap"]) + } + else { + for (const arch of defaultArchs) { + result.set(builder_util_1.archFromString(arch), defaultTarget); + } + } + } + return result; +} +exports.computeArchToTargetNamesMap = computeArchToTargetNamesMap; +function createTargets(nameToTarget, rawList, outDir, packager) { + const result = []; + const mapper = (name, factory) => { + let target = nameToTarget.get(name); + if (target == null) { + target = factory(outDir); + nameToTarget.set(name, target); + } + result.push(target); + }; + const targets = normalizeTargets(rawList, packager.defaultTarget); + packager.createTargets(targets, mapper); + return result; +} +exports.createTargets = createTargets; +function normalizeTargets(targets, defaultTarget) { + const list = []; + for (const t of targets) { + const name = t.toLowerCase().trim(); + if (name === core_1.DEFAULT_TARGET) { + list.push(...defaultTarget); + } + else { + list.push(name); + } + } + return list; +} +function createCommonTarget(target, outDir, packager) { + if (archiveTargets.has(target)) { + return new ArchiveTarget_1.ArchiveTarget(target, outDir, packager); + } + else if (target === core_1.DIR_TARGET) { + return new NoOpTarget(core_1.DIR_TARGET); + } + else { + throw new Error(`Unknown target: ${target}`); + } +} +exports.createCommonTarget = createCommonTarget; +class NoOpTarget extends core_1.Target { + constructor(name) { + super(name); + this.options = null; + } + get outDir() { + throw new Error("NoOpTarget"); + } + // eslint-disable-next-line + async build(appOutDir, arch) { + // no build + } +} +exports.NoOpTarget = NoOpTarget; +//# sourceMappingURL=targetFactory.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/targetFactory.js.map b/client/node_modules/app-builder-lib/out/targets/targetFactory.js.map new file mode 100644 index 0000000000..7a60e00cb1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetFactory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"targetFactory.js","sourceRoot":"","sources":["../../src/targets/targetFactory.ts"],"names":[],"mappings":";;;AAAA,+CAAgF;AAChF,kCAA2F;AAE3F,mDAA+C;AAE/C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAEtF,SAAgB,2BAA2B,CAAC,GAA6B,EAAE,gBAAuC,EAAE,QAAkB;IACpI,KAAK,MAAM,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE;QACtC,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,oEAAoE;YACpE,OAAO,GAAG,CAAA;SACX;KACF;IAED,MAAM,YAAY,GAAoB,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAI,CAAC,EAAE,CAAa,CAAC,CAAA;IAC1I,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,KAAK,MAAM,MAAM,IAAI,sBAAO,CAAC,gBAAgB,C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AC,MAAc,EAAE,MAAc,EAAE,QAA+B;IAChG,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,IAAI,6BAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;KACnD;SAAM,IAAI,MAAM,KAAK,iBAAU,EAAE;QAChC,OAAO,IAAI,UAAU,CAAC,iBAAU,CAAC,CAAA;KAClC;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAA;KAC7C;AACH,CAAC;AARD,gDAQC;AAED,MAAa,UAAW,SAAQ,aAAM;IAGpC,YAAY,IAAY;QACtB,KAAK,CAAC,IAAI,CAAC,CAAA;QAHJ,YAAO,GAAG,IAAI,CAAA;IAIvB,CAAC;IAED,IAAI,MAAM;QACR,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;IAED,2BAA2B;IAC3B,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,IAAU;QACvC,WAAW;IACb,CAAC;CACF;AAfD,gCAeC","sourcesContent":["import { addValue, Arch, archFromString, ArchType, asArray } from \"builder-util\"\nimport { DEFAULT_TARGET, DIR_TARGET, Platform, Target, TargetConfiguration } from \"../core\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { ArchiveTarget } from \"./ArchiveTarget\"\n\nconst archiveTargets = new Set([\"zip\", \"7z\", \"tar.xz\", \"tar.lz\", \"tar.gz\", \"tar.bz2\"])\n\nexport function computeArchToTargetNamesMap(raw: Map>, platformPackager: PlatformPackager, platform: Platform): Map> {\n for (const targetNames of raw.values()) {\n if (targetNames.length > 0) {\n // https://github.com/electron-userland/electron-builder/issues/1355\n return raw\n }\n }\n\n const defaultArchs: Array = raw.size === 0 ? [process.arch as ArchType] : Array.from(raw.keys()).map(it => Arch[it] as ArchType)\n const result = new Map(raw)\n for (const target of asArray(platformPackager.platformSpecificBuildOptions.target).map(it => (typeof it === \"string\" ? { target: it } : it))) {\n let name = target.target\n let archs = target.arch\n const suffixPos = name.lastIndexOf(\":\")\n if (suffixPos > 0) {\n name = target.target.substring(0, suffixPos)\n if (archs == null) {\n archs = target.target.substring(suffixPos + 1) as ArchType\n }\n }\n\n for (const arch of archs == null ? defaultArchs : asArray(archs)) {\n addValue(result, archFromString(arch), name)\n }\n }\n\n if (result.size === 0) {\n const defaultTarget = platformPackager.defaultTarget\n if (raw.size === 0 && platform === Platform.LINUX && (process.platform === \"darwin\" || process.platform === \"win32\")) {\n result.set(Arch.x64, defaultTarget)\n // cannot enable arm because of native dependencies - e.g. keytar doesn't provide pre-builds for arm\n // result.set(Arch.armv7l, [\"snap\"])\n } else {\n for (const arch of defaultArchs) {\n result.set(archFromString(arch), defaultTarget)\n }\n }\n }\n\n return result\n}\n\nexport function createTargets(nameToTarget: Map, rawList: Array, outDir: string, packager: PlatformPackager): Array {\n const result: Array = []\n\n const mapper = (name: string, factory: (outDir: string) => Target) => {\n let target = nameToTarget.get(name)\n if (target == null) {\n target = factory(outDir)\n nameToTarget.set(name, target)\n }\n result.push(target)\n }\n\n const targets = normalizeTargets(rawList, packager.defaultTarget)\n packager.createTargets(targets, mapper)\n return result\n}\n\nfunction normalizeTargets(targets: Array, defaultTarget: Array): Array {\n const list: Array = []\n for (const t of targets) {\n const name = t.toLowerCase().trim()\n if (name === DEFAULT_TARGET) {\n list.push(...defaultTarget)\n } else {\n list.push(name)\n }\n }\n return list\n}\n\nexport function createCommonTarget(target: string, outDir: string, packager: PlatformPackager): Target {\n if (archiveTargets.has(target)) {\n return new ArchiveTarget(target, outDir, packager)\n } else if (target === DIR_TARGET) {\n return new NoOpTarget(DIR_TARGET)\n } else {\n throw new Error(`Unknown target: ${target}`)\n }\n}\n\nexport class NoOpTarget extends Target {\n readonly options = null\n\n constructor(name: string) {\n super(name)\n }\n\n get outDir(): string {\n throw new Error(\"NoOpTarget\")\n }\n\n // eslint-disable-next-line\n async build(appOutDir: string, arch: Arch): Promise {\n // no build\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/targetUtil.d.ts b/client/node_modules/app-builder-lib/out/targets/targetUtil.d.ts new file mode 100644 index 0000000000..b879ab544d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetUtil.d.ts @@ -0,0 +1,14 @@ +import { Target, AppInfo } from "../"; +import { Arch } from "builder-util"; +import { PlatformPackager } from "../platformPackager"; +export declare class StageDir { + readonly dir: string; + constructor(dir: string); + getTempFile(name: string): string; + cleanup(): Promise; + toString(): string; +} +export declare function createStageDir(target: Target, packager: PlatformPackager, arch: Arch): Promise; +export declare function createStageDirPath(target: Target, packager: PlatformPackager, arch: Arch): Promise; +export declare function getWindowsInstallationDirName(appInfo: AppInfo, isTryToUseProductName: boolean): string; +export declare function getWindowsInstallationAppPackageName(appName: string): string; diff --git a/client/node_modules/app-builder-lib/out/targets/targetUtil.js b/client/node_modules/app-builder-lib/out/targets/targetUtil.js new file mode 100644 index 0000000000..80b458c251 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetUtil.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWindowsInstallationAppPackageName = exports.getWindowsInstallationDirName = exports.createStageDirPath = exports.createStageDir = exports.StageDir = void 0; +const path = require("path"); +const builder_util_1 = require("builder-util"); +const fs = require("fs/promises"); +class StageDir { + constructor(dir) { + this.dir = dir; + } + getTempFile(name) { + return this.dir + path.sep + name; + } + cleanup() { + if (!builder_util_1.debug.enabled || process.env.ELECTRON_BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG === "true") { + return fs.rm(this.dir, { recursive: true, force: true }); + } + return Promise.resolve(); + } + toString() { + return this.dir; + } +} +exports.StageDir = StageDir; +async function createStageDir(target, packager, arch) { + return new StageDir(await createStageDirPath(target, packager, arch)); +} +exports.createStageDir = createStageDir; +async function createStageDirPath(target, packager, arch) { + const tempDir = packager.info.stageDirPathCustomizer(target, packager, arch); + await fs.rm(tempDir, { recursive: true, force: true }); + await fs.mkdir(tempDir, { recursive: true }); + return tempDir; +} +exports.createStageDirPath = createStageDirPath; +// https://github.com/electron-userland/electron-builder/issues/3100 +// https://github.com/electron-userland/electron-builder/commit/2539cfba20dc639128e75c5b786651b652bb4b78 +function getWindowsInstallationDirName(appInfo, isTryToUseProductName) { + return isTryToUseProductName && /^[-_+0-9a-zA-Z .]+$/.test(appInfo.productFilename) ? appInfo.productFilename : appInfo.sanitizedName; +} +exports.getWindowsInstallationDirName = getWindowsInstallationDirName; +// https://github.com/electron-userland/electron-builder/issues/6747 +function getWindowsInstallationAppPackageName(appName) { + return appName.replace(/\//g, "\\"); +} +exports.getWindowsInstallationAppPackageName = getWindowsInstallationAppPackageName; +//# sourceMappingURL=targetUtil.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/targetUtil.js.map b/client/node_modules/app-builder-lib/out/targets/targetUtil.js.map new file mode 100644 index 0000000000..2b399fcb5a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/targetUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"targetUtil.js","sourceRoot":"","sources":["../../src/targets/targetUtil.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAE5B,+CAA0C;AAE1C,kCAAiC;AAEjC,MAAa,QAAQ;IACnB,YAAqB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEpC,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAA;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,oBAAK,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,2CAA2C,KAAK,MAAM,EAAE;YACxF,OAAO,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;SACzD;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;CACF;AAjBD,4BAiBC;AAEM,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,QAA+B,EAAE,IAAU;IAC9F,OAAO,IAAI,QAAQ,CAAC,MAAM,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;AACvE,CAAC;AAFD,wCAEC;AAEM,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,QAA+B,EAAE,IAAU;IAClG,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC5E,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACtD,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAA;AAChB,CAAC;AALD,gDAKC;AAED,oEAAoE;AACpE,wGAAwG;AACxG,SAAgB,6BAA6B,CAAC,OAAgB,EAAE,qBAA8B;IAC5F,OAAO,qBAAqB,IAAI,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAA;AACvI,CAAC;AAFD,sEAEC;AAED,oEAAoE;AACpE,SAAgB,oCAAoC,CAAC,OAAe;IAClE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACrC,CAAC;AAFD,oFAEC","sourcesContent":["import * as path from \"path\"\nimport { Target, AppInfo } from \"../\"\nimport { Arch, debug } from \"builder-util\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport * as fs from \"fs/promises\"\n\nexport class StageDir {\n constructor(readonly dir: string) {}\n\n getTempFile(name: string) {\n return this.dir + path.sep + name\n }\n\n cleanup() {\n if (!debug.enabled || process.env.ELECTRON_BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG === \"true\") {\n return fs.rm(this.dir, { recursive: true, force: true })\n }\n return Promise.resolve()\n }\n\n toString() {\n return this.dir\n }\n}\n\nexport async function createStageDir(target: Target, packager: PlatformPackager, arch: Arch): Promise {\n return new StageDir(await createStageDirPath(target, packager, arch))\n}\n\nexport async function createStageDirPath(target: Target, packager: PlatformPackager, arch: Arch): Promise {\n const tempDir = packager.info.stageDirPathCustomizer(target, packager, arch)\n await fs.rm(tempDir, { recursive: true, force: true })\n await fs.mkdir(tempDir, { recursive: true })\n return tempDir\n}\n\n// https://github.com/electron-userland/electron-builder/issues/3100\n// https://github.com/electron-userland/electron-builder/commit/2539cfba20dc639128e75c5b786651b652bb4b78\nexport function getWindowsInstallationDirName(appInfo: AppInfo, isTryToUseProductName: boolean): string {\n return isTryToUseProductName && /^[-_+0-9a-zA-Z .]+$/.test(appInfo.productFilename) ? appInfo.productFilename : appInfo.sanitizedName\n}\n\n// https://github.com/electron-userland/electron-builder/issues/6747\nexport function getWindowsInstallationAppPackageName(appName: string): string {\n return appName.replace(/\\//g, \"\\\\\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/tools.d.ts b/client/node_modules/app-builder-lib/out/targets/tools.d.ts new file mode 100644 index 0000000000..4105e47c38 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/tools.d.ts @@ -0,0 +1 @@ +export declare function getLinuxToolsPath(): Promise; diff --git a/client/node_modules/app-builder-lib/out/targets/tools.js b/client/node_modules/app-builder-lib/out/targets/tools.js new file mode 100644 index 0000000000..513740b224 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/tools.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLinuxToolsPath = void 0; +const binDownload_1 = require("../binDownload"); +function getLinuxToolsPath() { + //noinspection SpellCheckingInspection + return binDownload_1.getBinFromUrl("linux-tools", "mac-10.12.3", "SQ8fqIRVXuQVWnVgaMTDWyf2TLAJjJYw3tRSqQJECmgF6qdM7Kogfa6KD49RbGzzMYIFca9Uw3MdsxzOPRWcYw=="); +} +exports.getLinuxToolsPath = getLinuxToolsPath; +//# sourceMappingURL=tools.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/targets/tools.js.map b/client/node_modules/app-builder-lib/out/targets/tools.js.map new file mode 100644 index 0000000000..94d1314383 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/targets/tools.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/targets/tools.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAE9C,SAAgB,iBAAiB;IAC/B,sCAAsC;IACtC,OAAO,2BAAa,CAAC,aAAa,EAAE,aAAa,EAAE,0FAA0F,CAAC,CAAA;AAChJ,CAAC;AAHD,8CAGC","sourcesContent":["import { getBinFromUrl } from \"../binDownload\"\n\nexport function getLinuxToolsPath() {\n //noinspection SpellCheckingInspection\n return getBinFromUrl(\"linux-tools\", \"mac-10.12.3\", \"SQ8fqIRVXuQVWnVgaMTDWyf2TLAJjJYw3tRSqQJECmgF6qdM7Kogfa6KD49RbGzzMYIFca9Uw3MdsxzOPRWcYw==\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/AppFileWalker.d.ts b/client/node_modules/app-builder-lib/out/util/AppFileWalker.d.ts new file mode 100644 index 0000000000..f5cdca6229 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/AppFileWalker.d.ts @@ -0,0 +1,14 @@ +/// +import { Filter } from "builder-util/out/fs"; +import { Stats } from "fs-extra"; +import { FileMatcher } from "../fileMatcher"; +import { Packager } from "../packager"; +export declare abstract class FileCopyHelper { + protected readonly matcher: FileMatcher; + readonly filter: Filter | null; + protected readonly packager: Packager; + readonly metadata: Map; + protected constructor(matcher: FileMatcher, filter: Filter | null, packager: Packager); + protected handleFile(file: string, parent: string, fileStat: Stats): Promise | null; + private handleSymlink; +} diff --git a/client/node_modules/app-builder-lib/out/util/AppFileWalker.js b/client/node_modules/app-builder-lib/out/util/AppFileWalker.js new file mode 100644 index 0000000000..df9f8b0a1d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/AppFileWalker.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppFileWalker = exports.FileCopyHelper = void 0; +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const nodeModulesSystemDependentSuffix = `${path.sep}node_modules`; +function addAllPatternIfNeed(matcher) { + if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) { + matcher.prependPattern("**/*"); + } + return matcher; +} +class FileCopyHelper { + constructor(matcher, filter, packager) { + this.matcher = matcher; + this.filter = filter; + this.packager = packager; + this.metadata = new Map(); + } + handleFile(file, parent, fileStat) { + if (!fileStat.isSymbolicLink()) { + return null; + } + return fs_extra_1.readlink(file).then((linkTarget) => { + // http://unix.stackexchange.com/questions/105637/is-symlinks-target-relative-to-the-destinations-parent-directory-and-if-so-wh + return this.handleSymlink(fileStat, file, parent, linkTarget); + }); + } + handleSymlink(fileStat, file, parent, linkTarget) { + const resolvedLinkTarget = path.resolve(parent, linkTarget); + const link = path.relative(this.matcher.from, resolvedLinkTarget); + if (link.startsWith("..")) { + // outside of project, linked module (https://github.com/electron-userland/electron-builder/issues/675) + return fs_extra_1.stat(resolvedLinkTarget).then(targetFileStat => { + this.metadata.set(file, targetFileStat); + return targetFileStat; + }); + } + else { + const s = fileStat; + s.relativeLink = link; + s.linkRelativeToFile = path.relative(parent, resolvedLinkTarget); + } + return null; + } +} +exports.FileCopyHelper = FileCopyHelper; +function createAppFilter(matcher, packager) { + if (packager.areNodeModulesHandledExternally) { + return matcher.isEmpty() ? null : matcher.createFilter(); + } + const nodeModulesFilter = (file, fileStat) => { + return !(fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix)); + }; + if (matcher.isEmpty()) { + return nodeModulesFilter; + } + const filter = matcher.createFilter(); + return (file, fileStat) => { + if (!nodeModulesFilter(file, fileStat)) { + return !!packager.config.includeSubNodeModules; + } + return filter(file, fileStat); + }; +} +/** @internal */ +class AppFileWalker extends FileCopyHelper { + constructor(matcher, packager) { + super(addAllPatternIfNeed(matcher), createAppFilter(matcher, packager), packager); + this.matcherFilter = matcher.createFilter(); + } + // noinspection JSUnusedGlobalSymbols + // eslint-disable-next-line @typescript-eslint/no-unused-vars + consume(file, fileStat, parent, siblingNames) { + if (fileStat.isDirectory()) { + // https://github.com/electron-userland/electron-builder/issues/1539 + // but do not filter if we inside node_modules dir + // update: solution disabled, node module resolver should support such setup + if (file.endsWith(nodeModulesSystemDependentSuffix)) { + if (!this.packager.config.includeSubNodeModules) { + const matchesFilter = this.matcherFilter(file, fileStat); + if (!matchesFilter) { + // Skip the file + return false; + } + } + } + } + else { + // save memory - no need to store stat for directory + this.metadata.set(file, fileStat); + } + return this.handleFile(file, parent, fileStat); + } +} +exports.AppFileWalker = AppFileWalker; +//# sourceMappingURL=AppFileWalker.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/AppFileWalker.js.map b/client/node_modules/app-builder-lib/out/util/AppFileWalker.js.map new file mode 100644 index 0000000000..1bfddb685d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/AppFileWalker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AppFileWalker.js","sourceRoot":"","sources":["../../src/util/AppFileWalker.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAGhD,6BAA4B;AAE5B,MAAM,gCAAgC,GAAG,GAAG,IAAI,CAAC,GAAG,cAAc,CAAA;AAElE,SAAS,mBAAmB,CAAC,OAAoB;IAC/C,IAAI,CAAC,OAAO,CAAC,uBAAuB,IAAI,C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AAA;QACjF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAA;IAC7C,CAAC;IAED,qCAAqC;IACrC,6DAA6D;IAC7D,OAAO,CAAC,IAAY,EAAE,QAAe,EAAE,MAAc,EAAE,YAA2B;QAChF,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE;YAC1B,oEAAoE;YACpE,kDAAkD;YAClD,4EAA4E;YAC5E,IAAI,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,EAAE;gBACnD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE;oBAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;oBACxD,IAAI,CAAC,aAAa,EAAE;wBAClB,gBAAgB;wBAChB,OAAO,KAAK,CAAA;qBACb;iBACF;aACF;SACF;aAAM;YACL,oDAAoD;YACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;SAClC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACF;AA9BD,sCA8BC","sourcesContent":["import { Filter, FileConsumer } from \"builder-util/out/fs\"\nimport { readlink, stat, Stats } from \"fs-extra\"\nimport { FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport * as path from \"path\"\n\nconst nodeModulesSystemDependentSuffix = `${path.sep}node_modules`\n\nfunction addAllPatternIfNeed(matcher: FileMatcher) {\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n matcher.prependPattern(\"**/*\")\n }\n return matcher\n}\n\nexport abstract class FileCopyHelper {\n readonly metadata = new Map()\n\n protected constructor(protected readonly matcher: FileMatcher, readonly filter: Filter | null, protected readonly packager: Packager) {}\n\n protected handleFile(file: string, parent: string, fileStat: Stats): Promise | null {\n if (!fileStat.isSymbolicLink()) {\n return null\n }\n\n return readlink(file).then((linkTarget): any => {\n // http://unix.stackexchange.com/questions/105637/is-symlinks-target-relative-to-the-destinations-parent-directory-and-if-so-wh\n return this.handleSymlink(fileStat, file, parent, linkTarget)\n })\n }\n\n private handleSymlink(fileStat: Stats, file: string, parent: string, linkTarget: string): Promise | null {\n const resolvedLinkTarget = path.resolve(parent, linkTarget)\n const link = path.relative(this.matcher.from, resolvedLinkTarget)\n if (link.startsWith(\"..\")) {\n // outside of project, linked module (https://github.com/electron-userland/electron-builder/issues/675)\n return stat(resolvedLinkTarget).then(targetFileStat => {\n this.metadata.set(file, targetFileStat)\n return targetFileStat\n })\n } else {\n const s = fileStat as any\n s.relativeLink = link\n s.linkRelativeToFile = path.relative(parent, resolvedLinkTarget)\n }\n return null\n }\n}\n\nfunction createAppFilter(matcher: FileMatcher, packager: Packager): Filter | null {\n if (packager.areNodeModulesHandledExternally) {\n return matcher.isEmpty() ? null : matcher.createFilter()\n }\n\n const nodeModulesFilter: Filter = (file, fileStat) => {\n return !(fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix))\n }\n\n if (matcher.isEmpty()) {\n return nodeModulesFilter\n }\n\n const filter = matcher.createFilter()\n return (file, fileStat) => {\n if (!nodeModulesFilter(file, fileStat)) {\n return !!packager.config.includeSubNodeModules\n }\n return filter(file, fileStat)\n }\n}\n\n/** @internal */\nexport class AppFileWalker extends FileCopyHelper implements FileConsumer {\n readonly matcherFilter: any\n constructor(matcher: FileMatcher, packager: Packager) {\n super(addAllPatternIfNeed(matcher), createAppFilter(matcher, packager), packager)\n this.matcherFilter = matcher.createFilter()\n }\n\n // noinspection JSUnusedGlobalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n consume(file: string, fileStat: Stats, parent: string, siblingNames: Array): any {\n if (fileStat.isDirectory()) {\n // https://github.com/electron-userland/electron-builder/issues/1539\n // but do not filter if we inside node_modules dir\n // update: solution disabled, node module resolver should support such setup\n if (file.endsWith(nodeModulesSystemDependentSuffix)) {\n if (!this.packager.config.includeSubNodeModules) {\n const matchesFilter = this.matcherFilter(file, fileStat)\n if (!matchesFilter) {\n // Skip the file\n return false\n }\n }\n }\n } else {\n // save memory - no need to store stat for directory\n this.metadata.set(file, fileStat)\n }\n\n return this.handleFile(file, parent, fileStat)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.d.ts b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js new file mode 100644 index 0000000000..7d01346680 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NodeModuleCopyHelper = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const fileMatcher_1 = require("../fileMatcher"); +const platformPackager_1 = require("../platformPackager"); +const AppFileWalker_1 = require("./AppFileWalker"); +const excludedFiles = new Set([".DS_Store", "node_modules" /* already in the queue */, "CHANGELOG.md", "ChangeLog", "changelog.md", "Changelog.md", "Changelog", "binding.gyp", ".npmignore"].concat(fileMatcher_1.excludedNames.split(","))); +const topLevelExcludedFiles = new Set([ + "test.js", + "karma.conf.js", + ".coveralls.yml", + "README.md", + "readme.markdown", + "README", + "readme.md", + "Readme.md", + "Readme", + "readme", + "test", + "__tests__", + "tests", + "powered-test", + "example", + "examples", + ".bin", +]); +/** @internal */ +class NodeModuleCopyHelper extends AppFileWalker_1.FileCopyHelper { + constructor(matcher, packager) { + super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager); + } + async collectNodeModules(baseDir, moduleNames, nodeModuleExcludedExts) { + const filter = this.filter; + const metadata = this.metadata; + const onNodeModuleFile = platformPackager_1.resolveFunction(this.packager.config.onNodeModuleFile, "onNodeModuleFile"); + const result = []; + const queue = []; + for (const moduleName of moduleNames) { + const tmpPath = baseDir + path.sep + moduleName; + queue.length = 1; + // The path should be corrected in Windows that when the moduleName is Scoped packages named. + const depPath = path.normalize(tmpPath); + queue[0] = depPath; + while (queue.length > 0) { + const dirPath = queue.pop(); + const childNames = await fs_extra_1.readdir(dirPath); + childNames.sort(); + const isTopLevel = dirPath === depPath; + const dirs = []; + // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map + const sortedFilePaths = await bluebird_lst_1.default.map(childNames, name => { + if (onNodeModuleFile != null) { + onNodeModuleFile(dirPath + path.sep + name); + } + if (excludedFiles.has(name) || name.startsWith("._")) { + return null; + } + for (const ext of nodeModuleExcludedExts) { + if (name.endsWith(ext)) { + return null; + } + } + // noinspection SpellCheckingInspection + if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === "libui-node" && (name === "build" || name === "docs" || name === "src")))) { + return null; + } + if (dirPath.endsWith("build")) { + if (name === "gyp-mac-tool" || name === "Makefile" || name.endsWith(".mk") || name.endsWith(".gypi") || name.endsWith(".Makefile")) { + return null; + } + } + else if (dirPath.endsWith("Release") && (name === ".deps" || name === "obj.target")) { + return null; + } + else if (name === "src" && (dirPath.endsWith("keytar") || dirPath.endsWith("keytar-prebuild"))) { + return null; + } + else if (dirPath.endsWith("lzma-native") && (name === "build" || name === "deps")) { + return null; + } + const filePath = dirPath + path.sep + name; + return fs_extra_1.lstat(filePath).then(stat => { + if (filter != null && !filter(filePath, stat)) { + return null; + } + if (!stat.isDirectory()) { + metadata.set(filePath, stat); + } + const consumerResult = this.handleFile(filePath, dirPath, stat); + if (consumerResult == null) { + if (stat.isDirectory()) { + dirs.push(name); + return null; + } + else { + return filePath; + } + } + else { + return consumerResult.then(it => { + // asarUtil can return modified stat (symlink handling) + if ((it == null ? stat : it).isDirectory()) { + dirs.push(name); + return null; + } + else { + return filePath; + } + }); + } + }); + }, fs_1.CONCURRENCY); + for (const child of sortedFilePaths) { + if (child != null) { + result.push(child); + } + } + dirs.sort(); + for (const child of dirs) { + queue.push(dirPath + path.sep + child); + } + } + } + return result; + } +} +exports.NodeModuleCopyHelper = NodeModuleCopyHelper; +//# sourceMappingURL=NodeModuleCopyHelper.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js.map b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js.map new file mode 100644 index 0000000000..e7b13e1518 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/NodeModuleCopyHelper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,4CAAiD;AACjD,uCAAyC;AACzC,6BAA4B;AAC5B,gDAA2D;AAE3D,0DAAqD;AACrD,mDAAgD;AAEhD,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,CAAC,WAAW,EAAE,cAAc,CAAC,0BAA0B,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,MAAM,CACpK,2BAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CACzB,CACF,CAAA;AACD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,SAAS;IACT,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,WAAW;IACX,OAAO;IACP,cAAc;IACd,SAAS;IACT,UAAU;IACV,MAAM;CACP,CAAC,CAAA;AAEF,gBAAg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AA;yBACH;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC,EACD,gBAAW,CACZ,CAAA;gBAED,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE;oBACnC,IAAI,KAAK,IAAI,IAAI,EAAE;wBACjB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;qBACnB;iBACF;gBAED,IAAI,CAAC,IAAI,EAAE,CAAA;gBACX,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;oBACxB,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;iBACvC;aACF;SACF;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AA9GD,oDA8GC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { CONCURRENCY } from \"builder-util/out/fs\"\nimport { lstat, readdir } from \"fs-extra\"\nimport * as path from \"path\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport { resolveFunction } from \"../platformPackager\"\nimport { FileCopyHelper } from \"./AppFileWalker\"\n\nconst excludedFiles = new Set(\n [\".DS_Store\", \"node_modules\" /* already in the queue */, \"CHANGELOG.md\", \"ChangeLog\", \"changelog.md\", \"Changelog.md\", \"Changelog\", \"binding.gyp\", \".npmignore\"].concat(\n excludedNames.split(\",\")\n )\n)\nconst topLevelExcludedFiles = new Set([\n \"test.js\",\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"__tests__\",\n \"tests\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: Packager) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(baseDir: string, moduleNames: Iterable, nodeModuleExcludedExts: Array): Promise> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = resolveFunction(this.packager.config.onNodeModuleFile, \"onNodeModuleFile\")\n\n const result: Array = []\n const queue: Array = []\n for (const moduleName of moduleNames) {\n const tmpPath = baseDir + path.sep + moduleName\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array = []\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await BluebirdPromise.map(\n childNames,\n name => {\n if (onNodeModuleFile != null) {\n onNodeModuleFile(dirPath + path.sep + name)\n }\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n\n const filePath = dirPath + path.sep + name\n return lstat(filePath).then(stat => {\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n },\n CONCURRENCY\n )\n\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n }\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n }\n return result\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/appBuilder.d.ts b/client/node_modules/app-builder-lib/out/util/appBuilder.d.ts new file mode 100644 index 0000000000..2c25380040 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appBuilder.d.ts @@ -0,0 +1,7 @@ +/// +import { SpawnOptions } from "child_process"; +export declare function executeAppBuilderAsJson(args: Array): Promise; +export declare function executeAppBuilderAndWriteJson(args: Array, data: any, extraOptions?: SpawnOptions): Promise; +export declare function objectToArgs(to: Array, argNameToValue: { + [key: string]: string | null; +}): void; diff --git a/client/node_modules/app-builder-lib/out/util/appBuilder.js b/client/node_modules/app-builder-lib/out/util/appBuilder.js new file mode 100644 index 0000000000..601258771c --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appBuilder.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectToArgs = exports.executeAppBuilderAndWriteJson = exports.executeAppBuilderAsJson = void 0; +const builder_util_1 = require("builder-util"); +function executeAppBuilderAsJson(args) { + return builder_util_1.executeAppBuilder(args).then(rawResult => { + if (rawResult === "") { + return Object.create(null); + } + try { + return JSON.parse(rawResult); + } + catch (e) { + throw new Error(`Cannot parse result: ${e.message}: "${rawResult}"`); + } + }); +} +exports.executeAppBuilderAsJson = executeAppBuilderAsJson; +function executeAppBuilderAndWriteJson(args, data, extraOptions = {}) { + return builder_util_1.executeAppBuilder(args, childProcess => { + childProcess.stdin.end(JSON.stringify(data)); + }, { + ...extraOptions, + stdio: ["pipe", "pipe", process.stdout], + }); +} +exports.executeAppBuilderAndWriteJson = executeAppBuilderAndWriteJson; +function objectToArgs(to, argNameToValue) { + for (const name of Object.keys(argNameToValue)) { + const value = argNameToValue[name]; + if (value != null) { + to.push(`--${name}`, value); + } + } +} +exports.objectToArgs = objectToArgs; +//# sourceMappingURL=appBuilder.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/appBuilder.js.map b/client/node_modules/app-builder-lib/out/util/appBuilder.js.map new file mode 100644 index 0000000000..4837e14b15 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appBuilder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"appBuilder.js","sourceRoot":"","sources":["../../src/util/appBuilder.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAGhD,SAAgB,uBAAuB,CAAI,IAAmB;IAC5D,OAAO,gCAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QAC9C,IAAI,SAAS,KAAK,EAAE,EAAE;YACpB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAM,CAAA;SAChC;QAED,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAM,CAAA;SAClC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,OAAO,MAAM,SAAS,GAAG,CAAC,CAAA;SACrE;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAZD,0DAYC;AAED,SAAgB,6BAA6B,CAAC,IAAmB,EAAE,IAAS,EAAE,eAA6B,EAAE;IAC3G,OAAO,gCAAiB,CACtB,IAAI,EACJ,YAAY,CAAC,EAAE;QACb,YAAY,CAAC,KAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC,EACD;QACE,GAAG,YAAY;QACf,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;KACxC,CACF,CAAA;AACH,CAAC;AAXD,sEAWC;AAED,SAAgB,YAAY,CAAC,EAAiB,EAAE,cAAgD;IAC9F,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QAC9C,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;SAC5B;KACF;AACH,CAAC;AAPD,oCAOC","sourcesContent":["import { executeAppBuilder } from \"builder-util\"\nimport { SpawnOptions } from \"child_process\"\n\nexport function executeAppBuilderAsJson(args: Array): Promise {\n return executeAppBuilder(args).then(rawResult => {\n if (rawResult === \"\") {\n return Object.create(null) as T\n }\n\n try {\n return JSON.parse(rawResult) as T\n } catch (e) {\n throw new Error(`Cannot parse result: ${e.message}: \"${rawResult}\"`)\n }\n })\n}\n\nexport function executeAppBuilderAndWriteJson(args: Array, data: any, extraOptions: SpawnOptions = {}): Promise {\n return executeAppBuilder(\n args,\n childProcess => {\n childProcess.stdin!.end(JSON.stringify(data))\n },\n {\n ...extraOptions,\n stdio: [\"pipe\", \"pipe\", process.stdout],\n }\n )\n}\n\nexport function objectToArgs(to: Array, argNameToValue: { [key: string]: string | null }): void {\n for (const name of Object.keys(argNameToValue)) {\n const value = argNameToValue[name]\n if (value != null) {\n to.push(`--${name}`, value)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/appFileCopier.d.ts b/client/node_modules/app-builder-lib/out/util/appFileCopier.d.ts new file mode 100644 index 0000000000..128baadbb1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appFileCopier.d.ts @@ -0,0 +1,17 @@ +/// +import { FileTransformer } from "builder-util/out/fs"; +import { Stats } from "fs"; +import { FileMatcher } from "../fileMatcher"; +import { Packager } from "../packager"; +import { PlatformPackager } from "../platformPackager"; +export declare function getDestinationPath(file: string, fileSet: ResolvedFileSet): string; +export declare function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer): Promise; +export interface ResolvedFileSet { + src: string; + destination: string; + files: Array; + metadata: Map; + transformedFiles?: Map | null; +} +export declare function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise; +export declare function computeFileSets(matchers: Array, transformer: FileTransformer | null, platformPackager: PlatformPackager, isElectronCompile: boolean): Promise>; diff --git a/client/node_modules/app-builder-lib/out/util/appFileCopier.js b/client/node_modules/app-builder-lib/out/util/appFileCopier.js new file mode 100644 index 0000000000..11ef1380af --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appFileCopier.js @@ -0,0 +1,218 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeNodeModuleFileSets = exports.computeFileSets = exports.transformFiles = exports.copyAppFiles = exports.getDestinationPath = exports.ELECTRON_COMPILE_SHIM_FILENAME = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const promises_1 = require("fs/promises"); +const path = require("path"); +const unpackDetector_1 = require("../asar/unpackDetector"); +const core_1 = require("../core"); +const fileMatcher_1 = require("../fileMatcher"); +const fileTransformer_1 = require("../fileTransformer"); +const AppFileWalker_1 = require("./AppFileWalker"); +const NodeModuleCopyHelper_1 = require("./NodeModuleCopyHelper"); +const BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`; +/** @internal */ +exports.ELECTRON_COMPILE_SHIM_FILENAME = "__shim.js"; +function getDestinationPath(file, fileSet) { + if (file === fileSet.src) { + return fileSet.destination; + } + else { + const src = fileSet.src; + const dest = fileSet.destination; + if (file.length > src.length && file.startsWith(src) && file[src.length] === path.sep) { + return dest + file.substring(src.length); + } + else { + // hoisted node_modules + // not lastIndexOf, to ensure that nested module (top-level module depends on) copied to parent node_modules, not to top-level directory + // project https://github.com/angexis/punchcontrol/commit/cf929aba55c40d0d8901c54df7945e1d001ce022 + let index = file.indexOf(fileTransformer_1.NODE_MODULES_PATTERN); + if (index < 0 && file.endsWith(`${path.sep}node_modules`)) { + index = file.length - 13; + } + if (index < 0) { + throw new Error(`File "${file}" not under the source directory "${fileSet.src}"`); + } + return dest + file.substring(index); + } + } +} +exports.getDestinationPath = getDestinationPath; +async function copyAppFiles(fileSet, packager, transformer) { + const metadata = fileSet.metadata; + // search auto unpacked dir + const taskManager = new builder_util_1.AsyncTaskManager(packager.cancellationToken); + const createdParentDirs = new Set(); + const fileCopier = new fs_1.FileCopier(file => { + // https://github.com/electron-userland/electron-builder/issues/3038 + return !(unpackDetector_1.isLibOrExe(file) || file.endsWith(".node")); + }, transformer); + const links = []; + for (let i = 0, n = fileSet.files.length; i < n; i++) { + const sourceFile = fileSet.files[i]; + const stat = metadata.get(sourceFile); + if (stat == null) { + // dir + continue; + } + const destinationFile = getDestinationPath(sourceFile, fileSet); + if (stat.isSymbolicLink()) { + links.push({ file: destinationFile, link: await promises_1.readlink(sourceFile) }); + continue; + } + const fileParent = path.dirname(destinationFile); + if (!createdParentDirs.has(fileParent)) { + createdParentDirs.add(fileParent); + await promises_1.mkdir(fileParent, { recursive: true }); + } + taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat)); + if (taskManager.tasks.length > fs_1.MAX_FILE_REQUESTS) { + await taskManager.awaitTasks(); + } + } + if (taskManager.tasks.length > 0) { + await taskManager.awaitTasks(); + } + if (links.length > 0) { + await bluebird_lst_1.default.map(links, it => promises_1.symlink(it.link, it.file), fs_1.CONCURRENCY); + } +} +exports.copyAppFiles = copyAppFiles; +// used only for ASAR, if no asar, file transformed on the fly +async function transformFiles(transformer, fileSet) { + if (transformer == null) { + return; + } + let transformedFiles = fileSet.transformedFiles; + if (fileSet.transformedFiles == null) { + transformedFiles = new Map(); + fileSet.transformedFiles = transformedFiles; + } + const metadata = fileSet.metadata; + await bluebird_lst_1.default.filter(fileSet.files, (it, index) => { + const fileStat = metadata.get(it); + if (fileStat == null || !fileStat.isFile()) { + return false; + } + const transformedValue = transformer(it); + if (transformedValue == null) { + return false; + } + if (typeof transformedValue === "object" && "then" in transformedValue) { + return transformedValue.then(it => { + if (it != null) { + transformedFiles.set(index, it); + } + return false; + }); + } + transformedFiles.set(index, transformedValue); + return false; + }, fs_1.CONCURRENCY); +} +exports.transformFiles = transformFiles; +async function computeFileSets(matchers, transformer, platformPackager, isElectronCompile) { + const fileSets = []; + const packager = platformPackager.info; + for (const matcher of matchers) { + const fileWalker = new AppFileWalker_1.AppFileWalker(matcher, packager); + const fromStat = await fs_1.statOrNull(matcher.from); + if (fromStat == null) { + builder_util_1.log.debug({ directory: matcher.from, reason: "doesn't exist" }, `skipped copying`); + continue; + } + const files = await fs_1.walk(matcher.from, fileWalker.filter, fileWalker); + const metadata = fileWalker.metadata; + fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to })); + } + if (isElectronCompile) { + // cache files should be first (better IO) + fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager)); + } + return fileSets; +} +exports.computeFileSets = computeFileSets; +function getNodeModuleExcludedExts(platformPackager) { + // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852) + const result = [".o", ".obj"].concat(fileMatcher_1.excludedExts.split(",").map(it => `.${it}`)); + if (platformPackager.config.includePdb !== true) { + result.push(".pdb"); + } + if (platformPackager.platform !== core_1.Platform.WINDOWS) { + // https://github.com/electron-userland/electron-builder/issues/1738 + result.push(".dll"); + result.push(".exe"); + } + return result; +} +function validateFileSet(fileSet) { + if (fileSet.src == null || fileSet.src.length === 0) { + throw new Error("fileset src is empty"); + } + return fileSet; +} +/** @internal */ +async function computeNodeModuleFileSets(platformPackager, mainMatcher) { + const deps = await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value; + const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager); + // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure + const result = new Array(); + let index = 0; + for (const info of deps) { + const source = info.dir; + const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null }); + // use main matcher patterns, so, user can exclude some files in such hoisted node modules + // source here includes node_modules, but pattern base should be without because users expect that pattern "!node_modules/loot-core/src{,/**/*}" will work + const matcher = new fileMatcher_1.FileMatcher(path.dirname(source), destination, mainMatcher.macroExpander, mainMatcher.patterns); + const copier = new NodeModuleCopyHelper_1.NodeModuleCopyHelper(matcher, platformPackager.info); + const files = await copier.collectNodeModules(source, info.deps.map(it => it.name), nodeModuleExcludedExts); + result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata }); + } + return result; +} +exports.computeNodeModuleFileSets = computeNodeModuleFileSets; +async function compileUsingElectronCompile(mainFileSet, packager) { + builder_util_1.log.info("compiling using electron-compile"); + const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: "electron-compile-cache" }); + const cacheDir = path.join(electronCompileCache, ".cache"); + // clear and create cache dir + await promises_1.mkdir(cacheDir, { recursive: true }); + const compilerHost = await fileTransformer_1.createElectronCompilerHost(mainFileSet.src, cacheDir); + const nextSlashIndex = mainFileSet.src.length + 1; + // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir + await bluebird_lst_1.default.map(mainFileSet.files, file => { + if (file.includes(fileTransformer_1.NODE_MODULES_PATTERN) || + file.includes(BOWER_COMPONENTS_PATTERN) || + !file.includes(path.sep, nextSlashIndex) || // ignore not root files + !mainFileSet.metadata.get(file).isFile()) { + return null; + } + return compilerHost.compile(file).then(() => null); + }, fs_1.CONCURRENCY); + await compilerHost.saveConfiguration(); + const metadata = new Map(); + const cacheFiles = await fs_1.walk(cacheDir, file => !file.startsWith("."), { + consume: (file, fileStat) => { + if (fileStat.isFile()) { + metadata.set(file, fileStat); + } + return null; + }, + }); + // add shim + const shimPath = `${mainFileSet.src}${path.sep}${exports.ELECTRON_COMPILE_SHIM_FILENAME}`; + mainFileSet.files.push(shimPath); + mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false }); + if (mainFileSet.transformedFiles == null) { + mainFileSet.transformedFiles = new Map(); + } + mainFileSet.transformedFiles.set(mainFileSet.files.length - 1, ` +'use strict'; +require('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || "index"}'), true); +`); + return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }; +} +//# sourceMappingURL=appFileCopier.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/appFileCopier.js.map b/client/node_modules/app-builder-lib/out/util/appFileCopier.js.map new file mode 100644 index 0000000000..2d3a685acc --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/appFileCopier.js.map @@ -0,0 +1 @@ +{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAoD;AACpD,4CAAyH;AAEzH,0CAAsD;AACtD,6BAA4B;AAC5B,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,iEAA6D;AAE7D,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD,SAAgB,kBAAkB,CAAC,IAAY,EAAE,OAAwB;IACvE,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,EAAE;QACxB,OAAO,OAAO,CAAC,WAAW,CAAA;KAC3B;SAAM;QACL,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACvB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAA;QAChC,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,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AAC,QAAQ,CAAC,CAAA;IAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE;QACxC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;KACzC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { AsyncTaskManager, log } from \"builder-util\"\nimport { CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util/out/fs\"\nimport { Stats } from \"fs\"\nimport { mkdir, readlink, symlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n } else {\n const src = fileSet.src\n const dest = fileSet.destination\n if (file.length > src.length && file.startsWith(src) && file[src.length] === path.sep) {\n return dest + file.substring(src.length)\n } else {\n // hoisted node_modules\n // not lastIndexOf, to ensure that nested module (top-level module depends on) copied to parent node_modules, not to top-level directory\n // project https://github.com/angexis/punchcontrol/commit/cf929aba55c40d0d8901c54df7945e1d001ce022\n let index = file.indexOf(NODE_MODULES_PATTERN)\n if (index < 0 && file.endsWith(`${path.sep}node_modules`)) {\n index = file.length - 13\n }\n if (index < 0) {\n throw new Error(`File \"${file}\" not under the source directory \"${fileSet.src}\"`)\n }\n return dest + file.substring(index)\n }\n }\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set()\n\n const fileCopier = new FileCopier(file => {\n // https://github.com/electron-userland/electron-builder/issues/3038\n return !(isLibOrExe(file) || file.endsWith(\".node\"))\n }, transformer)\n const links: Array = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n if (links.length > 0) {\n await BluebirdPromise.map(links, it => symlink(it.link, it.file), CONCURRENCY)\n }\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array\n metadata: Map\n transformedFiles?: Map | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n await BluebirdPromise.filter(\n fileSet.files,\n (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return false\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return false\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return false\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return false\n },\n CONCURRENCY\n )\n}\n\nexport async function computeFileSets(\n matchers: Array,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager,\n isElectronCompile: boolean\n): Promise> {\n const fileSets: Array = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager, mainMatcher: FileMatcher): Promise> {\n const deps = await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array()\n let index = 0\n for (const info of deps) {\n const source = info.dir\n const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null as any })\n\n // use main matcher patterns, so, user can exclude some files in such hoisted node modules\n // source here includes node_modules, but pattern base should be without because users expect that pattern \"!node_modules/loot-core/src{,/**/*}\" will work\n const matcher = new FileMatcher(path.dirname(source), destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(\n source,\n info.deps.map(it => it.name),\n nodeModuleExcludedExts\n )\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n }\n return result\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n await BluebirdPromise.map(\n mainFileSet.files,\n file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return null\n }\n return compilerHost.compile(file).then(() => null)\n },\n CONCURRENCY\n )\n\n await compilerHost.saveConfiguration()\n\n const metadata = new Map()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/bundledTool.d.ts b/client/node_modules/app-builder-lib/out/util/bundledTool.d.ts new file mode 100644 index 0000000000..aa57a54b70 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/bundledTool.d.ts @@ -0,0 +1,6 @@ +export interface ToolInfo { + path: string; + env?: any; +} +export declare function computeEnv(oldValue: string | null | undefined, newValues: Array): string; +export declare function computeToolEnv(libPath: Array): any; diff --git a/client/node_modules/app-builder-lib/out/util/bundledTool.js b/client/node_modules/app-builder-lib/out/util/bundledTool.js new file mode 100644 index 0000000000..51ab1cf465 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/bundledTool.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeToolEnv = exports.computeEnv = void 0; +function computeEnv(oldValue, newValues) { + const parsedOldValue = oldValue ? oldValue.split(":") : []; + return newValues + .concat(parsedOldValue) + .filter(it => it.length > 0) + .join(":"); +} +exports.computeEnv = computeEnv; +function computeToolEnv(libPath) { + // noinspection SpellCheckingInspection + return { + ...process.env, + DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, libPath), + }; +} +exports.computeToolEnv = computeToolEnv; +//# sourceMappingURL=bundledTool.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/bundledTool.js.map b/client/node_modules/app-builder-lib/out/util/bundledTool.js.map new file mode 100644 index 0000000000..7dbff8acf6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/bundledTool.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundledTool.js","sourceRoot":"","sources":["../../src/util/bundledTool.ts"],"names":[],"mappings":";;;AAKA,SAAgB,UAAU,CAAC,QAAmC,EAAE,SAAwB;IACtF,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1D,OAAO,SAAS;SACb,MAAM,CAAC,cAAc,CAAC;SACtB,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SAC3B,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAND,gCAMC;AAED,SAAgB,cAAc,CAAC,OAAsB;IACnD,uCAAuC;IACvC,OAAO;QACL,GAAG,OAAO,CAAC,GAAG;QACd,iBAAiB,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC;KACtE,CAAA;AACH,CAAC;AAND,wCAMC","sourcesContent":["export interface ToolInfo {\n path: string\n env?: any\n}\n\nexport function computeEnv(oldValue: string | null | undefined, newValues: Array): string {\n const parsedOldValue = oldValue ? oldValue.split(\":\") : []\n return newValues\n .concat(parsedOldValue)\n .filter(it => it.length > 0)\n .join(\":\")\n}\n\nexport function computeToolEnv(libPath: Array): any {\n // noinspection SpellCheckingInspection\n return {\n ...process.env,\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, libPath),\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/cacheManager.d.ts b/client/node_modules/app-builder-lib/out/util/cacheManager.d.ts new file mode 100644 index 0000000000..5c0dead411 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/cacheManager.d.ts @@ -0,0 +1,19 @@ +/// +import { Arch } from "builder-util"; +import { Hash } from "crypto"; +export interface BuildCacheInfo { + executableDigest: string; +} +export declare class BuildCacheManager { + private readonly executableFile; + static VERSION: string; + readonly cacheDir: string; + readonly cacheInfoFile: string; + readonly cacheFile: string; + cacheInfo: BuildCacheInfo | null; + private newDigest; + constructor(outDir: string, executableFile: string, arch: Arch); + copyIfValid(digest: string): Promise; + save(): Promise; +} +export declare function digest(hash: Hash, files: Array): Promise; diff --git a/client/node_modules/app-builder-lib/out/util/cacheManager.js b/client/node_modules/app-builder-lib/out/util/cacheManager.js new file mode 100644 index 0000000000..2c66bcb63a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/cacheManager.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.digest = exports.BuildCacheManager = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const promise_1 = require("builder-util/out/promise"); +const fs_extra_1 = require("fs-extra"); +const promises_1 = require("fs/promises"); +const path = require("path"); +class BuildCacheManager { + constructor(outDir, executableFile, arch) { + this.executableFile = executableFile; + this.cacheInfo = null; + this.newDigest = null; + this.cacheDir = path.join(outDir, ".cache", builder_util_1.Arch[arch]); + this.cacheFile = path.join(this.cacheDir, "app.exe"); + this.cacheInfoFile = path.join(this.cacheDir, "info.json"); + } + async copyIfValid(digest) { + this.newDigest = digest; + this.cacheInfo = await promise_1.orNullIfFileNotExist(fs_extra_1.readJson(this.cacheInfoFile)); + const oldDigest = this.cacheInfo == null ? null : this.cacheInfo.executableDigest; + if (oldDigest !== digest) { + builder_util_1.log.debug({ oldDigest, newDigest: digest }, "no valid cached executable found"); + return false; + } + builder_util_1.log.debug({ cacheFile: this.cacheFile, file: this.executableFile }, `copying cached executable`); + try { + await fs_1.copyFile(this.cacheFile, this.executableFile, false); + return true; + } + catch (e) { + if (e.code === "ENOENT" || e.code === "ENOTDIR") { + builder_util_1.log.debug({ error: e.code }, "copy cached executable failed"); + } + else { + builder_util_1.log.warn({ error: e.stack || e }, `cannot copy cached executable`); + } + } + return false; + } + async save() { + if (this.newDigest == null) { + throw new Error("call copyIfValid before"); + } + if (this.cacheInfo == null) { + this.cacheInfo = { executableDigest: this.newDigest }; + } + else { + this.cacheInfo.executableDigest = this.newDigest; + } + try { + await promises_1.mkdir(this.cacheDir, { recursive: true }); + await Promise.all([fs_extra_1.writeJson(this.cacheInfoFile, this.cacheInfo), fs_1.copyFile(this.executableFile, this.cacheFile, false)]); + } + catch (e) { + builder_util_1.log.warn({ error: e.stack || e }, `cannot save build cache`); + } + } +} +exports.BuildCacheManager = BuildCacheManager; +BuildCacheManager.VERSION = "0"; +async function digest(hash, files) { + // do not use pipe - better do bulk file read (https://github.com/yarnpkg/yarn/commit/7a63e0d23c46a4564bc06645caf8a59690f04d01) + for (const content of await bluebird_lst_1.default.map(files, it => promises_1.readFile(it))) { + hash.update(content); + } + hash.update(BuildCacheManager.VERSION); + return hash.digest("base64"); +} +exports.digest = digest; +//# sourceMappingURL=cacheManager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/cacheManager.js.map b/client/node_modules/app-builder-lib/out/util/cacheManager.js.map new file mode 100644 index 0000000000..4566c0b20b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/cac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,CAAC,CAAA;SACzH;QAAC,OAAO,CAAC,EAAE;YACV,kBAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAA;SAC7D;IACH,CAAC;;AA1DH,8CA2DC;AA1DQ,yBAAO,GAAG,GAAG,CAAA;AA4Df,KAAK,UAAU,MAAM,CAAC,IAAU,EAAE,KAAoB;IAC3D,+HAA+H;IAC/H,KAAK,MAAM,OAAO,IAAI,MAAM,sBAAe,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,mBAAQ,CAAC,EAAE,CAAC,CAAC,EAAE;QAC1E,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;KACrB;IAED,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;IACtC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC9B,CAAC;AARD,wBAQC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, log } from \"builder-util\"\nimport { copyFile } from \"builder-util/out/fs\"\nimport { orNullIfFileNotExist } from \"builder-util/out/promise\"\nimport { Hash } from \"crypto\"\nimport { readJson, writeJson } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport interface BuildCacheInfo {\n executableDigest: string\n}\n\nexport class BuildCacheManager {\n static VERSION = \"0\"\n\n readonly cacheDir: string\n readonly cacheInfoFile: string\n readonly cacheFile: string\n\n cacheInfo: BuildCacheInfo | null = null\n\n private newDigest: string | null = null\n\n constructor(outDir: string, private readonly executableFile: string, arch: Arch) {\n this.cacheDir = path.join(outDir, \".cache\", Arch[arch])\n this.cacheFile = path.join(this.cacheDir, \"app.exe\")\n this.cacheInfoFile = path.join(this.cacheDir, \"info.json\")\n }\n\n async copyIfValid(digest: string): Promise {\n this.newDigest = digest\n\n this.cacheInfo = await orNullIfFileNotExist(readJson(this.cacheInfoFile))\n const oldDigest = this.cacheInfo == null ? null : this.cacheInfo.executableDigest\n if (oldDigest !== digest) {\n log.debug({ oldDigest, newDigest: digest }, \"no valid cached executable found\")\n return false\n }\n\n log.debug({ cacheFile: this.cacheFile, file: this.executableFile }, `copying cached executable`)\n try {\n await copyFile(this.cacheFile, this.executableFile, false)\n return true\n } catch (e) {\n if (e.code === \"ENOENT\" || e.code === \"ENOTDIR\") {\n log.debug({ error: e.code }, \"copy cached executable failed\")\n } else {\n log.warn({ error: e.stack || e }, `cannot copy cached executable`)\n }\n }\n return false\n }\n\n async save() {\n if (this.newDigest == null) {\n throw new Error(\"call copyIfValid before\")\n }\n\n if (this.cacheInfo == null) {\n this.cacheInfo = { executableDigest: this.newDigest }\n } else {\n this.cacheInfo.executableDigest = this.newDigest\n }\n\n try {\n await mkdir(this.cacheDir, { recursive: true })\n await Promise.all([writeJson(this.cacheInfoFile, this.cacheInfo), copyFile(this.executableFile, this.cacheFile, false)])\n } catch (e) {\n log.warn({ error: e.stack || e }, `cannot save build cache`)\n }\n }\n}\n\nexport async function digest(hash: Hash, files: Array) {\n // do not use pipe - better do bulk file read (https://github.com/yarnpkg/yarn/commit/7a63e0d23c46a4564bc06645caf8a59690f04d01)\n for (const content of await BluebirdPromise.map(files, it => readFile(it))) {\n hash.update(content)\n }\n\n hash.update(BuildCacheManager.VERSION)\n return hash.digest(\"base64\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/config.d.ts b/client/node_modules/app-builder-lib/out/util/config.d.ts new file mode 100644 index 0000000000..fdd55e0859 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/config.d.ts @@ -0,0 +1,13 @@ +import { DebugLogger } from "builder-util"; +import { Lazy } from "lazy-val"; +import { Configuration } from "../configuration"; +export declare function getConfig(projectDir: string, configPath: string | null, configFromOptions: Configuration | null | undefined, packageMetadata?: Lazy<{ + [key: string]: any; +} | null>): Promise; +/** + * `doMergeConfigs` takes configs in the order you would pass them to + * Object.assign as sources. + */ +export declare function doMergeConfigs(configs: Configuration[]): Configuration; +export declare function validateConfig(config: Configuration, debugLogger: DebugLogger): Promise; +export declare function computeDefaultAppDirectory(projectDir: string, userAppDir: string | null | undefined): Promise; diff --git a/client/node_modules/app-builder-lib/out/util/config.js b/client/node_modules/app-builder-lib/out/util/config.js new file mode 100644 index 0000000000..bf08614bcc --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/config.js @@ -0,0 +1,259 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeDefaultAppDirectory = exports.validateConfig = exports.doMergeConfigs = exports.getConfig = void 0; +const builder_util_1 = require("builder-util"); +const fs_1 = require("builder-util/out/fs"); +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const read_config_file_1 = require("read-config-file"); +const rectCra_1 = require("../presets/rectCra"); +const version_1 = require("../version"); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const validateSchema = require("@develar/schema-utils"); +// https://github.com/electron-userland/electron-builder/issues/1847 +function mergePublish(config, configFromOptions) { + // if config from disk doesn't have publish (or object), no need to handle, it will be simply merged by deepAssign + const publish = Array.isArray(config.publish) ? configFromOptions.publish : null; + if (publish != null) { + delete configFromOptions.publish; + } + builder_util_1.deepAssign(config, configFromOptions); + if (publish == null) { + return; + } + const listOnDisk = config.publish; + if (listOnDisk.length === 0) { + config.publish = publish; + } + else { + // apply to first + Object.assign(listOnDisk[0], publish); + } +} +async function getConfig(projectDir, configPath, configFromOptions, packageMetadata = new lazy_val_1.Lazy(() => read_config_file_1.orNullIfFileNotExist(fs_extra_1.readJson(path.join(projectDir, "package.json"))))) { + const configRequest = { packageKey: "build", configFilename: "electron-builder", projectDir, packageMetadata }; + const configAndEffectiveFile = await read_config_file_1.getConfig(configRequest, configPath); + const config = configAndEffectiveFile == null ? {} : configAndEffectiveFile.result; + if (configFromOptions != null) { + mergePublish(config, configFromOptions); + } + if (configAndEffectiveFile != null) { + builder_util_1.log.info({ file: configAndEffectiveFile.configFile == null ? 'package.json ("build" field)' : configAndEffectiveFile.configFile }, "loaded configuration"); + } + if (config.extends == null && config.extends !== null) { + const metadata = (await packageMetadata.value) || {}; + const devDependencies = metadata.devDependencies; + const dependencies = metadata.dependencies; + if ((dependencies != null && "react-scripts" in dependencies) || (devDependencies != null && "react-scripts" in devDependencies)) { + config.extends = "react-cra"; + } + else if (devDependencies != null && "electron-webpack" in devDependencies) { + let file = "electron-webpack/out/electron-builder.js"; + try { + file = require.resolve(file); + } + catch (ignore) { + file = require.resolve("electron-webpack/electron-builder.yml"); + } + config.extends = `file:${file}`; + } + } + const parentConfigs = await loadParentConfigsRecursively(config.extends, async (configExtend) => { + if (configExtend === "react-cra") { + const result = await rectCra_1.reactCra(projectDir); + builder_util_1.log.info({ preset: configExtend }, "loaded parent configuration"); + return result; + } + else { + const { configFile, result } = await read_config_file_1.loadParentConfig(configRequest, configExtend); + builder_util_1.log.info({ file: configFile }, "loaded parent configuration"); + return result; + } + }); + return doMergeConfigs([...parentConfigs, config]); +} +exports.getConfig = getConfig; +function asArray(value) { + return Array.isArray(value) ? value : typeof value === "string" ? [value] : []; +} +async function loadParentConfigsRecursively(configExtends, loader) { + const configs = []; + for (const configExtend of asArray(configExtends)) { + const result = await loader(configExtend); + const parentConfigs = await loadParentConfigsRecursively(result.extends, loader); + configs.push(...parentConfigs, result); + } + return configs; +} +// normalize for easy merge +function normalizeFiles(configuration, name) { + let value = configuration[name]; + if (value == null) { + return; + } + if (!Array.isArray(value)) { + value = [value]; + } + itemLoop: for (let i = 0; i < value.length; i++) { + let item = value[i]; + if (typeof item === "string") { + // merge with previous if possible + if (i !== 0) { + let prevItemIndex = i - 1; + let prevItem; + do { + prevItem = value[prevItemIndex--]; + } while (prevItem == null); + if (prevItem.from == null && prevItem.to == null) { + if (prevItem.filter == null) { + prevItem.filter = [item]; + } + else { + ; + prevItem.filter.push(item); + } + value[i] = null; + continue itemLoop; + } + } + item = { + filter: [item], + }; + value[i] = item; + } + else if (Array.isArray(item)) { + throw new Error(`${name} configuration is invalid, nested array not expected for index ${i}: ${item}`); + } + // make sure that merge logic is not complex - unify different presentations + if (item.from === ".") { + item.from = undefined; + } + if (item.to === ".") { + item.to = undefined; + } + if (item.filter != null && typeof item.filter === "string") { + item.filter = [item.filter]; + } + } + configuration[name] = value.filter(it => it != null); +} +function isSimilarFileSet(value, other) { + return value.from === other.from && value.to === other.to; +} +function mergeFilters(value, other) { + return asArray(value).concat(asArray(other)); +} +function mergeFileSets(lists) { + const result = []; + for (const list of lists) { + for (const item of list) { + const existingItem = result.find(i => isSimilarFileSet(i, item)); + if (existingItem) { + existingItem.filter = mergeFilters(item.filter, existingItem.filter); + } + else { + result.push(item); + } + } + } + return result; +} +/** + * `doMergeConfigs` takes configs in the order you would pass them to + * Object.assign as sources. + */ +function doMergeConfigs(configs) { + for (const config of configs) { + normalizeFiles(config, "files"); + normalizeFiles(config, "extraFiles"); + normalizeFiles(config, "extraResources"); + } + const result = builder_util_1.deepAssign(getDefaultConfig(), ...configs); + // `deepAssign` prioritises latter configs, while `mergeFilesSets` prioritises + // former configs, so we have to reverse the order, because latter configs + // must have higher priority. + configs = configs.slice().reverse(); + result.files = mergeFileSets(configs.map(config => { var _a; return ((_a = config.files) !== null && _a !== void 0 ? _a : []); })); + return result; +} +exports.doMergeConfigs = doMergeConfigs; +function getDefaultConfig() { + return { + directories: { + output: "dist", + buildResources: "build", + }, + }; +} +const schemeDataPromise = new lazy_val_1.Lazy(() => fs_extra_1.readJson(path.join(__dirname, "..", "..", "scheme.json"))); +async function validateConfig(config, debugLogger) { + const extraMetadata = config.extraMetadata; + if (extraMetadata != null) { + if (extraMetadata.build != null) { + throw new builder_util_1.InvalidConfigurationError(`--em.build is deprecated, please specify as -c"`); + } + if (extraMetadata.directories != null) { + throw new builder_util_1.InvalidConfigurationError(`--em.directories is deprecated, please specify as -c.directories"`); + } + } + const oldConfig = config; + if (oldConfig.npmSkipBuildFromSource === false) { + throw new builder_util_1.InvalidConfigurationError(`npmSkipBuildFromSource is deprecated, please use buildDependenciesFromSource"`); + } + if (oldConfig.appImage != null && oldConfig.appImage.systemIntegration != null) { + throw new builder_util_1.InvalidConfigurationError(`appImage.systemIntegration is deprecated, https://github.com/TheAssassin/AppImageLauncher is used for desktop integration"`); + } + // noinspection JSUnusedGlobalSymbols + validateSchema(await schemeDataPromise.value, config, { + name: `electron-builder ${version_1.PACKAGE_VERSION}`, + postFormatter: (formattedError, error) => { + if (debugLogger.isEnabled) { + debugLogger.add("invalidConfig", builder_util_1.safeStringifyJson(error)); + } + const site = "https://www.electron.build"; + let url = `${site}/configuration/configuration`; + const targets = new Set(["mac", "dmg", "pkg", "mas", "win", "nsis", "appx", "linux", "appimage", "snap"]); + const dataPath = error.dataPath == null ? null : error.dataPath; + const targetPath = dataPath.startsWith(".") ? dataPath.substr(1).toLowerCase() : null; + if (targetPath != null && targets.has(targetPath)) { + url = `${site}/configuration/${targetPath}`; + } + return `${formattedError}\n How to fix: + 1. Open ${url} + 2. Search the option name on the page (or type in into Search to find across the docs). + * Not found? The option was deprecated or not exists (check spelling). + * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root. +`; + }, + }); +} +exports.validateConfig = validateConfig; +const DEFAULT_APP_DIR_NAMES = ["app", "www"]; +async function computeDefaultAppDirectory(projectDir, userAppDir) { + if (userAppDir != null) { + const absolutePath = path.resolve(projectDir, userAppDir); + const stat = await fs_1.statOrNull(absolutePath); + if (stat == null) { + throw new builder_util_1.InvalidConfigurationError(`Application directory ${userAppDir} doesn't exist`); + } + else if (!stat.isDirectory()) { + throw new builder_util_1.InvalidConfigurationError(`Application directory ${userAppDir} is not a directory`); + } + else if (projectDir === absolutePath) { + builder_util_1.log.warn({ appDirectory: userAppDir }, `Specified application directory equals to project dir — superfluous or wrong configuration`); + } + return absolutePath; + } + for (const dir of DEFAULT_APP_DIR_NAMES) { + const absolutePath = path.join(projectDir, dir); + const packageJson = path.join(absolutePath, "package.json"); + const stat = await fs_1.statOrNull(packageJson); + if (stat != null && stat.isFile()) { + return absolutePath; + } + } + return projectDir; +} +exports.computeDefaultAppDirectory = computeDefaultAppDirectory; +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/config.js.map b/client/node_modules/app-builder-lib/out/util/config.js.map new file mode 100644 index 0000000000..cad835a4d7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/util/config.ts"],"names":[],"mappings":";;;AAAA,+CAAyG;AACzG,4CAAgD;AAChD,uCAAmC;AACnC,uCAA+B;AAC/B,6BAA4B;AAC5B,uDAAqH;AAGrH,gDAA6C;AAC7C,wCAA4C;AAC5C,8DAA8D;AAC9D,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAEvD,oEAAoE;AACpE,SAAS,YAAY,CAAC,MAAqB,EAAE,iBAAgC;IAC3E,kHAAkH;IAClH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;IAChF,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAQ,iBAAyB,CAAC,OAAO,CAAA;KAC1C;IAED,yBAAU,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAErC,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAM;KACP;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,OAAqB,CAAA;IAC/C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;KACzB;SAAM;QACL,iBAAiB;QACjB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;KACtC;AACH,CAA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AAI,EAAE;YAChB,MAAM,IAAI,wCAAyB,CAAC,yBAAyB,UAAU,gBAAgB,CAAC,CAAA;SACzF;aAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE;YAC9B,MAAM,IAAI,wCAAyB,CAAC,yBAAyB,UAAU,qBAAqB,CAAC,CAAA;SAC9F;aAAM,IAAI,UAAU,KAAK,YAAY,EAAE;YACtC,kBAAG,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,4FAA4F,CAAC,CAAA;SACrI;QACD,OAAO,YAAY,CAAA;KACpB;IAED,KAAK,MAAM,GAAG,IAAI,qBAAqB,EAAE;QACvC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;QAC3D,MAAM,IAAI,GAAG,MAAM,eAAU,CAAC,WAAW,CAAC,CAAA;QAC1C,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;YACjC,OAAO,YAAY,CAAA;SACpB;KACF;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAvBD,gEAuBC","sourcesContent":["import { DebugLogger, deepAssign, InvalidConfigurationError, log, safeStringifyJson } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { readJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist, ReadConfigRequest } from \"read-config-file\"\nimport { Configuration } from \"../configuration\"\nimport { FileSet } from \"../options/PlatformSpecificBuildOptions\"\nimport { reactCra } from \"../presets/rectCra\"\nimport { PACKAGE_VERSION } from \"../version\"\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst validateSchema = require(\"@develar/schema-utils\")\n\n// https://github.com/electron-userland/electron-builder/issues/1847\nfunction mergePublish(config: Configuration, configFromOptions: Configuration) {\n // if config from disk doesn't have publish (or object), no need to handle, it will be simply merged by deepAssign\n const publish = Array.isArray(config.publish) ? configFromOptions.publish : null\n if (publish != null) {\n delete (configFromOptions as any).publish\n }\n\n deepAssign(config, configFromOptions)\n\n if (publish == null) {\n return\n }\n\n const listOnDisk = config.publish as Array\n if (listOnDisk.length === 0) {\n config.publish = publish\n } else {\n // apply to first\n Object.assign(listOnDisk[0], publish)\n }\n}\n\nexport async function getConfig(\n projectDir: string,\n configPath: string | null,\n configFromOptions: Configuration | null | undefined,\n packageMetadata: Lazy<{ [key: string]: any } | null> = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, \"package.json\"))))\n): Promise {\n const configRequest: ReadConfigRequest = { packageKey: \"build\", configFilename: \"electron-builder\", projectDir, packageMetadata }\n const configAndEffectiveFile = await _getConfig(configRequest, configPath)\n const config = configAndEffectiveFile == null ? {} : configAndEffectiveFile.result\n if (configFromOptions != null) {\n mergePublish(config, configFromOptions)\n }\n\n if (configAndEffectiveFile != null) {\n log.info({ file: configAndEffectiveFile.configFile == null ? 'package.json (\"build\" field)' : configAndEffectiveFile.configFile }, \"loaded configuration\")\n }\n\n if (config.extends == null && config.extends !== null) {\n const metadata = (await packageMetadata.value) || {}\n const devDependencies = metadata.devDependencies\n const dependencies = metadata.dependencies\n if ((dependencies != null && \"react-scripts\" in dependencies) || (devDependencies != null && \"react-scripts\" in devDependencies)) {\n config.extends = \"react-cra\"\n } else if (devDependencies != null && \"electron-webpack\" in devDependencies) {\n let file = \"electron-webpack/out/electron-builder.js\"\n try {\n file = require.resolve(file)\n } catch (ignore) {\n file = require.resolve(\"electron-webpack/electron-builder.yml\")\n }\n config.extends = `file:${file}`\n }\n }\n\n const parentConfigs = await loadParentConfigsRecursively(config.extends, async configExtend => {\n if (configExtend === \"react-cra\") {\n const result = await reactCra(projectDir)\n log.info({ preset: configExtend }, \"loaded parent configuration\")\n return result\n } else {\n const { configFile, result } = await loadParentConfig(configRequest, configExtend)\n log.info({ file: configFile }, \"loaded parent configuration\")\n return result\n }\n })\n\n return doMergeConfigs([...parentConfigs, config])\n}\n\nfunction asArray(value: string[] | string | undefined | null): string[] {\n return Array.isArray(value) ? value : typeof value === \"string\" ? [value] : []\n}\n\nasync function loadParentConfigsRecursively(configExtends: Configuration[\"extends\"], loader: (configExtend: string) => Promise): Promise {\n const configs = []\n\n for (const configExtend of asArray(configExtends)) {\n const result = await loader(configExtend)\n const parentConfigs = await loadParentConfigsRecursively(result.extends, loader)\n configs.push(...parentConfigs, result)\n }\n\n return configs\n}\n\n// normalize for easy merge\nfunction normalizeFiles(configuration: Configuration, name: \"files\" | \"extraFiles\" | \"extraResources\") {\n let value = configuration[name]\n if (value == null) {\n return\n }\n\n if (!Array.isArray(value)) {\n value = [value]\n }\n\n itemLoop: for (let i = 0; i < value.length; i++) {\n let item = value[i]\n if (typeof item === \"string\") {\n // merge with previous if possible\n if (i !== 0) {\n let prevItemIndex = i - 1\n let prevItem: FileSet\n do {\n prevItem = value[prevItemIndex--] as FileSet\n } while (prevItem == null)\n\n if (prevItem.from == null && prevItem.to == null) {\n if (prevItem.filter == null) {\n prevItem.filter = [item]\n } else {\n ;(prevItem.filter as Array).push(item)\n }\n value[i] = null as any\n continue itemLoop\n }\n }\n\n item = {\n filter: [item],\n }\n value[i] = item\n } else if (Array.isArray(item)) {\n throw new Error(`${name} configuration is invalid, nested array not expected for index ${i}: ${item}`)\n }\n\n // make sure that merge logic is not complex - unify different presentations\n if (item.from === \".\") {\n item.from = undefined\n }\n\n if (item.to === \".\") {\n item.to = undefined\n }\n\n if (item.filter != null && typeof item.filter === \"string\") {\n item.filter = [item.filter]\n }\n }\n\n configuration[name] = value.filter(it => it != null)\n}\n\nfunction isSimilarFileSet(value: FileSet, other: FileSet): boolean {\n return value.from === other.from && value.to === other.to\n}\n\ntype Filter = FileSet[\"filter\"]\n\nfunction mergeFilters(value: Filter, other: Filter): string[] {\n return asArray(value).concat(asArray(other))\n}\n\nfunction mergeFileSets(lists: FileSet[][]): FileSet[] {\n const result = []\n\n for (const list of lists) {\n for (const item of list) {\n const existingItem = result.find(i => isSimilarFileSet(i, item))\n if (existingItem) {\n existingItem.filter = mergeFilters(item.filter, existingItem.filter)\n } else {\n result.push(item)\n }\n }\n }\n\n return result\n}\n\n/**\n * `doMergeConfigs` takes configs in the order you would pass them to\n * Object.assign as sources.\n */\nexport function doMergeConfigs(configs: Configuration[]): Configuration {\n for (const config of configs) {\n normalizeFiles(config, \"files\")\n normalizeFiles(config, \"extraFiles\")\n normalizeFiles(config, \"extraResources\")\n }\n\n const result = deepAssign(getDefaultConfig(), ...configs)\n\n // `deepAssign` prioritises latter configs, while `mergeFilesSets` prioritises\n // former configs, so we have to reverse the order, because latter configs\n // must have higher priority.\n configs = configs.slice().reverse()\n\n result.files = mergeFileSets(configs.map(config => (config.files ?? []) as FileSet[]))\n return result\n}\n\nfunction getDefaultConfig(): Configuration {\n return {\n directories: {\n output: \"dist\",\n buildResources: \"build\",\n },\n }\n}\n\nconst schemeDataPromise = new Lazy(() => readJson(path.join(__dirname, \"..\", \"..\", \"scheme.json\")))\n\nexport async function validateConfig(config: Configuration, debugLogger: DebugLogger) {\n const extraMetadata = config.extraMetadata\n if (extraMetadata != null) {\n if (extraMetadata.build != null) {\n throw new InvalidConfigurationError(`--em.build is deprecated, please specify as -c\"`)\n }\n if (extraMetadata.directories != null) {\n throw new InvalidConfigurationError(`--em.directories is deprecated, please specify as -c.directories\"`)\n }\n }\n\n const oldConfig: any = config\n if (oldConfig.npmSkipBuildFromSource === false) {\n throw new InvalidConfigurationError(`npmSkipBuildFromSource is deprecated, please use buildDependenciesFromSource\"`)\n }\n if (oldConfig.appImage != null && oldConfig.appImage.systemIntegration != null) {\n throw new InvalidConfigurationError(`appImage.systemIntegration is deprecated, https://github.com/TheAssassin/AppImageLauncher is used for desktop integration\"`)\n }\n\n // noinspection JSUnusedGlobalSymbols\n validateSchema(await schemeDataPromise.value, config, {\n name: `electron-builder ${PACKAGE_VERSION}`,\n postFormatter: (formattedError: string, error: any): string => {\n if (debugLogger.isEnabled) {\n debugLogger.add(\"invalidConfig\", safeStringifyJson(error))\n }\n\n const site = \"https://www.electron.build\"\n let url = `${site}/configuration/configuration`\n const targets = new Set([\"mac\", \"dmg\", \"pkg\", \"mas\", \"win\", \"nsis\", \"appx\", \"linux\", \"appimage\", \"snap\"])\n const dataPath: string = error.dataPath == null ? null : error.dataPath\n const targetPath = dataPath.startsWith(\".\") ? dataPath.substr(1).toLowerCase() : null\n if (targetPath != null && targets.has(targetPath)) {\n url = `${site}/configuration/${targetPath}`\n }\n\n return `${formattedError}\\n How to fix:\n 1. Open ${url}\n 2. Search the option name on the page (or type in into Search to find across the docs).\n * Not found? The option was deprecated or not exists (check spelling).\n * Found? Check that the option in the appropriate place. e.g. \"title\" only in the \"dmg\", not in the root.\n`\n },\n })\n}\n\nconst DEFAULT_APP_DIR_NAMES = [\"app\", \"www\"]\n\nexport async function computeDefaultAppDirectory(projectDir: string, userAppDir: string | null | undefined): Promise {\n if (userAppDir != null) {\n const absolutePath = path.resolve(projectDir, userAppDir)\n const stat = await statOrNull(absolutePath)\n if (stat == null) {\n throw new InvalidConfigurationError(`Application directory ${userAppDir} doesn't exist`)\n } else if (!stat.isDirectory()) {\n throw new InvalidConfigurationError(`Application directory ${userAppDir} is not a directory`)\n } else if (projectDir === absolutePath) {\n log.warn({ appDirectory: userAppDir }, `Specified application directory equals to project dir — superfluous or wrong configuration`)\n }\n return absolutePath\n }\n\n for (const dir of DEFAULT_APP_DIR_NAMES) {\n const absolutePath = path.join(projectDir, dir)\n const packageJson = path.join(absolutePath, \"package.json\")\n const stat = await statOrNull(packageJson)\n if (stat != null && stat.isFile()) {\n return absolutePath\n }\n }\n return projectDir\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/filename.d.ts b/client/node_modules/app-builder-lib/out/util/filename.d.ts new file mode 100644 index 0000000000..cca00eb34a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filename.d.ts @@ -0,0 +1,2 @@ +export declare function sanitizeFileName(s: string): string; +export declare function getCompleteExtname(filename: string): string; diff --git a/client/node_modules/app-builder-lib/out/util/filename.js b/client/node_modules/app-builder-lib/out/util/filename.js new file mode 100644 index 0000000000..744da8a7fa --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filename.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCompleteExtname = exports.sanitizeFileName = void 0; +// @ts-ignore +const _sanitizeFileName = require("sanitize-filename"); +const path = require("path"); +function sanitizeFileName(s) { + return _sanitizeFileName(s); +} +exports.sanitizeFileName = sanitizeFileName; +// Get the filetype from a filename. Returns a string of one or more file extensions, +// e.g. .zip, .dmg, .tar.gz, .tar.bz2, .exe.blockmap. We'd normally use `path.extname()`, +// but it doesn't support multiple extensions, e.g. Foo-1.0.0.dmg.blockmap should be +// .dmg.blockmap, not .blockmap. +function getCompleteExtname(filename) { + let extname = path.extname(filename); + switch (extname) { + // Append leading extension for blockmap filetype + case ".blockmap": { + extname = path.extname(filename.replace(extname, "")) + extname; + break; + } + // Append leading extension for known compressed tar formats + case ".bz2": + case ".gz": + case ".lz": + case ".xz": + case ".7z": { + const ext = path.extname(filename.replace(extname, "")); + if (ext === ".tar") { + extname = ext + extname; + } + break; + } + } + return extname; +} +exports.getCompleteExtname = getCompleteExtname; +//# sourceMappingURL=filename.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/filename.js.map b/client/node_modules/app-builder-lib/out/util/filename.js.map new file mode 100644 index 0000000000..772a7fb4b6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filename.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filename.js","sourceRoot":"","sources":["../../src/util/filename.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uDAAsD;AACtD,6BAA4B;AAE5B,SAAgB,gBAAgB,CAAC,CAAS;IACxC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC;AAFD,4CAEC;AAED,qFAAqF;AACrF,yFAAyF;AACzF,oFAAoF;AACpF,gCAAgC;AAChC,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEpC,QAAQ,OAAO,EAAE;QACf,iDAAiD;QACjD,KAAK,WAAW,CAAC,CAAC;YAChB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAA;YAE/D,MAAK;SACN;QACD,4DAA4D;QAC5D,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC,CAAC;YACV,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;YACvD,IAAI,GAAG,KAAK,MAAM,EAAE;gBAClB,OAAO,GAAG,GAAG,GAAG,OAAO,CAAA;aACxB;YAED,MAAK;SACN;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AA1BD,gDA0BC","sourcesContent":["// @ts-ignore\nimport * as _sanitizeFileName from \"sanitize-filename\"\nimport * as path from \"path\"\n\nexport function sanitizeFileName(s: string): string {\n return _sanitizeFileName(s)\n}\n\n// Get the filetype from a filename. Returns a string of one or more file extensions,\n// e.g. .zip, .dmg, .tar.gz, .tar.bz2, .exe.blockmap. We'd normally use `path.extname()`,\n// but it doesn't support multiple extensions, e.g. Foo-1.0.0.dmg.blockmap should be\n// .dmg.blockmap, not .blockmap.\nexport function getCompleteExtname(filename: string): string {\n let extname = path.extname(filename)\n\n switch (extname) {\n // Append leading extension for blockmap filetype\n case \".blockmap\": {\n extname = path.extname(filename.replace(extname, \"\")) + extname\n\n break\n }\n // Append leading extension for known compressed tar formats\n case \".bz2\":\n case \".gz\":\n case \".lz\":\n case \".xz\":\n case \".7z\": {\n const ext = path.extname(filename.replace(extname, \"\"))\n if (ext === \".tar\") {\n extname = ext + extname\n }\n\n break\n }\n }\n\n return extname\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/filter.d.ts b/client/node_modules/app-builder-lib/out/util/filter.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filter.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/util/filter.js b/client/node_modules/app-builder-lib/out/util/filter.js new file mode 100644 index 0000000000..8066f66839 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filter.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFilter = exports.hasMagic = void 0; +const path = require("path"); +const fileTransformer_1 = require("../fileTransformer"); +/** @internal */ +function hasMagic(pattern) { + const set = pattern.set; + if (set.length > 1) { + return true; + } + for (const i of set[0]) { + if (typeof i !== "string") { + return true; + } + } + return false; +} +exports.hasMagic = hasMagic; +// sometimes, destination may not contain path separator in the end (path to folder), but the src does. So let's ensure paths have path separators in the end +function ensureEndSlash(s) { + return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep; +} +function getRelativePath(file, srcWithEndSlash) { + if (!file.startsWith(srcWithEndSlash)) { + const index = file.indexOf(fileTransformer_1.NODE_MODULES_PATTERN); + if (index < 0) { + throw new Error(`${file} must be under ${srcWithEndSlash}`); + } + else { + return file.substring(index + 1 /* leading slash */); + } + } + let relative = file.substring(srcWithEndSlash.length); + if (path.sep === "\\") { + if (relative.startsWith("\\")) { + // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers + relative = relative.substring(1); + } + relative = relative.replace(/\\/g, "/"); + } + return relative; +} +/** @internal */ +function createFilter(src, patterns, excludePatterns) { + const srcWithEndSlash = ensureEndSlash(src); + return (file, stat) => { + if (src === file) { + return true; + } + const relative = getRelativePath(file, srcWithEndSlash); + // https://github.com/electron-userland/electron-builder/issues/867 + return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat)); + }; +} +exports.createFilter = createFilter; +// https://github.com/joshwnj/minimatch-all/blob/master/index.js +function minimatchAll(path, patterns, stat) { + let match = false; + for (const pattern of patterns) { + // If we've got a match, only re-test for exclusions. + // if we don't have a match, only re-test for inclusions. + if (match !== pattern.negate) { + continue; + } + // partial match — pattern: foo/bar.txt path: foo — we must allow foo + // use it only for non-negate patterns: const m = new Minimatch("!node_modules/@(electron-download|electron)/**/*", {dot: true }); m.match("node_modules", true) will return false, but must be true + match = pattern.match(path, stat.isDirectory() && !pattern.negate); + } + return match; +} +//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/filter.js.map b/client/node_modules/app-builder-lib/out/util/filter.js.map new file mode 100644 index 0000000000..6f9ff6c001 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/filter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/util/filter.ts"],"names":[],"mappings":";;;AAGA,6BAA4B;AAC5B,wDAAyD;AAEzD,gBAAgB;AAChB,SAAgB,QAAQ,CAAC,OAAkB;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;QAClB,OAAO,IAAI,CAAA;KACZ;IAED,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;QACtB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACzB,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAbD,4BAaC;AAED,6JAA6J;AAC7J,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAA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e,CAAC,CAAA;QACvD,mEAAmE;QACnE,OAAO,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,CAAA;IACpJ,CAAC,CAAA;AACH,CAAC;AAXD,oCAWC;AAED,gEAAgE;AAChE,SAAS,YAAY,CAAC,IAAY,EAAE,QAA0B,EAAE,IAAW;IACzE,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,qDAAqD;QACrD,yDAAyD;QACzD,IAAI,KAAK,KAAK,OAAO,CAAC,MAAM,EAAE;YAC5B,SAAQ;SACT;QAED,qEAAqE;QACrE,oMAAoM;QACpM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KACnE;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { Filter } from \"builder-util/out/fs\"\nimport { Stats } from \"fs-extra\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { NODE_MODULES_PATTERN } from \"../fileTransformer\"\n\n/** @internal */\nexport function hasMagic(pattern: Minimatch) {\n const set = pattern.set\n if (set.length > 1) {\n return true\n }\n\n for (const i of set[0]) {\n if (typeof i !== \"string\") {\n return true\n }\n }\n\n return false\n}\n\n// sometimes, destination may not contain path separator in the end (path to folder), but the src does. So let's ensure paths have path separators in the end\nfunction ensureEndSlash(s: string) {\n return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep\n}\n\nfunction getRelativePath(file: string, srcWithEndSlash: string) {\n if (!file.startsWith(srcWithEndSlash)) {\n const index = file.indexOf(NODE_MODULES_PATTERN)\n if (index < 0) {\n throw new Error(`${file} must be under ${srcWithEndSlash}`)\n } else {\n return file.substring(index + 1 /* leading slash */)\n }\n }\n\n let relative = file.substring(srcWithEndSlash.length)\n if (path.sep === \"\\\\\") {\n if (relative.startsWith(\"\\\\\")) {\n // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers\n relative = relative.substring(1)\n }\n relative = relative.replace(/\\\\/g, \"/\")\n }\n return relative\n}\n\n/** @internal */\nexport function createFilter(src: string, patterns: Array, excludePatterns?: Array | null): Filter {\n const srcWithEndSlash = ensureEndSlash(src)\n return (file, stat) => {\n if (src === file) {\n return true\n }\n\n const relative = getRelativePath(file, srcWithEndSlash)\n // https://github.com/electron-userland/electron-builder/issues/867\n return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat))\n }\n}\n\n// https://github.com/joshwnj/minimatch-all/blob/master/index.js\nfunction minimatchAll(path: string, patterns: Array, stat: Stats): boolean {\n let match = false\n for (const pattern of patterns) {\n // If we've got a match, only re-test for exclusions.\n // if we don't have a match, only re-test for inclusions.\n if (match !== pattern.negate) {\n continue\n }\n\n // partial match — pattern: foo/bar.txt path: foo — we must allow foo\n // use it only for non-negate patterns: const m = new Minimatch(\"!node_modules/@(electron-download|electron)/**/*\", {dot: true }); m.match(\"node_modules\", true) will return false, but must be true\n match = pattern.match(path, stat.isDirectory() && !pattern.negate)\n }\n return match\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/flags.d.ts b/client/node_modules/app-builder-lib/out/util/flags.d.ts new file mode 100644 index 0000000000..10ddbd5381 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/flags.d.ts @@ -0,0 +1,3 @@ +export declare function isUseSystemSigncode(): boolean; +export declare function isBuildCacheEnabled(): boolean; +export declare function isAutoDiscoveryCodeSignIdentity(): boolean; diff --git a/client/node_modules/app-builder-lib/out/util/flags.js b/client/node_modules/app-builder-lib/out/util/flags.js new file mode 100644 index 0000000000..b61ce5fb3b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/flags.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isAutoDiscoveryCodeSignIdentity = exports.isBuildCacheEnabled = exports.isUseSystemSigncode = void 0; +const builder_util_1 = require("builder-util"); +function isUseSystemSigncode() { + return builder_util_1.isEnvTrue(process.env.USE_SYSTEM_SIGNCODE); +} +exports.isUseSystemSigncode = isUseSystemSigncode; +function isBuildCacheEnabled() { + return !builder_util_1.isEnvTrue(process.env.ELECTRON_BUILDER_DISABLE_BUILD_CACHE); +} +exports.isBuildCacheEnabled = isBuildCacheEnabled; +function isAutoDiscoveryCodeSignIdentity() { + return process.env.CSC_IDENTITY_AUTO_DISCOVERY !== "false"; +} +exports.isAutoDiscoveryCodeSignIdentity = isAutoDiscoveryCodeSignIdentity; +//# sourceMappingURL=flags.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/flags.js.map b/client/node_modules/app-builder-lib/out/util/flags.js.map new file mode 100644 index 0000000000..902bb29697 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/flags.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/util/flags.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,SAAgB,mBAAmB;IACjC,OAAO,wBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AACnD,CAAC;AAFD,kDAEC;AAED,SAAgB,mBAAmB;IACjC,OAAO,CAAC,wBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACrE,CAAC;AAFD,kDAEC;AAED,SAAgB,+BAA+B;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,OAAO,CAAA;AAC5D,CAAC;AAFD,0EAEC","sourcesContent":["import { isEnvTrue } from \"builder-util\"\n\nexport function isUseSystemSigncode() {\n return isEnvTrue(process.env.USE_SYSTEM_SIGNCODE)\n}\n\nexport function isBuildCacheEnabled() {\n return !isEnvTrue(process.env.ELECTRON_BUILDER_DISABLE_BUILD_CACHE)\n}\n\nexport function isAutoDiscoveryCodeSignIdentity() {\n return process.env.CSC_IDENTITY_AUTO_DISCOVERY !== \"false\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/hash.d.ts b/client/node_modules/app-builder-lib/out/util/hash.d.ts new file mode 100644 index 0000000000..373178f76b --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/hash.d.ts @@ -0,0 +1 @@ +export declare function hashFile(file: string, algorithm?: string, encoding?: "base64" | "hex", options?: any): Promise; diff --git a/client/node_modules/app-builder-lib/out/util/hash.js b/client/node_modules/app-builder-lib/out/util/hash.js new file mode 100644 index 0000000000..42c547cb83 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/hash.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hashFile = void 0; +const crypto_1 = require("crypto"); +const fs_1 = require("fs"); +function hashFile(file, algorithm = "sha512", encoding = "base64", options) { + return new Promise((resolve, reject) => { + const hash = crypto_1.createHash(algorithm); + hash.on("error", reject).setEncoding(encoding); + fs_1.createReadStream(file, { ...options, highWaterMark: 1024 * 1024 /* better to use more memory but hash faster */ }) + .on("error", reject) + .on("end", () => { + hash.end(); + resolve(hash.read()); + }) + .pipe(hash, { end: false }); + }); +} +exports.hashFile = hashFile; +//# sourceMappingURL=hash.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/hash.js.map b/client/node_modules/app-builder-lib/out/util/hash.js.map new file mode 100644 index 0000000000..b5a82fe883 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/hash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/util/hash.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,2BAAqC;AAErC,SAAgB,QAAQ,CAAC,IAAY,EAAE,SAAS,GAAG,QAAQ,EAAE,WAA6B,QAAQ,EAAE,OAAa;IAC/G,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAG,mBAAU,CAAC,SAAS,CAAC,CAAA;QAClC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QAE9C,qBAAgB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC,+CAA+C,EAAE,CAAC;aAC/G,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;aACnB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACd,IAAI,CAAC,GAAG,EAAE,CAAA;YACV,OAAO,CAAC,IAAI,CAAC,IAAI,EAAY,CAAC,CAAA;QAChC,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;AACJ,CAAC;AAbD,4BAaC","sourcesContent":["import { createHash } from \"crypto\"\nimport { createReadStream } from \"fs\"\n\nexport function hashFile(file: string, algorithm = \"sha512\", encoding: \"base64\" | \"hex\" = \"base64\", options?: any) {\n return new Promise((resolve, reject) => {\n const hash = createHash(algorithm)\n hash.on(\"error\", reject).setEncoding(encoding)\n\n createReadStream(file, { ...options, highWaterMark: 1024 * 1024 /* better to use more memory but hash faster */ })\n .on(\"error\", reject)\n .on(\"end\", () => {\n hash.end()\n resolve(hash.read() as string)\n })\n .pipe(hash, { end: false })\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/langs.d.ts b/client/node_modules/app-builder-lib/out/util/langs.d.ts new file mode 100644 index 0000000000..bb942aa909 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/langs.d.ts @@ -0,0 +1,189 @@ +export declare const bundledLanguages: string[]; +export declare function toLangWithRegion(lang: string): string; +export declare const lcid: any; +export declare const langIdToName: { + ab: string; + aa: string; + af: string; + ak: string; + sq: string; + am: string; + ar: string; + an: string; + hy: string; + as: string; + av: string; + ae: string; + ay: string; + az: string; + bm: string; + ba: string; + eu: string; + be: string; + bn: string; + bh: string; + bi: string; + bs: string; + br: string; + bg: string; + my: string; + ca: string; + ch: string; + ce: string; + ny: string; + zh: string; + cv: string; + kw: string; + co: string; + cr: string; + hr: string; + cs: string; + da: string; + dv: string; + nl: string; + dz: string; + en: string; + eo: string; + et: string; + ee: string; + fo: string; + fj: string; + fi: string; + fr: string; + ff: string; + gl: string; + ka: string; + de: string; + el: string; + gn: string; + gu: string; + ht: string; + ha: string; + he: string; + hz: string; + hi: string; + ho: string; + hu: string; + ia: string; + id: string; + ie: string; + ga: string; + ig: string; + ik: string; + io: string; + is: string; + it: string; + iu: string; + ja: string; + jv: string; + kl: string; + kn: string; + kr: string; + ks: string; + kk: string; + km: string; + ki: string; + rw: string; + ky: string; + kv: string; + kg: string; + ko: string; + ku: string; + kj: string; + la: string; + lb: string; + lg: string; + li: string; + ln: string; + lo: string; + lt: string; + lu: string; + lv: string; + gv: string; + mk: string; + mg: string; + ms: string; + ml: string; + mt: string; + mi: string; + mr: string; + mh: string; + mn: string; + na: string; + nv: string; + nd: string; + ne: string; + ng: string; + nb: string; + nn: string; + no: string; + ii: string; + nr: string; + oc: string; + oj: string; + cu: string; + om: string; + or: string; + os: string; + pa: string; + pi: string; + fa: string; + pl: string; + ps: string; + pt: string; + qu: string; + rm: string; + rn: string; + ro: string; + ru: string; + sa: string; + sc: string; + sd: string; + se: string; + sm: string; + sg: string; + sr: string; + gd: string; + sn: string; + si: string; + sk: string; + sl: string; + so: string; + st: string; + es: string; + su: string; + sw: string; + ss: string; + sv: string; + ta: string; + te: string; + tg: string; + th: string; + ti: string; + bo: string; + tk: string; + tl: string; + tn: string; + to: string; + tr: string; + ts: string; + tt: string; + tw: string; + ty: string; + ug: string; + uk: string; + ur: string; + uz: string; + ve: string; + vi: string; + vo: string; + wa: string; + cy: string; + wo: string; + fy: string; + xh: string; + yi: string; + yo: string; + za: string; + zu: string; +}; diff --git a/client/node_modules/app-builder-lib/out/util/langs.js b/client/node_modules/app-builder-lib/out/util/langs.js new file mode 100644 index 0000000000..31a3bad68a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/langs.js @@ -0,0 +1,436 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.langIdToName = exports.lcid = exports.toLangWithRegion = exports.bundledLanguages = void 0; +exports.bundledLanguages = [ + "en_US", + "de_DE", + "fr_FR", + "es_ES", + "zh_CN", + "zh_TW", + "ja_JP", + "ko_KR", + "it_IT", + "nl_NL", + "da_DK", + "sv_SE", + "nb_NO", + "fi_FI", + "ru_RU", + "pt_PT", + "pt_BR", + "pl_PL", + "uk_UA", + "cs_CZ", + "sk_SK", + "hu_HU", + "ar_SA", + "tr_TR", + "th_TH", + "vi_VN", +]; +// todo "ro_RO" "el_GR" "et_EE" "ka_GE" +const langToLangWithRegion = new Map(); +for (const id of exports.bundledLanguages) { + langToLangWithRegion.set(id.substring(0, id.indexOf("_")), id); +} +function toLangWithRegion(lang) { + if (lang.includes("_")) { + return lang; + } + lang = lang.toLowerCase(); + const result = langToLangWithRegion.get(lang); + return result == null ? `${lang}_${lang.toUpperCase()}` : result; +} +exports.toLangWithRegion = toLangWithRegion; +exports.lcid = { + af_ZA: 1078, + am_ET: 1118, + ar_AE: 14337, + ar_BH: 15361, + ar_DZ: 5121, + ar_EG: 3073, + ar_IQ: 2049, + ar_JO: 11265, + ar_KW: 13313, + ar_LB: 12289, + ar_LY: 4097, + ar_MA: 6145, + ar_OM: 8193, + ar_QA: 16385, + ar_SA: 1025, + ar_SY: 10241, + ar_TN: 7169, + ar_YE: 9217, + arn_CL: 1146, + as_IN: 1101, + az_AZ: 2092, + ba_RU: 1133, + be_BY: 1059, + bg_BG: 1026, + bn_IN: 1093, + bo_BT: 2129, + bo_CN: 1105, + br_FR: 1150, + bs_BA: 8218, + ca_ES: 1027, + co_FR: 1155, + cs_CZ: 1029, + cy_GB: 1106, + da_DK: 1030, + de_AT: 3079, + de_CH: 2055, + de_DE: 1031, + de_LI: 5127, + de_LU: 4103, + div_MV: 1125, + dsb_DE: 2094, + el_GR: 1032, + en_AU: 3081, + en_BZ: 10249, + en_CA: 4105, + en_CB: 9225, + en_GB: 2057, + en_IE: 6153, + en_IN: 18441, + en_JA: 8201, + en_MY: 17417, + en_NZ: 5129, + en_PH: 13321, + en_TT: 11273, + en_US: 1033, + en_ZA: 7177, + en_ZW: 12297, + es_AR: 11274, + es_BO: 16394, + es_CL: 13322, + es_CO: 9226, + es_CR: 5130, + es_DO: 7178, + es_EC: 12298, + es_ES: 3082, + es_GT: 4106, + es_HN: 18442, + es_MX: 2058, + es_NI: 19466, + es_PA: 6154, + es_PE: 10250, + es_PR: 20490, + es_PY: 15370, + es_SV: 17418, + es_UR: 14346, + es_US: 21514, + es_VE: 8202, + et_EE: 1061, + eu_ES: 1069, + fa_IR: 1065, + fi_FI: 1035, + fil_PH: 1124, + fo_FO: 1080, + fr_BE: 2060, + fr_CA: 3084, + fr_CH: 4108, + fr_FR: 1036, + fr_LU: 5132, + fr_MC: 6156, + fy_NL: 1122, + ga_IE: 2108, + gbz_AF: 1164, + gl_ES: 1110, + gsw_FR: 1156, + gu_IN: 1095, + ha_NG: 1128, + he_IL: 1037, + hi_IN: 1081, + hr_BA: 4122, + hr_HR: 1050, + hu_HU: 1038, + hy_AM: 1067, + id_ID: 1057, + ii_CN: 1144, + is_IS: 1039, + it_CH: 2064, + it_IT: 1040, + iu_CA: 2141, + ja_JP: 1041, + ka_GE: 1079, + kh_KH: 1107, + kk_KZ: 1087, + kl_GL: 1135, + kn_IN: 1099, + ko_KR: 1042, + kok_IN: 1111, + ky_KG: 1088, + lb_LU: 1134, + lo_LA: 1108, + lt_LT: 1063, + lv_LV: 1062, + mi_NZ: 1153, + mk_MK: 1071, + ml_IN: 1100, + mn_CN: 2128, + mn_MN: 1104, + moh_CA: 1148, + mr_IN: 1102, + ms_BN: 2110, + ms_MY: 1086, + mt_MT: 1082, + my_MM: 1109, + nb_NO: 1044, + ne_NP: 1121, + nl_BE: 2067, + nl_NL: 1043, + nn_NO: 2068, + ns_ZA: 1132, + oc_FR: 1154, + or_IN: 1096, + pa_IN: 1094, + pl_PL: 1045, + ps_AF: 1123, + pt_BR: 1046, + pt_PT: 2070, + qut_GT: 1158, + quz_BO: 1131, + quz_EC: 2155, + quz_PE: 3179, + rm_CH: 1047, + ro_RO: 1048, + ru_RU: 1049, + rw_RW: 1159, + sa_IN: 1103, + sah_RU: 1157, + se_FI: 3131, + se_NO: 1083, + se_SE: 2107, + si_LK: 1115, + sk_SK: 1051, + sl_SI: 1060, + sma_NO: 6203, + sma_SE: 7227, + smj_NO: 4155, + smj_SE: 5179, + smn_FI: 9275, + sms_FI: 8251, + sq_AL: 1052, + sr_BA: 7194, + sr_SP: 3098, + sv_FI: 2077, + sv_SE: 1053, + sw_KE: 1089, + syr_SY: 1114, + ta_IN: 1097, + te_IN: 1098, + tg_TJ: 1064, + th_TH: 1054, + tk_TM: 1090, + tmz_DZ: 2143, + tn_ZA: 1074, + tr_TR: 1055, + tt_RU: 1092, + ug_CN: 1152, + uk_UA: 1058, + ur_IN: 2080, + ur_PK: 1056, + uz_UZ: 2115, + vi_VN: 1066, + wen_DE: 1070, + wo_SN: 1160, + xh_ZA: 1076, + yo_NG: 1130, + zh_CHS: 4, + zh_CHT: 31748, + zh_CN: 2052, + zh_HK: 3076, + zh_MO: 5124, + zh_SG: 4100, + zh_TW: 1028, + zu_ZA: 1077, +}; +// noinspection SpellCheckingInspection +exports.langIdToName = { + ab: "Abkhaz", + aa: "Afar", + af: "Afrikaans", + ak: "Akan", + sq: "Albanian", + am: "Amharic", + ar: "Arabic", + an: "Aragonese", + hy: "Armenian", + as: "Assamese", + av: "Avaric", + ae: "Avestan", + ay: "Aymara", + az: "Azerbaijani", + bm: "Bambara", + ba: "Bashkir", + eu: "Basque", + be: "Belarusian", + bn: "Bengali", + bh: "Bihari", + bi: "Bislama", + bs: "Bosnian", + br: "Breton", + bg: "Bulgarian", + my: "Burmese", + ca: "Catalan", + ch: "Chamorro", + ce: "Chechen", + ny: "Chichewa", + zh: "Chinese", + cv: "Chuvash", + kw: "Cornish", + co: "Corsican", + cr: "Cree", + hr: "Croatian", + cs: "Czech", + da: "Danish", + dv: "Divehi", + nl: "Dutch", + dz: "Dzongkha", + en: "English", + eo: "Esperanto", + et: "Estonian", + ee: "Ewe", + fo: "Faroese", + fj: "Fijian", + fi: "Finnish", + fr: "French", + ff: "Fula", + gl: "Galician", + ka: "Georgian", + de: "German", + el: "Greek", + gn: "Guaraní", + gu: "Gujarati", + ht: "Haitian", + ha: "Hausa", + he: "Hebrew", + hz: "Herero", + hi: "Hindi", + ho: "Hiri Motu", + hu: "Hungarian", + ia: "Interlingua", + id: "Indonesian", + ie: "Interlingue", + ga: "Irish", + ig: "Igbo", + ik: "Inupiaq", + io: "Ido", + is: "Icelandic", + it: "Italian", + iu: "Inuktitut", + ja: "Japanese", + jv: "Javanese", + kl: "Kalaallisut", + kn: "Kannada", + kr: "Kanuri", + ks: "Kashmiri", + kk: "Kazakh", + km: "Khmer", + ki: "Kikuyu", + rw: "Kinyarwanda", + ky: "Kyrgyz", + kv: "Komi", + kg: "Kongo", + ko: "Korean", + ku: "Kurdish", + kj: "Kwanyama", + la: "Latin", + lb: "Luxembourgish", + lg: "Ganda", + li: "Limburgish", + ln: "Lingala", + lo: "Lao", + lt: "Lithuanian", + lu: "Luba-Katanga", + lv: "Latvian", + gv: "Manx", + mk: "Macedonian", + mg: "Malagasy", + ms: "Malay", + ml: "Malayalam", + mt: "Maltese", + mi: "Māori", + mr: "Marathi", + mh: "Marshallese", + mn: "Mongolian", + na: "Nauru", + nv: "Navajo", + nd: "Northern Ndebele", + ne: "Nepali", + ng: "Ndonga", + nb: "Norwegian Bokmål", + nn: "Norwegian Nynorsk", + no: "Norwegian", + ii: "Nuosu", + nr: "Southern Ndebele", + oc: "Occitan", + oj: "Ojibwe", + cu: "Old Church Slavonic", + om: "Oromo", + or: "Oriya", + os: "Ossetian", + pa: "Panjabi", + pi: "Pāli", + fa: "Persian", + pl: "Polish", + ps: "Pashto", + pt: "Portuguese", + qu: "Quechua", + rm: "Romansh", + rn: "Kirundi", + ro: "Romanian", + ru: "Russian", + sa: "Sanskrit", + sc: "Sardinian", + sd: "Sindhi", + se: "Northern Sami", + sm: "Samoan", + sg: "Sango", + sr: "Serbian", + gd: "Gaelic", + sn: "Shona", + si: "Sinhala", + sk: "Slovak", + sl: "Slovene", + so: "Somali", + st: "Southern Sotho", + es: "Spanish", + su: "Sundanese", + sw: "Swahili", + ss: "Swati", + sv: "Swedish", + ta: "Tamil", + te: "Telugu", + tg: "Tajik", + th: "Thai", + ti: "Tigrinya", + bo: "Tibetan Standard", + tk: "Turkmen", + tl: "Tagalog", + tn: "Tswana", + to: "Tonga", + tr: "Turkish", + ts: "Tsonga", + tt: "Tatar", + tw: "Twi", + ty: "Tahitian", + ug: "Uyghur", + uk: "Ukrainian", + ur: "Urdu", + uz: "Uzbek", + ve: "Venda", + vi: "Vietnamese", + vo: "Volapük", + wa: "Walloon", + cy: "Welsh", + wo: "Wolof", + fy: "Western Frisian", + xh: "Xhosa", + yi: "Yiddish", + yo: "Yoruba", + za: "Zhuang", + zu: "Zulu", +}; +//# sourceMappingURL=langs.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/langs.js.map b/client/node_modules/app-builder-lib/out/util/langs.js.map new file mode 100644 index 0000000000..ab4c272620 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/langs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"langs.js","sourceRoot":"","sources":["../../src/util/langs.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO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ACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,MAAM;CACX,CAAA","sourcesContent":["export const bundledLanguages = [\n \"en_US\",\n \"de_DE\",\n \"fr_FR\",\n \"es_ES\",\n \"zh_CN\",\n \"zh_TW\",\n \"ja_JP\",\n \"ko_KR\",\n \"it_IT\",\n \"nl_NL\",\n \"da_DK\",\n \"sv_SE\",\n \"nb_NO\",\n \"fi_FI\",\n \"ru_RU\",\n \"pt_PT\",\n \"pt_BR\",\n \"pl_PL\",\n \"uk_UA\",\n \"cs_CZ\",\n \"sk_SK\",\n \"hu_HU\",\n \"ar_SA\",\n \"tr_TR\",\n \"th_TH\",\n \"vi_VN\",\n]\n\n// todo \"ro_RO\" \"el_GR\" \"et_EE\" \"ka_GE\"\n\nconst langToLangWithRegion = new Map()\nfor (const id of bundledLanguages) {\n langToLangWithRegion.set(id.substring(0, id.indexOf(\"_\")), id)\n}\n\nexport function toLangWithRegion(lang: string): string {\n if (lang.includes(\"_\")) {\n return lang\n }\n\n lang = lang.toLowerCase()\n\n const result = langToLangWithRegion.get(lang)\n return result == null ? `${lang}_${lang.toUpperCase()}` : result\n}\n\nexport const lcid: any = {\n af_ZA: 1078,\n am_ET: 1118,\n ar_AE: 14337,\n ar_BH: 15361,\n ar_DZ: 5121,\n ar_EG: 3073,\n ar_IQ: 2049,\n ar_JO: 11265,\n ar_KW: 13313,\n ar_LB: 12289,\n ar_LY: 4097,\n ar_MA: 6145,\n ar_OM: 8193,\n ar_QA: 16385,\n ar_SA: 1025,\n ar_SY: 10241,\n ar_TN: 7169,\n ar_YE: 9217,\n arn_CL: 1146,\n as_IN: 1101,\n az_AZ: 2092,\n ba_RU: 1133,\n be_BY: 1059,\n bg_BG: 1026,\n bn_IN: 1093,\n bo_BT: 2129,\n bo_CN: 1105,\n br_FR: 1150,\n bs_BA: 8218,\n ca_ES: 1027,\n co_FR: 1155,\n cs_CZ: 1029,\n cy_GB: 1106,\n da_DK: 1030,\n de_AT: 3079,\n de_CH: 2055,\n de_DE: 1031,\n de_LI: 5127,\n de_LU: 4103,\n div_MV: 1125,\n dsb_DE: 2094,\n el_GR: 1032,\n en_AU: 3081,\n en_BZ: 10249,\n en_CA: 4105,\n en_CB: 9225,\n en_GB: 2057,\n en_IE: 6153,\n en_IN: 18441,\n en_JA: 8201,\n en_MY: 17417,\n en_NZ: 5129,\n en_PH: 13321,\n en_TT: 11273,\n en_US: 1033,\n en_ZA: 7177,\n en_ZW: 12297,\n es_AR: 11274,\n es_BO: 16394,\n es_CL: 13322,\n es_CO: 9226,\n es_CR: 5130,\n es_DO: 7178,\n es_EC: 12298,\n es_ES: 3082,\n es_GT: 4106,\n es_HN: 18442,\n es_MX: 2058,\n es_NI: 19466,\n es_PA: 6154,\n es_PE: 10250,\n es_PR: 20490,\n es_PY: 15370,\n es_SV: 17418,\n es_UR: 14346,\n es_US: 21514,\n es_VE: 8202,\n et_EE: 1061,\n eu_ES: 1069,\n fa_IR: 1065,\n fi_FI: 1035,\n fil_PH: 1124,\n fo_FO: 1080,\n fr_BE: 2060,\n fr_CA: 3084,\n fr_CH: 4108,\n fr_FR: 1036,\n fr_LU: 5132,\n fr_MC: 6156,\n fy_NL: 1122,\n ga_IE: 2108,\n gbz_AF: 1164,\n gl_ES: 1110,\n gsw_FR: 1156,\n gu_IN: 1095,\n ha_NG: 1128,\n he_IL: 1037,\n hi_IN: 1081,\n hr_BA: 4122,\n hr_HR: 1050,\n hu_HU: 1038,\n hy_AM: 1067,\n id_ID: 1057,\n ii_CN: 1144,\n is_IS: 1039,\n it_CH: 2064,\n it_IT: 1040,\n iu_CA: 2141,\n ja_JP: 1041,\n ka_GE: 1079,\n kh_KH: 1107,\n kk_KZ: 1087,\n kl_GL: 1135,\n kn_IN: 1099,\n ko_KR: 1042,\n kok_IN: 1111,\n ky_KG: 1088,\n lb_LU: 1134,\n lo_LA: 1108,\n lt_LT: 1063,\n lv_LV: 1062,\n mi_NZ: 1153,\n mk_MK: 1071,\n ml_IN: 1100,\n mn_CN: 2128,\n mn_MN: 1104,\n moh_CA: 1148,\n mr_IN: 1102,\n ms_BN: 2110,\n ms_MY: 1086,\n mt_MT: 1082,\n my_MM: 1109,\n nb_NO: 1044,\n ne_NP: 1121,\n nl_BE: 2067,\n nl_NL: 1043,\n nn_NO: 2068,\n ns_ZA: 1132,\n oc_FR: 1154,\n or_IN: 1096,\n pa_IN: 1094,\n pl_PL: 1045,\n ps_AF: 1123,\n pt_BR: 1046,\n pt_PT: 2070,\n qut_GT: 1158,\n quz_BO: 1131,\n quz_EC: 2155,\n quz_PE: 3179,\n rm_CH: 1047,\n ro_RO: 1048,\n ru_RU: 1049,\n rw_RW: 1159,\n sa_IN: 1103,\n sah_RU: 1157,\n se_FI: 3131,\n se_NO: 1083,\n se_SE: 2107,\n si_LK: 1115,\n sk_SK: 1051,\n sl_SI: 1060,\n sma_NO: 6203,\n sma_SE: 7227,\n smj_NO: 4155,\n smj_SE: 5179,\n smn_FI: 9275,\n sms_FI: 8251,\n sq_AL: 1052,\n sr_BA: 7194,\n sr_SP: 3098,\n sv_FI: 2077,\n sv_SE: 1053,\n sw_KE: 1089,\n syr_SY: 1114,\n ta_IN: 1097,\n te_IN: 1098,\n tg_TJ: 1064,\n th_TH: 1054,\n tk_TM: 1090,\n tmz_DZ: 2143,\n tn_ZA: 1074,\n tr_TR: 1055,\n tt_RU: 1092,\n ug_CN: 1152,\n uk_UA: 1058,\n ur_IN: 2080,\n ur_PK: 1056,\n uz_UZ: 2115,\n vi_VN: 1066,\n wen_DE: 1070,\n wo_SN: 1160,\n xh_ZA: 1076,\n yo_NG: 1130,\n zh_CHS: 4,\n zh_CHT: 31748,\n zh_CN: 2052,\n zh_HK: 3076,\n zh_MO: 5124,\n zh_SG: 4100,\n zh_TW: 1028,\n zu_ZA: 1077,\n}\n\n// noinspection SpellCheckingInspection\nexport const langIdToName = {\n ab: \"Abkhaz\",\n aa: \"Afar\",\n af: \"Afrikaans\",\n ak: \"Akan\",\n sq: \"Albanian\",\n am: \"Amharic\",\n ar: \"Arabic\",\n an: \"Aragonese\",\n hy: \"Armenian\",\n as: \"Assamese\",\n av: \"Avaric\",\n ae: \"Avestan\",\n ay: \"Aymara\",\n az: \"Azerbaijani\",\n bm: \"Bambara\",\n ba: \"Bashkir\",\n eu: \"Basque\",\n be: \"Belarusian\",\n bn: \"Bengali\",\n bh: \"Bihari\",\n bi: \"Bislama\",\n bs: \"Bosnian\",\n br: \"Breton\",\n bg: \"Bulgarian\",\n my: \"Burmese\",\n ca: \"Catalan\",\n ch: \"Chamorro\",\n ce: \"Chechen\",\n ny: \"Chichewa\",\n zh: \"Chinese\",\n cv: \"Chuvash\",\n kw: \"Cornish\",\n co: \"Corsican\",\n cr: \"Cree\",\n hr: \"Croatian\",\n cs: \"Czech\",\n da: \"Danish\",\n dv: \"Divehi\",\n nl: \"Dutch\",\n dz: \"Dzongkha\",\n en: \"English\",\n eo: \"Esperanto\",\n et: \"Estonian\",\n ee: \"Ewe\",\n fo: \"Faroese\",\n fj: \"Fijian\",\n fi: \"Finnish\",\n fr: \"French\",\n ff: \"Fula\",\n gl: \"Galician\",\n ka: \"Georgian\",\n de: \"German\",\n el: \"Greek\",\n gn: \"Guaraní\",\n gu: \"Gujarati\",\n ht: \"Haitian\",\n ha: \"Hausa\",\n he: \"Hebrew\",\n hz: \"Herero\",\n hi: \"Hindi\",\n ho: \"Hiri Motu\",\n hu: \"Hungarian\",\n ia: \"Interlingua\",\n id: \"Indonesian\",\n ie: \"Interlingue\",\n ga: \"Irish\",\n ig: \"Igbo\",\n ik: \"Inupiaq\",\n io: \"Ido\",\n is: \"Icelandic\",\n it: \"Italian\",\n iu: \"Inuktitut\",\n ja: \"Japanese\",\n jv: \"Javanese\",\n kl: \"Kalaallisut\",\n kn: \"Kannada\",\n kr: \"Kanuri\",\n ks: \"Kashmiri\",\n kk: \"Kazakh\",\n km: \"Khmer\",\n ki: \"Kikuyu\",\n rw: \"Kinyarwanda\",\n ky: \"Kyrgyz\",\n kv: \"Komi\",\n kg: \"Kongo\",\n ko: \"Korean\",\n ku: \"Kurdish\",\n kj: \"Kwanyama\",\n la: \"Latin\",\n lb: \"Luxembourgish\",\n lg: \"Ganda\",\n li: \"Limburgish\",\n ln: \"Lingala\",\n lo: \"Lao\",\n lt: \"Lithuanian\",\n lu: \"Luba-Katanga\",\n lv: \"Latvian\",\n gv: \"Manx\",\n mk: \"Macedonian\",\n mg: \"Malagasy\",\n ms: \"Malay\",\n ml: \"Malayalam\",\n mt: \"Maltese\",\n mi: \"Māori\",\n mr: \"Marathi\",\n mh: \"Marshallese\",\n mn: \"Mongolian\",\n na: \"Nauru\",\n nv: \"Navajo\",\n nd: \"Northern Ndebele\",\n ne: \"Nepali\",\n ng: \"Ndonga\",\n nb: \"Norwegian Bokmål\",\n nn: \"Norwegian Nynorsk\",\n no: \"Norwegian\",\n ii: \"Nuosu\",\n nr: \"Southern Ndebele\",\n oc: \"Occitan\",\n oj: \"Ojibwe\",\n cu: \"Old Church Slavonic\",\n om: \"Oromo\",\n or: \"Oriya\",\n os: \"Ossetian\",\n pa: \"Panjabi\",\n pi: \"Pāli\",\n fa: \"Persian\",\n pl: \"Polish\",\n ps: \"Pashto\",\n pt: \"Portuguese\",\n qu: \"Quechua\",\n rm: \"Romansh\",\n rn: \"Kirundi\",\n ro: \"Romanian\",\n ru: \"Russian\",\n sa: \"Sanskrit\",\n sc: \"Sardinian\",\n sd: \"Sindhi\",\n se: \"Northern Sami\",\n sm: \"Samoan\",\n sg: \"Sango\",\n sr: \"Serbian\",\n gd: \"Gaelic\",\n sn: \"Shona\",\n si: \"Sinhala\",\n sk: \"Slovak\",\n sl: \"Slovene\",\n so: \"Somali\",\n st: \"Southern Sotho\",\n es: \"Spanish\",\n su: \"Sundanese\",\n sw: \"Swahili\",\n ss: \"Swati\",\n sv: \"Swedish\",\n ta: \"Tamil\",\n te: \"Telugu\",\n tg: \"Tajik\",\n th: \"Thai\",\n ti: \"Tigrinya\",\n bo: \"Tibetan Standard\",\n tk: \"Turkmen\",\n tl: \"Tagalog\",\n tn: \"Tswana\",\n to: \"Tonga\",\n tr: \"Turkish\",\n ts: \"Tsonga\",\n tt: \"Tatar\",\n tw: \"Twi\",\n ty: \"Tahitian\",\n ug: \"Uyghur\",\n uk: \"Ukrainian\",\n ur: \"Urdu\",\n uz: \"Uzbek\",\n ve: \"Venda\",\n vi: \"Vietnamese\",\n vo: \"Volapük\",\n wa: \"Walloon\",\n cy: \"Welsh\",\n wo: \"Wolof\",\n fy: \"Western Frisian\",\n xh: \"Xhosa\",\n yi: \"Yiddish\",\n yo: \"Yoruba\",\n za: \"Zhuang\",\n zu: \"Zulu\",\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/license.d.ts b/client/node_modules/app-builder-lib/out/util/license.d.ts new file mode 100644 index 0000000000..06b1bd60cc --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/license.d.ts @@ -0,0 +1,15 @@ +import { PlatformPackager } from "../platformPackager"; +export declare function getLicenseAssets(fileNames: Array, packager: PlatformPackager): { + file: string; + lang: string; + langWithRegion: string; + langName: any; +}[]; +export declare function getNotLocalizedLicenseFile(custom: string | null | undefined, packager: PlatformPackager, supportedExtension?: Array): Promise; +export declare function getLicenseFiles(packager: PlatformPackager): Promise>; +export interface LicenseFile { + file: string; + lang: string; + langWithRegion: string; + langName: string; +} diff --git a/client/node_modules/app-builder-lib/out/util/license.js b/client/node_modules/app-builder-lib/out/util/license.js new file mode 100644 index 0000000000..b219df0266 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/license.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLicenseFiles = exports.getNotLocalizedLicenseFile = exports.getLicenseAssets = void 0; +const path = require("path"); +const langs_1 = require("./langs"); +function getLicenseAssets(fileNames, packager) { + return fileNames + .sort((a, b) => { + const aW = a.includes("_en") ? 0 : 100; + const bW = b.includes("_en") ? 0 : 100; + return aW === bW ? a.localeCompare(b) : aW - bW; + }) + .map(file => { + let lang = /_([^.]+)\./.exec(file)[1]; + let langWithRegion; + if (lang.includes("_")) { + langWithRegion = lang; + lang = langWithRegion.substring(0, lang.indexOf("_")); + } + else { + lang = lang.toLowerCase(); + langWithRegion = langs_1.toLangWithRegion(lang); + } + return { file: path.join(packager.buildResourcesDir, file), lang, langWithRegion, langName: langs_1.langIdToName[lang] }; + }); +} +exports.getLicenseAssets = getLicenseAssets; +async function getNotLocalizedLicenseFile(custom, packager, supportedExtension = ["rtf", "txt", "html"]) { + const possibleFiles = []; + for (const name of ["license", "eula"]) { + for (const ext of supportedExtension) { + possibleFiles.push(`${name}.${ext}`); + possibleFiles.push(`${name.toUpperCase()}.${ext}`); + possibleFiles.push(`${name}.${ext.toUpperCase()}`); + possibleFiles.push(`${name.toUpperCase()}.${ext.toUpperCase()}`); + } + } + return await packager.getResource(custom, ...possibleFiles); +} +exports.getNotLocalizedLicenseFile = getNotLocalizedLicenseFile; +async function getLicenseFiles(packager) { + return getLicenseAssets((await packager.resourceList).filter(it => { + const name = it.toLowerCase(); + return (name.startsWith("license_") || name.startsWith("eula_")) && (name.endsWith(".rtf") || name.endsWith(".txt")); + }), packager); +} +exports.getLicenseFiles = getLicenseFiles; +//# sourceMappingURL=license.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/license.js.map b/client/node_modules/app-builder-lib/out/util/license.js.map new file mode 100644 index 0000000000..17381b265d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/license.js.map @@ -0,0 +1 @@ +{"version":3,"file":"license.js","sourceRoot":"","sources":["../../src/util/license.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAC5B,mCAAwD;AAGxD,SAAgB,gBAAgB,CAAC,SAAwB,EAAE,QAA+B;IACxF,OAAO,SAAS;SACb,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACb,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CA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AM,GAAG,IAAI,kBAAkB,EAAE;YACpC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACpC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA;YAClD,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;YAClD,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;SACjE;KACF;IAED,OAAO,MAAM,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,aAAa,CAAC,CAAA;AAC7D,CAAC;AAhBD,gEAgBC;AAEM,KAAK,UAAU,eAAe,CAAC,QAA+B;IACnE,OAAO,gBAAgB,CACrB,CAAC,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;QACxC,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,EAAE,CAAA;QAC7B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IACtH,CAAC,CAAC,EACF,QAAQ,CACT,CAAA;AACH,CAAC;AARD,0CAQC","sourcesContent":["import * as path from \"path\"\nimport { langIdToName, toLangWithRegion } from \"./langs\"\nimport { PlatformPackager } from \"../platformPackager\"\n\nexport function getLicenseAssets(fileNames: Array, packager: PlatformPackager) {\n return fileNames\n .sort((a, b) => {\n const aW = a.includes(\"_en\") ? 0 : 100\n const bW = b.includes(\"_en\") ? 0 : 100\n return aW === bW ? a.localeCompare(b) : aW - bW\n })\n .map(file => {\n let lang = /_([^.]+)\\./.exec(file)![1]\n let langWithRegion\n if (lang.includes(\"_\")) {\n langWithRegion = lang\n lang = langWithRegion.substring(0, lang.indexOf(\"_\"))\n } else {\n lang = lang.toLowerCase()\n langWithRegion = toLangWithRegion(lang)\n }\n return { file: path.join(packager.buildResourcesDir, file), lang, langWithRegion, langName: (langIdToName as any)[lang] }\n })\n}\n\nexport async function getNotLocalizedLicenseFile(\n custom: string | null | undefined,\n packager: PlatformPackager,\n supportedExtension: Array = [\"rtf\", \"txt\", \"html\"]\n): Promise {\n const possibleFiles: Array = []\n for (const name of [\"license\", \"eula\"]) {\n for (const ext of supportedExtension) {\n possibleFiles.push(`${name}.${ext}`)\n possibleFiles.push(`${name.toUpperCase()}.${ext}`)\n possibleFiles.push(`${name}.${ext.toUpperCase()}`)\n possibleFiles.push(`${name.toUpperCase()}.${ext.toUpperCase()}`)\n }\n }\n\n return await packager.getResource(custom, ...possibleFiles)\n}\n\nexport async function getLicenseFiles(packager: PlatformPackager): Promise> {\n return getLicenseAssets(\n (await packager.resourceList).filter(it => {\n const name = it.toLowerCase()\n return (name.startsWith(\"license_\") || name.startsWith(\"eula_\")) && (name.endsWith(\".rtf\") || name.endsWith(\".txt\"))\n }),\n packager\n )\n}\n\nexport interface LicenseFile {\n file: string\n lang: string\n langWithRegion: string\n langName: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/macosVersion.d.ts b/client/node_modules/app-builder-lib/out/util/macosVersion.d.ts new file mode 100644 index 0000000000..4651457498 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macosVersion.d.ts @@ -0,0 +1,3 @@ +export declare function isMacOsHighSierra(): boolean; +export declare function isMacOsSierra(): Promise; +export declare function isMacOsCatalina(): boolean; diff --git a/client/node_modules/app-builder-lib/out/util/macosVersion.js b/client/node_modules/app-builder-lib/out/util/macosVersion.js new file mode 100644 index 0000000000..059b8c505e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macosVersion.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isMacOsCatalina = exports.isMacOsSierra = exports.isMacOsHighSierra = void 0; +const fs_extra_1 = require("fs-extra"); +const lazy_val_1 = require("lazy-val"); +const semver = require("semver"); +const log_1 = require("builder-util/out/log"); +const os_1 = require("os"); +const macOsVersion = new lazy_val_1.Lazy(async () => { + const file = await fs_extra_1.readFile("/System/Library/CoreServices/SystemVersion.plist", "utf8"); + const matches = /ProductVersion<\/key>[\s\S]*([\d.]+)<\/string>/.exec(file); + if (!matches) { + throw new Error("Couldn't find the macOS version"); + } + log_1.log.debug({ version: matches[1] }, "macOS version"); + return clean(matches[1]); +}); +function clean(version) { + return version.split(".").length === 2 ? `${version}.0` : version; +} +async function isOsVersionGreaterThanOrEqualTo(input) { + return semver.gte(await macOsVersion.value, clean(input)); +} +function isMacOsHighSierra() { + // 17.7.0 === 10.13.6 + return process.platform === "darwin" && semver.gte(os_1.release(), "17.7.0"); +} +exports.isMacOsHighSierra = isMacOsHighSierra; +async function isMacOsSierra() { + return process.platform === "darwin" && (await isOsVersionGreaterThanOrEqualTo("10.12.0")); +} +exports.isMacOsSierra = isMacOsSierra; +function isMacOsCatalina() { + return process.platform === "darwin" && semver.gte(os_1.release(), "19.0.0"); +} +exports.isMacOsCatalina = isMacOsCatalina; +//# sourceMappingURL=macosVersion.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/macosVersion.js.map b/client/node_modules/app-builder-lib/out/util/macosVersion.js.map new file mode 100644 index 0000000000..ccbbb975c6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macosVersion.js.map @@ -0,0 +1 @@ +{"version":3,"file":"macosVersion.js","sourceRoot":"","sources":["../../src/util/macosVersion.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AACnC,uCAA+B;AAC/B,iCAAgC;AAChC,8CAA0C;AAC1C,2BAAyC;AAEzC,MAAM,YAAY,GAAG,IAAI,eAAI,CAAS,KAAK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,CAAC;AAFD,0CAEC","sourcesContent":["import { readFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as semver from \"semver\"\nimport { log } from \"builder-util/out/log\"\nimport { release as osRelease } from \"os\"\n\nconst macOsVersion = new Lazy(async () => {\n const file = await readFile(\"/System/Library/CoreServices/SystemVersion.plist\", \"utf8\")\n const matches = /ProductVersion<\\/key>[\\s\\S]*([\\d.]+)<\\/string>/.exec(file)\n if (!matches) {\n throw new Error(\"Couldn't find the macOS version\")\n }\n log.debug({ version: matches[1] }, \"macOS version\")\n return clean(matches[1])\n})\n\nfunction clean(version: string) {\n return version.split(\".\").length === 2 ? `${version}.0` : version\n}\n\nasync function isOsVersionGreaterThanOrEqualTo(input: string) {\n return semver.gte(await macOsVersion.value, clean(input))\n}\n\nexport function isMacOsHighSierra(): boolean {\n // 17.7.0 === 10.13.6\n return process.platform === \"darwin\" && semver.gte(osRelease(), \"17.7.0\")\n}\n\nexport async function isMacOsSierra() {\n return process.platform === \"darwin\" && (await isOsVersionGreaterThanOrEqualTo(\"10.12.0\"))\n}\n\nexport function isMacOsCatalina() {\n return process.platform === \"darwin\" && semver.gte(osRelease(), \"19.0.0\")\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/macroExpander.d.ts b/client/node_modules/app-builder-lib/out/util/macroExpander.d.ts new file mode 100644 index 0000000000..7e8607b1f6 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macroExpander.d.ts @@ -0,0 +1,2 @@ +import { AppInfo } from "../appInfo"; +export declare function expandMacro(pattern: string, arch: string | null | undefined, appInfo: AppInfo, extra?: any, isProductNameSanitized?: boolean): string; diff --git a/client/node_modules/app-builder-lib/out/util/macroExpander.js b/client/node_modules/app-builder-lib/out/util/macroExpander.js new file mode 100644 index 0000000000..c21008316a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macroExpander.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.expandMacro = void 0; +const builder_util_1 = require("builder-util"); +function expandMacro(pattern, arch, appInfo, extra = {}, isProductNameSanitized = true) { + if (arch == null) { + pattern = pattern + // tslint:disable-next-line:no-invalid-template-strings + .replace("-${arch}", "") + // tslint:disable-next-line:no-invalid-template-strings + .replace(" ${arch}", "") + // tslint:disable-next-line:no-invalid-template-strings + .replace("_${arch}", "") + // tslint:disable-next-line:no-invalid-template-strings + .replace("/${arch}", ""); + } + return pattern.replace(/\${([_a-zA-Z./*+]+)}/g, (match, p1) => { + switch (p1) { + case "productName": + return isProductNameSanitized ? appInfo.sanitizedProductName : appInfo.productName; + case "arch": + if (arch == null) { + // see above, we remove macro if no arch + return ""; + } + return arch; + case "author": { + const companyName = appInfo.companyName; + if (companyName == null) { + throw new builder_util_1.InvalidConfigurationError(`cannot expand pattern "${pattern}": author is not specified`, "ERR_ELECTRON_BUILDER_AUTHOR_UNSPECIFIED"); + } + return companyName; + } + case "platform": + return process.platform; + case "channel": + return appInfo.channel || "latest"; + default: { + if (p1 in appInfo) { + return appInfo[p1]; + } + if (p1.startsWith("env.")) { + const envName = p1.substring("env.".length); + const envValue = process.env[envName]; + if (envValue == null) { + throw new builder_util_1.InvalidConfigurationError(`cannot expand pattern "${pattern}": env ${envName} is not defined`, "ERR_ELECTRON_BUILDER_ENV_NOT_DEFINED"); + } + return envValue; + } + const value = extra[p1]; + if (value == null) { + throw new builder_util_1.InvalidConfigurationError(`cannot expand pattern "${pattern}": macro ${p1} is not defined`, "ERR_ELECTRON_BUILDER_MACRO_NOT_DEFINED"); + } + else { + return value; + } + } + } + }); +} +exports.expandMacro = expandMacro; +//# sourceMappingURL=macroExpander.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/macroExpander.js.map b/client/node_modules/app-builder-lib/out/util/macroExpander.js.map new file mode 100644 index 0000000000..cdf216c57f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/macroExpander.js.map @@ -0,0 +1 @@ +{"version":3,"file":"macroExpander.js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AAI,OAAO,EAAE;oBACjB,OAAQ,OAAe,CAAC,EAAE,CAAC,CAAA;iBAC5B;gBAED,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBACzB,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;oBAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;oBACrC,IAAI,QAAQ,IAAI,IAAI,EAAE;wBACpB,MAAM,IAAI,wCAAyB,CAAC,0BAA0B,OAAO,UAAU,OAAO,iBAAiB,EAAE,sCAAsC,CAAC,CAAA;qBACjJ;oBACD,OAAO,QAAQ,CAAA;iBAChB;gBAED,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAA;gBACvB,IAAI,KAAK,IAAI,IAAI,EAAE;oBACjB,MAAM,IAAI,wCAAyB,CAAC,0BAA0B,OAAO,YAAY,EAAE,iBAAiB,EAAE,wCAAwC,CAAC,CAAA;iBAChJ;qBAAM;oBACL,OAAO,KAAK,CAAA;iBACb;aACF;SACF;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AA9DD,kCA8DC","sourcesContent":["import { InvalidConfigurationError } from \"builder-util\"\nimport { AppInfo } from \"../appInfo\"\n\nexport function expandMacro(pattern: string, arch: string | null | undefined, appInfo: AppInfo, extra: any = {}, isProductNameSanitized = true): string {\n if (arch == null) {\n pattern = pattern\n // tslint:disable-next-line:no-invalid-template-strings\n .replace(\"-${arch}\", \"\")\n // tslint:disable-next-line:no-invalid-template-strings\n .replace(\" ${arch}\", \"\")\n // tslint:disable-next-line:no-invalid-template-strings\n .replace(\"_${arch}\", \"\")\n // tslint:disable-next-line:no-invalid-template-strings\n .replace(\"/${arch}\", \"\")\n }\n\n return pattern.replace(/\\${([_a-zA-Z./*+]+)}/g, (match, p1): string => {\n switch (p1) {\n case \"productName\":\n return isProductNameSanitized ? appInfo.sanitizedProductName : appInfo.productName\n\n case \"arch\":\n if (arch == null) {\n // see above, we remove macro if no arch\n return \"\"\n }\n return arch\n\n case \"author\": {\n const companyName = appInfo.companyName\n if (companyName == null) {\n throw new InvalidConfigurationError(`cannot expand pattern \"${pattern}\": author is not specified`, \"ERR_ELECTRON_BUILDER_AUTHOR_UNSPECIFIED\")\n }\n return companyName\n }\n\n case \"platform\":\n return process.platform\n\n case \"channel\":\n return appInfo.channel || \"latest\"\n\n default: {\n if (p1 in appInfo) {\n return (appInfo as any)[p1]\n }\n\n if (p1.startsWith(\"env.\")) {\n const envName = p1.substring(\"env.\".length)\n const envValue = process.env[envName]\n if (envValue == null) {\n throw new InvalidConfigurationError(`cannot expand pattern \"${pattern}\": env ${envName} is not defined`, \"ERR_ELECTRON_BUILDER_ENV_NOT_DEFINED\")\n }\n return envValue\n }\n\n const value = extra[p1]\n if (value == null) {\n throw new InvalidConfigurationError(`cannot expand pattern \"${pattern}\": macro ${p1} is not defined`, \"ERR_ELECTRON_BUILDER_MACRO_NOT_DEFINED\")\n } else {\n return value\n }\n }\n }\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/normalizePackageData.d.ts b/client/node_modules/app-builder-lib/out/util/normalizePackageData.d.ts new file mode 100644 index 0000000000..488b7f615f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/normalizePackageData.d.ts @@ -0,0 +1 @@ +export declare function normalizePackageData(data: any): void; diff --git a/client/node_modules/app-builder-lib/out/util/normalizePackageData.js b/client/node_modules/app-builder-lib/out/util/normalizePackageData.js new file mode 100644 index 0000000000..56cf558095 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/normalizePackageData.js @@ -0,0 +1,327 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizePackageData = void 0; +const semver = require("semver"); +const hosted_git_info_1 = require("hosted-git-info"); +const url = require("url"); +function normalizePackageData(data) { + for (const it of check) { + it(data); + } +} +exports.normalizePackageData = normalizePackageData; +const depTypes = ["dependencies", "devDependencies", "optionalDependencies"]; +const check = [ + function (data) { + if (data.repositories) { + data.repository = data.repositories[0]; + } + if (typeof data.repository === "string") { + data.repository = { + type: "git", + url: data.repository, + }; + } + if (data.repository != null && data.repository.url) { + const hosted = hosted_git_info_1.fromUrl(data.repository.url); + if (hosted) { + data.repository.url = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString(); + } + } + }, + function (data) { + const files = data.files; + if (files && !Array.isArray(files)) { + delete data.files; + } + else if (data.files) { + data.files = data.files.filter(function (file) { + return !(!file || typeof file !== "string"); + }); + } + }, + function (data) { + if (!data.bin) { + return; + } + if (typeof data.bin === "string") { + const b = {}; + const match = data.name.match(/^@[^/]+[/](.*)$/); + if (match) { + b[match[1]] = data.bin; + } + else { + b[data.name] = data.bin; + } + data.bin = b; + } + }, + function (data) { + if (data.description && typeof data.description !== "string") { + delete data.description; + } + if (data.description === undefined) { + delete data.description; + } + }, + fixBundleDependenciesField, + function fixDependencies(data) { + objectifyDeps(data); + fixBundleDependenciesField(data); + for (const deps of ["dependencies", "devDependencies", "optionalDependencies"]) { + if (!(deps in data)) { + continue; + } + if (!data[deps] || typeof data[deps] !== "object") { + delete data[deps]; + continue; + } + Object.keys(data[deps]).forEach(function (d) { + const r = data[deps][d]; + if (typeof r !== "string") { + delete data[deps][d]; + } + const hosted = hosted_git_info_1.fromUrl(data[deps][d]); + if (hosted) { + data[deps][d] = hosted.toString(); + } + }); + } + }, + function fixBugsField(data) { + if (!data.bugs && data.repository && data.repository.url) { + const hosted = hosted_git_info_1.fromUrl(data.repository.url); + if (hosted && hosted.bugs()) { + data.bugs = { url: hosted.bugs() }; + } + } + else if (data.bugs) { + const emailRe = /^.+@.*\..+$/; + if (typeof data.bugs == "string") { + if (emailRe.test(data.bugs)) { + data.bugs = { email: data.bugs }; + } + else if (url.parse(data.bugs).protocol) { + data.bugs = { url: data.bugs }; + } + } + else { + bugsTypos(data.bugs); + const oldBugs = data.bugs; + data.bugs = {}; + if (oldBugs.url) { + if (typeof oldBugs.url == "string" && url.parse(oldBugs.url).protocol) { + data.bugs.url = oldBugs.url; + } + } + if (oldBugs.email) { + if (typeof oldBugs.email == "string" && emailRe.test(oldBugs.email)) { + data.bugs.email = oldBugs.email; + } + } + } + if (!data.bugs.email && !data.bugs.url) { + delete data.bugs; + } + } + }, + function fixModulesField(data) { + if (data.modules) { + delete data.modules; + } + }, + function fixKeywordsField(data) { + if (typeof data.keywords === "string") { + data.keywords = data.keywords.split(/,\s+/); + } + if (data.keywords && !Array.isArray(data.keywords)) { + delete data.keywords; + } + else if (data.keywords) { + data.keywords = data.keywords.filter(function (kw) { + return !(typeof kw !== "string" || !kw); + }); + } + }, + function fixVersionField(data) { + const loose = true; + if (!data.version) { + data.version = ""; + return true; + } + if (!semver.valid(data.version, loose)) { + throw new Error(`Invalid version: "${data.version}"`); + } + data.version = semver.clean(data.version, loose); + return true; + }, + function fixPeople(data) { + modifyPeople(data, unParsePerson); + modifyPeople(data, parsePerson); + }, + function fixNameField(data) { + if (!data.name) { + data.name = ""; + return; + } + if (typeof data.name !== "string") { + throw new Error("name field must be a string."); + } + data.name = data.name.trim(); + ensureValidName(data.name); + }, + function fixHomepageField(data) { + if (!data.homepage && data.repository && data.repository.url) { + const hosted = hosted_git_info_1.fromUrl(data.repository.url); + if (hosted && hosted.docs()) { + data.homepage = hosted.docs(); + } + } + if (!data.homepage) { + return; + } + if (typeof data.homepage !== "string") { + delete data.homepage; + } + if (!url.parse(data.homepage).protocol) { + data.homepage = `https://${data.homepage}`; + } + return; + }, +]; +function fixBundleDependenciesField(data) { + const bdd = "bundledDependencies"; + const bd = "bundleDependencies"; + if (data[bdd] && !data[bd]) { + data[bd] = data[bdd]; + delete data[bdd]; + } + if (data[bd] && !Array.isArray(data[bd])) { + delete data[bd]; + } + else if (data[bd]) { + data[bd] = data[bd].filter(function (bd) { + if (!bd || typeof bd !== "string") { + return false; + } + else { + if (!data.dependencies) { + data.dependencies = {}; + } + if (!("bd" in data.dependencies)) { + data.dependencies[bd] = "*"; + } + return true; + } + }); + } +} +function isValidScopedPackageName(spec) { + if (spec.charAt(0) !== "@") { + return false; + } + const rest = spec.slice(1).split("/"); + if (rest.length !== 2) { + return false; + } + return rest[0] !== "" && rest[1] !== "" && rest[0] != null && rest[1] != null && rest[0] === encodeURIComponent(rest[0]) && rest[1] === encodeURIComponent(rest[1]); +} +function isCorrectlyEncodedName(spec) { + return !/[/@\s+%:]/.test(spec) && spec === encodeURIComponent(spec); +} +function ensureValidName(name) { + if (name.charAt(0) === "." || + !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) || + name.toLowerCase() === "node_modules" || + name.toLowerCase() === "favicon.ico") { + throw new Error("Invalid name: " + JSON.stringify(name)); + } +} +function modifyPeople(data, fn) { + if (data.author) { + data.author = fn(data.author); + } + for (const set of ["maintainers", "contributors"]) { + if (!Array.isArray(data[set])) { + continue; + } + data[set] = data[set].map(fn); + } + return data; +} +function unParsePerson(person) { + if (typeof person === "string") { + return person; + } + const name = person.name || ""; + const u = person.url || person.web; + const url = u ? ` (${u})` : ""; + const e = person.email || person.mail; + const email = e ? ` <${e}>` : ""; + return `${name}${email}${url}`; +} +function parsePerson(person) { + if (typeof person !== "string") { + return person; + } + const name = /^([^(<]+)/.exec(person); + const url = /\(([^)]+)\)/.exec(person); + const email = /<([^>]+)>/.exec(person); + const obj = {}; + if (name && name[0].trim()) { + obj.name = name[0].trim(); + } + if (email) { + obj.email = email[1]; + } + if (url) { + obj.url = url[1]; + } + return obj; +} +function depObjectify(deps) { + if (!deps) { + return {}; + } + if (typeof deps === "string") { + deps = deps.trim().split(/[\n\r\s\t ,]+/); + } + if (!Array.isArray(deps)) { + return deps; + } + const o = {}; + deps + .filter(function (d) { + return typeof d === "string"; + }) + .forEach(function (d) { + d = d.trim().split(/(:?[@\s><=])/); + const dn = d.shift(); + let dv = d.join(""); + dv = dv.trim(); + dv = dv.replace(/^@/, ""); + o[dn] = dv; + }); + return o; +} +function objectifyDeps(data) { + depTypes.forEach(function (type) { + if (!data[type]) { + return; + } + data[type] = depObjectify(data[type]); + }); +} +const typoBugs = { web: "url", name: "url" }; +function bugsTypos(bugs) { + if (!bugs) { + return; + } + Object.keys(bugs).forEach(function (k) { + if (typoBugs[k]) { + bugs[typoBugs[k]] = bugs[k]; + delete bugs[k]; + } + }); +} +//# sourceMappingURL=normalizePackageData.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/normalizePackageData.js.map b/client/node_modules/app-builder-lib/out/util/normalizePackageData.js.map new file mode 100644 index 0000000000..17c5c8b652 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/normalizePackageData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalizePackageData.js","sourceRoot":"","sources":["../../src/util/normalizePackageData.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,qDAAyC;AACzC,2BAA0B;AAE1B,SAAgB,oBAAoB,CAAC,IAAS;IAC5C,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,IAAI,CAAC,CAAA;KACT;AACH,CAAC;AAJD,oDAIC;AAED,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAA;AAC5E,MAAM,KAAK,GAAG;IACZ,UAAU,IAAS;QACjB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;SACvC;QACD,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE;YACvC,IAAI,CAAC,UAAU,GAAG;gBAChB,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,IAAI,CAAC,UAAU;aACrB,CAAA;SACF;QACD,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE;YAClD,MAAM,MAAM,GAAG,yBAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GA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ACV,CAAC;AAED,SAAS,aAAa,CAAC,IAAS;IAC9B,QAAQ,CAAC,OAAO,CAAC,UAAU,IAAI;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACf,OAAM;SACP;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,QAAQ,GAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAEjD,SAAS,SAAS,CAAC,IAAS;IAC1B,IAAI,CAAC,IAAI,EAAE;QACT,OAAM;KACP;IACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QACnC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YAC3B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;SACf;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import * as semver from \"semver\"\nimport { fromUrl } from \"hosted-git-info\"\nimport * as url from \"url\"\n\nexport function normalizePackageData(data: any) {\n for (const it of check) {\n it(data)\n }\n}\n\nconst depTypes = [\"dependencies\", \"devDependencies\", \"optionalDependencies\"]\nconst check = [\n function (data: any) {\n if (data.repositories) {\n data.repository = data.repositories[0]\n }\n if (typeof data.repository === \"string\") {\n data.repository = {\n type: \"git\",\n url: data.repository,\n }\n }\n if (data.repository != null && data.repository.url) {\n const hosted = fromUrl(data.repository.url)\n if (hosted) {\n data.repository.url = hosted.getDefaultRepresentation() == \"shortcut\" ? hosted.https() : hosted.toString()\n }\n }\n },\n function (data: any) {\n const files = data.files\n if (files && !Array.isArray(files)) {\n delete data.files\n } else if (data.files) {\n data.files = data.files.filter(function (file: any) {\n return !(!file || typeof file !== \"string\")\n })\n }\n },\n function (data: any) {\n if (!data.bin) {\n return\n }\n if (typeof data.bin === \"string\") {\n const b: any = {}\n const match = data.name.match(/^@[^/]+[/](.*)$/)\n if (match) {\n b[match[1]] = data.bin\n } else {\n b[data.name] = data.bin\n }\n data.bin = b\n }\n },\n function (data: any) {\n if (data.description && typeof data.description !== \"string\") {\n delete data.description\n }\n if (data.description === undefined) {\n delete data.description\n }\n },\n fixBundleDependenciesField,\n function fixDependencies(data: any) {\n objectifyDeps(data)\n fixBundleDependenciesField(data)\n\n for (const deps of [\"dependencies\", \"devDependencies\", \"optionalDependencies\"]) {\n if (!(deps in data)) {\n continue\n }\n if (!data[deps] || typeof data[deps] !== \"object\") {\n delete data[deps]\n continue\n }\n Object.keys(data[deps]).forEach(function (d) {\n const r = data[deps][d]\n if (typeof r !== \"string\") {\n delete data[deps][d]\n }\n const hosted = fromUrl(data[deps][d])\n if (hosted) {\n data[deps][d] = hosted.toString()\n }\n })\n }\n },\n function fixBugsField(data: any) {\n if (!data.bugs && data.repository && data.repository.url) {\n const hosted = fromUrl(data.repository.url)\n if (hosted && hosted.bugs()) {\n data.bugs = { url: hosted.bugs() }\n }\n } else if (data.bugs) {\n const emailRe = /^.+@.*\\..+$/\n if (typeof data.bugs == \"string\") {\n if (emailRe.test(data.bugs)) {\n data.bugs = { email: data.bugs }\n } else if (url.parse(data.bugs).protocol) {\n data.bugs = { url: data.bugs }\n }\n } else {\n bugsTypos(data.bugs)\n const oldBugs = data.bugs\n data.bugs = {}\n if (oldBugs.url) {\n if (typeof oldBugs.url == \"string\" && url.parse(oldBugs.url).protocol) {\n data.bugs.url = oldBugs.url\n }\n }\n if (oldBugs.email) {\n if (typeof oldBugs.email == \"string\" && emailRe.test(oldBugs.email)) {\n data.bugs.email = oldBugs.email\n }\n }\n }\n if (!data.bugs.email && !data.bugs.url) {\n delete data.bugs\n }\n }\n },\n function fixModulesField(data: any) {\n if (data.modules) {\n delete data.modules\n }\n },\n function fixKeywordsField(data: any) {\n if (typeof data.keywords === \"string\") {\n data.keywords = data.keywords.split(/,\\s+/)\n }\n if (data.keywords && !Array.isArray(data.keywords)) {\n delete data.keywords\n } else if (data.keywords) {\n data.keywords = data.keywords.filter(function (kw: any) {\n return !(typeof kw !== \"string\" || !kw)\n })\n }\n },\n function fixVersionField(data: any) {\n const loose = true\n if (!data.version) {\n data.version = \"\"\n return true\n }\n if (!semver.valid(data.version, loose)) {\n throw new Error(`Invalid version: \"${data.version}\"`)\n }\n data.version = semver.clean(data.version, loose)\n return true\n },\n function fixPeople(data: any) {\n modifyPeople(data, unParsePerson)\n modifyPeople(data, parsePerson)\n },\n function fixNameField(data: any) {\n if (!data.name) {\n data.name = \"\"\n return\n }\n if (typeof data.name !== \"string\") {\n throw new Error(\"name field must be a string.\")\n }\n data.name = data.name.trim()\n ensureValidName(data.name)\n },\n function fixHomepageField(data: any) {\n if (!data.homepage && data.repository && data.repository.url) {\n const hosted = fromUrl(data.repository.url)\n if (hosted && hosted.docs()) {\n data.homepage = hosted.docs()\n }\n }\n if (!data.homepage) {\n return\n }\n\n if (typeof data.homepage !== \"string\") {\n delete data.homepage\n }\n if (!url.parse(data.homepage).protocol) {\n data.homepage = `https://${data.homepage}`\n }\n return\n },\n]\n\nfunction fixBundleDependenciesField(data: any) {\n const bdd = \"bundledDependencies\"\n const bd = \"bundleDependencies\"\n if (data[bdd] && !data[bd]) {\n data[bd] = data[bdd]\n delete data[bdd]\n }\n if (data[bd] && !Array.isArray(data[bd])) {\n delete data[bd]\n } else if (data[bd]) {\n data[bd] = data[bd].filter(function (bd: any) {\n if (!bd || typeof bd !== \"string\") {\n return false\n } else {\n if (!data.dependencies) {\n data.dependencies = {}\n }\n if (!(\"bd\" in data.dependencies)) {\n data.dependencies[bd] = \"*\"\n }\n return true\n }\n })\n }\n}\n\nfunction isValidScopedPackageName(spec: string): boolean {\n if (spec.charAt(0) !== \"@\") {\n return false\n }\n\n const rest = spec.slice(1).split(\"/\")\n if (rest.length !== 2) {\n return false\n }\n\n return rest[0] !== \"\" && rest[1] !== \"\" && rest[0] != null && rest[1] != null && rest[0] === encodeURIComponent(rest[0]) && rest[1] === encodeURIComponent(rest[1])\n}\n\nfunction isCorrectlyEncodedName(spec: string): boolean {\n return !/[/@\\s+%:]/.test(spec) && spec === encodeURIComponent(spec)\n}\n\nfunction ensureValidName(name: string): void {\n if (\n name.charAt(0) === \".\" ||\n !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||\n name.toLowerCase() === \"node_modules\" ||\n name.toLowerCase() === \"favicon.ico\"\n ) {\n throw new Error(\"Invalid name: \" + JSON.stringify(name))\n }\n}\n\nfunction modifyPeople(data: any, fn: any): any {\n if (data.author) {\n data.author = fn(data.author)\n }\n for (const set of [\"maintainers\", \"contributors\"]) {\n if (!Array.isArray(data[set])) {\n continue\n }\n data[set] = data[set].map(fn)\n }\n return data\n}\n\nfunction unParsePerson(person: any): string {\n if (typeof person === \"string\") {\n return person\n }\n const name = person.name || \"\"\n const u = person.url || person.web\n const url = u ? ` (${u})` : \"\"\n const e = person.email || person.mail\n const email = e ? ` <${e}>` : \"\"\n return `${name}${email}${url}`\n}\n\nfunction parsePerson(person: any) {\n if (typeof person !== \"string\") {\n return person\n }\n const name = /^([^(<]+)/.exec(person)\n const url = /\\(([^)]+)\\)/.exec(person)\n const email = /<([^>]+)>/.exec(person)\n const obj: any = {}\n if (name && name[0].trim()) {\n obj.name = name[0].trim()\n }\n if (email) {\n obj.email = email[1]\n }\n if (url) {\n obj.url = url[1]\n }\n return obj\n}\n\nfunction depObjectify(deps: any): any {\n if (!deps) {\n return {}\n }\n if (typeof deps === \"string\") {\n deps = deps.trim().split(/[\\n\\r\\s\\t ,]+/)\n }\n if (!Array.isArray(deps)) {\n return deps\n }\n const o: any = {}\n deps\n .filter(function (d) {\n return typeof d === \"string\"\n })\n .forEach(function (d) {\n d = d.trim().split(/(:?[@\\s><=])/)\n const dn = d.shift()\n let dv = d.join(\"\")\n dv = dv.trim()\n dv = dv.replace(/^@/, \"\")\n o[dn] = dv\n })\n return o\n}\n\nfunction objectifyDeps(data: any) {\n depTypes.forEach(function (type) {\n if (!data[type]) {\n return\n }\n data[type] = depObjectify(data[type])\n })\n}\n\nconst typoBugs: any = { web: \"url\", name: \"url\" }\n\nfunction bugsTypos(bugs: any) {\n if (!bugs) {\n return\n }\n Object.keys(bugs).forEach(function (k) {\n if (typoBugs[k]) {\n bugs[typoBugs[k]] = bugs[k]\n delete bugs[k]\n }\n })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/packageDependencies.d.ts b/client/node_modules/app-builder-lib/out/util/packageDependencies.d.ts new file mode 100644 index 0000000000..8545991e30 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageDependencies.d.ts @@ -0,0 +1,9 @@ +import { Lazy } from "lazy-val"; +export declare function createLazyProductionDeps(projectDir: string, excludedDependencies: Array | null): Lazy; +export interface NodeModuleDirInfo { + readonly dir: string; + readonly deps: Array; +} +export interface NodeModuleInfo { + readonly name: string; +} diff --git a/client/node_modules/app-builder-lib/out/util/packageDependencies.js b/client/node_modules/app-builder-lib/out/util/packageDependencies.js new file mode 100644 index 0000000000..2bd131c9ab --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageDependencies.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createLazyProductionDeps = void 0; +const lazy_val_1 = require("lazy-val"); +const appBuilder_1 = require("./appBuilder"); +function createLazyProductionDeps(projectDir, excludedDependencies) { + return new lazy_val_1.Lazy(async () => { + const args = ["node-dep-tree", "--dir", projectDir]; + if (excludedDependencies != null) { + for (const name of excludedDependencies) { + args.push("--exclude-dep", name); + } + } + return appBuilder_1.executeAppBuilderAsJson(args); + }); +} +exports.createLazyProductionDeps = createLazyProductionDeps; +//# sourceMappingURL=packageDependencies.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/packageDependencies.js.map b/client/node_modules/app-builder-lib/out/util/packageDependencies.js.map new file mode 100644 index 0000000000..d40aced9ed --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageDependencies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"packageDependencies.js","sourceRoot":"","sources":["../../src/util/packageDependencies.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAC/B,6CAAsD;AAEtD,SAAgB,wBAAwB,CAAC,UAAkB,EAAE,oBAA0C;IACrG,OAAO,IAAI,eAAI,CAAC,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,GAAG,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;QACnD,IAAI,oBAAoB,IAAI,IAAI,EAAE;YAChC,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE;gBACvC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;aACjC;SACF;QACD,OAAO,oCAAuB,CAAa,IAAI,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC;AAVD,4DAUC","sourcesContent":["import { Lazy } from \"lazy-val\"\nimport { executeAppBuilderAsJson } from \"./appBuilder\"\n\nexport function createLazyProductionDeps(projectDir: string, excludedDependencies: Array | null) {\n return new Lazy(async () => {\n const args = [\"node-dep-tree\", \"--dir\", projectDir]\n if (excludedDependencies != null) {\n for (const name of excludedDependencies) {\n args.push(\"--exclude-dep\", name)\n }\n }\n return executeAppBuilderAsJson>(args)\n })\n}\n\nexport interface NodeModuleDirInfo {\n readonly dir: string\n readonly deps: Array\n}\n\nexport interface NodeModuleInfo {\n readonly name: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/packageMetadata.d.ts b/client/node_modules/app-builder-lib/out/util/packageMetadata.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageMetadata.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/client/node_modules/app-builder-lib/out/util/packageMetadata.js b/client/node_modules/app-builder-lib/out/util/packageMetadata.js new file mode 100644 index 0000000000..614b1272d2 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageMetadata.js @@ -0,0 +1,103 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkMetadata = exports.readPackageJson = void 0; +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const path = require("path"); +const semver = require("semver"); +const normalizePackageData_1 = require("./normalizePackageData"); +/** @internal */ +async function readPackageJson(file) { + const data = await fs_extra_1.readJson(file); + await authors(file, data); + // remove not required fields because can be used for remote build + delete data.scripts; + delete data.readme; + normalizePackageData_1.normalizePackageData(data); + return data; +} +exports.readPackageJson = readPackageJson; +async function authors(file, data) { + if (data.contributors != null) { + return; + } + let authorData; + try { + authorData = await fs_extra_1.readFile(path.resolve(path.dirname(file), "AUTHORS"), "utf8"); + } + catch (ignored) { + return; + } + data.contributors = authorData.split(/\r?\n/g).map(it => it.replace(/^\s*#.*$/, "").trim()); +} +/** @internal */ +function checkMetadata(metadata, devMetadata, appPackageFile, devAppPackageFile) { + const errors = []; + const reportError = (missedFieldName) => { + errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`); + }; + const checkNotEmpty = (name, value) => { + if (builder_util_1.isEmptyOrSpaces(value)) { + reportError(name); + } + }; + if (metadata.directories != null) { + errors.push(`"directories" in the root is deprecated, please specify in the "build"`); + } + checkNotEmpty("name", metadata.name); + if (builder_util_1.isEmptyOrSpaces(metadata.description)) { + builder_util_1.log.warn({ appPackageFile }, `description is missed in the package.json`); + } + if (metadata.author == null) { + builder_util_1.log.warn({ appPackageFile }, `author is missed in the package.json`); + } + checkNotEmpty("version", metadata.version); + checkDependencies(metadata.dependencies, errors); + if (metadata !== devMetadata) { + if (metadata.build != null) { + errors.push(`'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`); + } + } + const devDependencies = metadata.devDependencies; + if (devDependencies != null && "electron-rebuild" in devDependencies) { + builder_util_1.log.info('electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies\n\nTo ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`'); + } + if (errors.length > 0) { + throw new builder_util_1.InvalidConfigurationError(errors.join("\n")); + } +} +exports.checkMetadata = checkMetadata; +function versionSatisfies(version, range, loose) { + if (version == null) { + return false; + } + const coerced = semver.coerce(version); + if (coerced == null) { + return false; + } + return semver.satisfies(coerced, range, loose); +} +function checkDependencies(dependencies, errors) { + if (dependencies == null) { + return; + } + const updaterVersion = dependencies["electron-updater"]; + const requiredElectronUpdaterVersion = "4.0.0"; + if (updaterVersion != null && !versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) { + errors.push(`At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to "^${requiredElectronUpdaterVersion}"`); + } + const swVersion = dependencies["electron-builder-squirrel-windows"]; + if (swVersion != null && !versionSatisfies(swVersion, ">=20.32.0")) { + errors.push(`At least electron-builder-squirrel-windows 20.32.0 is required by current electron-builder version. Please set electron-builder-squirrel-windows to "^20.32.0"`); + } + const deps = ["electron", "electron-prebuilt", "electron-rebuild"]; + if (process.env.ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY !== "true") { + deps.push("electron-builder"); + } + for (const name of deps) { + if (name in dependencies) { + errors.push(`Package "${name}" is only allowed in "devDependencies". ` + `Please remove it from the "dependencies" section in your package.json.`); + } + } +} +//# sourceMappingURL=packageMetadata.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/packageMetadata.js.map b/client/node_modules/app-builder-lib/out/util/packageMetadata.js.map new file mode 100644 index 0000000000..95921f37f1 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/packageMetadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"packageMetadata.js","sourceRoot":"","sources":["../../src/util/packageMetadata.ts"],"names":[],"mappings":";;;AAAA,+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GAAG,wEAAwE,CAAC,CAAA;SACnJ;KACF;AACH,CAAC","sourcesContent":["import { isEmptyOrSpaces, log, InvalidConfigurationError } from \"builder-util\"\nimport { readFile, readJson } from \"fs-extra\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Metadata } from \"../options/metadata\"\nimport { normalizePackageData } from \"./normalizePackageData\"\n\n/** @internal */\nexport async function readPackageJson(file: string): Promise {\n const data = await readJson(file)\n await authors(file, data)\n // remove not required fields because can be used for remote build\n delete data.scripts\n delete data.readme\n normalizePackageData(data)\n return data\n}\n\nasync function authors(file: string, data: any) {\n if (data.contributors != null) {\n return\n }\n\n let authorData\n try {\n authorData = await readFile(path.resolve(path.dirname(file), \"AUTHORS\"), \"utf8\")\n } catch (ignored) {\n return\n }\n\n data.contributors = authorData.split(/\\r?\\n/g).map(it => it.replace(/^\\s*#.*$/, \"\").trim())\n}\n\n/** @internal */\nexport function checkMetadata(metadata: Metadata, devMetadata: any | null, appPackageFile: string, devAppPackageFile: string): void {\n const errors: Array = []\n const reportError = (missedFieldName: string) => {\n errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`)\n }\n\n const checkNotEmpty = (name: string, value: string | null | undefined) => {\n if (isEmptyOrSpaces(value)) {\n reportError(name)\n }\n }\n\n if ((metadata as any).directories != null) {\n errors.push(`\"directories\" in the root is deprecated, please specify in the \"build\"`)\n }\n\n checkNotEmpty(\"name\", metadata.name)\n\n if (isEmptyOrSpaces(metadata.description)) {\n log.warn({ appPackageFile }, `description is missed in the package.json`)\n }\n if (metadata.author == null) {\n log.warn({ appPackageFile }, `author is missed in the package.json`)\n }\n checkNotEmpty(\"version\", metadata.version)\n\n checkDependencies(metadata.dependencies, errors)\n if (metadata !== devMetadata) {\n if (metadata.build != null) {\n errors.push(\n `'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`\n )\n }\n }\n\n const devDependencies = (metadata as any).devDependencies\n if (devDependencies != null && \"electron-rebuild\" in devDependencies) {\n log.info(\n 'electron-rebuild not required if you use electron-builder, please consider to remove excess dependency from devDependencies\\n\\nTo ensure your native dependencies are always matched electron version, simply add script `\"postinstall\": \"electron-builder install-app-deps\" to your `package.json`'\n )\n }\n\n if (errors.length > 0) {\n throw new InvalidConfigurationError(errors.join(\"\\n\"))\n }\n}\n\nfunction versionSatisfies(version: string | semver.SemVer | null, range: string | semver.Range, loose?: boolean): boolean {\n if (version == null) {\n return false\n }\n\n const coerced = semver.coerce(version)\n if (coerced == null) {\n return false\n }\n\n return semver.satisfies(coerced, range, loose)\n}\n\nfunction checkDependencies(dependencies: { [key: string]: string } | null | undefined, errors: Array) {\n if (dependencies == null) {\n return\n }\n\n const updaterVersion = dependencies[\"electron-updater\"]\n const requiredElectronUpdaterVersion = \"4.0.0\"\n if (updaterVersion != null && !versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) {\n errors.push(\n `At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to \"^${requiredElectronUpdaterVersion}\"`\n )\n }\n\n const swVersion = dependencies[\"electron-builder-squirrel-windows\"]\n if (swVersion != null && !versionSatisfies(swVersion, \">=20.32.0\")) {\n errors.push(`At least electron-builder-squirrel-windows 20.32.0 is required by current electron-builder version. Please set electron-builder-squirrel-windows to \"^20.32.0\"`)\n }\n\n const deps = [\"electron\", \"electron-prebuilt\", \"electron-rebuild\"]\n if (process.env.ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY !== \"true\") {\n deps.push(\"electron-builder\")\n }\n for (const name of deps) {\n if (name in dependencies) {\n errors.push(`Package \"${name}\" is only allowed in \"devDependencies\". ` + `Please remove it from the \"dependencies\" section in your package.json.`)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/pathManager.d.ts b/client/node_modules/app-builder-lib/out/util/pathManager.d.ts new file mode 100644 index 0000000000..5169c8f098 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/pathManager.d.ts @@ -0,0 +1,2 @@ +export declare function getTemplatePath(file: string): string; +export declare function getVendorPath(file?: string): string; diff --git a/client/node_modules/app-builder-lib/out/util/pathManager.js b/client/node_modules/app-builder-lib/out/util/pathManager.js new file mode 100644 index 0000000000..9a9b6ba341 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/pathManager.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getVendorPath = exports.getTemplatePath = void 0; +const path = require("path"); +const root = path.join(__dirname, "..", ".."); +function getTemplatePath(file) { + return path.join(root, "templates", file); +} +exports.getTemplatePath = getTemplatePath; +function getVendorPath(file) { + return file == null ? path.join(root, "vendor") : path.join(root, "vendor", file); +} +exports.getVendorPath = getVendorPath; +//# sourceMappingURL=pathManager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/pathManager.js.map b/client/node_modules/app-builder-lib/out/util/pathManager.js.map new file mode 100644 index 0000000000..3c69cce287 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/pathManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pathManager.js","sourceRoot":"","sources":["../../src/util/pathManager.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAE5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE7C,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;AAC3C,CAAC;AAFD,0CAEC;AAED,SAAgB,aAAa,CAAC,IAAa;IACzC,OAAO,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;AACnF,CAAC;AAFD,sCAEC","sourcesContent":["import * as path from \"path\"\n\nconst root = path.join(__dirname, \"..\", \"..\")\n\nexport function getTemplatePath(file: string) {\n return path.join(root, \"templates\", file)\n}\n\nexport function getVendorPath(file?: string) {\n return file == null ? path.join(root, \"vendor\") : path.join(root, \"vendor\", file)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/repositoryInfo.d.ts b/client/node_modules/app-builder-lib/out/util/repositoryInfo.d.ts new file mode 100644 index 0000000000..86e02e99c9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/repositoryInfo.d.ts @@ -0,0 +1,3 @@ +import { SourceRepositoryInfo } from "../core"; +import { Metadata } from "../options/metadata"; +export declare function getRepositoryInfo(projectDir: string, metadata?: Metadata, devMetadata?: Metadata | null): Promise; diff --git a/client/node_modules/app-builder-lib/out/util/repositoryInfo.js b/client/node_modules/app-builder-lib/out/util/repositoryInfo.js new file mode 100644 index 0000000000..7ca0847ca7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/repositoryInfo.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRepositoryInfo = void 0; +const promise_1 = require("builder-util/out/promise"); +const fs_extra_1 = require("fs-extra"); +const hosted_git_info_1 = require("hosted-git-info"); +const path = require("path"); +function getRepositoryInfo(projectDir, metadata, devMetadata) { + return _getInfo(projectDir, (devMetadata == null ? null : devMetadata.repository) || (metadata == null ? null : metadata.repository)); +} +exports.getRepositoryInfo = getRepositoryInfo; +async function getGitUrlFromGitConfig(projectDir) { + const data = await promise_1.orNullIfFileNotExist(fs_extra_1.readFile(path.join(projectDir, ".git", "config"), "utf8")); + if (data == null) { + return null; + } + const conf = data.split(/\r?\n/); + const i = conf.indexOf('[remote "origin"]'); + if (i !== -1) { + let u = conf[i + 1]; + if (!/^\s*url =/.exec(u)) { + u = conf[i + 2]; + } + if (/^\s*url =/.exec(u)) { + return u.replace(/^\s*url = /, ""); + } + } + return null; +} +async function _getInfo(projectDir, repo) { + if (repo != null) { + return parseRepositoryUrl(typeof repo === "string" ? repo : repo.url); + } + const slug = process.env.TRAVIS_REPO_SLUG || process.env.APPVEYOR_REPO_NAME; + if (slug != null) { + const splitted = slug.split("/"); + return { + user: splitted[0], + project: splitted[1], + }; + } + const user = process.env.CIRCLE_PROJECT_USERNAME; + const project = process.env.CIRCLE_PROJECT_REPONAME; + if (user != null && project != null) { + return { + user, + project, + }; + } + const url = await getGitUrlFromGitConfig(projectDir); + return url == null ? null : parseRepositoryUrl(url); +} +function parseRepositoryUrl(url) { + const info = hosted_git_info_1.fromUrl(url); + if (info == null) { + return null; + } + delete info.protocols; + delete info.treepath; + delete info.filetemplate; + delete info.bugstemplate; + delete info.gittemplate; + delete info.tarballtemplate; + delete info.sshtemplate; + delete info.sshurltemplate; + delete info.browsetemplate; + delete info.docstemplate; + delete info.httpstemplate; + delete info.shortcuttemplate; + delete info.pathtemplate; + delete info.pathmatch; + delete info.protocols_re; + delete info.committish; + delete info.default; + delete info.opts; + delete info.browsefiletemplate; + delete info.auth; + return info; +} +//# sourceMappingURL=repositoryInfo.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/repositoryInfo.js.map b/client/node_modules/app-builder-lib/out/util/repositoryInfo.js.map new file mode 100644 index 0000000000..e5d14abceb --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/repositoryInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"repositoryInfo.js","sourceRoot":"","sources":["../../src/util/repositoryInfo.ts"],"names":[],"mappings":";;;AAAA,sDAA+D;AAC/D,uCAAmC;AACnC,qDAAkD;AAClD,6BAA4B;AAI5B,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,QAAmB,EAAE,WAA6B;IACtG,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAA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,IAAI,CAAC,YAAY,CAAA;IACxB,OAAO,IAAI,CAAC,SAAS,CAAA;IACrB,OAAO,IAAI,CAAC,YAAY,CAAA;IACxB,OAAO,IAAI,CAAC,UAAU,CAAA;IACtB,OAAO,IAAI,CAAC,OAAO,CAAA;IACnB,OAAO,IAAI,CAAC,IAAI,CAAA;IAChB,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAC9B,OAAO,IAAI,CAAC,IAAI,CAAA;IAChB,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { orNullIfFileNotExist } from \"builder-util/out/promise\"\nimport { readFile } from \"fs-extra\"\nimport GitHost, { fromUrl } from \"hosted-git-info\"\nimport * as path from \"path\"\nimport { SourceRepositoryInfo } from \"../core\"\nimport { Metadata, RepositoryInfo } from \"../options/metadata\"\n\nexport function getRepositoryInfo(projectDir: string, metadata?: Metadata, devMetadata?: Metadata | null): Promise {\n return _getInfo(projectDir, (devMetadata == null ? null : devMetadata.repository) || (metadata == null ? null : metadata.repository))\n}\n\nasync function getGitUrlFromGitConfig(projectDir: string): Promise {\n const data = await orNullIfFileNotExist(readFile(path.join(projectDir, \".git\", \"config\"), \"utf8\"))\n if (data == null) {\n return null\n }\n\n const conf = data.split(/\\r?\\n/)\n const i = conf.indexOf('[remote \"origin\"]')\n if (i !== -1) {\n let u = conf[i + 1]\n if (!/^\\s*url =/.exec(u)) {\n u = conf[i + 2]\n }\n\n if (/^\\s*url =/.exec(u)) {\n return u.replace(/^\\s*url = /, \"\")\n }\n }\n return null\n}\n\nasync function _getInfo(projectDir: string, repo?: RepositoryInfo | string | null): Promise {\n if (repo != null) {\n return parseRepositoryUrl(typeof repo === \"string\" ? repo : repo.url)\n }\n\n const slug = process.env.TRAVIS_REPO_SLUG || process.env.APPVEYOR_REPO_NAME\n if (slug != null) {\n const splitted = slug.split(\"/\")\n return {\n user: splitted[0],\n project: splitted[1],\n }\n }\n\n const user = process.env.CIRCLE_PROJECT_USERNAME\n const project = process.env.CIRCLE_PROJECT_REPONAME\n if (user != null && project != null) {\n return {\n user,\n project,\n }\n }\n\n const url = await getGitUrlFromGitConfig(projectDir)\n return url == null ? null : parseRepositoryUrl(url)\n}\n\nfunction parseRepositoryUrl(url: string): GitHost | null {\n const info: any = fromUrl(url)\n if (info == null) {\n return null\n }\n delete info.protocols\n delete info.treepath\n delete info.filetemplate\n delete info.bugstemplate\n delete info.gittemplate\n delete info.tarballtemplate\n delete info.sshtemplate\n delete info.sshurltemplate\n delete info.browsetemplate\n delete info.docstemplate\n delete info.httpstemplate\n delete info.shortcuttemplate\n delete info.pathtemplate\n delete info.pathmatch\n delete info.protocols_re\n delete info.committish\n delete info.default\n delete info.opts\n delete info.browsefiletemplate\n delete info.auth\n return info\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/timer.d.ts b/client/node_modules/app-builder-lib/out/util/timer.d.ts new file mode 100644 index 0000000000..705f3ff321 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/timer.d.ts @@ -0,0 +1,11 @@ +export interface Timer { + end(): void; +} +export declare class DevTimer implements Timer { + private readonly label; + private start; + constructor(label: string); + endAndGet(): string; + end(): void; +} +export declare function time(label: string): Timer; diff --git a/client/node_modules/app-builder-lib/out/util/timer.js b/client/node_modules/app-builder-lib/out/util/timer.js new file mode 100644 index 0000000000..a2c8a5bc7e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/timer.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.time = exports.DevTimer = void 0; +const builder_util_1 = require("builder-util"); +class DevTimer { + constructor(label) { + this.label = label; + this.start = process.hrtime(); + } + endAndGet() { + const end = process.hrtime(this.start); + return `${end[0]}s ${Math.round(end[1] / 1000000)}ms`; + } + end() { + console.info(`${this.label}: ${this.endAndGet()}`); + } +} +exports.DevTimer = DevTimer; +class ProductionTimer { + end() { + // ignore + } +} +function time(label) { + return builder_util_1.debug.enabled ? new DevTimer(label) : new ProductionTimer(); +} +exports.time = time; +//# sourceMappingURL=timer.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/timer.js.map b/client/node_modules/app-builder-lib/out/util/timer.js.map new file mode 100644 index 0000000000..4011f1d9df --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/timer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../src/util/timer.ts"],"names":[],"mappings":";;;AAAA,+CAAoC;AAMpC,MAAa,QAAQ;IAGnB,YAA6B,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFlC,UAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAA;IAEa,CAAC;IAE9C,SAAS;QACP,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAA;IACvD,CAAC;IAED,GAAG;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA;IACpD,CAAC;CACF;AAbD,4BAaC;AAED,MAAM,eAAe;IACnB,GAAG;QACD,SAAS;IACX,CAAC;CACF;AAED,SAAgB,IAAI,CAAC,KAAa;IAChC,OAAO,oBAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAA;AACpE,CAAC;AAFD,oBAEC","sourcesContent":["import { debug } from \"builder-util\"\n\nexport interface Timer {\n end(): void\n}\n\nexport class DevTimer implements Timer {\n private start = process.hrtime()\n\n constructor(private readonly label: string) {}\n\n endAndGet(): string {\n const end = process.hrtime(this.start)\n return `${end[0]}s ${Math.round(end[1] / 1000000)}ms`\n }\n\n end(): void {\n console.info(`${this.label}: ${this.endAndGet()}`)\n }\n}\n\nclass ProductionTimer implements Timer {\n end(): void {\n // ignore\n }\n}\n\nexport function time(label: string): Timer {\n return debug.enabled ? new DevTimer(label) : new ProductionTimer()\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/yarn.d.ts b/client/node_modules/app-builder-lib/out/util/yarn.d.ts new file mode 100644 index 0000000000..c8fe763d41 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/yarn.d.ts @@ -0,0 +1,19 @@ +/// +import { Lazy } from "lazy-val"; +import { Configuration } from "../configuration"; +import { NodeModuleDirInfo } from "./packageDependencies"; +export declare function installOrRebuild(config: Configuration, appDir: string, options: RebuildOptions, forceInstall?: boolean): Promise; +export interface DesktopFrameworkInfo { + version: string; + useCustomDist: boolean; +} +export declare function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean): any; +export declare function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo): Promise; +export interface RebuildOptions { + frameworkInfo: DesktopFrameworkInfo; + productionDeps?: Lazy>; + platform?: NodeJS.Platform; + arch?: string; + buildFromSource?: boolean; + additionalArgs?: Array | null; +} diff --git a/client/node_modules/app-builder-lib/out/util/yarn.js b/client/node_modules/app-builder-lib/out/util/yarn.js new file mode 100644 index 0000000000..2c3f8e7ffd --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/yarn.js @@ -0,0 +1,151 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.rebuild = exports.nodeGypRebuild = exports.getGypEnv = exports.installOrRebuild = void 0; +const builder_util_1 = require("builder-util"); +const fs_extra_1 = require("fs-extra"); +const os_1 = require("os"); +const path = require("path"); +const appBuilder_1 = require("./appBuilder"); +async function installOrRebuild(config, appDir, options, forceInstall = false) { + const effectiveOptions = { + buildFromSource: config.buildDependenciesFromSource === true, + additionalArgs: builder_util_1.asArray(config.npmArgs), + ...options, + }; + let isDependenciesInstalled = false; + for (const fileOrDir of ["node_modules", ".pnp.js"]) { + if (await fs_extra_1.pathExists(path.join(appDir, fileOrDir))) { + isDependenciesInstalled = true; + break; + } + } + if (forceInstall || !isDependenciesInstalled) { + await installDependencies(appDir, effectiveOptions); + } + else { + await rebuild(appDir, effectiveOptions); + } +} +exports.installOrRebuild = installOrRebuild; +function getElectronGypCacheDir() { + return path.join(os_1.homedir(), ".electron-gyp"); +} +function getGypEnv(frameworkInfo, platform, arch, buildFromSource) { + const npmConfigArch = arch === "armv7l" ? "arm" : arch; + const common = { + ...process.env, + npm_config_arch: npmConfigArch, + npm_config_target_arch: npmConfigArch, + npm_config_platform: platform, + npm_config_build_from_source: buildFromSource, + // required for node-pre-gyp + npm_config_target_platform: platform, + npm_config_update_binary: true, + npm_config_fallback_to_build: true, + }; + if (platform !== process.platform) { + common.npm_config_force = "true"; + } + if (platform === "win32" || platform === "darwin") { + common.npm_config_target_libc = "unknown"; + } + if (!frameworkInfo.useCustomDist) { + return common; + } + // https://github.com/nodejs/node-gyp/issues/21 + return { + ...common, + npm_config_disturl: "https://electronjs.org/headers", + npm_config_target: frameworkInfo.version, + npm_config_runtime: "electron", + npm_config_devdir: getElectronGypCacheDir(), + }; +} +exports.getGypEnv = getGypEnv; +function checkYarnBerry() { + var _a; + const npmUserAgent = process.env["npm_config_user_agent"] || ""; + const regex = /yarn\/(\d+)\./gm; + const yarnVersionMatch = regex.exec(npmUserAgent); + const yarnMajorVersion = Number((_a = yarnVersionMatch === null || yarnVersionMatch === void 0 ? void 0 : yarnVersionMatch[1]) !== null && _a !== void 0 ? _a : 0); + return yarnMajorVersion >= 2; +} +function installDependencies(appDir, options) { + const platform = options.platform || process.platform; + const arch = options.arch || process.arch; + const additionalArgs = options.additionalArgs; + builder_util_1.log.info({ platform, arch, appDir }, `installing production dependencies`); + let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS; + const execArgs = ["install"]; + const isYarnBerry = checkYarnBerry(); + if (!isYarnBerry) { + if (process.env.NPM_NO_BIN_LINKS === "true") { + execArgs.push("--no-bin-links"); + } + execArgs.push("--production"); + } + if (!isRunningYarn(execPath)) { + execArgs.push("--prefer-offline"); + } + if (execPath == null) { + execPath = getPackageToolPath(); + } + else if (!isYarnBerry) { + execArgs.unshift(execPath); + execPath = process.env.npm_node_execpath || process.env.NODE_EXE || "node"; + } + if (additionalArgs != null) { + execArgs.push(...additionalArgs); + } + return builder_util_1.spawn(execPath, execArgs, { + cwd: appDir, + env: getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true), + }); +} +async function nodeGypRebuild(platform, arch, frameworkInfo) { + builder_util_1.log.info({ platform, arch }, "executing node-gyp rebuild"); + // this script must be used only for electron + const nodeGyp = `node-gyp${process.platform === "win32" ? ".cmd" : ""}`; + const args = ["rebuild"]; + // headers of old Electron versions do not have a valid config.gypi file + // and --force-process-config must be passed to node-gyp >= 8.4.0 to + // correctly build modules for them. + // see also https://github.com/nodejs/node-gyp/pull/2497 + const [major, minor] = frameworkInfo.version + .split(".") + .slice(0, 2) + .map(n => parseInt(n, 10)); + if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) { + args.push("--force-process-config"); + } + await builder_util_1.spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) }); +} +exports.nodeGypRebuild = nodeGypRebuild; +function getPackageToolPath() { + if (process.env.FORCE_YARN === "true") { + return process.platform === "win32" ? "yarn.cmd" : "yarn"; + } + else { + return process.platform === "win32" ? "npm.cmd" : "npm"; + } +} +function isRunningYarn(execPath) { + const userAgent = process.env.npm_config_user_agent; + return process.env.FORCE_YARN === "true" || (execPath != null && path.basename(execPath).startsWith("yarn")) || (userAgent != null && /\byarn\b/.test(userAgent)); +} +/** @internal */ +async function rebuild(appDir, options) { + const configuration = { + dependencies: await options.productionDeps.value, + nodeExecPath: process.execPath, + platform: options.platform || process.platform, + arch: options.arch || process.arch, + additionalArgs: options.additionalArgs, + execPath: process.env.npm_execpath || process.env.NPM_CLI_JS, + buildFromSource: options.buildFromSource === true, + }; + const env = getGypEnv(options.frameworkInfo, configuration.platform, configuration.arch, options.buildFromSource === true); + await appBuilder_1.executeAppBuilderAndWriteJson(["rebuild-node-modules"], configuration, { env, cwd: appDir }); +} +exports.rebuild = rebuild; +//# sourceMappingURL=yarn.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/util/yarn.js.map b/client/node_modules/app-builder-lib/out/util/yarn.js.map new file mode 100644 index 0000000000..0c6a46629e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/util/yarn.js.map @@ -0,0 +1 @@ +{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../src/util/yarn.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,uCAAqC;AAErC,2BAA4B;AAC5B,6BAA4B;AAE5B,6CAA4D;AAGrD,KAAK,UAAU,gBAAgB,CAAC,MAAqB,EAAE,MAAc,EAAE,OAAuB,EAAE,YAAY,GAAG,KAAK;IACzH,MAAM,gBAAgB,GAAG;QACvB,eAAe,EAAE,MAAM,CAAC,2BAA2B,KAAK,IAAI;QAC5D,cAAc,EAAE,sBAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QACvC,GAAG,OAAO;KACX,CAAA;IACD,IAAI,uBAAuB,GAAG,KAAK,CAAA;IAEnC,KAAK,MAAM,SAAS,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;QACnD,IAAI,MAAM,qBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAAE;YAClD,uBAAuB,GAAG,IAAI,CAAA;YAE9B,MAAK;SACN;KACF;IAED,IAAI,YAAY,IAAI,CAAC,uBAAuB,EAAE;QAC5C,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;KACpD;SAAM;QACL,MAAM,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;KACxC;AACH,CAAC;AArBD,4CAqBC;AAOD,SA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Y,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5D,eAAe,EAAE,OAAO,CAAC,eAAe,KAAK,IAAI;KAClD,CAAA;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,KAAK,IAAI,CAAC,CAAA;IAC1H,MAAM,0CAA6B,CAAC,CAAC,sBAAsB,CAAC,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;AACpG,CAAC;AAbD,0BAaC","sourcesContent":["import { asArray, log, spawn } from \"builder-util\"\nimport { pathExists } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { executeAppBuilderAndWriteJson } from \"./appBuilder\"\nimport { NodeModuleDirInfo } from \"./packageDependencies\"\n\nexport async function installOrRebuild(config: Configuration, appDir: string, options: RebuildOptions, forceInstall = false) {\n const effectiveOptions = {\n buildFromSource: config.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if (await pathExists(path.join(appDir, fileOrDir))) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(appDir, effectiveOptions)\n } else {\n await rebuild(appDir, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...process.env,\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\nfunction checkYarnBerry() {\n const npmUserAgent = process.env[\"npm_config_user_agent\"] || \"\"\n const regex = /yarn\\/(\\d+)\\./gm\n\n const yarnVersionMatch = regex.exec(npmUserAgent)\n const yarnMajorVersion = Number(yarnVersionMatch?.[1] ?? 0)\n return yarnMajorVersion >= 2\n}\n\nfunction installDependencies(appDir: string, options: RebuildOptions): Promise {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n log.info({ platform, arch, appDir }, `installing production dependencies`)\n let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS\n const execArgs = [\"install\"]\n const isYarnBerry = checkYarnBerry()\n if (!isYarnBerry) {\n if (process.env.NPM_NO_BIN_LINKS === \"true\") {\n execArgs.push(\"--no-bin-links\")\n }\n execArgs.push(\"--production\")\n }\n\n if (!isRunningYarn(execPath)) {\n execArgs.push(\"--prefer-offline\")\n }\n\n if (execPath == null) {\n execPath = getPackageToolPath()\n } else if (!isYarnBerry) {\n execArgs.unshift(execPath)\n execPath = process.env.npm_node_execpath || process.env.NODE_EXE || \"node\"\n }\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n return spawn(execPath, execArgs, {\n cwd: appDir,\n env: getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n })\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = `node-gyp${process.platform === \"win32\" ? \".cmd\" : \"\"}`\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\n\nfunction getPackageToolPath() {\n if (process.env.FORCE_YARN === \"true\") {\n return process.platform === \"win32\" ? \"yarn.cmd\" : \"yarn\"\n } else {\n return process.platform === \"win32\" ? \"npm.cmd\" : \"npm\"\n }\n}\n\nfunction isRunningYarn(execPath: string | null | undefined) {\n const userAgent = process.env.npm_config_user_agent\n return process.env.FORCE_YARN === \"true\" || (execPath != null && path.basename(execPath).startsWith(\"yarn\")) || (userAgent != null && /\\byarn\\b/.test(userAgent))\n}\n\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n productionDeps?: Lazy>\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array | null\n}\n\n/** @internal */\nexport async function rebuild(appDir: string, options: RebuildOptions) {\n const configuration: any = {\n dependencies: await options.productionDeps!.value,\n nodeExecPath: process.execPath,\n platform: options.platform || process.platform,\n arch: options.arch || process.arch,\n additionalArgs: options.additionalArgs,\n execPath: process.env.npm_execpath || process.env.NPM_CLI_JS,\n buildFromSource: options.buildFromSource === true,\n }\n\n const env = getGypEnv(options.frameworkInfo, configuration.platform, configuration.arch, options.buildFromSource === true)\n await executeAppBuilderAndWriteJson([\"rebuild-node-modules\"], configuration, { env, cwd: appDir })\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/version.d.ts b/client/node_modules/app-builder-lib/out/version.d.ts new file mode 100644 index 0000000000..456cb2ebd9 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/version.d.ts @@ -0,0 +1 @@ +export declare const PACKAGE_VERSION = "23.6.0"; diff --git a/client/node_modules/app-builder-lib/out/version.js b/client/node_modules/app-builder-lib/out/version.js new file mode 100644 index 0000000000..e3a8cff292 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/version.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PACKAGE_VERSION = void 0; +exports.PACKAGE_VERSION = "23.6.0"; +//# sourceMappingURL=version.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/version.js.map b/client/node_modules/app-builder-lib/out/version.js.map new file mode 100644 index 0000000000..1de1e4ad5e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"23.6.0\"\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/MonoVm.d.ts b/client/node_modules/app-builder-lib/out/vm/MonoVm.d.ts new file mode 100644 index 0000000000..f14480394f --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/MonoVm.d.ts @@ -0,0 +1,9 @@ +/// +import { SpawnOptions, ExecFileOptions } from "child_process"; +import { ExtraSpawnOptions } from "builder-util"; +import { VmManager } from "./vm"; +export declare class MonoVmManager extends VmManager { + constructor(); + exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug?: boolean): Promise; + spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/vm/MonoVm.js b/client/node_modules/app-builder-lib/out/vm/MonoVm.js new file mode 100644 index 0000000000..b7deb84703 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/MonoVm.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MonoVmManager = void 0; +const builder_util_1 = require("builder-util"); +const vm_1 = require("./vm"); +class MonoVmManager extends vm_1.VmManager { + constructor() { + super(); + } + exec(file, args, options, isLogOutIfDebug = true) { + return builder_util_1.exec("mono", [file].concat(args), { + ...options, + }, isLogOutIfDebug); + } + spawn(file, args, options, extraOptions) { + return builder_util_1.spawn("mono", [file].concat(args), options, extraOptions); + } +} +exports.MonoVmManager = MonoVmManager; +//# sourceMappingURL=MonoVm.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/MonoVm.js.map b/client/node_modules/app-builder-lib/out/vm/MonoVm.js.map new file mode 100644 index 0000000000..a0b71e5a89 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/MonoVm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MonoVm.js","sourceRoot":"","sources":["../../src/vm/MonoVm.ts"],"names":[],"mappings":";;;AACA,+CAA6D;AAC7D,6BAAgC;AAEhC,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;IACT,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,mBAAI,CACT,MAAM,EACN,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;YACE,GAAG,OAAO;SACX,EACD,eAAe,CAChB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,OAAO,oBAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;CACF;AAnBD,sCAmBC","sourcesContent":["import { SpawnOptions, ExecFileOptions } from \"child_process\"\nimport { exec, ExtraSpawnOptions, spawn } from \"builder-util\"\nimport { VmManager } from \"./vm\"\n\nexport class MonoVmManager extends VmManager {\n constructor() {\n super()\n }\n\n exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug = true): Promise {\n return exec(\n \"mono\",\n [file].concat(args),\n {\n ...options,\n },\n isLogOutIfDebug\n )\n }\n\n spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise {\n return spawn(\"mono\", [file].concat(args), options, extraOptions)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/ParallelsVm.d.ts b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.d.ts new file mode 100644 index 0000000000..2eb7d1cb1e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.d.ts @@ -0,0 +1,7 @@ +export declare function macPathToParallelsWindows(file: string): string; +export interface ParallelsVm { + id: string; + name: string; + os: "win-10" | "win-11" | "ubuntu" | "elementary"; + state: "running" | "suspended" | "stopped"; +} diff --git a/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js new file mode 100644 index 0000000000..eac54ebac3 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.macPathToParallelsWindows = exports.ParallelsVmManager = exports.parseVmList = void 0; +const builder_util_1 = require("builder-util"); +const child_process_1 = require("child_process"); +const vm_1 = require("./vm"); +/** @internal */ +async function parseVmList(debugLogger) { + // do not log output if debug - it is huge, logged using debugLogger + let rawList = await builder_util_1.exec("prlctl", ["list", "-i", "-s", "name"], undefined, false); + debugLogger.add("parallels.list", rawList); + rawList = rawList.substring(rawList.indexOf("ID:")); + // let match: Array | null + const result = []; + for (const info of rawList + .split("\n\n") + .map(it => it.trim()) + .filter(it => it.length > 0)) { + const vm = {}; + for (const line of info.split("\n")) { + const meta = /^([^:("]+): (.*)$/.exec(line); + if (meta == null) { + continue; + } + const key = meta[1].toLowerCase(); + if (key === "id" || key === "os" || key === "name" || key === "state" || key === "name") { + vm[key] = meta[2].trim(); + } + } + result.push(vm); + } + return result; +} +exports.parseVmList = parseVmList; +/** @internal */ +class ParallelsVmManager extends vm_1.VmManager { + constructor(vm) { + super(); + this.vm = vm; + this.isExitHookAdded = false; + this.startPromise = this.doStartVm(); + } + get pathSep() { + return "/"; + } + handleExecuteError(error) { + if (error.message.includes("Unable to open new session in this virtual machine")) { + throw new Error(`Please ensure that your are logged in "${this.vm.name}" parallels virtual machine. In the future please do not stop VM, but suspend.\n\n${error.message}`); + } + builder_util_1.log.warn("ensure that 'Share folders' is set to 'All Disks', see https://goo.gl/E6XphP"); + throw error; + } + async exec(file, args, options) { + await this.ensureThatVmStarted(); + // it is important to use "--current-user" to execute command under logged in user - to access certs. + return await builder_util_1.exec("prlctl", ["exec", this.vm.id, "--current-user", file.startsWith("/") ? macPathToParallelsWindows(file) : file].concat(args), options).catch(error => this.handleExecuteError(error)); + } + async spawn(file, args, options, extraOptions) { + await this.ensureThatVmStarted(); + return await builder_util_1.spawn("prlctl", ["exec", this.vm.id, file].concat(args), options, extraOptions).catch(error => this.handleExecuteError(error)); + } + async doStartVm() { + const vmId = this.vm.id; + const state = this.vm.state; + if (state === "running") { + return; + } + if (!this.isExitHookAdded) { + this.isExitHookAdded = true; + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("async-exit-hook")((callback) => { + const stopArgs = ["suspend", vmId]; + if (callback == null) { + child_process_1.execFileSync("prlctl", stopArgs); + } + else { + builder_util_1.exec("prlctl", stopArgs).then(callback).catch(callback); + } + }); + } + await builder_util_1.exec("prlctl", ["start", vmId]); + } + ensureThatVmStarted() { + let startPromise = this.startPromise; + if (startPromise == null) { + startPromise = this.doStartVm(); + this.startPromise = startPromise; + } + return startPromise; + } + toVmFile(file) { + // https://stackoverflow.com/questions/4742992/cannot-access-network-drive-in-powershell-running-as-administrator + return macPathToParallelsWindows(file); + } +} +exports.ParallelsVmManager = ParallelsVmManager; +function macPathToParallelsWindows(file) { + if (file.startsWith("C:\\")) { + return file; + } + return "\\\\Mac\\Host\\" + file.replace(/\//g, "\\"); +} +exports.macPathToParallelsWindows = macPathToParallelsWindows; +//# sourceMappingURL=ParallelsVm.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js.map b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js.map new file mode 100644 index 0000000000..70645c97b7 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/ParallelsVm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ParallelsVm.js","sourceRoot":"","sources":["../../src/vm/ParallelsVm.ts"],"names":[],"mappings":";;;AAAA,+CAA+E;AAC/E,iDAA2E;AAC3E,6BAAgC;AAEhC,gBAAgB;AACT,KAAK,UAAU,WAAW,CAAC,WAAwB;IACxD,oEAAoE;IACpE,IAAI,OAAO,GAAG,MAAM,mBAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAA;IAClF,WAAW,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAE1C,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAEnD,kCAAkC;IAClC,MAAM,MAAM,GAAuB,EAAE,CAAA;IACrC,KAAK,MAAM,IAAI,IAAI,OAAO;SACvB,KAAK,CAAC,MAAM,CAAC;SACb,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MA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,CAAC,CAAC,CAAC,QAA6B,EAAE,EAAE;gBAC3D,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;gBAClC,IAAI,QAAQ,IAAI,IAAI,EAAE;oBACpB,4BAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;iBACjC;qBAAM;oBACL,mBAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;iBACxD;YACH,CAAC,CAAC,CAAA;SACH;QACD,MAAM,mBAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IACvC,CAAC;IAEO,mBAAmB;QACzB,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACpC,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;YAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;SACjC;QACD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,iHAAiH;QACjH,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;CACF;AAxED,gDAwEC;AAED,SAAgB,yBAAyB,CAAC,IAAY;IACpD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtD,CAAC;AALD,8DAKC","sourcesContent":["import { exec, spawn, DebugLogger, ExtraSpawnOptions, log } from \"builder-util\"\nimport { SpawnOptions, execFileSync, ExecFileOptions } from \"child_process\"\nimport { VmManager } from \"./vm\"\n\n/** @internal */\nexport async function parseVmList(debugLogger: DebugLogger) {\n // do not log output if debug - it is huge, logged using debugLogger\n let rawList = await exec(\"prlctl\", [\"list\", \"-i\", \"-s\", \"name\"], undefined, false)\n debugLogger.add(\"parallels.list\", rawList)\n\n rawList = rawList.substring(rawList.indexOf(\"ID:\"))\n\n // let match: Array | null\n const result: Array = []\n for (const info of rawList\n .split(\"\\n\\n\")\n .map(it => it.trim())\n .filter(it => it.length > 0)) {\n const vm: any = {}\n for (const line of info.split(\"\\n\")) {\n const meta = /^([^:(\"]+): (.*)$/.exec(line)\n if (meta == null) {\n continue\n }\n\n const key = meta[1].toLowerCase()\n if (key === \"id\" || key === \"os\" || key === \"name\" || key === \"state\" || key === \"name\") {\n vm[key] = meta[2].trim()\n }\n }\n result.push(vm)\n }\n return result\n}\n\n/** @internal */\nexport class ParallelsVmManager extends VmManager {\n private startPromise: Promise\n\n private isExitHookAdded = false\n\n constructor(private readonly vm: ParallelsVm) {\n super()\n\n this.startPromise = this.doStartVm()\n }\n\n get pathSep(): string {\n return \"/\"\n }\n\n private handleExecuteError(error: Error): any {\n if (error.message.includes(\"Unable to open new session in this virtual machine\")) {\n throw new Error(`Please ensure that your are logged in \"${this.vm.name}\" parallels virtual machine. In the future please do not stop VM, but suspend.\\n\\n${error.message}`)\n }\n\n log.warn(\"ensure that 'Share folders' is set to 'All Disks', see https://goo.gl/E6XphP\")\n throw error\n }\n\n async exec(file: string, args: Array, options?: ExecFileOptions): Promise {\n await this.ensureThatVmStarted()\n // it is important to use \"--current-user\" to execute command under logged in user - to access certs.\n return await exec(\"prlctl\", [\"exec\", this.vm.id, \"--current-user\", file.startsWith(\"/\") ? macPathToParallelsWindows(file) : file].concat(args), options).catch(error =>\n this.handleExecuteError(error)\n )\n }\n\n async spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise {\n await this.ensureThatVmStarted()\n return await spawn(\"prlctl\", [\"exec\", this.vm.id, file].concat(args), options, extraOptions).catch(error => this.handleExecuteError(error))\n }\n\n private async doStartVm() {\n const vmId = this.vm.id\n const state = this.vm.state\n if (state === \"running\") {\n return\n }\n\n if (!this.isExitHookAdded) {\n this.isExitHookAdded = true\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"async-exit-hook\")((callback: (() => void) | null) => {\n const stopArgs = [\"suspend\", vmId]\n if (callback == null) {\n execFileSync(\"prlctl\", stopArgs)\n } else {\n exec(\"prlctl\", stopArgs).then(callback).catch(callback)\n }\n })\n }\n await exec(\"prlctl\", [\"start\", vmId])\n }\n\n private ensureThatVmStarted() {\n let startPromise = this.startPromise\n if (startPromise == null) {\n startPromise = this.doStartVm()\n this.startPromise = startPromise\n }\n return startPromise\n }\n\n toVmFile(file: string): string {\n // https://stackoverflow.com/questions/4742992/cannot-access-network-drive-in-powershell-running-as-administrator\n return macPathToParallelsWindows(file)\n }\n}\n\nexport function macPathToParallelsWindows(file: string) {\n if (file.startsWith(\"C:\\\\\")) {\n return file\n }\n return \"\\\\\\\\Mac\\\\Host\\\\\" + file.replace(/\\//g, \"\\\\\")\n}\n\nexport interface ParallelsVm {\n id: string\n name: string\n os: \"win-10\" | \"win-11\" | \"ubuntu\" | \"elementary\"\n state: \"running\" | \"suspended\" | \"stopped\"\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/WineVm.d.ts b/client/node_modules/app-builder-lib/out/vm/WineVm.d.ts new file mode 100644 index 0000000000..708d967111 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/WineVm.d.ts @@ -0,0 +1,10 @@ +/// +import { SpawnOptions, ExecFileOptions } from "child_process"; +import { ExtraSpawnOptions } from "builder-util"; +import { VmManager } from "./vm"; +export declare class WineVmManager extends VmManager { + constructor(); + exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug?: boolean): Promise; + spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise; + toVmFile(file: string): string; +} diff --git a/client/node_modules/app-builder-lib/out/vm/WineVm.js b/client/node_modules/app-builder-lib/out/vm/WineVm.js new file mode 100644 index 0000000000..68d6ea5a46 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/WineVm.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WineVmManager = void 0; +const wine_1 = require("../wine"); +const vm_1 = require("./vm"); +const path = require("path"); +class WineVmManager extends vm_1.VmManager { + constructor() { + super(); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + exec(file, args, options, isLogOutIfDebug = true) { + return wine_1.execWine(file, null, args, options); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + spawn(file, args, options, extraOptions) { + throw new Error("Unsupported"); + } + toVmFile(file) { + return path.win32.join("Z:", file); + } +} +exports.WineVmManager = WineVmManager; +//# sourceMappingURL=WineVm.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/WineVm.js.map b/client/node_modules/app-builder-lib/out/vm/WineVm.js.map new file mode 100644 index 0000000000..7fd8841206 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/WineVm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"WineVm.js","sourceRoot":"","sources":["../../src/vm/WineVm.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAClC,6BAAgC;AAChC,6BAA4B;AAE5B,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;IACT,CAAC;IAED,6DAA6D;IAC7D,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,eAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;CACF;AAlBD,sCAkBC","sourcesContent":["import { SpawnOptions, ExecFileOptions } from \"child_process\"\nimport { ExtraSpawnOptions } from \"builder-util\"\nimport { execWine } from \"../wine\"\nimport { VmManager } from \"./vm\"\nimport * as path from \"path\"\n\nexport class WineVmManager extends VmManager {\n constructor() {\n super()\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug = true): Promise {\n return execWine(file, null, args, options)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise {\n throw new Error(\"Unsupported\")\n }\n\n toVmFile(file: string): string {\n return path.win32.join(\"Z:\", file)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/vm.d.ts b/client/node_modules/app-builder-lib/out/vm/vm.d.ts new file mode 100644 index 0000000000..0cd6113f3d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/vm.d.ts @@ -0,0 +1,10 @@ +/// +import { DebugLogger, ExtraSpawnOptions } from "builder-util"; +import { ExecFileOptions, SpawnOptions } from "child_process"; +export declare class VmManager { + get pathSep(): string; + exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug?: boolean): Promise; + spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise; + toVmFile(file: string): string; +} +export declare function getWindowsVm(debugLogger: DebugLogger): Promise; diff --git a/client/node_modules/app-builder-lib/out/vm/vm.js b/client/node_modules/app-builder-lib/out/vm/vm.js new file mode 100644 index 0000000000..d77f899a91 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/vm.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWindowsVm = exports.VmManager = void 0; +const builder_util_1 = require("builder-util"); +const path = require("path"); +class VmManager { + get pathSep() { + return path.sep; + } + exec(file, args, options, isLogOutIfDebug = true) { + return builder_util_1.exec(file, args, options, isLogOutIfDebug); + } + spawn(file, args, options, extraOptions) { + return builder_util_1.spawn(file, args, options, extraOptions); + } + toVmFile(file) { + return file; + } +} +exports.VmManager = VmManager; +async function getWindowsVm(debugLogger) { + const parallelsVmModule = await Promise.resolve().then(() => require("./ParallelsVm")); + const vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => ["win-10", "win-11"].includes(it.os)); + if (vmList.length === 0) { + throw new builder_util_1.InvalidConfigurationError("Cannot find suitable Parallels Desktop virtual machine (Windows 10 is required)"); + } + // prefer running or suspended vm + return new parallelsVmModule.ParallelsVmManager(vmList.find(it => it.state === "running") || vmList.find(it => it.state === "suspended") || vmList[0]); +} +exports.getWindowsVm = getWindowsVm; +//# sourceMappingURL=vm.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/vm/vm.js.map b/client/node_modules/app-builder-lib/out/vm/vm.js.map new file mode 100644 index 0000000000..c4bab6382a --- /dev/null +++ b/client/node_modules/app-builder-lib/out/vm/vm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vm.js","sourceRoot":"","sources":["../../src/vm/vm.ts"],"names":[],"mappings":";;;AAAA,+CAAqG;AAErG,6BAA4B;AAE5B,MAAa,SAAS;IACpB,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,mBAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC,CAAA;IACnD,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,OAAO,oBAAK,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IACjD,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAhBD,8BAgBC;AAEM,KAAK,UAAU,YAAY,CAAC,WAAwB;IACzD,MAAM,iBAAiB,GAAG,2CAAa,eAAe,EAAC,CAAA;IACvD,MAAM,MAAM,GAAG,CAAC,MAAM,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACpH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,wCAAyB,CAAC,iFAAiF,CAAC,CAAA;KACvH;IAED,iCAAiC;IACjC,OAAO,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,KAAK,WAAW,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACxJ,CAAC;AATD,oCASC","sourcesContent":["import { DebugLogger, exec, ExtraSpawnOptions, InvalidConfigurationError, spawn } from \"builder-util\"\nimport { ExecFileOptions, SpawnOptions } from \"child_process\"\nimport * as path from \"path\"\n\nexport class VmManager {\n get pathSep(): string {\n return path.sep\n }\n\n exec(file: string, args: Array, options?: ExecFileOptions, isLogOutIfDebug = true): Promise {\n return exec(file, args, options, isLogOutIfDebug)\n }\n\n spawn(file: string, args: Array, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise {\n return spawn(file, args, options, extraOptions)\n }\n\n toVmFile(file: string): string {\n return file\n }\n}\n\nexport async function getWindowsVm(debugLogger: DebugLogger): Promise {\n const parallelsVmModule = await import(\"./ParallelsVm\")\n const vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => [\"win-10\", \"win-11\"].includes(it.os))\n if (vmList.length === 0) {\n throw new InvalidConfigurationError(\"Cannot find suitable Parallels Desktop virtual machine (Windows 10 is required)\")\n }\n\n // prefer running or suspended vm\n return new parallelsVmModule.ParallelsVmManager(vmList.find(it => it.state === \"running\") || vmList.find(it => it.state === \"suspended\") || vmList[0])\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/winPackager.d.ts b/client/node_modules/app-builder-lib/out/winPackager.d.ts new file mode 100644 index 0000000000..23309baa58 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/winPackager.d.ts @@ -0,0 +1,29 @@ +import { Arch } from "builder-util"; +import { FileTransformer } from "builder-util/out/fs"; +import { Lazy } from "lazy-val"; +import { CertificateFromStoreInfo, CertificateInfo, FileCodeSigningInfo } from "./codeSign/windowsCodeSign"; +import { AfterPackContext } from "./configuration"; +import { Target } from "./core"; +import { RequestedExecutionLevel, WindowsConfiguration } from "./options/winOptions"; +import { Packager } from "./packager"; +import { PlatformPackager } from "./platformPackager"; +import { VmManager } from "./vm/vm"; +export declare class WinPackager extends PlatformPackager { + readonly cscInfo: Lazy; + private _iconPath; + readonly vm: Lazy; + readonly computedPublisherName: Lazy; + readonly lazyCertInfo: Lazy; + get isForceCodeSigningVerification(): boolean; + constructor(info: Packager); + get defaultTarget(): Array; + protected doGetCscPassword(): string | undefined | null; + createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void; + getIconPath(): Promise; + sign(file: string, logMessagePrefix?: string): Promise; + private doSign; + signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null): Promise; + private isSignDlls; + protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null; + protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise; +} diff --git a/client/node_modules/app-builder-lib/out/winPackager.js b/client/node_modules/app-builder-lib/out/winPackager.js new file mode 100644 index 0000000000..078ba37607 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/winPackager.js @@ -0,0 +1,340 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WinPackager = void 0; +const bluebird_lst_1 = require("bluebird-lst"); +const builder_util_1 = require("builder-util"); +const builder_util_runtime_1 = require("builder-util-runtime"); +const fs_1 = require("builder-util/out/fs"); +const crypto_1 = require("crypto"); +const promises_1 = require("fs/promises"); +const isCI = require("is-ci"); +const lazy_val_1 = require("lazy-val"); +const path = require("path"); +const codesign_1 = require("./codeSign/codesign"); +const windowsCodeSign_1 = require("./codeSign/windowsCodeSign"); +const core_1 = require("./core"); +const platformPackager_1 = require("./platformPackager"); +const NsisTarget_1 = require("./targets/nsis/NsisTarget"); +const nsisUtil_1 = require("./targets/nsis/nsisUtil"); +const WebInstallerTarget_1 = require("./targets/nsis/WebInstallerTarget"); +const targetFactory_1 = require("./targets/targetFactory"); +const cacheManager_1 = require("./util/cacheManager"); +const flags_1 = require("./util/flags"); +const timer_1 = require("./util/timer"); +const vm_1 = require("./vm/vm"); +const wine_1 = require("./wine"); +class WinPackager extends platformPackager_1.PlatformPackager { + constructor(info) { + super(info, core_1.Platform.WINDOWS); + this.cscInfo = new lazy_val_1.Lazy(() => { + const platformSpecificBuildOptions = this.platformSpecificBuildOptions; + if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) { + return this.vm.value + .then(vm => windowsCodeSign_1.getCertificateFromStoreInfo(platformSpecificBuildOptions, vm)) + .catch(e => { + // https://github.com/electron-userland/electron-builder/pull/2397 + if (platformSpecificBuildOptions.sign == null) { + throw e; + } + else { + builder_util_1.log.debug({ error: e }, "getCertificateFromStoreInfo error"); + return null; + } + }); + } + const certificateFile = platformSpecificBuildOptions.certificateFile; + if (certificateFile != null) { + const certificatePassword = this.getCscPassword(); + return Promise.resolve({ + file: certificateFile, + password: certificatePassword == null ? null : certificatePassword.trim(), + }); + } + const cscLink = this.getCscLink("WIN_CSC_LINK"); + if (cscLink == null) { + return Promise.resolve(null); + } + return (codesign_1.importCertificate(cscLink, this.info.tempDirManager, this.projectDir) + // before then + .catch(e => { + if (e instanceof builder_util_1.InvalidConfigurationError) { + throw new builder_util_1.InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`); + } + else { + throw e; + } + }) + .then(path => { + return { + file: path, + password: this.getCscPassword(), + }; + })); + }); + this._iconPath = new lazy_val_1.Lazy(() => this.getOrConvertIcon("ico")); + this.vm = new lazy_val_1.Lazy(() => (process.platform === "win32" ? Promise.resolve(new vm_1.VmManager()) : vm_1.getWindowsVm(this.debugLogger))); + this.computedPublisherName = new lazy_val_1.Lazy(async () => { + const publisherName = this.platformSpecificBuildOptions.publisherName; + if (publisherName === null) { + return null; + } + else if (publisherName != null) { + return builder_util_1.asArray(publisherName); + } + const certInfo = await this.lazyCertInfo.value; + return certInfo == null ? null : [certInfo.commonName]; + }); + this.lazyCertInfo = new lazy_val_1.Lazy(async () => { + const cscInfo = await this.cscInfo.value; + if (cscInfo == null) { + return null; + } + if ("subject" in cscInfo) { + const bloodyMicrosoftSubjectDn = cscInfo.subject; + return { + commonName: builder_util_runtime_1.parseDn(bloodyMicrosoftSubjectDn).get("CN"), + bloodyMicrosoftSubjectDn, + }; + } + const cscFile = cscInfo.file; + if (cscFile == null) { + return null; + } + return await windowsCodeSign_1.getCertInfo(cscFile, cscInfo.password || ""); + }); + } + get isForceCodeSigningVerification() { + return this.platformSpecificBuildOptions.verifyUpdateCodeSignature !== false; + } + get defaultTarget() { + return ["nsis"]; + } + doGetCscPassword() { + return platformPackager_1.chooseNotNull(platformPackager_1.chooseNotNull(this.platformSpecificBuildOptions.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword()); + } + createTargets(targets, mapper) { + let copyElevateHelper; + const getCopyElevateHelper = () => { + if (copyElevateHelper == null) { + copyElevateHelper = new nsisUtil_1.CopyElevateHelper(); + } + return copyElevateHelper; + }; + let helper; + const getHelper = () => { + if (helper == null) { + helper = new nsisUtil_1.AppPackageHelper(getCopyElevateHelper()); + } + return helper; + }; + for (const name of targets) { + if (name === core_1.DIR_TARGET) { + continue; + } + if (name === "nsis" || name === "portable") { + mapper(name, outDir => new NsisTarget_1.NsisTarget(this, outDir, name, getHelper())); + } + else if (name === "nsis-web") { + // package file format differs from nsis target + mapper(name, outDir => new WebInstallerTarget_1.WebInstallerTarget(this, path.join(outDir, name), name, new nsisUtil_1.AppPackageHelper(getCopyElevateHelper()))); + } + else { + const targetClass = (() => { + switch (name) { + case "squirrel": + try { + return require("electron-builder-squirrel-windows").default; + } + catch (e) { + throw new builder_util_1.InvalidConfigurationError(`Module electron-builder-squirrel-windows must be installed in addition to build Squirrel.Windows: ${e.stack || e}`); + } + case "appx": + return require("./targets/AppxTarget").default; + case "msi": + return require("./targets/MsiTarget").default; + default: + return null; + } + })(); + mapper(name, outDir => (targetClass === null ? targetFactory_1.createCommonTarget(name, outDir, this) : new targetClass(this, outDir, name))); + } + } + } + getIconPath() { + return this._iconPath.value; + } + async sign(file, logMessagePrefix) { + const signOptions = { + path: file, + name: this.appInfo.productName, + site: await this.appInfo.computePackageUrl(), + options: this.platformSpecificBuildOptions, + }; + const cscInfo = await this.cscInfo.value; + if (cscInfo == null) { + if (this.platformSpecificBuildOptions.sign != null) { + await windowsCodeSign_1.sign(signOptions, this); + } + else if (this.forceCodeSigning) { + throw new builder_util_1.InvalidConfigurationError(`App is not signed and "forceCodeSigning" is set to true, please ensure that code signing configuration is correct, please see https://electron.build/code-signing`); + } + return; + } + if (logMessagePrefix == null) { + logMessagePrefix = "signing"; + } + if ("file" in cscInfo) { + builder_util_1.log.info({ + file: builder_util_1.log.filePath(file), + certificateFile: cscInfo.file, + }, logMessagePrefix); + } + else { + const info = cscInfo; + builder_util_1.log.info({ + file: builder_util_1.log.filePath(file), + subject: info.subject, + thumbprint: info.thumbprint, + store: info.store, + user: info.isLocalMachineStore ? "local machine" : "current user", + }, logMessagePrefix); + } + await this.doSign({ + ...signOptions, + cscInfo, + options: { + ...this.platformSpecificBuildOptions, + }, + }); + } + async doSign(options) { + for (let i = 0; i < 3; i++) { + try { + await windowsCodeSign_1.sign(options, this); + break; + } + catch (e) { + // https://github.com/electron-userland/electron-builder/issues/1414 + const message = e.message; + if (message != null && message.includes("Couldn't resolve host name")) { + builder_util_1.log.warn({ error: message, attempt: i + 1 }, `cannot sign`); + continue; + } + throw e; + } + } + } + async signAndEditResources(file, arch, outDir, internalName, requestedExecutionLevel) { + const appInfo = this.appInfo; + const files = []; + const args = [ + file, + "--set-version-string", + "FileDescription", + appInfo.productName, + "--set-version-string", + "ProductName", + appInfo.productName, + "--set-version-string", + "LegalCopyright", + appInfo.copyright, + "--set-file-version", + appInfo.shortVersion || appInfo.buildVersion, + "--set-product-version", + appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(), + ]; + if (internalName != null) { + args.push("--set-version-string", "InternalName", internalName, "--set-version-string", "OriginalFilename", ""); + } + if (requestedExecutionLevel != null && requestedExecutionLevel !== "asInvoker") { + args.push("--set-requested-execution-level", requestedExecutionLevel); + } + builder_util_1.use(appInfo.companyName, it => args.push("--set-version-string", "CompanyName", it)); + builder_util_1.use(this.platformSpecificBuildOptions.legalTrademarks, it => args.push("--set-version-string", "LegalTrademarks", it)); + const iconPath = await this.getIconPath(); + builder_util_1.use(iconPath, it => { + files.push(it); + args.push("--set-icon", it); + }); + const config = this.config; + const cscInfoForCacheDigest = !flags_1.isBuildCacheEnabled() || isCI || config.electronDist != null ? null : await this.cscInfo.value; + let buildCacheManager = null; + // resources editing doesn't change executable for the same input and executed quickly - no need to complicate + if (cscInfoForCacheDigest != null) { + const cscFile = cscInfoForCacheDigest.file; + if (cscFile != null) { + files.push(cscFile); + } + const timer = timer_1.time("executable cache"); + const hash = crypto_1.createHash("sha512"); + hash.update(config.electronVersion || "no electronVersion"); + hash.update(JSON.stringify(this.platformSpecificBuildOptions)); + hash.update(JSON.stringify(args)); + hash.update(this.platformSpecificBuildOptions.certificateSha1 || "no certificateSha1"); + hash.update(this.platformSpecificBuildOptions.certificateSubjectName || "no subjectName"); + buildCacheManager = new cacheManager_1.BuildCacheManager(outDir, file, arch); + if (await buildCacheManager.copyIfValid(await cacheManager_1.digest(hash, files))) { + timer.end(); + return; + } + timer.end(); + } + const timer = timer_1.time("wine&sign"); + // rcedit crashed of executed using wine, resourcehacker works + if (process.platform === "win32" || process.platform === "darwin") { + await builder_util_1.executeAppBuilder(["rcedit", "--args", JSON.stringify(args)], undefined /* child-process */, {}, 3 /* retry three times */); + } + else if (this.info.framework.name === "electron") { + const vendorPath = await windowsCodeSign_1.getSignVendorPath(); + await wine_1.execWine(path.join(vendorPath, "rcedit-ia32.exe"), path.join(vendorPath, "rcedit-x64.exe"), args); + } + await this.sign(file); + timer.end(); + if (buildCacheManager != null) { + await buildCacheManager.save(); + } + } + isSignDlls() { + return this.platformSpecificBuildOptions.signDlls === true; + } + createTransformerForExtraFiles(packContext) { + if (this.platformSpecificBuildOptions.signAndEditExecutable === false) { + return null; + } + return file => { + if (file.endsWith(".exe") || (this.isSignDlls() && file.endsWith(".dll"))) { + const parentDir = path.dirname(file); + if (parentDir !== packContext.appOutDir) { + return new fs_1.CopyFileTransformer(file => this.sign(file)); + } + } + return null; + }; + } + async signApp(packContext, isAsar) { + const exeFileName = `${this.appInfo.productFilename}.exe`; + if (this.platformSpecificBuildOptions.signAndEditExecutable === false) { + return; + } + await bluebird_lst_1.default.map(promises_1.readdir(packContext.appOutDir), (file) => { + if (file === exeFileName) { + return this.signAndEditResources(path.join(packContext.appOutDir, exeFileName), packContext.arch, packContext.outDir, path.basename(exeFileName, ".exe"), this.platformSpecificBuildOptions.requestedExecutionLevel); + } + else if (file.endsWith(".exe") || (this.isSignDlls() && file.endsWith(".dll"))) { + return this.sign(path.join(packContext.appOutDir, file)); + } + return null; + }); + if (!isAsar) { + return; + } + const signPromise = (filepath) => { + const outDir = path.join(packContext.appOutDir, ...filepath); + return fs_1.walk(outDir, (file, stat) => stat.isDirectory() || file.endsWith(".exe") || (this.isSignDlls() && file.endsWith(".dll"))); + }; + const filesToSign = await Promise.all([signPromise(["resources", "app.asar.unpacked"]), signPromise(["swiftshader"])]); + await bluebird_lst_1.default.map(filesToSign.flat(1), file => this.sign(file), { concurrency: 4 }); + } +} +exports.WinPackager = WinPackager; +//# sourceMappingURL=winPackager.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/winPackager.js.map b/client/node_modules/app-builder-lib/out/winPackager.js.map new file mode 100644 index 0000000000..819354e34e --- /dev/null +++ b/client/node_modules/app-builder-lib/out/winPackager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"winPackager.js","sourceRoot":"","sources":["../src/winPackager.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAoG;AACpG,+DAA8C;AAC9C,4CAAgF;AAChF,mCAAmC;AACnC,0CAAqC;AACrC,8BAA6B;AAC7B,uCAA+B;AAC/B,6BAA4B;AAC5B,kDAAuD;AACvD,gEASmC;AAEnC,iCAAqD;AAGrD,yDAAoE;AAEpE,0DAAsD;AACtD,sDAA6E;AAC7E,0EAAsE;AACtE,2DAA4D;AAC5D,sDAA+D;AAC/D,wCAAkD;AAClD,wCAAmC;AACnC,gCAAiD;AACjD,iCAAiC;AAEjC,MAAa,WAAY,SAAQ,mCAAsC;IA2FrE,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,EAAE,eAAQ,CAAC,OAAO,CAAC,CAAA;QA3FtB,YAAO,GAAG,IAAI,eAAI,CAAwD,GAAG,EAAE;YACtF,MAAM,4BAA4B,GAAG,IAAI,CAAC,4BAA4B,CAAA;YACtE,IAAI,4BAA4B,CAAC,sBAAsB,IAAI,IAAI,IAAI,4BAA4B,CAAC,eAAe,IAAI,IAAI,EAAE;gBACvH,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK;qBACjB,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,6CAA2B,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;qBACzE,KAAK,CAAC,CAA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IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAClI,CAAC,CAAA;QACD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACtH,MAAM,sBAAe,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAA;IAC7F,CAAC;CACF;AA7WD,kCA6WC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, InvalidConfigurationError, log, use, executeAppBuilder } from \"builder-util\"\nimport { parseDn } from \"builder-util-runtime\"\nimport { CopyFileTransformer, FileTransformer, walk } from \"builder-util/out/fs\"\nimport { createHash } from \"crypto\"\nimport { readdir } from \"fs/promises\"\nimport * as isCI from \"is-ci\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { importCertificate } from \"./codeSign/codesign\"\nimport {\n CertificateFromStoreInfo,\n CertificateInfo,\n FileCodeSigningInfo,\n getCertificateFromStoreInfo,\n getCertInfo,\n getSignVendorPath,\n sign,\n WindowsSignOptions,\n} from \"./codeSign/windowsCodeSign\"\nimport { AfterPackContext } from \"./configuration\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { RequestedExecutionLevel, WindowsConfiguration } from \"./options/winOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport AppXTarget from \"./targets/AppxTarget\"\nimport { NsisTarget } from \"./targets/nsis/NsisTarget\"\nimport { AppPackageHelper, CopyElevateHelper } from \"./targets/nsis/nsisUtil\"\nimport { WebInstallerTarget } from \"./targets/nsis/WebInstallerTarget\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\nimport { BuildCacheManager, digest } from \"./util/cacheManager\"\nimport { isBuildCacheEnabled } from \"./util/flags\"\nimport { time } from \"./util/timer\"\nimport { getWindowsVm, VmManager } from \"./vm/vm\"\nimport { execWine } from \"./wine\"\n\nexport class WinPackager extends PlatformPackager {\n readonly cscInfo = new Lazy(() => {\n const platformSpecificBuildOptions = this.platformSpecificBuildOptions\n if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) {\n return this.vm.value\n .then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch(e => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (platformSpecificBuildOptions.sign == null) {\n throw e\n } else {\n log.debug({ error: e }, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = platformSpecificBuildOptions.certificateFile\n if (certificateFile != null) {\n const certificatePassword = this.getCscPassword()\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n const cscLink = this.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null) {\n return Promise.resolve(null)\n }\n\n return (\n importCertificate(cscLink, this.info.tempDirManager, this.projectDir)\n // before then\n .catch(e => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n } else {\n throw e\n }\n })\n .then(path => {\n return {\n file: path,\n password: this.getCscPassword(),\n }\n })\n )\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"ico\"))\n\n readonly vm = new Lazy(() => (process.platform === \"win32\" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger)))\n\n readonly computedPublisherName = new Lazy | null>(async () => {\n const publisherName = this.platformSpecificBuildOptions.publisherName\n if (publisherName === null) {\n return null\n } else if (publisherName != null) {\n return asArray(publisherName)\n }\n\n const certInfo = await this.lazyCertInfo.value\n return certInfo == null ? null : [certInfo.commonName]\n })\n\n readonly lazyCertInfo = new Lazy(async () => {\n const cscInfo = await this.cscInfo.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = cscInfo.subject\n return {\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\")!,\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = cscInfo.file\n if (cscFile == null) {\n return null\n }\n return await getCertInfo(cscFile, cscInfo.password || \"\")\n })\n\n get isForceCodeSigningVerification(): boolean {\n return this.platformSpecificBuildOptions.verifyUpdateCodeSignature !== false\n }\n\n constructor(info: Packager) {\n super(info, Platform.WINDOWS)\n }\n\n get defaultTarget(): Array {\n return [\"nsis\"]\n }\n\n protected doGetCscPassword(): string | undefined | null {\n return chooseNotNull(chooseNotNull(this.platformSpecificBuildOptions.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword())\n }\n\n createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let copyElevateHelper: CopyElevateHelper | null\n const getCopyElevateHelper = () => {\n if (copyElevateHelper == null) {\n copyElevateHelper = new CopyElevateHelper()\n }\n return copyElevateHelper\n }\n\n let helper: AppPackageHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new AppPackageHelper(getCopyElevateHelper())\n }\n return helper\n }\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n if (name === \"nsis\" || name === \"portable\") {\n mapper(name, outDir => new NsisTarget(this, outDir, name, getHelper()))\n } else if (name === \"nsis-web\") {\n // package file format differs from nsis target\n mapper(name, outDir => new WebInstallerTarget(this, path.join(outDir, name), name, new AppPackageHelper(getCopyElevateHelper())))\n } else {\n const targetClass: typeof NsisTarget | typeof AppXTarget | null = (() => {\n switch (name) {\n case \"squirrel\":\n try {\n return require(\"electron-builder-squirrel-windows\").default\n } catch (e) {\n throw new InvalidConfigurationError(`Module electron-builder-squirrel-windows must be installed in addition to build Squirrel.Windows: ${e.stack || e}`)\n }\n\n case \"appx\":\n return require(\"./targets/AppxTarget\").default\n\n case \"msi\":\n return require(\"./targets/MsiTarget\").default\n\n default:\n return null\n }\n })()\n\n mapper(name, outDir => (targetClass === null ? createCommonTarget(name, outDir, this) : new (targetClass as any)(this, outDir, name)))\n }\n }\n }\n\n getIconPath() {\n return this._iconPath.value\n }\n\n async sign(file: string, logMessagePrefix?: string): Promise {\n const signOptions: WindowsSignOptions = {\n path: file,\n name: this.appInfo.productName,\n site: await this.appInfo.computePackageUrl(),\n options: this.platformSpecificBuildOptions,\n }\n\n const cscInfo = await this.cscInfo.value\n if (cscInfo == null) {\n if (this.platformSpecificBuildOptions.sign != null) {\n await sign(signOptions, this)\n } else if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(\n `App is not signed and \"forceCodeSigning\" is set to true, please ensure that code signing configuration is correct, please see https://electron.build/code-signing`\n )\n }\n return\n }\n\n if (logMessagePrefix == null) {\n logMessagePrefix = \"signing\"\n }\n\n if (\"file\" in cscInfo) {\n log.info(\n {\n file: log.filePath(file),\n certificateFile: cscInfo.file,\n },\n logMessagePrefix\n )\n } else {\n const info = cscInfo\n log.info(\n {\n file: log.filePath(file),\n subject: info.subject,\n thumbprint: info.thumbprint,\n store: info.store,\n user: info.isLocalMachineStore ? \"local machine\" : \"current user\",\n },\n logMessagePrefix\n )\n }\n\n await this.doSign({\n ...signOptions,\n cscInfo,\n options: {\n ...this.platformSpecificBuildOptions,\n },\n })\n }\n\n private async doSign(options: WindowsSignOptions) {\n for (let i = 0; i < 3; i++) {\n try {\n await sign(options, this)\n break\n } catch (e) {\n // https://github.com/electron-userland/electron-builder/issues/1414\n const message = e.message\n if (message != null && message.includes(\"Couldn't resolve host name\")) {\n log.warn({ error: message, attempt: i + 1 }, `cannot sign`)\n continue\n }\n throw e\n }\n }\n }\n\n async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {\n const appInfo = this.appInfo\n\n const files: Array = []\n\n const args = [\n file,\n \"--set-version-string\",\n \"FileDescription\",\n appInfo.productName,\n \"--set-version-string\",\n \"ProductName\",\n appInfo.productName,\n \"--set-version-string\",\n \"LegalCopyright\",\n appInfo.copyright,\n \"--set-file-version\",\n appInfo.shortVersion || appInfo.buildVersion,\n \"--set-product-version\",\n appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),\n ]\n\n if (internalName != null) {\n args.push(\"--set-version-string\", \"InternalName\", internalName, \"--set-version-string\", \"OriginalFilename\", \"\")\n }\n\n if (requestedExecutionLevel != null && requestedExecutionLevel !== \"asInvoker\") {\n args.push(\"--set-requested-execution-level\", requestedExecutionLevel)\n }\n\n use(appInfo.companyName, it => args.push(\"--set-version-string\", \"CompanyName\", it))\n use(this.platformSpecificBuildOptions.legalTrademarks, it => args.push(\"--set-version-string\", \"LegalTrademarks\", it))\n const iconPath = await this.getIconPath()\n use(iconPath, it => {\n files.push(it)\n args.push(\"--set-icon\", it)\n })\n\n const config = this.config\n const cscInfoForCacheDigest = !isBuildCacheEnabled() || isCI || config.electronDist != null ? null : await this.cscInfo.value\n let buildCacheManager: BuildCacheManager | null = null\n // resources editing doesn't change executable for the same input and executed quickly - no need to complicate\n if (cscInfoForCacheDigest != null) {\n const cscFile = (cscInfoForCacheDigest as FileCodeSigningInfo).file\n if (cscFile != null) {\n files.push(cscFile)\n }\n\n const timer = time(\"executable cache\")\n const hash = createHash(\"sha512\")\n hash.update(config.electronVersion || \"no electronVersion\")\n hash.update(JSON.stringify(this.platformSpecificBuildOptions))\n hash.update(JSON.stringify(args))\n hash.update(this.platformSpecificBuildOptions.certificateSha1 || \"no certificateSha1\")\n hash.update(this.platformSpecificBuildOptions.certificateSubjectName || \"no subjectName\")\n\n buildCacheManager = new BuildCacheManager(outDir, file, arch)\n if (await buildCacheManager.copyIfValid(await digest(hash, files))) {\n timer.end()\n return\n }\n timer.end()\n }\n\n const timer = time(\"wine&sign\")\n // rcedit crashed of executed using wine, resourcehacker works\n if (process.platform === \"win32\" || process.platform === \"darwin\") {\n await executeAppBuilder([\"rcedit\", \"--args\", JSON.stringify(args)], undefined /* child-process */, {}, 3 /* retry three times */)\n } else if (this.info.framework.name === \"electron\") {\n const vendorPath = await getSignVendorPath()\n await execWine(path.join(vendorPath, \"rcedit-ia32.exe\"), path.join(vendorPath, \"rcedit-x64.exe\"), args)\n }\n\n await this.sign(file)\n timer.end()\n\n if (buildCacheManager != null) {\n await buildCacheManager.save()\n }\n }\n\n private isSignDlls(): boolean {\n return this.platformSpecificBuildOptions.signDlls === true\n }\n\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n return null\n }\n\n return file => {\n if (file.endsWith(\".exe\") || (this.isSignDlls() && file.endsWith(\".dll\"))) {\n const parentDir = path.dirname(file)\n if (parentDir !== packContext.appOutDir) {\n return new CopyFileTransformer(file => this.sign(file))\n }\n }\n return null\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise {\n const exeFileName = `${this.appInfo.productFilename}.exe`\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n return\n }\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === exeFileName) {\n return this.signAndEditResources(\n path.join(packContext.appOutDir, exeFileName),\n packContext.arch,\n packContext.outDir,\n path.basename(exeFileName, \".exe\"),\n this.platformSpecificBuildOptions.requestedExecutionLevel\n )\n } else if (file.endsWith(\".exe\") || (this.isSignDlls() && file.endsWith(\".dll\"))) {\n return this.sign(path.join(packContext.appOutDir, file))\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const signPromise = (filepath: string[]) => {\n const outDir = path.join(packContext.appOutDir, ...filepath)\n return walk(outDir, (file, stat) => stat.isDirectory() || file.endsWith(\".exe\") || (this.isSignDlls() && file.endsWith(\".dll\")))\n }\n const filesToSign = await Promise.all([signPromise([\"resources\", \"app.asar.unpacked\"]), signPromise([\"swiftshader\"])])\n await BluebirdPromise.map(filesToSign.flat(1), file => this.sign(file), { concurrency: 4 })\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/wine.d.ts b/client/node_modules/app-builder-lib/out/wine.d.ts new file mode 100644 index 0000000000..d073dd430d --- /dev/null +++ b/client/node_modules/app-builder-lib/out/wine.d.ts @@ -0,0 +1,6 @@ +/// +import { ExecFileOptions } from "child_process"; +/** @private */ +export declare function execWine(file: string, file64?: string | null, appArgs?: Array, options?: ExecFileOptions): Promise; +/** @private */ +export declare function prepareWindowsExecutableArgs(args: Array, exePath: string): string[]; diff --git a/client/node_modules/app-builder-lib/out/wine.js b/client/node_modules/app-builder-lib/out/wine.js new file mode 100644 index 0000000000..9ab372b9e8 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/wine.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prepareWindowsExecutableArgs = exports.execWine = void 0; +const builder_util_1 = require("builder-util"); +/** @private */ +function execWine(file, file64 = null, appArgs = [], options = {}) { + if (process.platform === "win32") { + if (options.timeout == null) { + // 2 minutes + options.timeout = 120 * 1000; + } + return builder_util_1.exec(file, appArgs, options); + } + const commandArgs = ["wine", "--ia32", file]; + if (file64 != null) { + commandArgs.push("--x64", file64); + } + if (appArgs.length > 0) { + commandArgs.push("--args", JSON.stringify(appArgs)); + } + return builder_util_1.executeAppBuilder(commandArgs, undefined, options); +} +exports.execWine = execWine; +/** @private */ +function prepareWindowsExecutableArgs(args, exePath) { + if (process.platform !== "win32") { + args.unshift(exePath); + } + return args; +} +exports.prepareWindowsExecutableArgs = prepareWindowsExecutableArgs; +//# sourceMappingURL=wine.js.map \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/out/wine.js.map b/client/node_modules/app-builder-lib/out/wine.js.map new file mode 100644 index 0000000000..c7e5bc3767 --- /dev/null +++ b/client/node_modules/app-builder-lib/out/wine.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wine.js","sourceRoot":"","sources":["../src/wine.ts"],"names":[],"mappings":";;;AACA,+CAAsD;AAEtD,eAAe;AACf,SAAgB,QAAQ,CAAC,IAAY,EAAE,SAAwB,IAAI,EAAE,UAAyB,EAAE,EAAE,UAA2B,EAAE;IAC7H,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE;YAC3B,YAAY;YACZ,OAAO,CAAC,OAAO,GAAG,GAAG,GAAG,IAAI,CAAA;SAC7B;QACD,OAAO,mBAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;KACpC;IAED,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC5C,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;KAClC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;KACpD;IACD,OAAO,gCAAiB,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3D,CAAC;AAjBD,4BAiBC;AAED,eAAe;AACf,SAAgB,4BAA4B,CAAC,IAAmB,EAAE,OAAe;IAC/E,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;KACtB;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AALD,oEAKC","sourcesContent":["import { ExecFileOptions } from \"child_process\"\nimport { exec, executeAppBuilder } from \"builder-util\"\n\n/** @private */\nexport function execWine(file: string, file64: string | null = null, appArgs: Array = [], options: ExecFileOptions = {}): Promise {\n if (process.platform === \"win32\") {\n if (options.timeout == null) {\n // 2 minutes\n options.timeout = 120 * 1000\n }\n return exec(file, appArgs, options)\n }\n\n const commandArgs = [\"wine\", \"--ia32\", file]\n if (file64 != null) {\n commandArgs.push(\"--x64\", file64)\n }\n if (appArgs.length > 0) {\n commandArgs.push(\"--args\", JSON.stringify(appArgs))\n }\n return executeAppBuilder(commandArgs, undefined, options)\n}\n\n/** @private */\nexport function prepareWindowsExecutableArgs(args: Array, exePath: string) {\n if (process.platform !== \"win32\") {\n args.unshift(exePath)\n }\n return args\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/package.json b/client/node_modules/app-builder-lib/package.json new file mode 100644 index 0000000000..36c836c7b7 --- /dev/null +++ b/client/node_modules/app-builder-lib/package.json @@ -0,0 +1,111 @@ +{ + "name": "app-builder-lib", + "description": "electron-builder lib", + "version": "23.6.0", + "main": "out/index.js", + "files": [ + "out", + "templates", + "scheme.json", + "electron-osx-sign", + "certs/root_certs.keychain" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/electron-userland/electron-builder.git", + "directory": "packages/app-builder-lib" + }, + "engines": { + "node": ">=14.0.0" + }, + "keywords": [ + "electron", + "builder", + "build", + "installer", + "install", + "packager", + "pack", + "nsis", + "app", + "dmg", + "pkg", + "msi", + "exe", + "setup", + "Windows", + "OS X", + "MacOS", + "Mac", + "appx", + "snap", + "flatpak", + "portable" + ], + "author": "Vladimir Krivosheev", + "license": "MIT", + "bugs": "https://github.com/electron-userland/electron-builder/issues", + "homepage": "https://github.com/electron-userland/electron-builder", + "dependencies": { + "7zip-bin": "~5.1.1", + "@develar/schema-utils": "~2.6.5", + "@electron/universal": "1.2.1", + "@malept/flatpak-bundler": "^0.4.0", + "async-exit-hook": "^2.0.1", + "bluebird-lst": "^1.0.9", + "builder-util": "23.6.0", + "builder-util-runtime": "9.1.1", + "chromium-pickle-js": "^0.2.0", + "debug": "^4.3.4", + "ejs": "^3.1.7", + "electron-osx-sign": "^0.6.0", + "electron-publish": "23.6.0", + "form-data": "^4.0.0", + "fs-extra": "^10.1.0", + "hosted-git-info": "^4.1.0", + "is-ci": "^3.0.0", + "isbinaryfile": "^4.0.10", + "js-yaml": "^4.1.0", + "lazy-val": "^1.0.5", + "minimatch": "^3.1.2", + "read-config-file": "6.2.0", + "sanitize-filename": "^1.6.3", + "semver": "^7.3.7", + "tar": "^6.1.11", + "temp-file": "^3.4.0" + }, + "///": "babel in devDependencies for proton tests", + "devDependencies": { + "@babel/core": "7.15.5", + "@babel/plugin-proposal-class-properties": "7.14.5", + "@babel/plugin-proposal-decorators": "7.15.4", + "@babel/plugin-proposal-do-expressions": "7.14.5", + "@babel/plugin-proposal-export-default-from": "7.14.5", + "@babel/plugin-proposal-export-namespace-from": "7.14.5", + "@babel/plugin-proposal-function-bind": "7.14.5", + "@babel/plugin-proposal-function-sent": "7.14.5", + "@babel/plugin-proposal-json-strings": "7.14.5", + "@babel/plugin-proposal-logical-assignment-operators": "7.14.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5", + "@babel/plugin-proposal-numeric-separator": "7.14.5", + "@babel/plugin-proposal-optional-chaining": "7.14.5", + "@babel/plugin-proposal-pipeline-operator": "7.15.0", + "@babel/plugin-proposal-throw-expressions": "7.14.5", + "@babel/plugin-syntax-dynamic-import": "7.8.3", + "@babel/plugin-syntax-import-meta": "7.10.4", + "@babel/preset-env": "7.15.6", + "@babel/preset-react": "7.14.5", + "@types/debug": "4.1.7", + "@types/ejs": "3.1.0", + "@types/fs-extra": "9.0.13", + "@types/hosted-git-info": "3.0.2", + "@types/is-ci": "3.0.0", + "@types/js-yaml": "4.0.3", + "@types/semver": "7.3.8", + "@types/tar": "^6.1.1", + "dmg-builder": "23.6.0", + "electron-builder-squirrel-windows": "23.6.0" + }, + "//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)", + "typings": "./out/index.d.ts" +} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/scheme.json b/client/node_modules/app-builder-lib/scheme.json new file mode 100644 index 0000000000..f9e06294e7 --- /dev/null +++ b/client/node_modules/app-builder-lib/scheme.json @@ -0,0 +1,6999 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "definitions": { + "AppImageOptions": { + "additionalProperties": false, + "properties": { + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "license": { + "description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.", + "type": [ + "null", + "string" + ] + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "AppXOptions": { + "additionalProperties": false, + "properties": { + "addAutoLaunchExtension": { + "description": "Whether to add auto launch extension. Defaults to `true` if [electron-winstore-auto-launch](https://github.com/felixrieseberg/electron-winstore-auto-launch) in the dependencies.", + "type": "boolean" + }, + "applicationId": { + "description": "The application id. Defaults to `identityName`. Can’t start with numbers.", + "type": "string" + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "backgroundColor": { + "default": "#464646", + "description": "The background color of the app tile. See [Visual Elements](https://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx).", + "type": [ + "null", + "string" + ] + }, + "customExtensionsPath": { + "description": "Relative path to custom extensions xml to be included in an `appmanifest.xml`.", + "type": "string" + }, + "displayName": { + "description": "A friendly name that can be displayed to users. Corresponds to [Properties.DisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211432.aspx).\nDefaults to the application product name.", + "type": [ + "null", + "string" + ] + }, + "electronUpdaterAware": { + "default": false, + "type": "boolean" + }, + "identityName": { + "description": "The name. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). Defaults to the [application name](/configuration/configuration#Metadata-name).", + "type": [ + "null", + "string" + ] + }, + "languages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The list of [supported languages](https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest) that will be listed in the Windows Store.\nThe first entry (index 0) will be the default language.\nDefaults to en-US if omitted." + }, + "makeappxArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "publisher": { + "description": "The Windows Store publisher. Not used if AppX is build for testing. See [AppX Package Code Signing](#appx-package-code-signing) below.", + "type": [ + "null", + "string" + ] + }, + "publisherDisplayName": { + "description": "A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).\nDefaults to company name from the application metadata.", + "type": [ + "null", + "string" + ] + }, + "setBuildNumber": { + "default": false, + "description": "Whether to set build number. See https://github.com/electron-userland/electron-builder/issues/3875", + "type": "boolean" + }, + "showNameOnTiles": { + "default": false, + "description": "Whether to overlay the app's name on top of tile images on the Start screen. Defaults to `false`. (https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-shownameontiles) in the dependencies.", + "type": "boolean" + } + }, + "type": "object" + }, + "AsarOptions": { + "additionalProperties": false, + "properties": { + "ordering": { + "type": [ + "null", + "string" + ] + }, + "smartUnpack": { + "default": true, + "description": "Whether to automatically unpack executables files.", + "type": "boolean" + } + }, + "type": "object" + }, + "BitbucketOptions": { + "additionalProperties": false, + "description": "Bitbucket options.\nhttps://bitbucket.org/\nDefine `BITBUCKET_TOKEN` environment variable.\n\nFor converting an app password to a usable token, you can utilize this\n```typescript\nconvertAppPassword(owner: string, token: string) {\nconst base64encodedData = Buffer.from(`${owner}:${token.trim()}`).toString(\"base64\")\nreturn `Basic ${base64encodedData}`\n}\n```", + "properties": { + "channel": { + "default": "latest", + "description": "The channel.", + "type": [ + "null", + "string" + ] + }, + "owner": { + "description": "Repository owner", + "type": "string" + }, + "provider": { + "description": "The provider. Must be `bitbucket`.", + "enum": [ + "bitbucket" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "slug": { + "description": "Repository slug/name", + "type": "string" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "token": { + "description": "The access token to support auto-update from private bitbucket repositories.", + "type": [ + "null", + "string" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + }, + "username": { + "description": "The user name to support auto-update from private bitbucket repositories.", + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "owner", + "provider", + "slug" + ], + "type": "object" + }, + "CustomNsisBinary": { + "additionalProperties": false, + "properties": { + "checksum": { + "default": "VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==", + "type": [ + "null", + "string" + ] + }, + "debugLogging": { + "description": "Whether or not to enable NSIS logging for debugging.\nNote: Requires a debug-enabled NSIS build.\nelectron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary`\nIn your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText`", + "type": [ + "null", + "boolean" + ] + }, + "url": { + "default": "https://github.com/electron-userland/electron-builder-binaries/releases/download", + "type": [ + "null", + "string" + ] + }, + "version": { + "default": "3.0.4.1", + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "url" + ], + "type": "object" + }, + "CustomPublishOptions": { + "additionalProperties": {}, + "properties": { + "provider": { + "description": "The provider. Must be `custom`.", + "enum": [ + "custom" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updateProvider": { + "description": "The Provider to provide UpdateInfo regarding available updates. Required\nto use custom providers with electron-updater.", + "typeof": "function" + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "provider" + ], + "type": "object" + }, + "DebOptions": { + "additionalProperties": false, + "properties": { + "afterInstall": { + "type": [ + "null", + "string" + ] + }, + "afterRemove": { + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "bzip2", + "gz", + "lzo", + "xz" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "xz", + "description": "The compression type." + }, + "depends": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\nIf need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\nIf need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used by GNOME](https://packages.debian.org/bullseye/gconf2)." + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "fpm": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "*Advanced only* The [fpm](https://github.com/jordansissel/fpm/wiki#usage) options.\n\nExample: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`" + }, + "icon": { + "type": "string" + }, + "maintainer": { + "type": [ + "null", + "string" + ] + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "packageCategory": { + "description": "The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).", + "type": [ + "null", + "string" + ] + }, + "packageName": { + "description": "The name of the package.", + "type": [ + "null", + "string" + ] + }, + "priority": { + "description": "The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.", + "type": [ + "null", + "string" + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + }, + "vendor": { + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "DmgContent": { + "additionalProperties": false, + "properties": { + "name": { + "description": "The name of the file within the DMG. Defaults to basename of `path`.", + "type": "string" + }, + "path": { + "description": "The path of the file within the DMG.", + "type": "string" + }, + "type": { + "enum": [ + "dir", + "file", + "link" + ], + "type": "string" + }, + "x": { + "description": "The device-independent pixel offset from the left of the window to the **center** of the icon.", + "type": "number" + }, + "y": { + "description": "The device-independent pixel offset from the top of the window to the **center** of the icon.", + "type": "number" + } + }, + "required": [ + "x", + "y" + ], + "type": "object" + }, + "DmgOptions": { + "additionalProperties": false, + "properties": { + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "background": { + "description": "The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\nIf background is not specified, use `window.size`. Default locations expected background size to be 540x380.", + "type": [ + "null", + "string" + ] + }, + "backgroundColor": { + "description": "The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.", + "type": [ + "null", + "string" + ] + }, + "contents": { + "description": "The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.", + "items": { + "$ref": "#/definitions/DmgContent" + }, + "type": "array" + }, + "format": { + "default": "UDZO", + "description": "The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).", + "enum": [ + "UDBZ", + "UDCO", + "UDRO", + "UDRW", + "UDZO", + "ULFO" + ], + "type": "string" + }, + "icon": { + "description": "The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to the application icon (`build/icon.icns`).", + "type": [ + "null", + "string" + ] + }, + "iconSize": { + "default": 80, + "description": "The size of all the icons inside the DMG.", + "type": [ + "null", + "number" + ] + }, + "iconTextSize": { + "default": 12, + "description": "The size of all the icon texts inside the DMG.", + "type": [ + "null", + "number" + ] + }, + "internetEnabled": { + "default": false, + "description": "Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).", + "type": "boolean" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "sign": { + "default": false, + "description": "Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.", + "type": "boolean" + }, + "title": { + "default": "${productName} ${version}", + "description": "The title of the produced DMG, which will be shown when mounted (volume name).\n\nMacro `${productName}`, `${version}` and `${name}` are supported.", + "type": [ + "null", + "string" + ] + }, + "window": { + "$ref": "#/definitions/DmgWindow", + "description": "The DMG window position and size. With y co-ordinates running from bottom to top.\n\nThe Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\nIt is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen." + }, + "writeUpdateInfo": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + }, + "DmgWindow": { + "additionalProperties": false, + "properties": { + "height": { + "description": "The height. Defaults to background image height or 380.", + "type": "number" + }, + "width": { + "description": "The width. Defaults to background image width or 540.", + "type": "number" + }, + "x": { + "default": 400, + "description": "The X position relative to left of the screen.", + "type": "number" + }, + "y": { + "default": 100, + "description": "The Y position relative to bottom of the screen.", + "type": "number" + } + }, + "type": "object" + }, + "ElectronBrandingOptions": { + "additionalProperties": false, + "description": "Electron distributables branding options.", + "properties": { + "productName": { + "type": "string" + }, + "projectName": { + "type": "string" + } + }, + "type": "object" + }, + "ElectronDownloadOptions": { + "additionalProperties": false, + "properties": { + "arch": { + "type": "string" + }, + "cache": { + "description": "The [cache location](https://github.com/electron-userland/electron-download#cache-location).", + "type": [ + "null", + "string" + ] + }, + "customDir": { + "type": [ + "null", + "string" + ] + }, + "customFilename": { + "type": [ + "null", + "string" + ] + }, + "isVerifyChecksum": { + "type": "boolean" + }, + "mirror": { + "description": "The mirror.", + "type": [ + "null", + "string" + ] + }, + "platform": { + "enum": [ + "darwin", + "linux", + "mas", + "win32" + ], + "type": "string" + }, + "strictSSL": { + "type": "boolean" + }, + "version": { + "type": "string" + } + }, + "type": "object" + }, + "FileAssociation": { + "additionalProperties": false, + "description": "File associations.\n\nmacOS (corresponds to [CFBundleDocumentTypes](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685)), NSIS, and MSI only.\n\nOn Windows (NSIS) works only if [nsis.perMachine](https://electron.build/configuration/configuration#NsisOptions-perMachine) is set to `true`.", + "properties": { + "description": { + "description": "*windows-only.* The description.", + "type": [ + "null", + "string" + ] + }, + "ext": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], + "description": "The extension (minus the leading period). e.g. `png`." + }, + "icon": { + "description": "The path to icon (`.icns` for MacOS and `.ico` for Windows), relative to `build` (build resources directory). Defaults to `${firstExt}.icns`/`${firstExt}.ico` (if several extensions specified, first is used) or to application icon.\n\nNot supported on Linux, file issue if need (default icon will be `x-office-document`). Not supported on MSI.", + "type": [ + "null", + "string" + ] + }, + "isPackage": { + "description": "*macOS-only* Whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file. Corresponds to `LSTypeIsPackage`.", + "type": "boolean" + }, + "mimeType": { + "description": "*linux-only.* The mime-type.", + "type": [ + "null", + "string" + ] + }, + "name": { + "description": "The name. e.g. `PNG`. Defaults to `ext`.", + "type": [ + "null", + "string" + ] + }, + "rank": { + "default": "Default", + "description": "*macOS-only* The app’s rank with respect to the type. The value can be `Owner`, `Default`, `Alternate`, or `None`. Corresponds to `LSHandlerRank`.", + "type": "string" + }, + "role": { + "default": "Editor", + "description": "*macOS-only* The app’s role with respect to the type. The value can be `Editor`, `Viewer`, `Shell`, or `None`. Corresponds to `CFBundleTypeRole`.", + "type": "string" + } + }, + "required": [ + "ext" + ], + "type": "object" + }, + "FileSet": { + "additionalProperties": false, + "properties": { + "filter": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], + "description": "The [glob patterns](/file-patterns)." + }, + "from": { + "description": "The source path relative to the project directory.", + "type": "string" + }, + "to": { + "description": "The destination path relative to the app's content directory for `extraFiles` and the app's resource directory for `extraResources`.", + "type": "string" + } + }, + "type": "object" + }, + "FlatpakOptions": { + "additionalProperties": false, + "properties": { + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "base": { + "description": "Start with the files from the specified application. This can be used to create applications that extend another application.\nDefaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "baseVersion": { + "description": "Use this specific version of the application specified in base. Defaults to `20.08`.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "branch": { + "description": "The branch to use when exporting the application. Defaults to `master`.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "files": { + "description": "Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n\nSee [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).", + "items": { + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "type": "array" + }, + "finishArgs": { + "description": "An array of arguments passed to the flatpak build-finish command. Defaults to:\n```json\n[\n // Wayland/X11 Rendering\n \"--socket=wayland\",\n \"--socket=x11\",\n \"--share=ipc\",\n // Open GL\n \"--device=dri\",\n // Audio output\n \"--socket=pulseaudio\",\n // Read/write home directory access\n \"--filesystem=home\",\n // Allow communication with network\n \"--share=network\",\n // System notifications with libnotify\n \"--talk-name=org.freedesktop.Notifications\",\n]\n```\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "items": { + "type": "string" + }, + "type": "array" + }, + "license": { + "description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.", + "type": [ + "null", + "string" + ] + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "modules": { + "description": "An array of objects specifying the modules to be built in order.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "items": {}, + "type": "array" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "runtime": { + "description": "The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "runtimeVersion": { + "description": "The version of the runtime that the application uses. Defaults to `20.08`.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "sdk": { + "description": "The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n\nSee [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).", + "type": "string" + }, + "symlinks": { + "description": "Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n\nSee [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).", + "items": { + "items": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "type": "array" + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + }, + "useWaylandFlags": { + "description": "Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.", + "type": "boolean" + } + }, + "type": "object" + }, + "GenericServerOptions": { + "additionalProperties": false, + "description": "Generic (any HTTP(S) server) options.\nIn all publish options [File Macros](/file-patterns#file-macros) are supported.", + "properties": { + "channel": { + "default": "latest", + "description": "The channel.", + "type": [ + "null", + "string" + ] + }, + "provider": { + "description": "The provider. Must be `generic`.", + "enum": [ + "generic" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + }, + "url": { + "description": "The base url. e.g. `https://bucket_name.s3.amazonaws.com`.", + "type": "string" + }, + "useMultipleRangeRequest": { + "description": "Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.", + "type": "boolean" + } + }, + "required": [ + "provider", + "url" + ], + "type": "object" + }, + "GithubOptions": { + "additionalProperties": false, + "description": "[GitHub](https://help.github.com/articles/about-releases/) options.\n\nGitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.\nDefine `GH_TOKEN` environment variable.", + "properties": { + "channel": { + "default": "latest", + "description": "The channel.", + "type": [ + "null", + "string" + ] + }, + "host": { + "default": "github.com", + "description": "The host (including the port if need).", + "type": [ + "null", + "string" + ] + }, + "owner": { + "description": "The owner.", + "type": [ + "null", + "string" + ] + }, + "private": { + "description": "Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo).", + "type": [ + "null", + "boolean" + ] + }, + "protocol": { + "anyOf": [ + { + "enum": [ + "http", + "https" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "https", + "description": "The protocol. GitHub Publisher supports only `https`." + }, + "provider": { + "description": "The provider. Must be `github`.", + "enum": [ + "github" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "releaseType": { + "anyOf": [ + { + "enum": [ + "draft", + "prerelease", + "release" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "draft", + "description": "The type of release. By default `draft` release will be created.\n\nAlso you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRE_RELEASE`is set to `true` — `prerelease`." + }, + "repo": { + "description": "The repository name. [Detected automatically](#github-repository-and-bintray-package).", + "type": [ + "null", + "string" + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "token": { + "description": "The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).", + "type": [ + "null", + "string" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + }, + "vPrefixedTagName": { + "default": true, + "description": "Whether to use `v`-prefixed tag name.", + "type": "boolean" + } + }, + "required": [ + "provider" + ], + "type": "object" + }, + "KeygenOptions": { + "additionalProperties": false, + "description": "Keygen options.\nhttps://keygen.sh/\nDefine `KEYGEN_TOKEN` environment variable.", + "properties": { + "account": { + "description": "Keygen account's UUID", + "type": "string" + }, + "channel": { + "anyOf": [ + { + "enum": [ + "alpha", + "beta", + "dev", + "rc", + "stable" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "stable", + "description": "The channel." + }, + "platform": { + "description": "The target Platform. Is set programmatically explicitly during publishing.", + "type": [ + "null", + "string" + ] + }, + "product": { + "description": "Keygen product's UUID", + "type": "string" + }, + "provider": { + "description": "The provider. Must be `keygen`.", + "enum": [ + "keygen" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "account", + "product", + "provider" + ], + "type": "object" + }, + "LinuxConfiguration": { + "additionalProperties": false, + "properties": { + "appId": { + "default": "com.electron.${name}", + "description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.", + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).", + "type": [ + "null", + "string" + ] + }, + "asar": { + "anyOf": [ + { + "$ref": "#/definitions/AsarOptions" + }, + { + "type": [ + "null", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n\nNode modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work." + }, + "asarUnpack": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive." + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "maximum", + "normal", + "store" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "normal", + "description": "The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time." + }, + "cscKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscLink": { + "type": [ + "null", + "string" + ] + }, + "defaultArch": { + "type": "string" + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "detectUpdateChannel": { + "default": true, + "description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.", + "type": "boolean" + }, + "electronUpdaterCompatibility": { + "description": "The [electron-updater compatibility](/auto-update#compatibility) semver range.", + "type": [ + "null", + "string" + ] + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "executableName": { + "description": "The executable name. Defaults to `productName`.", + "type": [ + "null", + "string" + ] + }, + "extraFiles": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "extraResources": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "fileAssociations": { + "anyOf": [ + { + "$ref": "#/definitions/FileAssociation" + }, + { + "items": { + "$ref": "#/definitions/FileAssociation" + }, + "type": "array" + } + ], + "description": "The file associations." + }, + "files": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "forceCodeSigning": { + "description": "Whether to fail if app will be not code signed.", + "type": "boolean" + }, + "generateUpdatesFilesForAllChannels": { + "default": false, + "description": "Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).", + "type": "boolean" + }, + "icon": { + "description": "The path to icon set directory or one png file, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\nBy default will be generated automatically based on the macOS icns file.", + "type": "string" + }, + "maintainer": { + "description": "The maintainer. Defaults to [author](/configuration/configuration#Metadata-author).", + "type": [ + "null", + "string" + ] + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "packageCategory": { + "description": "backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place", + "type": [ + "null", + "string" + ] + }, + "protocols": { + "anyOf": [ + { + "$ref": "#/definitions/Protocol" + }, + { + "items": { + "$ref": "#/definitions/Protocol" + }, + "type": "array" + } + ], + "description": "The URL protocol schemes." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "releaseInfo": { + "$ref": "#/definitions/ReleaseInfo", + "description": "The release info. Intended for command line usage:\n\n```\n-c.releaseInfo.releaseNotes=\"new features\"\n```" + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + }, + "target": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "default": "AppImage", + "description": "Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n\nelectron-builder [docker image](/multi-platform-build#docker) can be used to build Linux targets on any platform.\n\nPlease [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz." + }, + "vendor": { + "description": "The vendor. Defaults to [author](/configuration/configuration#Metadata-author).", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "LinuxTargetSpecificOptions": { + "additionalProperties": false, + "properties": { + "afterInstall": { + "type": [ + "null", + "string" + ] + }, + "afterRemove": { + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "bzip2", + "gz", + "lzo", + "xz" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "xz", + "description": "The compression type." + }, + "depends": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Package dependencies." + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "fpm": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "*Advanced only* The [fpm](https://github.com/jordansissel/fpm/wiki#usage) options.\n\nExample: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`" + }, + "icon": { + "type": "string" + }, + "maintainer": { + "type": [ + "null", + "string" + ] + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "packageCategory": { + "description": "The package category.", + "type": [ + "null", + "string" + ] + }, + "packageName": { + "description": "The name of the package.", + "type": [ + "null", + "string" + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + }, + "vendor": { + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "MacConfiguration": { + "additionalProperties": false, + "properties": { + "appId": { + "default": "com.electron.${name}", + "description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.", + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).", + "type": [ + "null", + "string" + ] + }, + "asar": { + "anyOf": [ + { + "$ref": "#/definitions/AsarOptions" + }, + { + "type": [ + "null", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n\nNode modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work." + }, + "asarUnpack": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive." + }, + "binaries": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Paths of any extra binaries that need to be signed." + }, + "bundleShortVersion": { + "description": "The `CFBundleShortVersionString`. Do not use it unless you need to.", + "type": [ + "null", + "string" + ] + }, + "bundleVersion": { + "description": "The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).", + "type": [ + "null", + "string" + ] + }, + "category": { + "description": "The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n\nFor example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n\nValid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "maximum", + "normal", + "store" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "normal", + "description": "The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time." + }, + "cscInstallerKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscInstallerLink": { + "type": [ + "null", + "string" + ] + }, + "cscKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscLink": { + "type": [ + "null", + "string" + ] + }, + "darkModeSupport": { + "default": false, + "description": "Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.", + "type": "boolean" + }, + "defaultArch": { + "type": "string" + }, + "detectUpdateChannel": { + "default": true, + "description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.", + "type": "boolean" + }, + "electronLanguages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], + "description": "The electron locales. By default Electron locales used as is." + }, + "electronUpdaterCompatibility": { + "description": "The [electron-updater compatibility](/auto-update#compatibility) semver range.", + "type": [ + "null", + "string" + ] + }, + "entitlements": { + "description": "The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set).\nMAS entitlements is specified in the [mas](/configuration/mas).\nSee [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\nBe aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\nSee [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.", + "type": [ + "null", + "string" + ] + }, + "entitlementsInherit": { + "description": "The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set).\nSee [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n\nThis option only applies when signing with `entitlements` provided.", + "type": [ + "null", + "string" + ] + }, + "entitlementsLoginHelper": { + "description": "Path to login helper entitlement file.\nWhen using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.\nDefaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.", + "type": [ + "null", + "string" + ] + }, + "executableName": { + "description": "The executable name. Defaults to `productName`.", + "type": [ + "null", + "string" + ] + }, + "extendInfo": { + "description": "The extra entries for `Info.plist`." + }, + "extraDistFiles": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Extra files to put in archive. Not applicable for `tar.*`." + }, + "extraFiles": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "extraResources": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "fileAssociations": { + "anyOf": [ + { + "$ref": "#/definitions/FileAssociation" + }, + { + "items": { + "$ref": "#/definitions/FileAssociation" + }, + "type": "array" + } + ], + "description": "The file associations." + }, + "files": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "forceCodeSigning": { + "description": "Whether to fail if app will be not code signed.", + "type": "boolean" + }, + "gatekeeperAssess": { + "default": false, + "description": "Whether to let electron-osx-sign validate the signing or not.", + "type": "boolean" + }, + "generateUpdatesFilesForAllChannels": { + "default": false, + "description": "Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).", + "type": "boolean" + }, + "hardenedRuntime": { + "default": true, + "description": "Whether your app has to be signed with hardened runtime.", + "type": "boolean" + }, + "helperBundleId": { + "default": "${appBundleIdentifier}.helper", + "description": "The bundle identifier to use in the application helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperEHBundleId": { + "default": "${appBundleIdentifier}.helper.EH", + "description": "The bundle identifier to use in the EH helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperGPUBundleId": { + "default": "${appBundleIdentifier}.helper.GPU", + "description": "The bundle identifier to use in the GPU helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperNPBundleId": { + "default": "${appBundleIdentifier}.helper.NP", + "description": "The bundle identifier to use in the NP helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperPluginBundleId": { + "default": "${appBundleIdentifier}.helper.Plugin", + "description": "The bundle identifier to use in the Plugin helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperRendererBundleId": { + "default": "${appBundleIdentifier}.helper.Renderer", + "description": "The bundle identifier to use in the Renderer helper's plist.", + "type": [ + "null", + "string" + ] + }, + "icon": { + "default": "build/icon.icns", + "description": "The path to application icon.", + "type": [ + "null", + "string" + ] + }, + "identity": { + "description": "The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.\nMAS installer identity is specified in the [mas](/configuration/mas).", + "type": [ + "null", + "string" + ] + }, + "mergeASARs": { + "default": true, + "description": "Whether to merge ASAR files for different architectures or not.\n\nThis option has no effect unless building for \"universal\" arch.", + "type": "boolean" + }, + "minimumSystemVersion": { + "description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.", + "type": [ + "null", + "string" + ] + }, + "protocols": { + "anyOf": [ + { + "$ref": "#/definitions/Protocol" + }, + { + "items": { + "$ref": "#/definitions/Protocol" + }, + "type": "array" + } + ], + "description": "The URL protocol schemes." + }, + "provisioningProfile": { + "description": "The path to the provisioning profile to use when signing, absolute or relative to the app root.", + "type": [ + "null", + "string" + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "releaseInfo": { + "$ref": "#/definitions/ReleaseInfo", + "description": "The release info. Intended for command line usage:\n\n```\n-c.releaseInfo.releaseNotes=\"new features\"\n```" + }, + "requirements": { + "description": "Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.", + "type": [ + "null", + "string" + ] + }, + "signIgnore": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Regex or an array of regex's that signal skipping signing a file." + }, + "singleArchFiles": { + "description": "Minimatch pattern of paths that are allowed to be present in one of the\nASAR files, but not in the other.\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.", + "type": "string" + }, + "strictVerify": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "string", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to let electron-osx-sign verify the contents or not." + }, + "target": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "enum": [ + "7z", + "default", + "dir", + "dmg", + "mas", + "mas-dev", + "pkg", + "tar.bz2", + "tar.gz", + "tar.lz", + "tar.xz", + "zip" + ], + "type": "string" + } + ] + }, + "type": "array" + }, + { + "enum": [ + "7z", + "default", + "dir", + "dmg", + "mas", + "mas-dev", + "pkg", + "tar.bz2", + "tar.gz", + "tar.lz", + "tar.xz", + "zip" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac)." + }, + "timestamp": { + "description": "Specify the URL of the timestamp authority server", + "type": [ + "null", + "string" + ] + }, + "type": { + "anyOf": [ + { + "enum": [ + "development", + "distribution" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "distribution", + "description": "Whether to sign app for development or for distribution." + }, + "x64ArchFiles": { + "description": "Minimatch pattern of paths that are allowed to be x64 binaries in both\nASAR files\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.", + "type": "string" + } + }, + "type": "object" + }, + "MasConfiguration": { + "additionalProperties": false, + "properties": { + "appId": { + "default": "com.electron.${name}", + "description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.", + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).", + "type": [ + "null", + "string" + ] + }, + "asar": { + "anyOf": [ + { + "$ref": "#/definitions/AsarOptions" + }, + { + "type": [ + "null", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n\nNode modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work." + }, + "asarUnpack": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive." + }, + "binaries": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Paths of any extra binaries that need to be signed." + }, + "bundleShortVersion": { + "description": "The `CFBundleShortVersionString`. Do not use it unless you need to.", + "type": [ + "null", + "string" + ] + }, + "bundleVersion": { + "description": "The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).", + "type": [ + "null", + "string" + ] + }, + "category": { + "description": "The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n\nFor example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n\nValid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "maximum", + "normal", + "store" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "normal", + "description": "The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time." + }, + "cscInstallerKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscInstallerLink": { + "type": [ + "null", + "string" + ] + }, + "cscKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscLink": { + "type": [ + "null", + "string" + ] + }, + "darkModeSupport": { + "default": false, + "description": "Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.", + "type": "boolean" + }, + "defaultArch": { + "type": "string" + }, + "detectUpdateChannel": { + "default": true, + "description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.", + "type": "boolean" + }, + "electronLanguages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], + "description": "The electron locales. By default Electron locales used as is." + }, + "electronUpdaterCompatibility": { + "description": "The [electron-updater compatibility](/auto-update#compatibility) semver range.", + "type": [ + "null", + "string" + ] + }, + "entitlements": { + "description": "The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set).\nSee [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\nBe aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\nSee [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.", + "type": [ + "null", + "string" + ] + }, + "entitlementsInherit": { + "description": "The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set).\nSee [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.", + "type": [ + "null", + "string" + ] + }, + "entitlementsLoginHelper": { + "description": "Path to login helper entitlement file.\nWhen using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.\nDefaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.", + "type": [ + "null", + "string" + ] + }, + "executableName": { + "description": "The executable name. Defaults to `productName`.", + "type": [ + "null", + "string" + ] + }, + "extendInfo": { + "description": "The extra entries for `Info.plist`." + }, + "extraDistFiles": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Extra files to put in archive. Not applicable for `tar.*`." + }, + "extraFiles": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "extraResources": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "fileAssociations": { + "anyOf": [ + { + "$ref": "#/definitions/FileAssociation" + }, + { + "items": { + "$ref": "#/definitions/FileAssociation" + }, + "type": "array" + } + ], + "description": "The file associations." + }, + "files": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "forceCodeSigning": { + "description": "Whether to fail if app will be not code signed.", + "type": "boolean" + }, + "gatekeeperAssess": { + "default": false, + "description": "Whether to let electron-osx-sign validate the signing or not.", + "type": "boolean" + }, + "generateUpdatesFilesForAllChannels": { + "default": false, + "description": "Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).", + "type": "boolean" + }, + "hardenedRuntime": { + "default": true, + "description": "Whether your app has to be signed with hardened runtime.", + "type": "boolean" + }, + "helperBundleId": { + "default": "${appBundleIdentifier}.helper", + "description": "The bundle identifier to use in the application helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperEHBundleId": { + "default": "${appBundleIdentifier}.helper.EH", + "description": "The bundle identifier to use in the EH helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperGPUBundleId": { + "default": "${appBundleIdentifier}.helper.GPU", + "description": "The bundle identifier to use in the GPU helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperNPBundleId": { + "default": "${appBundleIdentifier}.helper.NP", + "description": "The bundle identifier to use in the NP helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperPluginBundleId": { + "default": "${appBundleIdentifier}.helper.Plugin", + "description": "The bundle identifier to use in the Plugin helper's plist.", + "type": [ + "null", + "string" + ] + }, + "helperRendererBundleId": { + "default": "${appBundleIdentifier}.helper.Renderer", + "description": "The bundle identifier to use in the Renderer helper's plist.", + "type": [ + "null", + "string" + ] + }, + "icon": { + "default": "build/icon.icns", + "description": "The path to application icon.", + "type": [ + "null", + "string" + ] + }, + "identity": { + "description": "The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.\nMAS installer identity is specified in the [mas](/configuration/mas).", + "type": [ + "null", + "string" + ] + }, + "mergeASARs": { + "default": true, + "description": "Whether to merge ASAR files for different architectures or not.\n\nThis option has no effect unless building for \"universal\" arch.", + "type": "boolean" + }, + "minimumSystemVersion": { + "description": "The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.", + "type": [ + "null", + "string" + ] + }, + "protocols": { + "anyOf": [ + { + "$ref": "#/definitions/Protocol" + }, + { + "items": { + "$ref": "#/definitions/Protocol" + }, + "type": "array" + } + ], + "description": "The URL protocol schemes." + }, + "provisioningProfile": { + "description": "The path to the provisioning profile to use when signing, absolute or relative to the app root.", + "type": [ + "null", + "string" + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "releaseInfo": { + "$ref": "#/definitions/ReleaseInfo", + "description": "The release info. Intended for command line usage:\n\n```\n-c.releaseInfo.releaseNotes=\"new features\"\n```" + }, + "requirements": { + "description": "Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.", + "type": [ + "null", + "string" + ] + }, + "signIgnore": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Regex or an array of regex's that signal skipping signing a file." + }, + "singleArchFiles": { + "description": "Minimatch pattern of paths that are allowed to be present in one of the\nASAR files, but not in the other.\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.", + "type": "string" + }, + "strictVerify": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "string", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to let electron-osx-sign verify the contents or not." + }, + "target": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "enum": [ + "7z", + "default", + "dir", + "dmg", + "mas", + "mas-dev", + "pkg", + "tar.bz2", + "tar.gz", + "tar.lz", + "tar.xz", + "zip" + ], + "type": "string" + } + ] + }, + "type": "array" + }, + { + "enum": [ + "7z", + "default", + "dir", + "dmg", + "mas", + "mas-dev", + "pkg", + "tar.bz2", + "tar.gz", + "tar.lz", + "tar.xz", + "zip" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (dmg and zip for Squirrel.Mac)." + }, + "timestamp": { + "description": "Specify the URL of the timestamp authority server", + "type": [ + "null", + "string" + ] + }, + "type": { + "anyOf": [ + { + "enum": [ + "development", + "distribution" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "distribution", + "description": "Whether to sign app for development or for distribution." + }, + "x64ArchFiles": { + "description": "Minimatch pattern of paths that are allowed to be x64 binaries in both\nASAR files\n\nThis option has no effect unless building for \"universal\" arch and applies\nonly if `mergeASARs` is `true`.", + "type": "string" + } + }, + "type": "object" + }, + "MetadataDirectories": { + "additionalProperties": false, + "properties": { + "app": { + "description": "The application directory (containing the application package.json), defaults to `app`, `www` or working directory.", + "type": [ + "null", + "string" + ] + }, + "buildResources": { + "default": "build", + "description": "The path to build resources.\n\nPlease note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`", + "type": [ + "null", + "string" + ] + }, + "output": { + "default": "dist", + "description": "The output directory. [File macros](/file-patterns#file-macros) are supported.", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "MsiOptions": { + "additionalProperties": false, + "properties": { + "additionalWixArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Any additional arguments to be passed to the WiX installer compiler, such as `[\"-ext\", \"WixUtilExtension\"]`" + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "createDesktopShortcut": { + "default": true, + "description": "Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).", + "enum": [ + "always", + false, + true + ] + }, + "createStartMenuShortcut": { + "default": true, + "description": "Whether to create start menu shortcut.", + "type": "boolean" + }, + "menuCategory": { + "default": false, + "description": "Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.", + "type": [ + "string", + "boolean" + ] + }, + "oneClick": { + "default": true, + "description": "One-click installation.", + "type": "boolean" + }, + "perMachine": { + "default": false, + "description": "Whether to install per all users (per-machine).", + "type": "boolean" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "runAfterFinish": { + "default": true, + "description": "Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.", + "type": "boolean" + }, + "shortcutName": { + "description": "The name that will be used for all shortcuts. Defaults to the application name.", + "type": [ + "null", + "string" + ] + }, + "upgradeCode": { + "description": "The [upgrade code](https://msdn.microsoft.com/en-us/library/windows/desktop/aa372375(v=vs.85).aspx). Optional, by default generated using app id.", + "type": [ + "null", + "string" + ] + }, + "warningsAsErrors": { + "default": true, + "description": "If `warningsAsErrors` is `true` (default): treat warnings as errors. If `warningsAsErrors` is `false`: allow warnings.", + "type": "boolean" + } + }, + "type": "object" + }, + "NsisOptions": { + "additionalProperties": false, + "properties": { + "allowElevation": { + "default": true, + "description": "*assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.", + "type": "boolean" + }, + "allowToChangeInstallationDirectory": { + "default": false, + "description": "*assisted installer only.* Whether to allow user to change installation directory.", + "type": "boolean" + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.", + "type": [ + "null", + "string" + ] + }, + "createDesktopShortcut": { + "default": true, + "description": "Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).", + "enum": [ + "always", + false, + true + ] + }, + "createStartMenuShortcut": { + "default": true, + "description": "Whether to create start menu shortcut.", + "type": "boolean" + }, + "customNsisBinary": { + "anyOf": [ + { + "$ref": "#/definitions/CustomNsisBinary" + }, + { + "type": "null" + } + ], + "description": "Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)" + }, + "deleteAppDataOnUninstall": { + "default": false, + "description": "*one-click installer only.* Whether to delete app data on uninstall.", + "type": "boolean" + }, + "differentialPackage": { + "type": "boolean" + }, + "displayLanguageSelector": { + "default": false, + "description": "Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).", + "type": "boolean" + }, + "guid": { + "description": "See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).", + "type": [ + "null", + "string" + ] + }, + "include": { + "description": "The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).", + "type": [ + "null", + "string" + ] + }, + "installerHeader": { + "default": "build/installerHeader.bmp", + "description": "*assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.", + "type": [ + "null", + "string" + ] + }, + "installerHeaderIcon": { + "description": "*one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerHeaderIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "installerIcon": { + "description": "The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "installerLanguages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what." + }, + "installerSidebar": { + "description": "*assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.", + "type": [ + "null", + "string" + ] + }, + "language": { + "description": "[LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).", + "type": [ + "null", + "string" + ] + }, + "license": { + "description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n\nMultiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\nIf OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n\nAppropriate license file will be selected by user OS language.", + "type": [ + "null", + "string" + ] + }, + "menuCategory": { + "default": false, + "description": "Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.", + "type": [ + "string", + "boolean" + ] + }, + "multiLanguageInstaller": { + "description": "Whether to create multi-language installer. Defaults to `unicode` option value.", + "type": "boolean" + }, + "oneClick": { + "default": true, + "description": "Whether to create one-click installer or assisted.", + "type": "boolean" + }, + "packElevateHelper": { + "default": true, + "description": "Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.", + "type": "boolean" + }, + "perMachine": { + "default": false, + "description": "Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n\nIf `oneClick` is `true` (default): Whether to install per all users (per-machine).\n\nIf `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n\nIf `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.", + "type": "boolean" + }, + "preCompressedFileExtensions": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "default": [ + ".avi", + ".mov", + ".m4v", + ".mp4", + ".m4p", + ".qt", + ".mkv", + ".webm", + ".vmdk" + ], + "description": "The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "removeDefaultUninstallWelcomePage": { + "default": false, + "description": "*assisted installer only.* remove the default uninstall welcome page.", + "type": "boolean" + }, + "runAfterFinish": { + "default": true, + "description": "Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.", + "type": "boolean" + }, + "script": { + "description": "The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).", + "type": [ + "null", + "string" + ] + }, + "shortcutName": { + "description": "The name that will be used for all shortcuts. Defaults to the application name.", + "type": [ + "null", + "string" + ] + }, + "unicode": { + "default": true, + "description": "Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).", + "type": "boolean" + }, + "uninstallDisplayName": { + "default": "${productName} ${version}", + "description": "The uninstaller display name in the control panel.", + "type": "string" + }, + "uninstallerIcon": { + "description": "The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/uninstallerIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "uninstallerSidebar": { + "description": "*assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`", + "type": [ + "null", + "string" + ] + }, + "useZip": { + "default": false, + "type": "boolean" + }, + "warningsAsErrors": { + "default": true, + "description": "If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.", + "type": "boolean" + } + }, + "type": "object" + }, + "NsisWebOptions": { + "additionalProperties": false, + "description": "Web Installer options.", + "properties": { + "allowElevation": { + "default": true, + "description": "*assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.", + "type": "boolean" + }, + "allowToChangeInstallationDirectory": { + "default": false, + "description": "*assisted installer only.* Whether to allow user to change installation directory.", + "type": "boolean" + }, + "appPackageUrl": { + "description": "The application package download URL. Optional — by default computed using publish configuration.\n\nURL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\nPlease note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n\nCustom `X-Arch` http header is set to `32` or `64`.", + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.", + "type": [ + "null", + "string" + ] + }, + "createDesktopShortcut": { + "default": true, + "description": "Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).", + "enum": [ + "always", + false, + true + ] + }, + "createStartMenuShortcut": { + "default": true, + "description": "Whether to create start menu shortcut.", + "type": "boolean" + }, + "customNsisBinary": { + "anyOf": [ + { + "$ref": "#/definitions/CustomNsisBinary" + }, + { + "type": "null" + } + ], + "description": "Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)" + }, + "deleteAppDataOnUninstall": { + "default": false, + "description": "*one-click installer only.* Whether to delete app data on uninstall.", + "type": "boolean" + }, + "differentialPackage": { + "type": "boolean" + }, + "displayLanguageSelector": { + "default": false, + "description": "Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).", + "type": "boolean" + }, + "guid": { + "description": "See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).", + "type": [ + "null", + "string" + ] + }, + "include": { + "description": "The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).", + "type": [ + "null", + "string" + ] + }, + "installerHeader": { + "default": "build/installerHeader.bmp", + "description": "*assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.", + "type": [ + "null", + "string" + ] + }, + "installerHeaderIcon": { + "description": "*one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerHeaderIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "installerIcon": { + "description": "The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "installerLanguages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what." + }, + "installerSidebar": { + "description": "*assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.", + "type": [ + "null", + "string" + ] + }, + "language": { + "description": "[LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).", + "type": [ + "null", + "string" + ] + }, + "license": { + "description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n\nMultiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\nIf OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n\nAppropriate license file will be selected by user OS language.", + "type": [ + "null", + "string" + ] + }, + "menuCategory": { + "default": false, + "description": "Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.", + "type": [ + "string", + "boolean" + ] + }, + "multiLanguageInstaller": { + "description": "Whether to create multi-language installer. Defaults to `unicode` option value.", + "type": "boolean" + }, + "oneClick": { + "default": true, + "description": "Whether to create one-click installer or assisted.", + "type": "boolean" + }, + "packElevateHelper": { + "default": true, + "description": "Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.", + "type": "boolean" + }, + "perMachine": { + "default": false, + "description": "Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n\nIf `oneClick` is `true` (default): Whether to install per all users (per-machine).\n\nIf `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n\nIf `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.", + "type": "boolean" + }, + "preCompressedFileExtensions": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "default": [ + ".avi", + ".mov", + ".m4v", + ".mp4", + ".m4p", + ".qt", + ".mkv", + ".webm", + ".vmdk" + ], + "description": "The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "removeDefaultUninstallWelcomePage": { + "default": false, + "description": "*assisted installer only.* remove the default uninstall welcome page.", + "type": "boolean" + }, + "runAfterFinish": { + "default": true, + "description": "Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.", + "type": "boolean" + }, + "script": { + "description": "The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).", + "type": [ + "null", + "string" + ] + }, + "shortcutName": { + "description": "The name that will be used for all shortcuts. Defaults to the application name.", + "type": [ + "null", + "string" + ] + }, + "unicode": { + "default": true, + "description": "Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).", + "type": "boolean" + }, + "uninstallDisplayName": { + "default": "${productName} ${version}", + "description": "The uninstaller display name in the control panel.", + "type": "string" + }, + "uninstallerIcon": { + "description": "The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `build/uninstallerIcon.ico` or application icon.", + "type": [ + "null", + "string" + ] + }, + "uninstallerSidebar": { + "description": "*assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.\nDefaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`", + "type": [ + "null", + "string" + ] + }, + "useZip": { + "default": false, + "type": "boolean" + }, + "warningsAsErrors": { + "default": true, + "description": "If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.", + "type": "boolean" + } + }, + "type": "object" + }, + "OutgoingHttpHeaders": { + "additionalProperties": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "type": "object" + }, + "PkgBackgroundOptions": { + "additionalProperties": false, + "description": "Options for the background image in a PKG installer", + "properties": { + "alignment": { + "anyOf": [ + { + "enum": [ + "bottom", + "bottomleft", + "bottomright", + "center", + "left", + "right", + "top", + "topleft", + "topright" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "center", + "description": "Alignment of the background image.\nOptions are: center, left, right, top, bottom, topleft, topright, bottomleft, bottomright" + }, + "file": { + "description": "Path to the image to use as an installer background.", + "type": "string" + }, + "scaling": { + "anyOf": [ + { + "enum": [ + "none", + "proportional", + "tofit" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "tofit", + "description": "Scaling of the background image.\nOptions are: tofit, none, proportional" + } + }, + "type": "object" + }, + "PkgOptions": { + "additionalProperties": false, + "description": "macOS product archive options.", + "properties": { + "allowAnywhere": { + "default": true, + "description": "Whether can be installed at the root of any volume, including non-system volumes. Otherwise, it cannot be installed at the root of a volume.\n\nCorresponds to [enable_anywhere](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).", + "type": [ + "null", + "boolean" + ] + }, + "allowCurrentUserHome": { + "default": true, + "description": "Whether can be installed into the current user’s home directory.\nA home directory installation is done as the current user (not as root), and it cannot write outside of the home directory.\nIf the product cannot be installed in the user’s home directory and be not completely functional from user’s home directory.\n\nCorresponds to [enable_currentUserHome](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).", + "type": [ + "null", + "boolean" + ] + }, + "allowRootDirectory": { + "default": true, + "description": "Whether can be installed into the root directory. Should usually be `true` unless the product can be installed only to the user’s home directory.\n\nCorresponds to [enable_localSystem](https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW70).", + "type": [ + "null", + "boolean" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "background": { + "anyOf": [ + { + "$ref": "#/definitions/PkgBackgroundOptions" + }, + { + "type": "null" + } + ], + "description": "Options for the background image for the installer." + }, + "conclusion": { + "description": "The path to the conclusion file. This may be used to customize the text on the final \"Summary\" page of the installer.", + "type": [ + "null", + "string" + ] + }, + "hasStrictIdentifier": { + "default": true, + "description": "Require identical bundle identifiers at install path?", + "type": [ + "null", + "boolean" + ] + }, + "identity": { + "description": "The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](/code-signing) instead of specifying this option.", + "type": [ + "null", + "string" + ] + }, + "installLocation": { + "default": "/Applications", + "description": "The install location. [Do not use it](https://stackoverflow.com/questions/12863944/how-do-you-specify-a-default-install-location-to-home-with-pkgbuild) to create per-user package.\nMostly never you will need to change this option. `/Applications` would install it as expected into `/Applications` if the local system domain is chosen, or into `$HOME/Applications` if the home installation is chosen.", + "type": [ + "null", + "string" + ] + }, + "isRelocatable": { + "default": true, + "description": "Install bundle over previous version if moved by user?", + "type": [ + "null", + "boolean" + ] + }, + "isVersionChecked": { + "default": true, + "description": "Don't install bundle if newer version on disk?", + "type": [ + "null", + "boolean" + ] + }, + "license": { + "description": "The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).", + "type": [ + "null", + "string" + ] + }, + "mustClose": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Identifies applications that must be closed before the package is installed.\n\nCorresponds to [must-close](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW77)." + }, + "overwriteAction": { + "anyOf": [ + { + "enum": [ + "update", + "upgrade" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "upgrade", + "description": "Specifies how an existing version of the bundle on disk should be handled when the version in\nthe package is installed.\n\nIf you specify upgrade, the bundle in the package atomi-cally replaces any version on disk;\nthis has the effect of deleting old paths that no longer exist in the new version of\nthe bundle.\n\nIf you specify update, the bundle in the package overwrites the version on disk, and any files\nnot contained in the package will be left intact; this is appropriate when you are delivering\nan update-only package.\n\nAnother effect of update is that the package bundle will not be installed at all if there is\nnot already a version on disk; this allows a package to deliver an update for an app that\nthe user might have deleted." + }, + "productbuild": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "should be not documented, only to experiment" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "scripts": { + "default": "build/pkg-scripts", + "description": "The scripts directory, relative to `build` (build resources directory).\nThe scripts can be in any language so long as the files are marked executable and have the appropriate shebang indicating the path to the interpreter.\nScripts are required to be executable (`chmod +x file`).", + "type": [ + "null", + "string" + ] + }, + "welcome": { + "description": "The path to the welcome file. This may be used to customize the text on the Introduction page of the installer.", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "PlugDescriptor": { + "additionalProperties": { + "anyOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ] + }, + "type": "object" + }, + "PortableOptions": { + "additionalProperties": false, + "description": "Portable options.", + "properties": { + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "customNsisBinary": { + "anyOf": [ + { + "$ref": "#/definitions/CustomNsisBinary" + }, + { + "type": "null" + } + ], + "description": "Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)" + }, + "guid": { + "description": "See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).", + "type": [ + "null", + "string" + ] + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "requestExecutionLevel": { + "default": "user", + "description": "The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.", + "enum": [ + "admin", + "highest", + "user" + ], + "type": "string" + }, + "splashImage": { + "description": "The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.", + "type": [ + "null", + "string" + ] + }, + "unicode": { + "default": true, + "description": "Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).", + "type": "boolean" + }, + "unpackDirName": { + "description": "The unpack directory for the portable app resources.\n\nIf set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\nIf set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n\nDefaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).", + "type": [ + "string", + "boolean" + ] + }, + "useZip": { + "default": false, + "type": "boolean" + }, + "warningsAsErrors": { + "default": true, + "description": "If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.", + "type": "boolean" + } + }, + "type": "object" + }, + "Protocol": { + "additionalProperties": false, + "description": "URL Protocol Schemes. Protocols to associate the app with. macOS only.\n\nPlease note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).", + "properties": { + "name": { + "description": "The name. e.g. `IRC server URL`.", + "type": "string" + }, + "role": { + "default": "Editor", + "description": "*macOS-only* The app’s role with respect to the type.", + "enum": [ + "Editor", + "None", + "Shell", + "Viewer" + ], + "type": "string" + }, + "schemes": { + "description": "The schemes. e.g. `[\"irc\", \"ircs\"]`.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "name", + "schemes" + ], + "type": "object" + }, + "ReleaseInfo": { + "additionalProperties": false, + "properties": { + "releaseDate": { + "description": "The release date.", + "type": "string" + }, + "releaseName": { + "description": "The release name.", + "type": [ + "null", + "string" + ] + }, + "releaseNotes": { + "description": "The release notes.", + "type": [ + "null", + "string" + ] + }, + "releaseNotesFile": { + "description": "The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](#MetadataDirectories-buildResources).", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" + }, + "S3Options": { + "additionalProperties": false, + "description": "[Amazon S3](https://aws.amazon.com/s3/) options.\nAWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).\nDefine `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).\nOr in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).\n\nExample configuration:\n\n```json\n{\n\"build\":\n \"publish\": {\n \"provider\": \"s3\",\n \"bucket\": \"bucket-name\"\n }\n}\n}\n```", + "properties": { + "acl": { + "anyOf": [ + { + "enum": [ + "private", + "public-read" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "public-read", + "description": "The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n\nPlease see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128)." + }, + "bucket": { + "description": "The bucket name.", + "type": "string" + }, + "channel": { + "default": "latest", + "description": "The update channel.", + "type": [ + "null", + "string" + ] + }, + "encryption": { + "anyOf": [ + { + "enum": [ + "AES256", + "aws:kms" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Server-side encryption algorithm to use for the object." + }, + "endpoint": { + "description": "The endpoint URI to send requests to. The default endpoint is built from the configured region.\nThe endpoint should be a string like `https://{service}.{region}.amazonaws.com`.", + "type": [ + "null", + "string" + ] + }, + "path": { + "default": "/", + "description": "The directory path.", + "type": [ + "null", + "string" + ] + }, + "provider": { + "description": "The provider. Must be `s3`.", + "enum": [ + "s3" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "region": { + "description": "The region. Is determined and set automatically when publishing.", + "type": [ + "null", + "string" + ] + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "storageClass": { + "anyOf": [ + { + "enum": [ + "REDUCED_REDUNDANCY", + "STANDARD", + "STANDARD_IA" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "STANDARD", + "description": "The type of storage to use for the object." + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "bucket", + "provider" + ], + "type": "object" + }, + "SlotDescriptor": { + "additionalProperties": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": "null" + } + ] + }, + "type": "object" + }, + "SnapOptions": { + "additionalProperties": false, + "properties": { + "after": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.\nDefaults to `[\"desktop-gtk2\"\"]`.\n\nIf list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom parts `foo` in addition to defaults." + }, + "allowNativeWayland": { + "description": "Allow running the program with native wayland support with --ozone-platform=wayland.\nDisabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007", + "type": [ + "null", + "boolean" + ] + }, + "appPartStage": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.\n\nThe defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29)." + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "assumes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The list of features that must be supported by the core in order for this snap to install." + }, + "autoStart": { + "default": false, + "description": "Whether or not the snap should automatically start on login.", + "type": "boolean" + }, + "buildPackages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The list of debian packages needs to be installed for building this snap." + }, + "category": { + "description": "The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "lzo", + "xz" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Sets the compression type for the snap. Can be xz, lzo, or null." + }, + "confinement": { + "anyOf": [ + { + "enum": [ + "classic", + "devmode", + "strict" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "strict", + "description": "The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap." + }, + "description": { + "description": "As [description](/configuration/configuration#Metadata-description) from application package.json, but allows you to specify different for Linux.", + "type": [ + "null", + "string" + ] + }, + "desktop": { + "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)." + }, + "environment": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "description": "The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default." + }, + "executableArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The executable parameters. Pass to executableName" + }, + "grade": { + "anyOf": [ + { + "enum": [ + "devel", + "stable" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "stable", + "description": "The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels)." + }, + "hooks": { + "default": "build/snap-hooks", + "description": "The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).", + "type": [ + "null", + "string" + ] + }, + "layout": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": "null" + } + ], + "description": "Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more." + }, + "mimeTypes": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing." + }, + "plugs": { + "anyOf": [ + { + "$ref": "#/definitions/PlugDescriptor" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/PlugDescriptor" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The list of [plugs](https://snapcraft.io/docs/reference/interfaces).\nDefaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n\nIf list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom plug `foo` in addition to defaults.\n\nAdditional attributes can be specified using object instead of just name of plug:\n```\n[\n {\n \"browser-sandbox\": {\n \"interface\": \"browser-support\",\n \"allow-sandbox\": true\n },\n },\n \"another-simple-plug-name\"\n]\n```" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "slots": { + "anyOf": [ + { + "$ref": "#/definitions/PlugDescriptor" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/SlotDescriptor" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The list of [slots](https://snapcraft.io/docs/reference/interfaces).\n\nAdditional attributes can be specified using object instead of just name of slot:\n```\n[\n {\n \"mpris\": {\n \"name\": \"chromium\"\n },\n }\n]\n\nIn case you want your application to be a compliant MPris player, you will need to definie\nThe mpris slot with \"chromium\" name.\nThis electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),\nand we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement." + }, + "stagePackages": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.\nDefaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n\nIf list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom package `foo` in addition to defaults." + }, + "summary": { + "description": "The 78 character long summary. Defaults to [productName](/configuration/configuration#Configuration-productName).", + "type": [ + "null", + "string" + ] + }, + "synopsis": { + "description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).", + "type": [ + "null", + "string" + ] + }, + "title": { + "description": "An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).", + "type": [ + "null", + "string" + ] + }, + "useTemplateApp": { + "description": "Whether to use template snap. Defaults to `true` if `stagePackages` not specified.", + "type": "boolean" + } + }, + "type": "object" + }, + "SnapStoreOptions": { + "additionalProperties": false, + "description": "[Snap Store](https://snapcraft.io/) options.", + "properties": { + "channels": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "default": [ + "edge" + ], + "description": "The list of channels the snap would be released." + }, + "provider": { + "description": "The provider. Must be `snapStore`.", + "enum": [ + "snapStore" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "repo": { + "description": "snapcraft repo name", + "type": "string" + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "provider" + ], + "type": "object" + }, + "SpacesOptions": { + "additionalProperties": false, + "description": "[DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.\nAccess key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.", + "properties": { + "acl": { + "anyOf": [ + { + "enum": [ + "private", + "public-read" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "public-read", + "description": "The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822)." + }, + "channel": { + "default": "latest", + "description": "The update channel.", + "type": [ + "null", + "string" + ] + }, + "name": { + "description": "The space name.", + "type": "string" + }, + "path": { + "default": "/", + "description": "The directory path.", + "type": [ + "null", + "string" + ] + }, + "provider": { + "description": "The provider. Must be `spaces`.", + "enum": [ + "spaces" + ], + "type": "string" + }, + "publishAutoUpdate": { + "default": true, + "description": "Whether to publish auto update info files.\n\nAuto update relies only on the first provider in the list (you can specify several publishers).\nThus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.", + "type": "boolean" + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "region": { + "description": "The region (e.g. `nyc3`).", + "type": "string" + }, + "requestHeaders": { + "$ref": "#/definitions/OutgoingHttpHeaders", + "description": "Any custom request headers" + }, + "timeout": { + "default": 60000, + "description": "Request timeout in milliseconds. (Default is 2 minutes; O is ignored)", + "type": [ + "null", + "number" + ] + }, + "updaterCacheDirName": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "name", + "provider", + "region" + ], + "type": "object" + }, + "SquirrelWindowsOptions": { + "additionalProperties": false, + "properties": { + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template).", + "type": [ + "null", + "string" + ] + }, + "iconUrl": { + "description": "A URL to an ICO file to use as the application icon (displayed in Control Panel > Programs and Features). Defaults to the Electron icon.\n\nPlease note — [local icon file url is not accepted](https://github.com/atom/grunt-electron-installer/issues/73), must be https/http.\n\nIf you don't plan to build windows installer, you can omit it.\nIf your project repository is public on GitHub, it will be `https://github.com/${u}/${p}/blob/master/build/icon.ico?raw=true` by default.", + "type": [ + "null", + "string" + ] + }, + "loadingGif": { + "description": "The path to a .gif file to display during install. `build/install-spinner.gif` will be used if exists (it is a recommended way to set)\n(otherwise [default](https://github.com/electron/windows-installer/blob/master/resources/install-spinner.gif)).", + "type": [ + "null", + "string" + ] + }, + "msi": { + "description": "Whether to create an MSI installer. Defaults to `false` (MSI is not created).", + "type": "boolean" + }, + "name": { + "description": "https://github.com/electron-userland/electron-builder/issues/1743", + "type": "string" + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "remoteReleases": { + "description": "A URL to your existing updates. Or `true` to automatically set to your GitHub repository. If given, these will be downloaded to create delta updates.", + "type": [ + "null", + "string", + "boolean" + ] + }, + "remoteToken": { + "description": "Authentication token for remote updates", + "type": [ + "null", + "string" + ] + }, + "useAppIdAsId": { + "description": "Use `appId` to identify package instead of `name`.", + "type": "boolean" + } + }, + "type": "object" + }, + "TargetConfiguration": { + "additionalProperties": false, + "properties": { + "arch": { + "anyOf": [ + { + "items": { + "enum": [ + "arm64", + "armv7l", + "ia32", + "universal", + "x64" + ], + "type": "string" + }, + "type": "array" + }, + { + "enum": [ + "arm64", + "armv7l", + "ia32", + "universal", + "x64" + ], + "type": "string" + } + ], + "description": "The arch or list of archs." + }, + "target": { + "description": "The target name. e.g. `snap`.", + "type": "string" + } + }, + "required": [ + "target" + ], + "type": "object" + }, + "WindowsConfiguration": { + "additionalProperties": false, + "properties": { + "additionalCertificateFile": { + "description": "The path to an additional certificate file you want to add to the signature block.", + "type": [ + "null", + "string" + ] + }, + "appId": { + "default": "com.electron.${name}", + "description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.", + "type": [ + "null", + "string" + ] + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).", + "type": [ + "null", + "string" + ] + }, + "asar": { + "anyOf": [ + { + "$ref": "#/definitions/AsarOptions" + }, + { + "type": [ + "null", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n\nNode modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work." + }, + "asarUnpack": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive." + }, + "certificateFile": { + "description": "The path to the *.pfx certificate you want to sign with. Please use it only if you cannot use env variable `CSC_LINK` (`WIN_CSC_LINK`) for some reason.\nPlease see [Code Signing](/code-signing).", + "type": [ + "null", + "string" + ] + }, + "certificatePassword": { + "description": "The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason.\nPlease see [Code Signing](/code-signing).", + "type": [ + "null", + "string" + ] + }, + "certificateSha1": { + "description": "The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).", + "type": [ + "null", + "string" + ] + }, + "certificateSubjectName": { + "description": "The name of the subject of the signing certificate, which is often labeled with the field name `issued to`. Required only for EV Code Signing and works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "maximum", + "normal", + "store" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "normal", + "description": "The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time." + }, + "cscKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscLink": { + "type": [ + "null", + "string" + ] + }, + "defaultArch": { + "type": "string" + }, + "detectUpdateChannel": { + "default": true, + "description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.", + "type": "boolean" + }, + "electronUpdaterCompatibility": { + "description": "The [electron-updater compatibility](/auto-update#compatibility) semver range.", + "type": [ + "null", + "string" + ] + }, + "executableName": { + "description": "The executable name. Defaults to `productName`.", + "type": [ + "null", + "string" + ] + }, + "extraFiles": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "extraResources": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "fileAssociations": { + "anyOf": [ + { + "$ref": "#/definitions/FileAssociation" + }, + { + "items": { + "$ref": "#/definitions/FileAssociation" + }, + "type": "array" + } + ], + "description": "The file associations." + }, + "files": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "forceCodeSigning": { + "description": "Whether to fail if app will be not code signed.", + "type": "boolean" + }, + "generateUpdatesFilesForAllChannels": { + "default": false, + "description": "Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).", + "type": "boolean" + }, + "icon": { + "default": "build/icon.ico", + "description": "The path to application icon.", + "type": [ + "null", + "string" + ] + }, + "legalTrademarks": { + "description": "The trademarks and registered trademarks.", + "type": [ + "null", + "string" + ] + }, + "protocols": { + "anyOf": [ + { + "$ref": "#/definitions/Protocol" + }, + { + "items": { + "$ref": "#/definitions/Protocol" + }, + "type": "array" + } + ], + "description": "The URL protocol schemes." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "publisherName": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "[The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\nDefaults to common name from your code signing certificate." + }, + "releaseInfo": { + "$ref": "#/definitions/ReleaseInfo", + "description": "The release info. Intended for command line usage:\n\n```\n-c.releaseInfo.releaseNotes=\"new features\"\n```" + }, + "requestedExecutionLevel": { + "anyOf": [ + { + "enum": [ + "asInvoker", + "highestAvailable", + "requireAdministrator" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "asInvoker", + "description": "The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\nCannot be specified per target, allowed only in the `win`." + }, + "rfc3161TimeStampServer": { + "default": "http://timestamp.digicert.com", + "description": "The URL of the RFC 3161 time stamp server.", + "type": [ + "null", + "string" + ] + }, + "sign": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The custom function (or path to file or module id) to sign Windows executable." + }, + "signAndEditExecutable": { + "default": true, + "description": "Whether to sign and add metadata to executable. Advanced option.", + "type": "boolean" + }, + "signDlls": { + "default": false, + "description": "Whether to sign DLL files. Advanced option.", + "type": "boolean" + }, + "signingHashAlgorithms": { + "anyOf": [ + { + "items": { + "enum": [ + "sha1", + "sha256" + ], + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": "['sha1', 'sha256']", + "description": "Array of signing algorithms used. For AppX `sha256` is always used." + }, + "target": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "default": "nsis", + "description": "The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable](/configuration/nsis#portable) app without installation), `appx`, `msi`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\nAppX package can be built only on Windows 10.\n\nTo use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency." + }, + "timeStampServer": { + "default": "http://timestamp.digicert.com", + "description": "The URL of the time stamp server.", + "type": [ + "null", + "string" + ] + }, + "verifyUpdateCodeSignature": { + "default": true, + "description": "Whether to verify the signature of an available update before installation.\nThe [publisher name](#publisherName) will be used for the signature verification.", + "type": "boolean" + } + }, + "type": "object" + } + }, + "description": "Configuration Options", + "properties": { + "afterAllArtifactBuild": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild)." + }, + "afterPack": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be [run after pack](#afterpack) (but before pack into distributable format and sign)." + }, + "afterSign": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be [run after pack and sign](#aftersign) (but before pack into distributable format)." + }, + "apk": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxTargetSpecificOptions" + }, + { + "type": "null" + } + ] + }, + "appId": { + "default": "com.electron.${name}", + "description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.", + "type": [ + "null", + "string" + ] + }, + "appImage": { + "anyOf": [ + { + "$ref": "#/definitions/AppImageOptions" + }, + { + "type": "null" + } + ], + "description": "AppImage options." + }, + "appx": { + "anyOf": [ + { + "$ref": "#/definitions/AppXOptions" + }, + { + "type": "null" + } + ] + }, + "appxManifestCreated": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Appx manifest created on disk - not packed into .appx package yet." + }, + "artifactBuildCompleted": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be run on artifact build completed." + }, + "artifactBuildStarted": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be run on artifact build start." + }, + "artifactName": { + "description": "The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).", + "type": [ + "null", + "string" + ] + }, + "asar": { + "anyOf": [ + { + "$ref": "#/definitions/AsarOptions" + }, + { + "type": [ + "null", + "boolean" + ] + } + ], + "default": true, + "description": "Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n\nNode modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#configuration-asarUnpack) - please file an issue if this doesn't work." + }, + "asarUnpack": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "A [glob patterns](/file-patterns) relative to the [app directory](#MetadataDirectories-app), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive." + }, + "beforeBuild": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n\nIf provided and `node_modules` are missing, it will not invoke production dependencies check." + }, + "beforePack": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be [run before pack](#beforepack)" + }, + "buildDependenciesFromSource": { + "default": false, + "description": "Whether to build the application native dependencies from source.", + "type": "boolean" + }, + "buildNumber": { + "description": "The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\nIf not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.", + "type": [ + "null", + "string" + ] + }, + "buildVersion": { + "description": "The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\nIf `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).", + "type": [ + "null", + "string" + ] + }, + "compression": { + "anyOf": [ + { + "enum": [ + "maximum", + "normal", + "store" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "default": "normal", + "description": "The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time." + }, + "copyright": { + "default": "Copyright © year ${author}", + "description": "The human-readable copyright line for the app.", + "type": [ + "null", + "string" + ] + }, + "cscKeyPassword": { + "type": [ + "null", + "string" + ] + }, + "cscLink": { + "type": [ + "null", + "string" + ] + }, + "deb": { + "anyOf": [ + { + "$ref": "#/definitions/DebOptions" + }, + { + "type": "null" + } + ], + "description": "Debian package options." + }, + "defaultArch": { + "type": "string" + }, + "detectUpdateChannel": { + "default": true, + "description": "Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.", + "type": "boolean" + }, + "directories": { + "anyOf": [ + { + "$ref": "#/definitions/MetadataDirectories" + }, + { + "type": "null" + } + ] + }, + "dmg": { + "anyOf": [ + { + "$ref": "#/definitions/DmgOptions" + }, + { + "type": "null" + } + ], + "description": "macOS DMG options." + }, + "electronBranding": { + "$ref": "#/definitions/ElectronBrandingOptions", + "description": "The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file." + }, + "electronCompile": { + "description": "Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.", + "type": "boolean" + }, + "electronDist": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": "string" + } + ], + "description": "Returns the path to custom Electron build (e.g. `~/electron/out/R`). Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory" + }, + "electronDownload": { + "$ref": "#/definitions/ElectronDownloadOptions", + "description": "The [electron-download](https://github.com/electron-userland/electron-download#usage) options." + }, + "electronUpdaterCompatibility": { + "description": "The [electron-updater compatibility](/auto-update#compatibility) semver range.", + "type": [ + "null", + "string" + ] + }, + "electronVersion": { + "description": "The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.", + "type": [ + "null", + "string" + ] + }, + "executableName": { + "description": "The executable name. Defaults to `productName`.", + "type": [ + "null", + "string" + ] + }, + "extends": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n\nThe latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n\nIf `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection." + }, + "extraFiles": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "extraMetadata": { + "description": "Inject properties to `package.json`." + }, + "extraResources": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "fileAssociations": { + "anyOf": [ + { + "$ref": "#/definitions/FileAssociation" + }, + { + "items": { + "$ref": "#/definitions/FileAssociation" + }, + "type": "array" + } + ], + "description": "The file associations." + }, + "files": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/FileSet" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "flatpak": { + "anyOf": [ + { + "$ref": "#/definitions/FlatpakOptions" + }, + { + "type": "null" + } + ], + "description": "Flatpak options." + }, + "forceCodeSigning": { + "default": false, + "description": "Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).", + "type": "boolean" + }, + "framework": { + "description": "The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.", + "type": [ + "null", + "string" + ] + }, + "freebsd": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxTargetSpecificOptions" + }, + { + "type": "null" + } + ] + }, + "generateUpdatesFilesForAllChannels": { + "default": false, + "description": "Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).", + "type": "boolean" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "includePdb": { + "default": false, + "description": "Whether to include PDB files.", + "type": "boolean" + }, + "includeSubNodeModules": { + "default": false, + "description": "Whether to include *all* of the submodules node_modules directories", + "type": "boolean" + }, + "launchUiVersion": { + "description": "*libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.", + "type": [ + "null", + "string", + "boolean" + ] + }, + "linux": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxConfiguration" + }, + { + "type": "null" + } + ], + "description": "Options related to how build Linux targets." + }, + "mac": { + "anyOf": [ + { + "$ref": "#/definitions/MacConfiguration" + }, + { + "type": "null" + } + ], + "description": "Options related to how build macOS targets." + }, + "mas": { + "anyOf": [ + { + "$ref": "#/definitions/MasConfiguration" + }, + { + "type": "null" + } + ], + "description": "MAS (Mac Application Store) options." + }, + "masDev": { + "anyOf": [ + { + "$ref": "#/definitions/MasConfiguration" + }, + { + "type": "null" + } + ], + "description": "MAS (Mac Application Store) development options (`mas-dev` target)." + }, + "msi": { + "anyOf": [ + { + "$ref": "#/definitions/MsiOptions" + }, + { + "type": "null" + } + ] + }, + "msiProjectCreated": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "MSI project created on disk - not packed into .msi package yet." + }, + "nodeGypRebuild": { + "default": false, + "description": "Whether to execute `node-gyp rebuild` before starting to package the app.\n\nDon't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.", + "type": "boolean" + }, + "nodeVersion": { + "description": "*libui-based frameworks only* The version of NodeJS you are packaging for.\nYou can set it to `current` to set the Node.js version that you use to run.", + "type": [ + "null", + "string" + ] + }, + "npmArgs": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "Additional command line arguments to use when installing app native deps." + }, + "npmRebuild": { + "default": true, + "description": "Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.", + "type": "boolean" + }, + "nsis": { + "anyOf": [ + { + "$ref": "#/definitions/NsisOptions" + }, + { + "type": "null" + } + ] + }, + "nsisWeb": { + "anyOf": [ + { + "$ref": "#/definitions/NsisWebOptions" + }, + { + "type": "null" + } + ] + }, + "onNodeModuleFile": { + "anyOf": [ + { + "typeof": "function" + }, + { + "type": [ + "null", + "string" + ] + } + ], + "description": "The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file." + }, + "p5p": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxTargetSpecificOptions" + }, + { + "type": "null" + } + ] + }, + "pacman": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxTargetSpecificOptions" + }, + { + "type": "null" + } + ] + }, + "pkg": { + "anyOf": [ + { + "$ref": "#/definitions/PkgOptions" + }, + { + "type": "null" + } + ], + "description": "macOS PKG options." + }, + "portable": { + "anyOf": [ + { + "$ref": "#/definitions/PortableOptions" + }, + { + "type": "null" + } + ] + }, + "productName": { + "description": "As [name](#Metadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\nIf not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.", + "type": [ + "null", + "string" + ] + }, + "protocols": { + "anyOf": [ + { + "$ref": "#/definitions/Protocol" + }, + { + "items": { + "$ref": "#/definitions/Protocol" + }, + "type": "array" + } + ], + "description": "The URL protocol schemes." + }, + "publish": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/GithubOptions" + }, + { + "$ref": "#/definitions/S3Options" + }, + { + "$ref": "#/definitions/SpacesOptions" + }, + { + "$ref": "#/definitions/GenericServerOptions" + }, + { + "$ref": "#/definitions/CustomPublishOptions" + }, + { + "$ref": "#/definitions/KeygenOptions" + }, + { + "$ref": "#/definitions/SnapStoreOptions" + }, + { + "$ref": "#/definitions/BitbucketOptions" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "releaseInfo": { + "$ref": "#/definitions/ReleaseInfo", + "description": "The release info. Intended for command line usage:\n\n```\n-c.releaseInfo.releaseNotes=\"new features\"\n```" + }, + "remoteBuild": { + "default": true, + "description": "Whether to build using Electron Build Service if target not supported on current OS.", + "type": "boolean" + }, + "removePackageKeywords": { + "default": true, + "description": "Whether to remove `keywords` field from `package.json` files.", + "type": "boolean" + }, + "removePackageScripts": { + "default": true, + "description": "Whether to remove `scripts` field from `package.json` files.", + "type": "boolean" + }, + "rpm": { + "anyOf": [ + { + "$ref": "#/definitions/LinuxTargetSpecificOptions" + }, + { + "type": "null" + } + ] + }, + "snap": { + "anyOf": [ + { + "$ref": "#/definitions/SnapOptions" + }, + { + "type": "null" + } + ], + "description": "Snap options." + }, + "squirrelWindows": { + "anyOf": [ + { + "$ref": "#/definitions/SquirrelWindowsOptions" + }, + { + "type": "null" + } + ] + }, + "target": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TargetConfiguration" + }, + { + "type": "string" + } + ] + }, + "type": "array" + }, + { + "type": [ + "null", + "string" + ] + } + ] + }, + "win": { + "anyOf": [ + { + "$ref": "#/definitions/WindowsConfiguration" + }, + { + "type": "null" + } + ], + "description": "Options related to how build Windows targets." + }, + "$schema": { + "description": "JSON Schema for this document.", + "type": [ + "null", + "string" + ] + } + }, + "type": "object" +} \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/appx/appxmanifest.xml b/client/node_modules/app-builder-lib/templates/appx/appxmanifest.xml new file mode 100644 index 0000000000..0b1234a65d --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/appx/appxmanifest.xml @@ -0,0 +1,43 @@ + + + + + + + ${displayName} + ${publisherDisplayName} + ${description} + ${logo} + + + ${resourceLanguages} + + + + + + + + + + + ${lockScreen} + ${defaultTile} + ${splashScreen} + + ${extensions} + + + diff --git a/client/node_modules/app-builder-lib/templates/appx/priconfig.xml b/client/node_modules/app-builder-lib/templates/appx/priconfig.xml new file mode 100644 index 0000000000..2a4b2e19c0 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/appx/priconfig.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/entitlements.mac.plist b/client/node_modules/app-builder-lib/templates/entitlements.mac.plist new file mode 100644 index 0000000000..c10e10a79e --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/entitlements.mac.plist @@ -0,0 +1,14 @@ + + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + + com.apple.security.cs.disable-library-validation + + + diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/128x128.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/128x128.png new file mode 100644 index 0000000000..0c136f4779 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/128x128.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/16x16.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/16x16.png new file mode 100644 index 0000000000..61930494fa Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/16x16.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/256x256.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/256x256.png new file mode 100644 index 0000000000..7bef37a233 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/256x256.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/32x32.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/32x32.png new file mode 100644 index 0000000000..4b9c45f5e6 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/32x32.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/48x48.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/48x48.png new file mode 100644 index 0000000000..8fef48ac3c Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/48x48.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/electron-linux/64x64.png b/client/node_modules/app-builder-lib/templates/icons/electron-linux/64x64.png new file mode 100644 index 0000000000..651fd19806 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/electron-linux/64x64.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/1024x1024.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/1024x1024.png new file mode 100644 index 0000000000..eea522716d Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/1024x1024.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/128x128.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/128x128.png new file mode 100644 index 0000000000..9a999c0166 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/128x128.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/16x16.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/16x16.png new file mode 100644 index 0000000000..f76e6827c7 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/16x16.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/256x256.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/256x256.png new file mode 100644 index 0000000000..738f585cb3 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/256x256.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/32x32.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/32x32.png new file mode 100644 index 0000000000..452781414b Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/32x32.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/48x48.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/48x48.png new file mode 100644 index 0000000000..0c70d5a19b Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/48x48.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/512x512.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/512x512.png new file mode 100644 index 0000000000..cb7759e866 Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/512x512.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/64x64.png b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/64x64.png new file mode 100644 index 0000000000..10931b6abe Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/linux/64x64.png differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.icns b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.icns new file mode 100644 index 0000000000..e95e349fcd Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.icns differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.ico b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.ico new file mode 100644 index 0000000000..a92d8e74df Binary files /dev/null and b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.ico differ diff --git a/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.svg b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.svg new file mode 100644 index 0000000000..e79d06bf04 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/icons/proton-native/proton-native.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/linux/after-install.tpl b/client/node_modules/app-builder-lib/templates/linux/after-install.tpl new file mode 100644 index 0000000000..1536059a2a --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/linux/after-install.tpl @@ -0,0 +1,10 @@ +#!/bin/bash + +# Link to the binary +ln -sf '/opt/${sanitizedProductName}/${executable}' '/usr/bin/${executable}' + +# SUID chrome-sandbox for Electron 5+ +chmod 4755 '/opt/${sanitizedProductName}/chrome-sandbox' || true + +update-mime-database /usr/share/mime || true +update-desktop-database /usr/share/applications || true diff --git a/client/node_modules/app-builder-lib/templates/linux/after-remove.tpl b/client/node_modules/app-builder-lib/templates/linux/after-remove.tpl new file mode 100644 index 0000000000..40cc39ee5a --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/linux/after-remove.tpl @@ -0,0 +1,4 @@ +#!/bin/bash + +# Delete the link to the binary +rm -f '/usr/bin/${executable}' diff --git a/client/node_modules/app-builder-lib/templates/linux/desktop.tpl b/client/node_modules/app-builder-lib/templates/linux/desktop.tpl new file mode 100644 index 0000000000..5c78a5a3d7 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/linux/desktop.tpl @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=<%= title %> +Comment=<%= comment %> +Exec=<%= executable %> +Terminal=false +Type=Application diff --git a/client/node_modules/app-builder-lib/templates/msi/template.xml b/client/node_modules/app-builder-lib/templates/msi/template.xml new file mode 100644 index 0000000000..9d1c583d32 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/msi/template.xml @@ -0,0 +1,111 @@ + + + + + + + = 601]]> + + + + + + + + + + {{ if (iconPath) { }} + + + {{ } -}} + + {{ if (isRunAfterFinish) { }} + + {{ if (!isAssisted) { }} + + + NOT Installed AND UILevel >= 4 + + {{ } -}} + {{ } -}} + + {{ if (isPerMachine) { }} + + {{ } else { }} + + {{ } -}} + + + {{ if (isAssisted) { }} + + + {{ if (isPerMachine) { }} + + {{ } -}} + + {{ if (isRunAfterFinish) { }} + + + + WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed + + {{ } -}} + + + + 1 OR CostingComplete = 1 + NOT Installed + + 1 + !(wix.WixUISupportPerUser) AND NOT Privileged + NOT !(wix.WixUISupportPerUser) + WixAppFolder = "WixPerUserFolder" + WixAppFolder = "WixPerMachineFolder" + + 1 + 1 + + NOT Installed + + {{ } -}} + + + + {{ if (menuCategory) { }} + + {{ } -}} + + {{ if (menuCategory) { }} + + {{ } -}} + + + + {{ if (isCreateDesktopShortcut) { }} + + {{ } -}} + + + {{ if (isCreateStartMenuShortcut) { }} + + {{ } }} + + + + + + + + {{-dirs}} + + + {{-files}} + + + diff --git a/client/node_modules/app-builder-lib/templates/nsis/README.md b/client/node_modules/app-builder-lib/templates/nsis/README.md new file mode 100644 index 0000000000..62b793f285 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/README.md @@ -0,0 +1,47 @@ +# NSIS + +⚠️ **It is developer documentation.** If your are looking for usage guide, see [user documentation](https://electron.build/configuration/nsis). + +NSIS stands for Nullsoft Scriptable Install System. electron-builder utilizes a [customized version](https://github.com/electron-userland/electron-builder-binaries) of it and uses `NsisMultiUser` plugin to handle installation for single user or all users on the computer. + +## Some links +http://www.mathiaswestin.net/2012/09/how-to-make-per-user-installation-with.html + +https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx#FOLDERID_UserProgramFiles + +https://github.com/Drizin/NsisMultiUser + +NSIS vs Inno Setup — it is not easy to choose because both are far from ideal, e.g. inno also doesn't have built-in per-user installation implementation — http://stackoverflow.com/questions/34330668/inno-setup-custom-dialog-with-per-user-or-per-machine-installation. + +http://stackoverflow.com/questions/2565215/checking-if-the-application-is-running-in-nsis-before-uninstalling + +One-click installer: http://forums.winamp.com/showthread.php?t=300479 + +## Localization (l10n) + +For translators, the strings to be displayed are included in [`assistedMessages.yml`](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/nsis/assistedMessages.yml) and [`messages.yml`]https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/nsis/messages.yml). + +As for other strings in NSIS, head to [electron-userland/electron-builder-binaries](https://github.com/electron-userland/electron-builder-binaries) or the upstream repository on [Sorceforge](https://sourceforge.net/p/nsis/code/HEAD/tree/). + +## GUID +See [docs](https://electron.build/configuration/nsis). + +We use UUID v5 to generate sha-1 name-based UUID. + +http://stackoverflow.com/questions/3029994/convert-uri-to-guid +https://alexandrebrisebois.wordpress.com/2013/11/14/create-predictable-guids-for-your-windows-azure-table-storage-entities/ +https://github.com/Squirrel/Squirrel.Windows/pull/658 + +## Compression + +NSIS LZMA compression is slower and worse compared to external `7za` compression. Slower because `7za` is multi-threaded, worse because LZMA codec implementation is outdated and BCJ2 filter is not enabled. +Difference for test app — 4 MB (before: 36.3 after: 32.8). + +And compression time is also greatly reduced. + +Since NSIS is awesome, no disadvantages in our approach — [compression is disabled](http://nsis.sourceforge.net/Reference/SetCompress) before `File /oname=app.7z "${APP_ARCHIVE}"` and enabled after (it is the reasons why `SOLID` compression is not used). +So, opposite to Squirrel.Windows, archive is not twice compressed. + +So, in your custom NSIS scripts you should not use any compression instructions. Only `SetCompress` if you need to disable compression for already archived file. + + diff --git a/client/node_modules/app-builder-lib/templates/nsis/assistedInstaller.nsh b/client/node_modules/app-builder-lib/templates/nsis/assistedInstaller.nsh new file mode 100644 index 0000000000..03f4decbbf --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/assistedInstaller.nsh @@ -0,0 +1,147 @@ +!include UAC.nsh + +!ifndef INSTALL_MODE_PER_ALL_USERS + !include multiUserUi.nsh +!endif + +!ifndef BUILD_UNINSTALLER + + !ifmacrodef customWelcomePage + !insertmacro customWelcomePage + !endif + + !ifmacrodef licensePage + !insertmacro skipPageIfUpdated + !insertmacro licensePage + !endif + + !ifndef INSTALL_MODE_PER_ALL_USERS + !insertmacro PAGE_INSTALL_MODE + !endif + + !ifdef allowToChangeInstallationDirectory + !include StrContains.nsh + + !insertmacro skipPageIfUpdated + !insertmacro MUI_PAGE_DIRECTORY + + # pageDirectory leave doesn't work (it seems because $INSTDIR is set after custom leave function) + # so, we use instfiles pre + !define MUI_PAGE_CUSTOMFUNCTION_PRE instFilesPre + + # sanitize the MUI_PAGE_DIRECTORY result to make sure it has a application name sub-folder + Function instFilesPre + ${If} ${FileExists} "$INSTDIR\*" + ${StrContains} $0 "${APP_FILENAME}" $INSTDIR + ${If} $0 == "" + StrCpy $INSTDIR "$INSTDIR\${APP_FILENAME}" + ${endIf} + ${endIf} + FunctionEnd + !endif + + # after change installation directory and before install start, you can show custom page here. + !ifmacrodef customPageAfterChangeDir + !insertmacro customPageAfterChangeDir + !endif + + !insertmacro MUI_PAGE_INSTFILES + !ifmacrodef customFinishPage + !insertmacro customFinishPage + !else + !ifndef HIDE_RUN_AFTER_FINISH + Function StartApp + ${if} ${isUpdated} + StrCpy $1 "--updated" + ${else} + StrCpy $1 "" + ${endif} + ${StdUtils.ExecShellAsUser} $0 "$launchLink" "open" "$1" + FunctionEnd + + !define MUI_FINISHPAGE_RUN + !define MUI_FINISHPAGE_RUN_FUNCTION "StartApp" + !endif + !insertmacro MUI_PAGE_FINISH + !endif +!else + !ifndef removeDefaultUninstallWelcomePage + !insertmacro MUI_UNPAGE_WELCOME + !endif + !ifndef INSTALL_MODE_PER_ALL_USERS + !insertmacro PAGE_INSTALL_MODE + !endif + !insertmacro MUI_UNPAGE_INSTFILES + !ifmacrodef customUninstallPage + !insertmacro customUninstallPage + !endif + !insertmacro MUI_UNPAGE_FINISH +!endif + +!macro initMultiUser + !ifdef INSTALL_MODE_PER_ALL_USERS + !insertmacro setInstallModePerAllUsers + !else + ${If} ${UAC_IsInnerInstance} + ${AndIfNot} ${UAC_IsAdmin} + # special return value for outer instance so it knows we did not have admin rights + SetErrorLevel 0x666666 + Quit + ${endIf} + + !ifndef MULTIUSER_INIT_TEXT_ADMINREQUIRED + !define MULTIUSER_INIT_TEXT_ADMINREQUIRED "$(^Caption) requires administrator privileges." + !endif + + !ifndef MULTIUSER_INIT_TEXT_POWERREQUIRED + !define MULTIUSER_INIT_TEXT_POWERREQUIRED "$(^Caption) requires at least Power User privileges." + !endif + + !ifndef MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE + !define MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE "Your user account does not have sufficient privileges to install $(^Name) for all users of this computer." + !endif + + # checks registry for previous installation path (both for upgrading, reinstall, or uninstall) + StrCpy $hasPerMachineInstallation "0" + StrCpy $hasPerUserInstallation "0" + + # set installation mode to setting from a previous installation + ReadRegStr $perMachineInstallationFolder HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $perMachineInstallationFolder != "" + StrCpy $hasPerMachineInstallation "1" + ${endif} + + ReadRegStr $perUserInstallationFolder HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $perUserInstallationFolder != "" + StrCpy $hasPerUserInstallation "1" + ${endif} + + ${GetParameters} $R0 + ${GetOptions} $R0 "/allusers" $R1 + ${IfNot} ${Errors} + StrCpy $hasPerMachineInstallation "1" + StrCpy $hasPerUserInstallation "0" + ${EndIf} + + ${GetOptions} $R0 "/currentuser" $R1 + ${IfNot} ${Errors} + StrCpy $hasPerMachineInstallation "0" + StrCpy $hasPerUserInstallation "1" + ${EndIf} + + ${if} $hasPerUserInstallation == "1" + ${andif} $hasPerMachineInstallation == "0" + !insertmacro setInstallModePerUser + ${elseif} $hasPerUserInstallation == "0" + ${andif} $hasPerMachineInstallation == "1" + !insertmacro setInstallModePerAllUsers + ${else} + # if there is no installation, or there is both per-user and per-machine + !ifdef INSTALL_MODE_PER_ALL_USERS + !insertmacro setInstallModePerAllUsers + !else + !insertmacro setInstallModePerUser + !endif + ${endif} + !endif +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/assistedMessages.yml b/client/node_modules/app-builder-lib/templates/nsis/assistedMessages.yml new file mode 100644 index 0000000000..2751e03d40 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/assistedMessages.yml @@ -0,0 +1,368 @@ +# assisted installer messages, see messages.yml for one-click installer messages +chooseInstallationOptions: + en: Choose Installation Options + de: Installationsoption wählen + ru: Выберите опции установки + sk: Vyberte možnosti inštalácie + cs: Vyberte možnosti instalace + fr: Choisis les options d'installation + hu_HU: Telepítési opciók kiválasztása + pt_BR: Escolha uma opção de instalação + zh_CN: 安装选项 + zh_TW: 安裝選項 + tr_TR: Yükleme Ayarlarını Seçin + sv_SE: Välj alternativ för installation + pl_PL: Wybierz opcje instalacji + no: Velg alternativer for installering + nl_NL: Kies installatie-opties + it_IT: Scegli opzioni di installazione + fi: Valitse asennusvaihtoehdot + es: Elegir opciones de instalación + da: Vælg Installeringsmuligheder + ja: インストールオプションの選択 + ko: 설치 옵션 선택 +chooseUninstallationOptions: + en: Choose Uninstallation Options + de: Deinstallationsoption wählen + ru: Выберите опции удаления + sk: Vyberte možnosti odinštalovania + cs: Vyberte možnosti odinstalace + fr: Choisis les options de désinstallation + hu_HU: Eltávolítási opciók kiválasztása + pt_BR: Escolha uma opção de desinstalação + zh_CN: 卸载选项 + zh_TW: 解除安裝選項 + tr_TR: Kaldırma Ayarlarını Seçin + sv_SE: Välj alternativ för avinstallation + pl_PL: Wybierz opcje dezinstalacji + no: Velg alternativer for avinstallering + nl_NL: Kies verwijderings-opties + it_IT: Scegli opzioni di disinstallazione + fi: Valitse asennuksen poistovaihtoehdot + es: Elegir opciones de desinstalación + da: Vælg Afinstalleringsmuligheder + ja: アンインストールオプションの選択 + ko: 제거 옵션 선택 +whichInstallationShouldBeRemoved: + en: Which installation should be removed? + de: Welche Installation soll entfernt werden? + ru: Какую из установленных программ следует удалить? + sk: Ktorá inštalácia by mala byt odstránená? + cs: Která instalace by měla být odstraněna? + fr: Quelle installation doit être supprimée ? + hu_HU: Melyik telepítést távolítsuk el? + pt_BR: Qual instalação deve ser removida? + zh_CN: 需要移除哪个安装? + zh_TW: 需要移除哪個安裝? + tr_TR: Hangi Yükleme Kaldırılsın? + sv_SE: Vilken installation ska tas bort? + pl_PL: Którą instalację chcesz usunąć? + no: Hvilken installasjon skal fjernes? + nl_NL: Welke installatie moet worden verwijderd? + it_IT: Quale installazione intendi rimuovere? + fi: Mikä asennus pitäisi poistaa? + es: ¿Qué tipo de instalación debe eliminarse? + da: Hvilken installering skal fjernes? + ja: どれをアンインストールしますか? + ko: 어떤 설치 버전을 제거할까요? +whoShouldThisApplicationBeInstalledFor: + en: Who should this application be installed for? + de: Für wen soll diese Anwendung installiert werden? + ru: Для кого следует установить это приложение? + sk: Pre koho sa ma táto aplikacia inštalovať? + cs: Pro koho se má tato aplikace instalovat? + fr: Pour qui cette application doit-elle être installée ? + hu_HU: Kinek legyen ez az alkalmazás telepítve? + pt_BR: Para quem esta aplicação deve ser instalada? + zh_CN: 为哪位用户安装该应用? + zh_TW: 需要為哪位使用者安裝該應用程式? + tr_TR: Bu Uygulama Kimler için Kurulsun? + sv_SE: Vem ska den här applikationen installeras för? + pl_PL: Dla kogo zainstalować tę aplikację? + no: Hvem skal dette programmet installeres for? + nl_NL: Voor wie moet deze applicatie worden geïnstalleerd? + it_IT: Per chi dovrebbe essere installata questa applicazione? + fi: Kenen käyttöön tämä sovellus pitäisi asentaa? + es: ¿Para quién se instalará esta aplicación? + da: Hvem skal denne applikation installeres til? + ja: どのユーザーにインストールしますか? + ko : 이 프로그램의 사용자는 누구인가요? +selectUserMode: + en: Please select whether you wish to make this software available to all users or just yourself + de: Bitte wählen Sie, ob Sie die Anwendung nur für sich oder für alle Benutzer installieren möchten. + ru: Выбери, хочешь ли ты сделать эту программу доступной для всех пользователей или только для себя + sk: Prosím vyberte či sa ma tento softvér inštalovať len pre Vás alebo pre všetkých uživateľov + cs: Prosím vyberte, zda se má tento software instalovat jen pro Vás, nebo pro všechny uživatele + fr: "Choisis pour qui ce logiciel doit être accessible : pour tous les utilisateurs ou juste pour toi ?" + hu_HU: Válaszd ki, hogy a szoftver elérhető legyen-e minden felhasználó számára, vagy csak neked + pt_BR: Por favor, selecione se este software deve estar disponível apenas para você ou para todos usuários + zh_CN: 请选择为当前用户还是所有用户安装该软件 + zh_TW: 請選擇為目前使用者還是所有使用者安裝該軟體 + tr_TR: Lütfen bu yazılımı tüm kullanıcılar için mi yoksa sadece kendiniz mi kullanmak istediğinizi seçin + sv_SE: Välj om du vill göra den här mjukvaran tillgänglig för alla användare eller bara för dig + pl_PL: Wybierz, czy to oprogramowanie ma być dostępne dla wszystkich użytkowników, czy tylko dla Ciebie + no: Velg om du vil gjøre denne programvaren tilgjengelig for alle brukerne eller bare deg selv + nl_NL: Selecteer of je deze software beschikbaar wilt maken voor alle gebruikers of alleen voor jezelf. + it_IT: Seleziona se desideri rendere questo software accessibile a tutti gli utenti o solo a te + fi: Valitse, haluatko tämän ohjelmiston kaikkien käyttäjien vai pelkästään itsesi käyttöön + es: Elige si deseas que este software esté disponible para todos los usuarios o solo para ti. + da: Vælg, om du vil gøre denne software tilgængelig for andre brugere, eller kun for dig selv + ja: このソフトウェアをすべてのユーザーが使用できるようにするか、現在のユーザーのみ使用するかを選択してください + ko : 이 프로그램을 모든 사용자가 사용할 수 있도록 할 것인지 아니면 자신만 사용할 수 있도록 할 것인지 선택하십시오. +whichInstallationRemove: + en: This software is installed both per-machine (all users) and per-user.\nWhich installation you wish to remove? + de: Die Anwendung wurde für alle Benutzer und pro Benutzer installiert.\nWelche Installation möchten Sie entfernen? + ru: Эта программа установлена для всего компьютера (для всех пользователей) и для отдельного пользователя.\nКакую из установленных программ ты хочешь удалить? + sk: Tento softvér je nainštalovaný pre Vás a súčasne pre všetkých uživateľov.\nKtorú inštaláciu si želáte odstraniť? + cs: Tento software je nainstalovaný pro Vás a současně pro všechny uživatele.\nKterou instalaci si přejete odstranit? + fr: Ce logiciel est installé à la fois par machine (tous les utilisateurs) et par utilisateur.\nQuelle installation veux-tu supprimer ? + hu_HU: Ez a szoftver számítógépenként (minden felhasználó) és felhasználónként is telepítve van.\nMelyik telepítést szeretnéd eltávolítani? + pt_BR: Este software é instalado por máquina (todos os usuários) e por usuário. Qual instalação você deseja remover? + zh_CN: 该软件已为所有用户和当前用户安装.\n您希望移除哪个安装? + zh_TW: 該軟體已為所有使用者和目前使用者安裝。\n您希望移除哪一個? + tr_TR: Bu yazılım hem makine başına (tüm kullanıcılar) hem de kullanıcı başına yüklenir.\nKaldırmak istediğiniz kurulum? + sv_SE: Den här mjukvaran är installerad både ”per dator” (alla användare) och ”per användare”.\nVilken installation vill du ta bort? + pl_PL: To oprogramowanie zostało zainstalowane zarówno dla urządzenia (wszyscy użytkownicy), jak i dla użytkownika.\nKtórą instalację chcesz usunąć? + no: Denne programvaren er installert både per-maskin (alle brukere) og per-bruker. Hvilken installasjon vil du fjerne? + nl_NL: Deze software is zowel per apparaat (alle gebruikers) als per gebruiker geïnstalleerd. Welke installatie wil je verwijderen? + it_IT: Questo software è stato installato sia per computer (tutti gli utenti) sia per utente.\nQuale installazione desideri rimuovere? + fi: Tämä ohjelmisto on asennettu sekä konekohtaisesti (kaikki käyttäjät) että käyttäjäkohtaisesti.\nMinkä asennuksen haluat poistaa? + es: Este software se ha instalado para la máquina (todos los usuarios) y para el usuario.\n¿Qué instalación quieres eliminar? + da: Denne software er installeret både pr. maskine (alle brugere) og pr. bruger./nHvilken installering ønsker du at fjerne? + ja: このソフトウェアは、マシンごと(すべてのユーザー)とユーザーごとにインストールされています。\ nどちらを削除しますか? + ko: 이 프로그램은 시스템당(모든 사용자)또는 사용자별로 설치됩니다.\n어떤 설치를 제거하시겠습니까? +freshInstallForAll: + en: Fresh install for all users. (will prompt for admin credentials) + de: Neuinstallation für alle Benutzer durchführen. (Administratorrechte benötigt) + ru: Новая установка для всех пользователей. (потребуются права администратора) + sk: Nová inštalácia pre všetkých uživateľov. (Bude potrebovať prihlásenie administrátora) + cs: Nová instalace pro všechny uživatele. (Bude vyžadovat přihlášení administrátora) + fr: Nouvelle installation pour tous les utilisateurs. (demandera les identifiants administrateur) + hu_HU: Új telepítés minden felhasználó számára. (Az adminisztrátor hitelesítő adataira lesz szükség.) + pt_BR: Instalação limpa para todos os usuários. (irá solicitar credenciais de administrador) + zh_CN: 为所有用户进行全新安装. (需要管理员资格) + zh_TW: 為所有使用者進行全新安裝 (需要系統管理員權限) + tr_TR: Tüm kullanıcılar için yeni yükleme. (yönetici kimlik bilgilerini soracaktır) + sv_SE: Ny installation för alla användare. (kommer att begära adminbehörighet) + pl_PL: Nowa instalacja dla wszystkich użytkowników (potrzebne będą dane administratora). + no: Ny installasjon for alle brukere. (vil be om administratorlegitimasjon) + nl_NL: Nieuwe installatie voor alle gebruikers. (zal om beheerder-gegevens vragen) + it_IT: Re-installa per tutti gli utenti. (Richiede le credenziali di amministratore) + fi: Uusi asennus kaikille käyttäjille (pyytää ylläpitäjän käyttäjätunnuksia) + es: Instalación nueva para todos los usuarios (se pedirán los credenciales del administrador) + da: Ny installering til alle brugere. (Vil medføre administrations-legitimationsoplysninger) + ja: すべてのユーザーに新規インストール(管理者権限が必要) + ko: 모든 사용자를 위해 새로 설치. (관리자 자격 증명을 묻는 메시지가 표시됨) +freshInstallForCurrent: + en: Fresh install for current user only. + de: Neuinstallation nur für den aktuellen Benutzer durchführen. + ru: Новая установка только для текущего пользователя. + cs: Nová instalace pro aktuálního uživatele. + fr: Nouvelle installation uniquement pour l'utilisateur actuel. + hu_HU: Új telepítés csak a jelenlegi felhasználó számára. + pt_BR: Instalação limpa somente para o usuário atual. + zh_CN: 仅为当前用户进行全新安装. + zh_TW: 僅為目前使用者進行全新安裝 + tr_TR: Sadece mevcut kullanıcı için yeni yükleme. + sv_SE: Ny installation endast för den aktuella användaren. + pl_PL: Nowa instalacja wyłącznie dla obecnego użytkownika. + no: Ny installasjon kun for nåværende bruker. + nl_NL: Nieuwe installatie alleen voor huidige gebruiker. + it_IT: Re-installa solo per l'utente attuale. + fi: Uusi asennus vain nykyiselle käyttäjälle. + es: Instalación nueva solo para el usuario actual. + da: Ny installering kun til nuværende bruger. + ja: 現在のユーザーのみ新規インストール + ko: 현재 사용자만 새로 설치합니다. +onlyForMe: + en: Only for &me + de: Nur für &mich + ru: Только для &меня + sk: Iba pre mňa + cs: Pouze pro &mě + fr: Juste pour moi + hu_HU: Csak az én számomra + pt_BR: Apenas para &mim + zh_CN: 仅为我安装 + zh_TW: 僅為我安裝 + tr_TR: Sadece benim için + sv_SE: Endast för &mig + pl_PL: Tylko dla &mnie + no: Kun for &meg + nl_NL: Alleen voor &mij + it_IT: Solo per &me + fi: Vain minulle + es: Solo para mí. + da: Kun til mig + ja: 現在のユーザーのみにインストールする + ko: &me 전용 +forAll: + en: Anyone who uses this computer (&all users) + de: Für alle Benutzer dieses Computers (&alle Benutzer) + ru: Для &всех пользователей данного компьютера + sk: Pre každého kto použiva tento počitač (všetci uživatelia) + cs: Pro každého, kdo používá tento počítač (všichni uživatelé) + fr: Pour tous ceux qui utilisent cet ordinateur (tous les utilisateurs) + hu_HU: Bárki számára, aki ezt a számítógépet használja (minden felhasználó) + pt_BR: Para todos que usam esta máquina (&todos os usuários) + zh_CN: 为使用这台电脑的任何人安装 (所有用户) + zh_TW: 為使用這台電腦的任何人安裝 (所有使用者) + tr_TR: Bu bilgisayarı kullanan herkes (ve tüm kullanıcılar) + sv_SE: Alla som använder den här datorn (alla användare) + pl_PL: Każdy korzystający z tego komputera (wszyscy użytkownicy) + no: Alle som bruker denne datamaskinen (alle brukere) + nl_NL: Iedereen die deze computer gebruikt (alle gebruikers) + it_IT: Per chiunque usi questo computer (tutti gli utenti) + fi: Kaikille, jotka käyttävät tätä tietokonetta (kaikki käyttäjät) + es: Cualquiera que utilice este ordenador (todos los usuarios) + da: Enhver, der bruger denne computer (alle brugere) + ja: このコンピューターを使用しているすべてのユーザー用にインストールする + ko: 이 컴퓨터를 사용하는 모든 사람(&모든 사용자) +loginWithAdminAccount: + en: You need to login with an account that is a member of the admin group to continue... + de: Um die Installation fortzusetzen müssen Sie sich mit einem Administrator-Account anmelden... + ru: Чтобы продолжить, тебе нужно войти в учетную запись, которая входит в группу администраторов... + sk: Pre pokračovanie sa musíte zalogovať s účtom ktorý patrí do skupiny adminstrátorov... + cs: Pro pokračování se musíte přihlásit účtem, který patří do skupiny administrátorů... + fr: Tu dois te connecter avec un compte ayant des droits d'administrateur pour continuer... + hu_HU: A folytatáshoz adminisztrátori jogokkal rendelkező fiókkal kell bejelentkezned... + pt_BR: Você precisa realizar o login com uma conta que é membro do grupo de administração para continuar... + zh_CN: 您需要用属于管理员群组的用户账户登录来继续... + zh_TW: 您需要以具系統管理員身分的帳號登入才能繼續... + tr_TR: Devam etmek için yönetici grubunun üyesi olan bir hesapla giriş yapmanız gerekiyor.. + sv_SE: Du måste logga in med ett konto som är medlem i admingruppen för att fortsätta... + pl_PL: Musisz się zalogować za pomocą konta będącego członkiem grupy administratora, by kontynuować... + no: Du må logge inn med en konto som er medlem av administrasjonsgruppen for å fortsette... + nl_NL: Je dient in te loggen met een account dat lid is van de beheerdersgroep om verder te gaan... + it_IT: Devi accedere con un account incluso nel gruppo amministratore per continuare... + fi: Jatkaaksesi sinun on kirjauduttava käyttäjätilillä, joka on ylläpitäjäryhmän jäsen... + es: Para continuar, tienes que iniciar sesión con una cuenta que pertenezca al grupo de administradores... + da: Du skal logge ind med en konto, der er medlem af administrationsgruppen for at kunne fortsætte... + ja: 続行するには、管理者権限アカウントでログインする必要があります... + ko: 계속하려면 관리자 그룹의 구성원인 계정으로 로그인해야 합니다... +perUserInstallExists: + en: There is already a per-user installation. + de: Es existiert bereits eine Installation für den ausgewählten Benutzer. + ru: Уже есть установленная программа для отдельного пользователя. + cs: Již existuje instalace pro uživatele. + fr: Il y a déjà une installation par utilisateur. + hu_HU: Már van egy felhasználónkénti telepítés. + pt_BR: Já existe uma instalação por usuário. + zh_CN: 已经存在一个安装到当前用户的安装. + zh_TW: 已經為目前使用者安裝過該軟體 + tr_TR: Her kullanıcı için zaten bir kurulum var. + sv_SE: Det finns redan en ”per användare”-installation. + pl_PL: Instalacja dla użytkownika już istnieje. + no: Det er allerede en per-bruker-installasjon. + nl_NL: Er is al een installatie 'per gebruiker'. + it_IT: È già presente un'installazione per utente. + fi: Tämä on jo käyttäjäkohtainen asennus. + es: Ya hay una instalación por usuario. + da: Der er allerede en pr. bruger installation. + ja: すでに現在のユーザーにインストールされています。 + ko: 이미 사용자별 설치가 있습니다. +perUserInstall: + en: There is a per-user installation. + de: Benutzerinstallation bereits vorhanden. + ru: Есть установленная программа для отдельного пользователя. + cs: Instalace pro uživatele. + fr: Il y a une installation par utilisateur. + hu_HU: Van felhasználónkénti telepítés. + pt_BR: Existe uma instalação por usuário. + zh_CN: 存在一个安装到当前用户的安装. + zh_TW: 存在一個對目前使用者的安裝 + tr_TR: Kullanıcı başına bir kurulum var. + sv_SE: Det finns en ”per användare”-installation. + pl_PL: Instalacja dla użytkownika istnieje. + no: Det er en per-bruker-installasjon. + nl_NL: Er is een installatie 'per gebruiker'. + it_IT: È presente un'installazione per utente. + fi: Käyttäjäkohtainen asennus on olemassa. + es: Hay una instalación por usuario. + da: Der er en pr. bruger installation. + ja: ユーザーごとのインストールがあります。 + ko: 사용자별로 설치되어 있습니다. +perMachineInstallExists: + en: There is already a per-machine installation. + de: Es existiert bereits eine Installation für diesen Computer. + ru: Уже есть установленная программа для всего компьютера. + cs: Již existuje instalace pro tento počítač. + fr: Il y a déjà une installation par machine. + hu_HU: Már van egy számítógépenkénti telepítés. + pt_BR: Já existe uma instalação por máquina. + zh_CN: 已经存在一个安装到所有用户的安装. + zh_TW: 已經為所有使用者安裝過該軟體 + tr_TR: Zaten makine başına bir kurulum var. + sv_SE: Det finns redan en ”per dator”-installation. + pl_PL: Instalacja dla urządzenia już istnieje. + no: Det er allerede en per-maskin-installasjon. + nl_NL: Er is al een installatie 'per apparaat'. + it_IT: È già presente un'installazione per computer. + fi: Tämä on jo tietokonekohtainen asennus. + es: Ya hay una instalación por máquina. + da: Der er allerede en pr. maskine installation. + ja: 既にすべてのユーザー用にインストールされています。 + ko: 이미 머신별로 설치되어 있습니다. +perMachineInstall: + en: There is a per-machine installation. + de: Es existiert eine Installation für diesen Computer. + ru: Есть установленная программа для всего компьютера. + cs: Instalace pro tento počítač. + fr: Il y a une installation par machine. + hu_HU: Van számítógépenkénti telepítés. + pt_BR: Existe uma instalação por máquina. + zh_CN: 存在一个安装到所有用户的安装. + zh_TW: 存在一個對所有使用者的安裝 + tr_TR: Makine başına bir yükleme var. + sv_SE: Det finns en ”per dator”-installation. + pl_PL: Instalacja dla urządzenia istnieje. + no: Det er en per-maskin-installasjon. + nl_NL: Er is een installatie 'per apparaat'. + it_IT: È presente un'installazione per computer. + fi: Tietokonekohtainen asennus on olemassa. + es: Hay una instalación por máquina. + da: Der er en pr. maskine installation. + ja: すべてのユーザー用のインストールがあります。 + ko: 머신별로 설치되어 있습니다. +reinstallUpgrade: + en: Will reinstall/upgrade. + de: Die Anwendung wird aktualisiert. + ru: Приложение будет переустановлено/обновлено. + cs: Bude přeinstalováno/aktualizováno. + fr: Va réinstaller/mettre à jour. + hu_HU: Újratelepít/frissít. + pt_BR: Irá reinstalar/atualizar. + zh_CN: 即将重新安装/升级. + zh_TW: 即將重新安裝/升級 + tr_TR: Yeniden yükleme/yükseltme + sv_SE: Kommer att ominstallera/uppgradera. + pl_PL: Nastąpi ponowna instalacja/aktualizacja. + no: Vil installere på nytt / oppgradere. + nl_NL: Zal opnieuw installeren/upgraden. + it_IT: Re-installa/aggiorna il programma. + fi: Asennetaan uudelleen/päivitetään. + es: Se reinstalará/actualizará. + da: Reinstallerer/opgraderer. + ja: 再インストール/アップグレードします。 + ko: 재설치/업그레이드합니다. +uninstall: + en: Will uninstall. + de: Die Anwendung wird deinstalliert. + ru: Приложение будет удалено. + cs: Odinstaluje se. + fr: Va désinstaller. + hu_HU: Eltávolít. + pt_BR: Irá desinstalar. + zh_CN: 即将卸载. + zh_TW: 即將解除安裝 + tr_TR: Kaldıralacak. + sv_SE: Kommer att avinstallera. + pl_PL: Nastąpi dezinstalacja. + no: Vil avinstallere. + nl_NL: Zal installatie verwijderen. + it_IT: Disinstalla il programma. + fi: Poistetaan asennus. + es: Se desinstalará. + da: Afinstallerer. + ja: アンインストールします。 + ko: 제거합니다. diff --git a/client/node_modules/app-builder-lib/templates/nsis/common.nsh b/client/node_modules/app-builder-lib/templates/nsis/common.nsh new file mode 100644 index 0000000000..0509c03387 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/common.nsh @@ -0,0 +1,116 @@ +!include x64.nsh +!include WinVer.nsh + +BrandingText "${PRODUCT_NAME} ${VERSION}" +ShowInstDetails nevershow +SpaceTexts none +!ifdef BUILD_UNINSTALLER + ShowUninstDetails nevershow +!endif +FileBufSize 64 +Name "${PRODUCT_NAME}" + +!define APP_EXECUTABLE_FILENAME "${PRODUCT_FILENAME}.exe" +!define UNINSTALL_FILENAME "Uninstall ${PRODUCT_FILENAME}.exe" + +!macro check64BitAndSetRegView + # https://github.com/electron-userland/electron-builder/issues/2420 + ${If} ${IsWin2000} + ${OrIf} ${IsWinME} + ${OrIf} ${IsWinXP} + ${OrIf} ${IsWinVista} + MessageBox MB_OK "$(win7Required)" + Quit + ${EndIf} + + !ifdef APP_ARM64 + ${If} ${RunningX64} + SetRegView 64 + ${EndIf} + ${If} ${IsNativeARM64} + SetRegView 64 + ${EndIf} + !else + !ifdef APP_64 + ${If} ${RunningX64} + SetRegView 64 + ${Else} + !ifndef APP_32 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(x64WinRequired)" + Quit + !endif + ${EndIf} + !endif + !endif +!macroend + +# avoid exit code 2 +!macro quitSuccess + SetErrorLevel 0 + Quit +!macroend + +!macro setLinkVars + # old desktop shortcut (could exist or not since the user might has selected to delete it) + ReadRegStr $oldShortcutName SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" ShortcutName + ${if} $oldShortcutName == "" + StrCpy $oldShortcutName "${PRODUCT_FILENAME}" + ${endIf} + StrCpy $oldDesktopLink "$DESKTOP\$oldShortcutName.lnk" + + # new desktop shortcut (will be created/renamed in case of a fresh installation or if the user haven't deleted the initial one) + StrCpy $newDesktopLink "$DESKTOP\${SHORTCUT_NAME}.lnk" + + ReadRegStr $oldMenuDirectory SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory + ${if} $oldMenuDirectory == "" + StrCpy $oldStartMenuLink "$SMPROGRAMS\$oldShortcutName.lnk" + ${else} + StrCpy $oldStartMenuLink "$SMPROGRAMS\$oldMenuDirectory\$oldShortcutName.lnk" + ${endIf} + + # new menu shortcut (will be created/renamed in case of a fresh installation or if the user haven't deleted the initial one) + !ifdef MENU_FILENAME + StrCpy $newStartMenuLink "$SMPROGRAMS\${MENU_FILENAME}\${SHORTCUT_NAME}.lnk" + !else + StrCpy $newStartMenuLink "$SMPROGRAMS\${SHORTCUT_NAME}.lnk" + !endif +!macroend + +!macro skipPageIfUpdated + !define UniqueID ${__LINE__} + + Function skipPageIfUpdated_${UniqueID} + ${if} ${isUpdated} + Abort + ${endif} + FunctionEnd + + !define MUI_PAGE_CUSTOMFUNCTION_PRE skipPageIfUpdated_${UniqueID} + !undef UniqueID +!macroend + +!macro StartApp + Var /GLOBAL startAppArgs + ${if} ${isUpdated} + StrCpy $startAppArgs "--updated" + ${else} + StrCpy $startAppArgs "" + ${endif} + + ${StdUtils.ExecShellAsUser} $0 "$launchLink" "open" "$startAppArgs" +!macroend + +!define LogSet "!insertmacro LogSetMacro" +!macro LogSetMacro SETTING + !ifdef ENABLE_LOGGING_ELECTRON_BUILDER + SetOutPath $INSTDIR + LogSet ${SETTING} + !endif +!macroend + +!define LogText "!insertmacro LogTextMacroEB" +!macro LogTextMacroEB INPUT_TEXT + !ifdef ENABLE_LOGGING_ELECTRON_BUILDER + LogText ${INPUT_TEXT} + !endif +!macroend \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/empty-license.txt b/client/node_modules/app-builder-lib/templates/nsis/empty-license.txt new file mode 100644 index 0000000000..37d7092512 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/empty-license.txt @@ -0,0 +1 @@ +Loading... \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/FileAssociation.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/FileAssociation.nsh new file mode 100644 index 0000000000..1cabaf41ca --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/FileAssociation.nsh @@ -0,0 +1,132 @@ +; fileassoc.nsh +; File association helper macros +; Written by Saivert +; +; Features automatic backup system and UPDATEFILEASSOC macro for +; shell change notification. +; +; |> How to use <| +; To associate a file with an application so you can double-click it in explorer, use +; the APP_ASSOCIATE macro like this: +; +; Example: +; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "Description of txt files" \ +; "$INSTDIR\myapp.exe,0" "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\"" +; +; Never insert the APP_ASSOCIATE macro multiple times, it is only ment +; to associate an application with a single file and using the +; the "open" verb as default. To add more verbs (actions) to a file +; use the APP_ASSOCIATE_ADDVERB macro. +; +; Example: +; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \ +; "$INSTDIR\myapp.exe /edit $\"%1$\"" +; +; To have access to more options when registering the file association use the +; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the +; standard action (default verb). +; +; Note, that this script takes into account user versus global installs. +; To properly work you must initialize the SHELL_CONTEXT variable via SetShellVarContext. +; +; And finally: To remove the association from the registry use the APP_UNASSOCIATE +; macro. Here is another example just to wrap it up: +; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile" +; +; |> Note <| +; When defining your file class string always use the short form of your application title +; then a period (dot) and the type of file. This keeps the file class sort of unique. +; Examples: +; Winamp.Playlist +; NSIS.Script +; Photoshop.JPEGFile +; +; |> Tech info <| +; The registry key layout for a global file association is: +; +; HKEY_LOCAL_MACHINE\Software\Classes +; <".ext"> = +; = <"description"> +; shell +; = <"menu-item text"> +; command = <"command string"> +; +; +; The registry key layout for a per-user file association is: +; +; HKEY_CURRENT_USER\Software\Classes +; <".ext"> = +; = <"description"> +; shell +; = <"menu-item text"> +; command = <"command string"> +; + +!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND + ; Backup the previously associated file class + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" "" + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0" + + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}" + + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open" + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}` +!macroend + +!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND + ; Backup the previously associated file class + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" "" + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0" + + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}" + StrCmp "${SHELLNEW}" "0" +2 + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}\ShellNew" "NullFile" "" + + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" `${DEFAULTVERB}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}` +!macroend + +!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}` + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}` +!macroend + +!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB + DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}\shell\${VERB}` +!macroend + + +!macro APP_UNASSOCIATE EXT FILECLASS + ; Backup the previously associated file class + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup` + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0" + + DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}` +!macroend + +!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT + ReadRegStr ${OUTPUT} SHELL_CONTEXT "Software\Classes\.${EXT}" "" +!macroend + + +; !defines for use with SHChangeNotify +!ifdef SHCNE_ASSOCCHANGED +!undef SHCNE_ASSOCCHANGED +!endif +!define SHCNE_ASSOCCHANGED 0x08000000 +!ifdef SHCNF_FLUSH +!undef SHCNF_FLUSH +!endif +!define SHCNF_FLUSH 0x1000 + +!macro UPDATEFILEASSOC +; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we +; can update the shell. + System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)" +!macroend \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/StdUtils.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/StdUtils.nsh new file mode 100644 index 0000000000..511e004407 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/StdUtils.nsh @@ -0,0 +1,496 @@ +################################################################################# +# StdUtils plug-in for NSIS +# Copyright (C) 2004-2018 LoRd_MuldeR +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# http://www.gnu.org/licenses/lgpl-2.1.txt +################################################################################# + +# DEVELOPER NOTES: +# - Please see "https://github.com/lordmulder/stdutils/" for news and updates! +# - Please see "Docs\StdUtils\StdUtils.html" for detailed function descriptions! +# - Please see "Examples\StdUtils\StdUtilsTest.nsi" for usage examples! + +################################################################################# +# FUNCTION DECLARTIONS +################################################################################# + +!ifndef ___STDUTILS__NSH___ +!define ___STDUTILS__NSH___ + +!define StdUtils.Time '!insertmacro _StdU_Time' #time(), as in C standard library +!define StdUtils.GetMinutes '!insertmacro _StdU_GetMinutes' #GetSystemTimeAsFileTime(), returns the number of minutes +!define StdUtils.GetHours '!insertmacro _StdU_GetHours' #GetSystemTimeAsFileTime(), returns the number of hours +!define StdUtils.GetDays '!insertmacro _StdU_GetDays' #GetSystemTimeAsFileTime(), returns the number of days +!define StdUtils.Rand '!insertmacro _StdU_Rand' #rand(), as in C standard library +!define StdUtils.RandMax '!insertmacro _StdU_RandMax' #rand(), as in C standard library, with maximum value +!define StdUtils.RandMinMax '!insertmacro _StdU_RandMinMax' #rand(), as in C standard library, with minimum/maximum value +!define StdUtils.RandList '!insertmacro _StdU_RandList' #rand(), as in C standard library, with list support +!define StdUtils.RandBytes '!insertmacro _StdU_RandBytes' #Generates random bytes, returned as Base64-encoded string +!define StdUtils.FormatStr '!insertmacro _StdU_FormatStr' #sprintf(), as in C standard library, one '%d' placeholder +!define StdUtils.FormatStr2 '!insertmacro _StdU_FormatStr2' #sprintf(), as in C standard library, two '%d' placeholders +!define StdUtils.FormatStr3 '!insertmacro _StdU_FormatStr3' #sprintf(), as in C standard library, three '%d' placeholders +!define StdUtils.ScanStr '!insertmacro _StdU_ScanStr' #sscanf(), as in C standard library, one '%d' placeholder +!define StdUtils.ScanStr2 '!insertmacro _StdU_ScanStr2' #sscanf(), as in C standard library, two '%d' placeholders +!define StdUtils.ScanStr3 '!insertmacro _StdU_ScanStr3' #sscanf(), as in C standard library, three '%d' placeholders +!define StdUtils.TrimStr '!insertmacro _StdU_TrimStr' #Remove whitspaces from string, left and right +!define StdUtils.TrimStrLeft '!insertmacro _StdU_TrimStrLeft' #Remove whitspaces from string, left side only +!define StdUtils.TrimStrRight '!insertmacro _StdU_TrimStrRight' #Remove whitspaces from string, right side only +!define StdUtils.RevStr '!insertmacro _StdU_RevStr' #Reverse a string, e.g. "reverse me" <-> "em esrever" +!define StdUtils.ValidFileName '!insertmacro _StdU_ValidFileName' #Test whether string is a valid file name - no paths allowed +!define StdUtils.ValidPathSpec '!insertmacro _StdU_ValidPathSpec' #Test whether string is a valid full(!) path specification +!define StdUtils.ValidDomainName '!insertmacro _StdU_ValidDomain' #Test whether string is a valid host name or domain name +!define StdUtils.StrToUtf8 '!insertmacro _StdU_StrToUtf8' #Convert string from Unicode (UTF-16) or ANSI to UTF-8 bytes +!define StdUtils.StrFromUtf8 '!insertmacro _StdU_StrFromUtf8' #Convert string from UTF-8 bytes to Unicode (UTF-16) or ANSI +!define StdUtils.SHFileMove '!insertmacro _StdU_SHFileMove' #SHFileOperation(), using the FO_MOVE operation +!define StdUtils.SHFileCopy '!insertmacro _StdU_SHFileCopy' #SHFileOperation(), using the FO_COPY operation +!define StdUtils.AppendToFile '!insertmacro _StdU_AppendToFile' #Append contents of an existing file to another file +!define StdUtils.ExecShellAsUser '!insertmacro _StdU_ExecShlUser' #ShellExecute() as NON-elevated user from elevated installer +!define StdUtils.InvokeShellVerb '!insertmacro _StdU_InvkeShlVrb' #Invokes a "shell verb", e.g. for pinning items to the taskbar +!define StdUtils.ExecShellWaitEx '!insertmacro _StdU_ExecShlWaitEx' #ShellExecuteEx(), returns the handle of the new process +!define StdUtils.WaitForProcEx '!insertmacro _StdU_WaitForProcEx' #WaitForSingleObject(), e.g. to wait for a running process +!define StdUtils.GetParameter '!insertmacro _StdU_GetParameter' #Get the value of a specific command-line option +!define StdUtils.TestParameter '!insertmacro _StdU_TestParameter' #Test whether a specific command-line option has been set +!define StdUtils.ParameterCnt '!insertmacro _StdU_ParameterCnt' #Get number of command-line tokens, similar to argc in main() +!define StdUtils.ParameterStr '!insertmacro _StdU_ParameterStr' #Get the n-th command-line token, similar to argv[i] in main() +!define StdUtils.GetAllParameters '!insertmacro _StdU_GetAllParams' #Get complete command-line, but without executable name +!define StdUtils.GetRealOSVersion '!insertmacro _StdU_GetRealOSVer' #Get the *real* Windows version number, even on Windows 8.1+ +!define StdUtils.GetRealOSBuildNo '!insertmacro _StdU_GetRealOSBld' #Get the *real* Windows build number, even on Windows 8.1+ +!define StdUtils.GetRealOSName '!insertmacro _StdU_GetRealOSStr' #Get the *real* Windows version, as a "friendly" name +!define StdUtils.GetOSEdition '!insertmacro _StdU_GetOSEdition' #Get the Windows edition, i.e. "workstation" or "server" +!define StdUtils.GetOSReleaseId '!insertmacro _StdU_GetOSRelIdNo' #Get the Windows release identifier (on Windows 10) +!define StdUtils.VerifyOSVersion '!insertmacro _StdU_VrfyRealOSVer' #Compare *real* operating system to an expected version number +!define StdUtils.VerifyOSBuildNo '!insertmacro _StdU_VrfyRealOSBld' #Compare *real* operating system to an expected build number +!define StdUtils.HashText '!insertmacro _StdU_HashText' #Compute hash from text string (CRC32, MD5, SHA1/2/3, BLAKE2) +!define StdUtils.HashFile '!insertmacro _StdU_HashFile' #Compute hash from file (CRC32, MD5, SHA1/2/3, BLAKE2) +!define StdUtils.NormalizePath '!insertmacro _StdU_NormalizePath' #Simplifies the path to produce a direct, well-formed path +!define StdUtils.GetParentPath '!insertmacro _StdU_GetParentPath' #Get parent path by removing the last component from the path +!define StdUtils.SplitPath '!insertmacro _StdU_SplitPath' #Split the components of the given path +!define StdUtils.GetDrivePart '!insertmacro _StdU_GetDrivePart' #Get drive component of path +!define StdUtils.GetDirectoryPart '!insertmacro _StdU_GetDirPart' #Get directory component of path +!define StdUtils.GetFileNamePart '!insertmacro _StdU_GetFNamePart' #Get file name component of path +!define StdUtils.GetExtensionPart '!insertmacro _StdU_GetExtnPart' #Get file extension component of path +!define StdUtils.TimerCreate '!insertmacro _StdU_TimerCreate' #Create a new event-timer that will be triggered periodically +!define StdUtils.TimerDestroy '!insertmacro _StdU_TimerDestroy' #Destroy a running timer created with TimerCreate() +!define StdUtils.ProtectStr '!insertmacro _StdU_PrtctStr' #Protect a given String using Windows' DPAPI +!define StdUtils.UnprotectStr '!insertmacro _StdU_UnprtctStr' #Unprotect a string that was protected via ProtectStr() +!define StdUtils.GetLibVersion '!insertmacro _StdU_GetLibVersion' #Get the current StdUtils library version (for debugging) +!define StdUtils.SetVerbose '!insertmacro _StdU_SetVerbose' #Enable or disable "verbose" mode (for debugging) + + +################################################################################# +# MACRO DEFINITIONS +################################################################################# + +!macro _StdU_Time out + StdUtils::Time /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetMinutes out + StdUtils::GetMinutes /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetHours out + StdUtils::GetHours /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetDays out + StdUtils::GetDays /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_Rand out + StdUtils::Rand /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_RandMax out max + push ${max} + StdUtils::RandMax /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_RandMinMax out min max + push ${min} + push ${max} + StdUtils::RandMinMax /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_RandList count max + push ${max} + push ${count} + StdUtils::RandList /NOUNLOAD +!macroend + +!macro _StdU_RandBytes out count + push ${count} + StdUtils::RandBytes /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_FormatStr out format val + push `${format}` + push ${val} + StdUtils::FormatStr /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_FormatStr2 out format val1 val2 + push `${format}` + push ${val1} + push ${val2} + StdUtils::FormatStr2 /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_FormatStr3 out format val1 val2 val3 + push `${format}` + push ${val1} + push ${val2} + push ${val3} + StdUtils::FormatStr3 /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ScanStr out format input default + push `${format}` + push `${input}` + push ${default} + StdUtils::ScanStr /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ScanStr2 out1 out2 format input default1 default2 + push `${format}` + push `${input}` + push ${default1} + push ${default2} + StdUtils::ScanStr2 /NOUNLOAD + pop ${out1} + pop ${out2} +!macroend + +!macro _StdU_ScanStr3 out1 out2 out3 format input default1 default2 default3 + push `${format}` + push `${input}` + push ${default1} + push ${default2} + push ${default3} + StdUtils::ScanStr3 /NOUNLOAD + pop ${out1} + pop ${out2} + pop ${out3} +!macroend + +!macro _StdU_TrimStr var + push ${var} + StdUtils::TrimStr /NOUNLOAD + pop ${var} +!macroend + +!macro _StdU_TrimStrLeft var + push ${var} + StdUtils::TrimStrLeft /NOUNLOAD + pop ${var} +!macroend + +!macro _StdU_TrimStrRight var + push ${var} + StdUtils::TrimStrRight /NOUNLOAD + pop ${var} +!macroend + +!macro _StdU_RevStr var + push ${var} + StdUtils::RevStr /NOUNLOAD + pop ${var} +!macroend + +!macro _StdU_ValidFileName out test + push `${test}` + StdUtils::ValidFileName /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ValidPathSpec out test + push `${test}` + StdUtils::ValidPathSpec /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ValidDomain out test + push `${test}` + StdUtils::ValidDomainName /NOUNLOAD + pop ${out} +!macroend + + +!macro _StdU_StrToUtf8 out str + push `${str}` + StdUtils::StrToUtf8 /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_StrFromUtf8 out trnc str + push ${trnc} + push `${str}` + StdUtils::StrFromUtf8 /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_SHFileMove out from to hwnd + push `${from}` + push `${to}` + push ${hwnd} + StdUtils::SHFileMove /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_SHFileCopy out from to hwnd + push `${from}` + push `${to}` + push ${hwnd} + StdUtils::SHFileCopy /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_AppendToFile out from dest offset maxlen + push `${from}` + push `${dest}` + push ${offset} + push ${maxlen} + StdUtils::AppendToFile /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ExecShlUser out file verb args + push `${file}` + push `${verb}` + push `${args}` + StdUtils::ExecShellAsUser /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_InvkeShlVrb out path file verb_id + push "${path}" + push "${file}" + push ${verb_id} + StdUtils::InvokeShellVerb /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ExecShlWaitEx out_res out_val file verb args + push `${file}` + push `${verb}` + push `${args}` + StdUtils::ExecShellWaitEx /NOUNLOAD + pop ${out_res} + pop ${out_val} +!macroend + +!macro _StdU_WaitForProcEx out handle + push `${handle}` + StdUtils::WaitForProcEx /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetParameter out name default + push `${name}` + push `${default}` + StdUtils::GetParameter /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_TestParameter out name + push `${name}` + StdUtils::TestParameter /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ParameterCnt out + StdUtils::ParameterCnt /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_ParameterStr out index + push ${index} + StdUtils::ParameterStr /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetAllParams out truncate + push `${truncate}` + StdUtils::GetAllParameters /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetRealOSVer out_major out_minor out_spack + StdUtils::GetRealOsVersion /NOUNLOAD + pop ${out_major} + pop ${out_minor} + pop ${out_spack} +!macroend + +!macro _StdU_GetRealOSBld out + StdUtils::GetRealOsBuildNo /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetRealOSStr out + StdUtils::GetRealOsName /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_VrfyRealOSVer out major minor spack + push `${major}` + push `${minor}` + push `${spack}` + StdUtils::VerifyRealOsVersion /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_VrfyRealOSBld out build + push `${build}` + StdUtils::VerifyRealOsBuildNo /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetOSEdition out + StdUtils::GetOsEdition /NOUNLOAD + pop ${out} +!macroend + + +!macro _StdU_GetOSRelIdNo out + StdUtils::GetOsReleaseId /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_HashText out type text + push `${type}` + push `${text}` + StdUtils::HashText /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_HashFile out type file + push `${type}` + push `${file}` + StdUtils::HashFile /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_NormalizePath out path + push `${path}` + StdUtils::NormalizePath /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetParentPath out path + push `${path}` + StdUtils::GetParentPath /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_SplitPath out_drive out_dir out_fname out_ext path + push `${path}` + StdUtils::SplitPath /NOUNLOAD + pop ${out_drive} + pop ${out_dir} + pop ${out_fname} + pop ${out_ext} +!macroend + +!macro _StdU_GetDrivePart out path + push `${path}` + StdUtils::GetDrivePart /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetDirPart out path + push `${path}` + StdUtils::GetDirectoryPart /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetFNamePart out path + push `${path}` + StdUtils::GetFileNamePart /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetExtnPart out path + push `${path}` + StdUtils::GetExtensionPart /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_TimerCreate out callback interval + GetFunctionAddress ${out} ${callback} + push ${out} + push ${interval} + StdUtils::TimerCreate /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_TimerDestroy out timer_id + push ${timer_id} + StdUtils::TimerDestroy /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_PrtctStr out dpsc salt text + push `${dpsc}` + push `${salt}` + push `${text}` + StdUtils::ProtectStr /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_UnprtctStr out trnc salt data + push `${trnc}` + push `${salt}` + push `${data}` + StdUtils::UnprotectStr /NOUNLOAD + pop ${out} +!macroend + +!macro _StdU_GetLibVersion out_ver out_tst + StdUtils::GetLibVersion /NOUNLOAD + pop ${out_ver} + pop ${out_tst} +!macroend + +!macro _StdU_SetVerbose enable + Push ${enable} + StdUtils::SetVerboseMode /NOUNLOAD +!macroend + + +################################################################################# +# MAGIC NUMBERS +################################################################################# + +!define StdUtils.Const.ShellVerb.PinToTaskbar 0 +!define StdUtils.Const.ShellVerb.UnpinFromTaskbar 1 +!define StdUtils.Const.ShellVerb.PinToStart 2 +!define StdUtils.Const.ShellVerb.UnpinFromStart 3 + +!endif # !___STDUTILS__NSH___ diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/StrContains.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/StrContains.nsh new file mode 100644 index 0000000000..c7d395cd81 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/StrContains.nsh @@ -0,0 +1,48 @@ +; StrContains +; This function does a case sensitive searches for an occurrence of a substring in a string. +; It returns the substring if it is found. +; Otherwise it returns null(""). +; Written by kenglish_hi +; Adapted from StrReplace written by dandaman32 + + +Var STR_HAYSTACK +Var STR_NEEDLE +Var STR_CONTAINS_VAR_1 +Var STR_CONTAINS_VAR_2 +Var STR_CONTAINS_VAR_3 +Var STR_CONTAINS_VAR_4 +Var STR_RETURN_VAR + +Function StrContains + Exch $STR_NEEDLE + Exch 1 + Exch $STR_HAYSTACK + ; Uncomment to debug + ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK ' + StrCpy $STR_RETURN_VAR "" + StrCpy $STR_CONTAINS_VAR_1 -1 + StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE + StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK + loop: + IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1 + StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1 + StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found + StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done + Goto loop + found: + StrCpy $STR_RETURN_VAR $STR_NEEDLE + Goto done + done: + Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the + Exch $STR_RETURN_VAR +FunctionEnd + +!macro _StrContainsConstructor OUT NEEDLE HAYSTACK + Push `${HAYSTACK}` + Push `${NEEDLE}` + Call StrContains + Pop `${OUT}` +!macroend + +!define StrContains '!insertmacro "_StrContainsConstructor"' \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/UAC.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/UAC.nsh new file mode 100644 index 0000000000..08979aba97 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/UAC.nsh @@ -0,0 +1,299 @@ +/*** UAC Plug-in *** + +Interactive User (MediumIL) Admin user (HighIL) +***[Setup.exe]************* ***[Setup.exe]************** +* * * * +* +++[.OnInit]+++++++++++ * * +++[.OnInit]++++++++++++ * +* + UAC_RunElevated >---+-+----> * + + * +* + NSIS.Quit + * * + + * +* +++++++++++++++++++++++ * * ++++++++++++++++++++++++ * +* * * * +* * * * +* +++[Section]+++++++++++ * * +++[Section]++++++++++++ * +* + + * /--+-+- +** +** Get integrity level of current process +** +**/ +!macro UAC_GetIntegrityLevel outvar +UAC::_ 6 +!if "${outvar}" != "s" + Pop ${outvar} +!endif +!macroend + + + +/* UAC_IsAdmin +** +** Is the current process running with administrator privileges? Result in $0 +** +** ${If} ${UAC_IsAdmin} ... +** +**/ +!macro UAC_IsAdmin +UAC::_ 2 +!macroend +!define UAC_IsAdmin `"" UAC_IsAdmin ""` +!macro _UAC_IsAdmin _a _b _t _f +!insertmacro _UAC_MakeLL_Cmp _!= 0 2s +!macroend + + + +/* UAC_IsInnerInstance +** +** Does the current process have a NSIS/UAC parent process that is part of the elevation operation? +** +** ${If} ${UAC_IsInnerInstance} ... +** +**/ +!macro UAC_IsInnerInstance +UAC::_ 3 +!macroend +!define UAC_IsInnerInstance `"" UAC_IsInnerInstance ""` +!macro _UAC_IsInnerInstance _a _b _t _f +!insertmacro _UAC_MakeLL_Cmp _!= 0 3s +!macroend + + + +/* UAC_PageElevation_OnInit, UAC_PageElevation_OnGuiInit, +** +** Helper macros for elevation on a custom elevation page, see the DualMode example for more information. +** +**/ +!macro UAC_Notify_OnGuiInit +UAC::_ 4 +!macroend +!macro UAC_PageElevation_OnGuiInit +!insertmacro UAC_Notify_OnGuiInit +!macroend +!macro UAC_PageElevation_OnInit +UAC::_ 5 +${IfThen} ${Errors} ${|} Quit ${|} +!macroend + + + +/* UAC_AsUser_Call +** +** Calls a function or label in the user process instance. +** All the UAC_AsUser_* macros use this helper macro. +** +**/ +!define UAC_SYNCREGISTERS 0x1 +;define UAC_SYNCSTACK 0x2 +!define UAC_SYNCOUTDIR 0x4 +!define UAC_SYNCINSTDIR 0x8 +;define UAC_CLEARERRFLAG 0x10 +!macro UAC_AsUser_Call type name flags +push $0 +Get${type}Address $0 ${name} +!verbose push +!verbose ${UAC_VERBOSE} +!insertmacro _UAC_ParseDefineFlagsToInt _UAC_AsUser_Call__flags ${flags} +!verbose pop +StrCpy $0 "1$0:${_UAC_AsUser_Call__flags}" +!undef _UAC_AsUser_Call__flags +Exch $0 +UAC::_ +!macroend + + + +/* +** UAC_AsUser_GetSection +*/ +!macro UAC_AsUser_GetSection secprop secidx outvar +!insertmacro _UAC_AsUser_GenOp ${outvar} SectionGet${secprop} ${secidx} "" +!macroend + + + +/* +** UAC_AsUser_GetGlobalVar +** UAC_AsUser_GetGlobal +*/ +!macro UAC_AsUser_GetGlobalVar var +!insertmacro _UAC_AsUser_GenOp ${var} StrCpy "" ${var} +!macroend +!macro UAC_AsUser_GetGlobal outvar srcvar +!insertmacro _UAC_AsUser_GenOp ${outvar} StrCpy "" ${srcvar} +!macroend + + + +/* +** UAC_AsUser_ExecShell +** +** Call ExecShell in the user process instance. +** +*/ +!macro UAC_AsUser_ExecShell verb command params workdir show +!insertmacro _UAC_IncL +goto _UAC_L_E_${__UAC_L} +_UAC_L_F_${__UAC_L}: +ExecShell "${verb}" "${command}" '${params}' ${show} +return +_UAC_L_E_${__UAC_L}: +!if "${workdir}" != "" + push $outdir + SetOutPath "${workdir}" +!endif +!insertmacro UAC_AsUser_Call Label _UAC_L_F_${__UAC_L} ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR} #|${UAC_CLEARERRFLAG} +!if "${workdir}" != "" + pop $outdir + SetOutPath $outdir +!endif +!macroend + + + +!macro _UAC_MakeLL_Cmp cmpop cmp pluginparams +!insertmacro _LOGICLIB_TEMP +UAC::_ ${pluginparams} +pop $_LOGICLIB_TEMP +!insertmacro ${cmpop} $_LOGICLIB_TEMP ${cmp} `${_t}` `${_f}` +!macroend +!macro _UAC_definemath def val1 op val2 +!define /math _UAC_definemath "${val1}" ${op} ${val2} +!ifdef ${def} + !undef ${def} +!endif +!define ${def} "${_UAC_definemath}" +!undef _UAC_definemath +!macroend +!macro _UAC_ParseDefineFlags_orin parse outflags +!searchparse /noerrors ${${parse}} "" _UAC_ParseDefineFlags_orin_f1 "|" _UAC_ParseDefineFlags_orin_f2 +!define _UAC_ParseDefineFlags_orin_this ${_UAC_ParseDefineFlags_orin_f1} +!undef ${parse} +!define ${parse} ${_UAC_ParseDefineFlags_orin_f2} +!define _UAC_ParseDefineFlags_orin_saveout ${${outflags}} +!undef ${outflags} +!define /math ${outflags} "${_UAC_ParseDefineFlags_orin_saveout}" | "${_UAC_ParseDefineFlags_orin_this}" +!undef _UAC_ParseDefineFlags_orin_saveout +!undef _UAC_ParseDefineFlags_orin_this +!ifdef _UAC_ParseDefineFlags_orin_f1 + !undef _UAC_ParseDefineFlags_orin_f1 +!endif +!ifdef _UAC_ParseDefineFlags_orin_f2 + !undef _UAC_ParseDefineFlags_orin_f2 +!endif +!macroend +!macro _UAC_ParseDefineFlags_Begin _outdef _in +!define _UAC_PDF${_outdef}_parse "${_in}" +!define _UAC_PDF${_outdef}_flags "" +!define _UAC_PDF${_outdef}_r 0 +!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x1 +!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x2 +!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x4 +!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x8 +!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x10 +!macroend +!macro _UAC_ParseDefineFlags_End _outdef +!define ${_outdef} ${_UAC_PDF${_outdef}_r} +!undef _UAC_PDF${_outdef}_r +!undef _UAC_PDF${_outdef}_flags +!undef _UAC_PDF${_outdef}_parse +!macroend +!macro _UAC_ParseDefineFlags_IncludeFlag _outdef flag +!if ${_UAC_PDF${_outdef}_flags} & ${flag} + !insertmacro _UAC_definemath _UAC_PDF${_outdef}_r ${_UAC_PDF${_outdef}_r} | ${flag} +!endif +!macroend +!macro _UAC_ParseDefineFlagsToInt _outdef _in +!insertmacro _UAC_ParseDefineFlags_Begin _UAC_ParseDefineFlagsToInt_tmp "${_in}" +!define ${_outdef} ${_UAC_PDF_UAC_ParseDefineFlagsToInt_tmp_flags} +!insertmacro _UAC_ParseDefineFlags_End _UAC_ParseDefineFlagsToInt_tmp +!undef _UAC_ParseDefineFlagsToInt_tmp +!macroend +!macro _UAC_IncL +!insertmacro _UAC_definemath __UAC_L "${__UAC_L}" + 1 +!macroend +!macro _UAC_AsUser_GenOp outvar op opparam1 opparam2 +!define _UAC_AUGOGR_ID _UAC_AUGOGR_OP${outvar}${op}${opparam1}${opparam2} +!ifndef ${_UAC_AUGOGR_ID} ;Has this exact action been done before? + !if ${outvar} == $0 + !define ${_UAC_AUGOGR_ID} $1 + !else + !define ${_UAC_AUGOGR_ID} $0 + !endif + !if "${opparam1}" == "" + !define _UAC_AUGOGR_OPP1 ${${_UAC_AUGOGR_ID}} + !define _UAC_AUGOGR_OPP2 ${opparam2} + !else + !define _UAC_AUGOGR_OPP1 ${opparam1} + !define _UAC_AUGOGR_OPP2 ${${_UAC_AUGOGR_ID}} + !endif + goto ${_UAC_AUGOGR_ID}_C + ${_UAC_AUGOGR_ID}_F: + ${op} ${_UAC_AUGOGR_OPP1} ${_UAC_AUGOGR_OPP2} + return + ${_UAC_AUGOGR_ID}_C: + !undef _UAC_AUGOGR_OPP1 + !undef _UAC_AUGOGR_OPP2 +!endif +push ${${_UAC_AUGOGR_ID}} +!insertmacro UAC_AsUser_Call Label ${_UAC_AUGOGR_ID}_F ${UAC_SYNCREGISTERS} +StrCpy ${outvar} ${${_UAC_AUGOGR_ID}} +pop ${${_UAC_AUGOGR_ID}} +!undef _UAC_AUGOGR_ID +!macroend + + + +!verbose pop +!endif /* UAC_HDR__INC */ \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh new file mode 100644 index 0000000000..a1fd1875d8 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh @@ -0,0 +1,118 @@ +!ifndef nsProcess::FindProcess + !include "nsProcess.nsh" +!endif + +!ifmacrondef customCheckAppRunning + !include "getProcessInfo.nsh" + Var pid +!endif + +# http://nsis.sourceforge.net/Allow_only_one_installer_instance +!macro ALLOW_ONLY_ONE_INSTALLER_INSTANCE + BringToFront + !define /ifndef SYSTYPE_PTR p ; NSIS v3.0+ + System::Call 'kernel32::CreateMutex(${SYSTYPE_PTR}0, i1, t"${APP_GUID}")?e' + Pop $0 + IntCmpU $0 183 0 launch launch ; ERROR_ALREADY_EXISTS + StrLen $0 "$(^SetupCaption)" + IntOp $0 $0 + 1 ; GetWindowText count includes \0 + StrCpy $1 "" ; Start FindWindow with NULL + loop: + FindWindow $1 "#32770" "" "" $1 + StrCmp 0 $1 notfound + System::Call 'user32::GetWindowText(${SYSTYPE_PTR}r1, t.r2, ir0)' + StrCmp $2 "$(^SetupCaption)" 0 loop + SendMessage $1 0x112 0xF120 0 /TIMEOUT=2000 ; WM_SYSCOMMAND:SC_RESTORE to restore the window if it is minimized + System::Call "user32::SetForegroundWindow(${SYSTYPE_PTR}r1)" + notfound: + Abort + launch: +!macroend + +!macro CHECK_APP_RUNNING + !ifmacrodef customCheckAppRunning + !insertmacro customCheckAppRunning + !else + !insertmacro _CHECK_APP_RUNNING + !endif +!macroend + +!macro FIND_PROCESS _FILE _ERR + !ifdef INSTALL_MODE_PER_ALL_USERS + ${nsProcess::FindProcess} "${_FILE}" ${_ERR} + !else + # find process owned by current user + nsExec::Exec `cmd /c tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq ${_FILE}" | %SYSTEMROOT%\System32\find.exe "${_FILE}"` + Pop ${_ERR} + !endif +!macroend + +!macro _CHECK_APP_RUNNING + ${GetProcessInfo} 0 $pid $1 $2 $3 $4 + ${if} $3 != "${APP_EXECUTABLE_FILENAME}" + ${if} ${isUpdated} + # allow app to exit without explicit kill + Sleep 300 + ${endIf} + + !insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0 + ${if} $R0 == 0 + ${if} ${isUpdated} + # allow app to exit without explicit kill + Sleep 1000 + Goto doStopProcess + ${endIf} + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(appRunning)" /SD IDOK IDOK doStopProcess + Quit + + doStopProcess: + + DetailPrint `Closing running "${PRODUCT_NAME}"...` + + # https://github.com/electron-userland/electron-builder/issues/2516#issuecomment-372009092 + !ifdef INSTALL_MODE_PER_ALL_USERS + nsExec::Exec `taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` + !else + nsExec::Exec `cmd /c taskkill /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid" /fi "USERNAME eq %USERNAME%"` + !endif + # to ensure that files are not "in-use" + Sleep 300 + + # Retry counter + StrCpy $R1 0 + + loop: + IntOp $R1 $R1 + 1 + + !insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0 + ${if} $R0 == 0 + # wait to give a chance to exit gracefully + Sleep 1000 + !ifdef INSTALL_MODE_PER_ALL_USERS + nsExec::Exec `taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid"` + !else + nsExec::Exec `cmd /c taskkill /f /im "${APP_EXECUTABLE_FILENAME}" /fi "PID ne $pid" /fi "USERNAME eq %USERNAME%"` + !endif + !insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0 + ${If} $R0 == 0 + DetailPrint `Waiting for "${PRODUCT_NAME}" to close.` + Sleep 2000 + ${else} + Goto not_running + ${endIf} + ${else} + Goto not_running + ${endIf} + + # App likely running with elevated permissions. + # Ask user to close it manually + ${if} $R1 > 1 + MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDCANCEL IDRETRY loop + Quit + ${else} + Goto loop + ${endIf} + not_running: + ${endIf} + ${endIf} +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/extractAppPackage.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/extractAppPackage.nsh new file mode 100644 index 0000000000..f5470bf52e --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/extractAppPackage.nsh @@ -0,0 +1,138 @@ +!macro extractEmbeddedAppPackage + !ifdef COMPRESS + SetCompress off + !endif + + Var /GLOBAL packageArch + + !insertmacro identify_package + !insertmacro compute_files_for_current_arch + + !ifdef COMPRESS + SetCompress "${COMPRESS}" + !endif + + !insertmacro decompress + !insertmacro custom_files_post_decompression +!macroend + +!macro identify_package + !ifdef APP_32 + StrCpy $packageArch "32" + !endif + !ifdef APP_64 + ${if} ${RunningX64} + ${OrIf} ${IsNativeARM64} + StrCpy $packageArch "64" + ${endif} + !endif + !ifdef APP_ARM64 + ${if} ${IsNativeARM64} + StrCpy $packageArch "ARM64" + ${endif} + !endif +!macroend + +!macro compute_files_for_current_arch + ${if} $packageArch == "ARM64" + !ifdef APP_ARM64 + !insertmacro arm64_app_files + !endif + ${elseif} $packageArch == "64" + !ifdef APP_64 + !insertmacro x64_app_files + !endif + ${else} + !ifdef APP_32 + !insertmacro ia32_app_files + !endif + ${endIf} +!macroend + +!macro custom_files_post_decompression + ${if} $packageArch == "ARM64" + !ifmacrodef customFiles_arm64 + !insertmacro customFiles_arm64 + !endif + ${elseif} $packageArch == "64" + !ifmacrodef customFiles_x64 + !insertmacro customFiles_x64 + !endif + ${else} + !ifmacrodef customFiles_ia32 + !insertmacro customFiles_ia32 + !endif + ${endIf} +!macroend + +!macro arm64_app_files + File /oname=$PLUGINSDIR\app-arm64.${COMPRESSION_METHOD} "${APP_ARM64}" +!macroend + +!macro x64_app_files + File /oname=$PLUGINSDIR\app-64.${COMPRESSION_METHOD} "${APP_64}" +!macroend + +!macro ia32_app_files + File /oname=$PLUGINSDIR\app-32.${COMPRESSION_METHOD} "${APP_32}" +!macroend + +!macro decompress + !ifdef ZIP_COMPRESSION + nsisunz::Unzip "$PLUGINSDIR\app-$packageArch.zip" "$INSTDIR" + Pop $R0 + StrCmp $R0 "success" +3 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(decompressionFailed)$\n$R0" + Quit + !else + !insertmacro extractUsing7za "$PLUGINSDIR\app-$packageArch.7z" + !endif +!macroend + +!macro extractUsing7za FILE + Push $OUTDIR + CreateDirectory "$PLUGINSDIR\7z-out" + ClearErrors + SetOutPath "$PLUGINSDIR\7z-out" + Nsis7z::Extract "${FILE}" + Pop $R0 + SetOutPath $R0 + + # Retry counter + StrCpy $R1 0 + + LoopExtract7za: + IntOp $R1 $R1 + 1 + + # Attempt to copy files in atomic way + CopyFiles /SILENT "$PLUGINSDIR\7z-out\*" $OUTDIR + IfErrors 0 DoneExtract7za + + DetailPrint `Can't modify "${PRODUCT_NAME}"'s files.` + ${if} $R1 < 5 + # Try copying a few times before asking for a user action. + Goto RetryExtract7za + ${else} + MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDRETRY IDCANCEL AbortExtract7za + ${endIf} + + # As an absolutely last resort after a few automatic attempts and user + # intervention - we will just overwrite everything with `Nsis7z::Extract` + # even though it is not atomic and will ignore errors. + + # Clear the temporary folder first to make sure we don't use twice as + # much disk space. + RMDir /r "$PLUGINSDIR\7z-out" + + Nsis7z::Extract "${FILE}" + Goto DoneExtract7za + + AbortExtract7za: + Quit + + RetryExtract7za: + Sleep 1000 + Goto LoopExtract7za + + DoneExtract7za: +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/getProcessInfo.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/getProcessInfo.nsh new file mode 100644 index 0000000000..9c44a8a530 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/getProcessInfo.nsh @@ -0,0 +1,157 @@ +; NSIS PROCESS INFO LIBRARY - GetProcessInfo.nsh +; Version 1.1 - Mar 28th, 2011 +; +; Description: +; Gets process information. +; +; Usage example: +; ${GetProcessInfo} 0 $0 $1 $2 $3 $4 +; DetailPrint "pid=$0 parent_pid=$1 priority=$2 process_name=$3 exe=$4" +; +; History: +; 1.1 - 28/03/2011 - Added uninstall function, include guards, file header. Fixed getting full exe path on pre vista systems. (Sergius) +; + +!ifndef GETPROCESSINFO_INCLUDED +!define GETPROCESSINFO_INCLUDED + +!define PROCESSINFO.TH32CS_SNAPPROCESS 2 +!define PROCESSINFO.INVALID_HANDLE_VALUE -1 + +!define GetProcessInfo '!insertmacro GetProcessInfo' + +;@in pid_in - if 0 - get current process info +;@out pid_out - real process id (may be useful, if pid_in=0) +;@out ppid - parent process id +;@out priority +;@out name - name of process +;@out fullname - fully-qualified path of process +!macro GetProcessInfo pid_in pid_out ppid priority name fullname + Push ${pid_in} + !ifdef BUILD_UNINSTALLER + Call un._GetProcessInfo + !else + Call _GetProcessInfo + !endif + ;name;pri;ppid;fname;pid; + Pop ${name} + Pop ${priority} + Pop ${ppid} + Pop ${fullname} + Pop ${pid_out} +!macroend + +!macro FUNC_GETPROCESSINFO + Exch $R3 ;pid + Push $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $R0 ;hSnapshot + Push $R1 ;result + Push $R9 ;PROCESSENTRY32;MODULEENTRY32 and so on + Push $R8 + + ;zero registers to waste trash, if error occurred + StrCpy $0 "" + StrCpy $1 "" + StrCpy $2 "" + StrCpy $3 "" + StrCpy $4 "" + StrCpy $5 "" + + IntCmp $R3 0 0 skip_pid_detection skip_pid_detection + System::Call 'kernel32::GetCurrentProcess() i.R0' + System::Call "Kernel32::GetProcessId(i R0) i.R3" + +skip_pid_detection: + System::Call 'Kernel32::CreateToolhelp32Snapshot(i ${PROCESSINFO.TH32CS_SNAPPROCESS},i R3) i.R0' + + IntCmp $R0 ${PROCESSINFO.INVALID_HANDLE_VALUE} end ;someting wrong + + ;$R9=PROCESSENTRY32 + ;typedef struct tagPROCESSENTRY32 { + ; DWORD dwSize; + ; DWORD cntUsage; + ; DWORD th32ProcessID; + ; ULONG_PTR th32DefaultHeapID; + ; DWORD th32ModuleID; + ; DWORD cntThreads; + ; DWORD th32ParentProcessID; + ; LONG pcPriClassBase; + ; DWORD dwFlags; + ; TCHAR szExeFile[MAX_PATH]; + ;}PROCESSENTRY32, *PPROCESSENTRY32; + ;dwSize=4*9+2*260 + + System::Alloc 1024 + pop $R9 + System::Call "*$R9(i 556)" + + System::Call 'Kernel32::Process32FirstW(i R0, i $R9) i.R1' + StrCmp $R1 0 end + +nnext_iteration: + System::Call "*$R9(i,i,i.R1)" ;get PID + IntCmp $R1 $R3 exitloop + + System::Call 'Kernel32::Process32NextW(i R0, i $R9) i.R1' + IntCmp $R1 0 0 nnext_iteration nnext_iteration + +exitloop: + ;$0 - pid + ;$1 - threads + ;$2 - ppid + ;$3 - priority + ;$4 - process name + System::Call "*$R9(i,i,i.r0,i,i,i.r1,i.r2,i.r3,i,&w256.r4)" ; Get next module + + ;free: + System::Free $R9 + System::Call "Kernel32::CloseToolhelp32Snapshot(i R0)" + + ;=============== + ;now get full path and commandline + + System::Call "Kernel32::OpenProcess(i 1040, i 0, i r0)i .R0" + + StrCmp $R0 0 end + + IntOp $R8 0 + 256 + System::Call "psapi::GetModuleFileNameExW(i R0,i 0,t .r5, *i $R8)i .R1" + +end: + Pop $R8 + Pop $R9 + Pop $R1 + Pop $R0 + Exch $5 + Exch 1 + Exch $4 + Exch 2 + Exch $3 + Exch 3 + Exch $2 + Exch 4 + Pop $1 + Exch 4 + Exch $0 + Exch 5 + Pop $R3 +!macroend ;FUNC_GETPROCESSINFO + +!ifndef BUILD_UNINSTALLER +Function _GetProcessInfo + !insertmacro FUNC_GETPROCESSINFO +FunctionEnd +!endif + +!ifdef BUILD_UNINSTALLER +Function un._GetProcessInfo + !insertmacro FUNC_GETPROCESSINFO +FunctionEnd +!endif + +!endif ;GETPROCESSINFO_INCLUDED \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/installUtil.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/installUtil.nsh new file mode 100644 index 0000000000..4736774163 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/installUtil.nsh @@ -0,0 +1,248 @@ +!macro moveFile FROM TO + ClearErrors + Rename `${FROM}` `${TO}` + ${if} ${errors} + # not clear - can NSIS rename on another drive or not, so, in case of error, just copy + ClearErrors + !insertmacro copyFile `${FROM}` `${TO}` + Delete `${FROM}` + ${endif} +!macroend + +!macro copyFile FROM TO + ${StdUtils.GetParentPath} $R5 `${TO}` + CreateDirectory `$R5` + ClearErrors + CopyFiles /SILENT `${FROM}` `${TO}` +!macroend + +Function GetInQuotes + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R2 -1 + IntOp $R2 $R2 + 1 + StrCpy $R3 $R0 1 $R2 + StrCmp $R3 "" 0 +3 + StrCpy $R0 "" + Goto Done + StrCmp $R3 '"' 0 -5 + + IntOp $R2 $R2 + 1 + StrCpy $R0 $R0 "" $R2 + + StrCpy $R2 0 + IntOp $R2 $R2 + 1 + StrCpy $R3 $R0 1 $R2 + StrCmp $R3 "" 0 +3 + StrCpy $R0 "" + Goto Done + StrCmp $R3 '"' 0 -5 + + StrCpy $R0 $R0 $R2 + Done: + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +!macro GetInQuotes Var Str + Push "${Str}" + Call GetInQuotes + Pop "${Var}" +!macroend + +Function GetFileParent + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R1 0 + StrLen $R2 $R0 + + loop: + IntOp $R1 $R1 + 1 + IntCmp $R1 $R2 get 0 get + StrCpy $R3 $R0 1 -$R1 + StrCmp $R3 "\" get + Goto loop + + get: + StrCpy $R0 $R0 -$R1 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Var /GLOBAL isTryToKeepShortcuts + +!macro setIsTryToKeepShortcuts + StrCpy $isTryToKeepShortcuts "true" + !ifdef allowToChangeInstallationDirectory + ${ifNot} ${isUpdated} + StrCpy $isTryToKeepShortcuts "false" + ${endIf} + !endif +!macroend + +# https://nsis-dev.github.io/NSIS-Forums/html/t-172971.html +!macro readReg VAR ROOT_KEY SUB_KEY NAME + ${if} "${ROOT_KEY}" == "SHELL_CONTEXT" + ReadRegStr "${VAR}" SHELL_CONTEXT "${SUB_KEY}" "${NAME}" + ${elseif} "${ROOT_KEY}" == "HKEY_CURRENT_USER" + ReadRegStr "${VAR}" HKEY_CURRENT_USER "${SUB_KEY}" "${NAME}" + ${elseif} "${ROOT_KEY}" == "HKEY_LOCAL_MACHINE" + ReadRegStr "${VAR}" HKEY_LOCAL_MACHINE "${SUB_KEY}" "${NAME}" + ${else} + MessageBox MB_OK "Unsupported ${ROOT_KEY}" + ${endif} +!macroend + +Function handleUninstallResult + Var /GLOBAL rootKey_uninstallResult + Exch $rootKey_uninstallResult + + ${if} "$rootKey_uninstallResult" == "SHELL_CONTEXT" + !ifmacrodef customUnInstallCheck + !insertmacro customUnInstallCheck + Return + !endif + ${elseif} "$rootKey_uninstallResult" == "HKEY_CURRENT_USER" + !ifmacrodef customUnInstallCheckCurrentUser + !insertmacro customUnInstallCheckCurrentUser + Return + !endif + ${endif} + + IfErrors 0 +3 + DetailPrint `Uninstall was not successful. Not able to launch uninstaller!` + Return + + ${if} $R0 != 0 + MessageBox MB_OK|MB_ICONEXCLAMATION "$(uninstallFailed): $R0" + DetailPrint `Uninstall was not successful. Uninstaller error code: $R0.` + SetErrorLevel 2 + Quit + ${endif} +FunctionEnd + +!macro handleUninstallResult ROOT_KEY + Push "${ROOT_KEY}" + Call handleUninstallResult +!macroend + +# http://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni +Function uninstallOldVersion + Var /GLOBAL uninstallerFileName + Var /Global uninstallerFileNameTemp + Var /GLOBAL installationDir + Var /GLOBAL uninstallString + Var /GLOBAL rootKey + + ClearErrors + Exch $rootKey + + Push 0 + Pop $R0 + + !insertmacro readReg $uninstallString "$rootKey" "${UNINSTALL_REGISTRY_KEY}" UninstallString + ${if} $uninstallString == "" + !ifdef UNINSTALL_REGISTRY_KEY_2 + !insertmacro readReg $uninstallString "$rootKey" "${UNINSTALL_REGISTRY_KEY_2}" UninstallString + !endif + ${if} $uninstallString == "" + ClearErrors + Return + ${endif} + ${endif} + + # uninstaller should be copied out of app installation dir (because this dir will be deleted), so, extract uninstaller file name + !insertmacro GetInQuotes $uninstallerFileName "$uninstallString" + + !insertmacro readReg $installationDir "$rootKey" "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $installationDir == "" + ${andIf} $uninstallerFileName != "" + # https://github.com/electron-userland/electron-builder/issues/735#issuecomment-246918567 + Push $uninstallerFileName + Call GetFileParent + Pop $installationDir + ${endif} + + ${if} $installationDir == "" + ${andIf} $uninstallerFileName == "" + ClearErrors + Return + ${endif} + + ${if} $installMode == "CurrentUser" + ${orIf} $rootKey == "HKEY_CURRENT_USER" + StrCpy $0 "/currentuser" + ${else} + StrCpy $0 "/allusers" + ${endif} + + !insertMacro setIsTryToKeepShortcuts + + ${if} $isTryToKeepShortcuts == "true" + !insertmacro readReg $R5 "$rootKey" "${INSTALL_REGISTRY_KEY}" KeepShortcuts + # if true, it means that old uninstaller supports --keep-shortcuts flag + ${if} $R5 == "true" + ${andIf} ${FileExists} "$appExe" + StrCpy $0 "$0 --keep-shortcuts" + ${endIf} + ${endIf} + + ${if} ${isDeleteAppData} + StrCpy $0 "$0 --delete-app-data" + ${else} + # always pass --updated flag - to ensure that if DELETE_APP_DATA_ON_UNINSTALL is defined, user data will be not removed + StrCpy $0 "$0 --updated" + ${endif} + + StrCpy $uninstallerFileNameTemp "$PLUGINSDIR\old-uninstaller.exe" + !insertmacro copyFile "$uninstallerFileName" "$uninstallerFileNameTemp" + + # Retry counter + StrCpy $R5 0 + + UninstallLoop: + IntOp $R5 $R5 + 1 + + ${if} $R5 > 5 + MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDCANCEL IDRETRY OneMoreAttempt + Return + ${endIf} + + OneMoreAttempt: + ExecWait '"$uninstallerFileNameTemp" /S /KEEP_APP_DATA $0 _?=$installationDir' $R0 + ifErrors TryInPlace CheckResult + + TryInPlace: + # the execution failed - might have been caused by some group policy restrictions + # we try to execute the uninstaller in place + ExecWait '"$uninstallerFileName" /S /KEEP_APP_DATA $0 _?=$installationDir' $R0 + ifErrors DoesNotExist + + CheckResult: + ${if} $R0 == 0 + Return + ${endIf} + + Sleep 1000 + Goto UninstallLoop + + DoesNotExist: + SetErrors +FunctionEnd + +!macro uninstallOldVersion ROOT_KEY + Push "${ROOT_KEY}" + Call uninstallOldVersion +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/installer.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/installer.nsh new file mode 100644 index 0000000000..34e91dfe82 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/installer.nsh @@ -0,0 +1,227 @@ +# functions (nsis macro) for installer + +!include "extractAppPackage.nsh" + +!ifdef APP_PACKAGE_URL + !include webPackage.nsh +!endif + +!macro installApplicationFiles + !ifdef APP_BUILD_DIR + File /r "${APP_BUILD_DIR}\*.*" + !else + !ifdef APP_PACKAGE_URL + Var /GLOBAL packageFile + Var /GLOBAL isPackageFileExplicitlySpecified + + ${StdUtils.GetParameter} $packageFile "package-file" "" + ${if} $packageFile == "" + !ifdef APP_64_NAME + !ifdef APP_32_NAME + !ifdef APP_ARM64_NAME + ${if} ${IsNativeARM64} + StrCpy $packageFile "${APP_ARM64_NAME}" + StrCpy $1 "${APP_ARM64_HASH}" + ${elseif} ${IsNativeAMD64} + StrCpy $packageFile "${APP_64_NAME}" + StrCpy $1 "${APP_64_HASH}" + ${else} + StrCpy $packageFile "${APP_32_NAME}" + StrCpy $1 "${APP_32_HASH}" + ${endif} + !else + ${if} ${RunningX64} + StrCpy $packageFile "${APP_64_NAME}" + StrCpy $1 "${APP_64_HASH}" + ${else} + StrCpy $packageFile "${APP_32_NAME}" + StrCpy $1 "${APP_32_HASH}" + ${endif} + !endif + !else + StrCpy $packageFile "${APP_64_NAME}" + StrCpy $1 "${APP_64_HASH}" + !endif + !else + StrCpy $packageFile "${APP_32_NAME}" + StrCpy $1 "${APP_32_HASH}" + !endif + StrCpy $4 "$packageFile" + StrCpy $packageFile "$EXEDIR/$packageFile" + StrCpy $isPackageFileExplicitlySpecified "false" + ${else} + StrCpy $isPackageFileExplicitlySpecified "true" + ${endIf} + + # we do not check file hash is specifed explicitly using --package-file because it is clear that user definitely want to use this file and it is user responsibility to check + # 1. auto-updater uses --package-file and validates checksum + # 2. user can user another package file (use case - one installer suitable for any app version (use latest version)) + ${if} ${FileExists} "$packageFile" + ${if} $isPackageFileExplicitlySpecified == "true" + Goto fun_extract + ${else} + ${StdUtils.HashFile} $3 "SHA2-512" "$packageFile" + ${if} $3 == $1 + Goto fun_extract + ${else} + MessageBox MB_OK "Package file $4 found locally, but checksum doesn't match — expected $1, actual $3.$\r$\nLocal file is ignored and package will be downloaded from Internet." + ${endIf} + ${endIf} + ${endIf} + + !insertmacro downloadApplicationFiles + + fun_extract: + !insertmacro extractUsing7za "$packageFile" + + # electron always uses per user app data + ${if} $installMode == "all" + SetShellVarContext current + ${endif} + + !insertmacro moveFile "$packageFile" "$LOCALAPPDATA\${APP_PACKAGE_STORE_FILE}" + + ${if} $installMode == "all" + SetShellVarContext all + ${endif} + !else + !insertmacro extractEmbeddedAppPackage + # electron always uses per user app data + ${if} $installMode == "all" + SetShellVarContext current + ${endif} + !insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}" + ${if} $installMode == "all" + SetShellVarContext all + ${endif} + !endif + !endif + + File "/oname=${UNINSTALL_FILENAME}" "${UNINSTALLER_OUT_FILE}" +!macroend + +!macro registryAddInstallInfo + WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" InstallLocation "$INSTDIR" + WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" KeepShortcuts "true" + WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" ShortcutName "${SHORTCUT_NAME}" + !ifdef MENU_FILENAME + WriteRegStr SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory "${MENU_FILENAME}" + !endif + + ${if} $installMode == "all" + StrCpy $0 "/allusers" + StrCpy $1 "" + ${else} + StrCpy $0 "/currentuser" + StrCpy $1 "" + ${endIf} + + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" DisplayName "${UNINSTALL_DISPLAY_NAME}$1" + # https://github.com/electron-userland/electron-builder/issues/750 + StrCpy $2 "$INSTDIR\${UNINSTALL_FILENAME}" + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" UninstallString '"$2" $0' + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" QuietUninstallString '"$2" $0 /S' + + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}" + !ifdef UNINSTALLER_ICON + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\uninstallerIcon.ico" + !else + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "DisplayIcon" "$appExe,0" + !endif + + !ifdef COMPANY_NAME + WriteRegStr SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${COMPANY_NAME}" + !endif + + WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" NoModify 1 + WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" NoRepair 1 + + # allow user to define ESTIMATED_SIZE to avoid GetSize call + !ifdef ESTIMATED_SIZE + IntFmt $0 "0x%08X" ${ESTIMATED_SIZE} + !else + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + !endif + + WriteRegDWORD SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" "EstimatedSize" "$0" +!macroend + +!macro cleanupOldMenuDirectory + ${if} $oldMenuDirectory != "" + !ifdef MENU_FILENAME + ${if} $oldMenuDirectory != "${MENU_FILENAME}" + RMDir "$SMPROGRAMS\$oldMenuDirectory" + ${endIf} + !else + RMDir "$SMPROGRAMS\$oldMenuDirectory" + !endif + ${endIf} +!macroend + +!macro createMenuDirectory + !ifdef MENU_FILENAME + CreateDirectory "$SMPROGRAMS\${MENU_FILENAME}" + ClearErrors + !endif +!macroend + +!macro addStartMenuLink keepShortcuts + !ifndef DO_NOT_CREATE_START_MENU_SHORTCUT + # The keepShortcuts mechanism is NOT enabled. + # Menu shortcut will be recreated. + ${if} $keepShortcuts == "false" + !insertmacro cleanupOldMenuDirectory + !insertmacro createMenuDirectory + + CreateShortCut "$newStartMenuLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}" + # clear error (if shortcut already exists) + ClearErrors + WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}" + # The keepShortcuts mechanism IS enabled. + # The menu shortcut could either not exist (it shouldn't be recreated) or exist in an obsolete location. + ${elseif} $oldStartMenuLink != $newStartMenuLink + ${andIf} ${FileExists} "$oldStartMenuLink" + !insertmacro createMenuDirectory + + Rename $oldStartMenuLink $newStartMenuLink + WinShell::UninstShortcut "$oldStartMenuLink" + WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}" + + !insertmacro cleanupOldMenuDirectory + ${endIf} + !endif +!macroend + +!macro addDesktopLink keepShortcuts + !ifndef DO_NOT_CREATE_DESKTOP_SHORTCUT + # https://github.com/electron-userland/electron-builder/pull/1432 + ${ifNot} ${isNoDesktopShortcut} + # The keepShortcuts mechanism is NOT enabled. + # Shortcuts will be recreated. + ${if} $keepShortcuts == "false" + CreateShortCut "$newDesktopLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}" + ClearErrors + WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}" + # The keepShortcuts mechanism IS enabled. + # The desktop shortcut could exist in an obsolete location (due to name change). + ${elseif} $oldDesktopLink != $newDesktopLink + ${andIf} ${FileExists} "$oldDesktopLink" + Rename $oldDesktopLink $newDesktopLink + WinShell::UninstShortcut "$oldDesktopLink" + WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}" + + !ifdef RECREATE_DESKTOP_SHORTCUT + ${elseif} $oldDesktopLink != $newDesktopLink + ${orIfNot} ${FileExists} "$oldDesktopLink" + ${ifNot} ${isUpdated} + CreateShortCut "$newDesktopLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}" + ClearErrors + WinShell::SetLnkAUMI "$newDesktopLink" "${APP_ID}" + ${endIf} + !endif + ${endIf} + System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' + ${endIf} + !endif +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/nsProcess.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/nsProcess.nsh new file mode 100644 index 0000000000..9ef6098d22 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/nsProcess.nsh @@ -0,0 +1,28 @@ +!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess` + +!macro nsProcess::FindProcess _FILE _ERR + nsProcess::_FindProcess /NOUNLOAD `${_FILE}` + Pop ${_ERR} +!macroend + + +!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess` + +!macro nsProcess::KillProcess _FILE _ERR + nsProcess::_KillProcess /NOUNLOAD `${_FILE}` + Pop ${_ERR} +!macroend + +!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess` + +!macro nsProcess::CloseProcess _FILE _ERR + nsProcess::_CloseProcess /NOUNLOAD `${_FILE}` + Pop ${_ERR} +!macroend + + +!define nsProcess::Unload `!insertmacro nsProcess::Unload` + +!macro nsProcess::Unload + nsProcess::_Unload +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/include/webPackage.nsh b/client/node_modules/app-builder-lib/templates/nsis/include/webPackage.nsh new file mode 100644 index 0000000000..8ec0be318a --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/include/webPackage.nsh @@ -0,0 +1,64 @@ +!macro downloadApplicationFiles + Var /GLOBAL packageUrl + Var /GLOBAL packageArch + + StrCpy $packageUrl "${APP_PACKAGE_URL}" + StrCpy $packageArch "${APP_PACKAGE_URL}" + + !ifdef APP_PACKAGE_URL_IS_INCOMPLETE + !ifdef APP_64_NAME + !ifdef APP_32_NAME + !ifdef APP_ARM64_NAME + ${if} ${IsNativeARM64} + StrCpy $packageUrl "$packageUrl/${APP_ARM64_NAME}" + ${elseif} ${IsNativeAMD64} + StrCpy $packageUrl "$packageUrl/${APP_64_NAME}" + ${else} + StrCpy $packageUrl "$packageUrl/${APP_32_NAME}" + ${endif} + !else + ${if} ${IsNativeAMD64} + StrCpy $packageUrl "$packageUrl/${APP_64_NAME}" + ${else} + StrCpy $packageUrl "$packageUrl/${APP_32_NAME}" + ${endif} + !endif + !else + StrCpy $packageUrl "$packageUrl/${APP_64_NAME}" + !endif + !else + StrCpy $packageUrl "$packageUrl/${APP_32_NAME}" + !endif + !endif + + ${if} ${IsNativeARM64} + StrCpy $packageArch "ARM64" + ${elseif} ${IsNativeAMD64} + StrCpy $packageArch "64" + ${else} + StrCpy $packageArch "32" + ${endif} + + download: + inetc::get /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END + Pop $0 + + ${if} $0 == "Cancelled" + Quit + ${endif} + + ${if} $0 != "OK" + # try without proxy + inetc::get /NOPROXY /USERAGENT "electron-builder (Mozilla)" /HEADER "X-Arch: $packageArch" /RESUME "" "$packageUrl" "$PLUGINSDIR\package.7z" /END + Pop $0 + ${endif} + + ${if} $0 == "Cancelled" + quit + ${elseif} $0 != "OK" + Messagebox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Unable to download application package from $packageUrl (status: $0).$\r$\n$\r$\nPlease check your internet connection and retry." IDRETRY download + Quit + ${endif} + + StrCpy $packageFile "$PLUGINSDIR\package.7z" +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/installSection.nsh b/client/node_modules/app-builder-lib/templates/nsis/installSection.nsh new file mode 100644 index 0000000000..96f913a346 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/installSection.nsh @@ -0,0 +1,107 @@ +!include installer.nsh + +InitPluginsDir + +${IfNot} ${Silent} + SetDetailsPrint none +${endif} + +StrCpy $appExe "$INSTDIR\${APP_EXECUTABLE_FILENAME}" + +# must be called before uninstallOldVersion +!insertmacro setLinkVars + +!ifdef ONE_CLICK + !ifdef HEADER_ICO + File /oname=$PLUGINSDIR\installerHeaderico.ico "${HEADER_ICO}" + !endif + ${IfNot} ${Silent} + !ifdef HEADER_ICO + SpiderBanner::Show /MODERN /ICON "$PLUGINSDIR\installerHeaderico.ico" + !else + SpiderBanner::Show /MODERN + !endif + + FindWindow $0 "#32770" "" $hwndparent + FindWindow $0 "#32770" "" $hwndparent $0 + GetDlgItem $0 $0 1000 + SendMessage $0 ${WM_SETTEXT} 0 "STR:$(installing)" + ${endif} + !insertmacro CHECK_APP_RUNNING +!else + ${ifNot} ${UAC_IsInnerInstance} + !insertmacro CHECK_APP_RUNNING + ${endif} +!endif + +Var /GLOBAL keepShortcuts +StrCpy $keepShortcuts "false" +!insertMacro setIsTryToKeepShortcuts +${if} $isTryToKeepShortcuts == "true" + ReadRegStr $R1 SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" KeepShortcuts + + ${if} $R1 == "true" + ${andIf} ${FileExists} "$appExe" + StrCpy $keepShortcuts "true" + ${endIf} +${endif} + +!insertmacro uninstallOldVersion SHELL_CONTEXT +!insertmacro handleUninstallResult SHELL_CONTEXT + +${if} $installMode == "all" + !insertmacro uninstallOldVersion HKEY_CURRENT_USER + !insertmacro handleUninstallResult HKEY_CURRENT_USER +${endIf} + +SetOutPath $INSTDIR + +!ifdef UNINSTALLER_ICON + File /oname=uninstallerIcon.ico "${UNINSTALLER_ICON}" +!endif + +!insertmacro installApplicationFiles +!insertmacro registryAddInstallInfo +!insertmacro addStartMenuLink $keepShortcuts +!insertmacro addDesktopLink $keepShortcuts + +${if} ${FileExists} "$newStartMenuLink" + StrCpy $launchLink "$newStartMenuLink" +${else} + StrCpy $launchLink "$INSTDIR\${APP_EXECUTABLE_FILENAME}" +${endIf} + +!ifmacrodef registerFileAssociations + !insertmacro registerFileAssociations +!endif + +!ifmacrodef customInstall + !insertmacro customInstall +!endif + +!macro doStartApp + # otherwise app window will be in background + HideWindow + !insertmacro StartApp +!macroend + +!ifdef ONE_CLICK + # https://github.com/electron-userland/electron-builder/pull/3093#issuecomment-403734568 + !ifdef RUN_AFTER_FINISH + ${ifNot} ${Silent} + ${orIf} ${isForceRun} + !insertmacro doStartApp + ${endIf} + !else + ${if} ${isForceRun} + !insertmacro doStartApp + ${endIf} + !endif + !insertmacro quitSuccess +!else + # for assisted installer run only if silent, because assisted installer has run after finish option + ${if} ${isForceRun} + ${andIf} ${Silent} + !insertmacro doStartApp + ${endIf} +!endif \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/installer.nsi b/client/node_modules/app-builder-lib/templates/nsis/installer.nsi new file mode 100644 index 0000000000..4c69e9a888 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/installer.nsi @@ -0,0 +1,119 @@ +Var newStartMenuLink +Var oldStartMenuLink +Var newDesktopLink +Var oldDesktopLink +Var oldShortcutName +Var oldMenuDirectory + +!include "common.nsh" +!include "MUI2.nsh" +!include "multiUser.nsh" +!include "allowOnlyOneInstallerInstance.nsh" + +!ifdef INSTALL_MODE_PER_ALL_USERS + !ifdef BUILD_UNINSTALLER + RequestExecutionLevel user + !else + RequestExecutionLevel admin + !endif +!else + RequestExecutionLevel user +!endif + +!ifdef BUILD_UNINSTALLER + SilentInstall silent +!else + Var appExe + Var launchLink +!endif + +!ifdef ONE_CLICK + !include "oneClick.nsh" +!else + !include "assistedInstaller.nsh" +!endif + +!insertmacro addLangs + +!ifmacrodef customHeader + !insertmacro customHeader +!endif + +Function .onInit + SetOutPath $INSTDIR + ${LogSet} on + + !ifmacrodef preInit + !insertmacro preInit + !endif + + !ifdef DISPLAY_LANG_SELECTOR + !insertmacro MUI_LANGDLL_DISPLAY + !endif + + !ifdef BUILD_UNINSTALLER + WriteUninstaller "${UNINSTALLER_OUT_FILE}" + !insertmacro quitSuccess + !else + !insertmacro check64BitAndSetRegView + + !ifdef ONE_CLICK + !insertmacro ALLOW_ONLY_ONE_INSTALLER_INSTANCE + !else + ${IfNot} ${UAC_IsInnerInstance} + !insertmacro ALLOW_ONLY_ONE_INSTALLER_INSTANCE + ${EndIf} + !endif + + !insertmacro initMultiUser + + !ifmacrodef customInit + !insertmacro customInit + !endif + + !ifmacrodef addLicenseFiles + InitPluginsDir + !insertmacro addLicenseFiles + !endif + !endif +FunctionEnd + +!ifndef BUILD_UNINSTALLER + !include "installUtil.nsh" +!endif + +Section "install" + !ifndef BUILD_UNINSTALLER + # If we're running a silent upgrade of a per-machine installation, elevate so extracting the new app will succeed. + # For a non-silent install, the elevation will be triggered when the install mode is selected in the UI, + # but that won't be executed when silent. + !ifndef INSTALL_MODE_PER_ALL_USERS + !ifndef ONE_CLICK + ${if} $hasPerMachineInstallation == "1" # set in onInit by initMultiUser + ${andIf} ${Silent} + ${ifNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + ${Switch} $0 + ${Case} 0 + ${Break} + ${Case} 1223 ;user aborted + ${Break} + ${Default} + MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0" + ${Break} + ${EndSwitch} + Quit + ${else} + !insertmacro setInstallModePerAllUsers + ${endIf} + ${endIf} + !endif + !endif + !include "installSection.nsh" + !endif +SectionEnd + +!ifdef BUILD_UNINSTALLER + !include "uninstaller.nsh" +!endif \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/messages.yml b/client/node_modules/app-builder-lib/templates/nsis/messages.yml new file mode 100644 index 0000000000..a1c2847fa4 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/messages.yml @@ -0,0 +1,237 @@ +# one-click installer messages, see assistedMessages.yml for assisted installer messages +# en must be first (https://github.com/electron-userland/electron-builder/issues/2517) +win7Required: + en: Windows 7 and above is required + de: Windows 7 oder höher wird vorausgesetzt + it: È necessario disporre del sistema operativo Windows 7 e successivi + fr: Windows 7 (ou une version ultérieure) est requis + ja: Windows 7 以降が必要です + ko: Windows 7 이상이 필요합니다 + ru: Требуется Windows 7 и выше + sk: Iba Windows 7 a vyššie je podporovaný + cs: Jsou podporovány pouze Windows 7 a vyšší + hu: Windows 7 vagy újabb szükséges + pl: Windows 7 lub nowszy jest wymagany + pt_BR: Requer Windows 7 ou superior + zh_CN: 需要 Windows 7 或以上系统 + zh_TW: 需要 Windows 7 或更新的系統 + tr_TR: Windows 7 ve üstü gereklidir + sv_SE: Windows 7 eller högre krävs + no: Windows 7 og over er nødvendig + nl_NL: Windows 7 en hoger is vereist + fi: Windows 7 tai uudempi vaaditaan + es: Se necesita Windows 7 o una versión superior. + da: Windows 7 og højere er nødvendig +x64WinRequired: + en: 64-bit Windows is required + de: 64-Bit-Windows wird vorausgesetzt + it: È necessario disporre di un sistema operativo Windows a 64 bit + fr: Windows 64 bits est requis + ja: 64 ビット バージョンの Windows が必要です + ko: 64 비트 버전의 Windows가 필요합니다 + ru: Требуется Windows 64-bit + sk: Potrebujete 64-bit Windows + cs: Potřebujete 64-bit Windows + hu: 64-bit Windows szükséges + pl: Windows 64-bitowy jest wymagany + pt_BR: Requer Windows 64 bits + zh_CN: 需要 64 位 Windows 系统 + zh_TW: 需要 64 位元 Windows 系統 + tr_TR: 64 bit Windows gerekli + sv_SE: 64-bitars Windows krävs + no: 64-biters Windows er nødvendig + nl_NL: 64-bit Windows is vereist + fi: 64-bittinen Windows on pakollinen + es: Windows de 64 bits es requerido + da: 64-bit Windows er påkrævet +appRunning: + en: "${PRODUCT_NAME} is running.\nClick OK to close it.\nIf it doesn't close, try closing it manually." + ar: "‫إن ${PRODUCT_NAME} يعمل حاليا.\n‫يُرجى الضغط على « موافق » لغلقه.\n‫إذا لم يُغلَق، يُرجى محاولة إغلاقه يدويا." + az: "${PRODUCT_NAME} işləyir.\nBağlamaq üçün \"Oldu\"ya klikləyin.\nƏgər bağlanmasa, əllə bağlamağa çalışın." + ca: "${PRODUCT_NAME}s'executa.\nFeu clic a D'acord per tancar-la.\nSi no es tanca, proveu de tancar-la manualment." + cs: "${PRODUCT_NAME} běží.\nPotvrďte zavření stisknutím OK.\nPokud se aplikace nezavře sama, zavřete ji ručně." + cy: "Mae ${PRODUCT_NAME} yn rhedeg.\nCliciwch Iawn i'w gau.\nOs na fydd yn cau, ceisiwch ei gau â llaw." + da: "${PRODUCT_NAME} kører.\nKlik OK for at lukke den.\nHvis den ikke lukker, kan du prøve at lukke den manuelt." + de: "${PRODUCT_NAME} wird gerade ausgeführt.\nKlicke auf »OK«, um es zu schließen.\nFalls es sich nicht schließen lässt, versuche es manuell zu schließen." + el: "Το ${PRODUCT_NAME} εκτελείται ήδη. \nΚάντε κλικ στο ΟΚ για κλείσιμο.\nΑν δεν κλείνει, δοκιμάστε να το κλείσετε εσείς." + eo: "${PRODUCT_NAME} funkcias.\nAlklaku Bone („OK“) por fermi ĝin.\nSe ĝi ne fermiĝas, provu fermi ĝin permane." + es: "${PRODUCT_NAME} está activa.\nHaz clic en Aceptar para cerrarla.\nSi no se cierra, inténtalo manualmente." + fi: "${PRODUCT_NAME} on käynnissä.\nValitse OK sulkeaksesi sen.\nJos se ei sulkeudu, yritä sulkea se manuaalisesti." + fr: "${PRODUCT_NAME} est en cours d’utilisation. \nCliquez sur «OK» pour fermer ce programme." + he: "${PRODUCT_NAME} רץ.\nלחץ בסדר כדי לסגור אותו.\nאם הוא לא נסגר, נסה לסגור אותו באופן ידני." + hu: "A ${PRODUCT_NAME} alkalmazás fut.\nKattints az OK gombra a bezárásához.\nHa így sem áll le, zárd be manuálisan." + it: "${PRODUCT_NAME} è in esecuzione.\nClicca su OK per chiuderla.\nSe non si chiude, prova a chiuderla manualmente." + ja: "${PRODUCT_NAME} が起動しています。\nOKをクリックして、閉じてください。\n閉じない場合は、手動で閉じてください。" + ko: "${PRODUCT_NAME}이(가) 실행 중입니다. \nOK을 클릭하면 종료됩니다." + lt: "${PRODUCT_NAME} vis dar veikia.\nSpustelėkite „Gerai“, kad ją užvertumėte.\nJeigu ji neužsiveria, pabandykite ją užverti rankiniu būdu." + nl_NL: "${PRODUCT_NAME} is nog actief.\nKlik op OK om de applicatie te sluiten.\nAls de applicatie vervolgens nog niet sluit, probeer dan om de applicatie zelf te sluiten." + no: "${PRODUCT_NAME} kjører. \nKlikk OK for å lukke det." + pl: "Aplikacja ${PRODUCT_NAME} jest uruchomiona.\nKliknij OK, aby ją zamknąć.\nJeśli nie zostanie zamknięta, spróbuj zamknąć ją ręcznie." + pt_BR: "${PRODUCT_NAME} está funcionando.\nClique no OK para fechar.\nSe não fechar, tente fechá-lo manualmente." + pt_PT: "${PRODUCT_NAME} está a correr.\nClique em OK para o encerrar.\nSe não encerrar, tente encerrá-lo manualmente." + ro: "${PRODUCT_NAME} este pornit.\nApasă OK pentru a-l opri.\nDacă nu se oprește, încearcă să-l oprești manual." + ru: "Приложение ${PRODUCT_NAME} запущено.\nНажмите «OK», чтобы закрыть его.\nЕсли оно не закрывается, попробуйте закрыть его вручную." + sk: "${PRODUCT_NAME} beží.\nKliknutím na tlačidlo OK ho zatvoríte.\nAk sa nezavrie, skúste ho zatvoriť ručne." + sl: "${PRODUCT_NAME} teče.\nKliknite OK za prekinitev.\nČe se ne zapre, ga poskusite zapreti ročno." + sq: "${PRODUCT_NAME} po xhiron.\nKlikoni mbi OK që të mbyllet.\nNëse s’mbyllet, provoni dorazi." + sr: "${PRODUCT_NAME} је у току.\nКликнути OK да би се затворило.\nАко се не затвори, покушајте да га ручно затворите." + sv_SE: "${PRODUCT_NAME} är igång.\nKlicka på OK för att stänga det.\nOm det inte stängs, försök att stänga det manuellt." + tr_TR: "${PRODUCT_NAME} çalışıyor.\nKapatmak için Tamam'ı tıklayın." + uk: "${PRODUCT_NAME} запущено.\nКлацніть ОК для завершення.\nЯкщо завершення не вдалось — спробуйте вручну." + zh_CN: "${PRODUCT_NAME} 正在运行.\n点击“确定”关闭." + zh_TW: "${PRODUCT_NAME} 正在執行。\n點擊 OK 關閉。\n如果無法關閉,試著手動關閉。" +appCannotBeClosed: + en: "${PRODUCT_NAME} cannot be closed. \nPlease close it manually and click Retry to continue." + ar: "‫لم يتمكن من إغلاق ${PRODUCT_NAME} \nيُرجى إغلاقه يدويا ثم الضغط مرة أخرى على إعادة المحاولة للاستمرار.‏" + az: "${PRODUCT_NAME}, bağlanıla bilmir. \nZəhmət olmasa əllə bağlayın və davam etmək üçün \"Yenidən sına\"ya klikləyin." + af: "${PRODUCT_NAME} kan nie toegemaak word nie. \nMaak dit asb. handmatig toe en klik Probeer weer om voort te gaan." + bn: "${PRODUCT_NAME} বন্ধ করা যাবে না। \nঅনুগ্রহ করে ম্যানুয়ালি এটি বন্ধ করুন এবং চালিয়ে যেতে Retry এ ক্লিক করুন।" + ca: "No es pot tancar el ${PRODUCT_NAME}. \nTanqueu-lo manualment i cliqueu a tornar-ho a provar per continuar." + cs: "Aplikaci ${PRODUCT_NAME} se nepodařilo zavřít. \nZavřete ji ručně a poté klikněte na Opakovat pro pokračování." + cy: "Nid oes modd cau ${PRODUCT_NAME}. \nCaewch ef â llaw a chliciwch ar Ailgynnig i barhau." + da: "${PRODUCT_NAME} kan ikke afsluttes \nLuk den manuelt og klik Prøv igen for at fortsætte" + de: "${PRODUCT_NAME} kann nicht geschlossen werden. \nSchließ es bitte manuell und klicke auf »Wiederholen«, um fortzufahren." + eo: "${PRODUCT_NAME} ne povas esti fermita. \nFermu ĝin permane, kaj alklaku „Reprovi“ por daŭrigi." + el: "Το ${PRODUCT_NAME} δεν μπορεί να κλείσει. \nΠαρακαλώ κλείστο χειροκίνητα και πάτα Δοκιμή Ξανά για να συνεχίσεις." + es: "No se puede cerrar ${PRODUCT_NAME}. \nPor favor cierra la aplicación manualmente y haz clic en reintentar para continuar." + et: "${PRODUCT_NAME} ei saa sulgeda. \nPalun sulge see käsitsi ja klõpsa jätkamiseks \"Proovi uuesti\"." + fa: "سیگنال بسته نمی شود \nلطفاً آن را بصورت دستی ببندید و برای ادامه روی تلاش مجدد کلیک کنید" + fi: "${PRODUCT_NAME} ei voi sulkea. \nSulje se itse ja napsauta Yritä uudelleen jatkaaksesi." + fr: "${PRODUCT_NAME} ne peut pas être fermé. \nVeuillez la fermer manuellement et cliquez sur Réessayer pour continuer." + gd: "Cha b’ urrainn dhuinn ${PRODUCT_NAME} a dhùnadh. \nDùin a làimh e agus briog air “Feuch ris a-rithist” a leantainn air adhart." + he: "${PRODUCT_NAME} לא יכול להיסגר. \nאנא סגור אותו באופן ידני ולחץ על נסה שוב כדי להמשיך." + hi: "सिग्नल बंद नहीं किया जा सकता. \nकृपया इसे मैन्युअल रूप से बंद करें और जारी रखने के लिए रिट्राई पर क्लिक करें." + hu: "Nem sikerült bezárni a ${PRODUCT_NAME}t. \nZárd be kézzel, majd kattints az Újra gombra a folytatáshoz!" + id: "${PRODUCT_NAME} tidak dapat ditutup. \nMohon tutup secara manual dan klik Coba Lagi untuk melanjutkan." + is: "Ekki er hægt að loka ${PRODUCT_NAME}. \nLokaðu því handvirkt og ýttu á 'Reyna aftur' til að halda áfram." + it: "${PRODUCT_NAME} non può essere chiuso. \nPer favore, chiudilo manualmente e clicca su Riprova per continuare." + ja: "${PRODUCT_NAME}が終了できません。\n手動で閉じて、『再試行』をクリックしてください。" + lt: "Nepavyksta užverti ${PRODUCT_NAME}. \nPabandykite ją užverti rankiniu būdu ir norėdami tęsti spustelėkite „Bandyti dar kartą“." + mr: "${PRODUCT_NAME} बंद करता येत नाही. \nकृपया हाताने/मॅन्युअली बंद करा आणि पुढे चालू ठेवण्यासाठी पुन्हा प्रयत्न/रिट्राय वर क्लिक करा" + ms: "${PRODUCT_NAME} tidak boleh ditutup. \nSila tutup secara manual dan klik Cuba Semula untuk meneruskan." + nl_NL: "${PRODUCT_NAME} kan niet automatisch worden afgesloten. \nSluit zelf de ${PRODUCT_NAME} app en klik vervolgens op ‘Opnieuw proberen’." + nn: "Kan ikkje lukka ${PRODUCT_NAME}. \nPlease close it manually and click Retry to continue." + pl: "Nie można zamknąć ${PRODUCT_NAME}. \nZamknij aplikację i kliknij Ponów, aby kontynuować." + ps: "${PRODUCT_NAME} نشي تړل کېدای. \nد مهرباني له مخې په مانول ډول یې وتړئ او د ادامې لپاره پر بیا هڅې باندې کلیک وکړئ." + pt_BR: "Não é possível fechar o ${PRODUCT_NAME}. \nFeche a janela do ${PRODUCT_NAME} e clique em Repetir para continuar." + pt_PT: "Não é possível fechar o ${PRODUCT_NAME}. \nPor favor, feche-o manualmente e clique em ´Tentar novamente' para continuar." + ro: "${PRODUCT_NAME} nu poate fi închis \nVă rugăm închideți-l manual și apăsați Reîncercare pentru a continua." + ru: "Не удалось закрыть ${PRODUCT_NAME}. \nПожалуйста, закройте ${PRODUCT_NAME} вручную и нажмите «Повторить», чтобы продолжить." + sk: "${PRODUCT_NAME} nie je možné zatvoriť. \nZatvorte ho ručne a pokračujte kliknutím na položku Opakovať." + sl: "${PRODUCT_NAME} se ne more zapreti. \nPoskusite ga zapreti ročno in kliknite Ponovi za nadaljevanje." + sq: "${PRODUCT_NAME} s’mund të mbyllet. \nQë të vazhdohet, ju lutemi, mbylleni dorazi dhe klikoni mbi Riprovo." + sr: "${PRODUCT_NAME} не може да се затвори. \nЗатворите га ручно и кликните на Покушај да наставите." + sv: "${PRODUCT_NAME} går inte att stängas. \nVänligen stäng det manuellt och klicka på Försök igen för att fortsätta." + tr: "${PRODUCT_NAME} kapatılamaz. \nLütfen elle kapatın ve devam etmek için Tekrar'a tıklayın" + uk: "Неможливо закрити ${PRODUCT_NAME}. \nЗакрийте його вручну та натисніть Повторити, щоб продовжити." + vi: "${PRODUCT_NAME} không thể đóng \nVui lòng đóng nó theo cách thủ công và nhấp vào Thử lại để tiếp tục." + zh_CN: "${PRODUCT_NAME} 无法关闭。\n请手动关闭它,然后单击重试以继续。" + zh_TW: "${PRODUCT_NAME} 無法關閉。\n請手動關閉它,然後按一下重試以繼續。" +installing: + en: Installing, please wait... + de: Installation läuft, bitte warten... + it: Attendere prego. Installazione in corso... + fr: En cours d’installation... Veuillez patienter s'il vous plaît. + ja: インストールしています。しばらくお待ちください... + ko: 설치하고 있습니다. 잠시 기다려주십시오... + ru: Установка, пожалуйста, подождите... + sk: Inštalujem, prosím počkajte... + cs: Instaluje se, prosím vyčkejte... + hu: Telepítés, kérem várjon... + pl: Zaczekaj na ukończenie instalacji... + pt_BR: Instalando, por favor aguarde... + zh_CN: 正在安装, 请稍候... + zh_TW: 正在安裝, 請稍候... + tr_TR: Yükleniyor, lütfen bekleyin... + sv_SE: Installerar, vänligen vänta... + no: Installerer, vennligst vent... + nl_NL: Installeren, even geduld... + fi: Asennetaan, odota... + es: Instalando, espera un momento... + da: Installerer, vent venligst... +areYouSureToUninstall: + en: Are you sure you want to uninstall ${PRODUCT_NAME}? + de: Sind Sie sicher, dass Sie ${PRODUCT_NAME} deinstallieren möchten? + it: Sicuro di voler procedere alla disinstallazione di ${PRODUCT_NAME}? + fr: Etes-vous sûr(e) de vouloir désinstaller ${PRODUCT_NAME}? + ja: ${PRODUCT_NAME} をアンインストールしてもよろしいですか? + ko: ${PRODUCT_NAME}을(를) 제거 하시겠습니까? + ru: Вы уверены, что хотите удалить ${PRODUCT_NAME}? + sk: Ste si istý že chcete odinštalovať ${PRODUCT_NAME}? + cs: Jste si jisti, že chcete odinstalovat ${PRODUCT_NAME}? + hu: Biztos benne, hogy szeretné eltávolítani a ${PRODUCT_NAME} alkalmazást? + pl: Czy na pewno chcesz odinstalować ${PRODUCT_NAME}? + pt_BR: Tem certeza que deseja desinstalar ${PRODUCT_NAME}? + zh_CN: 确定卸载 ${PRODUCT_NAME} 吗? + zh_TW: 確定解除安裝 ${PRODUCT_NAME} 嗎? + tr_TR: ${PRODUCT_NAME} kaldırmak istediğinize Eminmisiniz? + sv_SE: Är du säker på att du vill avinstallera ${PRODUCT_NAME}? + no: Er du sikker på at du vil avinstallere ${PRODUCT_NAME}? + nl_NL: Weet je zeker dat je ${PRODUCT_NAME} wilt verwijderen? + fi: Oletko varma, että haluat poistaa ${PRODUCT_NAME} asennuksen? + es: ¿Seguro que quieres desinstalar ${PRODUCT_NAME}? + da: Er du sikker på, at du vil afinstallere ${PRODUCT_NAME}? +decompressionFailed: + en: Failed to decompress files. Please try running the installer again. + ar: "‫لقد فشل وينْدوزْ في فك ضغط الملفات. يُرجى محاولة تشغيل أداة التثبيت مرة أخرى." + az: Faylların sıxışdırması açılmadı. Zəhmət olmasa quraşdırıcını yenidən işə salmağa çalışın. + ca: No s'han pogut descomprimir els fitxers. Si us plau, proveu d'executar l'instal·lador un altre cop. + cs: Nepodařilo se rozbalit soubory. Zkuste prosím instalátor spustit znovu. + cy: Wedi methu â datgywasgu ffeiliau. Ceisiwch redeg y gosodwr eto. + da: Det lykkedes ikke at udpakke filer. Prøv venligst at køre installationsprogrammet igen. + de: Die Dateien konnten nicht entpackt werden. Bitte versuche, das Installationsprogramm erneut auszuführen. + el: Αποτυχία αποσυμπίεσης των αρχείων. Παρακαλούμε ξαναπροσπαθήστε την εγκατάσταση. + eo: Maldensigo de dosieroj malsukcesis. Provu relanĉi la instalilon. + es: Fallo al descomprimir archivos. Inténtalo de nuevo más tarde. + fi: Tiedostojen purkaminen ei onnistunut. Yritä ajaa asennusohjelma uudelleen. + fr: Échec de décompression des fichiers. Veuillez réessayer d’exécuter l'installeur. + he: נכשל בחילוץ קבצים. אנא נסה להריץ את המתקין שוב. + hu: Kicsomagolási hiba. Kérlek futtasd a telepítőt újra! + it: Impossibile decomprimere i file. Per favore, prova ad eseguire di nuovo il programma di installazione. + ja: ファイルの解凍に失敗しました。もう一度インストーラーを実行してみてください。 + lt: Nepavyko išglaudinti failų. Bandykite paleisti diegimo programą dar kartą. + nl_NL: Het decomprimeren van bestanden is mislukt. Voer het installatiebestand opnieuw uit om te proberen dit probleem te verhelpen. + pl: Nie udało się rozpakować plików. Spróbuj ponownie uruchomić instalator. + pt_BR: Falha ao descompactar os arquivos. Por favor, tente iniciar o instalador novamente. + pt_PT: Falha ao descomprimir ficheiros. Por favor, experimente correr o instalador de novo. + ro: Fișierele nu au putut fi dezarhivate. Te rugăm să încerci din nou instalarea. + ru: Не удалось разархивировать файлы. Пожалуйста, попробуйте запустить установщик заново. + sk: Nepodarilo sa rozbaliť súbory. Skúste znova spustiť inštalačný program. + sl: Neuspešno razširjanje datotek. Poskusite ponovno zagnati inštalacijo. + sq: S’u arrit të çngjeshen kartela. Ju lutemi, provoni të xhironi sërish instaluesin. + sr: Декомпримовање датотека није успело. Покушајте поново да покренете инсталатер. + sv_SE: Det gick inte att dekomprimera filer. Försök att köra installationsprogrammet igen. + uk: Не вдалось розархівувати файли. Будь ласка, спробуйте запустити встановлювач знов. + zh_TW: 解壓縮檔案失敗。 請嘗試再次執行安裝程式。 +uninstallFailed: + en: Failed to uninstall old application files. Please try running the installer again. + ar: ‫لقد فشل إلغاء التثبيت ملفات التطبيق. يُرجى محاولة تشغيل أداة التثبيت مرة أخرى. + az: Köhnə tətbiq faylları silinmədi. Zəhmət olmasa quraşdırıcını yenidən işə salmağa çalışın. + ca: No s'han pogut desinstal·lar els fitxers d'aplicacions antics. Si us plau, proveu d'executar l'instal·lador un altre cop. + cs: Nepodařilo se odinstalovat staré soubory aplikace. Zkuste prosím instalátor spustit znovu. + cy: Wedi methu â dadosod hen ffeiliau rhaglen. Ceisiwch redeg y gosodwr eto. + da: Det lykkedes ikke at afinstallere gamle applikationsfiler. Prøv venligst at køre installationsprogrammet igen. + de: Die alten Anwendungsdateien konnten nicht deinstalliert werden. Bitte versuche, das Installationsprogramm erneut auszuführen. + el: Δεν ήταν δυνατή η απεγκατάσταση των παλιών αρχείων εφαρμογής. Ξαναπροσπαθήστε την απεγκατάσταση αργότερα. + eo: Malinstalo de malnovaj aplikaĵaj dosieroj malsukcesis. Provu relanĉi la instalilon. + es: Fallo al desinstalar archivos antiguos de la aplicación. Inténtalo de nuevo más tarde. + fi: Vanhojen sovellustiedostojen poisto epäonnistui. Yritä ajaa asennusohjelma uudelleen. + fr: Échec de désinstallation des anciens fichiers d'application . Veuillez réessayer d’exécuter l'installeur. + he: נכשל בהסרת קבצים של היישום הישן. אנא נסה להריץ את המתקין שוב. + hu: A régi alkalmazás állományait nem sikerült törölni. Kérlek futtasd a telepítőt újra! + it: Impossibile disinstallare i vecchi file dell'applicazione. Per favore, prova ad eseguire di nuovo il programma di installazione. + ja: 古いアプリケーションファイルのアンインストールに失敗しました。もう一度インストーラーを実行してみてください。 + lt: Nepavyko pašalinti senos programos failų. Bandykite paleisti diegimo programą dar kartą. + nl: Het deïnstalleren van oude applicatiebestanden is mislukt. Voer het installatiebestand opnieuw uit om te proberen dit probleem te verhelpen. + pl: Nie udało się usunąć plików starej wersji aplikacji. Spróbuj ponownie uruchomić instalator. + pt_BR: Falha ao desinstalar os arquivos do aplicativo antigo. Por favor, tente iniciar o instalador novamente. + pt_PT: Falha ao desinstalar os ficheiros da aplicação antiga. Por favor, experimente correr novamente o instalador. + ro: Nu s-a putut dezinstala vechea aplicație. Te rugăm să încerci din nou instalarea. + ru: Не удалось удалить старые файлы приложения. Пожалуйста, попробуйте запустить установщик заново. + sk: Nepodarilo sa odinštalovať staré súbory aplikácie. Skúste znova spustiť inštalačný program. + sl: Neuspešno odnameščanje starih datotek. Poskusite ponovno zagnati inštalacijo. + sq: S’u arrit të çinstalohen kartela të vjetra aplikacioni. Ju lutemi, xhironi sërish instaluesin. + sr: Деинсталирање старих датотека апликације није успело. Покушајте поново да покренете инсталатер. + sv: Det gick inte att avinstallera gamla programfiler. Försök att köra installationsprogrammet igen. + uk: Не вдалось видалити старі файли застосунку. Будь ласка, спробуйте запустити встановлювач знов. + zh_TW: 無法俺安裝舊的應用程式檔案。 請嘗試再次執行安裝程式。 diff --git a/client/node_modules/app-builder-lib/templates/nsis/multiUser.nsh b/client/node_modules/app-builder-lib/templates/nsis/multiUser.nsh new file mode 100644 index 0000000000..3de631bf0c --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/multiUser.nsh @@ -0,0 +1,93 @@ +!include FileFunc.nsh +!include UAC.nsh + +!define FOLDERID_UserProgramFiles {5CD7AEE2-2219-4A67-B85D-6C9CE15660CB} +!define KF_FLAG_CREATE 0x00008000 + +# allow user to define own custom +!define /ifndef INSTALL_REGISTRY_KEY "Software\${APP_GUID}" +!define /ifndef UNINSTALL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" + +# current Install Mode ("all" or "CurrentUser") +Var installMode + +!ifndef INSTALL_MODE_PER_ALL_USERS + !ifndef ONE_CLICK + Var hasPerUserInstallation + Var hasPerMachineInstallation + !endif + Var PerUserInstallationFolder + + !macro setInstallModePerUser + StrCpy $installMode CurrentUser + SetShellVarContext current + + # сhecks registry for previous installation path + ReadRegStr $perUserInstallationFolder HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $perUserInstallationFolder != "" + StrCpy $INSTDIR $perUserInstallationFolder + ${else} + StrCpy $0 "$LocalAppData\Programs" + System::Store S + # Win7 has a per-user programfiles known folder and this can be a non-default location + System::Call 'SHELL32::SHGetKnownFolderPath(g "${FOLDERID_UserProgramFiles}", i ${KF_FLAG_CREATE}, p 0, *p .r2)i.r1' + ${If} $1 == 0 + System::Call '*$2(&w${NSIS_MAX_STRLEN} .s)' + StrCpy $0 $1 + System::Call 'OLE32::CoTaskMemFree(p r2)' + ${endif} + System::Store L + StrCpy $INSTDIR "$0\${APP_FILENAME}" + ${endif} + + # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551 + ${StdUtils.GetParameter} $R0 "D" "" + ${If} $R0 != "" + StrCpy $INSTDIR $R0 + ${endif} + + !macroend +!endif + +!ifdef INSTALL_MODE_PER_ALL_USERS_REQUIRED + Var perMachineInstallationFolder + + !macro setInstallModePerAllUsers + StrCpy $installMode all + SetShellVarContext all + + !ifdef BUILD_UNINSTALLER + ${IfNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + Quit + ${endif} + !endif + + # сheck registry for previous installation path + ReadRegStr $perMachineInstallationFolder HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation + ${if} $perMachineInstallationFolder != "" + StrCpy $INSTDIR $perMachineInstallationFolder + ${else} + StrCpy $0 "$PROGRAMFILES" + !ifdef APP_64 + ${if} ${RunningX64} + StrCpy $0 "$PROGRAMFILES64" + ${endif} + !endif + + !ifdef MENU_FILENAME + StrCpy $0 "$0\${MENU_FILENAME}" + !endif + + StrCpy $INSTDIR "$0\${APP_FILENAME}" + ${endif} + + # allow /D switch to override installation path https://github.com/electron-userland/electron-builder/issues/1551 + ${StdUtils.GetParameter} $R0 "D" "" + ${If} $R0 != "" + StrCpy $INSTDIR $R0 + ${endif} + + !macroend +!endif diff --git a/client/node_modules/app-builder-lib/templates/nsis/multiUserUi.nsh b/client/node_modules/app-builder-lib/templates/nsis/multiUserUi.nsh new file mode 100644 index 0000000000..52a83df6f6 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/multiUserUi.nsh @@ -0,0 +1,230 @@ +!include nsDialogs.nsh + +Var HasTwoAvailableOptions +Var RadioButtonLabel1 +Var isForceMachineInstall +Var isForceCurrentInstall + +!macro PAGE_INSTALL_MODE + !insertmacro MUI_PAGE_INIT + + !insertmacro MUI_SET MULTIUSER_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLMODEPAGE "" + Var MultiUser.InstallModePage + Var MultiUser.InstallModePage.Text + Var MultiUser.InstallModePage.AllUsers + Var MultiUser.InstallModePage.CurrentUser + Var MultiUser.InstallModePage.ReturnValue + + !ifndef BUILD_UNINSTALLER + !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} "" + PageEx custom + PageCallbacks MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} + Caption " " + PageExEnd + !else + !insertmacro FUNCTION_INSTALL_MODE_PAGE_FUNCTION MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} un. + UninstPage custom un.multiUser.InstallModePre_${MUI_UNIQUEID} un.MultiUser.InstallModeLeave_${MUI_UNIQUEID} + !endif +!macroend + +!macro FUNCTION_INSTALL_MODE_PAGE_FUNCTION PRE LEAVE UNINSTALLER_FUNCPREFIX + Function "${UNINSTALLER_FUNCPREFIX}${PRE}" + ${if} ${UAC_IsInnerInstance} + ${andIf} ${UAC_IsAdmin} + # inner Process (and Admin) - skip selection, inner process is always used for elevation (machine-wide) + !insertmacro setInstallModePerAllUsers + Abort + ${endIf} + + StrCpy $isForceMachineInstall "0" + StrCpy $isForceCurrentInstall "0" + !ifmacrodef customInstallmode + !insertmacro customInstallMode + !endif + + ${if} $isForceMachineInstall == "1" + ${OrIf} ${isForAllUsers} + StrCpy $hasPerMachineInstallation "1" + StrCpy $hasPerUserInstallation "0" + ${ifNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + Quit + ${endIf} + + !insertmacro setInstallModePerAllUsers + Abort + ${endIf} + + ${if} $isForceCurrentInstall == "1" + ${OrIf} ${isForCurrentUser} + StrCpy $hasPerMachineInstallation "0" + StrCpy $hasPerUserInstallation "1" + !insertmacro setInstallModePerUser + Abort + ${endIf} + + # If uninstalling, will check if there is both a per-user and per-machine installation. If there is only one, will skip the form. + # If uninstallation was invoked from the "add/remove programs" Windows will automatically requests elevation (depending if uninstall keys are in HKLM or HKCU) + # so (for uninstallation) just checking UAC_IsAdmin would probably be enought to determine if it's a per-user or per-machine. However, user can run the uninstall.exe from the folder itself + !ifdef BUILD_UNINSTALLER + ${if} $hasPerUserInstallation == "1" + ${andif} $hasPerMachineInstallation == "0" + !insertmacro setInstallModePerUser + Abort + ${elseIf} $hasPerUserInstallation == "0" + ${andIf} $hasPerMachineInstallation == "1" + ${IfNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + Quit + ${endIf} + + !insertmacro setInstallModePerAllUsers + Abort + ${endIf} + + !insertmacro MUI_HEADER_TEXT "$(chooseUninstallationOptions)" "$(whichInstallationShouldBeRemoved)" + !else + !insertmacro MUI_HEADER_TEXT "$(chooseInstallationOptions)" "$(whoShouldThisApplicationBeInstalledFor)" + !endif + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + nsDialogs::Create 1018 + Pop $MultiUser.InstallModePage + + !ifndef BUILD_UNINSTALLER + ${NSD_CreateLabel} 0u 0u 300u 20u "$(selectUserMode)" + StrCpy $8 "$(forAll)" + StrCpy $9 "$(onlyForMe)" + !else + ${NSD_CreateLabel} 0u 0u 300u 20u "$(whichInstallationRemove)" + StrCpy $8 "$(forAll)" + StrCpy $9 "$(onlyForMe)" + !endif + Pop $MultiUser.InstallModePage.Text + + ${NSD_CreateRadioButton} 10u 30u 280u 20u "$8" + Pop $MultiUser.InstallModePage.AllUsers + ${IfNot} ${UAC_IsAdmin} + !ifdef MULTIUSER_INSTALLMODE_ALLOW_ELEVATION + StrCpy $HasTwoAvailableOptions 1 + !else + # since radio button is disabled, we add that comment to the disabled control itself + SendMessage $MultiUser.InstallModePage.AllUsers ${WM_SETTEXT} 0 "STR:$8 (must run as admin)" + EnableWindow $MultiUser.InstallModePage.AllUsers 0 # start out disabled + StrCpy $HasTwoAvailableOptions 0 + !endif + ${else} + StrCpy $HasTwoAvailableOptions 1 + ${endif} + + System::Call "advapi32::GetUserName(t.r0,*i${NSIS_MAX_STRLEN})i" + ${NSD_CreateRadioButton} 10u 50u 280u 20u "$9 ($0)" + Pop $MultiUser.InstallModePage.CurrentUser + + nsDialogs::SetUserData $MultiUser.InstallModePage.AllUsers 1 ; Install for All Users (1, pra exibir o icone SHIELD de elevation) + nsDialogs::SetUserData $MultiUser.InstallModePage.CurrentUser 0 ; Install for Single User (0 pra não exibir) + + ${if} $HasTwoAvailableOptions == "1" ; if there are 2 available options, bind to radiobutton change + ${NSD_OnClick} $MultiUser.InstallModePage.CurrentUser ${UNINSTALLER_FUNCPREFIX}InstModeChange + ${NSD_OnClick} $MultiUser.InstallModePage.AllUsers ${UNINSTALLER_FUNCPREFIX}InstModeChange + ${endif} + + ${NSD_CreateLabel} 0u 110u 280u 50u "" + Pop $RadioButtonLabel1 + + ${if} $installMode == "all" + SendMessage $MultiUser.InstallModePage.AllUsers ${BM_SETCHECK} ${BST_CHECKED} 0 ; set as default + SendMessage $MultiUser.InstallModePage.AllUsers ${BM_CLICK} 0 0 ; trigger click event + ${else} + SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0 ; set as default + SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_CLICK} 0 0 ; trigger click event + ${endif} + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + nsDialogs::Show + FunctionEnd + + Function "${UNINSTALLER_FUNCPREFIX}${LEAVE}" + SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue + + ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED} + ${IfNot} ${UAC_IsAdmin} + ShowWindow $HWNDPARENT ${SW_HIDE} + !insertmacro UAC_RunElevated + ${Switch} $0 + ${Case} 0 + ${If} $1 = 1 + Quit ;we are the outer process, the inner process has done its work (ExitCode is $2), we are done + ${EndIf} + ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user + ${OrIf} $2 = 0x666666 ;our special return, the new process was not admin after all + MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(loginWithAdminAccount)" + ${EndIf} + ${Break} + ${Case} 1223 ;user aborted + ;MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This option requires admin privileges, aborting!" + ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons + ${Break} + ${Case} 1062 + MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!" ; "Unable to elevate, Secondary Logon service not running!" + ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons + ${Break} + ${Default} + MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0" + ;Quit ; instead of quit just abort going to the next page, and stay in the radiobuttons + ${Break} + ${EndSwitch} + + ShowWindow $HWNDPARENT ${SW_SHOW} + BringToFront + Abort + ${else} + !insertmacro setInstallModePerAllUsers + ${endif} + ${else} + !insertmacro setInstallModePerUser + ${endif} + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + FunctionEnd + + Function "${UNINSTALLER_FUNCPREFIX}InstModeChange" + pop $1 + nsDialogs::GetUserData $1 + pop $1 + GetDlgItem $0 $hwndParent 1 ; get item 1 (next button) at parent window, store in $0 - (0 is back, 1 is next .. what about CANCEL? http://nsis.sourceforge.net/Buttons_Header ) + + StrCpy $7 "" + ${if} "$1" == "0" ; current user + ${if} $hasPerUserInstallation == "1" + !ifndef BUILD_UNINSTALLER + StrCpy $7 "$(perUserInstallExists)($perUserInstallationFolder)$\r$\n$(reinstallUpgrade)" + !else + StrCpy $7 "$(perUserInstall)($perUserInstallationFolder)$\r$\n$(uninstall)" + !endif + ${else} + StrCpy $7 "$(freshInstallForCurrent)" + ${endif} + SendMessage $0 ${BCM_SETSHIELD} 0 0 ; hide SHIELD + ${else} ; all users + ${if} $hasPerMachineInstallation == "1" + !ifndef BUILD_UNINSTALLER + StrCpy $7 "$(perMachineInstallExists)($perMachineInstallationFolder)$\r$\n$(reinstallUpgrade)" + !else + StrCpy $7 "$(perMachineInstall)($perMachineInstallationFolder)$\r$\n$(uninstall)" + !endif + ${else} + StrCpy $7 "$(freshInstallForAll)" + ${endif} + ${ifNot} ${UAC_IsAdmin} + StrCpy $7 "$7" + SendMessage $0 ${BCM_SETSHIELD} 0 1 ; display SHIELD + ${else} + SendMessage $0 ${BCM_SETSHIELD} 0 0 ; hide SHIELD + ${endif} + ${endif} + SendMessage $RadioButtonLabel1 ${WM_SETTEXT} 0 "STR:$7" + FunctionEnd +!macroend diff --git a/client/node_modules/app-builder-lib/templates/nsis/oneClick.nsh b/client/node_modules/app-builder-lib/templates/nsis/oneClick.nsh new file mode 100644 index 0000000000..01d007ed27 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/oneClick.nsh @@ -0,0 +1,19 @@ +!ifndef BUILD_UNINSTALLER + !ifmacrodef licensePage + !insertmacro skipPageIfUpdated + !insertmacro licensePage + !endif +!endif + +!insertmacro MUI_PAGE_INSTFILES +!ifdef BUILD_UNINSTALLER + !insertmacro MUI_UNPAGE_INSTFILES +!endif + +!macro initMultiUser + !ifdef INSTALL_MODE_PER_ALL_USERS + !insertmacro setInstallModePerAllUsers + !else + !insertmacro setInstallModePerUser + !endif +!macroend \ No newline at end of file diff --git a/client/node_modules/app-builder-lib/templates/nsis/portable.nsi b/client/node_modules/app-builder-lib/templates/nsis/portable.nsi new file mode 100644 index 0000000000..e5436bb0f8 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/portable.nsi @@ -0,0 +1,91 @@ +!include "common.nsh" +!include "extractAppPackage.nsh" + +# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582 +CRCCheck off +WindowIcon Off +AutoCloseWindow True +RequestExecutionLevel ${REQUEST_EXECUTION_LEVEL} + +Function .onInit + !ifndef SPLASH_IMAGE + SetSilent silent + !endif + + !insertmacro check64BitAndSetRegView +FunctionEnd + +Function .onGUIInit + InitPluginsDir + + !ifdef SPLASH_IMAGE + File /oname=$PLUGINSDIR\splash.bmp "${SPLASH_IMAGE}" + BgImage::SetBg $PLUGINSDIR\splash.bmp + BgImage::Redraw + !endif +FunctionEnd + +Section + !ifdef SPLASH_IMAGE + HideWindow + !endif + + StrCpy $INSTDIR "$PLUGINSDIR\app" + !ifdef UNPACK_DIR_NAME + StrCpy $INSTDIR "$TEMP\${UNPACK_DIR_NAME}" + !endif + + RMDir /r $INSTDIR + SetOutPath $INSTDIR + + !ifdef APP_DIR_64 + !ifdef APP_DIR_ARM64 + !ifdef APP_DIR_32 + ${if} ${IsNativeARM64} + File /r "${APP_DIR_ARM64}\*.*" + ${elseif} ${RunningX64} + File /r "${APP_DIR_64}\*.*" + ${else} + File /r "${APP_DIR_32}\*.*" + ${endIf} + !else + ${if} ${IsNativeARM64} + File /r "${APP_DIR_ARM64}\*.*" + ${else} + File /r "${APP_DIR_64}\*.*" + {endIf} + !endif + !else + !ifdef APP_DIR_32 + ${if} ${RunningX64} + File /r "${APP_DIR_64}\*.*" + ${else} + File /r "${APP_DIR_32}\*.*" + ${endIf} + !else + File /r "${APP_DIR_64}\*.*" + !endif + !endif + !else + !ifdef APP_DIR_32 + File /r "${APP_DIR_32}\*.*" + !else + !insertmacro extractEmbeddedAppPackage + !endif + !endif + + System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_DIR", "$EXEDIR").r0' + System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_FILE", "$EXEPATH").r0' + System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("PORTABLE_EXECUTABLE_APP_FILENAME", "${APP_FILENAME}").r0' + ${StdUtils.GetAllParameters} $R0 0 + + !ifdef SPLASH_IMAGE + BgImage::Destroy + !endif + + ExecWait "$INSTDIR\${APP_EXECUTABLE_FILENAME} $R0" $0 + SetErrorLevel $0 + + SetOutPath $EXEDIR + RMDir /r $INSTDIR +SectionEnd diff --git a/client/node_modules/app-builder-lib/templates/nsis/uninstaller.nsh b/client/node_modules/app-builder-lib/templates/nsis/uninstaller.nsh new file mode 100644 index 0000000000..d400ec452d --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/nsis/uninstaller.nsh @@ -0,0 +1,245 @@ +Function un.checkAppRunning + !insertmacro CHECK_APP_RUNNING +FunctionEnd + +Function un.onInit + SetOutPath $INSTDIR + ${LogSet} on + + !insertmacro check64BitAndSetRegView + + ${If} ${Silent} + call un.checkAppRunning + ${else} + !ifdef ONE_CLICK + MessageBox MB_OKCANCEL "$(areYouSureToUninstall)" IDOK +2 + Quit + + # one-click installer executes uninstall section in the silent mode, but we must show message dialog if silent mode was not explicitly set by user (using /S flag) + call un.checkAppRunning + SetSilent silent + !endif + ${endIf} + + !insertmacro initMultiUser + + !ifmacrodef customUnInit + !insertmacro customUnInit + !endif +FunctionEnd + +Function un.atomicRMDir + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R3 "$INSTDIR$R0\*.*" + FindFirst $R1 $R2 $R3 + + loop: + StrCmp $R2 "" break + + StrCmp $R2 "." continue + StrCmp $R2 ".." continue + + IfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDir + + isDir: + CreateDirectory "$PLUGINSDIR\old-install$R0\$R2" + + Push "$R0\$R2" + Call un.atomicRMDir + Pop $R3 + + ${if} $R3 != 0 + Goto done + ${endIf} + + Goto continue + + isNotDir: + ClearErrors + Rename "$INSTDIR$R0\$R2" "$PLUGINSDIR\old-install$R0\$R2" + + # Ignore errors when renaming ourselves. + StrCmp "$R0\$R2" "${UNINSTALL_FILENAME}" 0 +2 + ClearErrors + + IfErrors 0 +3 + StrCpy $R3 "$INSTDIR$R0\$R2" + Goto done + + continue: + FindNext $R1 $R2 + Goto loop + + break: + StrCpy $R3 0 + + done: + FindClose $R1 + + StrCpy $R0 $R3 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Function un.restoreFiles + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R3 "$PLUGINSDIR\old-install$R0\*.*" + FindFirst $R1 $R2 $R3 + + loop: + StrCmp $R2 "" break + + StrCmp $R2 "." continue + StrCmp $R2 ".." continue + + IfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDir + + isDir: + CreateDirectory "$INSTDIR$R0\$R2" + + Push "$R0\$R2" + Call un.restoreFiles + Pop $R3 + + Goto continue + + isNotDir: + Rename $PLUGINSDIR\old-install$R0\$R2" "$INSTDIR$R0\$R2" + + continue: + FindNext $R1 $R2 + Goto loop + + break: + StrCpy $R0 0 + FindClose $R1 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Section "un.install" + # for assisted installer we check it here to show progress + !ifndef ONE_CLICK + ${IfNot} ${Silent} + call un.checkAppRunning + ${endIf} + !endif + + !insertmacro setLinkVars + + # delete the installed files + !ifmacrodef customRemoveFiles + !insertmacro customRemoveFiles + !else + ${if} ${isUpdated} + CreateDirectory "$PLUGINSDIR\old-install" + + Push "" + Call un.atomicRMDir + Pop $R0 + + ${if} $R0 != 0 + DetailPrint "File is busy, aborting: $R0" + + # Attempt to restore previous directory + Push "" + Call un.restoreFiles + Pop $R0 + + Abort `Can't rename "$INSTDIR" to "$PLUGINSDIR\old-install".` + ${endif} + + ${endif} + + # Remove all files (or remaining shallow directories from the block above) + RMDir /r $INSTDIR + !endif + + ${ifNot} ${isKeepShortcuts} + WinShell::UninstAppUserModelId "${APP_ID}" + + !ifndef DO_NOT_CREATE_DESKTOP_SHORTCUT + WinShell::UninstShortcut "$oldDesktopLink" + Delete "$oldDesktopLink" + !endif + + !ifndef DO_NOT_CREATE_START_MENU_SHORTCUT + WinShell::UninstShortcut "$oldStartMenuLink" + + Delete "$oldStartMenuLink" + ReadRegStr $R1 SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory + ${ifNot} $R1 == "" + RMDir "$SMPROGRAMS\$R1" + ${endIf} + !endif + ${endIf} + + # refresh the desktop + System::Call 'shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' + + !ifmacrodef unregisterFileAssociations + !insertmacro unregisterFileAssociations + !endif + + Var /GLOBAL isDeleteAppData + StrCpy $isDeleteAppData "0" + + ClearErrors + ${GetParameters} $R0 + ${GetOptions} $R0 "--delete-app-data" $R1 + ${if} ${Errors} + !ifdef DELETE_APP_DATA_ON_UNINSTALL + ${ifNot} ${isUpdated} + StrCpy $isDeleteAppData "1" + ${endif} + !endif + ${else} + StrCpy $isDeleteAppData "1" + ${endIf} + + ${if} $isDeleteAppData == "1" + # electron always uses per user app data + ${if} $installMode == "all" + SetShellVarContext current + ${endif} + RMDir /r "$APPDATA\${APP_FILENAME}" + !ifdef APP_PRODUCT_FILENAME + RMDir /r "$APPDATA\${APP_PRODUCT_FILENAME}" + !endif + # electron use package.json name for cache,indexdb etc. + !ifdef APP_PACKAGE_NAME + RMDir /r "$APPDATA\${APP_PACKAGE_NAME}" + !endif + ${if} $installMode == "all" + SetShellVarContext all + ${endif} + ${endif} + + DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" + !ifdef UNINSTALL_REGISTRY_KEY_2 + DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY_2}" + !endif + DeleteRegKey SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" + + !ifmacrodef customUnInstall + !insertmacro customUnInstall + !endif + + !ifdef ONE_CLICK + !insertmacro quitSuccess + !endif +SectionEnd diff --git a/client/node_modules/app-builder-lib/templates/snap/snapcraft.yaml b/client/node_modules/app-builder-lib/templates/snap/snapcraft.yaml new file mode 100644 index 0000000000..08ed9604b8 --- /dev/null +++ b/client/node_modules/app-builder-lib/templates/snap/snapcraft.yaml @@ -0,0 +1,148 @@ +base: core18 +grade: stable +confinement: strict +parts: + launch-scripts: + plugin: dump + source: scripts + gnome-platform-empty-dirs: + plugin: nil + override-build: > + mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/themes" + mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/icons" + mkdir -p "$SNAPCRAFT_PART_INSTALL/data-dir/sounds" + mkdir $SNAPCRAFT_PART_INSTALL/gnome-platform + + app-files: + plugin: dump + source: app + organize: + '*': app/ + stage: + - -app/chrome-sandbox + - -LICENSES.chromium.html + app: + plugin: "nil" + # cd ~ && rm -rf ~/squashfs-root && unsquashfs /media/psf/ramdisk/electron-builder-test/dist/__snap-x64/se-wo-template_1.1.0_amd64.snap + # comm -12 <(ls ~/squashfs-root/usr/lib/x86_64-linux-gnu/) <(ls /snap/gnome-3-28-1804/current/usr/lib/x86_64-linux-gnu/) > /media/psf/Home/f.txt + # run snap-exclude-list.js + stage: + - '-usr/lib/python*' + - '-usr/bin/python*' + - '-var/lib/ucf' + - '-usr/include' + - '-usr/lib/X11' + - '-usr/share' + - '-usr/sbin' + - '-usr/bin' + - "-usr/lib/*/libicudata.*" + - "-usr/lib/*/libicui18n.*" + - "-usr/lib/*/libgtk-*" + - "-usr/lib/*/libgdk-*" + - "-usr/lib/*/glib-*" + - "-usr/lib/*/gtk-*" + - "-usr/lib/*/gdk-*" + - "-usr/lib/*/krb5" + - "-usr/lib/systemd" + - "-usr/lib/glib-networking" + - "-usr/lib/dconf" + - "-usr/lib/*/avahi" + - "-usr/lib/*/gio" + - "-usr/lib/*/libatk*" + - "-usr/lib/*/libatspi*" + - "-usr/lib/*/libavahi*" + - "-usr/lib/*/libcairo*" + - "-usr/lib/*/libcolordprivate*" + - "-usr/lib/*/libcolord*" + - "-usr/lib/*/libcroco*" + - "-usr/lib/*/libcups*" + - "-usr/lib/*/libdatrie*" + - "-usr/lib/*/libdconf*" + - "-usr/lib/*/libepoxy*" + - "-usr/lib/*/libexpatw*" + - "-usr/lib/*/libffi*" + - "-usr/lib/*/libfontconfig*" + - "-usr/lib/*/libfreetype*" + - "-usr/lib/*/libgdk_pixbuf*" + - "-usr/lib/*/libgdk_pixbuf_xlib*" + - "-usr/lib/*/libgio*" + - "-usr/lib/*/libglib*" + - "-usr/lib/*/libgmodule*" + - "-usr/lib/*/libgmp*" + - "-usr/lib/*/libgnutls*" + - "-usr/lib/*/libgobject*" + - "-usr/lib/*/libgraphite2*" + - "-usr/lib/*/libgssapi_krb5*" + - "-usr/lib/*/libgthread*" + - "-usr/lib/*/libharfbuzz*" + - "-usr/lib/*/libhogweed*" + - "-usr/lib/*/libicuio*" + - "-usr/lib/*/libicutest*" + - "-usr/lib/*/libicutu*" + - "-usr/lib/*/libicuuc*" + - "-usr/lib/*/libidn2*" + - "-usr/lib/*/libjbig*" + - "-usr/lib/*/libjpeg*" + - "-usr/lib/*/libjson*" + - "-usr/lib/*/libk5crypto*" + - "-usr/lib/*/libkrb5*" + - "-usr/lib/*/libkrb5support*" + - "-usr/lib/*/liblcms2*" + - "-usr/lib/*/libnettle*" + - "-usr/lib/*/libp11*" + - "-usr/lib/*/libpango*" + - "-usr/lib/*/libpangocairo*" + - "-usr/lib/*/libpangoft2*" + - "-usr/lib/*/libpixman*" + - "-usr/lib/*/libpng16*" + - "-usr/lib/*/libproxy*" + - "-usr/lib/*/librest*" + - "-usr/lib/*/librsvg*" + - "-usr/lib/*/libsecret*" + - "-usr/lib/*/libsoup*" + - "-usr/lib/*/libsqlite3*" + - "-usr/lib/*/libtasn1*" + - "-usr/lib/*/libthai*" + - "-usr/lib/*/libtiff*" + - "-usr/lib/*/libunistring*" + - "-usr/lib/*/libwayland*" + - "-usr/lib/*/libX11*" + - "-usr/lib/*/libXau*" + - "-usr/lib/*/libxcb.so*" + - "-usr/lib/*/libxcb-dri2*" + - "-usr/lib/*/libxcb-dri3*" + - "-usr/lib/*/libxcb-glx*" + - "-usr/lib/*/libxcb-present*" + - "-usr/lib/*/libxcb-render*" + - "-usr/lib/*/libxcb-shm*" + - "-usr/lib/*/libxcb-sync*" + - "-usr/lib/*/libxcb-xfixes*" + - "-usr/lib/*/libXcomposite*" + - "-usr/lib/*/libXcursor*" + - "-usr/lib/*/libXdamage*" + - "-usr/lib/*/libXdmcp*" + - "-usr/lib/*/libXext*" + - "-usr/lib/*/libXfixes*" + - "-usr/lib/*/libXinerama*" + - "-usr/lib/*/libXi*" + - "-usr/lib/*/libxkbcommon*" + - "-usr/lib/*/libxml2*" + - "-usr/lib/*/libXrandr*" + - "-usr/lib/*/libXrender*" +plugs: + gnome-3-28-1804: + interface: content + target: $SNAP/gnome-platform + default-provider: gnome-3-28-1804 + gtk-3-themes: + interface: content + target: $SNAP/data-dir/themes + default-provider: gtk-common-themes + icon-themes: + interface: content + target: $SNAP/data-dir/icons + default-provider: gtk-common-themes + sound-themes: + interface: content + target: $SNAP/data-dir/sounds + default-provider: gtk-common-themes diff --git a/client/node_modules/builder-util-runtime/LICENSE b/client/node_modules/builder-util-runtime/LICENSE new file mode 100644 index 0000000000..7d8fa01c28 --- /dev/null +++ b/client/node_modules/builder-util-runtime/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Loopline Systems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/client/node_modules/builder-util-runtime/out/CancellationToken.d.ts b/client/node_modules/builder-util-runtime/out/CancellationToken.d.ts new file mode 100644 index 0000000000..2f2c2c78d0 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/CancellationToken.d.ts @@ -0,0 +1,18 @@ +/// +import { EventEmitter } from "events"; +export declare class CancellationToken extends EventEmitter { + private parentCancelHandler; + private _cancelled; + get cancelled(): boolean; + private _parent; + set parent(value: CancellationToken); + constructor(parent?: CancellationToken); + cancel(): void; + private onCancel; + createPromise(callback: (resolve: (thenableOrResult: R | PromiseLike) => void, reject: (error: Error) => void, onCancel: (callback: () => void) => void) => void): Promise; + private removeParentCancelHandler; + dispose(): void; +} +export declare class CancellationError extends Error { + constructor(); +} diff --git a/client/node_modules/builder-util-runtime/out/CancellationToken.js b/client/node_modules/builder-util-runtime/out/CancellationToken.js new file mode 100644 index 0000000000..91feab3bb4 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/CancellationToken.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CancellationError = exports.CancellationToken = void 0; +const events_1 = require("events"); +class CancellationToken extends events_1.EventEmitter { + // babel cannot compile ... correctly for super calls + constructor(parent) { + super(); + this.parentCancelHandler = null; + this._parent = null; + this._cancelled = false; + if (parent != null) { + this.parent = parent; + } + } + get cancelled() { + return this._cancelled || (this._parent != null && this._parent.cancelled); + } + set parent(value) { + this.removeParentCancelHandler(); + this._parent = value; + this.parentCancelHandler = () => this.cancel(); + this._parent.onCancel(this.parentCancelHandler); + } + cancel() { + this._cancelled = true; + this.emit("cancel"); + } + onCancel(handler) { + if (this.cancelled) { + handler(); + } + else { + this.once("cancel", handler); + } + } + createPromise(callback) { + if (this.cancelled) { + return Promise.reject(new CancellationError()); + } + const finallyHandler = () => { + if (cancelHandler != null) { + try { + this.removeListener("cancel", cancelHandler); + cancelHandler = null; + } + catch (ignore) { + // ignore + } + } + }; + let cancelHandler = null; + return new Promise((resolve, reject) => { + let addedCancelHandler = null; + cancelHandler = () => { + try { + if (addedCancelHandler != null) { + addedCancelHandler(); + addedCancelHandler = null; + } + } + finally { + reject(new CancellationError()); + } + }; + if (this.cancelled) { + cancelHandler(); + return; + } + this.onCancel(cancelHandler); + callback(resolve, reject, (callback) => { + addedCancelHandler = callback; + }); + }) + .then(it => { + finallyHandler(); + return it; + }) + .catch(e => { + finallyHandler(); + throw e; + }); + } + removeParentCancelHandler() { + const parent = this._parent; + if (parent != null && this.parentCancelHandler != null) { + parent.removeListener("cancel", this.parentCancelHandler); + this.parentCancelHandler = null; + } + } + dispose() { + try { + this.removeParentCancelHandler(); + } + finally { + this.removeAllListeners(); + this._parent = null; + } + } +} +exports.CancellationToken = CancellationToken; +class CancellationError extends Error { + constructor() { + super("cancelled"); + } +} +exports.CancellationError = CancellationError; +//# sourceMappingURL=CancellationToken.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/CancellationToken.js.map b/client/node_modules/builder-util-runtime/out/CancellationToken.js.map new file mode 100644 index 0000000000..beb735e597 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/CancellationToken.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CancellationToken.js","sourceRoot":"","sources":["../src/CancellationToken.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,MAAa,iBAAkB,SAAQ,qBAAY;IAiBjD,qDAAqD;IACrD,YAAY,MAA0B;QACpC,KAAK,EAAE,CAAA;QAlBD,wBAAmB,GAAuB,IAAI,CAAA;QAO9C,YAAO,GAA6B,IAAI,CAAA;QAa9C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACvB,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;SACrB;IACH,CAAC;IArBD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC5E,CAAC;IAGD,IAAI,MAAM,CAAC,KAAwB;QACjC,IAAI,CAAC,yBAAyB,EAAE,CAAA;QAEhC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAA;QAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IACjD,CAAC;IAYD,MAAM;QACJ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrB,CAAC;IAEO,QAAQ,CAAC,OAAkB;QACjC,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,EAAE,CAAA;SACV;aAAM;YACL,IAAI,CAAC,IA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AAE;YACT,cAAc,EAAE,CAAA;YAChB,MAAM,CAAC,CAAA;QACT,CAAC,CAAC,CAAA;IACN,CAAC;IAEO,yBAAyB;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,mBAAmB,IAAI,IAAI,EAAE;YACtD,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAA;YACzD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAA;SAChC;IACH,CAAC;IAED,OAAO;QACL,IAAI;YACF,IAAI,CAAC,yBAAyB,EAAE,CAAA;SACjC;gBAAS;YACR,IAAI,CAAC,kBAAkB,EAAE,CAAA;YACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;SACpB;IACH,CAAC;CACF;AA9GD,8CA8GC;AAED,MAAa,iBAAkB,SAAQ,KAAK;IAC1C;QACE,KAAK,CAAC,WAAW,CAAC,CAAA;IACpB,CAAC;CACF;AAJD,8CAIC","sourcesContent":["import { EventEmitter } from \"events\"\n\nexport class CancellationToken extends EventEmitter {\n private parentCancelHandler: (() => any) | null = null\n\n private _cancelled: boolean\n get cancelled(): boolean {\n return this._cancelled || (this._parent != null && this._parent.cancelled)\n }\n\n private _parent: CancellationToken | null = null\n set parent(value: CancellationToken) {\n this.removeParentCancelHandler()\n\n this._parent = value\n this.parentCancelHandler = () => this.cancel()\n this._parent.onCancel(this.parentCancelHandler)\n }\n\n // babel cannot compile ... correctly for super calls\n constructor(parent?: CancellationToken) {\n super()\n\n this._cancelled = false\n if (parent != null) {\n this.parent = parent\n }\n }\n\n cancel() {\n this._cancelled = true\n this.emit(\"cancel\")\n }\n\n private onCancel(handler: () => any) {\n if (this.cancelled) {\n handler()\n } else {\n this.once(\"cancel\", handler)\n }\n }\n\n createPromise(\n callback: (resolve: (thenableOrResult: R | PromiseLike) => void, reject: (error: Error) => void, onCancel: (callback: () => void) => void) => void\n ): Promise {\n if (this.cancelled) {\n return Promise.reject(new CancellationError())\n }\n\n const finallyHandler = () => {\n if (cancelHandler != null) {\n try {\n this.removeListener(\"cancel\", cancelHandler)\n cancelHandler = null\n } catch (ignore) {\n // ignore\n }\n }\n }\n\n let cancelHandler: (() => void) | null = null\n return new Promise((resolve, reject) => {\n let addedCancelHandler: (() => void) | null = null\n\n cancelHandler = () => {\n try {\n if (addedCancelHandler != null) {\n addedCancelHandler()\n addedCancelHandler = null\n }\n } finally {\n reject(new CancellationError())\n }\n }\n\n if (this.cancelled) {\n cancelHandler()\n return\n }\n\n this.onCancel(cancelHandler)\n\n callback(resolve, reject, (callback: () => void) => {\n addedCancelHandler = callback\n })\n })\n .then(it => {\n finallyHandler()\n return it\n })\n .catch(e => {\n finallyHandler()\n throw e\n })\n }\n\n private removeParentCancelHandler() {\n const parent = this._parent\n if (parent != null && this.parentCancelHandler != null) {\n parent.removeListener(\"cancel\", this.parentCancelHandler)\n this.parentCancelHandler = null\n }\n }\n\n dispose() {\n try {\n this.removeParentCancelHandler()\n } finally {\n this.removeAllListeners()\n this._parent = null\n }\n }\n}\n\nexport class CancellationError extends Error {\n constructor() {\n super(\"cancelled\")\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.d.ts b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.d.ts new file mode 100644 index 0000000000..61a857bc9c --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.d.ts @@ -0,0 +1,22 @@ +/// +import { Transform } from "stream"; +import { CancellationToken } from "./CancellationToken"; +export interface ProgressInfo { + total: number; + delta: number; + transferred: number; + percent: number; + bytesPerSecond: number; +} +export declare class ProgressCallbackTransform extends Transform { + private readonly total; + private readonly cancellationToken; + private readonly onProgress; + private start; + private transferred; + private delta; + private nextUpdate; + constructor(total: number, cancellationToken: CancellationToken, onProgress: (info: ProgressInfo) => any); + _transform(chunk: any, encoding: string, callback: any): void; + _flush(callback: any): void; +} diff --git a/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js new file mode 100644 index 0000000000..e456a0407a --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ProgressCallbackTransform = void 0; +const stream_1 = require("stream"); +class ProgressCallbackTransform extends stream_1.Transform { + constructor(total, cancellationToken, onProgress) { + super(); + this.total = total; + this.cancellationToken = cancellationToken; + this.onProgress = onProgress; + this.start = Date.now(); + this.transferred = 0; + this.delta = 0; + this.nextUpdate = this.start + 1000; + } + _transform(chunk, encoding, callback) { + if (this.cancellationToken.cancelled) { + callback(new Error("cancelled"), null); + return; + } + this.transferred += chunk.length; + this.delta += chunk.length; + const now = Date.now(); + if (now >= this.nextUpdate && this.transferred !== this.total /* will be emitted on _flush */) { + this.nextUpdate = now + 1000; + this.onProgress({ + total: this.total, + delta: this.delta, + transferred: this.transferred, + percent: (this.transferred / this.total) * 100, + bytesPerSecond: Math.round(this.transferred / ((now - this.start) / 1000)), + }); + this.delta = 0; + } + callback(null, chunk); + } + _flush(callback) { + if (this.cancellationToken.cancelled) { + callback(new Error("cancelled")); + return; + } + this.onProgress({ + total: this.total, + delta: this.delta, + transferred: this.total, + percent: 100, + bytesPerSecond: Math.round(this.transferred / ((Date.now() - this.start) / 1000)), + }); + this.delta = 0; + callback(null); + } +} +exports.ProgressCallbackTransform = ProgressCallbackTransform; +//# sourceMappingURL=ProgressCallbackTransform.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js.map b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js.map new file mode 100644 index 0000000000..d2e674d79a --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProgressCallbackTransform.js","sourceRoot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K,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;aAC3E,CAAC,CAAA;YACF,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;SACf;QAED,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvB,CAAC;IAED,MAAM,CAAC,QAAa;QAClB,IAAI,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE;YACpC,QAAQ,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;YAChC,OAAM;SACP;QAED,IAAI,CAAC,UAAU,CAAC;YACd,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,KAAK;YACvB,OAAO,EAAE,GAAG;YACZ,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;SAClF,CAAC,CAAA;QACF,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;QAEd,QAAQ,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;CACF;AAtDD,8DAsDC","sourcesContent":["import { Transform } from \"stream\"\nimport { CancellationToken } from \"./CancellationToken\"\n\nexport interface ProgressInfo {\n total: number\n delta: number\n transferred: number\n percent: number\n bytesPerSecond: number\n}\n\nexport class ProgressCallbackTransform extends Transform {\n private start = Date.now()\n private transferred = 0\n private delta = 0\n\n private nextUpdate = this.start + 1000\n\n constructor(private readonly total: number, private readonly cancellationToken: CancellationToken, private readonly onProgress: (info: ProgressInfo) => any) {\n super()\n }\n\n _transform(chunk: any, encoding: string, callback: any) {\n if (this.cancellationToken.cancelled) {\n callback(new Error(\"cancelled\"), null)\n return\n }\n\n this.transferred += chunk.length\n this.delta += chunk.length\n\n const now = Date.now()\n if (now >= this.nextUpdate && this.transferred !== this.total /* will be emitted on _flush */) {\n this.nextUpdate = now + 1000\n\n this.onProgress({\n total: this.total,\n delta: this.delta,\n transferred: this.transferred,\n percent: (this.transferred / this.total) * 100,\n bytesPerSecond: Math.round(this.transferred / ((now - this.start) / 1000)),\n })\n this.delta = 0\n }\n\n callback(null, chunk)\n }\n\n _flush(callback: any): void {\n if (this.cancellationToken.cancelled) {\n callback(new Error(\"cancelled\"))\n return\n }\n\n this.onProgress({\n total: this.total,\n delta: this.delta,\n transferred: this.total,\n percent: 100,\n bytesPerSecond: Math.round(this.transferred / ((Date.now() - this.start) / 1000)),\n })\n this.delta = 0\n\n callback(null)\n }\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/blockMapApi.d.ts b/client/node_modules/builder-util-runtime/out/blockMapApi.d.ts new file mode 100644 index 0000000000..cd72174ef9 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/blockMapApi.d.ts @@ -0,0 +1,12 @@ +export interface FileChunks { + checksums: Array; + sizes: Array; +} +export interface BlockMap { + version: "1" | "2"; + files: Array; +} +export interface BlockMapFile extends FileChunks { + name: string; + offset: number; +} diff --git a/client/node_modules/builder-util-runtime/out/blockMapApi.js b/client/node_modules/builder-util-runtime/out/blockMapApi.js new file mode 100644 index 0000000000..0e09ce317b --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/blockMapApi.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=blockMapApi.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/blockMapApi.js.map b/client/node_modules/builder-util-runtime/out/blockMapApi.js.map new file mode 100644 index 0000000000..d4d4ab9335 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/blockMapApi.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blockMapApi.js","sourceRoot":"","sources":["../src/blockMapApi.ts"],"names":[],"mappings":"","sourcesContent":["export interface FileChunks {\n checksums: Array\n sizes: Array\n}\n\nexport interface BlockMap {\n version: \"1\" | \"2\"\n files: Array\n}\n\nexport interface BlockMapFile extends FileChunks {\n name: string\n offset: number\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/httpExecutor.d.ts b/client/node_modules/builder-util-runtime/out/httpExecutor.d.ts new file mode 100644 index 0000000000..fb55c3ae24 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/httpExecutor.d.ts @@ -0,0 +1,72 @@ +/// +import { BinaryToTextEncoding } from "crypto"; +import { IncomingMessage, OutgoingHttpHeaders, RequestOptions } from "http"; +import { Transform } from "stream"; +import { URL } from "url"; +import { CancellationToken } from "./CancellationToken"; +import { ProgressInfo } from "./ProgressCallbackTransform"; +export interface RequestHeaders extends OutgoingHttpHeaders { + [key: string]: string; +} +export interface DownloadOptions { + readonly headers?: OutgoingHttpHeaders | null; + readonly sha2?: string | null; + readonly sha512?: string | null; + readonly cancellationToken: CancellationToken; + onProgress?: (progress: ProgressInfo) => void; +} +export declare function createHttpError(response: IncomingMessage, description?: any | null): HttpError; +export declare class HttpError extends Error { + readonly statusCode: number; + readonly description: any | null; + constructor(statusCode: number, message?: string, description?: any | null); + isServerError(): boolean; +} +export declare function parseJson(result: Promise): Promise; +interface Request { + abort: () => void; + end: (data?: Buffer) => void; +} +export declare abstract class HttpExecutor { + protected readonly maxRedirects = 10; + request(options: RequestOptions, cancellationToken?: CancellationToken, data?: { + [name: string]: any; + } | null): Promise; + doApiRequest(options: RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: T, reject: (error: Error) => void) => void, redirectCount?: number): Promise; + protected addRedirectHandlers(request: any, options: RequestOptions, reject: (error: Error) => void, redirectCount: number, handler: (options: RequestOptions) => void): void; + addErrorAndTimeoutHandlers(request: any, reject: (error: Error) => void, timeout?: number): void; + private handleResponse; + abstract createRequest(options: RequestOptions, callback: (response: any) => void): T; + downloadToBuffer(url: URL, options: DownloadOptions): Promise; + protected doDownload(requestOptions: RequestOptions, options: DownloadCallOptions, redirectCount: number): void; + protected createMaxRedirectError(): Error; + private addTimeOutHandler; + static prepareRedirectUrlOptions(redirectUrl: string, options: RequestOptions): RequestOptions; + static retryOnServerError(task: () => Promise, maxRetries?: number): Promise; +} +export interface DownloadCallOptions { + responseHandler: ((response: IncomingMessage, callback: (error: Error | null) => void) => void) | null; + onCancel: (callback: () => void) => void; + callback: (error: Error | null) => void; + options: DownloadOptions; + destination: string | null; +} +export declare function configureRequestOptionsFromUrl(url: string, options: RequestOptions): RequestOptions; +export declare function configureRequestUrl(url: URL, options: RequestOptions): void; +export declare class DigestTransform extends Transform { + readonly expected: string; + private readonly algorithm; + private readonly encoding; + private readonly digester; + private _actual; + get actual(): string | null; + isValidateOnEnd: boolean; + constructor(expected: string, algorithm?: string, encoding?: BinaryToTextEncoding); + _transform(chunk: Buffer, encoding: string, callback: any): void; + _flush(callback: any): void; + validate(): null; +} +export declare function safeGetHeader(response: any, headerKey: string): any; +export declare function configureRequestOptions(options: RequestOptions, token?: string | null, method?: "GET" | "DELETE" | "PUT" | "POST"): RequestOptions; +export declare function safeStringifyJson(data: any, skippedNames?: Set): string; +export {}; diff --git a/client/node_modules/builder-util-runtime/out/httpExecutor.js b/client/node_modules/builder-util-runtime/out/httpExecutor.js new file mode 100644 index 0000000000..5c3c2cf8c2 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/httpExecutor.js @@ -0,0 +1,453 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.safeStringifyJson = exports.configureRequestOptions = exports.safeGetHeader = exports.DigestTransform = exports.configureRequestUrl = exports.configureRequestOptionsFromUrl = exports.HttpExecutor = exports.parseJson = exports.HttpError = exports.createHttpError = void 0; +const crypto_1 = require("crypto"); +const debug_1 = require("debug"); +const fs_1 = require("fs"); +const stream_1 = require("stream"); +const url_1 = require("url"); +const CancellationToken_1 = require("./CancellationToken"); +const index_1 = require("./index"); +const ProgressCallbackTransform_1 = require("./ProgressCallbackTransform"); +const debug = debug_1.default("electron-builder"); +function createHttpError(response, description = null) { + return new HttpError(response.statusCode || -1, `${response.statusCode} ${response.statusMessage}` + + (description == null ? "" : "\n" + JSON.stringify(description, null, " ")) + + "\nHeaders: " + + safeStringifyJson(response.headers), description); +} +exports.createHttpError = createHttpError; +const HTTP_STATUS_CODES = new Map([ + [429, "Too many requests"], + [400, "Bad request"], + [403, "Forbidden"], + [404, "Not found"], + [405, "Method not allowed"], + [406, "Not acceptable"], + [408, "Request timeout"], + [413, "Request entity too large"], + [500, "Internal server error"], + [502, "Bad gateway"], + [503, "Service unavailable"], + [504, "Gateway timeout"], + [505, "HTTP version not supported"], +]); +class HttpError extends Error { + constructor(statusCode, message = `HTTP error: ${HTTP_STATUS_CODES.get(statusCode) || statusCode}`, description = null) { + super(message); + this.statusCode = statusCode; + this.description = description; + this.name = "HttpError"; + this.code = `HTTP_ERROR_${statusCode}`; + } + isServerError() { + return this.statusCode >= 500 && this.statusCode <= 599; + } +} +exports.HttpError = HttpError; +function parseJson(result) { + return result.then(it => (it == null || it.length === 0 ? null : JSON.parse(it))); +} +exports.parseJson = parseJson; +class HttpExecutor { + constructor() { + this.maxRedirects = 10; + } + request(options, cancellationToken = new CancellationToken_1.CancellationToken(), data) { + configureRequestOptions(options); + const json = data == null ? undefined : JSON.stringify(data); + const encodedData = json ? Buffer.from(json) : undefined; + if (encodedData != null) { + debug(json); + const { headers, ...opts } = options; + options = { + method: "post", + headers: { + "Content-Type": "application/json", + "Content-Length": encodedData.length, + ...headers, + }, + ...opts, + }; + } + return this.doApiRequest(options, cancellationToken, it => it.end(encodedData)); + } + doApiRequest(options, cancellationToken, requestProcessor, redirectCount = 0) { + if (debug.enabled) { + debug(`Request: ${safeStringifyJson(options)}`); + } + return cancellationToken.createPromise((resolve, reject, onCancel) => { + const request = this.createRequest(options, (response) => { + try { + this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor); + } + catch (e) { + reject(e); + } + }); + this.addErrorAndTimeoutHandlers(request, reject, options.timeout); + this.addRedirectHandlers(request, options, reject, redirectCount, options => { + this.doApiRequest(options, cancellationToken, requestProcessor, redirectCount).then(resolve).catch(reject); + }); + requestProcessor(request, reject); + onCancel(() => request.abort()); + }); + } + // noinspection JSUnusedLocalSymbols + // eslint-disable-next-line + addRedirectHandlers(request, options, reject, redirectCount, handler) { + // not required for NodeJS + } + addErrorAndTimeoutHandlers(request, reject, timeout = 60 * 1000) { + this.addTimeOutHandler(request, reject, timeout); + request.on("error", reject); + request.on("aborted", () => { + reject(new Error("Request has been aborted by the server")); + }); + } + handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor) { + var _a; + if (debug.enabled) { + debug(`Response: ${response.statusCode} ${response.statusMessage}, request options: ${safeStringifyJson(options)}`); + } + // we handle any other >= 400 error on request end (read detailed message in the response body) + if (response.statusCode === 404) { + // error is clear, we don't need to read detailed error description + reject(createHttpError(response, `method: ${options.method || "GET"} url: ${options.protocol || "https:"}//${options.hostname}${options.port ? `:${options.port}` : ""}${options.path} + +Please double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404. +`)); + return; + } + else if (response.statusCode === 204) { + // on DELETE request + resolve(); + return; + } + const code = (_a = response.statusCode) !== null && _a !== void 0 ? _a : 0; + const shouldRedirect = code >= 300 && code < 400; + const redirectUrl = safeGetHeader(response, "location"); + if (shouldRedirect && redirectUrl != null) { + if (redirectCount > this.maxRedirects) { + reject(this.createMaxRedirectError()); + return; + } + this.doApiRequest(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, options), cancellationToken, requestProcessor, redirectCount).then(resolve).catch(reject); + return; + } + response.setEncoding("utf8"); + let data = ""; + response.on("error", reject); + response.on("data", (chunk) => (data += chunk)); + response.on("end", () => { + try { + if (response.statusCode != null && response.statusCode >= 400) { + const contentType = safeGetHeader(response, "content-type"); + const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes("json")) != null : contentType.includes("json")); + reject(createHttpError(response, `method: ${options.method || "GET"} url: ${options.protocol || "https:"}//${options.hostname}${options.port ? `:${options.port}` : ""}${options.path} + + Data: + ${isJson ? JSON.stringify(JSON.parse(data)) : data} + `)); + } + else { + resolve(data.length === 0 ? null : data); + } + } + catch (e) { + reject(e); + } + }); + } + async downloadToBuffer(url, options) { + return await options.cancellationToken.createPromise((resolve, reject, onCancel) => { + let result = null; + const requestOptions = { + headers: options.headers || undefined, + // because PrivateGitHubProvider requires HttpExecutor.prepareRedirectUrlOptions logic, so, we need to redirect manually + redirect: "manual", + }; + configureRequestUrl(url, requestOptions); + configureRequestOptions(requestOptions); + this.doDownload(requestOptions, { + destination: null, + options, + onCancel, + callback: error => { + if (error == null) { + resolve(result); + } + else { + reject(error); + } + }, + responseHandler: (response, callback) => { + const contentLength = safeGetHeader(response, "content-length"); + let position = -1; + if (contentLength != null) { + const size = parseInt(contentLength, 10); + if (size > 0) { + if (size > 524288000) { + callback(new Error("Maximum allowed size is 500 MB")); + return; + } + result = Buffer.alloc(size); + position = 0; + } + } + response.on("data", (chunk) => { + if (position !== -1) { + chunk.copy(result, position); + position += chunk.length; + } + else if (result == null) { + result = chunk; + } + else { + if (result.length > 524288000) { + callback(new Error("Maximum allowed size is 500 MB")); + return; + } + result = Buffer.concat([result, chunk]); + } + }); + response.on("end", () => { + if (result != null && position !== -1 && position !== result.length) { + callback(new Error(`Received data length ${position} is not equal to expected ${result.length}`)); + } + else { + callback(null); + } + }); + }, + }, 0); + }); + } + doDownload(requestOptions, options, redirectCount) { + const request = this.createRequest(requestOptions, (response) => { + if (response.statusCode >= 400) { + options.callback(new Error(`Cannot download "${requestOptions.protocol || "https:"}//${requestOptions.hostname}${requestOptions.path}", status ${response.statusCode}: ${response.statusMessage}`)); + return; + } + // It is possible for the response stream to fail, e.g. when a network is lost while + // response stream is in progress. Stop waiting and reject so consumer can catch the error. + response.on("error", options.callback); + // this code not relevant for Electron (redirect event instead handled) + const redirectUrl = safeGetHeader(response, "location"); + if (redirectUrl != null) { + if (redirectCount < this.maxRedirects) { + this.doDownload(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, requestOptions), options, redirectCount++); + } + else { + options.callback(this.createMaxRedirectError()); + } + return; + } + if (options.responseHandler == null) { + configurePipes(options, response); + } + else { + options.responseHandler(response, options.callback); + } + }); + this.addErrorAndTimeoutHandlers(request, options.callback, requestOptions.timeout); + this.addRedirectHandlers(request, requestOptions, options.callback, redirectCount, requestOptions => { + this.doDownload(requestOptions, options, redirectCount++); + }); + request.end(); + } + createMaxRedirectError() { + return new Error(`Too many redirects (> ${this.maxRedirects})`); + } + addTimeOutHandler(request, callback, timeout) { + request.on("socket", (socket) => { + socket.setTimeout(timeout, () => { + request.abort(); + callback(new Error("Request timed out")); + }); + }); + } + static prepareRedirectUrlOptions(redirectUrl, options) { + const newOptions = configureRequestOptionsFromUrl(redirectUrl, { ...options }); + const headers = newOptions.headers; + if (headers === null || headers === void 0 ? void 0 : headers.authorization) { + const parsedNewUrl = new url_1.URL(redirectUrl); + if (parsedNewUrl.hostname.endsWith(".amazonaws.com") || parsedNewUrl.searchParams.has("X-Amz-Credential")) { + delete headers.authorization; + } + } + return newOptions; + } + static retryOnServerError(task, maxRetries = 3) { + for (let attemptNumber = 0;; attemptNumber++) { + try { + return task(); + } + catch (e) { + if (attemptNumber < maxRetries && ((e instanceof HttpError && e.isServerError()) || e.code === "EPIPE")) { + continue; + } + throw e; + } + } + } +} +exports.HttpExecutor = HttpExecutor; +function configureRequestOptionsFromUrl(url, options) { + const result = configureRequestOptions(options); + configureRequestUrl(new url_1.URL(url), result); + return result; +} +exports.configureRequestOptionsFromUrl = configureRequestOptionsFromUrl; +function configureRequestUrl(url, options) { + options.protocol = url.protocol; + options.hostname = url.hostname; + if (url.port) { + options.port = url.port; + } + else if (options.port) { + delete options.port; + } + options.path = url.pathname + url.search; +} +exports.configureRequestUrl = configureRequestUrl; +class DigestTransform extends stream_1.Transform { + constructor(expected, algorithm = "sha512", encoding = "base64") { + super(); + this.expected = expected; + this.algorithm = algorithm; + this.encoding = encoding; + this._actual = null; + this.isValidateOnEnd = true; + this.digester = crypto_1.createHash(algorithm); + } + // noinspection JSUnusedGlobalSymbols + get actual() { + return this._actual; + } + // noinspection JSUnusedGlobalSymbols + _transform(chunk, encoding, callback) { + this.digester.update(chunk); + callback(null, chunk); + } + // noinspection JSUnusedGlobalSymbols + _flush(callback) { + this._actual = this.digester.digest(this.encoding); + if (this.isValidateOnEnd) { + try { + this.validate(); + } + catch (e) { + callback(e); + return; + } + } + callback(null); + } + validate() { + if (this._actual == null) { + throw index_1.newError("Not finished yet", "ERR_STREAM_NOT_FINISHED"); + } + if (this._actual !== this.expected) { + throw index_1.newError(`${this.algorithm} checksum mismatch, expected ${this.expected}, got ${this._actual}`, "ERR_CHECKSUM_MISMATCH"); + } + return null; + } +} +exports.DigestTransform = DigestTransform; +function checkSha2(sha2Header, sha2, callback) { + if (sha2Header != null && sha2 != null && sha2Header !== sha2) { + callback(new Error(`checksum mismatch: expected ${sha2} but got ${sha2Header} (X-Checksum-Sha2 header)`)); + return false; + } + return true; +} +function safeGetHeader(response, headerKey) { + const value = response.headers[headerKey]; + if (value == null) { + return null; + } + else if (Array.isArray(value)) { + // electron API + return value.length === 0 ? null : value[value.length - 1]; + } + else { + return value; + } +} +exports.safeGetHeader = safeGetHeader; +function configurePipes(options, response) { + if (!checkSha2(safeGetHeader(response, "X-Checksum-Sha2"), options.options.sha2, options.callback)) { + return; + } + const streams = []; + if (options.options.onProgress != null) { + const contentLength = safeGetHeader(response, "content-length"); + if (contentLength != null) { + streams.push(new ProgressCallbackTransform_1.ProgressCallbackTransform(parseInt(contentLength, 10), options.options.cancellationToken, options.options.onProgress)); + } + } + const sha512 = options.options.sha512; + if (sha512 != null) { + streams.push(new DigestTransform(sha512, "sha512", sha512.length === 128 && !sha512.includes("+") && !sha512.includes("Z") && !sha512.includes("=") ? "hex" : "base64")); + } + else if (options.options.sha2 != null) { + streams.push(new DigestTransform(options.options.sha2, "sha256", "hex")); + } + const fileOut = fs_1.createWriteStream(options.destination); + streams.push(fileOut); + let lastStream = response; + for (const stream of streams) { + stream.on("error", (error) => { + fileOut.close(); + if (!options.options.cancellationToken.cancelled) { + options.callback(error); + } + }); + lastStream = lastStream.pipe(stream); + } + fileOut.on("finish", () => { + ; + fileOut.close(options.callback); + }); +} +function configureRequestOptions(options, token, method) { + if (method != null) { + options.method = method; + } + options.headers = { ...options.headers }; + const headers = options.headers; + if (token != null) { + ; + headers.authorization = token.startsWith("Basic") || token.startsWith("Bearer") ? token : `token ${token}`; + } + if (headers["User-Agent"] == null) { + headers["User-Agent"] = "electron-builder"; + } + if (method == null || method === "GET" || headers["Cache-Control"] == null) { + headers["Cache-Control"] = "no-cache"; + } + // do not specify for node (in any case we use https module) + if (options.protocol == null && process.versions.electron != null) { + options.protocol = "https:"; + } + return options; +} +exports.configureRequestOptions = configureRequestOptions; +function safeStringifyJson(data, skippedNames) { + return JSON.stringify(data, (name, value) => { + if (name.endsWith("Authorization") || + name.endsWith("authorization") || + name.endsWith("Password") || + name.endsWith("PASSWORD") || + name.endsWith("Token") || + name.includes("password") || + name.includes("token") || + (skippedNames != null && skippedNames.has(name))) { + return ""; + } + return value; + }, 2); +} +exports.safeStringifyJson = safeStringifyJson; +//# sourceMappingURL=httpExecutor.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/httpExecutor.js.map b/client/node_modules/builder-util-runtime/out/httpExecutor.js.map new file mode 100644 index 0000000000..f47666b95c --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/httpExecutor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"httpExecutor.js","sourceRoot":"","sources":["../src/httpExecutor.ts"],"names":[],"mappings":";;;AAAA,mCAA+D;AAC/D,iCAA0B;AAC1B,2BAAsC;AAGtC,mCAAkC;AAClC,6BAAyB;AACzB,2DAAuD;AACvD,mCAAkC;AAClC,2EAAqF;AAErF,MAAM,KAAK,GAAG,eAAM,CAAC,kBAAkB,CAAC,CAAA;AAi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from \"fs\"\nimport { IncomingMessage, OutgoingHttpHeaders, RequestOptions } from \"http\"\nimport { Socket } from \"net\"\nimport { Transform } from \"stream\"\nimport { URL } from \"url\"\nimport { CancellationToken } from \"./CancellationToken\"\nimport { newError } from \"./index\"\nimport { ProgressCallbackTransform, ProgressInfo } from \"./ProgressCallbackTransform\"\n\nconst debug = _debug(\"electron-builder\")\n\nexport interface RequestHeaders extends OutgoingHttpHeaders {\n [key: string]: string\n}\n\nexport interface DownloadOptions {\n readonly headers?: OutgoingHttpHeaders | null\n readonly sha2?: string | null\n readonly sha512?: string | null\n\n readonly cancellationToken: CancellationToken\n\n // noinspection JSUnusedLocalSymbols\n onProgress?: (progress: ProgressInfo) => void\n}\n\nexport function createHttpError(response: IncomingMessage, description: any | null = null) {\n return new HttpError(\n response.statusCode || -1,\n `${response.statusCode} ${response.statusMessage}` +\n (description == null ? \"\" : \"\\n\" + JSON.stringify(description, null, \" \")) +\n \"\\nHeaders: \" +\n safeStringifyJson(response.headers),\n description\n )\n}\n\nconst HTTP_STATUS_CODES = new Map([\n [429, \"Too many requests\"],\n [400, \"Bad request\"],\n [403, \"Forbidden\"],\n [404, \"Not found\"],\n [405, \"Method not allowed\"],\n [406, \"Not acceptable\"],\n [408, \"Request timeout\"],\n [413, \"Request entity too large\"],\n [500, \"Internal server error\"],\n [502, \"Bad gateway\"],\n [503, \"Service unavailable\"],\n [504, \"Gateway timeout\"],\n [505, \"HTTP version not supported\"],\n])\n\nexport class HttpError extends Error {\n constructor(readonly statusCode: number, message = `HTTP error: ${HTTP_STATUS_CODES.get(statusCode) || statusCode}`, readonly description: any | null = null) {\n super(message)\n\n this.name = \"HttpError\"\n ;(this as NodeJS.ErrnoException).code = `HTTP_ERROR_${statusCode}`\n }\n\n isServerError() {\n return this.statusCode >= 500 && this.statusCode <= 599\n }\n}\n\nexport function parseJson(result: Promise) {\n return result.then(it => (it == null || it.length === 0 ? null : JSON.parse(it)))\n}\n\ninterface Request {\n abort: () => void\n end: (data?: Buffer) => void\n}\nexport abstract class HttpExecutor {\n protected readonly maxRedirects = 10\n\n request(options: RequestOptions, cancellationToken: CancellationToken = new CancellationToken(), data?: { [name: string]: any } | null): Promise {\n configureRequestOptions(options)\n const json = data == null ? undefined : JSON.stringify(data)\n const encodedData = json ? Buffer.from(json) : undefined\n if (encodedData != null) {\n debug(json!)\n const { headers, ...opts } = options\n options = {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Content-Length\": encodedData.length,\n ...headers,\n },\n ...opts,\n }\n }\n return this.doApiRequest(options, cancellationToken, it => it.end(encodedData))\n }\n\n doApiRequest(\n options: RequestOptions,\n cancellationToken: CancellationToken,\n requestProcessor: (request: T, reject: (error: Error) => void) => void,\n redirectCount = 0\n ): Promise {\n if (debug.enabled) {\n debug(`Request: ${safeStringifyJson(options)}`)\n }\n\n return cancellationToken.createPromise((resolve, reject, onCancel) => {\n const request = this.createRequest(options, (response: any) => {\n try {\n this.handleResponse(response, options, cancellationToken, resolve, reject, redirectCount, requestProcessor)\n } catch (e: any) {\n reject(e)\n }\n })\n this.addErrorAndTimeoutHandlers(request, reject, options.timeout)\n this.addRedirectHandlers(request, options, reject, redirectCount, options => {\n this.doApiRequest(options, cancellationToken, requestProcessor, redirectCount).then(resolve).catch(reject)\n })\n requestProcessor(request, reject)\n onCancel(() => request.abort())\n })\n }\n\n // noinspection JSUnusedLocalSymbols\n // eslint-disable-next-line\n protected addRedirectHandlers(request: any, options: RequestOptions, reject: (error: Error) => void, redirectCount: number, handler: (options: RequestOptions) => void) {\n // not required for NodeJS\n }\n\n addErrorAndTimeoutHandlers(request: any, reject: (error: Error) => void, timeout = 60 * 1000) {\n this.addTimeOutHandler(request, reject, timeout)\n request.on(\"error\", reject)\n request.on(\"aborted\", () => {\n reject(new Error(\"Request has been aborted by the server\"))\n })\n }\n\n private handleResponse(\n response: IncomingMessage,\n options: RequestOptions,\n cancellationToken: CancellationToken,\n resolve: (data?: any) => void,\n reject: (error: Error) => void,\n redirectCount: number,\n requestProcessor: (request: T, reject: (error: Error) => void) => void\n ) {\n if (debug.enabled) {\n debug(`Response: ${response.statusCode} ${response.statusMessage}, request options: ${safeStringifyJson(options)}`)\n }\n\n // we handle any other >= 400 error on request end (read detailed message in the response body)\n if (response.statusCode === 404) {\n // error is clear, we don't need to read detailed error description\n reject(\n createHttpError(\n response,\n `method: ${options.method || \"GET\"} url: ${options.protocol || \"https:\"}//${options.hostname}${options.port ? `:${options.port}` : \"\"}${options.path}\n\nPlease double check that your authentication token is correct. Due to security reasons, actual status maybe not reported, but 404.\n`\n )\n )\n return\n } else if (response.statusCode === 204) {\n // on DELETE request\n resolve()\n return\n }\n\n const code = response.statusCode ?? 0\n const shouldRedirect = code >= 300 && code < 400\n const redirectUrl = safeGetHeader(response, \"location\")\n if (shouldRedirect && redirectUrl != null) {\n if (redirectCount > this.maxRedirects) {\n reject(this.createMaxRedirectError())\n return\n }\n\n this.doApiRequest(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, options), cancellationToken, requestProcessor, redirectCount).then(resolve).catch(reject)\n return\n }\n\n response.setEncoding(\"utf8\")\n\n let data = \"\"\n response.on(\"error\", reject)\n response.on(\"data\", (chunk: string) => (data += chunk))\n response.on(\"end\", () => {\n try {\n if (response.statusCode != null && response.statusCode >= 400) {\n const contentType = safeGetHeader(response, \"content-type\")\n const isJson = contentType != null && (Array.isArray(contentType) ? contentType.find(it => it.includes(\"json\")) != null : contentType.includes(\"json\"))\n reject(\n createHttpError(\n response,\n `method: ${options.method || \"GET\"} url: ${options.protocol || \"https:\"}//${options.hostname}${options.port ? `:${options.port}` : \"\"}${options.path}\n\n Data:\n ${isJson ? JSON.stringify(JSON.parse(data)) : data}\n `\n )\n )\n } else {\n resolve(data.length === 0 ? null : data)\n }\n } catch (e) {\n reject(e)\n }\n })\n }\n\n // noinspection JSUnusedLocalSymbols\n abstract createRequest(options: RequestOptions, callback: (response: any) => void): T\n\n async downloadToBuffer(url: URL, options: DownloadOptions): Promise {\n return await options.cancellationToken.createPromise((resolve, reject, onCancel) => {\n let result: Buffer | null = null\n const requestOptions = {\n headers: options.headers || undefined,\n // because PrivateGitHubProvider requires HttpExecutor.prepareRedirectUrlOptions logic, so, we need to redirect manually\n redirect: \"manual\",\n }\n configureRequestUrl(url, requestOptions)\n configureRequestOptions(requestOptions)\n this.doDownload(\n requestOptions,\n {\n destination: null,\n options,\n onCancel,\n callback: error => {\n if (error == null) {\n resolve(result!)\n } else {\n reject(error)\n }\n },\n responseHandler: (response, callback) => {\n const contentLength = safeGetHeader(response, \"content-length\")\n let position = -1\n if (contentLength != null) {\n const size = parseInt(contentLength, 10)\n if (size > 0) {\n if (size > 524288000) {\n callback(new Error(\"Maximum allowed size is 500 MB\"))\n return\n }\n\n result = Buffer.alloc(size)\n position = 0\n }\n }\n response.on(\"data\", (chunk: Buffer) => {\n if (position !== -1) {\n chunk.copy(result!, position)\n position += chunk.length\n } else if (result == null) {\n result = chunk\n } else {\n if (result.length > 524288000) {\n callback(new Error(\"Maximum allowed size is 500 MB\"))\n return\n }\n result = Buffer.concat([result, chunk])\n }\n })\n response.on(\"end\", () => {\n if (result != null && position !== -1 && position !== result.length) {\n callback(new Error(`Received data length ${position} is not equal to expected ${result.length}`))\n } else {\n callback(null)\n }\n })\n },\n },\n 0\n )\n })\n }\n\n protected doDownload(requestOptions: RequestOptions, options: DownloadCallOptions, redirectCount: number) {\n const request = this.createRequest(requestOptions, (response: IncomingMessage) => {\n if (response.statusCode! >= 400) {\n options.callback(\n new Error(\n `Cannot download \"${requestOptions.protocol || \"https:\"}//${requestOptions.hostname}${requestOptions.path}\", status ${response.statusCode}: ${response.statusMessage}`\n )\n )\n return\n }\n\n // It is possible for the response stream to fail, e.g. when a network is lost while\n // response stream is in progress. Stop waiting and reject so consumer can catch the error.\n response.on(\"error\", options.callback)\n\n // this code not relevant for Electron (redirect event instead handled)\n const redirectUrl = safeGetHeader(response, \"location\")\n if (redirectUrl != null) {\n if (redirectCount < this.maxRedirects) {\n this.doDownload(HttpExecutor.prepareRedirectUrlOptions(redirectUrl, requestOptions), options, redirectCount++)\n } else {\n options.callback(this.createMaxRedirectError())\n }\n return\n }\n\n if (options.responseHandler == null) {\n configurePipes(options, response)\n } else {\n options.responseHandler(response, options.callback)\n }\n })\n this.addErrorAndTimeoutHandlers(request, options.callback, requestOptions.timeout)\n this.addRedirectHandlers(request, requestOptions, options.callback, redirectCount, requestOptions => {\n this.doDownload(requestOptions, options, redirectCount++)\n })\n request.end()\n }\n\n protected createMaxRedirectError() {\n return new Error(`Too many redirects (> ${this.maxRedirects})`)\n }\n\n private addTimeOutHandler(request: any, callback: (error: Error) => void, timeout: number) {\n request.on(\"socket\", (socket: Socket) => {\n socket.setTimeout(timeout, () => {\n request.abort()\n callback(new Error(\"Request timed out\"))\n })\n })\n }\n\n static prepareRedirectUrlOptions(redirectUrl: string, options: RequestOptions): RequestOptions {\n const newOptions = configureRequestOptionsFromUrl(redirectUrl, { ...options })\n const headers = newOptions.headers\n if (headers?.authorization) {\n const parsedNewUrl = new URL(redirectUrl)\n if (parsedNewUrl.hostname.endsWith(\".amazonaws.com\") || parsedNewUrl.searchParams.has(\"X-Amz-Credential\")) {\n delete headers.authorization\n }\n }\n return newOptions\n }\n\n static retryOnServerError(task: () => Promise, maxRetries = 3) {\n for (let attemptNumber = 0; ; attemptNumber++) {\n try {\n return task()\n } catch (e) {\n if (attemptNumber < maxRetries && ((e instanceof HttpError && e.isServerError()) || e.code === \"EPIPE\")) {\n continue\n }\n throw e\n }\n }\n }\n}\n\nexport interface DownloadCallOptions {\n responseHandler: ((response: IncomingMessage, callback: (error: Error | null) => void) => void) | null\n onCancel: (callback: () => void) => void\n callback: (error: Error | null) => void\n\n options: DownloadOptions\n\n destination: string | null\n}\n\nexport function configureRequestOptionsFromUrl(url: string, options: RequestOptions) {\n const result = configureRequestOptions(options)\n configureRequestUrl(new URL(url), result)\n return result\n}\n\nexport function configureRequestUrl(url: URL, options: RequestOptions): void {\n options.protocol = url.protocol\n options.hostname = url.hostname\n if (url.port) {\n options.port = url.port\n } else if (options.port) {\n delete options.port\n }\n options.path = url.pathname + url.search\n}\n\nexport class DigestTransform extends Transform {\n private readonly digester: Hash\n\n private _actual: string | null = null\n\n // noinspection JSUnusedGlobalSymbols\n get actual() {\n return this._actual\n }\n\n isValidateOnEnd = true\n\n constructor(readonly expected: string, private readonly algorithm: string = \"sha512\", private readonly encoding: BinaryToTextEncoding = \"base64\") {\n super()\n\n this.digester = createHash(algorithm)\n }\n\n // noinspection JSUnusedGlobalSymbols\n _transform(chunk: Buffer, encoding: string, callback: any) {\n this.digester.update(chunk)\n callback(null, chunk)\n }\n\n // noinspection JSUnusedGlobalSymbols\n _flush(callback: any): void {\n this._actual = this.digester.digest(this.encoding)\n\n if (this.isValidateOnEnd) {\n try {\n this.validate()\n } catch (e) {\n callback(e)\n return\n }\n }\n\n callback(null)\n }\n\n validate() {\n if (this._actual == null) {\n throw newError(\"Not finished yet\", \"ERR_STREAM_NOT_FINISHED\")\n }\n\n if (this._actual !== this.expected) {\n throw newError(`${this.algorithm} checksum mismatch, expected ${this.expected}, got ${this._actual}`, \"ERR_CHECKSUM_MISMATCH\")\n }\n\n return null\n }\n}\n\nfunction checkSha2(sha2Header: string | null | undefined, sha2: string | null | undefined, callback: (error: Error | null) => void): boolean {\n if (sha2Header != null && sha2 != null && sha2Header !== sha2) {\n callback(new Error(`checksum mismatch: expected ${sha2} but got ${sha2Header} (X-Checksum-Sha2 header)`))\n return false\n }\n return true\n}\n\nexport function safeGetHeader(response: any, headerKey: string) {\n const value = response.headers[headerKey]\n if (value == null) {\n return null\n } else if (Array.isArray(value)) {\n // electron API\n return value.length === 0 ? null : value[value.length - 1]\n } else {\n return value\n }\n}\n\nfunction configurePipes(options: DownloadCallOptions, response: IncomingMessage) {\n if (!checkSha2(safeGetHeader(response, \"X-Checksum-Sha2\"), options.options.sha2, options.callback)) {\n return\n }\n\n const streams: Array = []\n if (options.options.onProgress != null) {\n const contentLength = safeGetHeader(response, \"content-length\")\n if (contentLength != null) {\n streams.push(new ProgressCallbackTransform(parseInt(contentLength, 10), options.options.cancellationToken, options.options.onProgress))\n }\n }\n\n const sha512 = options.options.sha512\n if (sha512 != null) {\n streams.push(new DigestTransform(sha512, \"sha512\", sha512.length === 128 && !sha512.includes(\"+\") && !sha512.includes(\"Z\") && !sha512.includes(\"=\") ? \"hex\" : \"base64\"))\n } else if (options.options.sha2 != null) {\n streams.push(new DigestTransform(options.options.sha2, \"sha256\", \"hex\"))\n }\n\n const fileOut = createWriteStream(options.destination!)\n streams.push(fileOut)\n\n let lastStream = response\n for (const stream of streams) {\n stream.on(\"error\", (error: Error) => {\n fileOut.close()\n if (!options.options.cancellationToken.cancelled) {\n options.callback(error)\n }\n })\n lastStream = lastStream.pipe(stream)\n }\n\n fileOut.on(\"finish\", () => {\n ;(fileOut.close as any)(options.callback)\n })\n}\n\nexport function configureRequestOptions(options: RequestOptions, token?: string | null, method?: \"GET\" | \"DELETE\" | \"PUT\" | \"POST\"): RequestOptions {\n if (method != null) {\n options.method = method\n }\n\n options.headers = { ...options.headers }\n const headers = options.headers\n\n if (token != null) {\n ;(headers as any).authorization = token.startsWith(\"Basic\") || token.startsWith(\"Bearer\") ? token : `token ${token}`\n }\n if (headers[\"User-Agent\"] == null) {\n headers[\"User-Agent\"] = \"electron-builder\"\n }\n\n if (method == null || method === \"GET\" || headers[\"Cache-Control\"] == null) {\n headers[\"Cache-Control\"] = \"no-cache\"\n }\n\n // do not specify for node (in any case we use https module)\n if (options.protocol == null && (process.versions as any).electron != null) {\n options.protocol = \"https:\"\n }\n return options\n}\n\nexport function safeStringifyJson(data: any, skippedNames?: Set) {\n return JSON.stringify(\n data,\n (name, value) => {\n if (\n name.endsWith(\"Authorization\") ||\n name.endsWith(\"authorization\") ||\n name.endsWith(\"Password\") ||\n name.endsWith(\"PASSWORD\") ||\n name.endsWith(\"Token\") ||\n name.includes(\"password\") ||\n name.includes(\"token\") ||\n (skippedNames != null && skippedNames.has(name))\n ) {\n return \"\"\n }\n return value\n },\n 2\n )\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/index.d.ts b/client/node_modules/builder-util-runtime/out/index.d.ts new file mode 100644 index 0000000000..1bdb9f43fb --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/index.d.ts @@ -0,0 +1,13 @@ +export { CancellationToken, CancellationError } from "./CancellationToken"; +export { HttpError, createHttpError, HttpExecutor, DownloadOptions, DigestTransform, RequestHeaders, safeGetHeader, configureRequestOptions, configureRequestOptionsFromUrl, safeStringifyJson, parseJson, configureRequestUrl, } from "./httpExecutor"; +export { CustomPublishOptions, GenericServerOptions, GithubOptions, KeygenOptions, BitbucketOptions, SnapStoreOptions, PublishConfiguration, S3Options, SpacesOptions, BaseS3Options, getS3LikeProviderBaseUrl, githubUrl, PublishProvider, AllPublishOptions, } from "./publishOptions"; +export { UpdateInfo, UpdateFileInfo, WindowsUpdateInfo, BlockMapDataHolder, PackageFileInfo, ReleaseNoteInfo } from "./updateInfo"; +export { parseDn } from "./rfc2253Parser"; +export { UUID } from "./uuid"; +export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"; +export { parseXml, XElement } from "./xml"; +export { BlockMap } from "./blockMapApi"; +export declare const CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe"; +export declare const CURRENT_APP_PACKAGE_FILE_NAME = "package.7z"; +export declare function asArray(v: null | undefined | T | Array): Array; +export declare function newError(message: string, code: string): Error; diff --git a/client/node_modules/builder-util-runtime/out/index.js b/client/node_modules/builder-util-runtime/out/index.js new file mode 100644 index 0000000000..37d5bf30d4 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/index.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.newError = exports.asArray = exports.CURRENT_APP_PACKAGE_FILE_NAME = exports.CURRENT_APP_INSTALLER_FILE_NAME = exports.XElement = exports.parseXml = exports.ProgressCallbackTransform = exports.UUID = exports.parseDn = exports.githubUrl = exports.getS3LikeProviderBaseUrl = exports.configureRequestUrl = exports.parseJson = exports.safeStringifyJson = exports.configureRequestOptionsFromUrl = exports.configureRequestOptions = exports.safeGetHeader = exports.DigestTransform = exports.HttpExecutor = exports.createHttpError = exports.HttpError = exports.CancellationError = exports.CancellationToken = void 0; +var CancellationToken_1 = require("./CancellationToken"); +Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return CancellationToken_1.CancellationToken; } }); +Object.defineProperty(exports, "CancellationError", { enumerable: true, get: function () { return CancellationToken_1.CancellationError; } }); +var httpExecutor_1 = require("./httpExecutor"); +Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return httpExecutor_1.HttpError; } }); +Object.defineProperty(exports, "createHttpError", { enumerable: true, get: function () { return httpExecutor_1.createHttpError; } }); +Object.defineProperty(exports, "HttpExecutor", { enumerable: true, get: function () { return httpExecutor_1.HttpExecutor; } }); +Object.defineProperty(exports, "DigestTransform", { enumerable: true, get: function () { return httpExecutor_1.DigestTransform; } }); +Object.defineProperty(exports, "safeGetHeader", { enumerable: true, get: function () { return httpExecutor_1.safeGetHeader; } }); +Object.defineProperty(exports, "configureRequestOptions", { enumerable: true, get: function () { return httpExecutor_1.configureRequestOptions; } }); +Object.defineProperty(exports, "configureRequestOptionsFromUrl", { enumerable: true, get: function () { return httpExecutor_1.configureRequestOptionsFromUrl; } }); +Object.defineProperty(exports, "safeStringifyJson", { enumerable: true, get: function () { return httpExecutor_1.safeStringifyJson; } }); +Object.defineProperty(exports, "parseJson", { enumerable: true, get: function () { return httpExecutor_1.parseJson; } }); +Object.defineProperty(exports, "configureRequestUrl", { enumerable: true, get: function () { return httpExecutor_1.configureRequestUrl; } }); +var publishOptions_1 = require("./publishOptions"); +Object.defineProperty(exports, "getS3LikeProviderBaseUrl", { enumerable: true, get: function () { return publishOptions_1.getS3LikeProviderBaseUrl; } }); +Object.defineProperty(exports, "githubUrl", { enumerable: true, get: function () { return publishOptions_1.githubUrl; } }); +var rfc2253Parser_1 = require("./rfc2253Parser"); +Object.defineProperty(exports, "parseDn", { enumerable: true, get: function () { return rfc2253Parser_1.parseDn; } }); +var uuid_1 = require("./uuid"); +Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return uuid_1.UUID; } }); +var ProgressCallbackTransform_1 = require("./ProgressCallbackTransform"); +Object.defineProperty(exports, "ProgressCallbackTransform", { enumerable: true, get: function () { return ProgressCallbackTransform_1.ProgressCallbackTransform; } }); +var xml_1 = require("./xml"); +Object.defineProperty(exports, "parseXml", { enumerable: true, get: function () { return xml_1.parseXml; } }); +Object.defineProperty(exports, "XElement", { enumerable: true, get: function () { return xml_1.XElement; } }); +// nsis +exports.CURRENT_APP_INSTALLER_FILE_NAME = "installer.exe"; +// nsis-web +exports.CURRENT_APP_PACKAGE_FILE_NAME = "package.7z"; +function asArray(v) { + if (v == null) { + return []; + } + else if (Array.isArray(v)) { + return v; + } + else { + return [v]; + } +} +exports.asArray = asArray; +function newError(message, code) { + const error = new Error(message); + error.code = code; + return error; +} +exports.newError = newError; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/index.js.map b/client/node_modules/builder-util-runtime/out/index.js.map new file mode 100644 index 0000000000..0fb717ff34 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAAE,sHAAA,iBAAiB,OAAA;AAC7C,+CAauB;AAZrB,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AACf,4GAAA,YAAY,OAAA;AAEZ,+GAAA,eAAe,OAAA;AAEf,6GAAA,aAAa,OAAA;AACb,uHAAA,uBAAuB,OAAA;AACvB,8HAAA,8BAA8B,OAAA;AAC9B,iHAAA,iBAAiB,OAAA;AACjB,yGAAA,SAAS,OAAA;AACT,mHAAA,mBAAmB,OAAA;AAErB,mDAeyB;AAJvB,0HAAA,wBAAwB,OAAA;AACxB,2GAAA,SAAS,OAAA;AAKX,iDAAyC;AAAhC,wGAAA,OAAO,OAAA;AAChB,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,yEAAqF;AAA5E,sIAAA,yBAAyB,OAAA;AAClC,6BAA0C;AAAjC,+FAAA,QAAQ,OAAA;AAAE,+FAAA,QAAQ,OAAA;AAG3B,OAAO;AACM,QAAA,+BAA+B,GAAG,eAAe,CAAA;AAC9D,WAAW;AACE,QAAA,6BAA6B,GAAG,YAAY,CAAA;AAEzD,SAAgB,OAAO,CAAI,CAAkC;IAC3D,IAAI,CAAC,IAAI,IAAI,EAAE;QACb,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC3B,OAAO,CAAC,CAAA;KACT;SAAM;QACL,OAAO,CAAC,CAAC,CAAC,CAAA;KACX;AACH,CAAC;AARD,0BAQC;AAED,SAAgB,QAAQ,CAAC,OAAe,EAAE,IAAY;IACpD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAC/B;IAAC,KAA+B,CAAC,IAAI,GAAG,IAAI,CAAA;IAC7C,OAAO,KAAK,CAAA;AACd,CAAC;AAJD,4BAIC","sourcesContent":["export { CancellationToken, CancellationError } from \"./CancellationToken\"\nexport {\n HttpError,\n createHttpError,\n HttpExecutor,\n DownloadOptions,\n DigestTransform,\n RequestHeaders,\n safeGetHeader,\n configureRequestOptions,\n configureRequestOptionsFromUrl,\n safeStringifyJson,\n parseJson,\n configureRequestUrl,\n} from \"./httpExecutor\"\nexport {\n CustomPublishOptions,\n GenericServerOptions,\n GithubOptions,\n KeygenOptions,\n BitbucketOptions,\n SnapStoreOptions,\n PublishConfiguration,\n S3Options,\n SpacesOptions,\n BaseS3Options,\n getS3LikeProviderBaseUrl,\n githubUrl,\n PublishProvider,\n AllPublishOptions,\n} from \"./publishOptions\"\nexport { UpdateInfo, UpdateFileInfo, WindowsUpdateInfo, BlockMapDataHolder, PackageFileInfo, ReleaseNoteInfo } from \"./updateInfo\"\nexport { parseDn } from \"./rfc2253Parser\"\nexport { UUID } from \"./uuid\"\nexport { ProgressCallbackTransform, ProgressInfo } from \"./ProgressCallbackTransform\"\nexport { parseXml, XElement } from \"./xml\"\nexport { BlockMap } from \"./blockMapApi\"\n\n// nsis\nexport const CURRENT_APP_INSTALLER_FILE_NAME = \"installer.exe\"\n// nsis-web\nexport const CURRENT_APP_PACKAGE_FILE_NAME = \"package.7z\"\n\nexport function asArray(v: null | undefined | T | Array): Array {\n if (v == null) {\n return []\n } else if (Array.isArray(v)) {\n return v\n } else {\n return [v]\n }\n}\n\nexport function newError(message: string, code: string) {\n const error = new Error(message)\n ;(error as NodeJS.ErrnoException).code = code\n return error\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/publishOptions.d.ts b/client/node_modules/builder-util-runtime/out/publishOptions.d.ts new file mode 100644 index 0000000000..d8003f9df9 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/publishOptions.d.ts @@ -0,0 +1,309 @@ +/// +import { OutgoingHttpHeaders } from "http"; +export declare type PublishProvider = "github" | "s3" | "spaces" | "generic" | "custom" | "snapStore" | "keygen" | "bitbucket"; +export declare type AllPublishOptions = string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | CustomPublishOptions | KeygenOptions | SnapStoreOptions | BitbucketOptions; +export interface PublishConfiguration { + /** + * The provider. + */ + readonly provider: PublishProvider; + /** + * @private + * win-only + */ + publisherName?: Array | null; + /** + * @private + * win-only + */ + readonly updaterCacheDirName?: string | null; + /** + * Whether to publish auto update info files. + * + * Auto update relies only on the first provider in the list (you can specify several publishers). + * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded. + * + * @default true + */ + readonly publishAutoUpdate?: boolean; + /** + * Any custom request headers + */ + readonly requestHeaders?: OutgoingHttpHeaders; + /** + * Request timeout in milliseconds. (Default is 2 minutes; O is ignored) + * + * @default 60000 + */ + readonly timeout?: number | null; +} +export interface CustomPublishOptions extends PublishConfiguration { + /** + * The provider. Must be `custom`. + */ + readonly provider: "custom"; + /** + * The Provider to provide UpdateInfo regarding available updates. Required + * to use custom providers with electron-updater. + */ + updateProvider?: new (options: CustomPublishOptions, updater: any, runtimeOptions: any) => any; + [index: string]: any; +} +/** + * [GitHub](https://help.github.com/articles/about-releases/) options. + * + * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission. + * Define `GH_TOKEN` environment variable. + */ +export interface GithubOptions extends PublishConfiguration { + /** + * The provider. Must be `github`. + */ + readonly provider: "github"; + /** + * The repository name. [Detected automatically](#github-repository-and-bintray-package). + */ + readonly repo?: string | null; + /** + * The owner. + */ + readonly owner?: string | null; + /** + * Whether to use `v`-prefixed tag name. + * @default true + */ + readonly vPrefixedTagName?: boolean; + /** + * The host (including the port if need). + * @default github.com + */ + readonly host?: string | null; + /** + * The protocol. GitHub Publisher supports only `https`. + * @default https + */ + readonly protocol?: "https" | "http" | null; + /** + * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions). + */ + readonly token?: string | null; + /** + * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo). + */ + readonly private?: boolean | null; + /** + * The channel. + * @default latest + */ + readonly channel?: string | null; + /** + * The type of release. By default `draft` release will be created. + * + * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRE_RELEASE`is set to `true` — `prerelease`. + * @default draft + */ + releaseType?: "draft" | "prerelease" | "release" | null; +} +/** @private */ +export declare function githubUrl(options: GithubOptions, defaultHost?: string): string; +/** + * Generic (any HTTP(S) server) options. + * In all publish options [File Macros](/file-patterns#file-macros) are supported. + */ +export interface GenericServerOptions extends PublishConfiguration { + /** + * The provider. Must be `generic`. + */ + readonly provider: "generic"; + /** + * The base url. e.g. `https://bucket_name.s3.amazonaws.com`. + */ + readonly url: string; + /** + * The channel. + * @default latest + */ + readonly channel?: string | null; + /** + * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`. + */ + readonly useMultipleRangeRequest?: boolean; +} +/** + * Keygen options. + * https://keygen.sh/ + * Define `KEYGEN_TOKEN` environment variable. + */ +export interface KeygenOptions extends PublishConfiguration { + /** + * The provider. Must be `keygen`. + */ + readonly provider: "keygen"; + /** + * Keygen account's UUID + */ + readonly account: string; + /** + * Keygen product's UUID + */ + readonly product: string; + /** + * The channel. + * @default stable + */ + readonly channel?: "stable" | "rc" | "beta" | "alpha" | "dev" | null; + /** + * The target Platform. Is set programmatically explicitly during publishing. + */ + readonly platform?: string | null; +} +/** + * Bitbucket options. + * https://bitbucket.org/ + * Define `BITBUCKET_TOKEN` environment variable. + * + * For converting an app password to a usable token, you can utilize this +```typescript +convertAppPassword(owner: string, token: string) { + const base64encodedData = Buffer.from(`${owner}:${token.trim()}`).toString("base64") + return `Basic ${base64encodedData}` +} +``` + */ +export interface BitbucketOptions extends PublishConfiguration { + /** + * The provider. Must be `bitbucket`. + */ + readonly provider: "bitbucket"; + /** + * Repository owner + */ + readonly owner: string; + /** + * The access token to support auto-update from private bitbucket repositories. + */ + readonly token?: string | null; + /** + * The user name to support auto-update from private bitbucket repositories. + */ + readonly username?: string | null; + /** + * Repository slug/name + */ + readonly slug: string; + /** + * The channel. + * @default latest + */ + readonly channel?: string | null; +} +/** + * [Snap Store](https://snapcraft.io/) options. + */ +export interface SnapStoreOptions extends PublishConfiguration { + /** + * The provider. Must be `snapStore`. + */ + readonly provider: "snapStore"; + /** + * snapcraft repo name + */ + readonly repo?: string; + /** + * The list of channels the snap would be released. + * @default ["edge"] + */ + readonly channels?: string | Array | null; +} +export interface BaseS3Options extends PublishConfiguration { + /** + * The update channel. + * @default latest + */ + channel?: string | null; + /** + * The directory path. + * @default / + */ + readonly path?: string | null; + /** + * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822). + * + * @default public-read + */ + readonly acl?: "private" | "public-read" | null; +} +/** + * [Amazon S3](https://aws.amazon.com/s3/) options. + * AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html). + * Define `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html). + * Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html). + * + * Example configuration: + * +```json +{ + "build": + "publish": { + "provider": "s3", + "bucket": "bucket-name" + } + } +} +``` + */ +export interface S3Options extends BaseS3Options { + /** + * The provider. Must be `s3`. + */ + readonly provider: "s3"; + /** + * The bucket name. + */ + readonly bucket: string; + /** + * The region. Is determined and set automatically when publishing. + */ + region?: string | null; + /** + * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822). + * + * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128). + * + * @default public-read + */ + readonly acl?: "private" | "public-read" | null; + /** + * The type of storage to use for the object. + * @default STANDARD + */ + readonly storageClass?: "STANDARD" | "REDUCED_REDUNDANCY" | "STANDARD_IA" | null; + /** + * Server-side encryption algorithm to use for the object. + */ + readonly encryption?: "AES256" | "aws:kms" | null; + /** + * The endpoint URI to send requests to. The default endpoint is built from the configured region. + * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`. + */ + readonly endpoint?: string | null; +} +/** + * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options. + * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables. + */ +export interface SpacesOptions extends BaseS3Options { + /** + * The provider. Must be `spaces`. + */ + readonly provider: "spaces"; + /** + * The space name. + */ + readonly name: string; + /** + * The region (e.g. `nyc3`). + */ + readonly region: string; +} +export declare function getS3LikeProviderBaseUrl(configuration: PublishConfiguration): string; diff --git a/client/node_modules/builder-util-runtime/out/publishOptions.js b/client/node_modules/builder-util-runtime/out/publishOptions.js new file mode 100644 index 0000000000..5cfe5c6874 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/publishOptions.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getS3LikeProviderBaseUrl = exports.githubUrl = void 0; +/** @private */ +function githubUrl(options, defaultHost = "github.com") { + return `${options.protocol || "https"}://${options.host || defaultHost}`; +} +exports.githubUrl = githubUrl; +function getS3LikeProviderBaseUrl(configuration) { + const provider = configuration.provider; + if (provider === "s3") { + return s3Url(configuration); + } + if (provider === "spaces") { + return spacesUrl(configuration); + } + throw new Error(`Not supported provider: ${provider}`); +} +exports.getS3LikeProviderBaseUrl = getS3LikeProviderBaseUrl; +function s3Url(options) { + let url; + if (options.endpoint != null) { + url = `${options.endpoint}/${options.bucket}`; + } + else if (options.bucket.includes(".")) { + if (options.region == null) { + throw new Error(`Bucket name "${options.bucket}" includes a dot, but S3 region is missing`); + } + // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro + if (options.region === "us-east-1") { + url = `https://s3.amazonaws.com/${options.bucket}`; + } + else { + url = `https://s3-${options.region}.amazonaws.com/${options.bucket}`; + } + } + else if (options.region === "cn-north-1") { + url = `https://${options.bucket}.s3.${options.region}.amazonaws.com.cn`; + } + else { + url = `https://${options.bucket}.s3.amazonaws.com`; + } + return appendPath(url, options.path); +} +function appendPath(url, p) { + if (p != null && p.length > 0) { + if (!p.startsWith("/")) { + url += "/"; + } + url += p; + } + return url; +} +function spacesUrl(options) { + if (options.name == null) { + throw new Error(`name is missing`); + } + if (options.region == null) { + throw new Error(`region is missing`); + } + return appendPath(`https://${options.name}.${options.region}.digitaloceanspaces.com`, options.path); +} +//# sourceMappingURL=publishOptions.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/publishOptions.js.map b/client/node_modules/builder-util-runtime/out/publishOptions.js.map new file mode 100644 index 0000000000..476735f519 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/publishOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"publishOptions.js","sourceRoot":"","sources":["../src/publishOptions.ts"],"names":[],"mappings":";;;AA0IA,eAAe;AACf,SAAgB,SAAS,CAAC,OAAsB,EAAE,WAAW,GAAG,YAAY;IAC1E,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,MAAM,OAAO,CAAC,IAAI,IAAI,WAAW,EAAE,CAAA;AAC1E,CAAC;AAFD,8BAEC;AAyOD,SAAgB,wBAAwB,CAAC,aAAmC;IAC1E,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAA;IACvC,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,OAAO,KAAK,CAAC,aAA0B,CAAC,CAAA;KACzC;IACD,IAAI,QAAQ,KAAK,QAAQ,EAAE;QACzB,OAAO,SAAS,CAAC,aAA8B,CAAC,CAAA;KACjD;IACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAA;AACxD,CAAC;AATD,4DASC;AAED,SAAS,KAAK,CAAC,OAAkB;IAC/B,IAAI,GAAW,CAAA;IACf,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;QAC5B,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAA;KAC9C;SAAM,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,gBAAgB,OAAO,CAAC,MAAM,4CAA4C,CAAC,CAAA;SAC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ic\" | \"custom\" | \"snapStore\" | \"keygen\" | \"bitbucket\"\n\n// typescript-json-schema generates only PublishConfiguration if it is specified in the list, so, it is not added here\nexport type AllPublishOptions =\n | string\n | GithubOptions\n | S3Options\n | SpacesOptions\n | GenericServerOptions\n | CustomPublishOptions\n | KeygenOptions\n | SnapStoreOptions\n | BitbucketOptions\n\nexport interface PublishConfiguration {\n /**\n * The provider.\n */\n readonly provider: PublishProvider\n\n /**\n * @private\n * win-only\n */\n publisherName?: Array | null\n\n /**\n * @private\n * win-only\n */\n readonly updaterCacheDirName?: string | null\n\n /**\n * Whether to publish auto update info files.\n *\n * Auto update relies only on the first provider in the list (you can specify several publishers).\n * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.\n *\n * @default true\n */\n readonly publishAutoUpdate?: boolean\n\n /**\n * Any custom request headers\n */\n readonly requestHeaders?: OutgoingHttpHeaders\n\n /**\n * Request timeout in milliseconds. (Default is 2 minutes; O is ignored)\n *\n * @default 60000\n */\n readonly timeout?: number | null\n}\n\n// https://github.com/electron-userland/electron-builder/issues/3261\nexport interface CustomPublishOptions extends PublishConfiguration {\n /**\n * The provider. Must be `custom`.\n */\n readonly provider: \"custom\"\n\n /**\n * The Provider to provide UpdateInfo regarding available updates. Required\n * to use custom providers with electron-updater.\n */\n updateProvider?: new (options: CustomPublishOptions, updater: any, runtimeOptions: any) => any\n\n [index: string]: any\n}\n\n/**\n * [GitHub](https://help.github.com/articles/about-releases/) options.\n *\n * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.\n * Define `GH_TOKEN` environment variable.\n */\nexport interface GithubOptions extends PublishConfiguration {\n /**\n * The provider. Must be `github`.\n */\n readonly provider: \"github\"\n\n /**\n * The repository name. [Detected automatically](#github-repository-and-bintray-package).\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * Whether to use `v`-prefixed tag name.\n * @default true\n */\n readonly vPrefixedTagName?: boolean\n\n /**\n * The host (including the port if need).\n * @default github.com\n */\n readonly host?: string | null\n\n /**\n * The protocol. GitHub Publisher supports only `https`.\n * @default https\n */\n readonly protocol?: \"https\" | \"http\" | null\n\n /**\n * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).\n */\n readonly token?: string | null\n\n /**\n * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo).\n */\n readonly private?: boolean | null\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n\n /**\n * The type of release. By default `draft` release will be created.\n *\n * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRE_RELEASE`is set to `true` — `prerelease`.\n * @default draft\n */\n releaseType?: \"draft\" | \"prerelease\" | \"release\" | null\n}\n\n/** @private */\nexport function githubUrl(options: GithubOptions, defaultHost = \"github.com\") {\n return `${options.protocol || \"https\"}://${options.host || defaultHost}`\n}\n\n/**\n * Generic (any HTTP(S) server) options.\n * In all publish options [File Macros](/file-patterns#file-macros) are supported.\n */\nexport interface GenericServerOptions extends PublishConfiguration {\n /**\n * The provider. Must be `generic`.\n */\n readonly provider: \"generic\"\n\n /**\n * The base url. e.g. `https://bucket_name.s3.amazonaws.com`.\n */\n readonly url: string\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n\n /**\n * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.\n */\n readonly useMultipleRangeRequest?: boolean\n}\n\n/**\n * Keygen options.\n * https://keygen.sh/\n * Define `KEYGEN_TOKEN` environment variable.\n */\nexport interface KeygenOptions extends PublishConfiguration {\n /**\n * The provider. Must be `keygen`.\n */\n readonly provider: \"keygen\"\n\n /**\n * Keygen account's UUID\n */\n readonly account: string\n\n /**\n * Keygen product's UUID\n */\n readonly product: string\n\n /**\n * The channel.\n * @default stable\n */\n readonly channel?: \"stable\" | \"rc\" | \"beta\" | \"alpha\" | \"dev\" | null\n\n /**\n * The target Platform. Is set programmatically explicitly during publishing.\n */\n readonly platform?: string | null\n}\n\n/**\n * Bitbucket options.\n * https://bitbucket.org/\n * Define `BITBUCKET_TOKEN` environment variable.\n * \n * For converting an app password to a usable token, you can utilize this\n```typescript\nconvertAppPassword(owner: string, token: string) {\n const base64encodedData = Buffer.from(`${owner}:${token.trim()}`).toString(\"base64\")\n return `Basic ${base64encodedData}`\n}\n```\n */\nexport interface BitbucketOptions extends PublishConfiguration {\n /**\n * The provider. Must be `bitbucket`.\n */\n readonly provider: \"bitbucket\"\n\n /**\n * Repository owner\n */\n readonly owner: string\n\n /**\n * The access token to support auto-update from private bitbucket repositories.\n */\n readonly token?: string | null\n\n /**\n * The user name to support auto-update from private bitbucket repositories.\n */\n readonly username?: string | null\n\n /**\n * Repository slug/name\n */\n readonly slug: string\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n}\n\n/**\n * [Snap Store](https://snapcraft.io/) options.\n */\nexport interface SnapStoreOptions extends PublishConfiguration {\n /**\n * The provider. Must be `snapStore`.\n */\n readonly provider: \"snapStore\"\n\n /**\n * snapcraft repo name\n */\n readonly repo?: string\n\n /**\n * The list of channels the snap would be released.\n * @default [\"edge\"]\n */\n readonly channels?: string | Array | null\n}\n\nexport interface BaseS3Options extends PublishConfiguration {\n /**\n * The update channel.\n * @default latest\n */\n channel?: string | null\n\n /**\n * The directory path.\n * @default /\n */\n readonly path?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n}\n\n/**\n * [Amazon S3](https://aws.amazon.com/s3/) options.\n * AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html).\n * Define `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html).\n * Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).\n * \n * Example configuration:\n * \n```json\n{\n \"build\":\n \"publish\": {\n \"provider\": \"s3\",\n \"bucket\": \"bucket-name\"\n }\n }\n}\n```\n */\nexport interface S3Options extends BaseS3Options {\n /**\n * The provider. Must be `s3`.\n */\n readonly provider: \"s3\"\n\n /**\n * The bucket name.\n */\n readonly bucket: string\n\n /**\n * The region. Is determined and set automatically when publishing.\n */\n region?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n\n /**\n * The type of storage to use for the object.\n * @default STANDARD\n */\n readonly storageClass?: \"STANDARD\" | \"REDUCED_REDUNDANCY\" | \"STANDARD_IA\" | null\n\n /**\n * Server-side encryption algorithm to use for the object.\n */\n readonly encryption?: \"AES256\" | \"aws:kms\" | null\n\n /**\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.\n */\n readonly endpoint?: string | null\n}\n\n/**\n * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.\n * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.\n */\nexport interface SpacesOptions extends BaseS3Options {\n /**\n * The provider. Must be `spaces`.\n */\n readonly provider: \"spaces\"\n\n /**\n * The space name.\n */\n readonly name: string\n\n /**\n * The region (e.g. `nyc3`).\n */\n readonly region: string\n}\n\nexport function getS3LikeProviderBaseUrl(configuration: PublishConfiguration) {\n const provider = configuration.provider\n if (provider === \"s3\") {\n return s3Url(configuration as S3Options)\n }\n if (provider === \"spaces\") {\n return spacesUrl(configuration as SpacesOptions)\n }\n throw new Error(`Not supported provider: ${provider}`)\n}\n\nfunction s3Url(options: S3Options) {\n let url: string\n if (options.endpoint != null) {\n url = `${options.endpoint}/${options.bucket}`\n } else if (options.bucket.includes(\".\")) {\n if (options.region == null) {\n throw new Error(`Bucket name \"${options.bucket}\" includes a dot, but S3 region is missing`)\n }\n\n // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro\n if (options.region === \"us-east-1\") {\n url = `https://s3.amazonaws.com/${options.bucket}`\n } else {\n url = `https://s3-${options.region}.amazonaws.com/${options.bucket}`\n }\n } else if (options.region === \"cn-north-1\") {\n url = `https://${options.bucket}.s3.${options.region}.amazonaws.com.cn`\n } else {\n url = `https://${options.bucket}.s3.amazonaws.com`\n }\n return appendPath(url, options.path)\n}\n\nfunction appendPath(url: string, p: string | null | undefined): string {\n if (p != null && p.length > 0) {\n if (!p.startsWith(\"/\")) {\n url += \"/\"\n }\n url += p\n }\n return url\n}\n\nfunction spacesUrl(options: SpacesOptions) {\n if (options.name == null) {\n throw new Error(`name is missing`)\n }\n if (options.region == null) {\n throw new Error(`region is missing`)\n }\n return appendPath(`https://${options.name}.${options.region}.digitaloceanspaces.com`, options.path)\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/rfc2253Parser.d.ts b/client/node_modules/builder-util-runtime/out/rfc2253Parser.d.ts new file mode 100644 index 0000000000..48c26bcc4a --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/rfc2253Parser.d.ts @@ -0,0 +1 @@ +export declare function parseDn(seq: string): Map; diff --git a/client/node_modules/builder-util-runtime/out/rfc2253Parser.js b/client/node_modules/builder-util-runtime/out/rfc2253Parser.js new file mode 100644 index 0000000000..cc21c8f5ea --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/rfc2253Parser.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseDn = void 0; +function parseDn(seq) { + let quoted = false; + let key = null; + let token = ""; + let nextNonSpace = 0; + seq = seq.trim(); + const result = new Map(); + for (let i = 0; i <= seq.length; i++) { + if (i === seq.length) { + if (key !== null) { + result.set(key, token); + } + break; + } + const ch = seq[i]; + if (quoted) { + if (ch === '"') { + quoted = false; + continue; + } + } + else { + if (ch === '"') { + quoted = true; + continue; + } + if (ch === "\\") { + i++; + const ord = parseInt(seq.slice(i, i + 2), 16); + if (Number.isNaN(ord)) { + token += seq[i]; + } + else { + i++; + token += String.fromCharCode(ord); + } + continue; + } + if (key === null && ch === "=") { + key = token; + token = ""; + continue; + } + if (ch === "," || ch === ";" || ch === "+") { + if (key !== null) { + result.set(key, token); + } + key = null; + token = ""; + continue; + } + } + if (ch === " " && !quoted) { + if (token.length === 0) { + continue; + } + if (i > nextNonSpace) { + let j = i; + while (seq[j] === " ") { + j++; + } + nextNonSpace = j; + } + if (nextNonSpace >= seq.length || + seq[nextNonSpace] === "," || + seq[nextNonSpace] === ";" || + (key === null && seq[nextNonSpace] === "=") || + (key !== null && seq[nextNonSpace] === "+")) { + i = nextNonSpace - 1; + continue; + } + } + token += ch; + } + return result; +} +exports.parseDn = parseDn; +//# sourceMappingURL=rfc2253Parser.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/rfc2253Parser.js.map b/client/node_modules/builder-util-runtime/out/rfc2253Parser.js.map new file mode 100644 index 0000000000..90d6a15145 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/rfc2253Parser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rfc2253Parser.js","sourceRoot":"","sources":["../src/rfc2253Parser.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,GAAW;IACjC,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,IAAI,GAAG,GAAkB,IAAI,CAAA;IAC7B,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,IAAI,YAAY,GAAG,CAAC,CAAA;I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AK,GAAG,EAAE;gBAC1C,IAAI,GAAG,KAAK,IAAI,EAAE;oBAChB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;iBACvB;gBACD,GAAG,GAAG,IAAI,CAAA;gBACV,KAAK,GAAG,EAAE,CAAA;gBACV,SAAQ;aACT;SACF;QAED,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE;YACzB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtB,SAAQ;aACT;YAED,IAAI,CAAC,GAAG,YAAY,EAAE;gBACpB,IAAI,CAAC,GAAG,CAAC,CAAA;gBACT,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;oBACrB,CAAC,EAAE,CAAA;iBACJ;gBACD,YAAY,GAAG,CAAC,CAAA;aACjB;YAED,IACE,YAAY,IAAI,GAAG,CAAC,MAAM;gBAC1B,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG;gBACzB,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG;gBACzB,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC;gBAC3C,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC,EAC3C;gBACA,CAAC,GAAG,YAAY,GAAG,CAAC,CAAA;gBACpB,SAAQ;aACT;SACF;QAED,KAAK,IAAI,EAAE,CAAA;KACZ;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AArFD,0BAqFC","sourcesContent":["export function parseDn(seq: string): Map {\n let quoted = false\n let key: string | null = null\n let token = \"\"\n let nextNonSpace = 0\n\n seq = seq.trim()\n const result = new Map()\n for (let i = 0; i <= seq.length; i++) {\n if (i === seq.length) {\n if (key !== null) {\n result.set(key, token)\n }\n break\n }\n\n const ch = seq[i]\n if (quoted) {\n if (ch === '\"') {\n quoted = false\n continue\n }\n } else {\n if (ch === '\"') {\n quoted = true\n continue\n }\n\n if (ch === \"\\\\\") {\n i++\n const ord = parseInt(seq.slice(i, i + 2), 16)\n if (Number.isNaN(ord)) {\n token += seq[i]\n } else {\n i++\n token += String.fromCharCode(ord)\n }\n continue\n }\n\n if (key === null && ch === \"=\") {\n key = token\n token = \"\"\n continue\n }\n\n if (ch === \",\" || ch === \";\" || ch === \"+\") {\n if (key !== null) {\n result.set(key, token)\n }\n key = null\n token = \"\"\n continue\n }\n }\n\n if (ch === \" \" && !quoted) {\n if (token.length === 0) {\n continue\n }\n\n if (i > nextNonSpace) {\n let j = i\n while (seq[j] === \" \") {\n j++\n }\n nextNonSpace = j\n }\n\n if (\n nextNonSpace >= seq.length ||\n seq[nextNonSpace] === \",\" ||\n seq[nextNonSpace] === \";\" ||\n (key === null && seq[nextNonSpace] === \"=\") ||\n (key !== null && seq[nextNonSpace] === \"+\")\n ) {\n i = nextNonSpace - 1\n continue\n }\n }\n\n token += ch\n }\n\n return result\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/updateInfo.d.ts b/client/node_modules/builder-util-runtime/out/updateInfo.d.ts new file mode 100644 index 0000000000..79d85f9979 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/updateInfo.d.ts @@ -0,0 +1,71 @@ +export interface ReleaseNoteInfo { + /** + * The version. + */ + readonly version: string; + /** + * The note. + */ + readonly note: string | null; +} +export interface BlockMapDataHolder { + /** + * The file size. Used to verify downloaded size (save one HTTP request to get length). + * Also used when block map data is embedded into the file (appimage, windows web installer package). + */ + size?: number; + /** + * The block map file size. Used when block map data is embedded into the file (appimage, windows web installer package). + * This information can be obtained from the file itself, but it requires additional HTTP request, + * so, to reduce request count, block map size is specified in the update metadata too. + */ + blockMapSize?: number; + /** + * The file checksum. + */ + readonly sha512: string; + readonly isAdminRightsRequired?: boolean; +} +export interface PackageFileInfo extends BlockMapDataHolder { + readonly path: string; +} +export interface UpdateFileInfo extends BlockMapDataHolder { + url: string; +} +export interface UpdateInfo { + /** + * The version. + */ + readonly version: string; + readonly files: Array; + /** @deprecated */ + readonly path: string; + /** @deprecated */ + readonly sha512: string; + /** + * The release name. + */ + releaseName?: string | null; + /** + * The release notes. List if `updater.fullChangelog` is set to `true`, `string` otherwise. + */ + releaseNotes?: string | Array | null; + /** + * The release date. + */ + releaseDate: string; + /** + * The [staged rollout](/auto-update#staged-rollouts) percentage, 0-100. + */ + readonly stagingPercentage?: number; +} +export interface WindowsUpdateInfo extends UpdateInfo { + packages?: { + [arch: string]: PackageFileInfo; + } | null; + /** + * @deprecated + * @private + */ + sha2?: string; +} diff --git a/client/node_modules/builder-util-runtime/out/updateInfo.js b/client/node_modules/builder-util-runtime/out/updateInfo.js new file mode 100644 index 0000000000..a257cacc04 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/updateInfo.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=updateInfo.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/updateInfo.js.map b/client/node_modules/builder-util-runtime/out/updateInfo.js.map new file mode 100644 index 0000000000..8f3fa7b4e9 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/updateInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"updateInfo.js","sourceRoot":"","sources":["../src/updateInfo.ts"],"names":[],"mappings":"","sourcesContent":["export interface ReleaseNoteInfo {\n /**\n * The version.\n */\n readonly version: string\n\n /**\n * The note.\n */\n readonly note: string | null\n}\n\nexport interface BlockMapDataHolder {\n /**\n * The file size. Used to verify downloaded size (save one HTTP request to get length).\n * Also used when block map data is embedded into the file (appimage, windows web installer package).\n */\n size?: number\n\n /**\n * The block map file size. Used when block map data is embedded into the file (appimage, windows web installer package).\n * This information can be obtained from the file itself, but it requires additional HTTP request,\n * so, to reduce request count, block map size is specified in the update metadata too.\n */\n blockMapSize?: number\n\n /**\n * The file checksum.\n */\n readonly sha512: string\n\n readonly isAdminRightsRequired?: boolean\n}\n\nexport interface PackageFileInfo extends BlockMapDataHolder {\n readonly path: string\n}\n\nexport interface UpdateFileInfo extends BlockMapDataHolder {\n url: string\n}\n\nexport interface UpdateInfo {\n /**\n * The version.\n */\n readonly version: string\n\n readonly files: Array\n\n /** @deprecated */\n readonly path: string\n\n /** @deprecated */\n readonly sha512: string\n\n /**\n * The release name.\n */\n releaseName?: string | null\n\n /**\n * The release notes. List if `updater.fullChangelog` is set to `true`, `string` otherwise.\n */\n releaseNotes?: string | Array | null\n\n /**\n * The release date.\n */\n releaseDate: string\n\n /**\n * The [staged rollout](/auto-update#staged-rollouts) percentage, 0-100.\n */\n readonly stagingPercentage?: number\n}\n\nexport interface WindowsUpdateInfo extends UpdateInfo {\n packages?: { [arch: string]: PackageFileInfo } | null\n\n /**\n * @deprecated\n * @private\n */\n sha2?: string\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/uuid.d.ts b/client/node_modules/builder-util-runtime/out/uuid.d.ts new file mode 100644 index 0000000000..13e814a1c9 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/uuid.d.ts @@ -0,0 +1,22 @@ +/// +export declare class UUID { + private ascii; + private readonly binary; + private readonly version; + static readonly OID: Buffer; + constructor(uuid: Buffer | string); + static v5(name: string | Buffer, namespace: Buffer): any; + toString(): string; + inspect(): string; + static check(uuid: Buffer | string, offset?: number): false | { + version: undefined; + variant: string; + format: string; + } | { + version: number; + variant: string; + format: string; + }; + static parse(input: string): Buffer; +} +export declare const nil: UUID; diff --git a/client/node_modules/builder-util-runtime/out/uuid.js b/client/node_modules/builder-util-runtime/out/uuid.js new file mode 100644 index 0000000000..0d168d086e --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/uuid.js @@ -0,0 +1,200 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.nil = exports.UUID = void 0; +const crypto_1 = require("crypto"); +const index_1 = require("./index"); +const invalidName = "options.name must be either a string or a Buffer"; +// Node ID according to rfc4122#section-4.5 +const randomHost = crypto_1.randomBytes(16); +randomHost[0] = randomHost[0] | 0x01; +// lookup table hex to byte +const hex2byte = {}; +// lookup table byte to hex +const byte2hex = []; +// populate lookup tables +for (let i = 0; i < 256; i++) { + const hex = (i + 0x100).toString(16).substr(1); + hex2byte[hex] = i; + byte2hex[i] = hex; +} +// UUID class +class UUID { + constructor(uuid) { + this.ascii = null; + this.binary = null; + const check = UUID.check(uuid); + if (!check) { + throw new Error("not a UUID"); + } + this.version = check.version; + if (check.format === "ascii") { + this.ascii = uuid; + } + else { + this.binary = uuid; + } + } + static v5(name, namespace) { + return uuidNamed(name, "sha1", 0x50, namespace); + } + toString() { + if (this.ascii == null) { + this.ascii = stringify(this.binary); + } + return this.ascii; + } + inspect() { + return `UUID v${this.version} ${this.toString()}`; + } + static check(uuid, offset = 0) { + if (typeof uuid === "string") { + uuid = uuid.toLowerCase(); + if (!/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-([a-f0-9]{12})$/.test(uuid)) { + return false; + } + if (uuid === "00000000-0000-0000-0000-000000000000") { + return { version: undefined, variant: "nil", format: "ascii" }; + } + return { + version: (hex2byte[uuid[14] + uuid[15]] & 0xf0) >> 4, + variant: getVariant((hex2byte[uuid[19] + uuid[20]] & 0xe0) >> 5), + format: "ascii", + }; + } + if (Buffer.isBuffer(uuid)) { + if (uuid.length < offset + 16) { + return false; + } + let i = 0; + for (; i < 16; i++) { + if (uuid[offset + i] !== 0) { + break; + } + } + if (i === 16) { + return { version: undefined, variant: "nil", format: "binary" }; + } + return { + version: (uuid[offset + 6] & 0xf0) >> 4, + variant: getVariant((uuid[offset + 8] & 0xe0) >> 5), + format: "binary", + }; + } + throw index_1.newError("Unknown type of uuid", "ERR_UNKNOWN_UUID_TYPE"); + } + // read stringified uuid into a Buffer + static parse(input) { + const buffer = Buffer.allocUnsafe(16); + let j = 0; + for (let i = 0; i < 16; i++) { + buffer[i] = hex2byte[input[j++] + input[j++]]; + if (i === 3 || i === 5 || i === 7 || i === 9) { + j += 1; + } + } + return buffer; + } +} +exports.UUID = UUID; +// from rfc4122#appendix-C +UUID.OID = UUID.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"); +// according to rfc4122#section-4.1.1 +function getVariant(bits) { + switch (bits) { + case 0: + case 1: + case 3: + return "ncs"; + case 4: + case 5: + return "rfc4122"; + case 6: + return "microsoft"; + default: + return "future"; + } +} +var UuidEncoding; +(function (UuidEncoding) { + UuidEncoding[UuidEncoding["ASCII"] = 0] = "ASCII"; + UuidEncoding[UuidEncoding["BINARY"] = 1] = "BINARY"; + UuidEncoding[UuidEncoding["OBJECT"] = 2] = "OBJECT"; +})(UuidEncoding || (UuidEncoding = {})); +// v3 + v5 +function uuidNamed(name, hashMethod, version, namespace, encoding = UuidEncoding.ASCII) { + const hash = crypto_1.createHash(hashMethod); + const nameIsNotAString = typeof name !== "string"; + if (nameIsNotAString && !Buffer.isBuffer(name)) { + throw index_1.newError(invalidName, "ERR_INVALID_UUID_NAME"); + } + hash.update(namespace); + hash.update(name); + const buffer = hash.digest(); + let result; + switch (encoding) { + case UuidEncoding.BINARY: + buffer[6] = (buffer[6] & 0x0f) | version; + buffer[8] = (buffer[8] & 0x3f) | 0x80; + result = buffer; + break; + case UuidEncoding.OBJECT: + buffer[6] = (buffer[6] & 0x0f) | version; + buffer[8] = (buffer[8] & 0x3f) | 0x80; + result = new UUID(buffer); + break; + default: + result = + byte2hex[buffer[0]] + + byte2hex[buffer[1]] + + byte2hex[buffer[2]] + + byte2hex[buffer[3]] + + "-" + + byte2hex[buffer[4]] + + byte2hex[buffer[5]] + + "-" + + byte2hex[(buffer[6] & 0x0f) | version] + + byte2hex[buffer[7]] + + "-" + + byte2hex[(buffer[8] & 0x3f) | 0x80] + + byte2hex[buffer[9]] + + "-" + + byte2hex[buffer[10]] + + byte2hex[buffer[11]] + + byte2hex[buffer[12]] + + byte2hex[buffer[13]] + + byte2hex[buffer[14]] + + byte2hex[buffer[15]]; + break; + } + return result; +} +function stringify(buffer) { + return (byte2hex[buffer[0]] + + byte2hex[buffer[1]] + + byte2hex[buffer[2]] + + byte2hex[buffer[3]] + + "-" + + byte2hex[buffer[4]] + + byte2hex[buffer[5]] + + "-" + + byte2hex[buffer[6]] + + byte2hex[buffer[7]] + + "-" + + byte2hex[buffer[8]] + + byte2hex[buffer[9]] + + "-" + + byte2hex[buffer[10]] + + byte2hex[buffer[11]] + + byte2hex[buffer[12]] + + byte2hex[buffer[13]] + + byte2hex[buffer[14]] + + byte2hex[buffer[15]]); +} +// according to rfc4122#section-4.1.7 +exports.nil = new UUID("00000000-0000-0000-0000-000000000000"); +// UUID.v4 = uuidRandom +// UUID.v4fast = uuidRandomFast +// UUID.v3 = function(options, callback) { +// return uuidNamed("md5", 0x30, options, callback) +// } +//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/uuid.js.map b/client/node_modules/builder-util-runtime/out/uuid.js.map new file mode 100644 index 0000000000..d5a0ca9c79 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/uuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAChD,mCAAkC;AAElC,MAAM,WAAW,GAAG,kDAAkD,CAAA;AAEtE,2CAA2C;AAC3C,MAAM,UAAU,GAAG,oBAAW,CAAC,EAAE,CAAC,CAAA;AAClC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;AAEpC,2BAA2B;AAC3B,MAAM,QAAQ,GAAQ,EAAE,CAAA;AAExB,2BAA2B;AAC3B,MAAM,QAAQ,GAAkB,EAAE,CAAA;AAClC,yBAAyB;AACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;IAC5B,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC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,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,GAAG;QACH,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,GAAG;QACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CACrB,CAAA;AACH,CAAC;AAED,qCAAqC;AACxB,QAAA,GAAG,GAAG,IAAI,IAAI,CAAC,sCAAsC,CAAC,CAAA;AAEnE,uBAAuB;AAEvB,+BAA+B;AAE/B,0CAA0C;AAC1C,uDAAuD;AACvD,IAAI","sourcesContent":["import { createHash, randomBytes } from \"crypto\"\nimport { newError } from \"./index\"\n\nconst invalidName = \"options.name must be either a string or a Buffer\"\n\n// Node ID according to rfc4122#section-4.5\nconst randomHost = randomBytes(16)\nrandomHost[0] = randomHost[0] | 0x01\n\n// lookup table hex to byte\nconst hex2byte: any = {}\n\n// lookup table byte to hex\nconst byte2hex: Array = []\n// populate lookup tables\nfor (let i = 0; i < 256; i++) {\n const hex = (i + 0x100).toString(16).substr(1)\n hex2byte[hex] = i\n byte2hex[i] = hex\n}\n\n// UUID class\nexport class UUID {\n private ascii: string | null = null\n private readonly binary: Buffer | null = null\n private readonly version: number\n\n // from rfc4122#appendix-C\n static readonly OID = UUID.parse(\"6ba7b812-9dad-11d1-80b4-00c04fd430c8\")\n\n constructor(uuid: Buffer | string) {\n const check = UUID.check(uuid)\n if (!check) {\n throw new Error(\"not a UUID\")\n }\n\n this.version = check.version!\n\n if (check.format === \"ascii\") {\n this.ascii = uuid as string\n } else {\n this.binary = uuid as Buffer\n }\n }\n\n static v5(name: string | Buffer, namespace: Buffer) {\n return uuidNamed(name, \"sha1\", 0x50, namespace)\n }\n\n toString() {\n if (this.ascii == null) {\n this.ascii = stringify(this.binary!)\n }\n return this.ascii\n }\n\n inspect() {\n return `UUID v${this.version} ${this.toString()}`\n }\n\n static check(uuid: Buffer | string, offset = 0) {\n if (typeof uuid === \"string\") {\n uuid = uuid.toLowerCase()\n\n if (!/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-([a-f0-9]{12})$/.test(uuid)) {\n return false\n }\n\n if (uuid === \"00000000-0000-0000-0000-000000000000\") {\n return { version: undefined, variant: \"nil\", format: \"ascii\" }\n }\n\n return {\n version: (hex2byte[uuid[14] + uuid[15]] & 0xf0) >> 4,\n variant: getVariant((hex2byte[uuid[19] + uuid[20]] & 0xe0) >> 5),\n format: \"ascii\",\n }\n }\n\n if (Buffer.isBuffer(uuid)) {\n if (uuid.length < offset + 16) {\n return false\n }\n\n let i = 0\n for (; i < 16; i++) {\n if (uuid[offset + i] !== 0) {\n break\n }\n }\n if (i === 16) {\n return { version: undefined, variant: \"nil\", format: \"binary\" }\n }\n\n return {\n version: (uuid[offset + 6] & 0xf0) >> 4,\n variant: getVariant((uuid[offset + 8] & 0xe0) >> 5),\n format: \"binary\",\n }\n }\n\n throw newError(\"Unknown type of uuid\", \"ERR_UNKNOWN_UUID_TYPE\")\n }\n\n // read stringified uuid into a Buffer\n static parse(input: string) {\n const buffer = Buffer.allocUnsafe(16)\n let j = 0\n for (let i = 0; i < 16; i++) {\n buffer[i] = hex2byte[input[j++] + input[j++]]\n if (i === 3 || i === 5 || i === 7 || i === 9) {\n j += 1\n }\n }\n return buffer\n }\n}\n\n// according to rfc4122#section-4.1.1\nfunction getVariant(bits: number) {\n switch (bits) {\n case 0:\n case 1:\n case 3:\n return \"ncs\"\n case 4:\n case 5:\n return \"rfc4122\"\n case 6:\n return \"microsoft\"\n default:\n return \"future\"\n }\n}\n\nenum UuidEncoding {\n ASCII,\n BINARY,\n OBJECT,\n}\n\n// v3 + v5\nfunction uuidNamed(name: string | Buffer, hashMethod: string, version: number, namespace: Buffer, encoding: UuidEncoding = UuidEncoding.ASCII) {\n const hash = createHash(hashMethod)\n\n const nameIsNotAString = typeof name !== \"string\"\n if (nameIsNotAString && !Buffer.isBuffer(name)) {\n throw newError(invalidName, \"ERR_INVALID_UUID_NAME\")\n }\n\n hash.update(namespace)\n hash.update(name)\n\n const buffer = hash.digest()\n let result: any\n switch (encoding) {\n case UuidEncoding.BINARY:\n buffer[6] = (buffer[6] & 0x0f) | version\n buffer[8] = (buffer[8] & 0x3f) | 0x80\n result = buffer\n break\n case UuidEncoding.OBJECT:\n buffer[6] = (buffer[6] & 0x0f) | version\n buffer[8] = (buffer[8] & 0x3f) | 0x80\n result = new UUID(buffer)\n break\n default:\n result =\n byte2hex[buffer[0]] +\n byte2hex[buffer[1]] +\n byte2hex[buffer[2]] +\n byte2hex[buffer[3]] +\n \"-\" +\n byte2hex[buffer[4]] +\n byte2hex[buffer[5]] +\n \"-\" +\n byte2hex[(buffer[6] & 0x0f) | version] +\n byte2hex[buffer[7]] +\n \"-\" +\n byte2hex[(buffer[8] & 0x3f) | 0x80] +\n byte2hex[buffer[9]] +\n \"-\" +\n byte2hex[buffer[10]] +\n byte2hex[buffer[11]] +\n byte2hex[buffer[12]] +\n byte2hex[buffer[13]] +\n byte2hex[buffer[14]] +\n byte2hex[buffer[15]]\n break\n }\n return result\n}\n\nfunction stringify(buffer: Buffer) {\n return (\n byte2hex[buffer[0]] +\n byte2hex[buffer[1]] +\n byte2hex[buffer[2]] +\n byte2hex[buffer[3]] +\n \"-\" +\n byte2hex[buffer[4]] +\n byte2hex[buffer[5]] +\n \"-\" +\n byte2hex[buffer[6]] +\n byte2hex[buffer[7]] +\n \"-\" +\n byte2hex[buffer[8]] +\n byte2hex[buffer[9]] +\n \"-\" +\n byte2hex[buffer[10]] +\n byte2hex[buffer[11]] +\n byte2hex[buffer[12]] +\n byte2hex[buffer[13]] +\n byte2hex[buffer[14]] +\n byte2hex[buffer[15]]\n )\n}\n\n// according to rfc4122#section-4.1.7\nexport const nil = new UUID(\"00000000-0000-0000-0000-000000000000\")\n\n// UUID.v4 = uuidRandom\n\n// UUID.v4fast = uuidRandomFast\n\n// UUID.v3 = function(options, callback) {\n// return uuidNamed(\"md5\", 0x30, options, callback)\n// }\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/xml.d.ts b/client/node_modules/builder-util-runtime/out/xml.d.ts new file mode 100644 index 0000000000..4aa921388f --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/xml.d.ts @@ -0,0 +1,17 @@ +export declare class XElement { + readonly name: string; + value: string; + attributes: { + [key: string]: string; + } | null; + isCData: boolean; + elements: Array | null; + constructor(name: string); + attribute(name: string): string; + removeAttribute(name: string): void; + element(name: string, ignoreCase?: boolean, errorIfMissed?: string | null): XElement; + elementOrNull(name: string, ignoreCase?: boolean): XElement | null; + getElements(name: string, ignoreCase?: boolean): XElement[]; + elementValueOrEmpty(name: string, ignoreCase?: boolean): string; +} +export declare function parseXml(data: string): XElement; diff --git a/client/node_modules/builder-util-runtime/out/xml.js b/client/node_modules/builder-util-runtime/out/xml.js new file mode 100644 index 0000000000..fff1065c8e --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/xml.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseXml = exports.XElement = void 0; +const sax = require("sax"); +const index_1 = require("./index"); +class XElement { + constructor(name) { + this.name = name; + this.value = ""; + this.attributes = null; + this.isCData = false; + this.elements = null; + if (!name) { + throw index_1.newError("Element name cannot be empty", "ERR_XML_ELEMENT_NAME_EMPTY"); + } + if (!isValidName(name)) { + throw index_1.newError(`Invalid element name: ${name}`, "ERR_XML_ELEMENT_INVALID_NAME"); + } + } + attribute(name) { + const result = this.attributes === null ? null : this.attributes[name]; + if (result == null) { + throw index_1.newError(`No attribute "${name}"`, "ERR_XML_MISSED_ATTRIBUTE"); + } + return result; + } + removeAttribute(name) { + if (this.attributes !== null) { + delete this.attributes[name]; + } + } + element(name, ignoreCase = false, errorIfMissed = null) { + const result = this.elementOrNull(name, ignoreCase); + if (result === null) { + throw index_1.newError(errorIfMissed || `No element "${name}"`, "ERR_XML_MISSED_ELEMENT"); + } + return result; + } + elementOrNull(name, ignoreCase = false) { + if (this.elements === null) { + return null; + } + for (const element of this.elements) { + if (isNameEquals(element, name, ignoreCase)) { + return element; + } + } + return null; + } + getElements(name, ignoreCase = false) { + if (this.elements === null) { + return []; + } + return this.elements.filter(it => isNameEquals(it, name, ignoreCase)); + } + elementValueOrEmpty(name, ignoreCase = false) { + const element = this.elementOrNull(name, ignoreCase); + return element === null ? "" : element.value; + } +} +exports.XElement = XElement; +const NAME_REG_EXP = new RegExp(/^[A-Za-z_][:A-Za-z0-9_-]*$/i); +function isValidName(name) { + return NAME_REG_EXP.test(name); +} +function isNameEquals(element, name, ignoreCase) { + const elementName = element.name; + return elementName === name || (ignoreCase === true && elementName.length === name.length && elementName.toLowerCase() === name.toLowerCase()); +} +function parseXml(data) { + let rootElement = null; + const parser = sax.parser(true, {}); + const elements = []; + parser.onopentag = saxElement => { + const element = new XElement(saxElement.name); + element.attributes = saxElement.attributes; + if (rootElement === null) { + rootElement = element; + } + else { + const parent = elements[elements.length - 1]; + if (parent.elements == null) { + parent.elements = []; + } + parent.elements.push(element); + } + elements.push(element); + }; + parser.onclosetag = () => { + elements.pop(); + }; + parser.ontext = text => { + if (elements.length > 0) { + elements[elements.length - 1].value = text; + } + }; + parser.oncdata = cdata => { + const element = elements[elements.length - 1]; + element.value = cdata; + element.isCData = true; + }; + parser.onerror = err => { + throw err; + }; + parser.write(data); + return rootElement; +} +exports.parseXml = parseXml; +//# sourceMappingURL=xml.js.map \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/out/xml.js.map b/client/node_modules/builder-util-runtime/out/xml.js.map new file mode 100644 index 0000000000..7e0889f852 --- /dev/null +++ b/client/node_modules/builder-util-runtime/out/xml.js.map @@ -0,0 +1 @@ +{"version":3,"file":"xml.js","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":";;;AAAA,2BAA0B;AAC1B,mCAAkC;AAElC,MAAa,QAAQ;IAMnB,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QALjC,UAAK,GAAG,EAAE,CAAA;QACV,eAAU,GAAqC,IAAI,CAAA;QACnD,YAAO,GAAG,KAAK,CAAA;QACf,aAAQ,GAA2B,IAAI,CAAA;QAGrC,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,gBAAQ,CAAC,8BAA8B,EAAE,4BAA4B,CAAC,CAAA;SAC7E;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACtB,MAAM,gBAAQ,CAAC,yBAAyB,IAAI,EAAE,EAAE,8BAA8B,CAAC,CAAA;SAChF;IACH,CAAC;IAED,SAAS,CAAC,IAAY;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACtE,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,gBAAQ,CAAC,iBAAiB,IAAI,GAAG,EAAE,0BAA0B,CAAC,CAAA;SACrE;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,eAAe,CAAC,IAAY;QAC1B,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;SAC7B;IACH,CAAC;IAED,OAAO,CAAC,IAAY,EAAE,UAAU,GAAG,KAAK,EAAE,gBAA+B,IAAI;QAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,C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G,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAA;SAC3C;IACH,CAAC,CAAA;IAED,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE;QACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAC7C,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IACxB,CAAC,CAAA;IAED,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE;QACrB,MAAM,GAAG,CAAA;IACX,CAAC,CAAA;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAClB,OAAO,WAAY,CAAA;AACrB,CAAC;AA3CD,4BA2CC","sourcesContent":["import * as sax from \"sax\"\nimport { newError } from \"./index\"\n\nexport class XElement {\n value = \"\"\n attributes: { [key: string]: string } | null = null\n isCData = false\n elements: Array | null = null\n\n constructor(readonly name: string) {\n if (!name) {\n throw newError(\"Element name cannot be empty\", \"ERR_XML_ELEMENT_NAME_EMPTY\")\n }\n if (!isValidName(name)) {\n throw newError(`Invalid element name: ${name}`, \"ERR_XML_ELEMENT_INVALID_NAME\")\n }\n }\n\n attribute(name: string): string {\n const result = this.attributes === null ? null : this.attributes[name]\n if (result == null) {\n throw newError(`No attribute \"${name}\"`, \"ERR_XML_MISSED_ATTRIBUTE\")\n }\n return result\n }\n\n removeAttribute(name: string): void {\n if (this.attributes !== null) {\n delete this.attributes[name]\n }\n }\n\n element(name: string, ignoreCase = false, errorIfMissed: string | null = null): XElement {\n const result = this.elementOrNull(name, ignoreCase)\n if (result === null) {\n throw newError(errorIfMissed || `No element \"${name}\"`, \"ERR_XML_MISSED_ELEMENT\")\n }\n return result\n }\n\n elementOrNull(name: string, ignoreCase = false): XElement | null {\n if (this.elements === null) {\n return null\n }\n\n for (const element of this.elements) {\n if (isNameEquals(element, name, ignoreCase)) {\n return element\n }\n }\n\n return null\n }\n\n getElements(name: string, ignoreCase = false) {\n if (this.elements === null) {\n return []\n }\n return this.elements.filter(it => isNameEquals(it, name, ignoreCase))\n }\n\n elementValueOrEmpty(name: string, ignoreCase = false): string {\n const element = this.elementOrNull(name, ignoreCase)\n return element === null ? \"\" : element.value\n }\n}\n\nconst NAME_REG_EXP = new RegExp(/^[A-Za-z_][:A-Za-z0-9_-]*$/i)\n\nfunction isValidName(name: string) {\n return NAME_REG_EXP.test(name)\n}\n\nfunction isNameEquals(element: XElement, name: string, ignoreCase: boolean) {\n const elementName = element.name\n return elementName === name || (ignoreCase === true && elementName.length === name.length && elementName.toLowerCase() === name.toLowerCase())\n}\n\nexport function parseXml(data: string): XElement {\n let rootElement: XElement | null = null\n const parser = sax.parser(true, {})\n const elements: Array = []\n\n parser.onopentag = saxElement => {\n const element = new XElement(saxElement.name)\n element.attributes = saxElement.attributes as { [key: string]: string }\n\n if (rootElement === null) {\n rootElement = element\n } else {\n const parent = elements[elements.length - 1]\n if (parent.elements == null) {\n parent.elements = []\n }\n parent.elements.push(element)\n }\n elements.push(element)\n }\n\n parser.onclosetag = () => {\n elements.pop()\n }\n\n parser.ontext = text => {\n if (elements.length > 0) {\n elements[elements.length - 1].value = text\n }\n }\n\n parser.oncdata = cdata => {\n const element = elements[elements.length - 1]\n element.value = cdata\n element.isCData = true\n }\n\n parser.onerror = err => {\n throw err\n }\n\n parser.write(data)\n return rootElement!\n}\n"]} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/package.json b/client/node_modules/builder-util-runtime/package.json new file mode 100644 index 0000000000..63c1b6bc55 --- /dev/null +++ b/client/node_modules/builder-util-runtime/package.json @@ -0,0 +1,29 @@ +{ + "name": "builder-util-runtime", + "version": "9.1.1", + "main": "out/index.js", + "author": "Vladimir Krivosheev", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/electron-userland/electron-builder.git", + "directory": "packages/builder-util-runtime" + }, + "bugs": "https://github.com/electron-userland/electron-builder/issues", + "homepage": "https://github.com/electron-userland/electron-builder", + "files": [ + "out" + ], + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "debug": "^4.3.4", + "sax": "^1.2.4" + }, + "devDependencies": { + "@types/debug": "4.1.7", + "@types/sax": "1.2.3" + }, + "types": "./out/index.d.ts" +} \ No newline at end of file diff --git a/client/node_modules/builder-util-runtime/readme.md b/client/node_modules/builder-util-runtime/readme.md new file mode 100644 index 0000000000..c0312a2ca9 --- /dev/null +++ b/client/node_modules/builder-util-runtime/readme.md @@ -0,0 +1,3 @@ +# builder-util-runtime + +HTTP utilities. Used by [electron-builder](https://github.com/electron-userland/electron-builder). \ No newline at end of file diff --git a/client/node_modules/builder-util/LICENSE b/client/node_modules/builder-util/LICENSE new file mode 100644 index 0000000000..7d8fa01c28 --- /dev/null +++ b/client/node_modules/builder-util/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Loopline Systems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/client/node_modules/builder-util/node_modules/chalk/index.d.ts b/client/node_modules/builder-util/node_modules/chalk/index.d.ts new file mode 100644 index 0000000000..9cd88f38be --- /dev/null +++ b/client/node_modules/builder-util/node_modules/chalk/index.d.ts @@ -0,0 +1,415 @@ +/** +Basic foreground colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type ForegroundColor = + | 'black' + | 'red' + | 'green' + | 'yellow' + | 'blue' + | 'magenta' + | 'cyan' + | 'white' + | 'gray' + | 'grey' + | 'blackBright' + | 'redBright' + | 'greenBright' + | 'yellowBright' + | 'blueBright' + | 'magentaBright' + | 'cyanBright' + | 'whiteBright'; + +/** +Basic background colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type BackgroundColor = + | 'bgBlack' + | 'bgRed' + | 'bgGreen' + | 'bgYellow' + | 'bgBlue' + | 'bgMagenta' + | 'bgCyan' + | 'bgWhite' + | 'bgGray' + | 'bgGrey' + | 'bgBlackBright' + | 'bgRedBright' + | 'bgGreenBright' + | 'bgYellowBright' + | 'bgBlueBright' + | 'bgMagentaBright' + | 'bgCyanBright' + | 'bgWhiteBright'; + +/** +Basic colors. + +[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) +*/ +declare type Color = ForegroundColor | BackgroundColor; + +declare type Modifiers = + | 'reset' + | 'bold' + | 'dim' + | 'italic' + | 'underline' + | 'inverse' + | 'hidden' + | 'strikethrough' + | 'visible'; + +declare namespace chalk { + /** + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + type Level = 0 | 1 | 2 | 3; + + interface Options { + /** + Specify the color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level?: Level; + } + + /** + Return a new Chalk instance. + */ + type Instance = new (options?: Options) => Chalk; + + /** + Detect whether the terminal supports color. + */ + interface ColorSupport { + /** + The color level used by Chalk. + */ + level: Level; + + /** + Return whether Chalk supports basic 16 colors. + */ + hasBasic: boolean; + + /** + Return whether Chalk supports ANSI 256 colors. + */ + has256: boolean; + + /** + Return whether Chalk supports Truecolor 16 million colors. + */ + has16m: boolean; + } + + interface ChalkFunction { + /** + Use a template string. + + @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) + + @example + ``` + import chalk = require('chalk'); + + log(chalk` + CPU: {red ${cpu.totalPercent}%} + RAM: {green ${ram.used / ram.total * 100}%} + DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} + `); + ``` + + @example + ``` + import chalk = require('chalk'); + + log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) + ``` + */ + (text: TemplateStringsArray, ...placeholders: unknown[]): string; + + (...text: unknown[]): string; + } + + interface Chalk extends ChalkFunction { + /** + Return a new Chalk instance. + */ + Instance: Instance; + + /** + The color support for Chalk. + + By default, color support is automatically detected based on the environment. + + Levels: + - `0` - All colors disabled. + - `1` - Basic 16 colors support. + - `2` - ANSI 256 colors support. + - `3` - Truecolor 16 million colors support. + */ + level: Level; + + /** + Use HEX value to set text color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.hex('#DEADED'); + ``` + */ + hex(color: string): Chalk; + + /** + Use keyword color value to set text color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.keyword('orange'); + ``` + */ + keyword(color: string): Chalk; + + /** + Use RGB values to set text color. + */ + rgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set text color. + */ + hsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set text color. + */ + hsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set text color. + */ + hwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + */ + ansi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. + */ + ansi256(index: number): Chalk; + + /** + Use HEX value to set background color. + + @param color - Hexadecimal value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgHex('#DEADED'); + ``` + */ + bgHex(color: string): Chalk; + + /** + Use keyword color value to set background color. + + @param color - Keyword value representing the desired color. + + @example + ``` + import chalk = require('chalk'); + + chalk.bgKeyword('orange'); + ``` + */ + bgKeyword(color: string): Chalk; + + /** + Use RGB values to set background color. + */ + bgRgb(red: number, green: number, blue: number): Chalk; + + /** + Use HSL values to set background color. + */ + bgHsl(hue: number, saturation: number, lightness: number): Chalk; + + /** + Use HSV values to set background color. + */ + bgHsv(hue: number, saturation: number, value: number): Chalk; + + /** + Use HWB values to set background color. + */ + bgHwb(hue: number, whiteness: number, blackness: number): Chalk; + + /** + Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. + + 30 <= code && code < 38 || 90 <= code && code < 98 + For example, 31 for red, 91 for redBright. + Use the foreground code, not the background code (for example, not 41, nor 101). + */ + bgAnsi(code: number): Chalk; + + /** + Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. + */ + bgAnsi256(index: number): Chalk; + + /** + Modifier: Resets the current color chain. + */ + readonly reset: Chalk; + + /** + Modifier: Make text bold. + */ + readonly bold: Chalk; + + /** + Modifier: Emitting only a small amount of light. + */ + readonly dim: Chalk; + + /** + Modifier: Make text italic. (Not widely supported) + */ + readonly italic: Chalk; + + /** + Modifier: Make text underline. (Not widely supported) + */ + readonly underline: Chalk; + + /** + Modifier: Inverse background and foreground colors. + */ + readonly inverse: Chalk; + + /** + Modifier: Prints the text, but makes it invisible. + */ + readonly hidden: Chalk; + + /** + Modifier: Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: Chalk; + + /** + Modifier: Prints the text only when Chalk has a color support level > 0. + Can be useful for things that are purely cosmetic. + */ + readonly visible: Chalk; + + readonly black: Chalk; + readonly red: Chalk; + readonly green: Chalk; + readonly yellow: Chalk; + readonly blue: Chalk; + readonly magenta: Chalk; + readonly cyan: Chalk; + readonly white: Chalk; + + /* + Alias for `blackBright`. + */ + readonly gray: Chalk; + + /* + Alias for `blackBright`. + */ + readonly grey: Chalk; + + readonly blackBright: Chalk; + readonly redBright: Chalk; + readonly greenBright: Chalk; + readonly yellowBright: Chalk; + readonly blueBright: Chalk; + readonly magentaBright: Chalk; + readonly cyanBright: Chalk; + readonly whiteBright: Chalk; + + readonly bgBlack: Chalk; + readonly bgRed: Chalk; + readonly bgGreen: Chalk; + readonly bgYellow: Chalk; + readonly bgBlue: Chalk; + readonly bgMagenta: Chalk; + readonly bgCyan: Chalk; + readonly bgWhite: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGray: Chalk; + + /* + Alias for `bgBlackBright`. + */ + readonly bgGrey: Chalk; + + readonly bgBlackBright: Chalk; + readonly bgRedBright: Chalk; + readonly bgGreenBright: Chalk; + readonly bgYellowBright: Chalk; + readonly bgBlueBright: Chalk; + readonly bgMagentaBright: Chalk; + readonly bgCyanBright: Chalk; + readonly bgWhiteBright: Chalk; + } +} + +/** +Main Chalk object that allows to chain styles together. +Call the last one as a method with a string argument. +Order doesn't matter, and later styles take precedent in case of a conflict. +This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. +*/ +declare const chalk: chalk.Chalk & chalk.ChalkFunction & { + supportsColor: chalk.ColorSupport | false; + Level: chalk.Level; + Color: Color; + ForegroundColor: ForegroundColor; + BackgroundColor: BackgroundColor; + Modifiers: Modifiers; + stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; +}; + +export = chalk; diff --git a/client/node_modules/builder-util/node_modules/chalk/license b/client/node_modules/builder-util/node_modules/chalk/license new file mode 100644 index 0000000000..e7af2f7710 --- /dev/null +++ b/client/node_modules/builder-util/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/client/node_modules/builder-util/node_modules/chalk/package.json b/client/node_modules/builder-util/node_modules/chalk/package.json new file mode 100644 index 0000000000..47c23f2906 --- /dev/null +++ b/client/node_modules/builder-util/node_modules/chalk/package.json @@ -0,0 +1,68 @@ +{ + "name": "chalk", + "version": "4.1.2", + "description": "Terminal string styling done right", + "license": "MIT", + "repository": "chalk/chalk", + "funding": "https://github.com/chalk/chalk?sponsor=1", + "main": "source", + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && nyc ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "source", + "index.d.ts" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "str", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.7", + "execa": "^4.0.0", + "import-fresh": "^3.1.0", + "matcha": "^0.7.0", + "nyc": "^15.0.0", + "resolve-from": "^5.0.0", + "tsd": "^0.7.4", + "xo": "^0.28.2" + }, + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "unicorn/prefer-includes": "off", + "@typescript-eslint/member-ordering": "off", + "no-redeclare": "off", + "unicorn/string-content": "off", + "unicorn/better-regex": "off" + } + } +} diff --git a/client/node_modules/builder-util/node_modules/chalk/readme.md b/client/node_modules/builder-util/node_modules/chalk/readme.md new file mode 100644 index 0000000000..a055d21c97 --- /dev/null +++ b/client/node_modules/builder-util/node_modules/chalk/readme.md @@ -0,0 +1,341 @@ +

+
+
+ Chalk +
+
+
+

+ +> Terminal string styling done right + +[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) + + + +
+ +--- + + + +--- + +
+ +## Highlights + +- Expressive API +- Highly performant +- Ability to nest styles +- [256/Truecolor color support](#256-and-truecolor-color-support) +- Auto-detects color support +- Doesn't extend `String.prototype` +- Clean and focused +- Actively maintained +- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020 + +## Install + +```console +$ npm install chalk +``` + +## Usage + +```js +const chalk = require('chalk'); + +console.log(chalk.blue('Hello world!')); +``` + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +const chalk = require('chalk'); +const log = console.log; + +// Combine styled and normal strings +log(chalk.blue('Hello') + ' World' + chalk.red('!')); + +// Compose multiple styles using the chainable API +log(chalk.blue.bgRed.bold('Hello world!')); + +// Pass in multiple arguments +log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); + +// Nest styles +log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); + +// Nest styles of the same type even (color, underline, background) +log(chalk.green( + 'I am a green line ' + + chalk.blue.underline.bold('with a blue substring') + + ' that becomes green again!' +)); + +// ES2015 template literal +log(` +CPU: ${chalk.red('90%')} +RAM: ${chalk.green('40%')} +DISK: ${chalk.yellow('70%')} +`); + +// ES2015 tagged template literal +log(chalk` +CPU: {red ${cpu.totalPercent}%} +RAM: {green ${ram.used / ram.total * 100}%} +DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} +`); + +// Use RGB colors in terminal emulators that support it. +log(chalk.keyword('orange')('Yay for orange colored text!')); +log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); +log(chalk.hex('#DEADED').bold('Bold gray!')); +``` + +Easily define your own themes: + +```js +const chalk = require('chalk'); + +const error = chalk.bold.red; +const warning = chalk.keyword('orange'); + +console.log(error('Error!')); +console.log(warning('Warning!')); +``` + +Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): + +```js +const name = 'Sindre'; +console.log(chalk.green('Hello %s'), name); +//=> 'Hello Sindre' +``` + +## API + +### chalk.` -`, + `, is: 'licenses-view', @@ -49,27 +49,30 @@ Polymer({ _licensesLoaded: false, - ready: function() { + ready: function () { // This complexity is to avoid unconditionally loading the (huge) license // text at startup. var appRoot = dom(this).getOwnerRoot().host; - window.addEventListener('location-changed', function() { - if (this._licensesLoaded || appRoot.page !== 'licenses') { - return; - } + window.addEventListener( + 'location-changed', + function () { + if (this._licensesLoaded || appRoot.page !== 'licenses') { + return; + } - var xhr = new XMLHttpRequest(); - xhr.onload = () => { - this.$.licensesText.innerText = xhr.responseText; - this._licensesLoaded = true; - }; - xhr.onerror = () => { - console.error('could not load license.txt'); - }; - // This path works in both Cordova and Electron. - // Do *not* add a leading slash. - xhr.open('GET', 'ui_components/licenses/licenses.txt', true); - xhr.send(); - }.bind(this)); - } + var xhr = new XMLHttpRequest(); + xhr.onload = () => { + this.$.licensesText.innerText = xhr.responseText; + this._licensesLoaded = true; + }; + xhr.onerror = () => { + console.error('could not load license.txt'); + }; + // This path works in both Cordova and Electron. + // Do *not* add a leading slash. + xhr.open('GET', 'ui_components/licenses/licenses.txt', true); + xhr.send(); + }.bind(this) + ); + }, }); diff --git a/src/www/ui_components/licenses/README.md b/client/src/www/ui_components/licenses/README.md similarity index 100% rename from src/www/ui_components/licenses/README.md rename to client/src/www/ui_components/licenses/README.md diff --git a/src/www/ui_components/licenses/licenses.txt b/client/src/www/ui_components/licenses/licenses.txt similarity index 100% rename from src/www/ui_components/licenses/licenses.txt rename to client/src/www/ui_components/licenses/licenses.txt diff --git a/src/www/ui_components/licenses/third_party.sh b/client/src/www/ui_components/licenses/third_party.sh similarity index 100% rename from src/www/ui_components/licenses/third_party.sh rename to client/src/www/ui_components/licenses/third_party.sh diff --git a/src/www/ui_components/outline-icons.js b/client/src/www/ui_components/outline-icons.js similarity index 99% rename from src/www/ui_components/outline-icons.js rename to client/src/www/ui_components/outline-icons.js index 7f3ff31b15..69531368e5 100644 --- a/src/www/ui_components/outline-icons.js +++ b/client/src/www/ui_components/outline-icons.js @@ -27,4 +27,3 @@ $_documentContainer.innerHTML = `[[localize(titleLocalizationKey)]]
[[localize(detailLocalizationKey)]]
- + [[localize(linkTextLocalizationKey)]] - [[localize(dismissButtonTextLocalizationKey)]] + [[localize(dismissButtonTextLocalizationKey)]]
-`, + `, is: 'user-comms-dialog', @@ -130,22 +132,22 @@ Polymer({ fireEventOnHide: String, }, - show: function() { + show: function () { this.$.wrapper.classList.add('active'); }, - hide: function() { + hide: function () { this.$.wrapper.classList.remove('active'); }, - _dismiss: function() { + _dismiss: function () { this.hide(); if (!!this.fireEventOnHide) { this.fire(this.fireEventOnHide); } }, - _shouldHideLink: function() { + _shouldHideLink: function () { return !this.linkUrl; - } + }, }); diff --git a/src/www/views/contact_view/app_type.ts b/client/src/www/views/contact_view/app_type.ts similarity index 100% rename from src/www/views/contact_view/app_type.ts rename to client/src/www/views/contact_view/app_type.ts diff --git a/src/www/views/contact_view/index.spec.ts b/client/src/www/views/contact_view/index.spec.ts similarity index 100% rename from src/www/views/contact_view/index.spec.ts rename to client/src/www/views/contact_view/index.spec.ts diff --git a/src/www/views/contact_view/index.ts b/client/src/www/views/contact_view/index.ts similarity index 100% rename from src/www/views/contact_view/index.ts rename to client/src/www/views/contact_view/index.ts diff --git a/src/www/views/contact_view/issue_type.ts b/client/src/www/views/contact_view/issue_type.ts similarity index 100% rename from src/www/views/contact_view/issue_type.ts rename to client/src/www/views/contact_view/issue_type.ts diff --git a/src/www/views/contact_view/stories.ts b/client/src/www/views/contact_view/stories.ts similarity index 100% rename from src/www/views/contact_view/stories.ts rename to client/src/www/views/contact_view/stories.ts diff --git a/src/www/views/contact_view/support_form/index.spec.ts b/client/src/www/views/contact_view/support_form/index.spec.ts similarity index 100% rename from src/www/views/contact_view/support_form/index.spec.ts rename to client/src/www/views/contact_view/support_form/index.spec.ts diff --git a/src/www/views/contact_view/support_form/index.ts b/client/src/www/views/contact_view/support_form/index.ts similarity index 100% rename from src/www/views/contact_view/support_form/index.ts rename to client/src/www/views/contact_view/support_form/index.ts diff --git a/src/www/views/contact_view/support_form/stories.ts b/client/src/www/views/contact_view/support_form/stories.ts similarity index 100% rename from src/www/views/contact_view/support_form/stories.ts rename to client/src/www/views/contact_view/support_form/stories.ts diff --git a/src/www/views/servers_view/index.ts b/client/src/www/views/servers_view/index.ts similarity index 100% rename from src/www/views/servers_view/index.ts rename to client/src/www/views/servers_view/index.ts diff --git a/src/www/views/servers_view/server_connection_indicator/index.ts b/client/src/www/views/servers_view/server_connection_indicator/index.ts similarity index 100% rename from src/www/views/servers_view/server_connection_indicator/index.ts rename to client/src/www/views/servers_view/server_connection_indicator/index.ts diff --git a/src/www/views/servers_view/server_connection_indicator/stories.ts b/client/src/www/views/servers_view/server_connection_indicator/stories.ts similarity index 100% rename from src/www/views/servers_view/server_connection_indicator/stories.ts rename to client/src/www/views/servers_view/server_connection_indicator/stories.ts diff --git a/src/www/views/servers_view/server_list/index.ts b/client/src/www/views/servers_view/server_list/index.ts similarity index 100% rename from src/www/views/servers_view/server_list/index.ts rename to client/src/www/views/servers_view/server_list/index.ts diff --git a/src/www/views/servers_view/server_list/stories.ts b/client/src/www/views/servers_view/server_list/stories.ts similarity index 100% rename from src/www/views/servers_view/server_list/stories.ts rename to client/src/www/views/servers_view/server_list/stories.ts diff --git a/src/www/views/servers_view/server_list_item/index.ts b/client/src/www/views/servers_view/server_list_item/index.ts similarity index 100% rename from src/www/views/servers_view/server_list_item/index.ts rename to client/src/www/views/servers_view/server_list_item/index.ts diff --git a/src/www/views/servers_view/server_list_item/server_card/index.ts b/client/src/www/views/servers_view/server_list_item/server_card/index.ts similarity index 99% rename from src/www/views/servers_view/server_list_item/server_card/index.ts rename to client/src/www/views/servers_view/server_list_item/server_card/index.ts index 52a218a52f..9771cbe6c6 100644 --- a/src/www/views/servers_view/server_list_item/server_card/index.ts +++ b/client/src/www/views/servers_view/server_list_item/server_card/index.ts @@ -98,7 +98,7 @@ const sharedCSS = css` font-size: var(--server-name-size); margin-bottom: var(--outline-mini-gutter); /* To break the line in case a sequence of word characters is longer than the line. - See https://github.com/Jigsaw-Code/outline-client/issues/1372. */ + See https://github.com/Jigsaw-Code/outline-apps/issues/1372. */ word-break: break-all; } diff --git a/src/www/views/servers_view/server_list_item/server_card/stories.ts b/client/src/www/views/servers_view/server_list_item/server_card/stories.ts similarity index 100% rename from src/www/views/servers_view/server_list_item/server_card/stories.ts rename to client/src/www/views/servers_view/server_list_item/server_card/stories.ts diff --git a/src/www/webpack_base.mjs b/client/src/www/webpack_base.mjs similarity index 100% rename from src/www/webpack_base.mjs rename to client/src/www/webpack_base.mjs diff --git a/src/www/webpack_cordova.mjs b/client/src/www/webpack_cordova.mjs similarity index 100% rename from src/www/webpack_cordova.mjs rename to client/src/www/webpack_cordova.mjs diff --git a/src/www/webpack_css_rtl_loader.cjs b/client/src/www/webpack_css_rtl_loader.cjs similarity index 100% rename from src/www/webpack_css_rtl_loader.cjs rename to client/src/www/webpack_css_rtl_loader.cjs diff --git a/src/www/webpack_electron.mjs b/client/src/www/webpack_electron.mjs similarity index 100% rename from src/www/webpack_electron.mjs rename to client/src/www/webpack_electron.mjs diff --git a/src/www/webpack_test.mjs b/client/src/www/webpack_test.mjs similarity index 100% rename from src/www/webpack_test.mjs rename to client/src/www/webpack_test.mjs diff --git a/tools/OutlineService/OutlineService.sln b/client/tools/OutlineService/OutlineService.sln similarity index 100% rename from tools/OutlineService/OutlineService.sln rename to client/tools/OutlineService/OutlineService.sln diff --git a/tools/OutlineService/OutlineService/App.config b/client/tools/OutlineService/OutlineService/App.config similarity index 100% rename from tools/OutlineService/OutlineService/App.config rename to client/tools/OutlineService/OutlineService/App.config diff --git a/tools/OutlineService/OutlineService/OutlineService.Designer.cs b/client/tools/OutlineService/OutlineService/OutlineService.Designer.cs similarity index 100% rename from tools/OutlineService/OutlineService/OutlineService.Designer.cs rename to client/tools/OutlineService/OutlineService/OutlineService.Designer.cs diff --git a/tools/OutlineService/OutlineService/OutlineService.cs b/client/tools/OutlineService/OutlineService/OutlineService.cs similarity index 99% rename from tools/OutlineService/OutlineService/OutlineService.cs rename to client/tools/OutlineService/OutlineService/OutlineService.cs index 71da846c61..654dfeec0f 100755 --- a/tools/OutlineService/OutlineService/OutlineService.cs +++ b/client/tools/OutlineService/OutlineService/OutlineService.cs @@ -564,7 +564,7 @@ private void StartSmartDnsBlock() // This is for Windows 7: without it, the process exits immediately, presumably // because stdin isn't connected to anything: - // https://github.com/Jigsaw-Code/outline-client/issues/415 + // https://github.com/Jigsaw-Code/outline-apps/issues/415 // // This seems to make no difference on Windows 8 and 10. smartDnsBlock.StartInfo.RedirectStandardInput = true; diff --git a/tools/OutlineService/OutlineService/OutlineService.csproj b/client/tools/OutlineService/OutlineService/OutlineService.csproj similarity index 100% rename from tools/OutlineService/OutlineService/OutlineService.csproj rename to client/tools/OutlineService/OutlineService/OutlineService.csproj diff --git a/tools/OutlineService/OutlineService/OutlineService.resx b/client/tools/OutlineService/OutlineService/OutlineService.resx similarity index 100% rename from tools/OutlineService/OutlineService/OutlineService.resx rename to client/tools/OutlineService/OutlineService/OutlineService.resx diff --git a/tools/OutlineService/OutlineService/Program.cs b/client/tools/OutlineService/OutlineService/Program.cs similarity index 100% rename from tools/OutlineService/OutlineService/Program.cs rename to client/tools/OutlineService/OutlineService/Program.cs diff --git a/tools/OutlineService/OutlineService/Properties/AssemblyInfo.cs b/client/tools/OutlineService/OutlineService/Properties/AssemblyInfo.cs similarity index 100% rename from tools/OutlineService/OutlineService/Properties/AssemblyInfo.cs rename to client/tools/OutlineService/OutlineService/Properties/AssemblyInfo.cs diff --git a/tools/OutlineService/OutlineService/bin/OutlineService.exe b/client/tools/OutlineService/OutlineService/bin/OutlineService.exe similarity index 100% rename from tools/OutlineService/OutlineService/bin/OutlineService.exe rename to client/tools/OutlineService/OutlineService/bin/OutlineService.exe diff --git a/tools/OutlineService/OutlineService/bin/Release/OutlineService.exe.config b/client/tools/OutlineService/OutlineService/bin/Release/OutlineService.exe.config similarity index 100% rename from tools/OutlineService/OutlineService/bin/Release/OutlineService.exe.config rename to client/tools/OutlineService/OutlineService/bin/Release/OutlineService.exe.config diff --git a/tools/OutlineService/OutlineService/packages.config b/client/tools/OutlineService/OutlineService/packages.config similarity index 100% rename from tools/OutlineService/OutlineService/packages.config rename to client/tools/OutlineService/OutlineService/packages.config diff --git a/tools/build/Dockerfile b/client/tools/build/Dockerfile similarity index 100% rename from tools/build/Dockerfile rename to client/tools/build/Dockerfile diff --git a/tools/build/README.md b/client/tools/build/README.md similarity index 100% rename from tools/build/README.md rename to client/tools/build/README.md diff --git a/tools/build/android_tools_versions.sh b/client/tools/build/android_tools_versions.sh similarity index 100% rename from tools/build/android_tools_versions.sh rename to client/tools/build/android_tools_versions.sh diff --git a/tools/build/build.action.sh b/client/tools/build/build.action.sh similarity index 100% rename from tools/build/build.action.sh rename to client/tools/build/build.action.sh diff --git a/tools/build/build.sh b/client/tools/build/build.sh similarity index 100% rename from tools/build/build.sh rename to client/tools/build/build.sh diff --git a/tools/build/setup_linux_android.sh b/client/tools/build/setup_linux_android.sh similarity index 100% rename from tools/build/setup_linux_android.sh rename to client/tools/build/setup_linux_android.sh diff --git a/tools/build/setup_macos_android.sh b/client/tools/build/setup_macos_android.sh similarity index 100% rename from tools/build/setup_macos_android.sh rename to client/tools/build/setup_macos_android.sh diff --git a/tools/find_tap_name/bin/386/find_tap_name.exe b/client/tools/find_tap_name/bin/386/find_tap_name.exe similarity index 100% rename from tools/find_tap_name/bin/386/find_tap_name.exe rename to client/tools/find_tap_name/bin/386/find_tap_name.exe diff --git a/tools/find_tap_name/bin/amd64/find_tap_name.exe b/client/tools/find_tap_name/bin/amd64/find_tap_name.exe similarity index 100% rename from tools/find_tap_name/bin/amd64/find_tap_name.exe rename to client/tools/find_tap_name/bin/amd64/find_tap_name.exe diff --git a/tools/find_tap_name/build.action.sh b/client/tools/find_tap_name/build.action.sh similarity index 100% rename from tools/find_tap_name/build.action.sh rename to client/tools/find_tap_name/build.action.sh diff --git a/tools/find_tap_name/main.go b/client/tools/find_tap_name/main.go similarity index 100% rename from tools/find_tap_name/main.go rename to client/tools/find_tap_name/main.go diff --git a/tools/outline_proxy_controller/.gitignore b/client/tools/outline_proxy_controller/.gitignore similarity index 100% rename from tools/outline_proxy_controller/.gitignore rename to client/tools/outline_proxy_controller/.gitignore diff --git a/tools/outline_proxy_controller/CMakeLists.txt b/client/tools/outline_proxy_controller/CMakeLists.txt similarity index 100% rename from tools/outline_proxy_controller/CMakeLists.txt rename to client/tools/outline_proxy_controller/CMakeLists.txt diff --git a/tools/outline_proxy_controller/Dockerfile b/client/tools/outline_proxy_controller/Dockerfile similarity index 100% rename from tools/outline_proxy_controller/Dockerfile rename to client/tools/outline_proxy_controller/Dockerfile diff --git a/tools/outline_proxy_controller/OutlineProxyControllerConfig.h.in b/client/tools/outline_proxy_controller/OutlineProxyControllerConfig.h.in similarity index 100% rename from tools/outline_proxy_controller/OutlineProxyControllerConfig.h.in rename to client/tools/outline_proxy_controller/OutlineProxyControllerConfig.h.in diff --git a/tools/outline_proxy_controller/README.md b/client/tools/outline_proxy_controller/README.md similarity index 100% rename from tools/outline_proxy_controller/README.md rename to client/tools/outline_proxy_controller/README.md diff --git a/tools/outline_proxy_controller/build.action.sh b/client/tools/outline_proxy_controller/build.action.sh similarity index 100% rename from tools/outline_proxy_controller/build.action.sh rename to client/tools/outline_proxy_controller/build.action.sh diff --git a/tools/outline_proxy_controller/dist/OutlineProxyController b/client/tools/outline_proxy_controller/dist/OutlineProxyController similarity index 100% rename from tools/outline_proxy_controller/dist/OutlineProxyController rename to client/tools/outline_proxy_controller/dist/OutlineProxyController diff --git a/tools/outline_proxy_controller/dist/install_linux_service.sh b/client/tools/outline_proxy_controller/dist/install_linux_service.sh similarity index 100% rename from tools/outline_proxy_controller/dist/install_linux_service.sh rename to client/tools/outline_proxy_controller/dist/install_linux_service.sh diff --git a/tools/outline_proxy_controller/dist/outline_proxy_controller.service b/client/tools/outline_proxy_controller/dist/outline_proxy_controller.service similarity index 100% rename from tools/outline_proxy_controller/dist/outline_proxy_controller.service rename to client/tools/outline_proxy_controller/dist/outline_proxy_controller.service diff --git a/tools/outline_proxy_controller/logger.cpp b/client/tools/outline_proxy_controller/logger.cpp similarity index 100% rename from tools/outline_proxy_controller/logger.cpp rename to client/tools/outline_proxy_controller/logger.cpp diff --git a/tools/outline_proxy_controller/logger.h b/client/tools/outline_proxy_controller/logger.h similarity index 100% rename from tools/outline_proxy_controller/logger.h rename to client/tools/outline_proxy_controller/logger.h diff --git a/tools/outline_proxy_controller/network_monitor.cpp b/client/tools/outline_proxy_controller/network_monitor.cpp similarity index 100% rename from tools/outline_proxy_controller/network_monitor.cpp rename to client/tools/outline_proxy_controller/network_monitor.cpp diff --git a/tools/outline_proxy_controller/network_monitor.h b/client/tools/outline_proxy_controller/network_monitor.h similarity index 100% rename from tools/outline_proxy_controller/network_monitor.h rename to client/tools/outline_proxy_controller/network_monitor.h diff --git a/tools/outline_proxy_controller/outline_controller_server.cpp b/client/tools/outline_proxy_controller/outline_controller_server.cpp similarity index 100% rename from tools/outline_proxy_controller/outline_controller_server.cpp rename to client/tools/outline_proxy_controller/outline_controller_server.cpp diff --git a/tools/outline_proxy_controller/outline_controller_server.h b/client/tools/outline_proxy_controller/outline_controller_server.h similarity index 100% rename from tools/outline_proxy_controller/outline_controller_server.h rename to client/tools/outline_proxy_controller/outline_controller_server.h diff --git a/tools/outline_proxy_controller/outline_daemon.cpp b/client/tools/outline_proxy_controller/outline_daemon.cpp similarity index 100% rename from tools/outline_proxy_controller/outline_daemon.cpp rename to client/tools/outline_proxy_controller/outline_daemon.cpp diff --git a/tools/outline_proxy_controller/outline_error.cpp b/client/tools/outline_proxy_controller/outline_error.cpp similarity index 100% rename from tools/outline_proxy_controller/outline_error.cpp rename to client/tools/outline_proxy_controller/outline_error.cpp diff --git a/tools/outline_proxy_controller/outline_error.h b/client/tools/outline_proxy_controller/outline_error.h similarity index 100% rename from tools/outline_proxy_controller/outline_error.h rename to client/tools/outline_proxy_controller/outline_error.h diff --git a/tools/outline_proxy_controller/outline_proxy_controller.cpp b/client/tools/outline_proxy_controller/outline_proxy_controller.cpp similarity index 100% rename from tools/outline_proxy_controller/outline_proxy_controller.cpp rename to client/tools/outline_proxy_controller/outline_proxy_controller.cpp diff --git a/tools/outline_proxy_controller/outline_proxy_controller.h b/client/tools/outline_proxy_controller/outline_proxy_controller.h similarity index 100% rename from tools/outline_proxy_controller/outline_proxy_controller.h rename to client/tools/outline_proxy_controller/outline_proxy_controller.h diff --git a/tools/smartdnsblock/README.md b/client/tools/smartdnsblock/README.md similarity index 100% rename from tools/smartdnsblock/README.md rename to client/tools/smartdnsblock/README.md diff --git a/tools/smartdnsblock/bin/smartdnsblock.exe b/client/tools/smartdnsblock/bin/smartdnsblock.exe similarity index 100% rename from tools/smartdnsblock/bin/smartdnsblock.exe rename to client/tools/smartdnsblock/bin/smartdnsblock.exe diff --git a/tools/smartdnsblock/smartdnsblock.sln b/client/tools/smartdnsblock/smartdnsblock.sln similarity index 100% rename from tools/smartdnsblock/smartdnsblock.sln rename to client/tools/smartdnsblock/smartdnsblock.sln diff --git a/tools/smartdnsblock/smartdnsblock/smartdnsblock.cpp b/client/tools/smartdnsblock/smartdnsblock/smartdnsblock.cpp similarity index 100% rename from tools/smartdnsblock/smartdnsblock/smartdnsblock.cpp rename to client/tools/smartdnsblock/smartdnsblock/smartdnsblock.cpp diff --git a/tools/smartdnsblock/smartdnsblock/smartdnsblock.filters b/client/tools/smartdnsblock/smartdnsblock/smartdnsblock.filters similarity index 100% rename from tools/smartdnsblock/smartdnsblock/smartdnsblock.filters rename to client/tools/smartdnsblock/smartdnsblock/smartdnsblock.filters diff --git a/tools/smartdnsblock/smartdnsblock/smartdnsblock.user b/client/tools/smartdnsblock/smartdnsblock/smartdnsblock.user similarity index 100% rename from tools/smartdnsblock/smartdnsblock/smartdnsblock.user rename to client/tools/smartdnsblock/smartdnsblock/smartdnsblock.user diff --git a/tools/smartdnsblock/smartdnsblock/smartdnsblock.vcxproj b/client/tools/smartdnsblock/smartdnsblock/smartdnsblock.vcxproj similarity index 100% rename from tools/smartdnsblock/smartdnsblock/smartdnsblock.vcxproj rename to client/tools/smartdnsblock/smartdnsblock/smartdnsblock.vcxproj diff --git a/tsconfig.json b/client/tsconfig.json similarity index 95% rename from tsconfig.json rename to client/tsconfig.json index 33fb161c84..f6dbb97233 100644 --- a/tsconfig.json +++ b/client/tsconfig.json @@ -11,7 +11,7 @@ "outDir": "build", "removeComments": false, "resolveJsonModule": true, - "rootDir": "./", + "rootDir": "../", "skipLibCheck": true, "target": "es2017", "lib": ["es2022"] diff --git a/client/www/6a9a3c1460491e5495ea8899784fc0fe.png b/client/www/6a9a3c1460491e5495ea8899784fc0fe.png new file mode 100644 index 0000000000..35c767c566 Binary files /dev/null and b/client/www/6a9a3c1460491e5495ea8899784fc0fe.png differ diff --git a/client/www/8c59cf2168143c4cc938073f1a28650e.woff2 b/client/www/8c59cf2168143c4cc938073f1a28650e.woff2 new file mode 100644 index 0000000000..561f1fcbfc Binary files /dev/null and b/client/www/8c59cf2168143c4cc938073f1a28650e.woff2 differ diff --git a/client/www/assets/brand-logo.png b/client/www/assets/brand-logo.png new file mode 100644 index 0000000000..b608bba0de Binary files /dev/null and b/client/www/assets/brand-logo.png differ diff --git a/client/www/assets/circle.png b/client/www/assets/circle.png new file mode 100644 index 0000000000..35c767c566 Binary files /dev/null and b/client/www/assets/circle.png differ diff --git a/client/www/assets/icons/about.png b/client/www/assets/icons/about.png new file mode 100644 index 0000000000..b5e2c38bde Binary files /dev/null and b/client/www/assets/icons/about.png differ diff --git a/client/www/assets/icons/add.png b/client/www/assets/icons/add.png new file mode 100644 index 0000000000..1dedaf6530 Binary files /dev/null and b/client/www/assets/icons/add.png differ diff --git a/client/www/assets/icons/back.png b/client/www/assets/icons/back.png new file mode 100644 index 0000000000..54ca096f3c Binary files /dev/null and b/client/www/assets/icons/back.png differ diff --git a/client/www/assets/icons/change_language.png b/client/www/assets/icons/change_language.png new file mode 100644 index 0000000000..3ad885ba12 Binary files /dev/null and b/client/www/assets/icons/change_language.png differ diff --git a/client/www/assets/icons/contact.png b/client/www/assets/icons/contact.png new file mode 100644 index 0000000000..3af65e90be Binary files /dev/null and b/client/www/assets/icons/contact.png differ diff --git a/client/www/assets/icons/feedback.png b/client/www/assets/icons/feedback.png new file mode 100644 index 0000000000..3af65e90be Binary files /dev/null and b/client/www/assets/icons/feedback.png differ diff --git a/client/www/assets/icons/help.png b/client/www/assets/icons/help.png new file mode 100644 index 0000000000..f0355df551 Binary files /dev/null and b/client/www/assets/icons/help.png differ diff --git a/client/www/assets/icons/menu.png b/client/www/assets/icons/menu.png new file mode 100644 index 0000000000..6b01874af1 Binary files /dev/null and b/client/www/assets/icons/menu.png differ diff --git a/client/www/assets/icons/outline.png b/client/www/assets/icons/outline.png new file mode 100644 index 0000000000..839790f2eb Binary files /dev/null and b/client/www/assets/icons/outline.png differ diff --git a/client/www/assets/icons/quit.png b/client/www/assets/icons/quit.png new file mode 100644 index 0000000000..febfdf75be Binary files /dev/null and b/client/www/assets/icons/quit.png differ diff --git a/client/www/assets/jigsaw-logo.png b/client/www/assets/jigsaw-logo.png new file mode 100644 index 0000000000..e6b852400c Binary files /dev/null and b/client/www/assets/jigsaw-logo.png differ diff --git a/client/www/assets/jigsaw-logo.svg b/client/www/assets/jigsaw-logo.svg new file mode 100644 index 0000000000..b0a60a2285 --- /dev/null +++ b/client/www/assets/jigsaw-logo.svg @@ -0,0 +1,30 @@ + + + + +Jigsaw +Created with Sketch. + + + + + + + + + + + + diff --git a/client/www/assets/logo-nav.png b/client/www/assets/logo-nav.png new file mode 100644 index 0000000000..fa59c9a510 Binary files /dev/null and b/client/www/assets/logo-nav.png differ diff --git a/client/www/assets/material_icons.woff2 b/client/www/assets/material_icons.woff2 new file mode 100644 index 0000000000..561f1fcbfc Binary files /dev/null and b/client/www/assets/material_icons.woff2 differ diff --git a/client/www/assets/outline-client-logo.png b/client/www/assets/outline-client-logo.png new file mode 100644 index 0000000000..82d2b39046 Binary files /dev/null and b/client/www/assets/outline-client-logo.png differ diff --git a/client/www/assets/outline-client-logo.svg b/client/www/assets/outline-client-logo.svg new file mode 100644 index 0000000000..b211065c72 --- /dev/null +++ b/client/www/assets/outline-client-logo.svg @@ -0,0 +1,34 @@ + + + + +outline-logotype +Created with Sketch. + + + + + + + + + + + + + + + + + diff --git a/client/www/assets/privacy-lock.png b/client/www/assets/privacy-lock.png new file mode 100644 index 0000000000..12c942ec6d Binary files /dev/null and b/client/www/assets/privacy-lock.png differ diff --git a/client/www/environment.json b/client/www/environment.json new file mode 100644 index 0000000000..a73c77fa0c --- /dev/null +++ b/client/www/environment.json @@ -0,0 +1 @@ +{"APP_VERSION":"0.0.0-debug","APP_BUILD_NUMBER":475553} \ No newline at end of file diff --git a/src/www/index_electron.html b/client/www/index_electron.html similarity index 95% rename from src/www/index_electron.html rename to client/www/index_electron.html index c337625130..64c46e07cf 100644 --- a/src/www/index_electron.html +++ b/client/www/index_electron.html @@ -20,7 +20,7 @@ Outline - + + + + + ``` + + ```js + import {html} from '@polymer/polymer/lib/utils/html-tag.js'; + import '@polymer/iron-flex-layout/iron-flex-layout-classes.js'; + + const template = html` + + +
+
horizontal layout center alignment
+
+ `; + document.body.appendChild(template.content); + ``` + +2. [Custom CSS +mixins](https://github.com/PolymerElements/iron-flex-layout/blob/master/iron-flex-layout.html). +The mixin stylesheet includes custom CSS mixins that can be applied inside a CSS +rule using the `@apply` function. + +Please note that the old [/deep/ layout +classes](https://github.com/PolymerElements/iron-flex-layout/tree/master/classes) +are deprecated, and should not be used. To continue using layout properties +directly in markup, please switch to using the new `dom-module`-based +[layout +classes](https://github.com/PolymerElements/iron-flex-layout/tree/master/iron-flex-layout-classes.html). +Please note that the new version does not use `/deep/`, and therefore requires +you to import the `dom-modules` in every element that needs to use them. + +@group Iron Elements +@pseudoElement iron-flex-layout +@demo demo/index.html +*/ +const template = (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_1__.html)` + + + + + +`; + +template.setAttribute('style', 'display: none;'); +document.head.appendChild(template.content); + +var style = document.createElement('style'); +style.textContent = '[hidden] { display: none !important; }'; +document.head.appendChild(style); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-form-element-behavior/iron-form-element-behavior.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@polymer/iron-form-element-behavior/iron-form-element-behavior.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronFormElementBehavior: () => (/* binding */ IronFormElementBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + +/** + IronFormElementBehavior adds a `name`, `value` and `required` properties to + a custom element. It mostly exists for backcompatibility with Polymer 1.x, and + is probably not something you want to use. + + @demo demo/index.html + @polymerBehavior + */ +const IronFormElementBehavior = { + + properties: { + /** + * The name of this element. + */ + name: {type: String}, + + /** + * The value for this element. + * @type {*} + */ + value: {notify: true, type: String}, + + /** + * Set to true to mark the input as required. If used in a form, a + * custom element that uses this behavior should also use + * IronValidatableBehavior and define a custom validation method. + * Otherwise, a `required` element will always be considered valid. + * It's also strongly recommended to provide a visual style for the element + * when its value is invalid. + */ + required: {type: Boolean, value: false}, + }, + + // Empty implementations for backcompatibility. + attached: function() {}, + detached: function() {} +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-icon/iron-icon.js": +/*!******************************************************!*\ + !*** ./node_modules/@polymer/iron-icon/iron-icon.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_iron_flex_layout_iron_flex_layout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/iron-flex-layout/iron-flex-layout.js */ "./node_modules/@polymer/iron-flex-layout/iron-flex-layout.js"); +/* harmony import */ var _polymer_iron_meta_iron_meta_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-meta/iron-meta.js */ "./node_modules/@polymer/iron-meta/iron-meta.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + +/** + +The `iron-icon` element displays an icon. By default an icon renders as a 24px +square. + +Example using src: + + + +Example setting size to 32px x 32px: + + + + + +The iron elements include several sets of icons. To use the default set of +icons, import `iron-icons.js` and use the `icon` attribute to specify an icon: + + + + + +To use a different built-in set of icons, import the specific +`iron-icons/-icons.js`, and specify the icon as `:`. +For example, to use a communication icon, you would use: + + + + + +You can also create custom icon sets of bitmap or SVG icons. + +Example of using an icon named `cherry` from a custom iconset with the ID +`fruit`: + + + +See `` and `` for more information about how to +create a custom iconset. + +See the `iron-icons` demo to see the icons available in the various iconsets. + +### Styling + +The following custom properties are available for styling: + +Custom property | Description | Default +----------------|-------------|---------- +`--iron-icon` | Mixin applied to the icon | {} +`--iron-icon-width` | Width of the icon | `24px` +`--iron-icon-height` | Height of the icon | `24px` +`--iron-icon-fill-color` | Fill color of the svg icon | `currentcolor` +`--iron-icon-stroke-color` | Stroke color of the svg icon | none + +@group Iron Elements +@element iron-icon +@demo demo/index.html +@hero hero.svg +@homepage polymer.github.io +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_2__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_4__.html)` + +`, + + is: 'iron-icon', + + properties: { + + /** + * The name of the icon to use. The name should be of the form: + * `iconset_name:icon_name`. + */ + icon: {type: String}, + + /** + * The name of the theme to used, if one is specified by the + * iconset. + */ + theme: {type: String}, + + /** + * If using iron-icon without an iconset, you can set the src to be + * the URL of an individual icon image file. Note that this will take + * precedence over a given icon attribute. + */ + src: {type: String}, + + /** + * @type {!IronMeta} + */ + _meta: {value: _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_5__.Base.create('iron-meta', {type: 'iconset'})} + + }, + + observers: [ + '_updateIcon(_meta, isAttached)', + '_updateIcon(theme, isAttached)', + '_srcChanged(src, isAttached)', + '_iconChanged(icon, isAttached)' + ], + + _DEFAULT_ICONSET: 'icons', + + _iconChanged: function(icon) { + var parts = (icon || '').split(':'); + this._iconName = parts.pop(); + this._iconsetName = parts.pop() || this._DEFAULT_ICONSET; + this._updateIcon(); + }, + + _srcChanged: function(src) { + this._updateIcon(); + }, + + _usesIconset: function() { + return this.icon || !this.src; + }, + + /** @suppress {visibility} */ + _updateIcon: function() { + if (this._usesIconset()) { + if (this._img && this._img.parentNode) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this.root).removeChild(this._img); + } + if (this._iconName === '') { + if (this._iconset) { + this._iconset.removeIcon(this); + } + } else if (this._iconsetName && this._meta) { + this._iconset = /** @type {?Polymer.Iconset} */ ( + this._meta.byKey(this._iconsetName)); + if (this._iconset) { + this._iconset.applyIcon(this, this._iconName, this.theme); + this.unlisten(window, 'iron-iconset-added', '_updateIcon'); + } else { + this.listen(window, 'iron-iconset-added', '_updateIcon'); + } + } + } else { + if (this._iconset) { + this._iconset.removeIcon(this); + } + if (!this._img) { + this._img = document.createElement('img'); + this._img.style.width = '100%'; + this._img.style.height = '100%'; + this._img.draggable = false; + } + this._img.src = this.src; + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this.root).appendChild(this._img); + } + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-icons/communication-icons.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@polymer/iron-icons/communication-icons.js ***! + \*****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_iron_icon_iron_icon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/iron-icon/iron-icon.js */ "./node_modules/@polymer/iron-icon/iron-icon.js"); +/* harmony import */ var _polymer_iron_iconset_svg_iron_iconset_svg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-iconset-svg/iron-iconset-svg.js */ "./node_modules/@polymer/iron-iconset-svg/iron-iconset-svg.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2014 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + +const template = (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__.html)` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +document.head.appendChild(template.content); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-icons/iron-icons.js": +/*!********************************************************!*\ + !*** ./node_modules/@polymer/iron-icons/iron-icons.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_iron_icon_iron_icon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/iron-icon/iron-icon.js */ "./node_modules/@polymer/iron-icon/iron-icon.js"); +/* harmony import */ var _polymer_iron_iconset_svg_iron_iconset_svg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-iconset-svg/iron-iconset-svg.js */ "./node_modules/@polymer/iron-iconset-svg/iron-iconset-svg.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2014 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + +/** + +`iron-icons` is a utility import that includes the definition for the +`iron-icon` element, `iron-iconset-svg` element, as well as an import for the +default icon set. + +The `iron-icons` directory also includes imports for additional icon sets that +can be loaded into your project. + +Example loading icon set: + + + +To use an icon from one of these sets, first prefix your `iron-icon` with the +icon set name, followed by a colon, ":", and then the icon id. + +Example using the directions-bus icon from the maps icon set: + + + +See [iron-icon](https://www.webcomponents.org/element/@polymer/iron-icon) for +more information about working with icons. + +See [iron-iconset](https://www.webcomponents.org/element/@polymer/iron-iconset) +and +[iron-iconset-svg](https://www.webcomponents.org/element/@polymer/iron-iconset-svg) +for more information about how to create a custom iconset. + +@group Iron Elements +@pseudoElement iron-icons +@demo demo/index.html +*/ + +const template = (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__.html)` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +document.head.appendChild(template.content); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-iconset-svg/iron-iconset-svg.js": +/*!********************************************************************!*\ + !*** ./node_modules/@polymer/iron-iconset-svg/iron-iconset-svg.js ***! + \********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_meta_iron_meta_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-meta/iron-meta.js */ "./node_modules/@polymer/iron-meta/iron-meta.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + +/** + * The `iron-iconset-svg` element allows users to define their own icon sets + * that contain svg icons. The svg icon elements should be children of the + * `iron-iconset-svg` element. Multiple icons should be given distinct id's. + * + * Using svg elements to create icons has a few advantages over traditional + * bitmap graphics like jpg or png. Icons that use svg are vector based so + * they are resolution independent and should look good on any device. They + * are stylable via css. Icons can be themed, colorized, and even animated. + * + * Example: + * + * + * + * + * + * + * + * + * + * + * + * + * This will automatically register the icon set "my-svg-icons" to the iconset + * database. To use these icons from within another element, make a + * `iron-iconset` element and call the `byId` method + * to retrieve a given iconset. To apply a particular icon inside an + * element use the `applyIcon` method. For example: + * + * iconset.applyIcon(iconNode, 'car'); + * + * @element iron-iconset-svg + * @demo demo/index.html + * @implements {Polymer.Iconset} + */ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_2__.Polymer)({ + is: 'iron-iconset-svg', + + properties: { + + /** + * The name of the iconset. + */ + name: {type: String, observer: '_nameChanged'}, + + /** + * The size of an individual icon. Note that icons must be square. + */ + size: {type: Number, value: 24}, + + /** + * Set to true to enable mirroring of icons where specified when they are + * stamped. Icons that should be mirrored should be decorated with a + * `mirror-in-rtl` attribute. + * + * NOTE: For performance reasons, direction will be resolved once per + * document per iconset, so moving icons in and out of RTL subtrees will + * not cause their mirrored state to change. + */ + rtlMirroring: {type: Boolean, value: false}, + + /** + * Set to true to measure RTL based on the dir attribute on the body or + * html elements (measured on document.body or document.documentElement as + * available). + */ + useGlobalRtlAttribute: {type: Boolean, value: false} + }, + + created: function() { + this._meta = new _polymer_iron_meta_iron_meta_js__WEBPACK_IMPORTED_MODULE_1__.IronMeta({type: 'iconset', key: null, value: null}); + }, + + attached: function() { + this.style.display = 'none'; + }, + + /** + * Construct an array of all icon names in this iconset. + * + * @return {!Array} Array of icon names. + */ + getIconNames: function() { + this._icons = this._createIconMap(); + return Object.keys(this._icons).map(function(n) { + return this.name + ':' + n; + }, this); + }, + + /** + * Applies an icon to the given element. + * + * An svg icon is prepended to the element's shadowRoot if it exists, + * otherwise to the element itself. + * + * If RTL mirroring is enabled, and the icon is marked to be mirrored in + * RTL, the element will be tested (once and only once ever for each + * iconset) to determine the direction of the subtree the element is in. + * This direction will apply to all future icon applications, although only + * icons marked to be mirrored will be affected. + * + * @method applyIcon + * @param {Element} element Element to which the icon is applied. + * @param {string} iconName Name of the icon to apply. + * @return {?Element} The svg element which renders the icon. + */ + applyIcon: function(element, iconName) { + // Remove old svg element + this.removeIcon(element); + // install new svg element + var svg = this._cloneIcon( + iconName, this.rtlMirroring && this._targetIsRTL(element)); + if (svg) { + // insert svg element into shadow root, if it exists + var pde = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(element.root || element); + pde.insertBefore(svg, pde.childNodes[0]); + return element._svgIcon = svg; + } + return null; + }, + + /** + * Remove an icon from the given element by undoing the changes effected + * by `applyIcon`. + * + * @param {Element} element The element from which the icon is removed. + */ + removeIcon: function(element) { + // Remove old svg element + if (element._svgIcon) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(element.root || element).removeChild(element._svgIcon); + element._svgIcon = null; + } + }, + + /** + * Measures and memoizes the direction of the element. Note that this + * measurement is only done once and the result is memoized for future + * invocations. + */ + _targetIsRTL: function(target) { + if (this.__targetIsRTL == null) { + if (this.useGlobalRtlAttribute) { + var globalElement = + (document.body && document.body.hasAttribute('dir')) ? + document.body : + document.documentElement; + + this.__targetIsRTL = globalElement.getAttribute('dir') === 'rtl'; + } else { + if (target && target.nodeType !== Node.ELEMENT_NODE) { + target = target.host; + } + + this.__targetIsRTL = + target && window.getComputedStyle(target)['direction'] === 'rtl'; + } + } + + return this.__targetIsRTL; + }, + + /** + * + * When name is changed, register iconset metadata + * + */ + _nameChanged: function() { + this._meta.value = null; + this._meta.key = this.name; + this._meta.value = this; + + this.async(function() { + this.fire('iron-iconset-added', this, {node: window}); + }); + }, + + /** + * Create a map of child SVG elements by id. + * + * @return {!Object} Map of id's to SVG elements. + */ + _createIconMap: function() { + // Objects chained to Object.prototype (`{}`) have members. Specifically, + // on FF there is a `watch` method that confuses the icon map, so we + // need to use a null-based object here. + var icons = Object.create(null); + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this).querySelectorAll('[id]').forEach(function(icon) { + icons[icon.id] = icon; + }); + return icons; + }, + + /** + * Produce installable clone of the SVG element matching `id` in this + * iconset, or `undefined` if there is no matching element. + * + * @return {Element} Returns an installable clone of the SVG element + * matching `id`. + */ + _cloneIcon: function(id, mirrorAllowed) { + // create the icon map on-demand, since the iconset itself has no discrete + // signal to know when it's children are fully parsed + this._icons = this._icons || this._createIconMap(); + return this._prepareSvgClone(this._icons[id], this.size, mirrorAllowed); + }, + + /** + * @param {Element} sourceSvg + * @param {number} size + * @param {Boolean} mirrorAllowed + * @return {Element} + */ + _prepareSvgClone: function(sourceSvg, size, mirrorAllowed) { + if (sourceSvg) { + var content = sourceSvg.cloneNode(true), + svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'), + viewBox = + content.getAttribute('viewBox') || '0 0 ' + size + ' ' + size, + cssText = + 'pointer-events: none; display: block; width: 100%; height: 100%;'; + + if (mirrorAllowed && content.hasAttribute('mirror-in-rtl')) { + cssText += + '-webkit-transform:scale(-1,1);transform:scale(-1,1);transform-origin:center;'; + } + + svg.setAttribute('viewBox', viewBox); + svg.setAttribute('preserveAspectRatio', 'xMidYMid meet'); + svg.setAttribute('focusable', 'false'); + // TODO(dfreedm): `pointer-events: none` works around + // https://crbug.com/370136 + // TODO(sjmiles): inline style may not be ideal, but avoids requiring a + // shadow-root + svg.style.cssText = cssText; + svg.appendChild(content).removeAttribute('id'); + return svg; + } + return null; + } + +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-image/iron-image.js": +/*!********************************************************!*\ + !*** ./node_modules/@polymer/iron-image/iron-image.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/* harmony import */ var _polymer_polymer_lib_utils_resolve_url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/utils/resolve-url.js */ "./node_modules/@polymer/polymer/lib/utils/resolve-url.js"); +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt +Code distributed by Google as part of the polymer project is also +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + +/** +`iron-image` is an element for displaying an image that provides useful sizing and +preloading options not found on the standard `` tag. + +The `sizing` option allows the image to be either cropped (`cover`) or +letterboxed (`contain`) to fill a fixed user-size placed on the element. + +The `preload` option prevents the browser from rendering the image until the +image is fully loaded. In the interim, either the element's CSS `background-color` +can be be used as the placeholder, or the `placeholder` property can be +set to a URL (preferably a data-URI, for instant rendering) for an +placeholder image. + +The `fade` option (only valid when `preload` is set) will cause the placeholder +image/color to be faded out once the image is rendered. + +Examples: + + Basically identical to `` tag: + + + + Will letterbox the image to fit: + + + + Will crop the image to fit: + + + + Will show light-gray background until the image loads: + + + + Will show a base-64 encoded placeholder image until the image loads: + + + + Will fade the light-gray background out once the image is loaded: + + + +Custom property | Description | Default +----------------|-------------|---------- +`--iron-image-placeholder` | Mixin applied to #placeholder | `{}` +`--iron-image-width` | Sets the width of the wrapped image | `auto` +`--iron-image-height` | Sets the height of the wrapped image | `auto` + +@group Iron Elements +@element iron-image +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_2__.html)` + + + + + +
+`, + + is: 'iron-image', + + properties: { + /** + * The URL of an image. + */ + src: {type: String, value: ''}, + + /** + * A short text alternative for the image. + */ + alt: {type: String, value: null}, + + /** + * CORS enabled images support: + * https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image + */ + crossorigin: {type: String, value: null}, + + /** + * When true, the image is prevented from loading and any placeholder is + * shown. This may be useful when a binding to the src property is known to + * be invalid, to prevent 404 requests. + */ + preventLoad: {type: Boolean, value: false}, + + /** + * Sets a sizing option for the image. Valid values are `contain` (full + * aspect ratio of the image is contained within the element and + * letterboxed) or `cover` (image is cropped in order to fully cover the + * bounds of the element), or `null` (default: image takes natural size). + */ + sizing: {type: String, value: null, reflectToAttribute: true}, + + /** + * When a sizing option is used (`cover` or `contain`), this determines + * how the image is aligned within the element bounds. + */ + position: {type: String, value: 'center'}, + + /** + * When `true`, any change to the `src` property will cause the + * `placeholder` image to be shown until the new image has loaded. + */ + preload: {type: Boolean, value: false}, + + /** + * This image will be used as a background/placeholder until the src image + * has loaded. Use of a data-URI for placeholder is encouraged for instant + * rendering. + */ + placeholder: {type: String, value: null, observer: '_placeholderChanged'}, + + /** + * When `preload` is true, setting `fade` to true will cause the image to + * fade into place. + */ + fade: {type: Boolean, value: false}, + + /** + * Read-only value that is true when the image is loaded. + */ + loaded: {notify: true, readOnly: true, type: Boolean, value: false}, + + /** + * Read-only value that tracks the loading state of the image when the + * `preload` option is used. + */ + loading: {notify: true, readOnly: true, type: Boolean, value: false}, + + /** + * Read-only value that indicates that the last set `src` failed to load. + */ + error: {notify: true, readOnly: true, type: Boolean, value: false}, + + /** + * Can be used to set the width of image (e.g. via binding); size may also + * be set via CSS. + */ + width: {observer: '_widthChanged', type: Number, value: null}, + + /** + * Can be used to set the height of image (e.g. via binding); size may also + * be set via CSS. + * + * @attribute height + * @type number + * @default null + */ + height: {observer: '_heightChanged', type: Number, value: null}, + }, + + observers: [ + '_transformChanged(sizing, position)', + '_loadStateObserver(src, preventLoad)' + ], + + created: function() { + this._resolvedSrc = ''; + }, + + _imgOnLoad: function() { + if (this.$.img.src !== this._resolveSrc(this.src)) { + return; + } + + this._setLoading(false); + this._setLoaded(true); + this._setError(false); + }, + + _imgOnError: function() { + if (this.$.img.src !== this._resolveSrc(this.src)) { + return; + } + + this.$.img.removeAttribute('src'); + this.$.sizedImgDiv.style.backgroundImage = ''; + + this._setLoading(false); + this._setLoaded(false); + this._setError(true); + }, + + _computePlaceholderHidden: function() { + return !this.preload || (!this.fade && !this.loading && this.loaded); + }, + + _computePlaceholderClassName: function() { + return (this.preload && this.fade && !this.loading && this.loaded) ? + 'faded-out' : + ''; + }, + + _computeImgDivHidden: function() { + return !this.sizing; + }, + + _computeImgDivARIAHidden: function() { + return this.alt === '' ? 'true' : undefined; + }, + + _computeImgDivARIALabel: function() { + if (this.alt !== null) { + return this.alt; + } + + // Polymer.ResolveUrl.resolveUrl will resolve '' relative to a URL x to + // that URL x, but '' is the default for src. + if (this.src === '') { + return ''; + } + + // NOTE: Use of `URL` was removed here because IE11 doesn't support + // constructing it. If this ends up being problematic, we should + // consider reverting and adding the URL polyfill as a dev dependency. + var resolved = this._resolveSrc(this.src); + // Remove query parts, get file name. + return resolved.replace(/[?|#].*/g, '').split('/').pop(); + }, + + _computeImgHidden: function() { + return !!this.sizing; + }, + + _widthChanged: function() { + this.style.width = isNaN(this.width) ? this.width : this.width + 'px'; + }, + + _heightChanged: function() { + this.style.height = isNaN(this.height) ? this.height : this.height + 'px'; + }, + + _loadStateObserver: function(src, preventLoad) { + var newResolvedSrc = this._resolveSrc(src); + if (newResolvedSrc === this._resolvedSrc) { + return; + } + + this._resolvedSrc = ''; + this.$.img.removeAttribute('src'); + this.$.sizedImgDiv.style.backgroundImage = ''; + + if (src === '' || preventLoad) { + this._setLoading(false); + this._setLoaded(false); + this._setError(false); + } else { + this._resolvedSrc = newResolvedSrc; + this.$.img.src = this._resolvedSrc; + this.$.sizedImgDiv.style.backgroundImage = + 'url("' + this._resolvedSrc + '")'; + + this._setLoading(true); + this._setLoaded(false); + this._setError(false); + } + }, + + _placeholderChanged: function() { + this.$.placeholder.style.backgroundImage = + this.placeholder ? 'url("' + this.placeholder + '")' : ''; + }, + + _transformChanged: function() { + var sizedImgDivStyle = this.$.sizedImgDiv.style; + var placeholderStyle = this.$.placeholder.style; + + sizedImgDivStyle.backgroundSize = placeholderStyle.backgroundSize = + this.sizing; + + sizedImgDivStyle.backgroundPosition = placeholderStyle.backgroundPosition = + this.sizing ? this.position : ''; + + sizedImgDivStyle.backgroundRepeat = placeholderStyle.backgroundRepeat = + this.sizing ? 'no-repeat' : ''; + }, + + _resolveSrc: function(testSrc) { + var resolved = (0,_polymer_polymer_lib_utils_resolve_url_js__WEBPACK_IMPORTED_MODULE_3__.resolveUrl)(testSrc, this.$.baseURIAnchor.href); + // NOTE: Use of `URL` was removed here because IE11 doesn't support + // constructing it. If this ends up being problematic, we should + // consider reverting and adding the URL polyfill as a dev dependency. + if (resolved.length >= 2 && resolved[0] === '/' && resolved[1] !== '/') { + // In IE location.origin might not work + // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7 + resolved = (location.origin || location.protocol + '//' + location.host) + + resolved; + } + return resolved; + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-input/iron-input.js": +/*!********************************************************!*\ + !*** ./node_modules/@polymer/iron-input/iron-input.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_a11y_announcer_iron_a11y_announcer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-a11y-announcer/iron-a11y-announcer.js */ "./node_modules/@polymer/iron-a11y-announcer/iron-a11y-announcer.js"); +/* harmony import */ var _polymer_iron_validatable_behavior_iron_validatable_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-validatable-behavior/iron-validatable-behavior.js */ "./node_modules/@polymer/iron-validatable-behavior/iron-validatable-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + +/** +`` is a wrapper to a native `` element, that adds two-way +binding and prevention of invalid input. To use it, you must distribute a native +`` yourself. You can continue to use the native `input` as you would +normally: + + + + + + + + + +### Two-way binding + +By default you can only get notified of changes to a native ``'s `value` +due to user input: + + + +This means that if you imperatively set the value (i.e. `someNativeInput.value = +'foo'`), no events will be fired and this change cannot be observed. + +`iron-input` adds the `bind-value` property that mirrors the native `input`'s +'`value` property; this property can be used for two-way data binding. +`bind-value` will notify if it is changed either by user input or by script. + + + + + +Note: this means that if you want to imperatively set the native `input`'s, you +_must_ set `bind-value` instead, so that the wrapper `iron-input` can be +notified. + +### Validation + +`iron-input` uses the native `input`'s validation. For simplicity, `iron-input` +has a `validate()` method (which internally just checks the distributed +`input`'s validity), which sets an `invalid` attribute that can also be used for +styling. + +To validate automatically as you type, you can use the `auto-validate` +attribute. + +`iron-input` also fires an `iron-input-validate` event after `validate()` is +called. You can use it to implement a custom validator: + + var CatsOnlyValidator = { + validate: function(ironInput) { + var valid = !ironInput.bindValue || ironInput.bindValue === 'cat'; + ironInput.invalid = !valid; + return valid; + } + } + ironInput.addEventListener('iron-input-validate', function() { + CatsOnly.validate(input2); + }); + +You can also use an element implementing an +[`IronValidatorBehavior`](/element/PolymerElements/iron-validatable-behavior). +This example can also be found in the demo for this element: + + + + + +### Preventing invalid input + +It may be desirable to only allow users to enter certain characters. You can use +the `allowed-pattern` attribute to accomplish this. This feature is separate +from validation, and `allowed-pattern` does not affect how the input is +validated. + + // Only allow typing digits, but a valid input has exactly 5 digits. + + + + +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__.html)` + + +`, + + is: 'iron-input', + behaviors: [_polymer_iron_validatable_behavior_iron_validatable_behavior_js__WEBPACK_IMPORTED_MODULE_2__.IronValidatableBehavior], + + /** + * Fired whenever `validate()` is called. + * + * @event iron-input-validate + */ + + properties: { + + /** + * Use this property instead of `value` for two-way data binding, or to + * set a default value for the input. **Do not** use the distributed + * input's `value` property to set a default value. + */ + bindValue: {type: String, value: ''}, + + /** + * Computed property that echoes `bindValue` (mostly used for Polymer 1.0 + * backcompatibility, if you were one-way binding to the Polymer 1.0 + * `input is="iron-input"` value attribute). + */ + value: {type: String, computed: '_computeValue(bindValue)'}, + + /** + * Regex-like list of characters allowed as input; all characters not in the + * list will be rejected. The recommended format should be a list of allowed + * characters, for example, `[a-zA-Z0-9.+-!;:]`. + * + * This pattern represents the allowed characters for the field; as the user + * inputs text, each individual character will be checked against the + * pattern (rather than checking the entire value as a whole). If a + * character is not a match, it will be rejected. + * + * Pasted input will have each character checked individually; if any + * character doesn't match `allowedPattern`, the entire pasted string will + * be rejected. + * + * Note: if you were using `iron-input` in 1.0, you were also required to + * set `prevent-invalid-input`. This is no longer needed as of Polymer 2.0, + * and will be set automatically for you if an `allowedPattern` is provided. + * + */ + allowedPattern: {type: String}, + + /** + * Set to true to auto-validate the input value as you type. + */ + autoValidate: {type: Boolean, value: false}, + + /** + * The native input element. + */ + _inputElement: Object, + }, + + observers: ['_bindValueChanged(bindValue, _inputElement)'], + listeners: {'input': '_onInput', 'keypress': '_onKeypress'}, + + created: function() { + _polymer_iron_a11y_announcer_iron_a11y_announcer_js__WEBPACK_IMPORTED_MODULE_1__.IronA11yAnnouncer.requestAvailability(); + this._previousValidInput = ''; + this._patternAlreadyChecked = false; + }, + + attached: function() { + // If the input is added at a later time, update the internal reference. + this._observer = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(this).observeNodes(function(info) { + this._initSlottedInput(); + }.bind(this)); + }, + + detached: function() { + if (this._observer) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(this).unobserveNodes(this._observer); + this._observer = null; + } + }, + + /** + * Returns the distributed input element. + */ + get inputElement() { + return this._inputElement; + }, + + _initSlottedInput: function() { + this._inputElement = this.getEffectiveChildren()[0]; + + if (this.inputElement && this.inputElement.value) { + this.bindValue = this.inputElement.value; + } + + this.fire('iron-input-ready'); + }, + + get _patternRegExp() { + var pattern; + if (this.allowedPattern) { + pattern = new RegExp(this.allowedPattern); + } else { + switch (this.inputElement.type) { + case 'number': + pattern = /[0-9.,e-]/; + break; + } + } + return pattern; + }, + + /** + * @suppress {checkTypes} + */ + _bindValueChanged: function(bindValue, inputElement) { + // The observer could have run before attached() when we have actually + // initialized this property. + if (!inputElement) { + return; + } + + if (bindValue === undefined) { + inputElement.value = null; + } else if (bindValue !== inputElement.value) { + this.inputElement.value = bindValue; + } + + if (this.autoValidate) { + this.validate(); + } + + // manually notify because we don't want to notify until after setting value + this.fire('bind-value-changed', {value: bindValue}); + }, + + _onInput: function() { + // Need to validate each of the characters pasted if they haven't + // been validated inside `_onKeypress` already. + if (this.allowedPattern && !this._patternAlreadyChecked) { + var valid = this._checkPatternValidity(); + if (!valid) { + this._announceInvalidCharacter( + 'Invalid string of characters not entered.'); + this.inputElement.value = this._previousValidInput; + } + } + this.bindValue = this._previousValidInput = this.inputElement.value; + this._patternAlreadyChecked = false; + }, + + _isPrintable: function(event) { + // What a control/printable character is varies wildly based on the browser. + // - most control characters (arrows, backspace) do not send a `keypress` + // event + // in Chrome, but the *do* on Firefox + // - in Firefox, when they do send a `keypress` event, control chars have + // a charCode = 0, keyCode = xx (for ex. 40 for down arrow) + // - printable characters always send a keypress event. + // - in Firefox, printable chars always have a keyCode = 0. In Chrome, the + // keyCode + // always matches the charCode. + // None of this makes any sense. + + // For these keys, ASCII code == browser keycode. + var anyNonPrintable = (event.keyCode == 8) || // backspace + (event.keyCode == 9) || // tab + (event.keyCode == 13) || // enter + (event.keyCode == 27); // escape + + // For these keys, make sure it's a browser keycode and not an ASCII code. + var mozNonPrintable = (event.keyCode == 19) || // pause + (event.keyCode == 20) || // caps lock + (event.keyCode == 45) || // insert + (event.keyCode == 46) || // delete + (event.keyCode == 144) || // num lock + (event.keyCode == 145) || // scroll lock + (event.keyCode > 32 && + event.keyCode < 41) || // page up/down, end, home, arrows + (event.keyCode > 111 && event.keyCode < 124); // fn keys + + return !anyNonPrintable && !(event.charCode == 0 && mozNonPrintable); + }, + + _onKeypress: function(event) { + if (!this.allowedPattern && this.inputElement.type !== 'number') { + return; + } + var regexp = this._patternRegExp; + if (!regexp) { + return; + } + + // Handle special keys and backspace + if (event.metaKey || event.ctrlKey || event.altKey) { + return; + } + + // Check the pattern either here or in `_onInput`, but not in both. + this._patternAlreadyChecked = true; + + var thisChar = String.fromCharCode(event.charCode); + if (this._isPrintable(event) && !regexp.test(thisChar)) { + event.preventDefault(); + this._announceInvalidCharacter( + 'Invalid character ' + thisChar + ' not entered.'); + } + }, + + _checkPatternValidity: function() { + var regexp = this._patternRegExp; + if (!regexp) { + return true; + } + for (var i = 0; i < this.inputElement.value.length; i++) { + if (!regexp.test(this.inputElement.value[i])) { + return false; + } + } + return true; + }, + + /** + * Returns true if `value` is valid. The validator provided in `validator` + * will be used first, then any constraints. + * @return {boolean} True if the value is valid. + */ + validate: function() { + if (!this.inputElement) { + this.invalid = false; + return true; + } + + // Use the nested input's native validity. + var valid = this.inputElement.checkValidity(); + + // Only do extra checking if the browser thought this was valid. + if (valid) { + // Empty, required input is invalid + if (this.required && this.bindValue === '') { + valid = false; + } else if (this.hasValidator()) { + valid = _polymer_iron_validatable_behavior_iron_validatable_behavior_js__WEBPACK_IMPORTED_MODULE_2__.IronValidatableBehavior.validate.call(this, this.bindValue); + } + } + + this.invalid = !valid; + this.fire('iron-input-validate'); + return valid; + }, + + _announceInvalidCharacter: function(message) { + this.fire('iron-announce', {text: message}); + }, + + _computeValue: function(bindValue) { + return bindValue; + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-location/iron-location.js": +/*!**************************************************************!*\ + !*** ./node_modules/@polymer/iron-location/iron-location.js ***! + \**************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/** + +The `iron-location` element manages binding to and from the current URL. + +iron-location is the first, and lowest level element in the Polymer team's +routing system. This is a beta release of iron-location as we continue work +on higher level elements, and as such iron-location may undergo breaking +changes. + +#### Properties + +When the URL is: `/search?query=583#details` iron-location's properties will be: + + - path: `'/search'` + - query: `'query=583'` + - hash: `'details'` + +These bindings are bidirectional. Modifying them will in turn modify the URL. + +iron-location is only active while it is attached to the document. + +#### Links + +While iron-location is active in the document it will intercept clicks on links +within your site, updating the URL pushing the updated URL out through the +databinding system. iron-location only intercepts clicks with the intent to +open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine. + +You can customize this behavior with the `urlSpaceRegex`. + +#### Dwell Time + +iron-location protects against accidental history spamming by only adding +entries to the user's history if the URL stays unchanged for `dwellTime` +milliseconds. + +@demo demo/index.html + + */ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + is: 'iron-location', + _template: null, + + properties: { + /** + * The pathname component of the URL. + */ + path: { + type: String, + notify: true, + value: function() { + return window.decodeURIComponent(window.location.pathname); + } + }, + + /** + * The query string portion of the URL. + */ + query: { + type: String, + notify: true, + value: function() { + return window.location.search.slice(1); + } + }, + + /** + * The hash component of the URL. + */ + hash: { + type: String, + notify: true, + value: function() { + return window.decodeURIComponent(window.location.hash.slice(1)); + } + }, + + /** + * If the user was on a URL for less than `dwellTime` milliseconds, it + * won't be added to the browser's history, but instead will be replaced + * by the next entry. + * + * This is to prevent large numbers of entries from clogging up the user's + * browser history. Disable by setting to a negative number. + */ + dwellTime: {type: Number, value: 2000}, + + /** + * A regexp that defines the set of URLs that should be considered part + * of this web app. + * + * Clicking on a link that matches this regex won't result in a full page + * navigation, but will instead just update the URL state in place. + * + * This regexp is given everything after the origin in an absolute + * URL. So to match just URLs that start with /search/ do: + * url-space-regex="^/search/" + * + * @type {string|RegExp} + */ + urlSpaceRegex: {type: String, value: ''}, + + /** + * A flag that specifies whether the spaces in query that would normally be + * encoded as %20 should be encoded as +. + * + * Given an example text "hello world", it is encoded in query as + * - "hello%20world" without the parameter + * - "hello+world" with the parameter + */ + encodeSpaceAsPlusInQuery: {type: Boolean, value: false}, + + /** + * urlSpaceRegex, but coerced into a regexp. + * + * @type {RegExp} + */ + _urlSpaceRegExp: {computed: '_makeRegExp(urlSpaceRegex)'}, + + _lastChangedAt: {type: Number}, + + _initialized: {type: Boolean, value: false} + }, + + hostAttributes: {hidden: true}, + + observers: ['_updateUrl(path, query, hash)'], + + created: function() { + this.__location = window.location; + }, + + attached: function() { + this.listen(window, 'hashchange', '_hashChanged'); + this.listen(window, 'location-changed', '_urlChanged'); + this.listen(window, 'popstate', '_urlChanged'); + this.listen( + /** @type {!HTMLBodyElement} */ (document.body), + 'click', + '_globalOnClick'); + // Give a 200ms grace period to make initial redirects without any + // additions to the user's history. + this._lastChangedAt = window.performance.now() - (this.dwellTime - 200); + this._initialized = true; + + this._urlChanged(); + }, + + detached: function() { + this.unlisten(window, 'hashchange', '_hashChanged'); + this.unlisten(window, 'location-changed', '_urlChanged'); + this.unlisten(window, 'popstate', '_urlChanged'); + this.unlisten( + /** @type {!HTMLBodyElement} */ (document.body), + 'click', + '_globalOnClick'); + this._initialized = false; + }, + + _hashChanged: function() { + this.hash = window.decodeURIComponent(this.__location.hash.substring(1)); + }, + + _urlChanged: function() { + // We want to extract all info out of the updated URL before we + // try to write anything back into it. + // + // i.e. without _dontUpdateUrl we'd overwrite the new path with the old + // one when we set this.hash. Likewise for query. + this._dontUpdateUrl = true; + this._hashChanged(); + this.path = window.decodeURIComponent(this.__location.pathname); + this.query = this.__location.search.substring(1); + this._dontUpdateUrl = false; + this._updateUrl(); + }, + + _getUrl: function() { + var partiallyEncodedPath = + window.encodeURI(this.path).replace(/\#/g, '%23').replace(/\?/g, '%3F'); + var partiallyEncodedQuery = ''; + if (this.query) { + partiallyEncodedQuery = '?' + this.query.replace(/\#/g, '%23'); + if (this.encodeSpaceAsPlusInQuery) { + partiallyEncodedQuery = partiallyEncodedQuery.replace(/\+/g, '%2B') + .replace(/ /g, '+') + .replace(/%20/g, '+'); + } else { + // required for edge + partiallyEncodedQuery = + partiallyEncodedQuery.replace(/\+/g, '%2B').replace(/ /g, '%20'); + } + } + var partiallyEncodedHash = ''; + if (this.hash) { + partiallyEncodedHash = '#' + window.encodeURI(this.hash); + } + return ( + partiallyEncodedPath + partiallyEncodedQuery + partiallyEncodedHash); + }, + + _updateUrl: function() { + if (this._dontUpdateUrl || !this._initialized) { + return; + } + + if (this.path === window.decodeURIComponent(this.__location.pathname) && + this.query === this.__location.search.substring(1) && + this.hash === + window.decodeURIComponent(this.__location.hash.substring(1))) { + // Nothing to do, the current URL is a representation of our properties. + return; + } + + var newUrl = this._getUrl(); + // Need to use a full URL in case the containing page has a base URI. + var fullNewUrl = + new URL(newUrl, this.__location.protocol + '//' + this.__location.host) + .href; + var now = window.performance.now(); + var shouldReplace = this._lastChangedAt + this.dwellTime > now; + this._lastChangedAt = now; + + if (shouldReplace) { + window.history.replaceState({}, '', fullNewUrl); + } else { + window.history.pushState({}, '', fullNewUrl); + } + + this.fire('location-changed', {}, {node: window}); + }, + + /** + * A necessary evil so that links work as expected. Does its best to + * bail out early if possible. + * + * @param {MouseEvent} event . + */ + _globalOnClick: function(event) { + // If another event handler has stopped this event then there's nothing + // for us to do. This can happen e.g. when there are multiple + // iron-location elements in a page. + if (event.defaultPrevented) { + return; + } + + var href = this._getSameOriginLinkHref(event); + + if (!href) { + return; + } + + event.preventDefault(); + + // If the navigation is to the current page we shouldn't add a history + // entry or fire a change event. + if (href === this.__location.href) { + return; + } + + window.history.pushState({}, '', href); + this.fire('location-changed', {}, {node: window}); + }, + + /** + * Returns the absolute URL of the link (if any) that this click event + * is clicking on, if we can and should override the resulting full + * page navigation. Returns null otherwise. + * + * @param {MouseEvent} event . + * @return {string?} . + */ + _getSameOriginLinkHref: function(event) { + // We only care about left-clicks. + if (event.button !== 0) { + return null; + } + + // We don't want modified clicks, where the intent is to open the page + // in a new tab. + if (event.metaKey || event.ctrlKey || event.shiftKey) { + return null; + } + + var eventPath = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__.dom)(event).path; + var anchor = null; + + for (var i = 0; i < eventPath.length; i++) { + var element = eventPath[i]; + + if (element.tagName === 'A' && element.href) { + anchor = element; + break; + } + } + + // If there's no link there's nothing to do. + if (!anchor) { + return null; + } + + // Target blank is a new tab, don't intercept. + if (anchor.target === '_blank') { + return null; + } + + // If the link is for an existing parent frame, don't intercept. + if ((anchor.target === '_top' || anchor.target === '_parent') && + window.top !== window) { + return null; + } + + // If the link is a download, don't intercept. + if (anchor.download) { + return null; + } + + var href = anchor.href; + + // It only makes sense for us to intercept same-origin navigations. + // pushState/replaceState don't work with cross-origin links. + var url; + + if (document.baseURI != null) { + url = new URL(href, /** @type {string} */ (document.baseURI)); + } else { + url = new URL(href); + } + + var origin; + + // IE Polyfill + if (this.__location.origin) { + origin = this.__location.origin; + } else { + origin = this.__location.protocol + '//' + this.__location.host; + } + + var urlOrigin; + + if (url.origin) { + urlOrigin = url.origin; + } else { + // IE always adds port number on HTTP and HTTPS on .host but not on + // window.location.host + var urlHost = url.host; + var urlPort = url.port; + var urlProtocol = url.protocol; + var isExtraneousHTTPS = urlProtocol === 'https:' && urlPort === '443'; + var isExtraneousHTTP = urlProtocol === 'http:' && urlPort === '80'; + + if (isExtraneousHTTPS || isExtraneousHTTP) { + urlHost = url.hostname; + } + urlOrigin = urlProtocol + '//' + urlHost; + } + + if (urlOrigin !== origin) { + return null; + } + + var normalizedHref = url.pathname + url.search + url.hash; + + // pathname should start with '/', but may not if `new URL` is not supported + if (normalizedHref[0] !== '/') { + normalizedHref = '/' + normalizedHref; + } + + // If we've been configured not to handle this url... don't handle it! + if (this._urlSpaceRegExp && !this._urlSpaceRegExp.test(normalizedHref)) { + return null; + } + + // Need to use a full URL in case the containing page has a base URI. + var fullNormalizedHref = new URL(normalizedHref, this.__location.href).href; + return fullNormalizedHref; + }, + + _makeRegExp: function(urlSpaceRegex) { + return RegExp(urlSpaceRegex); + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-location/iron-query-params.js": +/*!******************************************************************!*\ + !*** ./node_modules/@polymer/iron-location/iron-query-params.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + +/** + * @demo demo/iron-query-params.html + */ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + is: 'iron-query-params', + _template: null, + + properties: { + /** + * @type{string|undefined} + */ + paramsString: { + type: String, + notify: true, + observer: 'paramsStringChanged', + }, + + /** + * @type{Object|undefined} + */ + paramsObject: { + type: Object, + notify: true, + }, + + _dontReact: {type: Boolean, value: false} + }, + + hostAttributes: {hidden: true}, + + observers: ['paramsObjectChanged(paramsObject.*)'], + + paramsStringChanged: function() { + this._dontReact = true; + this.paramsObject = this._decodeParams(this.paramsString); + this._dontReact = false; + }, + + paramsObjectChanged: function() { + if (this._dontReact) { + return; + } + this.paramsString = this._encodeParams(this.paramsObject) + .replace(/%3F/g, '?') + .replace(/%2F/g, '/') + .replace(/'/g, '%27'); + }, + + _encodeParams: function(params) { + var encodedParams = []; + + for (var key in params) { + var value = params[key]; + + if (value === '') { + encodedParams.push(encodeURIComponent(key)); + + } else if (value) { + encodedParams.push( + encodeURIComponent(key) + '=' + + encodeURIComponent(value.toString())); + } + } + return encodedParams.join('&'); + }, + + _decodeParams: function(paramString) { + var params = {}; + // Work around a bug in decodeURIComponent where + is not + // converted to spaces: + paramString = (paramString || '').replace(/\+/g, '%20'); + var paramList = paramString.split('&'); + for (var i = 0; i < paramList.length; i++) { + var param = paramList[i].split('='); + if (param[0]) { + params[decodeURIComponent(param[0])] = + decodeURIComponent(param[1] || ''); + } + } + return params; + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-menu-behavior/iron-menu-behavior.js": +/*!************************************************************************!*\ + !*** ./node_modules/@polymer/iron-menu-behavior/iron-menu-behavior.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronMenuBehavior: () => (/* binding */ IronMenuBehavior), +/* harmony export */ IronMenuBehaviorImpl: () => (/* binding */ IronMenuBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js */ "./node_modules/@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js"); +/* harmony import */ var _polymer_iron_selector_iron_multi_selectable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-selector/iron-multi-selectable.js */ "./node_modules/@polymer/iron-selector/iron-multi-selectable.js"); +/* harmony import */ var _polymer_iron_selector_iron_selectable_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/iron-selector/iron-selectable.js */ "./node_modules/@polymer/iron-selector/iron-selectable.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** + * `IronMenuBehavior` implements accessible menu behavior. + * + * @demo demo/index.html + * @polymerBehavior IronMenuBehavior + */ +const IronMenuBehaviorImpl = { + + properties: { + + /** + * Returns the currently focused item. + * @type {?Object} + */ + focusedItem: + {observer: '_focusedItemChanged', readOnly: true, type: Object}, + + /** + * The attribute to use on menu items to look up the item title. Typing the + * first letter of an item when the menu is open focuses that item. If + * unset, `textContent` will be used. + */ + attrForItemTitle: {type: String}, + + /** + * @type {boolean} + */ + disabled: { + type: Boolean, + value: false, + observer: '_disabledChanged', + }, + }, + + /** + * The list of keys has been taken from + * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState + * @private + */ + _MODIFIER_KEYS: [ + 'Alt', + 'AltGraph', + 'CapsLock', + 'Control', + 'Fn', + 'FnLock', + 'Hyper', + 'Meta', + 'NumLock', + 'OS', + 'ScrollLock', + 'Shift', + 'Super', + 'Symbol', + 'SymbolLock' + ], + + /** @private */ + _SEARCH_RESET_TIMEOUT_MS: 1000, + + /** @private */ + _previousTabIndex: 0, + + hostAttributes: { + 'role': 'menu', + }, + + observers: ['_updateMultiselectable(multi)'], + + listeners: { + 'focus': '_onFocus', + 'keydown': '_onKeydown', + 'iron-items-changed': '_onIronItemsChanged' + }, + + /** + * @type {!Object} + */ + keyBindings: { + 'up': '_onUpKey', + 'down': '_onDownKey', + 'esc': '_onEscKey', + 'shift+tab:keydown': '_onShiftTabDown' + }, + + attached: function() { + this._resetTabindices(); + }, + + /** + * Selects the given value. If the `multi` property is true, then the selected + * state of the `value` will be toggled; otherwise the `value` will be + * selected. + * + * @param {string|number} value the value to select. + */ + select: function(value) { + // Cancel automatically focusing a default item if the menu received focus + // through a user action selecting a particular item. + if (this._defaultFocusAsync) { + this.cancelAsync(this._defaultFocusAsync); + this._defaultFocusAsync = null; + } + var item = this._valueToItem(value); + if (item && item.hasAttribute('disabled')) + return; + this._setFocusedItem(item); + _polymer_iron_selector_iron_multi_selectable_js__WEBPACK_IMPORTED_MODULE_2__.IronMultiSelectableBehaviorImpl.select.apply(this, arguments); + }, + + /** + * Resets all tabindex attributes to the appropriate value based on the + * current selection state. The appropriate value is `0` (focusable) for + * the default selected item, and `-1` (not keyboard focusable) for all + * other items. Also sets the correct initial values for aria-selected + * attribute, true for default selected item and false for others. + */ + _resetTabindices: function() { + var firstSelectedItem = this.multi ? + (this.selectedItems && this.selectedItems[0]) : + this.selectedItem; + + this.items.forEach(function(item) { + item.setAttribute('tabindex', item === firstSelectedItem ? '0' : '-1'); + item.setAttribute('aria-selected', this._selection.isSelected(item)); + }, this); + }, + + /** + * Sets appropriate ARIA based on whether or not the menu is meant to be + * multi-selectable. + * + * @param {boolean} multi True if the menu should be multi-selectable. + */ + _updateMultiselectable: function(multi) { + if (multi) { + this.setAttribute('aria-multiselectable', 'true'); + } else { + this.removeAttribute('aria-multiselectable'); + } + }, + + /** + * Given a KeyboardEvent, this method will focus the appropriate item in the + * menu (if there is a relevant item, and it is possible to focus it). + * + * @param {KeyboardEvent} event A KeyboardEvent. + */ + _focusWithKeyboardEvent: function(event) { + // Make sure that the key pressed is not a modifier key. + // getModifierState is not being used, as it is not available in Safari + // earlier than 10.0.2 (https://trac.webkit.org/changeset/206725/webkit) + if (this._MODIFIER_KEYS.indexOf(event.key) !== -1) + return; + + this.cancelDebouncer('_clearSearchText'); + + var searchText = this._searchText || ''; + var key = event.key && event.key.length == 1 ? + event.key : + String.fromCharCode(event.keyCode); + searchText += key.toLocaleLowerCase(); + + var searchLength = searchText.length; + + for (var i = 0, item; item = this.items[i]; i++) { + if (item.hasAttribute('disabled')) { + continue; + } + + var attr = this.attrForItemTitle || 'textContent'; + var title = (item[attr] || item.getAttribute(attr) || '').trim(); + + if (title.length < searchLength) { + continue; + } + + if (title.slice(0, searchLength).toLocaleLowerCase() == searchText) { + this._setFocusedItem(item); + break; + } + } + + this._searchText = searchText; + this.debounce( + '_clearSearchText', + this._clearSearchText, + this._SEARCH_RESET_TIMEOUT_MS); + }, + + _clearSearchText: function() { + this._searchText = ''; + }, + + /** + * Focuses the previous item (relative to the currently focused item) in the + * menu, disabled items will be skipped. + * Loop until length + 1 to handle case of single item in menu. + */ + _focusPrevious: function() { + var length = this.items.length; + var curFocusIndex = Number(this.indexOf(this.focusedItem)); + + for (var i = 1; i < length + 1; i++) { + var item = this.items[(curFocusIndex - i + length) % length]; + if (!item.hasAttribute('disabled')) { + var owner = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(item).getOwnerRoot() || document; + this._setFocusedItem(item); + + // Focus might not have worked, if the element was hidden or not + // focusable. In that case, try again. + if ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(owner).activeElement == item) { + return; + } + } + } + }, + + /** + * Focuses the next item (relative to the currently focused item) in the + * menu, disabled items will be skipped. + * Loop until length + 1 to handle case of single item in menu. + */ + _focusNext: function() { + var length = this.items.length; + var curFocusIndex = Number(this.indexOf(this.focusedItem)); + + for (var i = 1; i < length + 1; i++) { + var item = this.items[(curFocusIndex + i) % length]; + if (!item.hasAttribute('disabled')) { + var owner = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(item).getOwnerRoot() || document; + this._setFocusedItem(item); + + // Focus might not have worked, if the element was hidden or not + // focusable. In that case, try again. + if ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(owner).activeElement == item) { + return; + } + } + } + }, + + /** + * Mutates items in the menu based on provided selection details, so that + * all items correctly reflect selection state. + * + * @param {Element} item An item in the menu. + * @param {boolean} isSelected True if the item should be shown in a + * selected state, otherwise false. + */ + _applySelection: function(item, isSelected) { + if (isSelected) { + item.setAttribute('aria-selected', 'true'); + } else { + item.setAttribute('aria-selected', 'false'); + } + _polymer_iron_selector_iron_selectable_js__WEBPACK_IMPORTED_MODULE_3__.IronSelectableBehavior._applySelection.apply(this, arguments); + }, + + /** + * Discretely updates tabindex values among menu items as the focused item + * changes. + * + * @param {Element} focusedItem The element that is currently focused. + * @param {?Element} old The last element that was considered focused, if + * applicable. + */ + _focusedItemChanged: function(focusedItem, old) { + old && old.setAttribute('tabindex', '-1'); + if (focusedItem && !focusedItem.hasAttribute('disabled') && + !this.disabled) { + focusedItem.setAttribute('tabindex', '0'); + focusedItem.focus(); + } + }, + + /** + * A handler that responds to mutation changes related to the list of items + * in the menu. + * + * @param {CustomEvent} event An event containing mutation records as its + * detail. + */ + _onIronItemsChanged: function(event) { + if (event.detail.addedNodes.length) { + this._resetTabindices(); + } + }, + + /** + * Handler that is called when a shift+tab keypress is detected by the menu. + * + * @param {CustomEvent} event A key combination event. + */ + _onShiftTabDown: function(event) { + var oldTabIndex = this.getAttribute('tabindex'); + + IronMenuBehaviorImpl._shiftTabPressed = true; + + this._setFocusedItem(null); + + this.setAttribute('tabindex', '-1'); + + this.async(function() { + this.setAttribute('tabindex', oldTabIndex); + IronMenuBehaviorImpl._shiftTabPressed = false; + // NOTE(cdata): polymer/polymer#1305 + }, 1); + }, + + /** + * Handler that is called when the menu receives focus. + * + * @param {FocusEvent} event A focus event. + */ + _onFocus: function(event) { + if (IronMenuBehaviorImpl._shiftTabPressed) { + // do not focus the menu itself + return; + } + + // Do not focus the selected tab if the deepest target is part of the + // menu element's local DOM and is focusable. + var rootTarget = + /** @type {?HTMLElement} */ ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_4__.dom)(event).rootTarget); + if (rootTarget !== this && typeof rootTarget.tabIndex !== 'undefined' && + !this.isLightDescendant(rootTarget)) { + return; + } + + // clear the cached focus item + this._defaultFocusAsync = this.async(function() { + // focus the selected item when the menu receives focus, or the first item + // if no item is selected + var firstSelectedItem = this.multi ? + (this.selectedItems && this.selectedItems[0]) : + this.selectedItem; + + this._setFocusedItem(null); + + if (firstSelectedItem) { + this._setFocusedItem(firstSelectedItem); + } else if (this.items[0]) { + // We find the first none-disabled item (if one exists) + this._focusNext(); + } + }); + }, + + /** + * Handler that is called when the up key is pressed. + * + * @param {CustomEvent} event A key combination event. + */ + _onUpKey: function(event) { + // up and down arrows moves the focus + this._focusPrevious(); + event.detail.keyboardEvent.preventDefault(); + }, + + /** + * Handler that is called when the down key is pressed. + * + * @param {CustomEvent} event A key combination event. + */ + _onDownKey: function(event) { + this._focusNext(); + event.detail.keyboardEvent.preventDefault(); + }, + + /** + * Handler that is called when the esc key is pressed. + * + * @param {CustomEvent} event A key combination event. + */ + _onEscKey: function(event) { + var focusedItem = this.focusedItem; + if (focusedItem) { + focusedItem.blur(); + } + }, + + /** + * Handler that is called when a keydown event is detected. + * + * @param {KeyboardEvent} event A keyboard event. + */ + _onKeydown: function(event) { + if (!this.keyboardEventMatchesKeys(event, 'up down esc')) { + // all other keys focus the menu item starting with that character + this._focusWithKeyboardEvent(event); + } + event.stopPropagation(); + }, + + // override _activateHandler + _activateHandler: function(event) { + _polymer_iron_selector_iron_selectable_js__WEBPACK_IMPORTED_MODULE_3__.IronSelectableBehavior._activateHandler.call(this, event); + event.stopPropagation(); + }, + + /** + * Updates this element's tab index when it's enabled/disabled. + * @param {boolean} disabled + */ + _disabledChanged: function(disabled) { + if (disabled) { + this._previousTabIndex = + this.hasAttribute('tabindex') ? this.tabIndex : 0; + this.removeAttribute( + 'tabindex'); // No tabindex means not tab-able or select-able. + } else if (!this.hasAttribute('tabindex')) { + this.setAttribute('tabindex', this._previousTabIndex); + } + } +}; + +IronMenuBehaviorImpl._shiftTabPressed = false; + +/** @polymerBehavior */ +const IronMenuBehavior = + [_polymer_iron_selector_iron_multi_selectable_js__WEBPACK_IMPORTED_MODULE_2__.IronMultiSelectableBehavior, _polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_1__.IronA11yKeysBehavior, IronMenuBehaviorImpl]; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-meta/iron-meta.js": +/*!******************************************************!*\ + !*** ./node_modules/@polymer/iron-meta/iron-meta.js ***! + \******************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronMeta: () => (/* binding */ IronMeta) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +class IronMeta { + /** + * @param {{ + * type: (string|null|undefined), + * key: (string|null|undefined), + * value: *, + * }=} options + */ + constructor(options) { + IronMeta[' '](options); + + /** @type {string} */ + this.type = (options && options.type) || 'default'; + /** @type {string|null|undefined} */ + this.key = options && options.key; + if (options && 'value' in options) { + /** @type {*} */ + this.value = options.value; + } + } + + /** @return {*} */ + get value() { + var type = this.type; + var key = this.key; + + if (type && key) { + return IronMeta.types[type] && IronMeta.types[type][key]; + } + } + + /** @param {*} value */ + set value(value) { + var type = this.type; + var key = this.key; + + if (type && key) { + type = IronMeta.types[type] = IronMeta.types[type] || {}; + if (value == null) { + delete type[key]; + } else { + type[key] = value; + } + } + } + + /** @return {!Array<*>} */ + get list() { + var type = this.type; + + if (type) { + var items = IronMeta.types[this.type]; + if (!items) { + return []; + } + + return Object.keys(items).map(function(key) { + return metaDatas[this.type][key]; + }, this); + } + } + + /** + * @param {string} key + * @return {*} + */ + byKey(key) { + this.key = key; + return this.value; + } +}; + +// This function is used to convince Closure not to remove constructor calls +// for instances that are not held anywhere. For example, when +// `new IronMeta({...})` is used only for the side effect of adding a value. +IronMeta[' '] = function() {}; + +IronMeta.types = {}; + +var metaDatas = IronMeta.types; + +/** +`iron-meta` is a generic element you can use for sharing information across the +DOM tree. It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) +such that any instance of iron-meta has access to the shared information. You +can use `iron-meta` to share whatever you want (or create an extension [like +x-meta] for enhancements). + +The `iron-meta` instances containing your actual data can be loaded in an +import, or constructed in any way you see fit. The only requirement is that you +create them before you try to access them. + +Examples: + +If I create an instance like this: + + + +Note that value="foo/bar" is the metadata I've defined. I could define more +attributes or use child nodes to define additional metadata. + +Now I can access that element (and it's metadata) from any iron-meta instance +via the byKey method, e.g. + + meta.byKey('info'); + +Pure imperative form would be like: + + document.createElement('iron-meta').byKey('info'); + +Or, in a Polymer element, you can include a meta in your template: + + + ... + this.$.meta.byKey('info'); + +@group Iron Elements +@demo demo/index.html +@element iron-meta +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + + is: 'iron-meta', + + properties: { + + /** + * The type of meta-data. All meta-data of the same type is stored + * together. + * @type {string} + */ + type: { + type: String, + value: 'default', + }, + + /** + * The key used to store `value` under the `type` namespace. + * @type {?string} + */ + key: { + type: String, + }, + + /** + * The meta-data to store or retrieve. + * @type {*} + */ + value: { + type: String, + notify: true, + }, + + /** + * If true, `value` is set to the iron-meta instance itself. + */ + self: {type: Boolean, observer: '_selfChanged'}, + + __meta: {type: Boolean, computed: '__computeMeta(type, key, value)'} + }, + + hostAttributes: {hidden: true}, + + __computeMeta: function(type, key, value) { + var meta = new IronMeta({type: type, key: key}); + + if (value !== undefined && value !== meta.value) { + meta.value = value; + } else if (this.value !== meta.value) { + this.value = meta.value; + } + + return meta; + }, + + get list() { + return this.__meta && this.__meta.list; + }, + + _selfChanged: function(self) { + if (self) { + this.value = this; + } + }, + + /** + * Retrieves meta data value by key. + * + * @method byKey + * @param {string} key The key of the meta-data to be returned. + * @return {*} + */ + byKey: function(key) { + return new IronMeta({type: this.type, key: key}).value; + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-overlay-behavior/iron-focusables-helper.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@polymer/iron-overlay-behavior/iron-focusables-helper.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronFocusablesHelper: () => (/* binding */ IronFocusablesHelper) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +var p = Element.prototype; +var matches = p.matches || p.matchesSelector || p.mozMatchesSelector || + p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector; + +class IronFocusablesHelperClass { + /** + * Returns a sorted array of tabbable nodes, including the root node. + * It searches the tabbable nodes in the light and shadow dom of the chidren, + * sorting the result by tabindex. + * @param {!Node} node + * @return {!Array} + */ + getTabbableNodes(node) { + var result = []; + // If there is at least one element with tabindex > 0, we need to sort + // the final array by tabindex. + var needsSortByTabIndex = this._collectTabbableNodes(node, result); + if (needsSortByTabIndex) { + return this._sortByTabIndex(result); + } + return result; + } + + /** + * Returns if a element is focusable. + * @param {!HTMLElement} element + * @return {boolean} + */ + isFocusable(element) { + // From http://stackoverflow.com/a/1600194/4228703: + // There isn't a definite list, it's up to the browser. The only + // standard we have is DOM Level 2 HTML + // https://www.w3.org/TR/DOM-Level-2-HTML/html.html, according to which the + // only elements that have a focus() method are HTMLInputElement, + // HTMLSelectElement, HTMLTextAreaElement and HTMLAnchorElement. This + // notably omits HTMLButtonElement and HTMLAreaElement. Referring to these + // tests with tabbables in different browsers + // http://allyjs.io/data-tables/focusable.html + + // Elements that cannot be focused if they have [disabled] attribute. + if (matches.call(element, 'input, select, textarea, button, object')) { + return matches.call(element, ':not([disabled])'); + } + // Elements that can be focused even if they have [disabled] attribute. + return matches.call( + element, 'a[href], area[href], iframe, [tabindex], [contentEditable]'); + } + + /** + * Returns if a element is tabbable. To be tabbable, a element must be + * focusable, visible, and with a tabindex !== -1. + * @param {!HTMLElement} element + * @return {boolean} + */ + isTabbable(element) { + return this.isFocusable(element) && + matches.call(element, ':not([tabindex="-1"])') && + this._isVisible(element); + } + + /** + * Returns the normalized element tabindex. If not focusable, returns -1. + * It checks for the attribute "tabindex" instead of the element property + * `tabIndex` since browsers assign different values to it. + * e.g. in Firefox `
` has `tabIndex = -1` + * @param {!HTMLElement} element + * @return {!number} + * @private + */ + _normalizedTabIndex(element) { + if (this.isFocusable(element)) { + var tabIndex = element.getAttribute('tabindex') || 0; + return Number(tabIndex); + } + return -1; + } + + /** + * Searches for nodes that are tabbable and adds them to the `result` array. + * Returns if the `result` array needs to be sorted by tabindex. + * @param {!Node} node The starting point for the search; added to `result` + * if tabbable. + * @param {!Array} result + * @return {boolean} + * @private + */ + _collectTabbableNodes(node, result) { + // If not an element or not visible, no need to explore children. + if (node.nodeType !== Node.ELEMENT_NODE) { + return false; + } + var element = /** @type {!HTMLElement} */ (node); + if (!this._isVisible(element)) { + return false; + } + var tabIndex = this._normalizedTabIndex(element); + var needsSort = tabIndex > 0; + if (tabIndex >= 0) { + result.push(element); + } + // In ShadowDOM v1, tab order is affected by the order of distrubution. + // E.g. getTabbableNodes(#root) in ShadowDOM v1 should return [#A, #B]; + // in ShadowDOM v0 tab order is not affected by the distrubution order, + // in fact getTabbableNodes(#root) returns [#B, #A]. + //
+ // + // + // + // + // + // + //
+ // TODO(valdrin) support ShadowDOM v1 when upgrading to Polymer v2.0. + var children; + if (element.localName === 'content' || element.localName === 'slot') { + children = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(element).getDistributedNodes(); + } else { + // Use shadow root if possible, will check for distributed nodes. + children = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(element.root || element).children; + } + for (var i = 0; i < children.length; i++) { + // Ensure method is always invoked to collect tabbable children. + needsSort = this._collectTabbableNodes(children[i], result) || needsSort; + } + return needsSort; + } + + /** + * Returns false if the element has `visibility: hidden` or `display: none` + * @param {!HTMLElement} element + * @return {boolean} + * @private + */ + _isVisible(element) { + // Check inline style first to save a re-flow. If looks good, check also + // computed style. + var style = element.style; + if (style.visibility !== 'hidden' && style.display !== 'none') { + style = window.getComputedStyle(element); + return (style.visibility !== 'hidden' && style.display !== 'none'); + } + return false; + } + + /** + * Sorts an array of tabbable elements by tabindex. Returns a new array. + * @param {!Array} tabbables + * @return {!Array} + * @private + */ + _sortByTabIndex(tabbables) { + // Implement a merge sort as Array.prototype.sort does a non-stable sort + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort + var len = tabbables.length; + if (len < 2) { + return tabbables; + } + var pivot = Math.ceil(len / 2); + var left = this._sortByTabIndex(tabbables.slice(0, pivot)); + var right = this._sortByTabIndex(tabbables.slice(pivot)); + return this._mergeSortByTabIndex(left, right); + } + + /** + * Merge sort iterator, merges the two arrays into one, sorted by tab index. + * @param {!Array} left + * @param {!Array} right + * @return {!Array} + * @private + */ + _mergeSortByTabIndex(left, right) { + var result = []; + while ((left.length > 0) && (right.length > 0)) { + if (this._hasLowerTabOrder(left[0], right[0])) { + result.push(right.shift()); + } else { + result.push(left.shift()); + } + } + + return result.concat(left, right); + } + + /** + * Returns if element `a` has lower tab order compared to element `b` + * (both elements are assumed to be focusable and tabbable). + * Elements with tabindex = 0 have lower tab order compared to elements + * with tabindex > 0. + * If both have same tabindex, it returns false. + * @param {!HTMLElement} a + * @param {!HTMLElement} b + * @return {boolean} + * @private + */ + _hasLowerTabOrder(a, b) { + // Normalize tabIndexes + // e.g. in Firefox `
` has `tabIndex = -1` + var ati = Math.max(a.tabIndex, 0); + var bti = Math.max(b.tabIndex, 0); + return (ati === 0 || bti === 0) ? bti > ati : ati > bti; + } +} + +const IronFocusablesHelper = new IronFocusablesHelperClass(); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-backdrop.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@polymer/iron-overlay-behavior/iron-overlay-backdrop.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + +/* +`iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It +should be a singleton. + +### Styling + +The following custom properties and mixins are available for styling. + +Custom property | Description | Default +-------------------------------------------|------------------------|--------- +`--iron-overlay-backdrop-background-color` | Backdrop background color | #000 +`--iron-overlay-backdrop-opacity` | Backdrop opacity | 0.6 +`--iron-overlay-backdrop` | Mixin applied to `iron-overlay-backdrop`. | {} +`--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-backdrop` when it is displayed | {} +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + /** @override */ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_3__.html)` + + + +`, + + is: 'iron-overlay-backdrop', + + properties: { + + /** + * Returns true if the backdrop is opened. + */ + opened: { + reflectToAttribute: true, + type: Boolean, + value: false, + observer: '_openedChanged', + } + + }, + + listeners: { + 'transitionend': '_onTransitionend', + }, + + /** @override */ + created: function() { + // Used to cancel previous requestAnimationFrame calls when opened changes. + this.__openedRaf = null; + }, + + /** @override */ + attached: function() { + this.opened && this._openedChanged(this.opened); + }, + + /** + * Appends the backdrop to document body if needed. + */ + prepare: function() { + if (this.opened && !this.parentNode) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__.dom)(document.body).appendChild(this); + } + }, + + /** + * Shows the backdrop. + */ + open: function() { + this.opened = true; + }, + + /** + * Hides the backdrop. + */ + close: function() { + this.opened = false; + }, + + /** + * Removes the backdrop from document body if needed. + */ + complete: function() { + if (!this.opened && this.parentNode === document.body) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__.dom)(this.parentNode).removeChild(this); + } + }, + + _onTransitionend: function(event) { + if (event && event.target === this) { + this.complete(); + } + }, + + /** + * @param {boolean} opened + * @private + */ + _openedChanged: function(opened) { + if (opened) { + // Auto-attach. + this.prepare(); + } else { + // Animation might be disabled via the mixin or opacity custom property. + // If it is disabled in other ways, it's up to the user to call complete. + var cs = window.getComputedStyle(this); + if (cs.transitionDuration === '0s' || cs.opacity == 0) { + this.complete(); + } + } + + if (!this.isAttached) { + return; + } + + // Always cancel previous requestAnimationFrame. + if (this.__openedRaf) { + window.cancelAnimationFrame(this.__openedRaf); + this.__openedRaf = null; + } + // Force relayout to ensure proper transitions. + this.scrollTop = this.scrollTop; + this.__openedRaf = window.requestAnimationFrame(function() { + this.__openedRaf = null; + this.toggleClass('opened', this.opened); + }.bind(this)); + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-behavior.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@polymer/iron-overlay-behavior/iron-overlay-behavior.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronOverlayBehavior: () => (/* binding */ IronOverlayBehavior), +/* harmony export */ IronOverlayBehaviorImpl: () => (/* binding */ IronOverlayBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_fit_behavior_iron_fit_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-fit-behavior/iron-fit-behavior.js */ "./node_modules/@polymer/iron-fit-behavior/iron-fit-behavior.js"); +/* harmony import */ var _polymer_iron_resizable_behavior_iron_resizable_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-resizable-behavior/iron-resizable-behavior.js */ "./node_modules/@polymer/iron-resizable-behavior/iron-resizable-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_settings_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/utils/settings.js */ "./node_modules/@polymer/polymer/lib/utils/settings.js"); +/* harmony import */ var _iron_focusables_helper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./iron-focusables-helper.js */ "./node_modules/@polymer/iron-overlay-behavior/iron-focusables-helper.js"); +/* harmony import */ var _iron_overlay_manager_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./iron-overlay-manager.js */ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-manager.js"); +/* harmony import */ var _iron_scroll_manager_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./iron-scroll-manager.js */ "./node_modules/@polymer/iron-overlay-behavior/iron-scroll-manager.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + + + + +/** @polymerBehavior */ +const IronOverlayBehaviorImpl = { + + properties: { + + /** + * True if the overlay is currently displayed. + */ + opened: + {observer: '_openedChanged', type: Boolean, value: false, notify: true}, + + /** + * True if the overlay was canceled when it was last closed. + */ + canceled: { + observer: '_canceledChanged', + readOnly: true, + type: Boolean, + value: false + }, + + /** + * Set to true to display a backdrop behind the overlay. It traps the focus + * within the light DOM of the overlay. + */ + withBackdrop: { + observer: '_withBackdropChanged', + type: Boolean, + }, + + /** + * Set to true to disable auto-focusing the overlay or child nodes with + * the `autofocus` attribute` when the overlay is opened. + */ + noAutoFocus: { + type: Boolean, + value: false, + }, + + /** + * Set to true to disable canceling the overlay with the ESC key. + */ + noCancelOnEscKey: { + type: Boolean, + value: false, + }, + + /** + * Set to true to disable canceling the overlay by clicking outside it. + */ + noCancelOnOutsideClick: { + type: Boolean, + value: false, + }, + + /** + * Contains the reason(s) this overlay was last closed (see + * `iron-overlay-closed`). `IronOverlayBehavior` provides the `canceled` + * reason; implementers of the behavior can provide other reasons in + * addition to `canceled`. + */ + closingReason: { + // was a getter before, but needs to be a property so other + // behaviors can override this. + type: Object, + }, + + /** + * Set to true to enable restoring of focus when overlay is closed. + */ + restoreFocusOnClose: { + type: Boolean, + value: false, + }, + + /** + * Set to true to allow clicks to go through overlays. + * When the user clicks outside this overlay, the click may + * close the overlay below. + */ + allowClickThrough: { + type: Boolean, + }, + + /** + * Set to true to keep overlay always on top. + */ + alwaysOnTop: { + type: Boolean, + }, + + /** + * Determines which action to perform when scroll outside an opened overlay + * happens. Possible values: lock - blocks scrolling from happening, refit - + * computes the new position on the overlay cancel - causes the overlay to + * close + */ + scrollAction: { + type: String, + }, + + /** + * Shortcut to access to the overlay manager. + * @private + * @type {!IronOverlayManagerClass} + */ + _manager: { + type: Object, + value: _iron_overlay_manager_js__WEBPACK_IMPORTED_MODULE_6__.IronOverlayManager, + }, + + /** + * The node being focused. + * @type {?Node} + */ + _focusedChild: { + type: Object, + } + + }, + + listeners: {'iron-resize': '_onIronResize'}, + + observers: ['__updateScrollObservers(isAttached, opened, scrollAction)'], + + /** + * The backdrop element. + * @return {!Element} + */ + get backdropElement() { + return this._manager.backdropElement; + }, + + /** + * Returns the node to give focus to. + * @return {!Node} + */ + get _focusNode() { + return this._focusedChild || (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this).querySelector('[autofocus]') || this; + }, + + /** + * Array of nodes that can receive focus (overlay included), ordered by + * `tabindex`. This is used to retrieve which is the first and last focusable + * nodes in order to wrap the focus for overlays `with-backdrop`. + * + * If you know what is your content (specifically the first and last focusable + * children), you can override this method to return only `[firstFocusable, + * lastFocusable];` + * @return {!Array} + * @protected + */ + get _focusableNodes() { + return _iron_focusables_helper_js__WEBPACK_IMPORTED_MODULE_5__.IronFocusablesHelper.getTabbableNodes(this); + }, + + /** + * @return {void} + */ + ready: function() { + // Used to skip calls to notifyResize and refit while the overlay is + // animating. + this.__isAnimating = false; + // with-backdrop needs tabindex to be set in order to trap the focus. + // If it is not set, IronOverlayBehavior will set it, and remove it if + // with-backdrop = false. + this.__shouldRemoveTabIndex = false; + // Used for wrapping the focus on TAB / Shift+TAB. + this.__firstFocusableNode = this.__lastFocusableNode = null; + // Used by to keep track of the RAF callbacks. + this.__rafs = {}; + // Focused node before overlay gets opened. Can be restored on close. + this.__restoreFocusNode = null; + // Scroll info to be restored. + this.__scrollTop = this.__scrollLeft = null; + this.__onCaptureScroll = this.__onCaptureScroll.bind(this); + // Root nodes hosting the overlay, used to listen for scroll events on them. + this.__rootNodes = null; + this._ensureSetup(); + }, + + /** @override */ + attached: function() { + // Call _openedChanged here so that position can be computed correctly. + if (this.opened) { + this._openedChanged(this.opened); + } + this._observer = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this).observeNodes(this._onNodesChange); + }, + + /** @override */ + detached: function() { + // TODO(bicknellr): Per spec, checking `this._observer` should never be + // necessary because `connectedCallback` and `disconnectedCallback` should + // always be called in alternating order. However, the custom elements + // polyfill doesn't implement the reactions stack, so this can sometimes + // happen, particularly if ShadyDOM is in noPatch mode where the custom + // elements polyfill is installed before ShadyDOM. We should investigate + // whether or not we can either implement the reactions stack without major + // performance implications or patch ShadyDOM's functions to restore the + // typical ShadyDOM-then-custom-elements order and remove this workaround. + if (this._observer) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this).unobserveNodes(this._observer); + } + this._observer = null; + for (var cb in this.__rafs) { + if (this.__rafs[cb] !== null) { + cancelAnimationFrame(this.__rafs[cb]); + } + } + this.__rafs = {}; + this._manager.removeOverlay(this); + + // We got detached while animating, ensure we show/hide the overlay + // and fire iron-overlay-opened/closed event! + if (this.__isAnimating) { + if (this.opened) { + this._finishRenderOpened(); + } else { + // Restore the focus if necessary. + this._applyFocus(); + this._finishRenderClosed(); + } + } + }, + + /** + * Toggle the opened state of the overlay. + */ + toggle: function() { + this._setCanceled(false); + this.opened = !this.opened; + }, + + /** + * Open the overlay. + */ + open: function() { + this._setCanceled(false); + this.opened = true; + }, + + /** + * Close the overlay. + */ + close: function() { + this._setCanceled(false); + this.opened = false; + }, + + /** + * Cancels the overlay. + * @param {Event=} event The original event + */ + cancel: function(event) { + var cancelEvent = + this.fire('iron-overlay-canceled', event, {cancelable: true}); + if (cancelEvent.defaultPrevented) { + return; + } + + this._setCanceled(true); + this.opened = false; + }, + + /** + * Invalidates the cached tabbable nodes. To be called when any of the + * focusable content changes (e.g. a button is disabled). + */ + invalidateTabbables: function() { + this.__firstFocusableNode = this.__lastFocusableNode = null; + }, + + _ensureSetup: function() { + if (this._overlaySetup) { + return; + } + this._overlaySetup = true; + this.style.outline = 'none'; + this.style.display = 'none'; + }, + + /** + * Called when `opened` changes. + * @param {boolean=} opened + * @protected + */ + _openedChanged: function(opened) { + if (opened) { + this.removeAttribute('aria-hidden'); + } else { + this.setAttribute('aria-hidden', 'true'); + } + + // Defer any animation-related code on attached + // (_openedChanged gets called again on attached). + if (!this.isAttached) { + return; + } + + this.__isAnimating = true; + + // Deraf for non-blocking rendering. + this.__deraf('__openedChanged', this.__openedChanged); + }, + + _canceledChanged: function() { + this.closingReason = this.closingReason || {}; + this.closingReason.canceled = this.canceled; + }, + + _withBackdropChanged: function() { + // If tabindex is already set, no need to override it. + if (this.withBackdrop && !this.hasAttribute('tabindex')) { + this.setAttribute('tabindex', '-1'); + this.__shouldRemoveTabIndex = true; + } else if (this.__shouldRemoveTabIndex) { + this.removeAttribute('tabindex'); + this.__shouldRemoveTabIndex = false; + } + if (this.opened && this.isAttached) { + this._manager.trackBackdrop(); + } + }, + + /** + * tasks which must occur before opening; e.g. making the element visible. + * @protected + */ + _prepareRenderOpened: function() { + // Store focused node. + this.__restoreFocusNode = this._manager.deepActiveElement; + + // Needed to calculate the size of the overlay so that transitions on its + // size will have the correct starting points. + this._preparePositioning(); + this.refit(); + this._finishPositioning(); + + // Safari will apply the focus to the autofocus element when displayed + // for the first time, so we make sure to return the focus where it was. + if (this.noAutoFocus && document.activeElement === this._focusNode) { + this._focusNode.blur(); + this.__restoreFocusNode.focus(); + } + }, + + /** + * Tasks which cause the overlay to actually open; typically play an + * animation. + * @protected + */ + _renderOpened: function() { + this._finishRenderOpened(); + }, + + /** + * Tasks which cause the overlay to actually close; typically play an + * animation. + * @protected + */ + _renderClosed: function() { + this._finishRenderClosed(); + }, + + /** + * Tasks to be performed at the end of open action. Will fire + * `iron-overlay-opened`. + * @protected + */ + _finishRenderOpened: function() { + this.notifyResize(); + this.__isAnimating = false; + + this.fire('iron-overlay-opened'); + }, + + /** + * Tasks to be performed at the end of close action. Will fire + * `iron-overlay-closed`. + * @protected + */ + _finishRenderClosed: function() { + // Hide the overlay. + this.style.display = 'none'; + // Reset z-index only at the end of the animation. + this.style.zIndex = ''; + this.notifyResize(); + this.__isAnimating = false; + this.fire('iron-overlay-closed', this.closingReason); + }, + + _preparePositioning: function() { + this.style.transition = this.style.webkitTransition = 'none'; + this.style.transform = this.style.webkitTransform = 'none'; + this.style.display = ''; + }, + + _finishPositioning: function() { + // First, make it invisible & reactivate animations. + this.style.display = 'none'; + // Force reflow before re-enabling animations so that they don't start. + // Set scrollTop to itself so that Closure Compiler doesn't remove this. + this.scrollTop = this.scrollTop; + this.style.transition = this.style.webkitTransition = ''; + this.style.transform = this.style.webkitTransform = ''; + // Now that animations are enabled, make it visible again + this.style.display = ''; + // Force reflow, so that following animations are properly started. + // Set scrollTop to itself so that Closure Compiler doesn't remove this. + this.scrollTop = this.scrollTop; + }, + + /** + * Applies focus according to the opened state. + * @protected + */ + _applyFocus: function() { + if (this.opened) { + if (!this.noAutoFocus) { + this._focusNode.focus(); + } + } else { + // Restore focus. + if (this.restoreFocusOnClose && this.__restoreFocusNode) { + // If the activeElement is `` or inside the overlay, + // we are allowed to restore the focus. In all the other + // cases focus might have been moved elsewhere by another + // component or by an user interaction (e.g. click on a + // button outside the overlay). + var activeElement = this._manager.deepActiveElement; + if (activeElement === document.body || + composedContains(this, activeElement)) { + this.__restoreFocusNode.focus(); + } + } + this.__restoreFocusNode = null; + this._focusNode.blur(); + this._focusedChild = null; + } + }, + + /** + * Cancels (closes) the overlay. Call when click happens outside the overlay. + * @param {!Event} event + * @protected + */ + _onCaptureClick: function(event) { + if (!this.noCancelOnOutsideClick) { + this.cancel(event); + } + }, + + /** + * Keeps track of the focused child. If withBackdrop, traps focus within + * overlay. + * @param {!Event} event + * @protected + */ + _onCaptureFocus: function(event) { + if (!this.withBackdrop) { + return; + } + var path = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(event).path; + if (path.indexOf(this) === -1) { + event.stopPropagation(); + this._applyFocus(); + } else { + this._focusedChild = /** @type {Node} */ (path[0]); + } + }, + + /** + * Handles the ESC key event and cancels (closes) the overlay. + * @param {!Event} event + * @protected + */ + _onCaptureEsc: function(event) { + if (!this.noCancelOnEscKey) { + this.cancel(event); + } + }, + + /** + * Handles TAB key events to track focus changes. + * Will wrap focus for overlays withBackdrop. + * @param {!Event} event + * @protected + */ + _onCaptureTab: function(event) { + if (!this.withBackdrop) { + return; + } + this.__ensureFirstLastFocusables(); + // TAB wraps from last to first focusable. + // Shift + TAB wraps from first to last focusable. + var shift = event.shiftKey; + var nodeToCheck = + shift ? this.__firstFocusableNode : this.__lastFocusableNode; + var nodeToSet = + shift ? this.__lastFocusableNode : this.__firstFocusableNode; + var shouldWrap = false; + if (nodeToCheck === nodeToSet) { + // If nodeToCheck is the same as nodeToSet, it means we have an overlay + // with 0 or 1 focusables; in either case we still need to trap the + // focus within the overlay. + shouldWrap = true; + } else { + // In dom=shadow, the manager will receive focus changes on the main + // root but not the ones within other shadow roots, so we can't rely on + // _focusedChild, but we should check the deepest active element. + var focusedNode = this._manager.deepActiveElement; + // If the active element is not the nodeToCheck but the overlay itself, + // it means the focus is about to go outside the overlay, hence we + // should prevent that (e.g. user opens the overlay and hit Shift+TAB). + shouldWrap = (focusedNode === nodeToCheck || focusedNode === this); + } + + if (shouldWrap) { + // When the overlay contains the last focusable element of the document + // and it's already focused, pressing TAB would move the focus outside + // the document (e.g. to the browser search bar). Similarly, when the + // overlay contains the first focusable element of the document and it's + // already focused, pressing Shift+TAB would move the focus outside the + // document (e.g. to the browser search bar). + // In both cases, we would not receive a focus event, but only a blur. + // In order to achieve focus wrapping, we prevent this TAB event and + // force the focus. This will also prevent the focus to temporarily move + // outside the overlay, which might cause scrolling. + event.preventDefault(); + this._focusedChild = nodeToSet; + this._applyFocus(); + } + }, + + /** + * Refits if the overlay is opened and not animating. + * @protected + */ + _onIronResize: function() { + if (this.opened && !this.__isAnimating) { + this.__deraf('refit', this.refit); + } + }, + + /** + * Will call notifyResize if overlay is opened. + * Can be overridden in order to avoid multiple observers on the same node. + * @protected + */ + _onNodesChange: function() { + if (this.opened && !this.__isAnimating) { + // It might have added focusable nodes, so invalidate cached values. + this.invalidateTabbables(); + this.notifyResize(); + } + }, + + /** + * Updates the references to the first and last focusable nodes. + * @private + */ + __ensureFirstLastFocusables: function() { + var focusableNodes = this._focusableNodes; + this.__firstFocusableNode = focusableNodes[0]; + this.__lastFocusableNode = focusableNodes[focusableNodes.length - 1]; + }, + + /** + * Tasks executed when opened changes: prepare for the opening, move the + * focus, update the manager, render opened/closed. + * @private + */ + __openedChanged: function() { + if (this.opened) { + // Make overlay visible, then add it to the manager. + this._prepareRenderOpened(); + this._manager.addOverlay(this); + // Move the focus to the child node with [autofocus]. + this._applyFocus(); + + this._renderOpened(); + } else { + // Remove overlay, then restore the focus before actually closing. + this._manager.removeOverlay(this); + this._applyFocus(); + + this._renderClosed(); + } + }, + + /** + * Debounces the execution of a callback to the next animation frame. + * @param {!string} jobname + * @param {!Function} callback Always bound to `this` + * @private + */ + __deraf: function(jobname, callback) { + var rafs = this.__rafs; + if (rafs[jobname] !== null) { + cancelAnimationFrame(rafs[jobname]); + } + rafs[jobname] = requestAnimationFrame(function nextAnimationFrame() { + rafs[jobname] = null; + callback.call(this); + }.bind(this)); + }, + + /** + * @param {boolean} isAttached + * @param {boolean} opened + * @param {string=} scrollAction + * @private + */ + __updateScrollObservers: function(isAttached, opened, scrollAction) { + if (!isAttached || !opened || !this.__isValidScrollAction(scrollAction)) { + (0,_iron_scroll_manager_js__WEBPACK_IMPORTED_MODULE_7__.removeScrollLock)(this); + this.__removeScrollListeners(); + } else { + if (scrollAction === 'lock') { + this.__saveScrollPosition(); + (0,_iron_scroll_manager_js__WEBPACK_IMPORTED_MODULE_7__.pushScrollLock)(this); + } + this.__addScrollListeners(); + } + }, + + /** + * @private + */ + __addScrollListeners: function() { + if (!this.__rootNodes) { + this.__rootNodes = []; + // Listen for scroll events in all shadowRoots hosting this overlay only + // when in native ShadowDOM. + if (_polymer_polymer_lib_utils_settings_js__WEBPACK_IMPORTED_MODULE_4__.useShadow) { + var node = this; + while (node) { + if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.host) { + this.__rootNodes.push(node); + } + node = node.host || node.assignedSlot || node.parentNode; + } + } + this.__rootNodes.push(document); + } + this.__rootNodes.forEach(function(el) { + el.addEventListener('scroll', this.__onCaptureScroll, { + capture: true, + passive: true, + }); + }, this); + }, + + /** + * @private + */ + __removeScrollListeners: function() { + if (this.__rootNodes) { + this.__rootNodes.forEach(function(el) { + el.removeEventListener('scroll', this.__onCaptureScroll, { + capture: true, + passive: true, + }); + }, this); + } + if (!this.isAttached) { + this.__rootNodes = null; + } + }, + + /** + * @param {string=} scrollAction + * @return {boolean} + * @private + */ + __isValidScrollAction: function(scrollAction) { + return scrollAction === 'lock' || scrollAction === 'refit' || + scrollAction === 'cancel'; + }, + + /** + * @private + */ + __onCaptureScroll: function(event) { + if (this.__isAnimating) { + return; + } + // Check if scroll outside the overlay. + if ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(event).path.indexOf(this) >= 0) { + return; + } + switch (this.scrollAction) { + case 'lock': + // NOTE: scrolling might happen if a scroll event is not cancellable, or + // if user pressed keys that cause scrolling (they're not prevented in + // order not to break a11y features like navigate with arrow keys). + this.__restoreScrollPosition(); + break; + case 'refit': + this.__deraf('refit', this.refit); + break; + case 'cancel': + this.cancel(event); + break; + } + }, + + /** + * Memoizes the scroll position of the outside scrolling element. + * @private + */ + __saveScrollPosition: function() { + if (document.scrollingElement) { + this.__scrollTop = document.scrollingElement.scrollTop; + this.__scrollLeft = document.scrollingElement.scrollLeft; + } else { + // Since we don't know if is the body or html, get max. + this.__scrollTop = + Math.max(document.documentElement.scrollTop, document.body.scrollTop); + this.__scrollLeft = Math.max( + document.documentElement.scrollLeft, document.body.scrollLeft); + } + }, + + /** + * Resets the scroll position of the outside scrolling element. + * @private + */ + __restoreScrollPosition: function() { + if (document.scrollingElement) { + document.scrollingElement.scrollTop = this.__scrollTop; + document.scrollingElement.scrollLeft = this.__scrollLeft; + } else { + // Since we don't know if is the body or html, set both. + document.documentElement.scrollTop = document.body.scrollTop = + this.__scrollTop; + document.documentElement.scrollLeft = document.body.scrollLeft = + this.__scrollLeft; + } + }, + +}; + +const composedParent = node => + node.assignedSlot || node.parentNode || node.host; + +const composedContains = (ancestor, descendant) => { + for (let element = descendant; element; element = composedParent(element)) { + if (element === ancestor) { + return true; + } + } + return false; +}; + +/** + Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden + or shown, and displays on top of other content. It includes an optional + backdrop, and can be used to implement a variety of UI controls including + dialogs and drop downs. Multiple overlays may be displayed at once. + + See the [demo source + code](https://github.com/PolymerElements/iron-overlay-behavior/blob/master/demo/simple-overlay.html) + for an example. + + ### Closing and canceling + + An overlay may be hidden by closing or canceling. The difference between close + and cancel is user intent. Closing generally implies that the user + acknowledged the content on the overlay. By default, it will cancel whenever + the user taps outside it or presses the escape key. This behavior is + configurable with the `no-cancel-on-esc-key` and the + `no-cancel-on-outside-click` properties. `close()` should be called explicitly + by the implementer when the user interacts with a control in the overlay + element. When the dialog is canceled, the overlay fires an + 'iron-overlay-canceled' event. Call `preventDefault` on this event to prevent + the overlay from closing. + + ### Positioning + + By default the element is sized and positioned to fit and centered inside the + window. You can position and size it manually using CSS. See + `Polymer.IronFitBehavior`. + + ### Backdrop + + Set the `with-backdrop` attribute to display a backdrop behind the overlay. + The backdrop is appended to `` and is of type ``. + See its doc page for styling options. + + In addition, `with-backdrop` will wrap the focus within the content in the + light DOM. Override the [`_focusableNodes` + getter](#Polymer.IronOverlayBehavior:property-_focusableNodes) to achieve a + different behavior. + + ### Limitations + + The element is styled to appear on top of other content by setting its + `z-index` property. You must ensure no element has a stacking context with a + higher `z-index` than its parent stacking context. You should place this + element as a child of `` whenever possible. + + @demo demo/index.html + @polymerBehavior + */ +const IronOverlayBehavior = + [_polymer_iron_fit_behavior_iron_fit_behavior_js__WEBPACK_IMPORTED_MODULE_1__.IronFitBehavior, _polymer_iron_resizable_behavior_iron_resizable_behavior_js__WEBPACK_IMPORTED_MODULE_2__.IronResizableBehavior, IronOverlayBehaviorImpl]; + +/** + * Fired after the overlay opens. + * @event iron-overlay-opened + */ + +/** + * Fired when the overlay is canceled, but before it is closed. + * @event iron-overlay-canceled + * @param {Event} event The closing of the overlay can be prevented + * by calling `event.preventDefault()`. The `event.detail` is the original event + * that originated the canceling (e.g. ESC keyboard event or click event outside + * the overlay). + */ + +/** + * Fired after the overlay closes. + * @event iron-overlay-closed + * @param {Event} event The `event.detail` is the `closingReason` property + * (contains `canceled`, whether the overlay was canceled). + */ + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-manager.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@polymer/iron-overlay-behavior/iron-overlay-manager.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronOverlayManager: () => (/* binding */ IronOverlayManager), +/* harmony export */ IronOverlayManagerClass: () => (/* binding */ IronOverlayManagerClass) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _iron_overlay_backdrop_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iron-overlay-backdrop.js */ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-backdrop.js"); +/* harmony import */ var _polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js */ "./node_modules/@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_gestures_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/utils/gestures.js */ "./node_modules/@polymer/polymer/lib/utils/gestures.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** + * @package + */ +class IronOverlayManagerClass { + constructor() { + /** + * Used to keep track of the opened overlays. + * @private {!Array} + */ + this._overlays = []; + + /** + * iframes have a default z-index of 100, + * so this default should be at least that. + * @private {number} + */ + this._minimumZ = 101; + + /** + * Memoized backdrop element. + * @private {Element|null} + */ + this._backdropElement = null; + + // Enable document-wide tap recognizer. + // NOTE: Use useCapture=true to avoid accidentally prevention of the closing + // of an overlay via event.stopPropagation(). The only way to prevent + // closing of an overlay should be through its APIs. + // NOTE: enable tap on to workaround Polymer/polymer#4459 + // Pass no-op function because MSEdge 15 doesn't handle null as 2nd argument + // https://github.com/Microsoft/ChakraCore/issues/3863 + _polymer_polymer_lib_utils_gestures_js__WEBPACK_IMPORTED_MODULE_4__.addListener(document.documentElement, 'tap', function() {}); + document.addEventListener('tap', this._onCaptureClick.bind(this), true); + document.addEventListener('focus', this._onCaptureFocus.bind(this), true); + document.addEventListener( + 'keydown', this._onCaptureKeyDown.bind(this), true); + } + + /** + * The shared backdrop element. + * @return {!Element} backdropElement + */ + get backdropElement() { + if (!this._backdropElement) { + this._backdropElement = document.createElement('iron-overlay-backdrop'); + } + return this._backdropElement; + } + + /** + * The deepest active element. + * @return {!Element} activeElement the active element + */ + get deepActiveElement() { + var active = document.activeElement; + // document.activeElement can be null + // https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement + // In IE 11, it can also be an object when operating in iframes. + // In these cases, default it to document.body. + if (!active || active instanceof Element === false) { + active = document.body; + } + while (active.root && (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(active.root).activeElement) { + active = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(active.root).activeElement; + } + return active; + } + + /** + * Brings the overlay at the specified index to the front. + * @param {number} i + * @private + */ + _bringOverlayAtIndexToFront(i) { + var overlay = this._overlays[i]; + if (!overlay) { + return; + } + var lastI = this._overlays.length - 1; + var currentOverlay = this._overlays[lastI]; + // Ensure always-on-top overlay stays on top. + if (currentOverlay && + this._shouldBeBehindOverlay(overlay, currentOverlay)) { + lastI--; + } + // If already the top element, return. + if (i >= lastI) { + return; + } + // Update z-index to be on top. + var minimumZ = Math.max(this.currentOverlayZ(), this._minimumZ); + if (this._getZ(overlay) <= minimumZ) { + this._applyOverlayZ(overlay, minimumZ); + } + + // Shift other overlays behind the new on top. + while (i < lastI) { + this._overlays[i] = this._overlays[i + 1]; + i++; + } + this._overlays[lastI] = overlay; + } + + /** + * Adds the overlay and updates its z-index if it's opened, or removes it if + * it's closed. Also updates the backdrop z-index. + * @param {!Element} overlay + */ + addOrRemoveOverlay(overlay) { + if (overlay.opened) { + this.addOverlay(overlay); + } else { + this.removeOverlay(overlay); + } + } + + /** + * Tracks overlays for z-index and focus management. + * Ensures the last added overlay with always-on-top remains on top. + * @param {!Element} overlay + */ + addOverlay(overlay) { + var i = this._overlays.indexOf(overlay); + if (i >= 0) { + this._bringOverlayAtIndexToFront(i); + this.trackBackdrop(); + return; + } + var insertionIndex = this._overlays.length; + var currentOverlay = this._overlays[insertionIndex - 1]; + var minimumZ = Math.max(this._getZ(currentOverlay), this._minimumZ); + var newZ = this._getZ(overlay); + + // Ensure always-on-top overlay stays on top. + if (currentOverlay && + this._shouldBeBehindOverlay(overlay, currentOverlay)) { + // This bumps the z-index of +2. + this._applyOverlayZ(currentOverlay, minimumZ); + insertionIndex--; + // Update minimumZ to match previous overlay's z-index. + var previousOverlay = this._overlays[insertionIndex - 1]; + minimumZ = Math.max(this._getZ(previousOverlay), this._minimumZ); + } + + // Update z-index and insert overlay. + if (newZ <= minimumZ) { + this._applyOverlayZ(overlay, minimumZ); + } + this._overlays.splice(insertionIndex, 0, overlay); + + this.trackBackdrop(); + } + + /** + * @param {!Element} overlay + */ + removeOverlay(overlay) { + var i = this._overlays.indexOf(overlay); + if (i === -1) { + return; + } + this._overlays.splice(i, 1); + + this.trackBackdrop(); + } + + /** + * Returns the current overlay. + * @return {!Element|undefined} + */ + currentOverlay() { + var i = this._overlays.length - 1; + return this._overlays[i]; + } + + /** + * Returns the current overlay z-index. + * @return {number} + */ + currentOverlayZ() { + return this._getZ(this.currentOverlay()); + } + + /** + * Ensures that the minimum z-index of new overlays is at least `minimumZ`. + * This does not effect the z-index of any existing overlays. + * @param {number} minimumZ + */ + ensureMinimumZ(minimumZ) { + this._minimumZ = Math.max(this._minimumZ, minimumZ); + } + + focusOverlay() { + var current = /** @type {?} */ (this.currentOverlay()); + if (current) { + current._applyFocus(); + } + } + + /** + * Updates the backdrop z-index. + */ + trackBackdrop() { + var overlay = this._overlayWithBackdrop(); + // Avoid creating the backdrop if there is no overlay with backdrop. + if (!overlay && !this._backdropElement) { + return; + } + this.backdropElement.style.zIndex = this._getZ(overlay) - 1; + this.backdropElement.opened = !!overlay; + // Property observers are not fired until element is attached + // in Polymer 2.x, so we ensure element is attached if needed. + // https://github.com/Polymer/polymer/issues/4526 + this.backdropElement.prepare(); + } + + /** + * @return {!Array} + */ + getBackdrops() { + var backdrops = []; + for (var i = 0; i < this._overlays.length; i++) { + if (this._overlays[i].withBackdrop) { + backdrops.push(this._overlays[i]); + } + } + return backdrops; + } + + /** + * Returns the z-index for the backdrop. + * @return {number} + */ + backdropZ() { + return this._getZ(this._overlayWithBackdrop()) - 1; + } + + /** + * Returns the top opened overlay that has a backdrop. + * @return {!Element|undefined} + * @private + */ + _overlayWithBackdrop() { + for (var i = this._overlays.length - 1; i >= 0; i--) { + if (this._overlays[i].withBackdrop) { + return this._overlays[i]; + } + } + } + + /** + * Calculates the minimum z-index for the overlay. + * @param {Element=} overlay + * @private + */ + _getZ(overlay) { + var z = this._minimumZ; + if (overlay) { + var z1 = Number( + overlay.style.zIndex || window.getComputedStyle(overlay).zIndex); + // Check if is a number + // Number.isNaN not supported in IE 10+ + if (z1 === z1) { + z = z1; + } + } + return z; + } + + /** + * @param {!Element} element + * @param {number|string} z + * @private + */ + _setZ(element, z) { + element.style.zIndex = z; + } + + /** + * @param {!Element} overlay + * @param {number} aboveZ + * @private + */ + _applyOverlayZ(overlay, aboveZ) { + this._setZ(overlay, aboveZ + 2); + } + + /** + * Returns the deepest overlay in the path. + * @param {!Array=} path + * @return {!Element|undefined} + * @suppress {missingProperties} + * @private + */ + _overlayInPath(path) { + path = path || []; + for (var i = 0; i < path.length; i++) { + if (path[i]._manager === this) { + return path[i]; + } + } + } + + /** + * Ensures the click event is delegated to the right overlay. + * @param {!Event} event + * @private + */ + _onCaptureClick(event) { + var i = this._overlays.length - 1; + if (i === -1) + return; + var path = /** @type {!Array} */ ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(event).path); + var overlay; + // Check if clicked outside of overlay. + while ((overlay = /** @type {?} */ (this._overlays[i])) && + this._overlayInPath(path) !== overlay) { + overlay._onCaptureClick(event); + if (overlay.allowClickThrough) { + i--; + } else { + break; + } + } + } + + /** + * Ensures the focus event is delegated to the right overlay. + * @param {!Event} event + * @private + */ + _onCaptureFocus(event) { + var overlay = /** @type {?} */ (this.currentOverlay()); + if (overlay) { + overlay._onCaptureFocus(event); + } + } + + /** + * Ensures TAB and ESC keyboard events are delegated to the right overlay. + * @param {!Event} event + * @private + */ + _onCaptureKeyDown(event) { + var overlay = /** @type {?} */ (this.currentOverlay()); + if (overlay) { + if (_polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_2__.IronA11yKeysBehavior.keyboardEventMatchesKeys(event, 'esc')) { + overlay._onCaptureEsc(event); + } else if (_polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_2__.IronA11yKeysBehavior.keyboardEventMatchesKeys(event, 'tab')) { + overlay._onCaptureTab(event); + } + } + } + + /** + * Returns if the overlay1 should be behind overlay2. + * @param {!Element} overlay1 + * @param {!Element} overlay2 + * @return {boolean} + * @suppress {missingProperties} + * @private + */ + _shouldBeBehindOverlay(overlay1, overlay2) { + return !overlay1.alwaysOnTop && overlay2.alwaysOnTop; + } +}; + +const IronOverlayManager = new IronOverlayManagerClass(); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-overlay-behavior/iron-scroll-manager.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@polymer/iron-overlay-behavior/iron-scroll-manager.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ _boundScrollHandler: () => (/* binding */ _boundScrollHandler), +/* harmony export */ _composedTreeContains: () => (/* binding */ _composedTreeContains), +/* harmony export */ _getScrollInfo: () => (/* binding */ _getScrollInfo), +/* harmony export */ _getScrollableNodes: () => (/* binding */ _getScrollableNodes), +/* harmony export */ _getScrollingNode: () => (/* binding */ _getScrollingNode), +/* harmony export */ _hasCachedLockedElement: () => (/* binding */ _hasCachedLockedElement), +/* harmony export */ _hasCachedUnlockedElement: () => (/* binding */ _hasCachedUnlockedElement), +/* harmony export */ _lockScrollInteractions: () => (/* binding */ _lockScrollInteractions), +/* harmony export */ _lockedElementCache: () => (/* binding */ _lockedElementCache), +/* harmony export */ _lockingElements: () => (/* binding */ _lockingElements), +/* harmony export */ _scrollInteractionHandler: () => (/* binding */ _scrollInteractionHandler), +/* harmony export */ _shouldPreventScrolling: () => (/* binding */ _shouldPreventScrolling), +/* harmony export */ _unlockScrollInteractions: () => (/* binding */ _unlockScrollInteractions), +/* harmony export */ _unlockedElementCache: () => (/* binding */ _unlockedElementCache), +/* harmony export */ currentLockingElement: () => (/* binding */ currentLockingElement), +/* harmony export */ elementIsScrollLocked: () => (/* binding */ elementIsScrollLocked), +/* harmony export */ pushScrollLock: () => (/* binding */ pushScrollLock), +/* harmony export */ removeScrollLock: () => (/* binding */ removeScrollLock) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2017 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + +/** + * Used to calculate the scroll direction during touch events. + * @type {!Object} + */ +var lastTouchPosition = {pageX: 0, pageY: 0}; +/** + * Used to avoid computing event.path and filter scrollable nodes (better perf). + * @type {?EventTarget} + */ +var lastRootTarget = null; +/** + * @type {!Array} + */ +var lastScrollableNodes = []; +/** + * @type {!Array} + */ +var scrollEvents = [ + // Modern `wheel` event for mouse wheel scrolling: + 'wheel', + // Older, non-standard `mousewheel` event for some FF: + 'mousewheel', + // IE: + 'DOMMouseScroll', + // Touch enabled devices + 'touchstart', + 'touchmove' +]; +// must be defined for modulizer +var _boundScrollHandler; + +/** + * The current element that defines the DOM boundaries of the + * scroll lock. This is always the most recently locking element. + * + * @type {!Node|undefined} + */ +var currentLockingElement; + + + +/** + * Returns true if the provided element is "scroll locked", which is to + * say that it cannot be scrolled via pointer or keyboard interactions. + * + * @param {!HTMLElement} element An HTML element instance which may or may + * not be scroll locked. + */ +function elementIsScrollLocked(element) { + var lockingElement = currentLockingElement; + + if (lockingElement === undefined) { + return false; + } + + var scrollLocked; + + if (_hasCachedLockedElement(element)) { + return true; + } + + if (_hasCachedUnlockedElement(element)) { + return false; + } + + scrollLocked = !!lockingElement && lockingElement !== element && + !_composedTreeContains(lockingElement, element); + + if (scrollLocked) { + _lockedElementCache.push(element); + } else { + _unlockedElementCache.push(element); + } + + return scrollLocked; +} + +/** + * Push an element onto the current scroll lock stack. The most recently + * pushed element and its children will be considered scrollable. All + * other elements will not be scrollable. + * + * Scroll locking is implemented as a stack so that cases such as + * dropdowns within dropdowns are handled well. + * + * @param {!HTMLElement} element The element that should lock scroll. + */ +function pushScrollLock(element) { + // Prevent pushing the same element twice + if (_lockingElements.indexOf(element) >= 0) { + return; + } + + if (_lockingElements.length === 0) { + _lockScrollInteractions(); + } + + _lockingElements.push(element); + currentLockingElement = _lockingElements[_lockingElements.length - 1]; + + _lockedElementCache = []; + _unlockedElementCache = []; +} + +/** + * Remove an element from the scroll lock stack. The element being + * removed does not need to be the most recently pushed element. However, + * the scroll lock constraints only change when the most recently pushed + * element is removed. + * + * @param {!HTMLElement} element The element to remove from the scroll + * lock stack. + */ +function removeScrollLock(element) { + var index = _lockingElements.indexOf(element); + + if (index === -1) { + return; + } + + _lockingElements.splice(index, 1); + currentLockingElement = _lockingElements[_lockingElements.length - 1]; + + _lockedElementCache = []; + _unlockedElementCache = []; + + if (_lockingElements.length === 0) { + _unlockScrollInteractions(); + } +} + +const _lockingElements = []; +let _lockedElementCache = null; +let _unlockedElementCache = null; + +function _hasCachedLockedElement(element) { + return _lockedElementCache.indexOf(element) > -1; +} + +function _hasCachedUnlockedElement(element) { + return _unlockedElementCache.indexOf(element) > -1; +} + +function _composedTreeContains(element, child) { + // NOTE(cdata): This method iterates over content elements and their + // corresponding distributed nodes to implement a contains-like method + // that pierces through the composed tree of the ShadowDOM. Results of + // this operation are cached (elsewhere) on a per-scroll-lock basis, to + // guard against potentially expensive lookups happening repeatedly as + // a user scrolls / touchmoves. + var contentElements; + var distributedNodes; + var contentIndex; + var nodeIndex; + + if (element.contains(child)) { + return true; + } + + contentElements = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(element).querySelectorAll('content,slot'); + + for (contentIndex = 0; contentIndex < contentElements.length; + ++contentIndex) { + distributedNodes = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(contentElements[contentIndex]).getDistributedNodes(); + + for (nodeIndex = 0; nodeIndex < distributedNodes.length; ++nodeIndex) { + // Polymer 2.x returns slot.assignedNodes which can contain text nodes. + if (distributedNodes[nodeIndex].nodeType !== Node.ELEMENT_NODE) + continue; + + if (_composedTreeContains(distributedNodes[nodeIndex], child)) { + return true; + } + } + } + + return false; +} + +function _scrollInteractionHandler(event) { + // Avoid canceling an event with cancelable=false, e.g. scrolling is in + // progress and cannot be interrupted. + if (event.cancelable && _shouldPreventScrolling(event)) { + event.preventDefault(); + } + // If event has targetTouches (touch event), update last touch position. + if (event.targetTouches) { + var touch = event.targetTouches[0]; + lastTouchPosition.pageX = touch.pageX; + lastTouchPosition.pageY = touch.pageY; + } +} + +/** + * @package + */ + + +function _lockScrollInteractions() { + _boundScrollHandler = + _boundScrollHandler || _scrollInteractionHandler.bind(undefined); + for (var i = 0, l = scrollEvents.length; i < l; i++) { + // NOTE: browsers that don't support objects as third arg will + // interpret it as boolean, hence useCapture = true in this case. + document.addEventListener( + scrollEvents[i], _boundScrollHandler, {capture: true, passive: false}); + } +} + +function _unlockScrollInteractions() { + for (var i = 0, l = scrollEvents.length; i < l; i++) { + // NOTE: browsers that don't support objects as third arg will + // interpret it as boolean, hence useCapture = true in this case. + document.removeEventListener( + scrollEvents[i], _boundScrollHandler, {capture: true, passive: false}); + } +} + +/** + * Returns true if the event causes scroll outside the current locking + * element, e.g. pointer/keyboard interactions, or scroll "leaking" + * outside the locking element when it is already at its scroll boundaries. + * @param {!Event} event + * @return {boolean} + * @package + */ +function _shouldPreventScrolling(event) { + // Update if root target changed. For touch events, ensure we don't + // update during touchmove. + var target = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(event).rootTarget; + if (event.type !== 'touchmove' && lastRootTarget !== target) { + lastRootTarget = target; + lastScrollableNodes = _getScrollableNodes((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(event).path); + } + + // Prevent event if no scrollable nodes. + if (!lastScrollableNodes.length) { + return true; + } + // Don't prevent touchstart event inside the locking element when it has + // scrollable nodes. + if (event.type === 'touchstart') { + return false; + } + // Get deltaX/Y. + var info = _getScrollInfo(event); + // Prevent if there is no child that can scroll. + return !_getScrollingNode(lastScrollableNodes, info.deltaX, info.deltaY); +} + +/** + * Returns an array of scrollable nodes up to the current locking element, + * which is included too if scrollable. + * @param {!Array} nodes + * @return {!Array} scrollables + * @package + */ +function _getScrollableNodes(nodes) { + var scrollables = []; + var lockingIndex = + nodes.indexOf(/** @type {!Node} */ (currentLockingElement)); + // Loop from root target to locking element (included). + for (var i = 0; i <= lockingIndex; i++) { + // Skip non-Element nodes. + if (nodes[i].nodeType !== Node.ELEMENT_NODE) { + continue; + } + var node = /** @type {!Element} */ (nodes[i]); + // Check inline style before checking computed style. + var style = node.style; + if (style.overflow !== 'scroll' && style.overflow !== 'auto') { + style = window.getComputedStyle(node); + } + if (style.overflow === 'scroll' || style.overflow === 'auto') { + scrollables.push(node); + } + } + return scrollables; +} + +/** + * Returns the node that is scrolling. If there is no scrolling, + * returns undefined. + * @param {!Array} nodes + * @param {number} deltaX Scroll delta on the x-axis + * @param {number} deltaY Scroll delta on the y-axis + * @return {!Node|undefined} + * @package + */ +function _getScrollingNode(nodes, deltaX, deltaY) { + // No scroll. + if (!deltaX && !deltaY) { + return; + } + // Check only one axis according to where there is more scroll. + // Prefer vertical to horizontal. + var verticalScroll = Math.abs(deltaY) >= Math.abs(deltaX); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var canScroll = false; + if (verticalScroll) { + // delta < 0 is scroll up, delta > 0 is scroll down. + canScroll = deltaY < 0 ? + node.scrollTop > 0 : + node.scrollTop < node.scrollHeight - node.clientHeight; + } else { + // delta < 0 is scroll left, delta > 0 is scroll right. + canScroll = deltaX < 0 ? + node.scrollLeft > 0 : + node.scrollLeft < node.scrollWidth - node.clientWidth; + } + if (canScroll) { + return node; + } + } +} + +/** + * Returns scroll `deltaX` and `deltaY`. + * @param {!Event} event The scroll event + * @return {{deltaX: number, deltaY: number}} Object containing the + * x-axis scroll delta (positive: scroll right, negative: scroll left, + * 0: no scroll), and the y-axis scroll delta (positive: scroll down, + * negative: scroll up, 0: no scroll). + * @package + */ +function _getScrollInfo(event) { + var info = {deltaX: event.deltaX, deltaY: event.deltaY}; + // Already available. + if ('deltaX' in event) { + // do nothing, values are already good. + } + // Safari has scroll info in `wheelDeltaX/Y`. + else if ('wheelDeltaX' in event && 'wheelDeltaY' in event) { + info.deltaX = -event.wheelDeltaX; + info.deltaY = -event.wheelDeltaY; + } + // IE10 has only vertical scroll info in `wheelDelta`. + else if ('wheelDelta' in event) { + info.deltaX = 0; + info.deltaY = -event.wheelDelta; + } + // Firefox has scroll info in `detail` and `axis`. + else if ('axis' in event) { + info.deltaX = event.axis === 1 ? event.detail : 0; + info.deltaY = event.axis === 2 ? event.detail : 0; + } + // On mobile devices, calculate scroll direction. + else if (event.targetTouches) { + var touch = event.targetTouches[0]; + // Touch moves from right to left => scrolling goes right. + info.deltaX = lastTouchPosition.pageX - touch.pageX; + // Touch moves from down to up => scrolling goes down. + info.deltaY = lastTouchPosition.pageY - touch.pageY; + } + return info; +} + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-pages/iron-pages.js": +/*!********************************************************!*\ + !*** ./node_modules/@polymer/iron-pages/iron-pages.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_resizable_behavior_iron_resizable_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-resizable-behavior/iron-resizable-behavior.js */ "./node_modules/@polymer/iron-resizable-behavior/iron-resizable-behavior.js"); +/* harmony import */ var _polymer_iron_selector_iron_selectable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-selector/iron-selectable.js */ "./node_modules/@polymer/iron-selector/iron-selectable.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** +`iron-pages` is used to select one of its children to show. One use is to cycle +through a list of children "pages". + +Example: + + +
One
+
Two
+
Three
+
+ + + +@group Iron Elements +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_4__.html)` + + + +`, + + is: 'iron-pages', + behaviors: [_polymer_iron_resizable_behavior_iron_resizable_behavior_js__WEBPACK_IMPORTED_MODULE_1__.IronResizableBehavior, _polymer_iron_selector_iron_selectable_js__WEBPACK_IMPORTED_MODULE_2__.IronSelectableBehavior], + + properties: { + + // as the selected page is the only one visible, activateEvent + // is both non-sensical and problematic; e.g. in cases where a user + // handler attempts to change the page and the activateEvent + // handler immediately changes it back + activateEvent: {type: String, value: null} + + }, + + observers: ['_selectedPageChanged(selected)'], + + _selectedPageChanged: function(selected, old) { + this.async(this.notifyResize); + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-resizable-behavior/iron-resizable-behavior.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@polymer/iron-resizable-behavior/iron-resizable-behavior.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronResizableBehavior: () => (/* binding */ IronResizableBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_settings_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/utils/settings.js */ "./node_modules/@polymer/polymer/lib/utils/settings.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + +// Contains all connected resizables that do not have a parent. +var ORPHANS = new Set(); + +/** + * `IronResizableBehavior` is a behavior that can be used in Polymer elements to + * coordinate the flow of resize events between "resizers" (elements that + *control the size or hidden state of their children) and "resizables" (elements + *that need to be notified when they are resized or un-hidden by their parents + *in order to take action on their new measurements). + * + * Elements that perform measurement should add the `IronResizableBehavior` + *behavior to their element definition and listen for the `iron-resize` event on + *themselves. This event will be fired when they become showing after having + *been hidden, when they are resized explicitly by another resizable, or when + *the window has been resized. + * + * Note, the `iron-resize` event is non-bubbling. + * + * @polymerBehavior + * @demo demo/index.html + **/ +const IronResizableBehavior = { + properties: { + /** + * The closest ancestor element that implements `IronResizableBehavior`. + */ + _parentResizable: { + type: Object, + observer: '_parentResizableChanged', + }, + + /** + * True if this element is currently notifying its descendant elements of + * resize. + */ + _notifyingDescendant: { + type: Boolean, + value: false, + } + }, + + listeners: { + 'iron-request-resize-notifications': '_onIronRequestResizeNotifications' + }, + + created: function() { + // We don't really need property effects on these, and also we want them + // to be created before the `_parentResizable` observer fires: + this._interestedResizables = []; + this._boundNotifyResize = this.notifyResize.bind(this); + this._boundOnDescendantIronResize = this._onDescendantIronResize.bind(this); + }, + + attached: function() { + this._requestResizeNotifications(); + }, + + detached: function() { + if (this._parentResizable) { + this._parentResizable.stopResizeNotificationsFor(this); + } else { + ORPHANS.delete(this); + window.removeEventListener('resize', this._boundNotifyResize); + } + + this._parentResizable = null; + }, + + /** + * Can be called to manually notify a resizable and its descendant + * resizables of a resize change. + */ + notifyResize: function() { + if (!this.isAttached) { + return; + } + + this._interestedResizables.forEach(function(resizable) { + if (this.resizerShouldNotify(resizable)) { + this._notifyDescendant(resizable); + } + }, this); + + this._fireResize(); + }, + + /** + * Used to assign the closest resizable ancestor to this resizable + * if the ancestor detects a request for notifications. + */ + assignParentResizable: function(parentResizable) { + if (this._parentResizable) { + this._parentResizable.stopResizeNotificationsFor(this); + } + + this._parentResizable = parentResizable; + + if (parentResizable && + parentResizable._interestedResizables.indexOf(this) === -1) { + parentResizable._interestedResizables.push(this); + parentResizable._subscribeIronResize(this); + } + }, + + /** + * Used to remove a resizable descendant from the list of descendants + * that should be notified of a resize change. + */ + stopResizeNotificationsFor: function(target) { + var index = this._interestedResizables.indexOf(target); + + if (index > -1) { + this._interestedResizables.splice(index, 1); + this._unsubscribeIronResize(target); + } + }, + + /** + * Subscribe this element to listen to iron-resize events on the given target. + * + * Preferred over target.listen because the property renamer does not + * understand to rename when the target is not specifically "this" + * + * @param {!HTMLElement} target Element to listen to for iron-resize events. + */ + _subscribeIronResize: function(target) { + target.addEventListener('iron-resize', this._boundOnDescendantIronResize); + }, + + /** + * Unsubscribe this element from listening to to iron-resize events on the + * given target. + * + * Preferred over target.unlisten because the property renamer does not + * understand to rename when the target is not specifically "this" + * + * @param {!HTMLElement} target Element to listen to for iron-resize events. + */ + _unsubscribeIronResize: function(target) { + target.removeEventListener( + 'iron-resize', this._boundOnDescendantIronResize); + }, + + /** + * This method can be overridden to filter nested elements that should or + * should not be notified by the current element. Return true if an element + * should be notified, or false if it should not be notified. + * + * @param {HTMLElement} element A candidate descendant element that + * implements `IronResizableBehavior`. + * @return {boolean} True if the `element` should be notified of resize. + */ + resizerShouldNotify: function(element) { + return true; + }, + + _onDescendantIronResize: function(event) { + if (this._notifyingDescendant) { + event.stopPropagation(); + return; + } + + // no need to use this during shadow dom because of event retargeting + if (!_polymer_polymer_lib_utils_settings_js__WEBPACK_IMPORTED_MODULE_2__.useShadow) { + this._fireResize(); + } + }, + + _fireResize: function() { + this.fire('iron-resize', null, {node: this, bubbles: false}); + }, + + _onIronRequestResizeNotifications: function(event) { + var target = /** @type {!EventTarget} */ ((0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(event).rootTarget); + if (target === this) { + return; + } + + target.assignParentResizable(this); + this._notifyDescendant(target); + + event.stopPropagation(); + }, + + _parentResizableChanged: function(parentResizable) { + if (parentResizable) { + window.removeEventListener('resize', this._boundNotifyResize); + } + }, + + _notifyDescendant: function(descendant) { + // NOTE(cdata): In IE10, attached is fired on children first, so it's + // important not to notify them if the parent is not attached yet (or + // else they will get redundantly notified when the parent attaches). + if (!this.isAttached) { + return; + } + + this._notifyingDescendant = true; + descendant.notifyResize(); + this._notifyingDescendant = false; + }, + + _requestResizeNotifications: function() { + if (!this.isAttached) { + return; + } + + if (document.readyState === 'loading') { + var _requestResizeNotifications = + this._requestResizeNotifications.bind(this); + document.addEventListener( + 'readystatechange', function readystatechanged() { + document.removeEventListener('readystatechange', readystatechanged); + _requestResizeNotifications(); + }); + } else { + this._findParent(); + + if (!this._parentResizable) { + // If this resizable is an orphan, tell other orphans to try to find + // their parent again, in case it's this resizable. + ORPHANS.forEach(function(orphan) { + if (orphan !== this) { + orphan._findParent(); + } + }, this); + + window.addEventListener('resize', this._boundNotifyResize); + this.notifyResize(); + } else { + // If this resizable has a parent, tell other child resizables of + // that parent to try finding their parent again, in case it's this + // resizable. + this._parentResizable._interestedResizables + .forEach(function(resizable) { + if (resizable !== this) { + resizable._findParent(); + } + }, this); + } + } + }, + + _findParent: function() { + this.assignParentResizable(null); + this.fire( + 'iron-request-resize-notifications', + null, + {node: this, bubbles: true, cancelable: true}); + + if (!this._parentResizable) { + ORPHANS.add(this); + } else { + ORPHANS.delete(this); + } + } +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-scroll-target-behavior/iron-scroll-target-behavior.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@polymer/iron-scroll-target-behavior/iron-scroll-target-behavior.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronScrollTargetBehavior: () => (/* binding */ IronScrollTargetBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/** + * `Polymer.IronScrollTargetBehavior` allows an element to respond to scroll + * events from a designated scroll target. + * + * Elements that consume this behavior can override the `_scrollHandler` + * method to add logic on the scroll event. + * + * @demo demo/scrolling-region.html Scrolling Region + * @demo demo/document.html Document Element + * @polymerBehavior + */ +const IronScrollTargetBehavior = { + + properties: { + + /** + * Specifies the element that will handle the scroll event + * on the behalf of the current element. This is typically a reference to an + *element, but there are a few more posibilities: + * + * ### Elements id + * + *```html + *
+ * + * + * + *
+ *``` + * In this case, the `scrollTarget` will point to the outer div element. + * + * ### Document scrolling + * + * For document scrolling, you can use the reserved word `document`: + * + *```html + * + * + * + *``` + * + * ### Elements reference + * + *```js + * appHeader.scrollTarget = document.querySelector('#scrollable-element'); + *``` + * + * @type {HTMLElement} + * @default document + */ + scrollTarget: { + type: HTMLElement, + value: function() { + return this._defaultScrollTarget; + } + } + }, + + observers: ['_scrollTargetChanged(scrollTarget, isAttached)'], + + /** + * True if the event listener should be installed. + */ + _shouldHaveListener: true, + + _scrollTargetChanged: function(scrollTarget, isAttached) { + var eventTarget; + + if (this._oldScrollTarget) { + this._toggleScrollListener(false, this._oldScrollTarget); + this._oldScrollTarget = null; + } + if (!isAttached) { + return; + } + // Support element id references + if (scrollTarget === 'document') { + this.scrollTarget = this._doc; + + } else if (typeof scrollTarget === 'string') { + var domHost = this.domHost; + + this.scrollTarget = domHost && domHost.$ ? + domHost.$[scrollTarget] : + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(this.ownerDocument).querySelector('#' + scrollTarget); + + } else if (this._isValidScrollTarget()) { + this._oldScrollTarget = scrollTarget; + this._toggleScrollListener(this._shouldHaveListener, scrollTarget); + } + }, + + /** + * Runs on every scroll event. Consumer of this behavior may override this + * method. + * + * @protected + */ + _scrollHandler: function scrollHandler() {}, + + /** + * The default scroll target. Consumers of this behavior may want to customize + * the default scroll target. + * + * @type {Element} + */ + get _defaultScrollTarget() { + return this._doc; + }, + + /** + * Shortcut for the document element + * + * @type {Element} + */ + get _doc() { + return this.ownerDocument.documentElement; + }, + + /** + * Gets the number of pixels that the content of an element is scrolled + * upward. + * + * @type {number} + */ + get _scrollTop() { + if (this._isValidScrollTarget()) { + return this.scrollTarget === this._doc ? window.pageYOffset : + this.scrollTarget.scrollTop; + } + return 0; + }, + + /** + * Gets the number of pixels that the content of an element is scrolled to the + * left. + * + * @type {number} + */ + get _scrollLeft() { + if (this._isValidScrollTarget()) { + return this.scrollTarget === this._doc ? window.pageXOffset : + this.scrollTarget.scrollLeft; + } + return 0; + }, + + /** + * Sets the number of pixels that the content of an element is scrolled + * upward. + * + * @type {number} + */ + set _scrollTop(top) { + if (this.scrollTarget === this._doc) { + window.scrollTo(window.pageXOffset, top); + } else if (this._isValidScrollTarget()) { + this.scrollTarget.scrollTop = top; + } + }, + + /** + * Sets the number of pixels that the content of an element is scrolled to the + * left. + * + * @type {number} + */ + set _scrollLeft(left) { + if (this.scrollTarget === this._doc) { + window.scrollTo(left, window.pageYOffset); + } else if (this._isValidScrollTarget()) { + this.scrollTarget.scrollLeft = left; + } + }, + + /** + * Scrolls the content to a particular place. + * + * @method scroll + * @param {number|!{left: number, top: number}} leftOrOptions The left position or scroll options + * @param {number=} top The top position + * @return {void} + */ + scroll: function(leftOrOptions, top) { + var left; + + if (typeof leftOrOptions === 'object') { + left = leftOrOptions.left; + top = leftOrOptions.top; + } else { + left = leftOrOptions; + } + + left = left || 0; + top = top || 0; + if (this.scrollTarget === this._doc) { + window.scrollTo(left, top); + } else if (this._isValidScrollTarget()) { + this.scrollTarget.scrollLeft = left; + this.scrollTarget.scrollTop = top; + } + }, + + /** + * Gets the width of the scroll target. + * + * @type {number} + */ + get _scrollTargetWidth() { + if (this._isValidScrollTarget()) { + return this.scrollTarget === this._doc ? window.innerWidth : + this.scrollTarget.offsetWidth; + } + return 0; + }, + + /** + * Gets the height of the scroll target. + * + * @type {number} + */ + get _scrollTargetHeight() { + if (this._isValidScrollTarget()) { + return this.scrollTarget === this._doc ? window.innerHeight : + this.scrollTarget.offsetHeight; + } + return 0; + }, + + /** + * Returns true if the scroll target is a valid HTMLElement. + * + * @return {boolean} + */ + _isValidScrollTarget: function() { + return this.scrollTarget instanceof HTMLElement; + }, + + _toggleScrollListener: function(yes, scrollTarget) { + var eventTarget = scrollTarget === this._doc ? window : scrollTarget; + if (yes) { + if (!this._boundScrollHandler) { + this._boundScrollHandler = this._scrollHandler.bind(this); + eventTarget.addEventListener('scroll', this._boundScrollHandler); + } + } else { + if (this._boundScrollHandler) { + eventTarget.removeEventListener('scroll', this._boundScrollHandler); + this._boundScrollHandler = null; + } + } + }, + + /** + * Enables or disables the scroll event listener. + * + * @param {boolean} yes True to add the event, False to remove it. + */ + toggleScrollListener: function(yes) { + this._shouldHaveListener = yes; + this._toggleScrollListener(yes, this.scrollTarget); + } + +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-selector/iron-multi-selectable.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@polymer/iron-selector/iron-multi-selectable.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronMultiSelectableBehavior: () => (/* binding */ IronMultiSelectableBehavior), +/* harmony export */ IronMultiSelectableBehaviorImpl: () => (/* binding */ IronMultiSelectableBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _iron_selectable_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iron-selectable.js */ "./node_modules/@polymer/iron-selector/iron-selectable.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/** + * @polymerBehavior IronMultiSelectableBehavior + */ +const IronMultiSelectableBehaviorImpl = { + properties: { + + /** + * If true, multiple selections are allowed. + */ + multi: {type: Boolean, value: false, observer: 'multiChanged'}, + + /** + * Gets or sets the selected elements. This is used instead of `selected` + * when `multi` is true. + */ + selectedValues: { + type: Array, + notify: true, + value: function() { + return []; + } + }, + + /** + * Returns an array of currently selected items. + */ + selectedItems: { + type: Array, + readOnly: true, + notify: true, + value: function() { + return []; + } + }, + + }, + + observers: ['_updateSelected(selectedValues.splices)'], + + /** + * Selects the given value. If the `multi` property is true, then the selected + * state of the `value` will be toggled; otherwise the `value` will be + * selected. + * + * @method select + * @param {string|number} value the value to select. + */ + select: function(value) { + if (this.multi) { + this._toggleSelected(value); + } else { + this.selected = value; + } + }, + + multiChanged: function(multi) { + this._selection.multi = multi; + this._updateSelected(); + }, + + // UNUSED, FOR API COMPATIBILITY + get _shouldUpdateSelection() { + return this.selected != null || + (this.selectedValues != null && this.selectedValues.length); + }, + + _updateAttrForSelected: function() { + if (!this.multi) { + _iron_selectable_js__WEBPACK_IMPORTED_MODULE_1__.IronSelectableBehavior._updateAttrForSelected.apply(this); + } else if (this.selectedItems && this.selectedItems.length > 0) { + this.selectedValues = + this.selectedItems + .map( + function(selectedItem) { + return this._indexToValue(this.indexOf(selectedItem)); + }, + this) + .filter(function(unfilteredValue) { + return unfilteredValue != null; + }, this); + } + }, + + _updateSelected: function() { + if (this.multi) { + this._selectMulti(this.selectedValues); + } else { + this._selectSelected(this.selected); + } + }, + + _selectMulti: function(values) { + values = values || []; + + var selectedItems = + (this._valuesToItems(values) || []).filter(function(item) { + return item !== null && item !== undefined; + }); + + // clear all but the current selected items + this._selection.clear(selectedItems); + + // select only those not selected yet + for (var i = 0; i < selectedItems.length; i++) { + this._selection.setItemSelected(selectedItems[i], true); + } + + // Check for items, since this array is populated only when attached + if (this.fallbackSelection && !this._selection.get().length) { + var fallback = this._valueToItem(this.fallbackSelection); + if (fallback) { + this.select(this.fallbackSelection); + } + } + }, + + _selectionChange: function() { + var s = this._selection.get(); + if (this.multi) { + this._setSelectedItems(s); + this._setSelectedItem(s.length ? s[0] : null); + } else { + if (s !== null && s !== undefined) { + this._setSelectedItems([s]); + this._setSelectedItem(s); + } else { + this._setSelectedItems([]); + this._setSelectedItem(null); + } + } + }, + + _toggleSelected: function(value) { + var i = this.selectedValues.indexOf(value); + var unselected = i < 0; + if (unselected) { + this.push('selectedValues', value); + } else { + this.splice('selectedValues', i, 1); + } + }, + + _valuesToItems: function(values) { + return (values == null) ? null : values.map(function(value) { + return this._valueToItem(value); + }, this); + } +}; + +/** @polymerBehavior */ +const IronMultiSelectableBehavior = + [_iron_selectable_js__WEBPACK_IMPORTED_MODULE_1__.IronSelectableBehavior, IronMultiSelectableBehaviorImpl]; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-selector/iron-selectable.js": +/*!****************************************************************!*\ + !*** ./node_modules/@polymer/iron-selector/iron-selectable.js ***! + \****************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronSelectableBehavior: () => (/* binding */ IronSelectableBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_case_map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/utils/case-map.js */ "./node_modules/@polymer/polymer/lib/utils/case-map.js"); +/* harmony import */ var _iron_selection_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./iron-selection.js */ "./node_modules/@polymer/iron-selector/iron-selection.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** + * @polymerBehavior + */ +const IronSelectableBehavior = { + + /** + * Fired when iron-selector is activated (selected or deselected). + * It is fired before the selected items are changed. + * Cancel the event to abort selection. + * + * @event iron-activate + */ + + /** + * Fired when an item is selected + * + * @event iron-select + */ + + /** + * Fired when an item is deselected + * + * @event iron-deselect + */ + + /** + * Fired when the list of selectable items changes (e.g., items are + * added or removed). The detail of the event is a mutation record that + * describes what changed. + * + * @event iron-items-changed + */ + + properties: { + + /** + * If you want to use an attribute value or property of an element for + * `selected` instead of the index, set this to the name of the attribute + * or property. Hyphenated values are converted to camel case when used to + * look up the property of a selectable element. Camel cased values are + * *not* converted to hyphenated values for attribute lookup. It's + * recommended that you provide the hyphenated form of the name so that + * selection works in both cases. (Use `attr-or-property-name` instead of + * `attrOrPropertyName`.) + */ + attrForSelected: {type: String, value: null}, + + /** + * Gets or sets the selected element. The default is to use the index of the + * item. + * @type {string|number} + */ + selected: {type: String, notify: true}, + + /** + * Returns the currently selected item. + * + * @type {?Object} + */ + selectedItem: {type: Object, readOnly: true, notify: true}, + + /** + * The event that fires from items when they are selected. Selectable + * will listen for this event from items and update the selection state. + * Set to empty string to listen to no events. + */ + activateEvent: + {type: String, value: 'tap', observer: '_activateEventChanged'}, + + /** + * This is a CSS selector string. If this is set, only items that match the + * CSS selector are selectable. + */ + selectable: String, + + /** + * The class to set on elements when selected. + */ + selectedClass: {type: String, value: 'iron-selected'}, + + /** + * The attribute to set on elements when selected. + */ + selectedAttribute: {type: String, value: null}, + + /** + * Default fallback if the selection based on selected with + * `attrForSelected` is not found. + */ + fallbackSelection: {type: String, value: null}, + + /** + * The list of items from which a selection can be made. + */ + items: { + type: Array, + readOnly: true, + notify: true, + value: function() { + return []; + } + }, + + /** + * The set of excluded elements where the key is the `localName` + * of the element that will be ignored from the item list. + * + * @default {template: 1} + */ + _excludedLocalNames: { + type: Object, + value: function() { + return { + 'template': 1, + 'dom-bind': 1, + 'dom-if': 1, + 'dom-repeat': 1, + }; + } + } + }, + + observers: [ + '_updateAttrForSelected(attrForSelected)', + '_updateSelected(selected)', + '_checkFallback(fallbackSelection)' + ], + + created: function() { + this._bindFilterItem = this._filterItem.bind(this); + this._selection = new _iron_selection_js__WEBPACK_IMPORTED_MODULE_3__.IronSelection(this._applySelection.bind(this)); + }, + + attached: function() { + this._observer = this._observeItems(this); + this._addListener(this.activateEvent); + }, + + detached: function() { + if (this._observer) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(this).unobserveNodes(this._observer); + } + this._removeListener(this.activateEvent); + }, + + /** + * Returns the index of the given item. + * + * @method indexOf + * @param {Object} item + * @returns Returns the index of the item + */ + indexOf: function(item) { + return this.items ? this.items.indexOf(item) : -1; + }, + + /** + * Selects the given value. + * + * @method select + * @param {string|number} value the value to select. + */ + select: function(value) { + this.selected = value; + }, + + /** + * Selects the previous item. + * + * @method selectPrevious + */ + selectPrevious: function() { + var length = this.items.length; + var index = length - 1; + if (this.selected !== undefined) { + index = (Number(this._valueToIndex(this.selected)) - 1 + length) % length; + } + this.selected = this._indexToValue(index); + }, + + /** + * Selects the next item. + * + * @method selectNext + */ + selectNext: function() { + var index = 0; + if (this.selected !== undefined) { + index = + (Number(this._valueToIndex(this.selected)) + 1) % this.items.length; + } + this.selected = this._indexToValue(index); + }, + + /** + * Selects the item at the given index. + * + * @method selectIndex + */ + selectIndex: function(index) { + this.select(this._indexToValue(index)); + }, + + /** + * Force a synchronous update of the `items` property. + * + * NOTE: Consider listening for the `iron-items-changed` event to respond to + * updates to the set of selectable items after updates to the DOM list and + * selection state have been made. + * + * WARNING: If you are using this method, you should probably consider an + * alternate approach. Synchronously querying for items is potentially + * slow for many use cases. The `items` property will update asynchronously + * on its own to reflect selectable items in the DOM. + */ + forceSynchronousItemUpdate: function() { + if (this._observer && typeof this._observer.flush === 'function') { + // NOTE(bicknellr): `dom.flush` above is no longer sufficient to trigger + // `observeNodes` callbacks. Polymer 2.x returns an object from + // `observeNodes` with a `flush` that synchronously gives the callback any + // pending MutationRecords (retrieved with `takeRecords`). Any case where + // ShadyDOM flushes were expected to synchronously trigger item updates + // will now require calling `forceSynchronousItemUpdate`. + this._observer.flush(); + } else { + this._updateItems(); + } + }, + + // UNUSED, FOR API COMPATIBILITY + get _shouldUpdateSelection() { + return this.selected != null; + }, + + _checkFallback: function() { + this._updateSelected(); + }, + + _addListener: function(eventName) { + this.listen(this, eventName, '_activateHandler'); + }, + + _removeListener: function(eventName) { + this.unlisten(this, eventName, '_activateHandler'); + }, + + _activateEventChanged: function(eventName, old) { + this._removeListener(old); + this._addListener(eventName); + }, + + _updateItems: function() { + var nodes = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(this).queryDistributedElements(this.selectable || '*'); + nodes = Array.prototype.filter.call(nodes, this._bindFilterItem); + this._setItems(nodes); + }, + + _updateAttrForSelected: function() { + if (this.selectedItem) { + this.selected = this._valueForItem(this.selectedItem); + } + }, + + _updateSelected: function() { + this._selectSelected(this.selected); + }, + + _selectSelected: function(selected) { + if (!this.items) { + return; + } + + var item = this._valueToItem(this.selected); + if (item) { + this._selection.select(item); + } else { + this._selection.clear(); + } + // Check for items, since this array is populated only when attached + // Since Number(0) is falsy, explicitly check for undefined + if (this.fallbackSelection && this.items.length && + (this._selection.get() === undefined)) { + this.selected = this.fallbackSelection; + } + }, + + _filterItem: function(node) { + return !this._excludedLocalNames[node.localName]; + }, + + _valueToItem: function(value) { + return (value == null) ? null : this.items[this._valueToIndex(value)]; + }, + + _valueToIndex: function(value) { + if (this.attrForSelected) { + for (var i = 0, item; item = this.items[i]; i++) { + if (this._valueForItem(item) == value) { + return i; + } + } + } else { + return Number(value); + } + }, + + _indexToValue: function(index) { + if (this.attrForSelected) { + var item = this.items[index]; + if (item) { + return this._valueForItem(item); + } + } else { + return index; + } + }, + + _valueForItem: function(item) { + if (!item) { + return null; + } + if (!this.attrForSelected) { + var i = this.indexOf(item); + return i === -1 ? null : i; + } + var propValue = item[(0,_polymer_polymer_lib_utils_case_map_js__WEBPACK_IMPORTED_MODULE_2__.dashToCamelCase)(this.attrForSelected)]; + return propValue != undefined ? propValue : + item.getAttribute(this.attrForSelected); + }, + + _applySelection: function(item, isSelected) { + if (this.selectedClass) { + this.toggleClass(this.selectedClass, isSelected, item); + } + if (this.selectedAttribute) { + this.toggleAttribute(this.selectedAttribute, isSelected, item); + } + this._selectionChange(); + this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item}); + }, + + _selectionChange: function() { + this._setSelectedItem(this._selection.get()); + }, + + // observe items change under the given node. + _observeItems: function(node) { + return (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_1__.dom)(node).observeNodes(function(mutation) { + this._updateItems(); + this._updateSelected(); + + // Let other interested parties know about the change so that + // we don't have to recreate mutation observers everywhere. + this.fire( + 'iron-items-changed', mutation, {bubbles: false, cancelable: false}); + }); + }, + + _activateHandler: function(e) { + var t = e.target; + var items = this.items; + while (t && t != this) { + var i = items.indexOf(t); + if (i >= 0) { + var value = this._indexToValue(i); + this._itemActivate(value, t); + return; + } + t = t.parentNode; + } + }, + + _itemActivate: function(value, item) { + if (!this.fire('iron-activate', {selected: value, item: item}, { + cancelable: true + }) + .defaultPrevented) { + this.select(value); + } + } + +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-selector/iron-selection.js": +/*!***************************************************************!*\ + !*** ./node_modules/@polymer/iron-selector/iron-selection.js ***! + \***************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronSelection: () => (/* binding */ IronSelection) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + +class IronSelection { + /** + * @param {!Function} selectCallback + * @suppress {missingProvide} + */ + constructor(selectCallback) { + this.selection = []; + this.selectCallback = selectCallback; + } + + /** + * Retrieves the selected item(s). + * + * @returns Returns the selected item(s). If the multi property is true, + * `get` will return an array, otherwise it will return + * the selected item or undefined if there is no selection. + */ + get() { + return this.multi ? this.selection.slice() : this.selection[0]; + } + + /** + * Clears all the selection except the ones indicated. + * + * @param {Array} excludes items to be excluded. + */ + clear(excludes) { + this.selection.slice().forEach(function(item) { + if (!excludes || excludes.indexOf(item) < 0) { + this.setItemSelected(item, false); + } + }, this); + } + + /** + * Indicates if a given item is selected. + * + * @param {*} item The item whose selection state should be checked. + * @return {boolean} Returns true if `item` is selected. + */ + isSelected(item) { + return this.selection.indexOf(item) >= 0; + } + + /** + * Sets the selection state for a given item to either selected or deselected. + * + * @param {*} item The item to select. + * @param {boolean} isSelected True for selected, false for deselected. + */ + setItemSelected(item, isSelected) { + if (item != null) { + if (isSelected !== this.isSelected(item)) { + // proceed to update selection only if requested state differs from + // current + if (isSelected) { + this.selection.push(item); + } else { + var i = this.selection.indexOf(item); + if (i >= 0) { + this.selection.splice(i, 1); + } + } + if (this.selectCallback) { + this.selectCallback(item, isSelected); + } + } + } + } + + /** + * Sets the selection state for a given item. If the `multi` property + * is true, then the selected state of `item` will be toggled; otherwise + * the `item` will be selected. + * + * @param {*} item The item to select. + */ + select(item) { + if (this.multi) { + this.toggle(item); + } else if (this.get() !== item) { + this.setItemSelected(this.get(), false); + this.setItemSelected(item, true); + } + } + + /** + * Toggles the selection state for `item`. + * + * @param {*} item The item to toggle. + */ + toggle(item) { + this.setItemSelected(item, !this.isSelected(item)); + } +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/iron-validatable-behavior/iron-validatable-behavior.js": +/*!**************************************************************************************!*\ + !*** ./node_modules/@polymer/iron-validatable-behavior/iron-validatable-behavior.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IronValidatableBehavior: () => (/* binding */ IronValidatableBehavior), +/* harmony export */ IronValidatableBehaviorMeta: () => (/* binding */ IronValidatableBehaviorMeta) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_meta_iron_meta_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-meta/iron-meta.js */ "./node_modules/@polymer/iron-meta/iron-meta.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/** + * Singleton IronMeta instance. + */ +let IronValidatableBehaviorMeta = null; + +/** + * `Use IronValidatableBehavior` to implement an element that validates + * user input. Use the related `IronValidatorBehavior` to add custom + * validation logic to an iron-input. + * + * By default, an `` element validates its fields when the user + * presses the submit button. To validate a form imperatively, call the form's + * `validate()` method, which in turn will call `validate()` on all its + * children. By using `IronValidatableBehavior`, your custom element + * will get a public `validate()`, which will return the validity of the + * element, and a corresponding `invalid` attribute, which can be used for + * styling. + * + * To implement the custom validation logic of your element, you must override + * the protected `_getValidity()` method of this behaviour, rather than + * `validate()`. See + * [this](https://github.com/PolymerElements/iron-form/blob/master/demo/simple-element.html) + * for an example. + * + * ### Accessibility + * + * Changing the `invalid` property, either manually or by calling `validate()` + * will update the `aria-invalid` attribute. + * + * @demo demo/index.html + * @polymerBehavior + */ +const IronValidatableBehavior = { + + properties: { + /** + * Name of the validator to use. + */ + validator: {type: String}, + + /** + * True if the last call to `validate` is invalid. + */ + invalid: { + notify: true, + reflectToAttribute: true, + type: Boolean, + value: false, + observer: '_invalidChanged' + }, + }, + + registered: function() { + IronValidatableBehaviorMeta = new _polymer_iron_meta_iron_meta_js__WEBPACK_IMPORTED_MODULE_1__.IronMeta({type: 'validator'}); + }, + + _invalidChanged: function() { + if (this.invalid) { + this.setAttribute('aria-invalid', 'true'); + } else { + this.removeAttribute('aria-invalid'); + } + }, + + /* Recompute this every time it's needed, because we don't know if the + * underlying IronValidatableBehaviorMeta has changed. */ + get _validator() { + return IronValidatableBehaviorMeta && + IronValidatableBehaviorMeta.byKey(this.validator); + }, + + /** + * @return {boolean} True if the validator `validator` exists. + */ + hasValidator: function() { + return this._validator != null; + }, + + /** + * Returns true if the `value` is valid, and updates `invalid`. If you want + * your element to have custom validation logic, do not override this method; + * override `_getValidity(value)` instead. + + * @param {Object} value Deprecated: The value to be validated. By default, + * it is passed to the validator's `validate()` function, if a validator is + set. + * If this argument is not specified, then the element's `value` property + * is used, if it exists. + * @return {boolean} True if `value` is valid. + */ + validate: function(value) { + // If this is an element that also has a value property, and there was + // no explicit value argument passed, use the element's property instead. + if (value === undefined && this.value !== undefined) + this.invalid = !this._getValidity(this.value); + else + this.invalid = !this._getValidity(value); + return !this.invalid; + }, + + /** + * Returns true if `value` is valid. By default, it is passed + * to the validator's `validate()` function, if a validator is set. You + * should override this method if you want to implement custom validity + * logic for your element. + * + * @param {Object} value The value to be validated. + * @return {boolean} True if `value` is valid. + */ + + _getValidity: function(value) { + if (this.hasValidator()) { + return this._validator.validate(value); + } + return true; + } +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/neon-animation/animations/fade-in-animation.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@polymer/neon-animation/animations/fade-in-animation.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _neon_animation_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../neon-animation-behavior.js */ "./node_modules/@polymer/neon-animation/neon-animation-behavior.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/* +`` animates the opacity of an element from 0 to 1. + +Configuration: +``` +{ + name: 'fade-in-animation', + node: + timing: +} +``` +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + + is: 'fade-in-animation', + + behaviors: [_neon_animation_behavior_js__WEBPACK_IMPORTED_MODULE_2__.NeonAnimationBehavior], + + configure: function(config) { + var node = config.node; + this._effect = new KeyframeEffect( + node, + [{'opacity': '0'}, {'opacity': '1'}], + this.timingFromConfig(config)); + return this._effect; + } + +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/neon-animation/animations/fade-out-animation.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@polymer/neon-animation/animations/fade-out-animation.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _neon_animation_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../neon-animation-behavior.js */ "./node_modules/@polymer/neon-animation/neon-animation-behavior.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/* +`` animates the opacity of an element from 1 to 0. + +Configuration: +``` +{ + name: 'fade-out-animation', + node: + timing: +} +``` +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_1__.Polymer)({ + + is: 'fade-out-animation', + + behaviors: [_neon_animation_behavior_js__WEBPACK_IMPORTED_MODULE_2__.NeonAnimationBehavior], + + configure: function(config) { + var node = config.node; + this._effect = new KeyframeEffect( + node, + [ + {'opacity': '1'}, + {'opacity': '0'}, + ], + this.timingFromConfig(config)); + return this._effect; + } + +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/neon-animation/neon-animatable-behavior.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@polymer/neon-animation/neon-animatable-behavior.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NeonAnimatableBehavior: () => (/* binding */ NeonAnimatableBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + +/** + * `NeonAnimatableBehavior` is implemented by elements containing + * animations for use with elements implementing + * `NeonAnimationRunnerBehavior`. + * @polymerBehavior + */ +const NeonAnimatableBehavior = { + + properties: { + + /** + * Animation configuration. See README for more info. + */ + animationConfig: {type: Object}, + + /** + * Convenience property for setting an 'entry' animation. Do not set + * `animationConfig.entry` manually if using this. The animated node is set + * to `this` if using this property. + */ + entryAnimation: { + observer: '_entryAnimationChanged', + type: String, + }, + + /** + * Convenience property for setting an 'exit' animation. Do not set + * `animationConfig.exit` manually if using this. The animated node is set + * to `this` if using this property. + */ + exitAnimation: { + observer: '_exitAnimationChanged', + type: String, + }, + + }, + + _entryAnimationChanged: function() { + this.animationConfig = this.animationConfig || {}; + this.animationConfig['entry'] = [{name: this.entryAnimation, node: this}]; + }, + + _exitAnimationChanged: function() { + this.animationConfig = this.animationConfig || {}; + this.animationConfig['exit'] = [{name: this.exitAnimation, node: this}]; + }, + + _copyProperties: function(config1, config2) { + // shallowly copy properties from config2 to config1 + for (var property in config2) { + config1[property] = config2[property]; + } + }, + + _cloneConfig: function(config) { + var clone = {isClone: true}; + this._copyProperties(clone, config); + return clone; + }, + + _getAnimationConfigRecursive: function(type, map, allConfigs) { + if (!this.animationConfig) { + return; + } + + if (this.animationConfig.value && + typeof this.animationConfig.value === 'function') { + this._warn(this._logf( + 'playAnimation', + 'Please put \'animationConfig\' inside of your components \'properties\' object instead of outside of it.')); + return; + } + + // type is optional + var thisConfig; + if (type) { + thisConfig = this.animationConfig[type]; + } else { + thisConfig = this.animationConfig; + } + + if (!Array.isArray(thisConfig)) { + thisConfig = [thisConfig]; + } + + // iterate animations and recurse to process configurations from child nodes + if (thisConfig) { + for (var config, index = 0; config = thisConfig[index]; index++) { + if (config.animatable) { + config.animatable._getAnimationConfigRecursive( + config.type || type, map, allConfigs); + } else { + if (config.id) { + var cachedConfig = map[config.id]; + if (cachedConfig) { + // merge configurations with the same id, making a clone lazily + if (!cachedConfig.isClone) { + map[config.id] = this._cloneConfig(cachedConfig); + cachedConfig = map[config.id]; + } + this._copyProperties(cachedConfig, config); + } else { + // put any configs with an id into a map + map[config.id] = config; + } + } else { + allConfigs.push(config); + } + } + } + } + }, + + /** + * An element implementing `NeonAnimationRunnerBehavior` calls this + * method to configure an animation with an optional type. Elements + * implementing `NeonAnimatableBehavior` should define the property + * `animationConfig`, which is either a configuration object or a map of + * animation type to array of configuration objects. + */ + getAnimationConfig: function(type) { + var map = {}; + var allConfigs = []; + this._getAnimationConfigRecursive(type, map, allConfigs); + // append the configurations saved in the map to the array + for (var key in map) { + allConfigs.push(map[key]); + } + return allConfigs; + } + +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/neon-animation/neon-animation-behavior.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@polymer/neon-animation/neon-animation-behavior.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NeonAnimationBehavior: () => (/* binding */ NeonAnimationBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + +/** + * Use `NeonAnimationBehavior` to implement an animation. + * @polymerBehavior + */ +const NeonAnimationBehavior = { + + properties: { + + /** + * Defines the animation timing. + */ + animationTiming: { + type: Object, + value: function() { + return { + duration: 500, easing: 'cubic-bezier(0.4, 0, 0.2, 1)', fill: 'both' + } + } + } + + }, + + /** + * Can be used to determine that elements implement this behavior. + */ + isNeonAnimation: true, + + /** + * Do any animation configuration here. + */ + // configure: function(config) { + // }, + + created: function() { + if (!document.body.animate) { + console.warn( + 'No web animations detected. This element will not' + + ' function without a web animations polyfill.'); + } + }, + + /** + * Returns the animation timing by mixing in properties from `config` to the + * defaults defined by the animation. + */ + timingFromConfig: function(config) { + if (config.timing) { + for (var property in config.timing) { + this.animationTiming[property] = config.timing[property]; + } + } + return this.animationTiming; + }, + + /** + * Sets `transform` and `transformOrigin` properties along with the prefixed + * versions. + */ + setPrefixedProperty: function(node, property, value) { + var map = { + 'transform': ['webkitTransform'], + 'transformOrigin': ['mozTransformOrigin', 'webkitTransformOrigin'] + }; + var prefixes = map[property]; + for (var prefix, index = 0; prefix = prefixes[index]; index++) { + node.style[prefix] = value; + } + node.style[property] = value; + }, + + /** + * Called when the animation finishes. + */ + complete: function(config) {} + +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/neon-animation/neon-animation-runner-behavior.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@polymer/neon-animation/neon-animation-runner-behavior.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NeonAnimationRunnerBehavior: () => (/* binding */ NeonAnimationRunnerBehavior), +/* harmony export */ NeonAnimationRunnerBehaviorImpl: () => (/* binding */ NeonAnimationRunnerBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _neon_animatable_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./neon-animatable-behavior.js */ "./node_modules/@polymer/neon-animation/neon-animatable-behavior.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + +/** + * `NeonAnimationRunnerBehavior` adds a method to run animations. + * + * @polymerBehavior NeonAnimationRunnerBehavior + */ +const NeonAnimationRunnerBehaviorImpl = { + + _configureAnimations: function(configs) { + var results = []; + var resultsToPlay = []; + + if (configs.length > 0) { + for (let config, index = 0; config = configs[index]; index++) { + let neonAnimation = document.createElement(config.name); + // is this element actually a neon animation? + if (neonAnimation.isNeonAnimation) { + let result = null; + // Closure compiler does not work well with a try / catch here. + // .configure needs to be explicitly defined + if (!neonAnimation.configure) { + /** + * @param {Object} config + * @return {AnimationEffectReadOnly} + */ + neonAnimation.configure = function(config) { + return null; + } + } + + result = neonAnimation.configure(config); + resultsToPlay.push({ + result: result, + config: config, + neonAnimation: neonAnimation, + }); + } else { + console.warn(this.is + ':', config.name, 'not found!'); + } + } + } + + for (var i = 0; i < resultsToPlay.length; i++) { + let result = resultsToPlay[i].result; + let config = resultsToPlay[i].config; + let neonAnimation = resultsToPlay[i].neonAnimation; + // configuration or play could fail if polyfills aren't loaded + try { + // Check if we have an Effect rather than an Animation + if (typeof result.cancel != 'function') { + result = document.timeline.play(result); + } + } catch (e) { + result = null; + console.warn('Couldnt play', '(', config.name, ').', e); + } + + if (result) { + results.push({ + neonAnimation: neonAnimation, + config: config, + animation: result, + }); + } + } + + return results; + }, + + _shouldComplete: function(activeEntries) { + var finished = true; + for (var i = 0; i < activeEntries.length; i++) { + if (activeEntries[i].animation.playState != 'finished') { + finished = false; + break; + } + } + return finished; + }, + + _complete: function(activeEntries) { + for (var i = 0; i < activeEntries.length; i++) { + activeEntries[i].neonAnimation.complete(activeEntries[i].config); + } + for (var i = 0; i < activeEntries.length; i++) { + activeEntries[i].animation.cancel(); + } + }, + + /** + * Plays an animation with an optional `type`. + * @param {string=} type + * @param {!Object=} cookie + */ + playAnimation: function(type, cookie) { + var configs = this.getAnimationConfig(type); + if (!configs) { + return; + } + this._active = this._active || {}; + if (this._active[type]) { + this._complete(this._active[type]); + delete this._active[type]; + } + + var activeEntries = this._configureAnimations(configs); + + if (activeEntries.length == 0) { + this.fire('neon-animation-finish', cookie, {bubbles: false}); + return; + } + + this._active[type] = activeEntries; + + for (var i = 0; i < activeEntries.length; i++) { + activeEntries[i].animation.onfinish = function() { + if (this._shouldComplete(activeEntries)) { + this._complete(activeEntries); + delete this._active[type]; + this.fire('neon-animation-finish', cookie, {bubbles: false}); + } + }.bind(this); + } + }, + + /** + * Cancels the currently running animations. + */ + cancelAnimation: function() { + for (var k in this._active) { + var entries = this._active[k] + + for (var j in entries) { + entries[j].animation.cancel(); + } + } + + this._active = {}; + } +}; + +/** @polymerBehavior */ +const NeonAnimationRunnerBehavior = + [_neon_animatable_behavior_js__WEBPACK_IMPORTED_MODULE_1__.NeonAnimatableBehavior, NeonAnimationRunnerBehaviorImpl]; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-behaviors/paper-button-behavior.js": +/*!************************************************************************!*\ + !*** ./node_modules/@polymer/paper-behaviors/paper-button-behavior.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperButtonBehavior: () => (/* binding */ PaperButtonBehavior), +/* harmony export */ PaperButtonBehaviorImpl: () => (/* binding */ PaperButtonBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-button-state.js */ "./node_modules/@polymer/iron-behaviors/iron-button-state.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-control-state.js */ "./node_modules/@polymer/iron-behaviors/iron-control-state.js"); +/* harmony import */ var _paper_ripple_behavior_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./paper-ripple-behavior.js */ "./node_modules/@polymer/paper-behaviors/paper-ripple-behavior.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** @polymerBehavior PaperButtonBehavior */ +const PaperButtonBehaviorImpl = { + properties: { + /** + * The z-depth of this element, from 0-5. Setting to 0 will remove the + * shadow, and each increasing number greater than 0 will be "deeper" + * than the last. + * + * @attribute elevation + * @type number + * @default 1 + */ + elevation: {type: Number, reflectToAttribute: true, readOnly: true} + }, + + observers: [ + '_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)', + '_computeKeyboardClass(receivedFocusFromKeyboard)' + ], + + hostAttributes: {role: 'button', tabindex: '0', animated: true}, + + _calculateElevation: function() { + var e = 1; + if (this.disabled) { + e = 0; + } else if (this.active || this.pressed) { + e = 4; + } else if (this.receivedFocusFromKeyboard) { + e = 3; + } + this._setElevation(e); + }, + + _computeKeyboardClass: function(receivedFocusFromKeyboard) { + this.toggleClass('keyboard-focus', receivedFocusFromKeyboard); + }, + + /** + * In addition to `IronButtonState` behavior, when space key goes down, + * create a ripple down effect. + * + * @param {!KeyboardEvent} event . + */ + _spaceKeyDownHandler: function(event) { + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__.IronButtonStateImpl._spaceKeyDownHandler.call(this, event); + // Ensure that there is at most one ripple when the space key is held down. + if (this.hasRipple() && this.getRipple().ripples.length < 1) { + this._ripple.uiDownAction(); + } + }, + + /** + * In addition to `IronButtonState` behavior, when space key goes up, + * create a ripple up effect. + * + * @param {!KeyboardEvent} event . + */ + _spaceKeyUpHandler: function(event) { + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__.IronButtonStateImpl._spaceKeyUpHandler.call(this, event); + if (this.hasRipple()) { + this._ripple.uiUpAction(); + } + } +}; + +/** @polymerBehavior */ +const PaperButtonBehavior = [ + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__.IronButtonState, + _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_2__.IronControlState, + _paper_ripple_behavior_js__WEBPACK_IMPORTED_MODULE_3__.PaperRippleBehavior, + PaperButtonBehaviorImpl +]; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-behaviors/paper-inky-focus-behavior.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@polymer/paper-behaviors/paper-inky-focus-behavior.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperInkyFocusBehavior: () => (/* binding */ PaperInkyFocusBehavior), +/* harmony export */ PaperInkyFocusBehaviorImpl: () => (/* binding */ PaperInkyFocusBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-button-state.js */ "./node_modules/@polymer/iron-behaviors/iron-button-state.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-control-state.js */ "./node_modules/@polymer/iron-behaviors/iron-control-state.js"); +/* harmony import */ var _paper_ripple_behavior_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./paper-ripple-behavior.js */ "./node_modules/@polymer/paper-behaviors/paper-ripple-behavior.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +/** + * `PaperInkyFocusBehavior` implements a ripple when the element has keyboard + * focus. + * + * @polymerBehavior PaperInkyFocusBehavior + */ +const PaperInkyFocusBehaviorImpl = { + observers: ['_focusedChanged(receivedFocusFromKeyboard)'], + + _focusedChanged: function(receivedFocusFromKeyboard) { + if (receivedFocusFromKeyboard) { + this.ensureRipple(); + } + if (this.hasRipple()) { + this._ripple.holdDown = receivedFocusFromKeyboard; + } + }, + + _createRipple: function() { + var ripple = _paper_ripple_behavior_js__WEBPACK_IMPORTED_MODULE_3__.PaperRippleBehavior._createRipple(); + ripple.id = 'ink'; + ripple.setAttribute('center', ''); + ripple.classList.add('circle'); + return ripple; + } +}; + +/** @polymerBehavior */ +const PaperInkyFocusBehavior = [ + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_1__.IronButtonState, + _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_2__.IronControlState, + _paper_ripple_behavior_js__WEBPACK_IMPORTED_MODULE_3__.PaperRippleBehavior, + PaperInkyFocusBehaviorImpl +]; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-behaviors/paper-ripple-behavior.js": +/*!************************************************************************!*\ + !*** ./node_modules/@polymer/paper-behaviors/paper-ripple-behavior.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperRippleBehavior: () => (/* binding */ PaperRippleBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_paper_ripple_paper_ripple_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/paper-ripple/paper-ripple.js */ "./node_modules/@polymer/paper-ripple/paper-ripple.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-button-state.js */ "./node_modules/@polymer/iron-behaviors/iron-button-state.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + +/** + * `PaperRippleBehavior` dynamically implements a ripple when the element has + * focus via pointer or keyboard. + * + * NOTE: This behavior is intended to be used in conjunction with and after + * `IronButtonState` and `IronControlState`. + * + * @polymerBehavior PaperRippleBehavior + */ +const PaperRippleBehavior = { + properties: { + /** + * If true, the element will not produce a ripple effect when interacted + * with via the pointer. + */ + noink: {type: Boolean, observer: '_noinkChanged'}, + + /** + * @type {Element|undefined} + */ + _rippleContainer: { + type: Object, + } + }, + + /** + * Ensures a `` element is available when the element is + * focused. + */ + _buttonStateChanged: function() { + if (this.focused) { + this.ensureRipple(); + } + }, + + /** + * In addition to the functionality provided in `IronButtonState`, ensures + * a ripple effect is created when the element is in a `pressed` state. + */ + _downHandler: function(event) { + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_2__.IronButtonStateImpl._downHandler.call(this, event); + if (this.pressed) { + this.ensureRipple(event); + } + }, + + /** + * Ensures this element contains a ripple effect. For startup efficiency + * the ripple effect is dynamically on demand when needed. + * @param {!Event=} optTriggeringEvent (optional) event that triggered the + * ripple. + */ + ensureRipple: function(optTriggeringEvent) { + if (!this.hasRipple()) { + this._ripple = this._createRipple(); + this._ripple.noink = this.noink; + var rippleContainer = this._rippleContainer || this.root; + if (rippleContainer) { + (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(rippleContainer).appendChild(this._ripple); + } + if (optTriggeringEvent) { + // Check if the event happened inside of the ripple container + // Fall back to host instead of the root because distributed text + // nodes are not valid event targets + var domContainer = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(this._rippleContainer || this); + var target = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__.dom)(optTriggeringEvent).rootTarget; + if (domContainer.deepContains(/** @type {Node} */ (target))) { + this._ripple.uiDownAction(optTriggeringEvent); + } + } + } + }, + + /** + * Returns the `` element used by this element to create + * ripple effects. The element's ripple is created on demand, when + * necessary, and calling this method will force the + * ripple to be created. + */ + getRipple: function() { + this.ensureRipple(); + return this._ripple; + }, + + /** + * Returns true if this element currently contains a ripple effect. + * @return {boolean} + */ + hasRipple: function() { + return Boolean(this._ripple); + }, + + /** + * Create the element's ripple effect via creating a ``. + * Override this method to customize the ripple element. + * @return {!PaperRippleElement} Returns a `` element. + */ + _createRipple: function() { + var element = /** @type {!PaperRippleElement} */ ( + document.createElement('paper-ripple')); + return element; + }, + + _noinkChanged: function(noink) { + if (this.hasRipple()) { + this._ripple.noink = noink; + } + } +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-button/paper-button.js": +/*!************************************************************!*\ + !*** ./node_modules/@polymer/paper-button/paper-button.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_iron_flex_layout_iron_flex_layout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/iron-flex-layout/iron-flex-layout.js */ "./node_modules/@polymer/iron-flex-layout/iron-flex-layout.js"); +/* harmony import */ var _polymer_paper_styles_element_styles_paper_material_styles_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/paper-styles/element-styles/paper-material-styles.js */ "./node_modules/@polymer/paper-styles/element-styles/paper-material-styles.js"); +/* harmony import */ var _polymer_paper_behaviors_paper_button_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/paper-behaviors/paper-button-behavior.js */ "./node_modules/@polymer/paper-behaviors/paper-button-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +const template = (0,_polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_4__.html)` + + + `; + +template.setAttribute('strip-whitespace', ''); + +/** +Material design: +[Buttons](https://www.google.com/design/spec/components/buttons.html) + +`paper-button` is a button. When the user touches the button, a ripple effect +emanates from the point of contact. It may be flat or raised. A raised button is +styled with a shadow. + +Example: + + Flat button + Raised button + No ripple effect + Toggle-able button + +A button that has `toggles` true will remain `active` after being clicked (and +will have an `active` attribute set). For more information, see the +`IronButtonState` behavior. + +You may use custom DOM in the button body to create a variety of buttons. For +example, to create a button with an icon and some text: + + + + custom button content + + +To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` +will already receive focus, you may want to prevent the anchor tag from +receiving focus as well by setting its tabindex to -1. + +
+ Polymer Project + + +### Styling + +Style the button with CSS as you would a normal DOM element. + + paper-button.fancy { + background: green; + color: yellow; + } + + paper-button.fancy:hover { + background: lime; + } + + paper-button[disabled], + paper-button[toggles][active] { + background: red; + } + +By default, the ripple is the same color as the foreground at 25% opacity. You +may customize the color using the `--paper-button-ink-color` custom property. + +The following custom properties and mixins are also available for styling: + +Custom property | Description | Default +----------------|-------------|---------- +`--paper-button-ink-color` | Background color of the ripple | `Based on the button's color` +`--paper-button` | Mixin applied to the button | `{}` +`--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` +`--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` +`--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` + +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_3__.Polymer)({ + _template: template, + + is: 'paper-button', + + behaviors: [_polymer_paper_behaviors_paper_button_behavior_js__WEBPACK_IMPORTED_MODULE_2__.PaperButtonBehavior], + + properties: { + /** + * If true, the button should be styled with a shadow. + */ + raised: { + type: Boolean, + reflectToAttribute: true, + value: false, + observer: '_calculateElevation', + } + }, + + _calculateElevation: function() { + if (!this.raised) { + this._setElevation(0); + } else { + _polymer_paper_behaviors_paper_button_behavior_js__WEBPACK_IMPORTED_MODULE_2__.PaperButtonBehaviorImpl._calculateElevation.apply(this); + } + } + + /** + Fired when the animation finishes. + This is useful if you want to wait until + the ripple animation finishes to perform some action. + + @event transitionend + Event param: {{node: Object}} detail Contains the animated node. + */ +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-card/paper-card.js": +/*!********************************************************!*\ + !*** ./node_modules/@polymer/paper-card/paper-card.js ***! + \********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_flex_layout_iron_flex_layout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-flex-layout/iron-flex-layout.js */ "./node_modules/@polymer/iron-flex-layout/iron-flex-layout.js"); +/* harmony import */ var _polymer_iron_image_iron_image_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-image/iron-image.js */ "./node_modules/@polymer/iron-image/iron-image.js"); +/* harmony import */ var _polymer_paper_styles_element_styles_paper_material_styles_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-styles/element-styles/paper-material-styles.js */ "./node_modules/@polymer/paper-styles/element-styles/paper-material-styles.js"); +/* harmony import */ var _polymer_paper_styles_default_theme_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/paper-styles/default-theme.js */ "./node_modules/@polymer/paper-styles/default-theme.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + + +/** +Material design: +[Cards](https://www.google.com/design/spec/components/cards.html) + +`paper-card` is a container with a drop shadow. + +Example: + + +
Some content
+
+ Some action +
+
+ +Example - top card image: + + + ... + + +### Accessibility + +By default, the `aria-label` will be set to the value of the `heading` +attribute. + +### Styling + +The following custom properties and mixins are available for styling: + +Custom property | Description | Default +----------------|-------------|---------- +`--paper-card-background-color` | The background color of the card | `--primary-background-color` +`--paper-card-header-color` | The color of the header text | `#000` +`--paper-card-header` | Mixin applied to the card header section | `{}` +`--paper-card-header-text` | Mixin applied to the title in the card header section | `{}` +`--paper-card-header-image` | Mixin applied to the image in the card header section | `{}` +`--paper-card-header-image-text` | Mixin applied to the text overlapping the image in the card header section | `{}` +`--paper-card-content` | Mixin applied to the card content section| `{}` +`--paper-card-actions` | Mixin applied to the card action section | `{}` +`--paper-card` | Mixin applied to the card | `{}` + +@group Paper Elements +@element paper-card +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_5__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_6__.html)` + + +
+ +
[[heading]]
+
+ + +`, + + is: 'paper-card', + + properties: { + /** + * The title of the card. + */ + heading: {type: String, value: '', observer: '_headingChanged'}, + + /** + * The url of the title image of the card. + */ + image: {type: String, value: ''}, + + /** + * The text alternative of the card's title image. + */ + alt: {type: String}, + + /** + * When `true`, any change to the image url property will cause the + * `placeholder` image to be shown until the image is fully rendered. + */ + preloadImage: {type: Boolean, value: false}, + + /** + * When `preloadImage` is true, setting `fadeImage` to true will cause the + * image to fade into place. + */ + fadeImage: {type: Boolean, value: false}, + + /** + * This image will be used as a background/placeholder until the src image + * has loaded. Use of a data-URI for placeholder is encouraged for instant + * rendering. + */ + placeholderImage: {type: String, value: null}, + + /** + * The z-depth of the card, from 0-5. + */ + elevation: {type: Number, value: 1, reflectToAttribute: true}, + + /** + * Set this to true to animate the card shadow when setting a new + * `z` value. + */ + animatedShadow: {type: Boolean, value: false}, + + /** + * Read-only property used to pass down the `animatedShadow` value to + * the underlying paper-material style (since they have different names). + */ + animated: { + type: Boolean, + reflectToAttribute: true, + readOnly: true, + computed: '_computeAnimated(animatedShadow)' + } + }, + + /** + * Format function for aria-hidden. Use the ! operator results in the + * empty string when given a falsy value. + */ + _isHidden: function(image) { + return image ? 'false' : 'true'; + }, + + _headingChanged: function(heading) { + var currentHeading = this.getAttribute('heading'), + currentLabel = this.getAttribute('aria-label'); + + if (typeof currentLabel !== 'string' || currentLabel === currentHeading) { + this.setAttribute('aria-label', heading); + } + }, + + _computeHeadingClass: function(image) { + return image ? ' over-image' : ''; + }, + + _computeAnimated: function(animatedShadow) { + return animatedShadow; + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dialog-behavior/paper-dialog-behavior.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@polymer/paper-dialog-behavior/paper-dialog-behavior.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperDialogBehavior: () => (/* binding */ PaperDialogBehavior), +/* harmony export */ PaperDialogBehaviorImpl: () => (/* binding */ PaperDialogBehaviorImpl) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_overlay_behavior_iron_overlay_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-overlay-behavior/iron-overlay-behavior.js */ "./node_modules/@polymer/iron-overlay-behavior/iron-overlay-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + +/** + Use `Polymer.PaperDialogBehavior` and `paper-dialog-shared-styles.html` to + implement a Material Design dialog. + + For example, if `` implements this behavior: + + +

Header

+
Dialog body
+
+ Cancel + Accept +
+
+ + `paper-dialog-shared-styles.html` provide styles for a header, content area, + and an action area for buttons. Use the `

` tag for the header and the + `buttons` class for the action area. You can use the `paper-dialog-scrollable` + element (in its own repository) if you need a scrolling content area. + + Use the `dialog-dismiss` and `dialog-confirm` attributes on interactive + controls to close the dialog. If the user dismisses the dialog with + `dialog-confirm`, the `closingReason` will update to include `confirmed: + true`. + + ### Accessibility + + This element has `role="dialog"` by default. Depending on the context, it may + be more appropriate to override this attribute with `role="alertdialog"`. + + If `modal` is set, the element will prevent the focus from exiting the + element. It will also ensure that focus remains in the dialog. + + @hero hero.svg + @demo demo/index.html + @polymerBehavior PaperDialogBehavior + */ +const PaperDialogBehaviorImpl = { + + hostAttributes: {'role': 'dialog', 'tabindex': '-1'}, + + properties: { + + /** + * If `modal` is true, this implies `no-cancel-on-outside-click`, + * `no-cancel-on-esc-key` and `with-backdrop`. + */ + modal: {type: Boolean, value: false}, + + __readied: {type: Boolean, value: false} + + }, + + observers: ['_modalChanged(modal, __readied)'], + + listeners: {'tap': '_onDialogClick'}, + + /** + * @return {void} + */ + ready: function() { + // Only now these properties can be read. + this.__prevNoCancelOnOutsideClick = this.noCancelOnOutsideClick; + this.__prevNoCancelOnEscKey = this.noCancelOnEscKey; + this.__prevWithBackdrop = this.withBackdrop; + this.__readied = true; + }, + + _modalChanged: function(modal, readied) { + // modal implies noCancelOnOutsideClick, noCancelOnEscKey and withBackdrop. + // We need to wait for the element to be ready before we can read the + // properties values. + if (!readied) { + return; + } + + if (modal) { + this.__prevNoCancelOnOutsideClick = this.noCancelOnOutsideClick; + this.__prevNoCancelOnEscKey = this.noCancelOnEscKey; + this.__prevWithBackdrop = this.withBackdrop; + this.noCancelOnOutsideClick = true; + this.noCancelOnEscKey = true; + this.withBackdrop = true; + } else { + // If the value was changed to false, let it false. + this.noCancelOnOutsideClick = + this.noCancelOnOutsideClick && this.__prevNoCancelOnOutsideClick; + this.noCancelOnEscKey = + this.noCancelOnEscKey && this.__prevNoCancelOnEscKey; + this.withBackdrop = this.withBackdrop && this.__prevWithBackdrop; + } + }, + + _updateClosingReasonConfirmed: function(confirmed) { + this.closingReason = this.closingReason || {}; + this.closingReason.confirmed = confirmed; + }, + + /** + * Will dismiss the dialog if user clicked on an element with dialog-dismiss + * or dialog-confirm attribute. + */ + _onDialogClick: function(event) { + // Search for the element with dialog-confirm or dialog-dismiss, + // from the root target until this (excluded). + var path = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_2__.dom)(event).path; + for (var i = 0, l = path.indexOf(this); i < l; i++) { + var target = path[i]; + if (target.hasAttribute && + (target.hasAttribute('dialog-dismiss') || + target.hasAttribute('dialog-confirm'))) { + this._updateClosingReasonConfirmed( + target.hasAttribute('dialog-confirm')); + this.close(); + event.stopPropagation(); + break; + } + } + } + +}; + +/** @polymerBehavior */ +const PaperDialogBehavior = + [_polymer_iron_overlay_behavior_iron_overlay_behavior_js__WEBPACK_IMPORTED_MODULE_1__.IronOverlayBehavior, PaperDialogBehaviorImpl]; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dialog-behavior/paper-dialog-shared-styles.js": +/*!***********************************************************************************!*\ + !*** ./node_modules/@polymer/paper-dialog-behavior/paper-dialog-shared-styles.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_flex_layout_iron_flex_layout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-flex-layout/iron-flex-layout.js */ "./node_modules/@polymer/iron-flex-layout/iron-flex-layout.js"); +/* harmony import */ var _polymer_paper_styles_default_theme_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/paper-styles/default-theme.js */ "./node_modules/@polymer/paper-styles/default-theme.js"); +/* harmony import */ var _polymer_paper_styles_typography_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-styles/typography.js */ "./node_modules/@polymer/paper-styles/typography.js"); +/* harmony import */ var _polymer_paper_styles_shadow_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/paper-styles/shadow.js */ "./node_modules/@polymer/paper-styles/shadow.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ +/* +### Styling + +The following custom properties and mixins are available for styling. + +Custom property | Description | Default +----------------|-------------|---------- +`--paper-dialog-background-color` | Dialog background color | `--primary-background-color` +`--paper-dialog-color` | Dialog foreground color | `--primary-text-color` +`--paper-dialog` | Mixin applied to the dialog | `{}` +`--paper-dialog-title` | Mixin applied to the title (`

`) element | `{}` +`--paper-dialog-button-color` | Button area foreground color | `--default-primary-color` +*/ + + + + + +const $_documentContainer = document.createElement('template'); +$_documentContainer.setAttribute('style', 'display: none;'); + +$_documentContainer.innerHTML = ` + +`; + +document.head.appendChild($_documentContainer.content); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dialog/paper-dialog.js": +/*!************************************************************!*\ + !*** ./node_modules/@polymer/paper-dialog/paper-dialog.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_paper_dialog_behavior_paper_dialog_shared_styles_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/paper-dialog-behavior/paper-dialog-shared-styles.js */ "./node_modules/@polymer/paper-dialog-behavior/paper-dialog-shared-styles.js"); +/* harmony import */ var _polymer_neon_animation_neon_animation_runner_behavior_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/neon-animation/neon-animation-runner-behavior.js */ "./node_modules/@polymer/neon-animation/neon-animation-runner-behavior.js"); +/* harmony import */ var _polymer_paper_dialog_behavior_paper_dialog_behavior_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-dialog-behavior/paper-dialog-behavior.js */ "./node_modules/@polymer/paper-dialog-behavior/paper-dialog-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + +/** +Material design: +[Dialogs](https://www.google.com/design/spec/components/dialogs.html) + +`` is a dialog with Material Design styling and optional +animations when it is opened or closed. It provides styles for a header, content +area, and an action area for buttons. You can use the +`` element (in its own repository) if you need a +scrolling content area. To autofocus a specific child element after opening the +dialog, give it the `autofocus` attribute. See `Polymer.PaperDialogBehavior` and +`Polymer.IronOverlayBehavior` for specifics. + +For example, the following code implements a dialog with a header, scrolling +content area and buttons. Focus will be given to the `dialog-confirm` button +when the dialog is opened. + + +

Header

+ + Lorem ipsum... + +
+ Cancel + Accept +
+
+ +### Styling + +See the docs for `Polymer.PaperDialogBehavior` for the custom properties +available for styling this element. + +### Animations + +Set the `entry-animation` and/or `exit-animation` attributes to add an animation +when the dialog is opened or closed. See the documentation in +[PolymerElements/neon-animation](https://github.com/PolymerElements/neon-animation) +for more info. + +For example: + + + + +

Header

+
Dialog body
+
+ +### Accessibility + +See the docs for `Polymer.PaperDialogBehavior` for accessibility features +implemented by this element. + +@group Paper Elements +@element paper-dialog +@hero hero.svg +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_4__.Polymer)({ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__.html)` + + +`, + + is: 'paper-dialog', + behaviors: [_polymer_paper_dialog_behavior_paper_dialog_behavior_js__WEBPACK_IMPORTED_MODULE_3__.PaperDialogBehavior, _polymer_neon_animation_neon_animation_runner_behavior_js__WEBPACK_IMPORTED_MODULE_2__.NeonAnimationRunnerBehavior], + listeners: {'neon-animation-finish': '_onNeonAnimationFinish'}, + + _renderOpened: function() { + this.cancelAnimation(); + this.playAnimation('entry'); + }, + + _renderClosed: function() { + this.cancelAnimation(); + this.playAnimation('exit'); + }, + + _onNeonAnimationFinish: function() { + if (this.opened) { + this._finishRenderOpened(); + } else { + this._finishRenderClosed(); + } + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-icons.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-icons.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_iron_iconset_svg_iron_iconset_svg_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/iron-iconset-svg/iron-iconset-svg.js */ "./node_modules/@polymer/iron-iconset-svg/iron-iconset-svg.js"); +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + +const $_documentContainer = document.createElement('template'); +$_documentContainer.setAttribute('style', 'display: none;'); + +$_documentContainer.innerHTML = + ` + + + +`; + +document.head.appendChild($_documentContainer.content); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-shared-styles.js": +/*!****************************************************************************************!*\ + !*** ./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-shared-styles.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_paper_styles_default_theme_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/paper-styles/default-theme.js */ "./node_modules/@polymer/paper-styles/default-theme.js"); +/** +@license +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + +const $_documentContainer = document.createElement('template'); +$_documentContainer.setAttribute('style', 'display: none;'); + +$_documentContainer.innerHTML = + ` + +`; + +document.head.appendChild($_documentContainer.content); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js */ "./node_modules/@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js"); +/* harmony import */ var _polymer_iron_icon_iron_icon_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-icon/iron-icon.js */ "./node_modules/@polymer/iron-icon/iron-icon.js"); +/* harmony import */ var _polymer_paper_input_paper_input_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-input/paper-input.js */ "./node_modules/@polymer/paper-input/paper-input.js"); +/* harmony import */ var _polymer_paper_menu_button_paper_menu_button_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/paper-menu-button/paper-menu-button.js */ "./node_modules/@polymer/paper-menu-button/paper-menu-button.js"); +/* harmony import */ var _polymer_paper_ripple_paper_ripple_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/paper-ripple/paper-ripple.js */ "./node_modules/@polymer/paper-ripple/paper-ripple.js"); +/* harmony import */ var _polymer_paper_styles_default_theme_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @polymer/paper-styles/default-theme.js */ "./node_modules/@polymer/paper-styles/default-theme.js"); +/* harmony import */ var _paper_dropdown_menu_icons_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./paper-dropdown-menu-icons.js */ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-icons.js"); +/* harmony import */ var _paper_dropdown_menu_shared_styles_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./paper-dropdown-menu-shared-styles.js */ "./node_modules/@polymer/paper-dropdown-menu/paper-dropdown-menu-shared-styles.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-button-state.js */ "./node_modules/@polymer/iron-behaviors/iron-button-state.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-control-state.js */ "./node_modules/@polymer/iron-behaviors/iron-control-state.js"); +/* harmony import */ var _polymer_iron_form_element_behavior_iron_form_element_behavior_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @polymer/iron-form-element-behavior/iron-form-element-behavior.js */ "./node_modules/@polymer/iron-form-element-behavior/iron-form-element-behavior.js"); +/* harmony import */ var _polymer_iron_validatable_behavior_iron_validatable_behavior_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @polymer/iron-validatable-behavior/iron-validatable-behavior.js */ "./node_modules/@polymer/iron-validatable-behavior/iron-validatable-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_legacy_element_mixin_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/legacy-element-mixin.js */ "./node_modules/@polymer/polymer/lib/legacy/legacy-element-mixin.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_lib_utils_gestures_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @polymer/polymer/lib/utils/gestures.js */ "./node_modules/@polymer/polymer/lib/utils/gestures.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/* harmony import */ var _polymer_polymer_lib_utils_wrap_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @polymer/polymer/lib/utils/wrap.js */ "./node_modules/@polymer/polymer/lib/utils/wrap.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + + + + + + + + + + + + + + +// LegacyElementMixin dedupes and this is the base class for elements created +// with the `Polymer` function, so this is only a cache lookup. +// https://github.com/Polymer/polymer/blob/640bc80ac7177b761d46b2fa9c455c318f2b85c6/lib/legacy/class.js#L533-L534 +const LegacyPolymerElementBase = (0,_polymer_polymer_lib_legacy_legacy_element_mixin_js__WEBPACK_IMPORTED_MODULE_13__.LegacyElementMixin)(HTMLElement); + +/** +Material design: [Dropdown +menus](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons) + +`paper-dropdown-menu` is similar to a native browser select element. +`paper-dropdown-menu` works with selectable content. The currently selected +item is displayed in the control. If no item is selected, the `label` is +displayed instead. + +Example: + + + + Croissant + Donut + Financier + Madeleine + + + +This example renders a dropdown menu with 4 options. + +The child element with the slot `dropdown-content` is used as the dropdown +menu. This can be a [`paper-listbox`](paper-listbox), or any other or +element that acts like an [`iron-selector`](iron-selector). + +Specifically, the menu child must fire an +[`iron-select`](iron-selector#event-iron-select) event when one of its +children is selected, and an +[`iron-deselect`](iron-selector#event-iron-deselect) event when a child is +deselected. The selected or deselected item must be passed as the event's +`detail.item` property. + +Applications can listen for the `iron-select` and `iron-deselect` events +to react when options are selected and deselected. + +### Styling + +The following custom properties and mixins are also available for styling: + +Custom property | Description | Default +----------------|-------------|---------- +`--paper-dropdown-menu` | A mixin that is applied to the element host | `{}` +`--paper-dropdown-menu-disabled` | A mixin that is applied to the element host when disabled | `{}` +`--paper-dropdown-menu-ripple` | A mixin that is applied to the internal ripple | `{}` +`--paper-dropdown-menu-button` | A mixin that is applied to the internal menu button | `{}` +`--paper-dropdown-menu-input` | A mixin that is applied to the internal paper input | `{}` +`--paper-dropdown-menu-icon` | A mixin that is applied to the internal icon | `{}` + +You can also use any of the `paper-input-container` and `paper-menu-button` +style mixins and custom properties to style the internal input and menu button +respectively. + +@element paper-dropdown-menu +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_14__.Polymer)({ + /** @override */ + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_17__.html)` + + + + + + + +`, + + is: 'paper-dropdown-menu', + + behaviors: [ + _polymer_iron_behaviors_iron_button_state_js__WEBPACK_IMPORTED_MODULE_9__.IronButtonState, + _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_10__.IronControlState, + _polymer_iron_form_element_behavior_iron_form_element_behavior_js__WEBPACK_IMPORTED_MODULE_11__.IronFormElementBehavior, + _polymer_iron_validatable_behavior_iron_validatable_behavior_js__WEBPACK_IMPORTED_MODULE_12__.IronValidatableBehavior + ], + + properties: { + /** + * The derived "label" of the currently selected item. This value + * is the `label` property on the selected item if set, or else the + * trimmed text content of the selected item. + */ + selectedItemLabel: {type: String, notify: true, readOnly: true}, + + /** + * The last selected item. An item is selected if the dropdown menu has + * a child with slot `dropdown-content`, and that child triggers an + * `iron-select` event with the selected `item` in the `detail`. + * + * @type {?Object} + */ + selectedItem: {type: Object, notify: true, readOnly: true}, + + /** + * The value for this element that will be used when submitting in + * a form. It reflects the value of `selectedItemLabel`. If set directly, + * it will not update the `selectedItemLabel` value. + */ + value: { + type: String, + notify: true, + }, + + /** + * The label for the dropdown. + */ + label: {type: String}, + + /** + * The placeholder for the dropdown. + */ + placeholder: {type: String}, + + /** + * The error message to display when invalid. + */ + errorMessage: {type: String}, + + /** + * True if the dropdown is open. Otherwise, false. + */ + opened: + {type: Boolean, notify: true, value: false, observer: '_openedChanged'}, + + /** + * By default, the dropdown will constrain scrolling on the page + * to itself when opened. + * Set to true in order to prevent scroll from being constrained + * to the dropdown when it opens. + */ + allowOutsideScroll: {type: Boolean, value: false}, + + /** + * Set to true to disable the floating label. Bind this to the + * ``'s `noLabelFloat` property. + */ + noLabelFloat: {type: Boolean, value: false, reflectToAttribute: true}, + + /** + * Set to true to always float the label. Bind this to the + * ``'s `alwaysFloatLabel` property. + */ + alwaysFloatLabel: {type: Boolean, value: false}, + + /** + * Set to true to disable animations when opening and closing the + * dropdown. + */ + noAnimations: {type: Boolean, value: false}, + + /** + * The orientation against which to align the menu dropdown + * horizontally relative to the dropdown trigger. + */ + horizontalAlign: {type: String, value: 'right'}, + + /** + * The orientation against which to align the menu dropdown + * vertically relative to the dropdown trigger. + */ + verticalAlign: {type: String, value: 'top'}, + + /** + * Overrides the vertical offset computed in + * _computeMenuVerticalOffset. + */ + verticalOffset: Number, + + /** + * If true, the `horizontalAlign` and `verticalAlign` properties will + * be considered preferences instead of strict requirements when + * positioning the dropdown and may be changed if doing so reduces + * the area of the dropdown falling outside of `fitInto`. + */ + dynamicAlign: {type: Boolean}, + + /** + * Whether focus should be restored to the dropdown when the menu closes. + */ + restoreFocusOnClose: {type: Boolean, value: true}, + + /** + * If true and scrollbars are added to the dropdown after it is positioned, + * the size of the added scrollbars will be added to its `maxWidth` and + * `maxHeight`. + */ + expandSizingTargetForScrollbars: {type: Boolean, value: false}, + }, + + listeners: {'tap': '_onTap'}, + + /** + * @type {!Object} + */ + keyBindings: {'up down': 'open', 'esc': 'close'}, + + observers: ['_selectedItemChanged(selectedItem)'], + + /** + * Override `_attachDom` so that we can pass `delegatesFocus`. The overridden + * implementation of `_attachDom` specifically skips the steps performed here + * if the node already hosts a shadow root: + * https://github.com/Polymer/polymer/blob/640bc80ac7177b761d46b2fa9c455c318f2b85c6/lib/mixins/element-mixin.js#L691-L694 + * @override + */ + _attachDom(dom) { + const wrappedThis = (0,_polymer_polymer_lib_utils_wrap_js__WEBPACK_IMPORTED_MODULE_18__.wrap)(this); + wrappedThis.attachShadow({ + mode: 'open', + delegatesFocus: true, + shadyUpgradeFragment: dom, + }); + wrappedThis.shadowRoot.appendChild(dom); + return LegacyPolymerElementBase.prototype._attachDom.call(this, dom); + }, + + /** @override */ + focus() { + // When using Shady DOM and in browsers that don't support + // `delegatesFocus`, attempting to focus this element with the browser's + // native `HTMLElement#focus` will cause focus to be lost because this + // element isn't focusable in those situations. To work around this, the + // element in the shadow root that this element intends to delegate focus + // to is manually focused instead. + this.$.input._focusableElement.focus(); + }, + + /** @override */ + attached: function() { + // NOTE(cdata): Due to timing, a preselected value in a `IronSelectable` + // child will cause an `iron-select` event to fire while the element is + // still in a `DocumentFragment`. This has the effect of causing + // handlers not to fire. So, we double check this value on attached: + var contentElement = this.contentElement; + if (contentElement && contentElement.selectedItem) { + this._setSelectedItem(contentElement.selectedItem); + } + }, + + /** + * The content element that is contained by the dropdown menu, if any. + */ + get contentElement() { + // Polymer 2.x returns slot.assignedNodes which can contain text nodes. + var nodes = (0,_polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_15__.dom)(this.$.content).getDistributedNodes(); + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nodeType === Node.ELEMENT_NODE) { + return nodes[i]; + } + } + }, + + /** + * Show the dropdown content. + */ + open: function() { + this.$.menuButton.open(); + }, + + /** + * Hide the dropdown content. + */ + close: function() { + this.$.menuButton.close(); + }, + + /** + * A handler that is called when `iron-select` is fired. + * + * @param {CustomEvent} event An `iron-select` event. + */ + _onIronSelect: function(event) { + this._setSelectedItem(event.detail.item); + }, + + /** + * A handler that is called when `iron-deselect` is fired. + * + * @param {CustomEvent} event An `iron-deselect` event. + */ + _onIronDeselect: function(event) { + this._setSelectedItem(null); + }, + + /** + * A handler that is called when the dropdown is tapped. + * + * @param {CustomEvent} event A tap event. + */ + _onTap: function(event) { + if (_polymer_polymer_lib_utils_gestures_js__WEBPACK_IMPORTED_MODULE_16__.findOriginalTarget(event) === this) { + this.open(); + } + }, + + /** + * Compute the label for the dropdown given a selected item. + * + * @param {Element} selectedItem A selected Element item, with an + * optional `label` property. + */ + _selectedItemChanged: function(selectedItem) { + var value = ''; + if (!selectedItem) { + value = ''; + } else { + value = selectedItem.label || selectedItem.getAttribute('label') || + selectedItem.textContent.trim(); + } + + this.value = value; + this._setSelectedItemLabel(value); + }, + + /** + * Compute the vertical offset of the menu based on the value of + * `noLabelFloat`. + * + * @param {boolean} noLabelFloat True if the label should not float + * @param {number=} opt_verticalOffset Optional offset from the user + * above the input, otherwise false. + */ + _computeMenuVerticalOffset: function(noLabelFloat, opt_verticalOffset) { + // Override offset if it's passed from the user. + if (opt_verticalOffset) { + return opt_verticalOffset; + } + + // NOTE(cdata): These numbers are somewhat magical because they are + // derived from the metrics of elements internal to `paper-input`'s + // template. The metrics will change depending on whether or not the + // input has a floating label. + return noLabelFloat ? -4 : 8; + }, + + /** + * Returns false if the element is required and does not have a selection, + * and true otherwise. + * @param {*=} _value Ignored. + * @return {boolean} true if `required` is false, or if `required` is true + * and the element has a valid selection. + */ + _getValidity: function(_value) { + return this.disabled || !this.required || (this.required && !!this.value); + }, + + _openedChanged: function() { + var openState = this.opened ? 'true' : 'false'; + var e = this.contentElement; + if (e) { + e.setAttribute('aria-expanded', openState); + } + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-icon-button/paper-icon-button.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@polymer/paper-icon-button/paper-icon-button.js ***! + \**********************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_icon_iron_icon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-icon/iron-icon.js */ "./node_modules/@polymer/iron-icon/iron-icon.js"); +/* harmony import */ var _polymer_paper_styles_default_theme_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/paper-styles/default-theme.js */ "./node_modules/@polymer/paper-styles/default-theme.js"); +/* harmony import */ var _polymer_paper_behaviors_paper_inky_focus_behavior_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/paper-behaviors/paper-inky-focus-behavior.js */ "./node_modules/@polymer/paper-behaviors/paper-inky-focus-behavior.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer-fn.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer-fn.js"); +/* harmony import */ var _polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @polymer/polymer/lib/utils/html-tag.js */ "./node_modules/@polymer/polymer/lib/utils/html-tag.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + + +/** +Material design: [Icon +toggles](https://www.google.com/design/spec/components/buttons.html#buttons-toggle-buttons) + +`paper-icon-button` is a button with an image placed at the center. When the +user touches the button, a ripple effect emanates from the center of the button. + +`paper-icon-button` does not include a default icon set. To use icons from the +default set, include `PolymerElements/iron-icons/iron-icons.html`, and use the +`icon` attribute to specify which icon from the icon set to use. + + + +See [`iron-iconset`](iron-iconset) for more information about +how to use a custom icon set. + +Example: + + + + + + +To use `paper-icon-button` as a link, wrap it in an anchor tag. Since +`paper-icon-button` will already receive focus, you may want to prevent the +anchor tag from receiving focus as well by setting its tabindex to -1. + + + + + +### Styling + +Style the button with CSS as you would a normal DOM element. If you are using +the icons provided by `iron-icons`, they will inherit the foreground color of +the button. + + /* make a red "favorite" button *\/ + + +By default, the ripple is the same color as the foreground at 25% opacity. You +may customize the color using the `--paper-icon-button-ink-color` custom +property. + +The following custom properties and mixins are available for styling: + +Custom property | Description | Default +----------------|-------------|---------- +`--paper-icon-button-disabled-text` | The color of the disabled button | `--disabled-text-color` +`--paper-icon-button-ink-color` | Selected/focus ripple color | `--primary-text-color` +`--paper-icon-button` | Mixin for a button | `{}` +`--paper-icon-button-disabled` | Mixin for a disabled button | `{}` +`--paper-icon-button-hover` | Mixin for button on hover | `{}` + +@group Paper Elements +@element paper-icon-button +@demo demo/index.html +*/ +(0,_polymer_polymer_lib_legacy_polymer_fn_js__WEBPACK_IMPORTED_MODULE_4__.Polymer)({ + is: 'paper-icon-button', + + _template: (0,_polymer_polymer_lib_utils_html_tag_js__WEBPACK_IMPORTED_MODULE_5__.html)` + + + + `, + + hostAttributes: {role: 'button', tabindex: '0'}, + + behaviors: [_polymer_paper_behaviors_paper_inky_focus_behavior_js__WEBPACK_IMPORTED_MODULE_3__.PaperInkyFocusBehavior], + + registered: function() { + this._template.setAttribute('strip-whitespace', ''); + }, + + properties: { + /** + * The URL of an image for the icon. If the src property is specified, + * the icon property should not be. + */ + src: {type: String}, + + /** + * Specifies the icon name or index in the set of icons available in + * the icon's icon set. If the icon property is specified, + * the src property should not be. + */ + icon: {type: String}, + + /** + * Specifies the alternate text for the button, for accessibility. + */ + alt: {type: String, observer: '_altChanged'} + }, + + _altChanged: function(newValue, oldValue) { + var label = this.getAttribute('aria-label'); + + // Don't stomp over a user-set aria-label. + if (!label || oldValue == label) { + this.setAttribute('aria-label', newValue); + } + } +}); + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-input/paper-input-addon-behavior.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@polymer/paper-input/paper-input-addon-behavior.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperInputAddonBehavior: () => (/* binding */ PaperInputAddonBehavior) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + +/** + * Use `Polymer.PaperInputAddonBehavior` to implement an add-on for + * ``. A add-on appears below the input, and may display + * information based on the input value and validity such as a character counter + * or an error message. + * @polymerBehavior + */ +const PaperInputAddonBehavior = { + attached: function() { + this.fire('addon-attached'); + }, + + /** + * The function called by `` when the input value or + * validity changes. + * @param {{ + * invalid: boolean, + * inputElement: (Element|undefined), + * value: (string|undefined) + * }} state - + * inputElement: The input element. + * value: The input value. + * invalid: True if the input value is invalid. + */ + update: function(state) {} + +}; + + +/***/ }), + +/***/ "./node_modules/@polymer/paper-input/paper-input-behavior.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@polymer/paper-input/paper-input-behavior.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PaperInputBehavior: () => (/* binding */ PaperInputBehavior), +/* harmony export */ PaperInputBehaviorImpl: () => (/* binding */ PaperInputBehaviorImpl), +/* harmony export */ PaperInputHelper: () => (/* binding */ PaperInputHelper) +/* harmony export */ }); +/* harmony import */ var _polymer_polymer_polymer_legacy_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @polymer/polymer/polymer-legacy.js */ "./node_modules/@polymer/polymer/polymer-legacy.js"); +/* harmony import */ var _polymer_iron_a11y_keys_behavior_iron_a11y_keys_behavior_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js */ "./node_modules/@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js"); +/* harmony import */ var _polymer_iron_behaviors_iron_control_state_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @polymer/iron-behaviors/iron-control-state.js */ "./node_modules/@polymer/iron-behaviors/iron-control-state.js"); +/* harmony import */ var _polymer_polymer_lib_legacy_polymer_dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @polymer/polymer/lib/legacy/polymer.dom.js */ "./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"); +/* harmony import */ var _polymer_polymer_polymer_element_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @polymer/polymer/polymer-element.js */ "./node_modules/@polymer/polymer/polymer-element.js"); +/** +@license +Copyright (c) 2015 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/ + + + + + + + +// Generate unique, monotonically increasing IDs for labels (needed by +// aria-labelledby) and add-ons. +const PaperInputHelper = {}; + +PaperInputHelper.NextLabelID = 1; +PaperInputHelper.NextAddonID = 1; +PaperInputHelper.NextInputID = 1; + +/** + * Use `PaperInputBehavior` to implement inputs with ``. + * This behavior is implemented by ``. It exposes a number of + * properties from `` and `` and + * they should be bound in your template. + * + * The input element can be accessed by the `inputElement` property if you need + * to access properties or methods that are not exposed. + * @polymerBehavior PaperInputBehavior + */ +const PaperInputBehaviorImpl = { + + properties: { + /** + * Fired when the input changes due to user interaction. + * + * @event change + */ + + /** + * The label for this input. If you're using PaperInputBehavior to + * implement your own paper-input-like element, bind this to + * `