From 326e6577e142884af600dc5400533e78528240e1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 14 Dec 2021 14:32:27 +0000 Subject: [PATCH] Convert hak to TypeScript (#289) * Convert hak to TypeScript * Fix linter & remove stray log line * Fix more linting errors In one case by switching to import() and hence esnext * Return type for getNodeModuleBin Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> * More types Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintrc.js | 2 +- hak/keytar/{build.js => build.ts} | 13 +- hak/keytar/{check.js => check.ts} | 11 +- hak/keytar/hak.json | 4 +- hak/matrix-seshat/{build.js => build.ts} | 37 ++-- hak/matrix-seshat/{check.js => check.ts} | 15 +- .../{fetchDeps.js => fetchDeps.ts} | 27 +-- hak/matrix-seshat/hak.json | 6 +- hak/tsconfig.json | 17 ++ package.json | 8 +- scripts/hak/{build.js => build.ts} | 7 +- scripts/hak/{check.js => check.ts} | 7 +- scripts/hak/{clean.js => clean.ts} | 22 +-- scripts/hak/{copy.js => copy.ts} | 24 +-- scripts/hak/dep.ts | 32 ++++ scripts/hak/{fetch.js => fetch.ts} | 14 +- scripts/hak/{fetchDeps.js => fetchDeps.ts} | 8 +- scripts/hak/{hakEnv.js => hakEnv.ts} | 61 +++---- scripts/hak/{index.js => index.ts} | 23 ++- scripts/hak/{link.js => link.ts} | 18 +- scripts/hak/target.js | 82 --------- scripts/hak/target.ts | 126 ++++++++++++++ scripts/hak/tsconfig.json | 18 ++ yarn.lock | 163 ++++++++++++++++++ 24 files changed, 522 insertions(+), 223 deletions(-) rename hak/keytar/{build.js => build.ts} (76%) rename hak/keytar/{check.js => check.ts} (78%) rename hak/matrix-seshat/{build.js => build.ts} (89%) rename hak/matrix-seshat/{check.js => check.ts} (87%) rename hak/matrix-seshat/{fetchDeps.js => fetchDeps.ts} (84%) create mode 100644 hak/tsconfig.json rename scripts/hak/{build.js => build.ts} (79%) rename scripts/hak/{check.js => check.ts} (80%) rename scripts/hak/{clean.js => clean.ts} (69%) rename scripts/hak/{copy.js => copy.ts} (85%) create mode 100644 scripts/hak/dep.ts rename scripts/hak/{fetch.js => fetch.ts} (88%) rename scripts/hak/{fetchDeps.js => fetchDeps.ts} (78%) rename scripts/hak/{hakEnv.js => hakEnv.ts} (63%) rename scripts/hak/{index.js => index.ts} (88%) rename scripts/hak/{link.js => link.ts} (86%) delete mode 100644 scripts/hak/target.js create mode 100644 scripts/hak/target.ts create mode 100644 scripts/hak/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index e2277db..007c7bf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,7 +19,7 @@ module.exports = { "no-async-promise-executor": "off", }, overrides: [{ - files: ["src/**/*.{ts,tsx}"], + files: ["{src,scripts,hak}/**/*.{ts,tsx}"], extends: [ "plugin:matrix-org/typescript", ], diff --git a/hak/keytar/build.js b/hak/keytar/build.ts similarity index 76% rename from hak/keytar/build.js rename to hak/keytar/build.ts index 39319ef..4def7b2 100644 --- a/hak/keytar/build.js +++ b/hak/keytar/build.ts @@ -14,18 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const childProcess = require('child_process'); +import path from 'path'; +import childProcess from 'child_process'; -module.exports = async function(hakEnv, moduleInfo) { - await buildKeytar(hakEnv, moduleInfo); -}; +import HakEnv from '../../scripts/hak/hakEnv'; +import { DependencyInfo } from '../../scripts/hak/dep'; -async function buildKeytar(hakEnv, moduleInfo) { +export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { const env = hakEnv.makeGypEnv(); console.log("Running yarn with env", env); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( path.join(moduleInfo.nodeModuleBinDir, 'node-gyp' + (hakEnv.isWin() ? '.cmd' : '')), ['rebuild'], diff --git a/hak/keytar/check.js b/hak/keytar/check.ts similarity index 78% rename from hak/keytar/check.js rename to hak/keytar/check.ts index 8fcb788..b4bbc11 100644 --- a/hak/keytar/check.js +++ b/hak/keytar/check.ts @@ -14,13 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -const childProcess = require('child_process'); +import childProcess from 'child_process'; -module.exports = async function(hakEnv, moduleInfo) { +import HakEnv from '../../scripts/hak/hakEnv'; +import { DependencyInfo } from '../../scripts/hak/dep'; + +export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { const tools = [['python', '--version']]; // node-gyp uses python for reasons beyond comprehension for (const tool of tools) { - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn(tool[0], tool.slice(1), { stdio: ['ignore'], }); @@ -33,4 +36,4 @@ module.exports = async function(hakEnv, moduleInfo) { }); }); } -}; +} diff --git a/hak/keytar/hak.json b/hak/keytar/hak.json index 7597052..792d85d 100644 --- a/hak/keytar/hak.json +++ b/hak/keytar/hak.json @@ -1,7 +1,7 @@ { "scripts": { - "check": "check.js", - "build": "build.js" + "check": "check.ts", + "build": "build.ts" }, "copy": "build/Release/keytar.node", "dependencies": { diff --git a/hak/matrix-seshat/build.js b/hak/matrix-seshat/build.ts similarity index 89% rename from hak/matrix-seshat/build.js rename to hak/matrix-seshat/build.ts index 0468d47..bccb61c 100644 --- a/hak/matrix-seshat/build.js +++ b/hak/matrix-seshat/build.ts @@ -14,13 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const childProcess = require('child_process'); +import path from 'path'; +import childProcess from 'child_process'; -const mkdirp = require('mkdirp'); -const fsExtra = require('fs-extra'); +import mkdirp from 'mkdirp'; +import fsExtra from 'fs-extra'; -module.exports = async function(hakEnv, moduleInfo) { +import HakEnv from '../../scripts/hak/hakEnv'; +import { DependencyInfo } from '../../scripts/hak/dep'; + +export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { if (hakEnv.isWin()) { await buildOpenSslWin(hakEnv, moduleInfo); await buildSqlCipherWin(hakEnv, moduleInfo); @@ -28,7 +31,7 @@ module.exports = async function(hakEnv, moduleInfo) { await buildSqlCipherUnix(hakEnv, moduleInfo); } await buildMatrixSeshat(hakEnv, moduleInfo); -}; +} async function buildOpenSslWin(hakEnv, moduleInfo) { const version = moduleInfo.cfg.dependencies.openssl; @@ -37,15 +40,15 @@ async function buildOpenSslWin(hakEnv, moduleInfo) { const openSslArch = hakEnv.getTargetArch() === 'x64' ? 'VC-WIN64A' : 'VC-WIN32'; console.log("Building openssl in " + openSslDir); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'perl', [ 'Configure', '--prefix=' + moduleInfo.depPrefix, - // sqlcipher only uses about a tiny part of openssl. We link statically - // so will only pull in the symbols we use, but we may as well turn off - // as much as possible to save on build time. + // sqlcipher only uses about a tiny part of openssl. We link statically + // so will only pull in the symbols we use, but we may as well turn off + // as much as possible to save on build time. 'no-afalgeng', 'no-capieng', 'no-cms', @@ -103,7 +106,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'nmake', ['build_libs'], @@ -117,7 +120,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'nmake', ['install_dev'], @@ -139,7 +142,7 @@ async function buildSqlCipherWin(hakEnv, moduleInfo) { await mkdirp(buildDir); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'nmake', ['/f', path.join('..', 'Makefile.msc'), 'libsqlite3.lib', 'TOP=..'], @@ -214,7 +217,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) { args.push(`LDFLAGS=${ldflags.join(' ')}`); } - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( path.join(sqlCipherDir, 'configure'), args, @@ -228,7 +231,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'make', [], @@ -242,7 +245,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( 'make', ['install'], @@ -286,7 +289,7 @@ async function buildMatrixSeshat(hakEnv, moduleInfo) { } console.log("Running neon with env", env); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( path.join(moduleInfo.nodeModuleBinDir, 'neon' + (hakEnv.isWin() ? '.cmd' : '')), ['build', '--release'], diff --git a/hak/matrix-seshat/check.js b/hak/matrix-seshat/check.ts similarity index 87% rename from hak/matrix-seshat/check.js rename to hak/matrix-seshat/check.ts index b2a6afc..d34247f 100644 --- a/hak/matrix-seshat/check.js +++ b/hak/matrix-seshat/check.ts @@ -14,13 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -const childProcess = require('child_process'); -const fsProm = require('fs').promises; +import childProcess from 'child_process'; +import fsProm from 'fs/promises'; -module.exports = async function(hakEnv, moduleInfo) { +import HakEnv from '../../scripts/hak/hakEnv'; +import { DependencyInfo } from '../../scripts/hak/dep'; + +export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { // of course tcl doesn't have a --version if (!hakEnv.isLinux()) { - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn('tclsh', [], { stdio: ['pipe', 'ignore', 'ignore'], }); @@ -48,7 +51,7 @@ module.exports = async function(hakEnv, moduleInfo) { } for (const tool of tools) { - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn(tool[0], tool.slice(1), { stdio: ['ignore'], }); @@ -79,4 +82,4 @@ module.exports = async function(hakEnv, moduleInfo) { rustc.stdin.write('fn main() {}'); rustc.stdin.end(); }); -}; +} diff --git a/hak/matrix-seshat/fetchDeps.js b/hak/matrix-seshat/fetchDeps.ts similarity index 84% rename from hak/matrix-seshat/fetchDeps.js rename to hak/matrix-seshat/fetchDeps.ts index 5054d7b..3a6e085 100644 --- a/hak/matrix-seshat/fetchDeps.js +++ b/hak/matrix-seshat/fetchDeps.ts @@ -14,15 +14,18 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const childProcess = require('child_process'); +import path from 'path'; +import childProcess from 'child_process'; -const fs = require('fs'); -const fsProm = require('fs').promises; -const needle = require('needle'); -const tar = require('tar'); +import fs from 'fs'; +import fsProm from 'fs/promises'; +import needle from 'needle'; +import tar from 'tar'; -module.exports = async function(hakEnv, moduleInfo) { +import HakEnv from '../../scripts/hak/hakEnv'; +import { DependencyInfo } from '../../scripts/hak/dep'; + +export default async function(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { if (!hakEnv.isLinux()) { await getSqlCipher(hakEnv, moduleInfo); } @@ -30,9 +33,9 @@ module.exports = async function(hakEnv, moduleInfo) { if (hakEnv.isWin()) { await getOpenSsl(hakEnv, moduleInfo); } -}; +} -async function getSqlCipher(hakEnv, moduleInfo) { +async function getSqlCipher(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { const version = moduleInfo.cfg.dependencies.sqlcipher; const sqlCipherDir = path.join(moduleInfo.moduleTargetDotHakDir, `sqlcipher-${version}`); @@ -74,8 +77,8 @@ async function getSqlCipher(hakEnv, moduleInfo) { // set it to 2 (default to memory). const patchFile = path.join(moduleInfo.moduleHakDir, `sqlcipher-${version}-win.patch`); - await new Promise((resolve, reject) => { - const readStream = fs.createReadStream(patchFile); + await new Promise((resolve, reject) => { + const readStream = fs.createReadStream(patchFile); const proc = childProcess.spawn( 'patch', @@ -93,7 +96,7 @@ async function getSqlCipher(hakEnv, moduleInfo) { } } -async function getOpenSsl(hakEnv, moduleInfo) { +async function getOpenSsl(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { const version = moduleInfo.cfg.dependencies.openssl; const openSslDir = path.join(moduleInfo.moduleTargetDotHakDir, `openssl-${version}`); diff --git a/hak/matrix-seshat/hak.json b/hak/matrix-seshat/hak.json index 7188570..d6f5adf 100644 --- a/hak/matrix-seshat/hak.json +++ b/hak/matrix-seshat/hak.json @@ -1,8 +1,8 @@ { "scripts": { - "check": "check.js", - "fetchDeps": "fetchDeps.js", - "build": "build.js" + "check": "check.ts", + "fetchDeps": "fetchDeps.ts", + "build": "build.ts" }, "prune": "native", "copy": "native/index.node", diff --git a/hak/tsconfig.json b/hak/tsconfig.json new file mode 100644 index 0000000..46abbda --- /dev/null +++ b/hak/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "esModuleInterop": true, + "target": "es2016", + "sourceMap": false, + "lib": [ + "es2019", + ] + }, + "include": [ + "./**/*.ts" + ], + "ts-node": { + "transpileOnly": true + } +} diff --git a/package.json b/package.json index cf9e407..d74b389 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "lint": "yarn lint:types && yarn lint:js", "lint:js": "eslint --max-warnings 0 src scripts hak", "lint:js-fix": "eslint --fix src scripts hak", - "lint:types": "tsc --noEmit", + "lint:types": "tsc --noEmit && tsc -p scripts/hak/tsconfig.json --noEmit && tsc -p hak/tsconfig.json --noEmit", "build:native": "yarn run hak", "build:native:universal": "yarn run hak --target x86_64-apple-darwin fetchandbuild && yarn run hak --target aarch64-apple-darwin fetchandbuild && yarn run hak --target x86_64-apple-darwin --target aarch64-apple-darwin copyandlink", "build:32": "yarn run build:ts && yarn run build:res && electron-builder --ia32", @@ -37,7 +37,7 @@ "docker:install": "scripts/in-docker.sh yarn install", "debrepo": "scripts/mkrepo.sh", "clean": "rimraf webapp.asar dist packages deploys lib", - "hak": "node scripts/hak/index.js" + "hak": "ts-node scripts/hak/index.ts" }, "dependencies": { "auto-launch": "^5.0.5", @@ -52,6 +52,9 @@ "@types/auto-launch": "^5.0.1", "@types/counterpart": "^0.18.1", "@types/minimist": "^1.2.1", + "@types/mkdirp": "^1.0.2", + "@types/pacote": "^11.1.1", + "@types/rimraf": "^3.0.2", "@typescript-eslint/eslint-plugin": "^5.6.0", "@typescript-eslint/parser": "^5.6.0", "allchange": "^1.0.6", @@ -76,6 +79,7 @@ "pacote": "^11.3.5", "rimraf": "^3.0.2", "tar": "^6.1.2", + "ts-node": "^10.4.0", "typescript": "^4.5.3" }, "hakDependencies": { diff --git a/scripts/hak/build.js b/scripts/hak/build.ts similarity index 79% rename from scripts/hak/build.js rename to scripts/hak/build.ts index da685df..e0a6e09 100644 --- a/scripts/hak/build.js +++ b/scripts/hak/build.ts @@ -14,8 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -async function build(hakEnv, moduleInfo) { +import { DependencyInfo } from "./dep"; +import HakEnv from "./hakEnv"; + +export default async function build(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { await moduleInfo.scripts.build(hakEnv, moduleInfo); } - -module.exports = build; diff --git a/scripts/hak/check.js b/scripts/hak/check.ts similarity index 80% rename from scripts/hak/check.js rename to scripts/hak/check.ts index a9e1ca0..047d5a9 100644 --- a/scripts/hak/check.js +++ b/scripts/hak/check.ts @@ -14,10 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -async function check(hakEnv, moduleInfo) { +import { DependencyInfo } from "./dep"; +import HakEnv from "./hakEnv"; + +export default async function check(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { if (moduleInfo.scripts.check) { await moduleInfo.scripts.check(hakEnv, moduleInfo); } } - -module.exports = check; diff --git a/scripts/hak/clean.js b/scripts/hak/clean.ts similarity index 69% rename from scripts/hak/clean.js rename to scripts/hak/clean.ts index 9a15a21..96e4489 100644 --- a/scripts/hak/clean.js +++ b/scripts/hak/clean.ts @@ -14,13 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); +import path from 'path'; -const rimraf = require('rimraf'); +import rimraf from 'rimraf'; +import { DependencyInfo } from './dep'; +import HakEnv from './hakEnv'; -async function clean(hakEnv, moduleInfo) { - await new Promise((resolve, reject) => { - rimraf(moduleInfo.moduleDotHakDir, (err) => { +export default async function clean(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { + await new Promise((resolve, reject) => { + rimraf(moduleInfo.moduleDotHakDir, (err: Error) => { if (err) { reject(err); } else { @@ -29,8 +31,8 @@ async function clean(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { - rimraf(path.join(hakEnv.dotHakDir, 'links', moduleInfo.name), (err) => { + await new Promise((resolve, reject) => { + rimraf(path.join(hakEnv.dotHakDir, 'links', moduleInfo.name), (err: Error) => { if (err) { reject(err); } else { @@ -39,8 +41,8 @@ async function clean(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { - rimraf(path.join(hakEnv.projectRoot, 'node_modules', moduleInfo.name), (err) => { + await new Promise((resolve, reject) => { + rimraf(path.join(hakEnv.projectRoot, 'node_modules', moduleInfo.name), (err: Error) => { if (err) { reject(err); } else { @@ -49,5 +51,3 @@ async function clean(hakEnv, moduleInfo) { }); }); } - -module.exports = clean; diff --git a/scripts/hak/copy.js b/scripts/hak/copy.ts similarity index 85% rename from scripts/hak/copy.js rename to scripts/hak/copy.ts index fa9678a..7596705 100644 --- a/scripts/hak/copy.js +++ b/scripts/hak/copy.ts @@ -14,15 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const fsProm = require('fs').promises; -const childProcess = require('child_process'); +import path from 'path'; +import fsProm from 'fs/promises'; +import childProcess from 'child_process'; -const rimraf = require('rimraf'); -const glob = require('glob'); -const mkdirp = require('mkdirp'); +import rimraf from 'rimraf'; +import glob from 'glob'; +import mkdirp from 'mkdirp'; +import HakEnv from './hakEnv'; +import { DependencyInfo } from './dep'; -async function copy(hakEnv, moduleInfo) { +export default async function copy(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { if (moduleInfo.cfg.prune) { console.log("Removing " + moduleInfo.cfg.prune + " from " + moduleInfo.moduleOutDir); // rimraf doesn't have a 'cwd' option: it always uses process.cwd() @@ -30,7 +32,7 @@ async function copy(hakEnv, moduleInfo) { const oldCwd = process.cwd(); try { process.chdir(moduleInfo.moduleOutDir); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { rimraf(moduleInfo.cfg.prune, {}, err => { err ? reject(err) : resolve(); }); @@ -44,7 +46,7 @@ async function copy(hakEnv, moduleInfo) { // If there are multiple moduleBuildDirs, singular moduleBuildDir // is the same as moduleBuildDirs[0], so we're just listing the contents // of the first one. - const files = await new Promise(async (resolve, reject) => { + const files = await new Promise((resolve, reject) => { glob(moduleInfo.cfg.copy, { nosort: true, silent: true, @@ -68,7 +70,7 @@ async function copy(hakEnv, moduleInfo) { const dst = path.join(moduleInfo.moduleOutDir, f); await mkdirp(path.dirname(dst)); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { childProcess.execFile('lipo', ['-create', '-output', dst, ...components], (err) => { if (err) { @@ -96,5 +98,3 @@ async function copy(hakEnv, moduleInfo) { } } } - -module.exports = copy; diff --git a/scripts/hak/dep.ts b/scripts/hak/dep.ts new file mode 100644 index 0000000..5c725a7 --- /dev/null +++ b/scripts/hak/dep.ts @@ -0,0 +1,32 @@ +/* +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import HakEnv from "./hakEnv"; + +export interface DependencyInfo { + name: string; + version: string; + cfg: Record; + moduleHakDir: string; + moduleDotHakDir: string; + moduleTargetDotHakDir: string; + moduleBuildDir: string; + moduleBuildDirs: string[]; + moduleOutDir: string; + nodeModuleBinDir: string; + depPrefix: string; + scripts: Record Promise >; +} diff --git a/scripts/hak/fetch.js b/scripts/hak/fetch.ts similarity index 88% rename from scripts/hak/fetch.js rename to scripts/hak/fetch.ts index 694c0da..b8ff0bf 100644 --- a/scripts/hak/fetch.js +++ b/scripts/hak/fetch.ts @@ -14,12 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -const fsProm = require('fs').promises; -const childProcess = require('child_process'); +import fsProm from 'fs/promises'; +import childProcess from 'child_process'; -const pacote = require('pacote'); +import pacote from 'pacote'; +import HakEnv from './hakEnv'; +import { DependencyInfo } from './dep'; -async function fetch(hakEnv, moduleInfo) { +export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { let haveModuleBuildDir; try { const stats = await fsProm.stat(moduleInfo.moduleBuildDir); @@ -38,7 +40,7 @@ async function fetch(hakEnv, moduleInfo) { }); console.log("Running yarn install in " + moduleInfo.moduleBuildDir); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn( hakEnv.isWin() ? 'yarn.cmd' : 'yarn', ['install', '--ignore-scripts'], @@ -66,5 +68,3 @@ async function fetch(hakEnv, moduleInfo) { packumentCache, }); } - -module.exports = fetch; diff --git a/scripts/hak/fetchDeps.js b/scripts/hak/fetchDeps.ts similarity index 78% rename from scripts/hak/fetchDeps.js rename to scripts/hak/fetchDeps.ts index 90aba8e..cb1a189 100644 --- a/scripts/hak/fetchDeps.js +++ b/scripts/hak/fetchDeps.ts @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -const mkdirp = require('mkdirp'); +import mkdirp from 'mkdirp'; +import { DependencyInfo } from './dep'; +import HakEnv from './hakEnv'; -async function fetchDeps(hakEnv, moduleInfo) { +export default async function fetchDeps(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { await mkdirp(moduleInfo.moduleDotHakDir); if (moduleInfo.scripts.fetchDeps) { await moduleInfo.scripts.fetchDeps(hakEnv, moduleInfo); } } - -module.exports = fetchDeps; diff --git a/scripts/hak/hakEnv.js b/scripts/hak/hakEnv.ts similarity index 63% rename from scripts/hak/hakEnv.js rename to scripts/hak/hakEnv.ts index 9b7f69b..e9158b4 100644 --- a/scripts/hak/hakEnv.js +++ b/scripts/hak/hakEnv.ts @@ -14,21 +14,21 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const os = require('os'); +import path from 'path'; +import os from 'os'; -const nodePreGypVersioning = require('node-pre-gyp/lib/util/versioning'); -const getElectronVersion = require('app-builder-lib/out/electron/electronVersion').getElectronVersion; +import nodePreGypVersioning from "node-pre-gyp/lib/util/versioning"; +import { getElectronVersion } from "app-builder-lib/out/electron/electronVersion"; -const { TARGETS, getHost, isHostId } = require('./target'); +import { Arch, Target, TARGETS, getHost, isHostId, TargetId } from './target'; -function getRuntime(projectRoot) { - const electronVersion = getElectronVersion(projectRoot); +async function getRuntime(projectRoot: string): Promise { + const electronVersion = await getElectronVersion(projectRoot); return electronVersion ? 'electron' : 'node-webkit'; } -function getRuntimeVersion(projectRoot) { - const electronVersion = getElectronVersion(projectRoot); +async function getRuntimeVersion(projectRoot: string): Promise { + const electronVersion = await getElectronVersion(projectRoot); if (electronVersion) { return electronVersion; } else { @@ -36,8 +36,14 @@ function getRuntimeVersion(projectRoot) { } } -module.exports = class HakEnv { - constructor(prefix, targetId) { +export default class HakEnv { + public target: Target; + public projectRoot: string; + public runtime: string; + public runtimeVersion: string; + public dotHakDir: string; + + constructor(prefix: string, targetId: TargetId) { let target; if (targetId) { target = TARGETS[targetId]; @@ -50,20 +56,15 @@ module.exports = class HakEnv { } this.target = target; this.projectRoot = prefix; + this.dotHakDir = path.join(this.projectRoot, '.hak'); } async init() { - Object.assign(this, { - // what we're targeting - runtime: await getRuntime(this.projectRoot), - runtimeVersion: await getRuntimeVersion(this.projectRoot), - - // paths - dotHakDir: path.join(this.projectRoot, '.hak'), - }); + this.runtime = await getRuntime(this.projectRoot); + this.runtimeVersion = await getRuntimeVersion(this.projectRoot); } - getRuntimeAbi() { + getRuntimeAbi(): string { return nodePreGypVersioning.get_runtime_abi( this.runtime, this.runtimeVersion, @@ -71,35 +72,35 @@ module.exports = class HakEnv { } // {node_abi}-{platform}-{arch} - getNodeTriple() { + getNodeTriple(): string { return this.getRuntimeAbi() + '-' + this.target.platform + '-' + this.target.arch; } - getTargetId() { + getTargetId(): TargetId { return this.target.id; } - isWin() { + isWin(): boolean { return this.target.platform === 'win32'; } - isMac() { + isMac(): boolean { return this.target.platform === 'darwin'; } - isLinux() { + isLinux(): boolean { return this.target.platform === 'linux'; } - getTargetArch() { + getTargetArch(): Arch { return this.target.arch; } - isHost() { + isHost(): boolean { return isHostId(this.target.id); } - makeGypEnv() { + makeGypEnv(): Record { return Object.assign({}, process.env, { npm_config_arch: this.target.arch, npm_config_target_arch: this.target.arch, @@ -111,7 +112,7 @@ module.exports = class HakEnv { }); } - getNodeModuleBin(name) { + getNodeModuleBin(name: string): string { return path.join(this.projectRoot, 'node_modules', '.bin', name); } -}; +} diff --git a/scripts/hak/index.js b/scripts/hak/index.ts similarity index 88% rename from scripts/hak/index.js rename to scripts/hak/index.ts index df499d7..87bf131 100644 --- a/scripts/hak/index.js +++ b/scripts/hak/index.ts @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); +import path from 'path'; -const findNpmPrefix = require('find-npm-prefix'); +import findNpmPrefix from 'find-npm-prefix'; -const HakEnv = require('./hakEnv'); +import HakEnv from './hakEnv'; +import { TargetId } from './target'; +import { DependencyInfo } from './dep'; const GENERALCOMMANDS = [ 'target', @@ -60,7 +62,7 @@ async function main() { process.exit(1); } - const targetIds = []; + const targetIds = [] as TargetId[]; // Apply `--target ` option if specified // Can be specified multiple times for the copy command to bundle // multiple archs into a single universal output module) @@ -73,7 +75,7 @@ async function main() { process.exit(1); } // Extract target ID and remove from args - targetIds.push(process.argv.splice(targetIndex, 2)[1]); + targetIds.push(process.argv.splice(targetIndex, 2)[1] as TargetId); } const hakEnvs = targetIds.map(tid => new HakEnv(prefix, tid)); @@ -83,7 +85,7 @@ async function main() { } const hakEnv = hakEnvs[0]; - const deps = {}; + const deps = {} as Record; const hakDepsCfg = packageJson.hakDependencies || {}; @@ -114,7 +116,12 @@ async function main() { for (const s of HAKSCRIPTS) { if (hakJson.scripts && hakJson.scripts[s]) { - deps[dep].scripts[s] = require(path.join(prefix, 'hak', dep, hakJson.scripts[s])); + const scriptModule = await import(path.join(prefix, 'hak', dep, hakJson.scripts[s])); + if (scriptModule.__esModule) { + deps[dep].scripts[s] = scriptModule.default; + } else { + deps[dep].scripts[s] = scriptModule; + } } } } @@ -154,7 +161,7 @@ async function main() { process.exit(1); } - const cmdFunc = require('./' + cmd); + const cmdFunc = (await import('./' + cmd)).default; for (const mod of modules) { const depInfo = deps[mod]; diff --git a/scripts/hak/link.js b/scripts/hak/link.ts similarity index 86% rename from scripts/hak/link.js rename to scripts/hak/link.ts index db92920..6fe7006 100644 --- a/scripts/hak/link.js +++ b/scripts/hak/link.ts @@ -14,12 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const os = require('os'); -const fsProm = require('fs').promises; -const childProcess = require('child_process'); +import path from 'path'; +import os from 'os'; +import fsProm from 'fs/promises'; +import childProcess from 'child_process'; +import HakEnv from './hakEnv'; +import { DependencyInfo } from './dep'; -async function link(hakEnv, moduleInfo) { +export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise { const yarnrc = path.join(hakEnv.projectRoot, '.yarnrc'); // this is fairly terrible but it's reasonably clunky to either parse a yarnrc // properly or get yarn to do it, so this will probably suffice for now. @@ -46,7 +48,7 @@ async function link(hakEnv, moduleInfo) { const yarnCmd = 'yarn' + (hakEnv.isWin() ? '.cmd' : ''); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn(yarnCmd, ['link'], { cwd: moduleInfo.moduleOutDir, stdio: 'inherit', @@ -56,7 +58,7 @@ async function link(hakEnv, moduleInfo) { }); }); - await new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { const proc = childProcess.spawn(yarnCmd, ['link', moduleInfo.name], { cwd: hakEnv.projectRoot, stdio: 'inherit', @@ -66,5 +68,3 @@ async function link(hakEnv, moduleInfo) { }); }); } - -module.exports = link; diff --git a/scripts/hak/target.js b/scripts/hak/target.js deleted file mode 100644 index 0a965fc..0000000 --- a/scripts/hak/target.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; -/* -Copyright 2021 The Matrix.org Foundation C.I.C. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* - * THIS FILE IS GENERATED, NOT MEANT FOR EDITING DIRECTLY - * The original source is `target.ts` in the `element-builder` repo. You can - * edit it over there, run `yarn build`, and paste the changes here. It is - * currently assumed this file will rarely change, so a spearate package is not - * yet warranted. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isHost = exports.isHostId = exports.getHost = exports.ENABLED_TARGETS = exports.TARGETS = void 0; -const aarch64AppleDarwin = { - id: 'aarch64-apple-darwin', - platform: 'darwin', - arch: 'arm64', -}; -const i686PcWindowsMsvc = { - id: 'i686-pc-windows-msvc', - platform: 'win32', - arch: 'ia32', - vcVarsArch: 'x86', -}; -const x8664PcWindowsMsvc = { - id: 'x86_64-pc-windows-msvc', - platform: 'win32', - arch: 'x64', - vcVarsArch: 'amd64', -}; -const x8664AppleDarwin = { - id: 'x86_64-apple-darwin', - platform: 'darwin', - arch: 'x64', -}; -const x8664UnknownLinuxGnu = { - id: 'x86_64-unknown-linux-gnu', - platform: 'linux', - arch: 'x64', -}; -exports.TARGETS = { - 'aarch64-apple-darwin': aarch64AppleDarwin, - 'i686-pc-windows-msvc': i686PcWindowsMsvc, - 'x86_64-pc-windows-msvc': x8664PcWindowsMsvc, - 'x86_64-apple-darwin': x8664AppleDarwin, - 'x86_64-unknown-linux-gnu': x8664UnknownLinuxGnu, -}; -// The set of targets we build by default, sorted by increasing complexity so -// that we fail fast when the native host target fails. -exports.ENABLED_TARGETS = [ - exports.TARGETS['x86_64-apple-darwin'], - exports.TARGETS['aarch64-apple-darwin'], - exports.TARGETS['x86_64-unknown-linux-gnu'], - exports.TARGETS['i686-pc-windows-msvc'], -]; -function getHost() { - return Object.values(exports.TARGETS).find(target => (target.platform === process.platform && - target.arch === process.arch)); -} -exports.getHost = getHost; -function isHostId(id) { - return getHost()?.id === id; -} -exports.isHostId = isHostId; -function isHost(target) { - return getHost()?.id === target.id; -} -exports.isHost = isHost; diff --git a/scripts/hak/target.ts b/scripts/hak/target.ts new file mode 100644 index 0000000..50554fa --- /dev/null +++ b/scripts/hak/target.ts @@ -0,0 +1,126 @@ +/* +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// We borrow Rust's target naming scheme as a way of expressing all target +// details in a single string. +// See https://doc.rust-lang.org/rustc/platform-support.html. +export type TargetId = + 'aarch64-apple-darwin' | + 'x86_64-apple-darwin' | + 'universal-apple-darwin' | + 'i686-pc-windows-msvc' | + 'x86_64-pc-windows-msvc' | + 'x86_64-unknown-linux-gnu'; + +// Values are expected to match those used in `process.platform`. +export type Platform = 'darwin' | 'linux' | 'win32'; + +// Values are expected to match those used in `process.arch`. +export type Arch = 'arm64' | 'ia32' | 'x64' | 'universal'; + +// Values are expected to match those used by Visual Studio's `vcvarsall.bat`. +// See https://docs.microsoft.com/cpp/build/building-on-the-command-line?view=msvc-160#vcvarsall-syntax +export type VcVarsArch = 'amd64' | 'arm64' | 'x86'; + +export type Target = { + id: TargetId; + platform: Platform; + arch: Arch; +}; + +export type WindowsTarget = Target & { + platform: 'win32'; + vcVarsArch: VcVarsArch; +}; + +export type UniversalTarget = Target & { + arch: 'universal'; + subtargets: Target[]; +}; + +const aarch64AppleDarwin: Target = { + id: 'aarch64-apple-darwin', + platform: 'darwin', + arch: 'arm64', +}; + +const x8664AppleDarwin: Target = { + id: 'x86_64-apple-darwin', + platform: 'darwin', + arch: 'x64', +}; + +const universalAppleDarwin: UniversalTarget = { + id: 'universal-apple-darwin', + platform: 'darwin', + arch: 'universal', + subtargets: [ + aarch64AppleDarwin, + x8664AppleDarwin, + ], +}; + +const i686PcWindowsMsvc: WindowsTarget = { + id: 'i686-pc-windows-msvc', + platform: 'win32', + arch: 'ia32', + vcVarsArch: 'x86', +}; + +const x8664PcWindowsMsvc: WindowsTarget = { + id: 'x86_64-pc-windows-msvc', + platform: 'win32', + arch: 'x64', + vcVarsArch: 'amd64', +}; + +const x8664UnknownLinuxGnu: Target = { + id: 'x86_64-unknown-linux-gnu', + platform: 'linux', + arch: 'x64', +}; + +export const TARGETS: Record = { + 'aarch64-apple-darwin': aarch64AppleDarwin, + 'x86_64-apple-darwin': x8664AppleDarwin, + 'universal-apple-darwin': universalAppleDarwin, + 'i686-pc-windows-msvc': i686PcWindowsMsvc, + 'x86_64-pc-windows-msvc': x8664PcWindowsMsvc, + 'x86_64-unknown-linux-gnu': x8664UnknownLinuxGnu, +}; + +// The set of targets we build by default, sorted by increasing complexity so +// that we fail fast when the native host target fails. +export const ENABLED_TARGETS: Target[] = [ + TARGETS['universal-apple-darwin'], + TARGETS['x86_64-unknown-linux-gnu'], + TARGETS['x86_64-pc-windows-msvc'], +]; + +export function getHost(): Target { + return Object.values(TARGETS).find(target => ( + target.platform === process.platform && + target.arch === process.arch + )); +} + +export function isHostId(id: TargetId): boolean { + return getHost()?.id === id; +} + +export function isHost(target: Target): boolean { + return getHost()?.id === target.id; +} diff --git a/scripts/hak/tsconfig.json b/scripts/hak/tsconfig.json new file mode 100644 index 0000000..b397e79 --- /dev/null +++ b/scripts/hak/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "esModuleInterop": true, + "target": "es2016", + "module": "esnext", + "sourceMap": false, + "lib": [ + "es2019", + ] + }, + "include": [ + "./**/*.ts" + ], + "ts-node": { + "transpileOnly": true + } +} diff --git a/yarn.lock b/yarn.lock index 7948626..d435997 100644 --- a/yarn.lock +++ b/yarn.lock @@ -133,6 +133,18 @@ "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" +"@cspotcode/source-map-consumer@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" + integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== + +"@cspotcode/source-map-support@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" + integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== + dependencies: + "@cspotcode/source-map-consumer" "0.8.0" + "@develar/schema-utils@~2.6.5": version "2.6.5" resolved "https://registry.yarnpkg.com/@develar/schema-utils/-/schema-utils-2.6.5.tgz#3ece22c5838402419a6e0425f85742b961d9b6c6" @@ -700,6 +712,26 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== +"@tsconfig/node10@^1.0.7": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== + +"@tsconfig/node12@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== + +"@tsconfig/node14@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== + +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== + "@types/auto-launch@^5.0.1": version "5.0.2" resolved "https://registry.yarnpkg.com/@types/auto-launch/-/auto-launch-5.0.2.tgz#4970f01e5dd27572489b7fe77590204a19f86bd0" @@ -724,6 +756,14 @@ dependencies: "@types/node" "*" +"@types/glob@*": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" + integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/glob@^7.1.1": version "7.1.4" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.4.tgz#ea59e21d2ee5c517914cb4bc8e4153b99e566672" @@ -747,11 +787,26 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== +"@types/mkdirp@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.2.tgz#8d0bad7aa793abe551860be1f7ae7f3198c16666" + integrity sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ== + dependencies: + "@types/node" "*" + "@types/ms@*": version "0.7.31" resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== +"@types/node-fetch@^2.5.12": + version "2.5.12" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66" + integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + "@types/node@*": version "16.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708" @@ -767,6 +822,37 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.0.tgz#98df2397f6936bfbff4f089e40e06fa5dd88d32a" integrity sha512-0GeIl2kmVMXEnx8tg1SlG6Gg8vkqirrW752KqolYo1PHevhhZN3bhJ67qHj+bQaINhX0Ra3TlWwRvMCd9iEfNQ== +"@types/npm-package-arg@*": + version "6.1.1" + resolved "https://registry.yarnpkg.com/@types/npm-package-arg/-/npm-package-arg-6.1.1.tgz#9e2d8adc04d39824a3d9f36f738010a3f7da3c1a" + integrity sha512-452/1Kp9IdM/oR10AyqAgZOxUt7eLbm+EMJ194L6oarMYdZNiFIFAOJ7IIr0OrZXTySgfHjJezh2oiyk2kc3ag== + +"@types/npm-registry-fetch@*": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@types/npm-registry-fetch/-/npm-registry-fetch-8.0.2.tgz#afbc42f2c45785e723cb550e935ec7f82265821d" + integrity sha512-ps8VPCldQJhWXKrM4FYv+X5e2CGTKciHcCFAS+QTjEuP5JX9K6BZ2q/YF/vv7wy+krfJmHbDj0l6AwDcjRIeHA== + dependencies: + "@types/node" "*" + "@types/node-fetch" "^2.5.12" + "@types/npm-package-arg" "*" + "@types/npmlog" "*" + "@types/ssri" "*" + +"@types/npmlog@*": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@types/npmlog/-/npmlog-4.1.3.tgz#9c24b49a97e25cf15a890ff404764080d7942132" + integrity sha512-1TcL7YDYCtnHmLhTWbum+IIwLlvpaHoEKS2KNIngEwLzwgDeHaebaEHHbQp8IqzNQ9IYiboLKUjAf7MZqG63+w== + +"@types/pacote@^11.1.1": + version "11.1.1" + resolved "https://registry.yarnpkg.com/@types/pacote/-/pacote-11.1.1.tgz#74b902bdf99a2e0763a84774f7cb00b8dc8443bd" + integrity sha512-ycBhPpDuNb5hwvWQJFaLyGspdWXkpqBOcGyWclC+hQfMvZt/13aXIt5vx5b+wx4lJd8n0ROZEPMCt6C9uGP0ag== + dependencies: + "@types/node" "*" + "@types/npm-registry-fetch" "*" + "@types/npmlog" "*" + "@types/ssri" "*" + "@types/plist@^3.0.1": version "3.0.2" resolved "https://registry.yarnpkg.com/@types/plist/-/plist-3.0.2.tgz#61b3727bba0f5c462fe333542534a0c3e19ccb01" @@ -775,6 +861,21 @@ "@types/node" "*" xmlbuilder ">=11.0.1" +"@types/rimraf@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.2.tgz#a63d175b331748e5220ad48c901d7bbf1f44eef8" + integrity sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ== + dependencies: + "@types/glob" "*" + "@types/node" "*" + +"@types/ssri@*": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/ssri/-/ssri-7.1.1.tgz#2a2c94abf0d3a8c3b07bb4ff08142dd571407bb5" + integrity sha512-DPP/jkDaqGiyU75MyMURxLWyYLwKSjnAuGe9ZCsLp9QZOpXmDfuevk769F0BS86TmRuD5krnp06qw9nSoNO+0g== + dependencies: + "@types/node" "*" + "@types/verror@^1.10.3": version "1.10.5" resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.5.tgz#2a1413aded46e67a1fe2386800e291123ed75eb1" @@ -872,11 +973,21 @@ acorn-jsx@^5.3.1: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== +acorn@^8.4.1: + version "8.6.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.6.0.tgz#e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895" + integrity sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw== + agent-base@6, agent-base@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -1116,6 +1227,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1753,6 +1869,11 @@ crc@^3.8.0: dependencies: buffer "^5.1.0" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -1886,6 +2007,11 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dir-compare@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/dir-compare/-/dir-compare-2.4.0.tgz#785c41dc5f645b34343a4eafc50b79bac7f11631" @@ -2489,6 +2615,15 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -3363,6 +3498,11 @@ make-dir@^3.0.0, make-dir@^3.1.0: dependencies: semver "^6.0.0" +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + make-fetch-happen@^9.0.1: version "9.1.0" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz#53085a09e7971433e6765f7971bf63f4e05cb968" @@ -4725,6 +4865,24 @@ truncate-utf8-bytes@^1.0.0: dependencies: utf8-byte-length "^1.0.1" +ts-node@^10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" + integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== + dependencies: + "@cspotcode/source-map-support" "0.7.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + yn "3.1.1" + tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -5096,6 +5254,11 @@ yauzl@^2.10.0: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + zip-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79"