From 5fab4f42beff363b3a0607619335595b56efc7e6 Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Wed, 27 Apr 2022 01:03:25 +0900 Subject: [PATCH] fix: use mycloud compatible typescript --- index.ts | 19 +++++++++---------- package.json | 4 ++-- tsconfig.mjs.json | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/index.ts b/index.ts index 82ea028..5c7a074 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,4 @@ -import type { SpawnOptions } from 'child_process' -import { spawn } from 'child_process' +import { spawn, SpawnOptions } from 'child_process' import { mkdir, readFile, writeFile, stat, utimes } from 'fs/promises' import dbg from 'debug' import * as path from 'path' @@ -247,8 +246,8 @@ export class Plugin { readonly name: string readonly path: string - #data: Promise | undefined - #pkg: Promise | undefined + _data: Promise | undefined + _pkg: Promise | undefined constructor (name: string, path: string) { this.name = name @@ -257,21 +256,21 @@ export class Plugin { /* eslint-disable-next-line @typescript-eslint/promise-function-async */ package ({ force }: { force?: boolean } = {}): Promise { - let pkg = this.#pkg + let pkg = this._pkg if (pkg === undefined || force !== true) { pkg = loadPackage(this.name, this.path) - this.#pkg = pkg + this._pkg = pkg } return pkg } /* eslint-disable-next-line @typescript-eslint/promise-function-async */ data (opts?: { force?: boolean }): Promise { - let data = this.#data + let data = this._data if (data === undefined || opts?.force !== true) { /* eslint-disable-next-line @typescript-eslint/promise-function-async */ data = this.package(opts).then(pkg => loadData(this.name, this.path, pkg)) - this.#data = data + this._data = data } return data } @@ -289,8 +288,8 @@ async function prepare ({ tmpDir, names }: { tmpDir: string, names: string[] }): } export async function loadPlugins (plugins: FNOrResult, { tmpDir, maxAge }: { tmpDir?: string, maxAge?: number } = {}): Promise<{ [key: string]: Plugin }> { - tmpDir ??= DEFAULT_TMP_DIR - maxAge ??= DEFAULT_MAX_AGE + tmpDir = tmpDir ?? DEFAULT_TMP_DIR + maxAge = maxAge ?? DEFAULT_MAX_AGE const names = await assertInstalled(plugins, { tmpDir, maxAge }) return await prepare({ tmpDir, names }) } diff --git a/package.json b/package.json index d077983..c879cc7 100644 --- a/package.json +++ b/package.json @@ -22,12 +22,12 @@ "devDependencies": { "@types/debug": "^4.1.7", "@types/node": "^17.0.16", + "aws-sdk": "^2.1001.0", "c8": "^7.11.0", "fresh-tape": "^5.5.3", "ts-node": "^10.5.0", "ts-standard": "^11.0.0", - "typescript": "^4.4.4", - "aws-sdk": "^2.1001.0" + "typescript": "^3.7.7" }, "dependencies": { "debug": "^4.3.3", diff --git a/tsconfig.mjs.json b/tsconfig.mjs.json index 8d46afa..f56cbed 100644 --- a/tsconfig.mjs.json +++ b/tsconfig.mjs.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "module": "es2020", + "module": "esnext", "outDir": "mjs" } } \ No newline at end of file