Skip to content

Commit

Permalink
Refactor tsconfig: use inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Dec 23, 2023
1 parent 716711f commit 2dd5c0a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 52 deletions.
2 changes: 1 addition & 1 deletion src/webcrypto/aes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getCryptParams(
algo: BlockMode,
nonce: Uint8Array,
AAD?: Uint8Array
): AesCbcParams | AesCtrParams | AesGcmParams {
) {
if (algo === BlockMode.CBC) return { name: BlockMode.CBC, iv: nonce };
if (algo === BlockMode.CTR) return { name: BlockMode.CTR, counter: nonce, length: 64 };
if (algo === BlockMode.GCM) return { name: BlockMode.GCM, iv: nonce, additionalData: AAD };
Expand Down
30 changes: 12 additions & 18 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
{
"compilerOptions": {
"strict": true,
"outDir": "esm",
"target": "es2020",
"module": "es6",
"moduleResolution": "bundler",
"baseUrl": ".",
"paths": {
"@noble/ciphers/webcrypto/crypto": [
"src/webcrypto/crypto"
]
},
"lib": ["es2020"],
"strict": true,
"sourceMap": true,
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
Expand All @@ -20,12 +12,14 @@
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"baseUrl": ".",
"paths": {
"@noble/ciphers/webcrypto/crypto": ["src/webcrypto/crypto"]
},
"module": "es2020",
"outDir": "esm",
"moduleResolution": "bundler"
},
"include": [
"src"
],
"exclude": [
"node_modules",
"lib"
]
}
"include": ["src"],
"exclude": ["node_modules", "lib"]
}
39 changes: 6 additions & 33 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
{
"extends": "./tsconfig.esm.json",
"compilerOptions": {
"outDir": ".",
"target": "es2020",
"lib": [
"es2020",
"dom"
], // Set explicitly to remove DOM
"module": "commonjs",
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@noble/ciphers/webcrypto/crypto": [
"src/webcrypto/crypto"
]
},
"sourceMap": true,
"moduleResolution": "node10",
"outDir": ".",
"declaration": true,
"declarationMap": true,
"strict": true,
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
"esModuleInterop": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
},
"include": [
"src"
],
"exclude": [
"node_modules",
"*.d.ts"
],
}
"declarationMap": true
}
}

0 comments on commit 2dd5c0a

Please sign in to comment.