diff --git a/package.json b/package.json index 947285575b..dbdb58fe24 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "build:browser-bundle-min": "npx esbuild --minify --bundle dist/browser/index.js --format=esm --target=es2018 --outfile=dist/browser/index.bundle.min.js", "build:browser-umd": "npx rollup dist/browser/index.bundle.js --format umd --name jose -o dist/browser/index.umd.js && npx rollup dist/browser/index.bundle.min.js --compact --format umd --name jose -o dist/browser/index.umd.min.js", "build:deno": "npm run-script runtime-deno && find dist/deno -name '*.ts' -type f -print0 | xargs -0 sed -i '' -e \"s/@deno\\-expect\\-error/@ts-ignore/g\" -e \"s/\\.js'/.ts'/g\" -e \"s/\\.d'/.d.ts'/g\"", - "build:types": "npm run-script build -- -p ./tsconfig/types.json && cd src && find . -name '*.d.ts' -maxdepth 2 -type f -exec gcp --parents \"{}\" ../dist/types \\; && cd .. && node ./tools/strip-dts-comments && run-s -s types:find | xargs -0 sed -i '' -e \"s/\\.js'/'/g\" -e \"s/\\.d'/'/g\"", + "build:types": "npm run-script build -- -p ./tsconfig/types.json && cd src && find . -name '*.d.ts' -maxdepth 2 -type f -exec gcp --parents \"{}\" ../dist/types \\; && cd .. && run-s -s types:find | xargs -0 sed -i '' -e \"s/\\.js'/'/g\" -e \"s/\\.d'/'/g\"", "build:node-cjs": "run-s runtime-node 'build -- -p ./tsconfig/node-cjs.json'", "build:node-esm": "run-s runtime-node 'build -- -p ./tsconfig/node-esm.json' && echo '{\"type\": \"module\"}'> dist/node/esm/package.json", "build:node-webcrypto-cjs": "run-s runtime-node-webcrypto 'build -- -p ./tsconfig/node-webcrypto-cjs.json'", diff --git a/tools/strip-dts-comments.js b/tools/strip-dts-comments.js deleted file mode 100644 index b2a999e933..0000000000 --- a/tools/strip-dts-comments.js +++ /dev/null @@ -1,26 +0,0 @@ -const { strict: assert } = require('assert') -const { writeFileSync, readFileSync } = require('fs') -const { execSync } = require('child_process') - -const inputFile = './src/types.d.ts' -const outputFile = './dist/types/types.d.ts' -let types = readFileSync(outputFile, { encoding: 'utf-8' }) - -const regexJSDocs = /^[\t\s]*\/\*\*[^!#*][\s\S]*?\*\/[\r\n]?/gm -const regexMultilines = /^[\t\s]*\/\*[^!#*][\s\S]*?\*\/[\r\n]?/gm -const emptyLines = /^\s*\n/gm - -const inputKeyLikeLine = parseInt( - execSync(`awk '/export type KeyLike/{ print NR; exit }' ${inputFile}`), - 10, -) -assert(inputKeyLikeLine) -const keyLikeDoc = execSync(`head -n +${inputKeyLikeLine - 1} ${inputFile}`) - -writeFileSync(outputFile, keyLikeDoc) - -writeFileSync( - outputFile, - types.replace(regexJSDocs, '').replace(regexMultilines, '').replace(emptyLines, ''), - { flag: 'a' }, -) diff --git a/tsconfig/types.json b/tsconfig/types.json index 85f097cac1..4100827e8c 100644 --- a/tsconfig/types.json +++ b/tsconfig/types.json @@ -4,6 +4,7 @@ "target": "ESNext", "outDir": "../dist/types", "declaration": true, - "emitDeclarationOnly": true + "emitDeclarationOnly": true, + "removeComments": false } }