mirror of git3://git3.w3q/git3-cli
parent
5f956a76c9
commit
e974f4693a
File diff suppressed because one or more lines are too long
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
gateways: [
|
||||
"https://ipfs.io/ipfs/",
|
||||
"https://cloudflare-ipfs.com/ipfs/",
|
||||
"https://ipfs.fleek.co/ipfs/",
|
||||
"https://gateway.ipfs.io/ipfs/",
|
||||
],
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
const ns: Record<string, any> = {
|
||||
"eth": {
|
||||
"chainId": 1,
|
||||
"resolver": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
||||
eth: {
|
||||
chainId: 1,
|
||||
resolver: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
|
||||
},
|
||||
w3q: {
|
||||
chainId: 3334,
|
||||
resolver: "0x076B3e04dd300De7db95Ba3F5db1eD31f3139aE0",
|
||||
},
|
||||
fvm: {
|
||||
chainId: 3141,
|
||||
resolver: "",
|
||||
},
|
||||
"w3q": {
|
||||
"chainId": 3334,
|
||||
"resolver": "0x076B3e04dd300De7db95Ba3F5db1eD31f3139aE0"
|
||||
}
|
||||
}
|
||||
|
||||
export default ns;
|
||||
export default ns
|
||||
|
@ -0,0 +1,175 @@
|
||||
import { Ref, Status, Storage } from "./storage.js"
|
||||
import { getWallet } from "../wallet/index.js"
|
||||
import { TxManager } from "../wallet/tx-manager.js"
|
||||
import { ethers, Signer } from "ethers"
|
||||
import { NonceManager } from "@ethersproject/experimental"
|
||||
import abis from "../config/abis.js"
|
||||
import network from "../config/evm-network.js"
|
||||
import ipfsConf from "../config/ipfs.js"
|
||||
import axios from "axios"
|
||||
|
||||
export class SLIStorage implements Storage {
|
||||
repoName: string
|
||||
wallet: Signer
|
||||
contract: ethers.Contract
|
||||
provider: ethers.providers.JsonRpcProvider
|
||||
auth: string
|
||||
|
||||
txManager: TxManager
|
||||
|
||||
constructor(
|
||||
repoName: string,
|
||||
chainId: number,
|
||||
options: { git3Address: string | null; sender: string | null }
|
||||
) {
|
||||
let net = network[chainId]
|
||||
if (!net) throw new Error("chainId not supported")
|
||||
|
||||
this.repoName = repoName
|
||||
this.wallet = getWallet(options.sender)
|
||||
|
||||
let rpc = net.rpc[Math.floor(Math.random() * net.rpc.length)] //random get rpc
|
||||
|
||||
this.provider = new ethers.providers.JsonRpcProvider(rpc)
|
||||
this.wallet = this.wallet.connect(this.provider)
|
||||
// this.wallet = new NonceManager(this.wallet)
|
||||
|
||||
let repoAddress = options.git3Address || net.contracts.git3
|
||||
this.contract = new ethers.Contract(
|
||||
repoAddress,
|
||||
abis.SLIStorage,
|
||||
this.wallet
|
||||
)
|
||||
this.auth =
|
||||
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweGFEQTdCOWFlQTdGNTc2ZDI5NzM0ZWUxY0Q2ODVFMzc2OWNCM2QwRDEiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY3NTQ5NDYwMDkzMiwibmFtZSI6ImZ2bS1oYWNrc29uIn0.YBqfsj_LTZSJPKc0OH586avnQNqove_Htzl5rrToXTk"
|
||||
|
||||
this.txManager = new TxManager(this.contract, chainId, net.txConst)
|
||||
}
|
||||
|
||||
async repoRoles(): Promise<string[]> {
|
||||
let owner = await this.contract.repoNameToOwner(
|
||||
Buffer.from(this.repoName)
|
||||
)
|
||||
if (owner === ethers.constants.AddressZero) return []
|
||||
return [owner]
|
||||
}
|
||||
|
||||
async hasPermission(ref: string): Promise<boolean> {
|
||||
let member = await this.repoRoles()
|
||||
return member.indexOf(await this.wallet.getAddress()) >= 0
|
||||
}
|
||||
|
||||
async download(path: string): Promise<[Status, Buffer]> {
|
||||
const res = await this.contract.download(
|
||||
Buffer.from(this.repoName),
|
||||
Buffer.from(path)
|
||||
)
|
||||
const buffer = Buffer.from(res[0].slice(2), "hex")
|
||||
console.error("buffer", buffer, buffer.toString(), res[0])
|
||||
const cid = buffer.toString("utf8")
|
||||
for (let i = 0; i < ipfsConf.gateways.length; i++) {
|
||||
let gateway =
|
||||
ipfsConf.gateways[
|
||||
Math.floor(Math.random() * ipfsConf.gateways.length)
|
||||
] //random get rpc
|
||||
try {
|
||||
let response = await axios.get(gateway + cid)
|
||||
if (response.status === 200) {
|
||||
console.error(`=== download file ${path} succeed ===`)
|
||||
return [Status.SUCCEED, Buffer.from(response.data)]
|
||||
}
|
||||
} catch (e) {
|
||||
//pass
|
||||
}
|
||||
}
|
||||
|
||||
console.error(`=== download file ${cid} failed ===`)
|
||||
// console.error(buffer.toString('utf-8'))
|
||||
return [Status.FAILED, Buffer.from("")]
|
||||
}
|
||||
|
||||
async upload(path: string, file: Buffer): Promise<Status> {
|
||||
try {
|
||||
console.error(`=== uploading file ${path} ===`)
|
||||
const cid = await this.storeIPFS(file)
|
||||
await this.txManager.SendCall("upload", [
|
||||
Buffer.from(this.repoName),
|
||||
Buffer.from(path),
|
||||
Buffer.from(cid),
|
||||
])
|
||||
console.error(`=== upload ${path} ${cid} succeed ===`)
|
||||
|
||||
return Status.SUCCEED
|
||||
} catch (error: any) {
|
||||
this.txManager.CancelAll()
|
||||
console.error(`upload failed: ${error}`)
|
||||
return Status.FAILED
|
||||
}
|
||||
}
|
||||
|
||||
remove(path: string): Promise<Status> {
|
||||
throw new Error("Method not implemented.")
|
||||
}
|
||||
|
||||
async listRefs(): Promise<Ref[]> {
|
||||
const res: string[][] = await this.contract.listRefs(
|
||||
Buffer.from(this.repoName)
|
||||
)
|
||||
let refs = res.map((i) => ({
|
||||
ref: Buffer.from(i[1].slice(2), "hex")
|
||||
.toString("utf8")
|
||||
.slice(this.repoName.length + 1),
|
||||
sha: i[0].slice(2),
|
||||
}))
|
||||
return refs
|
||||
}
|
||||
|
||||
async setRef(path: string, sha: string): Promise<Status> {
|
||||
try {
|
||||
console.error(`=== setting ref ${path} ===`)
|
||||
await this.txManager.SendCall("setRef", [
|
||||
Buffer.from(this.repoName),
|
||||
Buffer.from(path),
|
||||
"0x" + sha,
|
||||
])
|
||||
console.error(`ref set succeed ${path}`)
|
||||
return Status.SUCCEED
|
||||
} catch (error: any) {
|
||||
console.error(`ref set failed ${error} : ${path}`)
|
||||
return Status.FAILED
|
||||
}
|
||||
}
|
||||
|
||||
async removeRef(path: string): Promise<Status> {
|
||||
await this.contract.delRef(
|
||||
Buffer.from(this.repoName),
|
||||
Buffer.from(path)
|
||||
)
|
||||
return Status.SUCCEED
|
||||
}
|
||||
|
||||
async storeIPFS(data: Buffer): Promise<string> {
|
||||
let response
|
||||
for (let i = 0; i < 10; i++) {
|
||||
// Todo: add timeout
|
||||
try {
|
||||
response = await axios.post(
|
||||
"https://api.nft.storage/upload",
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/octet-stream",
|
||||
Authorization: this.auth,
|
||||
},
|
||||
}
|
||||
)
|
||||
if (response.status == 200) {
|
||||
return response.data.value.cid
|
||||
}
|
||||
} catch (e) {
|
||||
//pass
|
||||
}
|
||||
}
|
||||
throw new Error(`store ipfs failed: ${response?.status}`)
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import axios from "axios"
|
||||
import Form from "form-data"
|
||||
let form = new Form()
|
||||
|
||||
form.append("file", Buffer.from("hello world"), {
|
||||
filename: "",
|
||||
contentType: "image/*",
|
||||
})
|
||||
const response = await axios.post(
|
||||
"https://api.nft.storage/upload",
|
||||
Buffer.from("hello world"),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/octet-stream",
|
||||
Authorization:
|
||||
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweGFEQTdCOWFlQTdGNTc2ZDI5NzM0ZWUxY0Q2ODVFMzc2OWNCM2QwRDEiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY3NTQ5NDYwMDkzMiwibmFtZSI6ImZ2bS1oYWNrc29uIn0.YBqfsj_LTZSJPKc0OH586avnQNqove_Htzl5rrToXTk",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
console.log(response.status)
|
||||
console.log(response.headers)
|
||||
console.log(response.data)
|
@ -0,0 +1,199 @@
|
||||
import { ethers } from "ethers"
|
||||
|
||||
export class TxManager {
|
||||
contract: ethers.Contract
|
||||
chainId: number
|
||||
price: ethers.providers.FeeData | null
|
||||
|
||||
cancel: boolean
|
||||
|
||||
blockTimeSec: number
|
||||
gasLimitRatio: number
|
||||
minNonce: number = -1
|
||||
queueCurrNonce: number = -1
|
||||
highestNonce: number = -1
|
||||
rbfTimes: number
|
||||
boardcastTimes: number
|
||||
waitDistance: number
|
||||
minRBFRatio: number
|
||||
|
||||
constructor(
|
||||
contract: ethers.Contract,
|
||||
chainId: number,
|
||||
constOptions: {
|
||||
blockTimeSec?: number
|
||||
gasLimitRatio?: number
|
||||
rbfTimes?: number
|
||||
boardcastTimes?: number
|
||||
waitDistance?: number
|
||||
minRBFRatio?: number
|
||||
}
|
||||
) {
|
||||
this.chainId = chainId
|
||||
this.contract = contract
|
||||
this.price = null
|
||||
this.cancel = false
|
||||
this.blockTimeSec = constOptions.blockTimeSec || 3
|
||||
this.gasLimitRatio = constOptions.gasLimitRatio || 1.2
|
||||
this.rbfTimes = constOptions.rbfTimes || 3
|
||||
this.boardcastTimes = constOptions.boardcastTimes || 3
|
||||
this.waitDistance = constOptions.waitDistance || 10
|
||||
this.minRBFRatio = constOptions.minRBFRatio || 1.3
|
||||
}
|
||||
|
||||
async FreshBaseGas(): Promise<ethers.providers.FeeData | null> {
|
||||
this.price = await this.contract.provider.getFeeData()
|
||||
return this.price
|
||||
}
|
||||
|
||||
CancelAll() {
|
||||
this.cancel = true
|
||||
// TODO: cancel all tx sended
|
||||
}
|
||||
|
||||
async SendCall(_method: string, _args: any[]): Promise<any> {
|
||||
let unsignedTx = await this.contract.populateTransaction[_method](
|
||||
..._args
|
||||
)
|
||||
unsignedTx.chainId = this.chainId
|
||||
if (this.highestNonce < 0) {
|
||||
this.highestNonce = await this.contract.signer.getTransactionCount()
|
||||
}
|
||||
const nonce = this.highestNonce
|
||||
unsignedTx.nonce = nonce
|
||||
this.highestNonce += 1
|
||||
|
||||
// estimateGas check
|
||||
let gasLimit = await this.contract.provider.estimateGas(unsignedTx)
|
||||
unsignedTx.gasLimit = gasLimit
|
||||
.mul((this.gasLimitRatio * 100) | 0)
|
||||
.div(100)
|
||||
let retryRBF = this.rbfTimes
|
||||
|
||||
let lastPrice = null
|
||||
while (retryRBF > 0 && !this.cancel) {
|
||||
// set gas price
|
||||
let price
|
||||
try {
|
||||
price = await this.FreshBaseGas()
|
||||
} catch (e) {
|
||||
price = this.price
|
||||
} finally {
|
||||
if (
|
||||
!price ||
|
||||
!price.maxFeePerGas ||
|
||||
!price.maxPriorityFeePerGas
|
||||
) {
|
||||
throw new Error("get fee data failed")
|
||||
}
|
||||
}
|
||||
if (lastPrice) {
|
||||
let maxFeePerGasMin = lastPrice
|
||||
.maxFeePerGas!.mul((this.minRBFRatio * 100) | 0)
|
||||
.div(100)
|
||||
if (price.maxFeePerGas.lt(maxFeePerGasMin)) {
|
||||
price.maxFeePerGas = maxFeePerGasMin
|
||||
}
|
||||
let maxPriorityFeePerGasMin = lastPrice
|
||||
.maxPriorityFeePerGas!.mul((this.minRBFRatio * 100) | 0)
|
||||
.div(100)
|
||||
if (price.maxPriorityFeePerGas.lt(maxPriorityFeePerGasMin)) {
|
||||
price.maxPriorityFeePerGas = maxPriorityFeePerGasMin
|
||||
}
|
||||
}
|
||||
lastPrice = price
|
||||
if (price && price.maxFeePerGas && price.maxPriorityFeePerGas) {
|
||||
unsignedTx.type = 2
|
||||
unsignedTx.maxFeePerGas = price.maxFeePerGas
|
||||
unsignedTx.maxPriorityFeePerGas = price.maxPriorityFeePerGas
|
||||
} else {
|
||||
throw new Error("get fee data failed")
|
||||
}
|
||||
|
||||
// sign
|
||||
let signedTx = await this.contract.signer.signTransaction(
|
||||
unsignedTx
|
||||
)
|
||||
|
||||
let retryBoardcast = this.boardcastTimes
|
||||
let txRes = null
|
||||
while (retryBoardcast > 0 && !this.cancel) {
|
||||
if (
|
||||
this.queueCurrNonce < 0 ||
|
||||
this.queueCurrNonce + 1 == nonce
|
||||
) {
|
||||
// Arrive in line
|
||||
retryBoardcast--
|
||||
} else if (nonce - this.queueCurrNonce > this.waitDistance) {
|
||||
// Too far away don't boardcast, waitTime = int(distance / groupSize) * blockTime + 1s
|
||||
const waitTime =
|
||||
(((nonce - this.queueCurrNonce) / this.waitDistance) |
|
||||
0) *
|
||||
this.blockTimeSec *
|
||||
1000 +
|
||||
1000
|
||||
await new Promise((r) => setTimeout(r, waitTime))
|
||||
continue
|
||||
} else {
|
||||
// Broadcast first anyway
|
||||
}
|
||||
|
||||
try {
|
||||
// send
|
||||
txRes = await this.contract.provider.sendTransaction(
|
||||
signedTx
|
||||
)
|
||||
await new Promise((r) =>
|
||||
setTimeout(r, (this.blockTimeSec / 2) * 1000)
|
||||
)
|
||||
} catch (e: Error | any) {
|
||||
if (e.code == ethers.errors.NONCE_EXPIRED) {
|
||||
// ignore if tx already in mempool
|
||||
} else {
|
||||
console.error(
|
||||
"[tx-manager] sendTransaction",
|
||||
nonce,
|
||||
e.code,
|
||||
e.message
|
||||
)
|
||||
}
|
||||
}
|
||||
if (txRes) {
|
||||
// wait
|
||||
try {
|
||||
let receipt =
|
||||
await this.contract.provider.waitForTransaction(
|
||||
txRes.hash,
|
||||
1,
|
||||
this.blockTimeSec * 1000 + 1000
|
||||
)
|
||||
if (receipt) {
|
||||
this.queueCurrNonce =
|
||||
txRes.nonce > this.queueCurrNonce
|
||||
? txRes.nonce
|
||||
: this.queueCurrNonce
|
||||
return receipt
|
||||
}
|
||||
} catch (e: Error | any) {
|
||||
if (e.code == ethers.errors.TIMEOUT) {
|
||||
// ignore timeout
|
||||
} else {
|
||||
console.error(
|
||||
"[tx-manager] waitForTransaction",
|
||||
nonce,
|
||||
txRes.hash,
|
||||
e.code,
|
||||
e.reason
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await new Promise((r) => setTimeout(r, 1000))
|
||||
}
|
||||
}
|
||||
retryRBF--
|
||||
}
|
||||
|
||||
throw new Error("send tx failed")
|
||||
}
|
||||
}
|
@ -1,71 +1,69 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Added */
|
||||
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
||||
"preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */
|
||||
"resolveJsonModule": true, /* Include modules imported with '.json' extension. Requires TypeScript version 2.9 or later. */
|
||||
/* Basic Options */
|
||||
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||
"module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"lib": [
|
||||
"es5",
|
||||
"es6"
|
||||
], /* Specify library files to be included in the compilation. */
|
||||
"allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "dist", /* Redirect output structure to the directory. */
|
||||
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
/* Additional Checks */
|
||||
"noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
/* Module Resolution Options */
|
||||
"moduleResolution": "nodenext", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "src", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
"types"
|
||||
], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"test",
|
||||
"dist",
|
||||
"bin",
|
||||
"types",
|
||||
]
|
||||
}
|
||||
"compilerOptions": {
|
||||
/* Added */
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
|
||||
"preserveConstEnums": true /* Do not erase const enum declarations in generated code. */,
|
||||
"resolveJsonModule": true /* Include modules imported with '.json' extension. Requires TypeScript version 2.9 or later. */,
|
||||
/* Basic Options */
|
||||
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
|
||||
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
||||
"lib": [
|
||||
"es5",
|
||||
"es6"
|
||||
] /* Specify library files to be included in the compilation. */,
|
||||
"allowJs": true /* Allow javascript files to be compiled. */,
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
"declaration": true /* Generates corresponding '.d.ts' file. */,
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
"sourceMap": true /* Generates corresponding '.map' file. */,
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "dist" /* Redirect output structure to the directory. */,
|
||||
"rootDir": "src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
/* Additional Checks */
|
||||
"noUnusedLocals": true /* Report errors on unused locals. */,
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
/* Module Resolution Options */
|
||||
"moduleResolution": "nodenext" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
||||
// "baseUrl": "src", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
"types"
|
||||
] /* List of folders to include type definitions from. */,
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"exclude": ["node_modules", "test", "dist", "bin", "types"],
|
||||
"ts-node": {
|
||||
// Tell ts-node CLI to install the --loader automatically
|
||||
"esm": true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue