13 lines
503 B
TypeScript
13 lines
503 B
TypeScript
import * as fs from "node:fs"
|
|
|
|
const statementRegex = /(?:^\/\*\*[\s\S]+?\*\/\n)?^(interface|type|declare).+\n(?:(?: .+\n)*};?\n)?/gm
|
|
|
|
const input = fs.readFileSync("node_modules/@types/web/index.d.ts", "utf8")
|
|
let output = ''
|
|
|
|
for (const match of input.matchAll(statementRegex)) if (match[1]!=="declare") output+=match[0]
|
|
|
|
output = output.replaceAll(/^(interface|type)/gm, "export $1")
|
|
|
|
fs.writeFileSync("index.d.ts", output, "utf8")
|
|
fs.copyFileSync("node_modules/@types/web/LICENSE.txt","LICENSE.txt") |