diff --git a/electron/extensions/downloadExtension.ts b/electron/extensions/downloadExtension.ts index 0dc8a905b9..dac9354f5d 100644 --- a/electron/extensions/downloadExtension.ts +++ b/electron/extensions/downloadExtension.ts @@ -1,9 +1,11 @@ +import {readFileSync} from 'fs'; +import path from 'path'; import tar from 'tar'; import {downloadFile} from '@utils/http'; import downloadExtensionEntry from './downloadExtensionEntry'; -import {createOrRecreateFolder, deleteFile, doesPathExist} from './fileSystem'; +import {createOrRecreateFolder, deleteFile, deleteFolder, doesPathExist, getAllFiles} from './fileSystem'; import {DownloadExtensionOptions} from './types'; async function downloadExtension( @@ -50,7 +52,25 @@ async function downloadExtension( await deleteFile(tarballFilePath); + checkAllJSONFilesOfExtensionAreValid(extensionFolderPath); + return extension; } export default downloadExtension; + +export const checkAllJSONFilesOfExtensionAreValid = (folderPath: string) => { + const allFiles = getAllFiles(folderPath).filter(file => path.extname(file) === '.json'); + let currentFile: string = ''; + try { + allFiles.forEach(file => { + currentFile = file; + const fileData = readFileSync(file); + JSON.parse(fileData.toString()); + }); + } catch (error: any) { + deleteFolder(folderPath); + const paths: Array = currentFile.split(path.sep); + throw new Error(`[${paths[paths.length - 1]}]: ${error.message}`); + } +}; diff --git a/electron/extensions/downloadExtensionEntry.ts b/electron/extensions/downloadExtensionEntry.ts index a635a6c902..43be56de95 100644 --- a/electron/extensions/downloadExtensionEntry.ts +++ b/electron/extensions/downloadExtensionEntry.ts @@ -47,7 +47,7 @@ async function downloadExtensionEntry( if (doesEntryFileExist) { await deleteFile(entryFilePath); } - await writeFile(entryFilePath, entryFileContent); + await writeFile(entryFilePath, JSON.stringify(parsedEntryFileContent)); return parsedEntryFileContent; } diff --git a/electron/extensions/fileSystem.ts b/electron/extensions/fileSystem.ts index 9946bf75b1..f775a85932 100644 --- a/electron/extensions/fileSystem.ts +++ b/electron/extensions/fileSystem.ts @@ -1,4 +1,5 @@ import fs, {promises} from 'fs'; +import { join, sep } from 'path'; import util from 'util'; export const doesPathExist = (path: string) => util.promisify(fs.exists)(path); @@ -14,3 +15,18 @@ export const deleteFile = (filePath: string) => promises.unlink(filePath); export const deleteFolder = (folderPath: string) => promises.rm(folderPath, {recursive: true}); export const readFile = (filePath: string) => promises.readFile(filePath, 'utf8'); export const writeFile = (filePath: string, fileContent: string) => promises.writeFile(filePath, fileContent, 'utf8'); + +export const getAllFiles = (dirPath: string, arrayOfFiles?: Array) => { + const files = fs.readdirSync(dirPath); + arrayOfFiles = arrayOfFiles || []; + + files.forEach((file: string) => { + if (fs.statSync(join(dirPath, file)).isDirectory()) { + arrayOfFiles = getAllFiles(join(dirPath, file), arrayOfFiles); + } else { + (>arrayOfFiles).push(join(dirPath, sep, file)); + } + }); + + return arrayOfFiles; +}; \ No newline at end of file diff --git a/electron/extensions/loadExtension.ts b/electron/extensions/loadExtension.ts index c7bc887819..405cd80ca2 100644 --- a/electron/extensions/loadExtension.ts +++ b/electron/extensions/loadExtension.ts @@ -28,7 +28,7 @@ async function loadExtension( validateEntryFileContent(parsedEntryFileContent); } catch (e) { if (e instanceof Error) { - log.warn(`[LoadExtension]: Invalid ${entryFileName} in ${folderPath}: `, e.message); + log.warn(`[LoadExtension]: Invalid ${entryFileName} in ${folderPath}: `); } return undefined; } diff --git a/electron/pluginService.ts b/electron/pluginService.ts index 16ca6b1902..86a3629077 100644 --- a/electron/pluginService.ts +++ b/electron/pluginService.ts @@ -20,7 +20,9 @@ import {convertExtensionsToRecord, extractRepositoryOwnerAndNameFromUrl, makeExt const PLUGIN_ENTRY_FILE_NAME = 'package.json'; function transformPackageJsonToAnyPlugin(packageJson: PluginPackageJson, folderPath: string): AnyPlugin { - const {repositoryOwner, repositoryName} = extractRepositoryOwnerAndNameFromUrl(packageJson.repository); + const {repositoryOwner, repositoryName, repositoryBranch} = extractRepositoryOwnerAndNameFromUrl( + packageJson.repository + ); const plugin: AnyPlugin = { id: packageJson.monoklePlugin.id, name: packageJson.name, @@ -31,7 +33,7 @@ function transformPackageJsonToAnyPlugin(packageJson: PluginPackageJson, folderP repository: { owner: repositoryOwner, name: repositoryName, - branch: 'main', // TODO: handle the branch name + branch: repositoryBranch, }, modules: packageJson.monoklePlugin.modules.map(module => { if (isTemplatePluginModule(module)) { @@ -60,7 +62,7 @@ export async function downloadPlugin( extensionTarballUrl: tarballUrl, entryFileName: 'package.json', entryFileUrl, - parseEntryFileContent: JSON.parse, + parseEntryFileContent: parseEntryFileContentHandler.bind(null, pluginUrl), validateEntryFileContent: validatePluginPackageJson, transformEntryFileContentToExtension: transformPackageJsonToAnyPlugin, makeExtensionFolderPath: () => { @@ -97,7 +99,14 @@ export async function updatePlugin( pluginsDir: string, userTempDir: string ): Promise | undefined> { - const repositoryUrl = `https://github.com/${plugin.repository.owner}/${plugin.repository.name}`; + let repositoryUrl; + + if (plugin.repository.branch) { + repositoryUrl = `https://github.com/${plugin.repository.owner}/${plugin.repository.name}/tree/${plugin.repository.branch}`; + } else { + repositoryUrl = `https://github.com/${plugin.repository.owner}/${plugin.repository.name}`; + } + const {entryFileUrl, folderPath} = makeExtensionDownloadData(repositoryUrl, PLUGIN_ENTRY_FILE_NAME, userTempDir); let tempPluginEntry: PluginPackageJson; try { @@ -114,6 +123,7 @@ export async function updatePlugin( } return; } + if (semver.lt(plugin.version, tempPluginEntry.version)) { try { const pluginExtension = await downloadPlugin(repositoryUrl, pluginsDir); @@ -128,3 +138,11 @@ export async function updatePlugin( } return undefined; } + +export const parseEntryFileContentHandler = (pluginUrl: string, entryFileContext: string) => { + const entryFile = JSON.parse(entryFileContext); + if (pluginUrl) { + entryFile.repository = pluginUrl; + } + return entryFile; +}; diff --git a/electron/templateService.ts b/electron/templateService.ts index f973d9fa93..8bdeea3a31 100644 --- a/electron/templateService.ts +++ b/electron/templateService.ts @@ -141,7 +141,7 @@ const makeLoadTemplateOptions = (folderPath: string) => { return { folderPath, entryFileName: TEMPLATE_ENTRY_FILE_NAME, - parseEntryFileContent: JSON.parse, + parseEntryFileContent: parseEntryFileContentHandler.bind(null), validateEntryFileContent: validateAnyTemplate, transformEntryFileContentToExtension: parseTemplate, }; @@ -307,3 +307,11 @@ export async function updateTemplatePack( } return undefined; } + +export const parseEntryFileContentHandler = (entryFileContent: any) => { + try { + return JSON.parse(entryFileContent); + } catch (error: any) { + log.error(`[${entryFileContent.name}]: ${error.message}`); + } +}; diff --git a/electron/utils.ts b/electron/utils.ts index 92ba1eb17f..dd06edea26 100644 --- a/electron/utils.ts +++ b/electron/utils.ts @@ -3,6 +3,7 @@ import {dialog} from 'electron'; import {AnyAction} from '@reduxjs/toolkit'; import {existsSync, mkdirSync, writeFileSync} from 'fs'; +import gitUrlParse from 'git-url-parse'; import _ from 'lodash'; import {machineIdSync} from 'node-machine-id'; import Nucleus from 'nucleus-nodejs'; @@ -18,7 +19,6 @@ import {loadResource} from '@redux/services'; import electronStore from '@utils/electronStore'; import {PROCESS_ENV} from '@utils/env'; -const GITHUB_URL = 'https://github.com'; const GITHUB_REPOSITORY_REGEX = /^https:\/\/github.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+/i; export function isValidRepositoryUrl(repositoryUrl: string) { @@ -27,14 +27,24 @@ export function isValidRepositoryUrl(repositoryUrl: string) { export function extractRepositoryOwnerAndNameFromUrl(pluginUrl: string) { if (!isValidRepositoryUrl(pluginUrl)) { - throw new Error('Invalid repository URL'); + throw new Error('Currently we support only Github as provider'); + } + const parsedURL = gitUrlParse(pluginUrl); + if (!parsedURL.owner || !parsedURL.name) { + throw new Error('Please enter a valid git URL!'); + } + if (!parsedURL.protocols.includes('https')) { + throw new Error('Currently we support only HTTPS protocol!'); + } + if (parsedURL.filepathtype && parsedURL.filepathtype !== 'tree') { + throw new Error('Please navigate main url of the branch!'); } - const repositoryPath = pluginUrl.split(`${GITHUB_URL}/`)[1]; - const [repositoryOwner, repositoryName] = repositoryPath.split('/'); - return { - repositoryOwner, - repositoryName, + repositoryOwner: parsedURL.owner, + repositoryName: parsedURL.name, + repositoryBranch: !parsedURL.filepathtype + ? 'main' + : `${parsedURL.ref}${parsedURL.filepath ? `/${parsedURL.filepath}` : ''}`, }; } @@ -43,10 +53,15 @@ export function makeExtensionDownloadData( extensionEntryFileName: string, downloadPath: string ) { - const {repositoryOwner, repositoryName} = extractRepositoryOwnerAndNameFromUrl(extensionRepositoryUrl); - const entryFileUrl = `https://raw.githubusercontent.com/${repositoryOwner}/${repositoryName}/main/${extensionEntryFileName}`; - const tarballUrl = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/tarball/main`; - const folderPath = path.join(downloadPath, `${repositoryOwner}-${repositoryName}`); + const {repositoryOwner, repositoryName, repositoryBranch} = + extractRepositoryOwnerAndNameFromUrl(extensionRepositoryUrl); + const entryFileUrl = `https://raw.githubusercontent.com/${repositoryOwner}/${repositoryName}/${repositoryBranch}/${extensionEntryFileName}`; + const tarballUrl = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/tarball/${repositoryBranch}`; + const folderPath = path.join( + downloadPath, + // @ts-ignore + `${repositoryOwner}-${repositoryName}-${repositoryBranch.replaceAll(path.sep, '-')}` + ); return {entryFileUrl, tarballUrl, folderPath}; } diff --git a/package-lock.json b/package-lock.json index 014943cf4b..44450252a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,12 +27,13 @@ "electron-devtools-installer": "3.2.0", "electron-log": "4.4.6", "electron-store": "8.0.1", - "electron-unhandled": "^4.0.0", + "electron-unhandled": "4.0.0", "electron-updater": "4.6.5", "es6-tween": "5.5.11", "execa": "5.1.1", "fast-deep-equal": "3.1.3", "flat": "5.0.2", + "git-url-parse": "11.6.0", "jsonpath-plus": "6.0.1", "lodash": "4.17.21", "loglevel": "1.8.0", @@ -82,6 +83,7 @@ "@trivago/prettier-plugin-sort-imports": "3.1.0", "@types/dagre": "0.7.46", "@types/electron-devtools-installer": "2.2.0", + "@types/git-url-parse": "9.0.1", "@types/jest": "27.0.1", "@types/luxon": "2.0.5", "@types/micromatch": "4.0.2", @@ -4959,6 +4961,12 @@ "@types/node": "*" } }, + "node_modules/@types/git-url-parse": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/git-url-parse/-/git-url-parse-9.0.1.tgz", + "integrity": "sha512-Zf9mY4Mz7N3Nyi341nUkOtgVUQn4j6NS4ndqEha/lOgEbTkHzpD7wZuRagYKzrXNtvawWfsrojoC1nhsQexvNA==", + "dev": true + }, "node_modules/@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -5459,9 +5467,9 @@ } }, "node_modules/@types/yargs-parser": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", - "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, "node_modules/@types/yauzl": { @@ -7779,7 +7787,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -7884,9 +7891,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001312", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz", - "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==", + "version": "1.0.30001313", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001313.tgz", + "integrity": "sha512-rI1UN0koZUiKINjysQDuRi2VeSCce3bYJNmDcj3PIKREiAmjakugBul1QSkg/fPrlULYl6oWfGg3PbgOSY9X4Q==", "dev": true, "funding": { "type": "opencollective", @@ -9917,9 +9924,9 @@ "dev": true }, "node_modules/csstype": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz", - "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==" + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz", + "integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==" }, "node_modules/cyclist": { "version": "1.0.1", @@ -13274,6 +13281,14 @@ "node": ">=8" } }, + "node_modules/filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha1-mzERErxsYSehbgFsbF1/GeCAXFs=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -13799,7 +13814,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -13991,6 +14005,23 @@ "semver": "bin/semver.js" } }, + "node_modules/git-up": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/git-up/-/git-up-4.0.5.tgz", + "integrity": "sha512-YUvVDg/vX3d0syBsk/CKUTib0srcQME0JyHkL5BaYdwLsiCslPWmDSi8PUMo9pXYjrryMcmsCoCgsTpSCJEQaA==", + "dependencies": { + "is-ssh": "^1.3.0", + "parse-url": "^6.0.0" + } + }, + "node_modules/git-url-parse": { + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.6.0.tgz", + "integrity": "sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g==", + "dependencies": { + "git-up": "^4.0.0" + } + }, "node_modules/gitconfiglocal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", @@ -14366,7 +14397,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -15956,6 +15986,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-ssh": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.3.tgz", + "integrity": "sha512-NKzJmQzJfEEma3w5cJNcUMxoXfDjz0Zj0eyCalHn2E6VOwlzjZo0yuO2fcBSf8zhFuVCL/82/r5gRcoi6aEPVQ==", + "dependencies": { + "protocols": "^1.1.0" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -19955,12 +19993,12 @@ } }, "node_modules/magic-string": { - "version": "0.25.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", - "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", "dev": true, "dependencies": { - "sourcemap-codec": "^1.4.4" + "sourcemap-codec": "^1.4.8" } }, "node_modules/make-dir": { @@ -21040,6 +21078,19 @@ "node": ">=0.10.0" } }, + "node_modules/mini-css-extract-plugin/node_modules/query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "dependencies": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -21054,6 +21105,15 @@ "node": ">= 4" } }, + "node_modules/mini-css-extract-plugin/node_modules/strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -21940,7 +22000,6 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -22717,6 +22776,39 @@ "node": ">= 0.10" } }, + "node_modules/parse-path": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/parse-path/-/parse-path-4.0.3.tgz", + "integrity": "sha512-9Cepbp2asKnWTJ9x2kpw6Fe8y9JDbqwahGCTvklzd/cEq5C5JC59x2Xb0Kx+x0QZ8bvNquGO8/BWP0cwBHzSAA==", + "dependencies": { + "is-ssh": "^1.3.0", + "protocols": "^1.4.0", + "qs": "^6.9.4", + "query-string": "^6.13.8" + } + }, + "node_modules/parse-url": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.0.tgz", + "integrity": "sha512-cYyojeX7yIIwuJzledIHeLUBVJ6COVLeT4eF+2P6aKVzwvgKQPndCBv3+yQ7pcWjqToYwaligxzSYNNmGoMAvw==", + "dependencies": { + "is-ssh": "^1.3.0", + "normalize-url": "^6.1.0", + "parse-path": "^4.0.0", + "protocols": "^1.4.0" + } + }, + "node_modules/parse-url/node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", @@ -24886,6 +24978,11 @@ "dev": true, "optional": true }, + "node_modules/protocols": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", + "integrity": "sha512-IgjKyaUSjsROSO8/D49Ab7hP8mJgTYcqApOqdPhLoPxAplXmkp+zRvsrSQjFn5by0rhm4VH0GAUELIPpx7B1yg==" + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -24997,24 +25094,34 @@ } }, "node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dependencies": { + "side-channel": "^1.0.4" + }, "engines": { "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/query-string": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", - "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", - "dev": true, + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.14.1.tgz", + "integrity": "sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw==", "dependencies": { - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/querystring": { @@ -25173,9 +25280,9 @@ } }, "node_modules/rc-cascader": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.2.6.tgz", - "integrity": "sha512-3CmlJP7jPVlP5jT+O3PrP8E9yxees48Na7Hiir84ktcw11pUUU5YawAhuRoSc09SGVvRcP70a9gCu94Hqp3ZwA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.2.7.tgz", + "integrity": "sha512-M8VtKtifTXXo/qqXj63p12tsMNXm1z45Lytj7tu86L6gxIF8keDPcJ16/ZqrhS5JwlBPfoJNA1VooNl/KId15A==", "dependencies": { "@babel/runtime": "^7.12.5", "array-tree-filter": "^2.1.0", @@ -25561,9 +25668,9 @@ } }, "node_modules/rc-tabs": { - "version": "11.10.5", - "resolved": "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.10.5.tgz", - "integrity": "sha512-DDuUdV6b9zGRYLtjI5hyejWLKoz1QiLWNgMeBzc3aMeQylZFhTYnFGdDc6HRqj5IYearNTsFPVSA+6VIT8g5cg==", + "version": "11.10.7", + "resolved": "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.10.7.tgz", + "integrity": "sha512-7IKmcU7QU3CdYnJTabeXs2DDeLiXLyALC8fvOtgyWWFXUD47G5vG+4bFO3f9+AI+rcFAPpfwapZbXxgmiRuWYQ==", "dependencies": { "@babel/runtime": "^7.11.2", "classnames": "2.x", @@ -27248,6 +27355,14 @@ "node": ">= 0.12" } }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "engines": { + "node": ">=0.6" + } + }, "node_modules/request/node_modules/tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -28817,7 +28932,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -29325,6 +29439,14 @@ "node": "*" } }, + "node_modules/split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", + "engines": { + "node": ">=6" + } + }, "node_modules/split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -29756,12 +29878,11 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" }, "node_modules/strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", - "dev": true, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=", "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, "node_modules/string_decoder": { @@ -31451,9 +31572,9 @@ } }, "node_modules/tsconfig-paths": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", - "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.13.0.tgz", + "integrity": "sha512-nWuffZppoaYK0vQ1SQmkSsQzJoHA4s6uzdb2waRpD806x9yfq153AdVsWz4je2qZcW+pENrMQXbGQ3sMCkXuhw==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", @@ -31836,9 +31957,9 @@ } }, "node_modules/unist-util-stringify-position": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.0.tgz", - "integrity": "sha512-SdfAl8fsDclywZpfMDTVDxA2V7LjtRDTOFd44wUJamgl6OlVngsqWjxvermMYf60elWHbxhuRCZml7AnuXCaSA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.2.tgz", + "integrity": "sha512-7A6eiDCs9UtjcwZOcCpM4aPII3bAAGv13E96IkawkOAW0OhH+yRxtY0lzo8KiHpzEMfH7Q+FizUmwp8Iqy5EWg==", "dependencies": { "@types/unist": "^2.0.0" }, @@ -32322,9 +32443,9 @@ "optional": true }, "node_modules/vfile": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.0.tgz", - "integrity": "sha512-Tj44nY/48OQvarrE4FAjUfrv7GZOYzPbl5OD65HxVKwLJKMPU7zmfV8cCgCnzKWnSfYG2f3pxu+ALqs7j22xQQ==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.2.tgz", + "integrity": "sha512-w0PLIugRY3Crkgw89TeMvHCzqCs/zpreR31hl4D92y6SOE07+bfJe+dK5Q2akwS+i/c801kzjoOr9gMcTe6IAA==", "dependencies": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", @@ -32337,9 +32458,9 @@ } }, "node_modules/vfile-message": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.0.tgz", - "integrity": "sha512-4QJbBk+DkPEhBXq3f260xSaWtjE4gPKOfulzfMFF8ZNwaPZieWsg3iVlcmF04+eebzpcpeXOOFMfrYzJHVYg+g==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.2.tgz", + "integrity": "sha512-QjSNP6Yxzyycd4SVOtmKKyTsSvClqBPJcd00Z0zuPj3hOIjg0rUPG6DbFGPvUKRgYyaIWLPKpuEclcuvb3H8qA==", "dependencies": { "@types/unist": "^2.0.0", "unist-util-stringify-position": "^3.0.0" @@ -38204,6 +38325,12 @@ "@types/node": "*" } }, + "@types/git-url-parse": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/git-url-parse/-/git-url-parse-9.0.1.tgz", + "integrity": "sha512-Zf9mY4Mz7N3Nyi341nUkOtgVUQn4j6NS4ndqEha/lOgEbTkHzpD7wZuRagYKzrXNtvawWfsrojoC1nhsQexvNA==", + "dev": true + }, "@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -38700,9 +38827,9 @@ } }, "@types/yargs-parser": { - "version": "20.2.1", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", - "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, "@types/yauzl": { @@ -40535,7 +40662,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -40618,9 +40744,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001312", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz", - "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==", + "version": "1.0.30001313", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001313.tgz", + "integrity": "sha512-rI1UN0koZUiKINjysQDuRi2VeSCce3bYJNmDcj3PIKREiAmjakugBul1QSkg/fPrlULYl6oWfGg3PbgOSY9X4Q==", "dev": true }, "capture-exit": { @@ -42224,9 +42350,9 @@ } }, "csstype": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.10.tgz", - "integrity": "sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==" + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz", + "integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==" }, "cyclist": { "version": "1.0.1", @@ -44810,6 +44936,11 @@ "to-regex-range": "^5.0.1" } }, + "filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha1-mzERErxsYSehbgFsbF1/GeCAXFs=" + }, "finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -45223,7 +45354,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -45364,6 +45494,23 @@ } } }, + "git-up": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/git-up/-/git-up-4.0.5.tgz", + "integrity": "sha512-YUvVDg/vX3d0syBsk/CKUTib0srcQME0JyHkL5BaYdwLsiCslPWmDSi8PUMo9pXYjrryMcmsCoCgsTpSCJEQaA==", + "requires": { + "is-ssh": "^1.3.0", + "parse-url": "^6.0.0" + } + }, + "git-url-parse": { + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.6.0.tgz", + "integrity": "sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g==", + "requires": { + "git-up": "^4.0.0" + } + }, "gitconfiglocal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", @@ -45656,8 +45803,7 @@ "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, "has-tostringtag": { "version": "1.0.0", @@ -46818,6 +46964,14 @@ "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", "dev": true }, + "is-ssh": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.3.tgz", + "integrity": "sha512-NKzJmQzJfEEma3w5cJNcUMxoXfDjz0Zj0eyCalHn2E6VOwlzjZo0yuO2fcBSf8zhFuVCL/82/r5gRcoi6aEPVQ==", + "requires": { + "protocols": "^1.1.0" + } + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -50025,12 +50179,12 @@ "dev": true }, "magic-string": { - "version": "0.25.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", - "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", "dev": true, "requires": { - "sourcemap-codec": "^1.4.4" + "sourcemap-codec": "^1.4.8" } }, "make-dir": { @@ -50743,6 +50897,16 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, "schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", @@ -50753,6 +50917,12 @@ "ajv-errors": "^1.0.0", "ajv-keywords": "^3.1.0" } + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true } } }, @@ -51472,8 +51642,7 @@ "object-inspect": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", - "dev": true + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" }, "object-is": { "version": "1.1.5", @@ -52032,6 +52201,35 @@ "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", "dev": true }, + "parse-path": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/parse-path/-/parse-path-4.0.3.tgz", + "integrity": "sha512-9Cepbp2asKnWTJ9x2kpw6Fe8y9JDbqwahGCTvklzd/cEq5C5JC59x2Xb0Kx+x0QZ8bvNquGO8/BWP0cwBHzSAA==", + "requires": { + "is-ssh": "^1.3.0", + "protocols": "^1.4.0", + "qs": "^6.9.4", + "query-string": "^6.13.8" + } + }, + "parse-url": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.0.tgz", + "integrity": "sha512-cYyojeX7yIIwuJzledIHeLUBVJ6COVLeT4eF+2P6aKVzwvgKQPndCBv3+yQ7pcWjqToYwaligxzSYNNmGoMAvw==", + "requires": { + "is-ssh": "^1.3.0", + "normalize-url": "^6.1.0", + "parse-path": "^4.0.0", + "protocols": "^1.4.0" + }, + "dependencies": { + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" + } + } + }, "parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", @@ -53809,6 +54007,11 @@ "dev": true, "optional": true }, + "protocols": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", + "integrity": "sha512-IgjKyaUSjsROSO8/D49Ab7hP8mJgTYcqApOqdPhLoPxAplXmkp+zRvsrSQjFn5by0rhm4VH0GAUELIPpx7B1yg==" + }, "proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -53911,18 +54114,22 @@ "dev": true }, "qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "requires": { + "side-channel": "^1.0.4" + } }, "query-string": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", - "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", - "dev": true, + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.14.1.tgz", + "integrity": "sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw==", "requires": { - "object-assign": "^4.1.0", - "strict-uri-encode": "^1.0.0" + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" } }, "querystring": { @@ -54048,9 +54255,9 @@ } }, "rc-cascader": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.2.6.tgz", - "integrity": "sha512-3CmlJP7jPVlP5jT+O3PrP8E9yxees48Na7Hiir84ktcw11pUUU5YawAhuRoSc09SGVvRcP70a9gCu94Hqp3ZwA==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.2.7.tgz", + "integrity": "sha512-M8VtKtifTXXo/qqXj63p12tsMNXm1z45Lytj7tu86L6gxIF8keDPcJ16/ZqrhS5JwlBPfoJNA1VooNl/KId15A==", "requires": { "@babel/runtime": "^7.12.5", "array-tree-filter": "^2.1.0", @@ -54316,9 +54523,9 @@ } }, "rc-tabs": { - "version": "11.10.5", - "resolved": "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.10.5.tgz", - "integrity": "sha512-DDuUdV6b9zGRYLtjI5hyejWLKoz1QiLWNgMeBzc3aMeQylZFhTYnFGdDc6HRqj5IYearNTsFPVSA+6VIT8g5cg==", + "version": "11.10.7", + "resolved": "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.10.7.tgz", + "integrity": "sha512-7IKmcU7QU3CdYnJTabeXs2DDeLiXLyALC8fvOtgyWWFXUD47G5vG+4bFO3f9+AI+rcFAPpfwapZbXxgmiRuWYQ==", "requires": { "@babel/runtime": "^7.11.2", "classnames": "2.x", @@ -55557,6 +55764,11 @@ "mime-types": "^2.1.12" } }, + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==" + }, "tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -56815,7 +57027,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -57243,6 +57454,11 @@ "through": "2" } }, + "split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==" + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -57602,10 +57818,9 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" }, "strict-uri-encode": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" }, "string_decoder": { "version": "1.1.1", @@ -58932,9 +59147,9 @@ "dev": true }, "tsconfig-paths": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", - "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.13.0.tgz", + "integrity": "sha512-nWuffZppoaYK0vQ1SQmkSsQzJoHA4s6uzdb2waRpD806x9yfq153AdVsWz4je2qZcW+pENrMQXbGQ3sMCkXuhw==", "dev": true, "requires": { "@types/json5": "^0.0.29", @@ -59225,9 +59440,9 @@ "integrity": "sha512-mgy/zI9fQ2HlbOtTdr2w9lhVaiFUHWQnZrFF2EUoVOqtAUdzqMtNiD99qA5a1IcjWVR8O6aVYE9u7Z2z1v0SQA==" }, "unist-util-stringify-position": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.0.tgz", - "integrity": "sha512-SdfAl8fsDclywZpfMDTVDxA2V7LjtRDTOFd44wUJamgl6OlVngsqWjxvermMYf60elWHbxhuRCZml7AnuXCaSA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.2.tgz", + "integrity": "sha512-7A6eiDCs9UtjcwZOcCpM4aPII3bAAGv13E96IkawkOAW0OhH+yRxtY0lzo8KiHpzEMfH7Q+FizUmwp8Iqy5EWg==", "requires": { "@types/unist": "^2.0.0" } @@ -59620,9 +59835,9 @@ } }, "vfile": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.0.tgz", - "integrity": "sha512-Tj44nY/48OQvarrE4FAjUfrv7GZOYzPbl5OD65HxVKwLJKMPU7zmfV8cCgCnzKWnSfYG2f3pxu+ALqs7j22xQQ==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.2.tgz", + "integrity": "sha512-w0PLIugRY3Crkgw89TeMvHCzqCs/zpreR31hl4D92y6SOE07+bfJe+dK5Q2akwS+i/c801kzjoOr9gMcTe6IAA==", "requires": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", @@ -59631,9 +59846,9 @@ } }, "vfile-message": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.0.tgz", - "integrity": "sha512-4QJbBk+DkPEhBXq3f260xSaWtjE4gPKOfulzfMFF8ZNwaPZieWsg3iVlcmF04+eebzpcpeXOOFMfrYzJHVYg+g==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.2.tgz", + "integrity": "sha512-QjSNP6Yxzyycd4SVOtmKKyTsSvClqBPJcd00Z0zuPj3hOIjg0rUPG6DbFGPvUKRgYyaIWLPKpuEclcuvb3H8qA==", "requires": { "@types/unist": "^2.0.0", "unist-util-stringify-position": "^3.0.0" diff --git a/package.json b/package.json index 5e2ac4cee1..4a5b1a3635 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@trivago/prettier-plugin-sort-imports": "3.1.0", "@types/dagre": "0.7.46", "@types/electron-devtools-installer": "2.2.0", + "@types/git-url-parse": "9.0.1", "@types/jest": "27.0.1", "@types/luxon": "2.0.5", "@types/micromatch": "4.0.2", @@ -100,12 +101,13 @@ "electron-devtools-installer": "3.2.0", "electron-log": "4.4.6", "electron-store": "8.0.1", - "electron-unhandled": "^4.0.0", + "electron-unhandled": "4.0.0", "electron-updater": "4.6.5", "es6-tween": "5.5.11", "execa": "5.1.1", "fast-deep-equal": "3.1.3", "flat": "5.0.2", + "git-url-parse": "11.6.0", "jsonpath-plus": "6.0.1", "lodash": "4.17.21", "loglevel": "1.8.0", diff --git a/src/components/organisms/PluginManager/PluginInstallModal.tsx b/src/components/organisms/PluginManager/PluginInstallModal.tsx index 3a21d2b610..e47d0bb0c5 100644 --- a/src/components/organisms/PluginManager/PluginInstallModal.tsx +++ b/src/components/organisms/PluginManager/PluginInstallModal.tsx @@ -1,8 +1,9 @@ import {ipcRenderer, shell} from 'electron'; -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; -import {Button, Input, Modal} from 'antd'; +import {Button, Form, Input, Modal} from 'antd'; +import {useForm} from 'antd/lib/form/Form'; import {PLUGIN_DOCS_URL} from '@constants/constants'; import {DOWNLOAD_PLUGIN, DOWNLOAD_PLUGIN_RESULT} from '@constants/ipcEvents'; @@ -12,6 +13,8 @@ import {DownloadPluginResult, isDownloadPluginResult} from '@models/extension'; import {useAppDispatch} from '@redux/hooks'; import {addMultipleTemplates, addPlugin} from '@redux/reducers/extension'; +import {useFocus} from '@utils/hooks'; + import Colors from '@styles/Colors'; const downloadPlugin = (pluginUrl: string) => { @@ -35,11 +38,13 @@ const downloadPlugin = (pluginUrl: string) => { function PluginInstallModal(props: {isVisible: boolean; onClose: () => void}) { const dispatch = useAppDispatch(); const {isVisible, onClose} = props; - const [pluginUrl, setPluginUrl] = useState(''); + const [formValues, setFormValues] = useState({pluginUrl: ''}); const [errorMessage, setErrorMessage] = useState(); const [isDownloading, setIsDownloading] = useState(false); + const [pluginForm] = useForm(); + const [inputRef, focus] = useFocus(); - const onClickDownload = async () => { + const download = async (pluginUrl: string) => { try { setIsDownloading(true); const downloadPluginResult = await downloadPlugin(pluginUrl); @@ -60,11 +65,48 @@ function PluginInstallModal(props: {isVisible: boolean; onClose: () => void}) { }; const close = () => { - setPluginUrl(''); + pluginForm.setFields([ + { + name: 'pluginUrl', + value: '', + errors: [], + }, + ]); setIsDownloading(false); onClose(); }; + const handlePluginURLChange = async (url: string) => { + try { + await download(url); + } catch (error: any) { + setErrorMessage(error.message); + } + }; + + const onFinish = async (values: {pluginUrl: string}) => { + setFormValues(values); + await handlePluginURLChange(values.pluginUrl); + }; + + useEffect(() => { + if (isVisible) { + focus(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isVisible]); + + useEffect(() => { + pluginForm.setFields([ + { + name: 'pluginUrl', + value: formValues.pluginUrl, + errors: errorMessage ? [errorMessage] : [], + }, + ]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [errorMessage]); + return ( void}) { , - , ]} @@ -85,12 +127,34 @@ function PluginInstallModal(props: {isVisible: boolean; onClose: () => void}) { See Plugin's documentation for more information.

- setPluginUrl(e.target.value)} /> - {errorMessage && ( -
-

{errorMessage}

-
- )} +
formValues}> + +
Enter the repository/branch url of the plugin you want to add! ie:
+
https://github.com/kubeshop/monokle-default-templates-plugin,
+
https://github.com/kubeshop/monokle-default-templates-plugin/tree/test
+ + ), + overlayInnerStyle: {width: '500px'}, + }} + rules={[ + { + required: true, + message: 'Please provide your plugin URL!', + }, + ]} + > + +
+
); }