update fileSmasher to support exporting default functions

This commit is contained in:
Holly Stubbs 2023-09-04 01:46:23 +01:00
parent 690c7be16f
commit a61d807966
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -42,7 +42,7 @@ const splitLines = combinedFiles.split("\n");
const resultLines:Array<string> = new Array<string>(); const resultLines:Array<string> = new Array<string>();
// Insert allowed imports // Insert allowed imports
resultLines.push(`import { createWriteStream, mkdirSync, existsSync, readFileSync, readFile, writeFile, writeFileSync, readdirSync } from "fs"; resultLines.push(`import { createWriteStream, mkdirSync, existsSync, readFileSync, readFile, writeFile, writeFileSync, readdirSync, renameSync } from "fs";
import { deflate, inflate } from "zlib"; import { deflate, inflate } from "zlib";
import { createWriter, createReader, IReader, Endian } from "bufferstuff"; import { createWriter, createReader, IReader, Endian } from "bufferstuff";
import { Console } from "hsconsole"; import { Console } from "hsconsole";
@ -57,7 +57,7 @@ for (const line of splitLines) {
} }
// Fix up classes, interfaces and such. // Fix up classes, interfaces and such.
//resultLines.push(line); //resultLines.push(line);
resultLines.push(line.replace("export class", "class").replace("export interface", "interface").replace("export enum", "enum").replace("export type", "type")); resultLines.push(line.replace("export default function", "function").replace("export class", "class").replace("export interface", "interface").replace("export enum", "enum").replace("export type", "type"));
} }
writeFileSync("./combined.ts", resultLines.join("\n")); writeFileSync("./combined.ts", resultLines.join("\n"));