diff --git a/src/CommonFormats.ts b/src/CommonFormats.ts index b6917399..5bd6f922 100644 --- a/src/CommonFormats.ts +++ b/src/CommonFormats.ts @@ -12,7 +12,9 @@ export const Category = { SPREADSHEET: "spreadsheet", PRESENTATION: "presentation", FONT: "font", - CODE: "code" + CODE: "code", + DATABASE: "database", + MODEL: "model", } /** diff --git a/src/handlers/FFmpeg.ts b/src/handlers/FFmpeg.ts index 33a62c2a..bde91a95 100644 --- a/src/handlers/FFmpeg.ts +++ b/src/handlers/FFmpeg.ts @@ -5,7 +5,7 @@ import type { LogEvent } from "@ffmpeg/ffmpeg"; import mime from "mime"; import normalizeMimeType from "../normalizeMimeType.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class FFmpegHandler implements FormatHandler { @@ -220,7 +220,7 @@ class FFmpegHandler implements FormatHandler { from: true, to: true, internal: "mov", - category: "audio", + category: Category.AUDIO, lossless: false }); @@ -233,7 +233,7 @@ class FFmpegHandler implements FormatHandler { from: true, to: true, internal: "asf", - category: "video" + category: Category.VIDEO }); // Normalize Bink metadata to ensure ".bik" files are detected by extension. diff --git a/src/handlers/als.ts b/src/handlers/als.ts index c3379f18..4b1fc2cd 100644 --- a/src/handlers/als.ts +++ b/src/handlers/als.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class alsHandler implements FormatHandler { @@ -14,7 +14,7 @@ class alsHandler implements FormatHandler { from: true, to: false, internal: "als", - category: "data", + category: Category.DATA, lossless: true }, CommonFormats.XML.builder("xml").allowTo(), diff --git a/src/handlers/aperturePicture.ts b/src/handlers/aperturePicture.ts index e1c2ac83..f26a1200 100644 --- a/src/handlers/aperturePicture.ts +++ b/src/handlers/aperturePicture.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class aperturePictureHandler implements FormatHandler { public name: string = "aperturePicture"; @@ -16,7 +16,7 @@ class aperturePictureHandler implements FormatHandler { from: true, to: false, internal: "apf", - category: ["image"], + category: Category.IMAGE, lossless: true, }, CommonFormats.BMP.builder("bmp") diff --git a/src/handlers/aseprite.ts b/src/handlers/aseprite.ts index a81a4b7a..3b340528 100644 --- a/src/handlers/aseprite.ts +++ b/src/handlers/aseprite.ts @@ -1,5 +1,5 @@ import pako from "pako"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; const ASEPRITE_HEADER_MAGIC = 0xA5E0; @@ -418,7 +418,7 @@ class asepriteHandler implements FormatHandler { from: true, to: false, internal: "aseprite", - category: "image", + category: Category.IMAGE, lossless: true }, CommonFormats.PNG.supported("png", false, true, true), diff --git a/src/handlers/bsor.ts b/src/handlers/bsor.ts index dc723212..947deb2d 100644 --- a/src/handlers/bsor.ts +++ b/src/handlers/bsor.ts @@ -1,7 +1,7 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import { Replay } from "./bsor/replay.ts"; import { render } from "./bsor/renderer.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class bsorHandler implements FormatHandler { public name: string = "bsor"; @@ -14,7 +14,7 @@ class bsorHandler implements FormatHandler { from: true, to: false, internal: "bsor", - category: "data", + category: Category.DATA, lossless: false }, CommonFormats.PNG.supported("png", false, true), diff --git a/src/handlers/bunburrows.ts b/src/handlers/bunburrows.ts index 1dfb81e2..858475ea 100644 --- a/src/handlers/bunburrows.ts +++ b/src/handlers/bunburrows.ts @@ -1,7 +1,7 @@ // file: bunburrows.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; const COLOR_WALKABLE = [0,0,0]; const COLOR_BREAKABLE = [98,135,64]; @@ -28,7 +28,7 @@ class bunburrowsHandler implements FormatHandler { from: true, to: false, internal: "bunlevel", - category: "data", + category: Category.DATA, lossless: false, }, ]; diff --git a/src/handlers/celariaMap.ts b/src/handlers/celariaMap.ts index 672c5a7c..f7148958 100644 --- a/src/handlers/celariaMap.ts +++ b/src/handlers/celariaMap.ts @@ -7,7 +7,7 @@ import { PlayerSpawnPoint } from "celaria-formats/class/maps/objects/PlayerSpawn import { Sphere } from "celaria-formats/class/maps/objects/Sphere.mjs" import { TutorialHologram } from "celaria-formats/class/maps/objects/TutorialHologram.mjs" import type { FlatVector3, Vector3 } from "celaria-formats/types/data.mts" -import CommonFormats from "src/CommonFormats.ts" +import CommonFormats, { Category } from "src/CommonFormats.ts" import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts" class celariaMapHandler implements FormatHandler { @@ -25,7 +25,7 @@ class celariaMapHandler implements FormatHandler { from: false, to: true, internal: "obj", - category: "model", + category: Category.MODEL, lossless: false, }, CommonFormats.JSON.builder("json").allowFrom(true).allowTo(true).markLossless(false), @@ -37,7 +37,7 @@ class celariaMapHandler implements FormatHandler { from: true, to: true, internal: "ecmap", - category: "data", + category: Category.DATA, lossless: false, }, { @@ -48,7 +48,7 @@ class celariaMapHandler implements FormatHandler { from: true, to: false, internal: "cmap", - category: "data", + category: Category.DATA, lossless: false, }, ] diff --git a/src/handlers/cgbi-to-png.ts b/src/handlers/cgbi-to-png.ts index ebf8a48d..fa3c1818 100644 --- a/src/handlers/cgbi-to-png.ts +++ b/src/handlers/cgbi-to-png.ts @@ -1,6 +1,6 @@ import pako from "pako"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; async function revertCgBIBuffer(input: Uint8Array | ArrayBuffer): Promise { const buffer = input instanceof Uint8Array ? input : new Uint8Array(input); @@ -156,7 +156,7 @@ class cgbiToPngHandler implements FormatHandler { from: true, to: false, internal: "cgbi-png", - category: "image", + category: Category.IMAGE, lossless: true }, CommonFormats.PNG.supported("png", false, true, true), diff --git a/src/handlers/curani.ts b/src/handlers/curani.ts index 0f65d4cb..9b0998c3 100644 --- a/src/handlers/curani.ts +++ b/src/handlers/curani.ts @@ -1,7 +1,7 @@ // file: curani.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; function read_lendian(x : number, y: number): number { return x + (y * 16 * 16); @@ -23,7 +23,7 @@ class curaniHandler implements FormatHandler { from: true, to: true, internal: "ani", - category: "image", + category: Category.IMAGE, lossless: false, }, { @@ -34,7 +34,7 @@ class curaniHandler implements FormatHandler { from: true, to: true, internal: "cur", - category: "image", + category: Category.IMAGE, lossless: false, }, { @@ -45,7 +45,7 @@ class curaniHandler implements FormatHandler { from: true, to: true, internal: "ico", - category: "image", + category: Category.IMAGE, lossless: false, } ]; diff --git a/src/handlers/cybergrindHandler.ts b/src/handlers/cybergrindHandler.ts index 6b59d0d4..f7bddfd4 100644 --- a/src/handlers/cybergrindHandler.ts +++ b/src/handlers/cybergrindHandler.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class cybergrindHandler implements FormatHandler { public name: string = "cybergrind"; @@ -17,7 +17,7 @@ class cybergrindHandler implements FormatHandler { format: "cgp", extension: "cgp", mime: "text/plain", - category: "data", + category: Category.DATA, from: false, to: true, internal: "cgp", diff --git a/src/handlers/envelope.ts b/src/handlers/envelope.ts index 4eb74436..cd7e8649 100644 --- a/src/handlers/envelope.ts +++ b/src/handlers/envelope.ts @@ -4,7 +4,7 @@ import { parseODT, parseODP, parseODS } from "./envelope/parseODF.js"; import parseDOCX from "./envelope/parseDOCX.js"; import parsePPTX from "./envelope/parsePPTX.js"; import parseXLSX from "./envelope/parseXLSX.js"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class envelopeHandler implements FormatHandler { @@ -23,7 +23,7 @@ class envelopeHandler implements FormatHandler { from: true, to: false, internal: "odt", - category: "document", + category: Category.DOCUMENT, lossless: false }, { @@ -34,7 +34,7 @@ class envelopeHandler implements FormatHandler { from: true, to: false, internal: "odp", - category: "presentation", + category: Category.PRESENTATION, lossless: false }, { @@ -45,7 +45,7 @@ class envelopeHandler implements FormatHandler { from: true, to: false, internal: "ods", - category: "spreadsheet", + category: Category.SPREADSHEET, lossless: false }, // Technically not "lossless", but it's about as close as we'll ever get diff --git a/src/handlers/flo.ts b/src/handlers/flo.ts index 7f863fa6..d3e1eff6 100644 --- a/src/handlers/flo.ts +++ b/src/handlers/flo.ts @@ -1,6 +1,6 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import normalizeMimeType from "../normalizeMimeType.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { FFmpeg } from "@ffmpeg/ffmpeg"; function interleaveAudioBuffer(buffer: AudioBuffer): Float32Array { @@ -187,7 +187,7 @@ class floHandler implements FormatHandler { from: true, to: true, internal: "flo", - category: "audio", + category: Category.AUDIO, lossless: false }, CommonFormats.WAV.builder("wav") @@ -200,7 +200,7 @@ class floHandler implements FormatHandler { from: true, to: true, internal: "f32le", - category: "audio", + category: Category.AUDIO, lossless: true }, ]; diff --git a/src/handlers/flptojson.ts b/src/handlers/flptojson.ts index 0214dbcf..1a1d8736 100644 --- a/src/handlers/flptojson.ts +++ b/src/handlers/flptojson.ts @@ -3,7 +3,7 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import { Buffer } from "buffer"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; if (typeof window !== "undefined") { (window as any).Buffer = Buffer; @@ -32,7 +32,7 @@ class flptojsonHandler implements FormatHandler { from: true, to: false, internal: "flp", - category: "audio", + category: Category.AUDIO, lossless: false, }, // Unsure about this, it might be lossless diff --git a/src/handlers/jsonToC.ts b/src/handlers/jsonToC.ts index d6051da0..f25121ed 100644 --- a/src/handlers/jsonToC.ts +++ b/src/handlers/jsonToC.ts @@ -1,7 +1,7 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import {JsonType} from "./jsonToC/JsonType.ts"; import JsonTypeFactory from "./jsonToC/JsonTypeFactory.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; export default class jsonToCHandler implements FormatHandler { /**************************************************/ @@ -18,7 +18,7 @@ export default class jsonToCHandler implements FormatHandler { from: true, to: true, internal: "c", - category: "code" + category: Category.CODE }, CommonFormats.JSON.supported("json", true, true) ]; diff --git a/src/handlers/libopenmpt.ts b/src/handlers/libopenmpt.ts index 7e6bd344..7b881040 100644 --- a/src/handlers/libopenmpt.ts +++ b/src/handlers/libopenmpt.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; interface LibOpenMPTModule { __render(fileData: Uint8Array, sampleRate: number): Int16Array; @@ -120,7 +120,7 @@ class libopenmptHandler implements FormatHandler { from: true, to: false, internal: fmt.ext, - category: "audio", + category: Category.AUDIO, lossless: true }); } diff --git a/src/handlers/lzh.ts b/src/handlers/lzh.ts index 63394ab1..a0a90001 100644 --- a/src/handlers/lzh.ts +++ b/src/handlers/lzh.ts @@ -2,7 +2,7 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import { LZHDecoder } from "./lzh/decoder.ts"; import { LZHEncoder, type LHAFileInput } from "./lzh/encoder.ts"; import JSZip from "jszip"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import normalizeMimeType from "../normalizeMimeType.ts"; import mime from "mime"; @@ -27,7 +27,7 @@ class LZHHandler implements FormatHandler { from: true, to: true, internal: "lzh", - category: "archive", + category: Category.ARCHIVE, lossless: true }, CommonFormats.ZIP.builder("zip").allowFrom() diff --git a/src/handlers/mcSchematicHandler.ts b/src/handlers/mcSchematicHandler.ts index 606a199b..01ecc79b 100644 --- a/src/handlers/mcSchematicHandler.ts +++ b/src/handlers/mcSchematicHandler.ts @@ -1,6 +1,7 @@ import type { FileData, FileFormat, FormatHandler } from "src/FormatHandler"; import * as NBT from "nbtify"; import { gunzipSync, gzipSync } from "fflate"; +import { Category } from "src/CommonFormats.ts"; class mcSchematicHandler implements FormatHandler { public name: string = "mcSchematic"; @@ -17,7 +18,7 @@ class mcSchematicHandler implements FormatHandler { from: true, to: true, internal: "schematic", - category: "data", + category: Category.DATA, lossless: true }, { @@ -28,7 +29,7 @@ class mcSchematicHandler implements FormatHandler { from: true, to: true, internal: "schem", - category: "data", + category: Category.DATA, lossless: true }, { @@ -39,7 +40,7 @@ class mcSchematicHandler implements FormatHandler { from: true, to: true, internal: "litematic", - category: "data", + category: Category.DATA, lossless: true }, // Target internal format for graph routing @@ -51,7 +52,7 @@ class mcSchematicHandler implements FormatHandler { from: false, to: true, internal: "nbt", - category: "data", + category: Category.DATA, lossless: true } ]; diff --git a/src/handlers/mcmap.ts b/src/handlers/mcmap.ts index 876dfecf..5675dc23 100644 --- a/src/handlers/mcmap.ts +++ b/src/handlers/mcmap.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import pako from "pako"; import * as NBT from "nbtify"; @@ -95,7 +95,7 @@ class mcMapHandler implements FormatHandler { from: false, to: true, internal: "rgb", - category: "image", + category: Category.IMAGE, lossless: true }, { @@ -106,7 +106,7 @@ class mcMapHandler implements FormatHandler { from: true, to: true, internal: "mcmap", - category: "data", + category: Category.DATA, lossless: false }, { @@ -117,7 +117,7 @@ class mcMapHandler implements FormatHandler { from: false, to: true, internal: "mcmap_grid", - category: "data", + category: Category.DATA, lossless: false } ]; diff --git a/src/handlers/midi.ts b/src/handlers/midi.ts index ee2c5130..893d0508 100644 --- a/src/handlers/midi.ts +++ b/src/handlers/midi.ts @@ -1,6 +1,6 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import { extractEvents, tableToString, stringToTable, buildMidi, parseRtttl, parseGrubTune, tableToRtttl, tableToGrubTune, pngToMidi, midiToPng } from "./midi/midifilelib.js"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; const SAMPLE_RATE = 44100; const BUFFER_FRAMES = 4096; @@ -83,10 +83,10 @@ export class midiCodecHandler implements FormatHandler { async init(): Promise { this.supportedFormats.push( - { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: true, to: true, internal: "mid", category: "audio", lossless: true }, - { name: "RTTTL", format: "rtttl", extension: "rtttl", mime: "audio/rtttl", from: true, to: true, internal: "rtttl", category: "text", lossless: false }, - { name: "NokRing", format: "rtttl", extension: "nokring",mime: "audio/rtttl", from: true, to: false, internal: "rtttl", category: "text", lossless: false }, - { name: "GRUB Init Tune",format: "grub", extension: "grub", mime: "text/plain", from: true, to: true, internal: "grub", category: "text", lossless: false }, + { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: true, to: true, internal: "mid", category: Category.AUDIO, lossless: true }, + { name: "RTTTL", format: "rtttl", extension: "rtttl", mime: "audio/rtttl", from: true, to: true, internal: "rtttl", category: Category.TEXT, lossless: false }, + { name: "NokRing", format: "rtttl", extension: "nokring",mime: "audio/rtttl", from: true, to: false, internal: "rtttl", category: Category.TEXT, lossless: false }, + { name: "GRUB Init Tune",format: "grub", extension: "grub", mime: "text/plain", from: true, to: true, internal: "grub", category: Category.TEXT, lossless: false }, CommonFormats.TEXT.builder("txt").allowFrom().allowTo().markLossless(), // PNG spectrogram -> MIDI (matches meyda's internal="image" so routing picks // up the audio->png->mid path automatically) @@ -209,7 +209,7 @@ export class midiSynthHandler implements FormatHandler { this.#sfontBin = sfontBin; this.supportedFormats.push( - { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: true, to: false, internal: "mid", category: "audio", lossless: true }, + { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: true, to: false, internal: "mid", category: Category.AUDIO, lossless: true }, CommonFormats.WAV.builder("wav").allowTo().markLossless() ); diff --git a/src/handlers/n64rom.ts b/src/handlers/n64rom.ts index df83e11d..72a81d8c 100644 --- a/src/handlers/n64rom.ts +++ b/src/handlers/n64rom.ts @@ -1,6 +1,6 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import normalizeMimeType from "../normalizeMimeType.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; const ROM_MAGIC = { z64: [0x80, 0x37, 0x12, 0x40], @@ -25,7 +25,7 @@ class n64romHandler implements FormatHandler { from: true, to: true, internal: "z64", - category: "data", + category: Category.DATA, lossless: true }, { @@ -36,7 +36,7 @@ class n64romHandler implements FormatHandler { from: true, to: true, internal: "n64", - category: "data", + category: Category.DATA, lossless: true }, { @@ -47,7 +47,7 @@ class n64romHandler implements FormatHandler { from: true, to: true, internal: "v64", - category: "data", + category: Category.DATA, lossless: true }, CommonFormats.PNG.builder("n64png") diff --git a/src/handlers/nbt.ts b/src/handlers/nbt.ts index 6188d12a..7eae948a 100644 --- a/src/handlers/nbt.ts +++ b/src/handlers/nbt.ts @@ -1,6 +1,6 @@ -import type { FileData, FileFormat, FormatHandler } from "src/FormatHandler"; +import type { FileData, FileFormat, FormatHandler } from "src/FormatHandler.ts"; import * as NBT from "nbtify"; -import CommonFormats from "src/CommonFormats"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { gzipSync, gunzipSync } from "fflate"; class nbtHandler implements FormatHandler { @@ -20,7 +20,7 @@ class nbtHandler implements FormatHandler { from: true, to: true, internal: "nbt", - category: "data", + category: Category.DATA, lossless: true }, CommonFormats.JSON.supported("json", true, true, true), @@ -32,7 +32,7 @@ class nbtHandler implements FormatHandler { from: true, to: true, internal: "snbt", - category: "data", + category: Category.DATA, lossless: true // only compression data is lost }, ] diff --git a/src/handlers/ota.ts b/src/handlers/ota.ts index 6c0730bf..6a9e2299 100644 --- a/src/handlers/ota.ts +++ b/src/handlers/ota.ts @@ -1,7 +1,7 @@ // file: ota.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class otaHandler implements FormatHandler { @@ -23,7 +23,7 @@ class otaHandler implements FormatHandler { from: true, to: true, internal: "ota", - category: "image", + category: Category.IMAGE, lossless: false, }, ]; diff --git a/src/handlers/petozip.ts b/src/handlers/petozip.ts index 43632376..19c18d05 100644 --- a/src/handlers/petozip.ts +++ b/src/handlers/petozip.ts @@ -6,7 +6,7 @@ import * as Pe from "pe-library"; import JSZip from "jszip"; import { Buffer } from "buffer"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; if (typeof window !== "undefined") { (window as any).Buffer = Buffer; } @@ -25,7 +25,7 @@ class peToZipHandler implements FormatHandler { from: true, to: false, internal: "dll", - category: "code", + category: Category.CODE, lossless: false }, CommonFormats.ZIP.builder("zip").allowTo().markLossless() diff --git a/src/handlers/piskel.ts b/src/handlers/piskel.ts index 4f07cfcb..905b29b8 100644 --- a/src/handlers/piskel.ts +++ b/src/handlers/piskel.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import JSZip from "jszip"; class piskelHandler implements FormatHandler { @@ -28,7 +28,7 @@ class piskelHandler implements FormatHandler { mime: "image/png+json", from: true, to: false, - category: "image", + category: Category.IMAGE, internal: "piskel", lossless: true } diff --git a/src/handlers/qoa-fu.ts b/src/handlers/qoa-fu.ts index b08fcb12..4eaf0659 100644 --- a/src/handlers/qoa-fu.ts +++ b/src/handlers/qoa-fu.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { QOAEncoder, QOADecoder, QOABase } from "qoa-fu"; import { WaveFile } from "wavefile"; @@ -56,7 +56,7 @@ class qoaFuHandler implements FormatHandler { from: true, to: true, internal: "qoa", - category: "audio", + category: Category.AUDIO, lossless: false } ]; diff --git a/src/handlers/qoi-fu.ts b/src/handlers/qoi-fu.ts index 616bbd48..c73c5fbd 100644 --- a/src/handlers/qoi-fu.ts +++ b/src/handlers/qoi-fu.ts @@ -1,4 +1,4 @@ -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import { QOIDecoder, QOIEncoder } from "qoi-fu"; @@ -20,7 +20,7 @@ class qoiFuHandler implements FormatHandler { from: true, to: true, internal: "qoi", - category: "image", + category: Category.IMAGE, lossless: true } ]; diff --git a/src/handlers/rename.ts b/src/handlers/rename.ts index b3261e83..1fcebe6c 100644 --- a/src/handlers/rename.ts +++ b/src/handlers/rename.ts @@ -36,7 +36,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "odt", - category: "document", + category: Category.DOCUMENT, lossless: true }, { @@ -47,7 +47,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "odp", - category: "presentation", + category: Category.PRESENTATION, lossless: true }, { @@ -58,7 +58,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "ods", - category: "spreadsheet", + category: Category.SPREADSHEET, lossless: true }, { @@ -69,7 +69,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "xpi", - category: "archive", + category: Category.ARCHIVE, lossless: true }, CommonFormats.ZIP.builder("love").allowFrom() @@ -88,7 +88,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "jar", - category: "archive", + category: Category.ARCHIVE, lossless: true }, { @@ -99,7 +99,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "apk", - category: "archive", + category: Category.ARCHIVE, lossless: true }, CommonFormats.ZIP.builder("sb3").allowFrom() @@ -116,7 +116,7 @@ export const renameZipHandler = renameHandler("renamezip", [ from: true, to: false, internal: "cbz", - category: "archive", + category: Category.ARCHIVE, lossless: true }, ]); @@ -137,7 +137,7 @@ export const renameJsonHandler = renameHandler("renamejson", [ mime: "application/har+json", from: true, to: false, - category: "archive", + category: Category.ARCHIVE, internal: "har" }, { @@ -147,7 +147,7 @@ export const renameJsonHandler = renameHandler("renamejson", [ mime: "image/png+json", from: true, to: false, - category: "image", + category: Category.IMAGE, internal: "piskel", lossless: true } diff --git a/src/handlers/rgba.ts b/src/handlers/rgba.ts index 3f012dea..aa15c7c2 100644 --- a/src/handlers/rgba.ts +++ b/src/handlers/rgba.ts @@ -1,7 +1,7 @@ // file: rgba.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class rgbaHandler implements FormatHandler { @@ -23,7 +23,7 @@ class rgbaHandler implements FormatHandler { from: true, to: true, internal: "rgb", - category: "image", + category: Category.IMAGE, lossless: false }, { @@ -34,7 +34,7 @@ class rgbaHandler implements FormatHandler { from: true, to: true, internal: "rgba", - category: "image", + category: Category.IMAGE, lossless: true }, ]; diff --git a/src/handlers/rpgmvp.ts b/src/handlers/rpgmvp.ts index ed646cfd..9d3c25c9 100644 --- a/src/handlers/rpgmvp.ts +++ b/src/handlers/rpgmvp.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { Decrypter } from "./rpgmvp-decrypter/scripts/Decrypter.js"; import { RPGFile } from "./rpgmvp-decrypter/scripts/RPGFile.js"; @@ -19,7 +19,7 @@ class rpgmvpHandler implements FormatHandler { from: true, to: false, internal: "rpgmvp", - category: "image", + category: Category.IMAGE, lossless: true }, CommonFormats.PNG.builder("png") diff --git a/src/handlers/sppd.ts b/src/handlers/sppd.ts index a8f9738d..a8ede760 100644 --- a/src/handlers/sppd.ts +++ b/src/handlers/sppd.ts @@ -5,7 +5,7 @@ import * as CSG from "three-bvh-csg"; import { Demo } from "./sppd/sppd/Demo.ts"; import { Vector } from "./sppd/sppd/Vector.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; function toThreeVector (vec: Vector) { return new THREE.Vector3(vec.y, vec.z, vec.x); @@ -186,7 +186,7 @@ class sppdHandler implements FormatHandler { from: true, to: false, internal: "dem", - category: "data", + category: Category.DATA, lossless: false }, CommonFormats.PNG.supported("png", false, true), diff --git a/src/handlers/sqlite.ts b/src/handlers/sqlite.ts index 61b4eaf3..a73d38a9 100644 --- a/src/handlers/sqlite.ts +++ b/src/handlers/sqlite.ts @@ -1,4 +1,4 @@ -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import sqlite3InitModule from "@sqlite.org/sqlite-wasm"; import {parse} from "papaparse"; @@ -19,7 +19,7 @@ class sqlite3Handler implements FormatHandler { from: true, to: true, internal: "sqlite3", - category: "database", + category: Category.DATABASE, lossless: false }, { @@ -30,7 +30,7 @@ class sqlite3Handler implements FormatHandler { from: true, to: false, internal: "sqlite3", - category: "database", + category: Category.DATABASE, lossless: false }, // Lossy because extracts only tables diff --git a/src/handlers/terrariawld.ts b/src/handlers/terrariawld.ts index 7a5f1e3c..a00dfd33 100644 --- a/src/handlers/terrariawld.ts +++ b/src/handlers/terrariawld.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { FileReader } from "src/handlers/terraria-wld-parser/src/"; // CODE BELOW IS WRITTEN BY PIXELKAT5 IN PR #244 @@ -888,7 +888,7 @@ class terrariaWldHandler implements FormatHandler { from: true, to: false, internal: "wld", - category: "data", + category: Category.DATA, lossless: false, }, diff --git a/src/handlers/textToSource.ts b/src/handlers/textToSource.ts index 925333d1..a0b3f0ce 100644 --- a/src/handlers/textToSource.ts +++ b/src/handlers/textToSource.ts @@ -1,7 +1,7 @@ // file: textToSource.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; function python(text: string): string { return `print(${JSON.stringify(text)})`; @@ -69,7 +69,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "js", - category: "code", + category: Category.CODE, lossless: true, }, javascript], [{ @@ -80,7 +80,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "c", - category: "code", + category: Category.CODE, lossless: true, }, c], [{ @@ -91,7 +91,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "cpp", - category: "code", + category: Category.CODE, lossless: true, }, cpp], [{ @@ -102,7 +102,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "go", - category: "code", + category: Category.CODE, lossless: true, }, go], [CommonFormats.BATCH.builder("bat").allowTo().markLossless(), batch], @@ -115,7 +115,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "csharp", - category: "code", + category: Category.CODE, lossless: true, }, csharp], [{ @@ -126,7 +126,7 @@ class textToSourceHandler implements FormatHandler { from: false, to: true, internal: "rs", - category: "code", + category: Category.CODE, lossless: true, }, rust], ]; diff --git a/src/handlers/threejs.ts b/src/handlers/threejs.ts index 5e460cf3..da893cdb 100644 --- a/src/handlers/threejs.ts +++ b/src/handlers/threejs.ts @@ -1,4 +1,4 @@ -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; import * as THREE from "three"; @@ -18,7 +18,7 @@ class threejsHandler implements FormatHandler { from: true, to: false, internal: "glb", - category: "model", + category: Category.MODEL, lossless: false }, { @@ -29,7 +29,7 @@ class threejsHandler implements FormatHandler { from: true, to: false, internal: "glb", - category: "model", + category: Category.MODEL, lossless: false }, { @@ -40,7 +40,7 @@ class threejsHandler implements FormatHandler { from: true, to: false, internal: "obj", - category: "model", + category: Category.MODEL, lossless: false, }, CommonFormats.PNG.supported("png", false, true), diff --git a/src/handlers/turbowarp.ts b/src/handlers/turbowarp.ts index 1c61caec..2640fca2 100644 --- a/src/handlers/turbowarp.ts +++ b/src/handlers/turbowarp.ts @@ -1,7 +1,7 @@ // file: turbowarp.ts import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import { Packager, largeAssets, downloadProject } from "turbowarp-packager-browser"; // patching some assets @@ -21,7 +21,7 @@ class turbowarpHandler implements FormatHandler { from: true, to: false, internal: "sb3", - category: "archive", + category: Category.ARCHIVE, lossless: false, }, CommonFormats.HTML.builder("html") diff --git a/src/handlers/txtToInfiniteCraft.ts b/src/handlers/txtToInfiniteCraft.ts index e4e37220..acc07b78 100644 --- a/src/handlers/txtToInfiniteCraft.ts +++ b/src/handlers/txtToInfiniteCraft.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class txtToInfiniteCraftHandler implements FormatHandler { @@ -18,7 +18,7 @@ class txtToInfiniteCraftHandler implements FormatHandler { from: false, to: true, internal: "ic", - category: "archive", + category: Category.ARCHIVE, lossless: false }, ]; diff --git a/src/handlers/vexflow.ts b/src/handlers/vexflow.ts index 5a396f77..8861c8c9 100644 --- a/src/handlers/vexflow.ts +++ b/src/handlers/vexflow.ts @@ -1,7 +1,7 @@ import * as vexml from '@stringsync/vexml'; import VexFlow from 'vexflow'; -import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from 'src/CommonFormats.ts'; +import type { FileData, FileFormat, FormatHandler } from '../FormatHandler.ts'; +import CommonFormats, { Category } from 'src/CommonFormats.ts'; import { buildMidi, addNote } from './midi/midifilelib.js'; class VexFlowHandler implements FormatHandler { @@ -16,7 +16,7 @@ class VexFlowHandler implements FormatHandler { CommonFormats.MUSICXML.builder("musicxml").allowFrom(), CommonFormats.MXL.builder("mxl").allowFrom(), CommonFormats.HTML.builder("html").allowTo(), - { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: false, to: true, internal: "mid", category: "audio", lossless: false } + { name: "MIDI", format: "mid", extension: "mid", mime: "audio/midi", from: false, to: true, internal: "mid", category: Category.AUDIO, lossless: false } ]; // Load VexFlow fonts (required for VexFlow 5) diff --git a/src/handlers/vtf.ts b/src/handlers/vtf.ts index 3114e3e8..8f77dea0 100644 --- a/src/handlers/vtf.ts +++ b/src/handlers/vtf.ts @@ -1,4 +1,4 @@ -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; const TEXTUREFLAGS_ENVMAP = 0x00004000; @@ -809,7 +809,7 @@ class vtfHandler implements FormatHandler { from: true, to: false, internal: "vtf", - category: "image", + category: Category.IMAGE, lossless: false }, CommonFormats.PNG.supported("png", false, true, true), diff --git a/src/handlers/xcf.ts b/src/handlers/xcf.ts index 38f57907..8143d342 100644 --- a/src/handlers/xcf.ts +++ b/src/handlers/xcf.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; import XCF from "./gimper/src/main.js"; class xcfHandler implements FormatHandler { @@ -21,7 +21,7 @@ class xcfHandler implements FormatHandler { from: true, to: false, internal: "xcf", - category: "image", + category: Category.IMAGE, lossless: true }, CommonFormats.PNG.builder("png") diff --git a/src/handlers/xcursor.ts b/src/handlers/xcursor.ts index fe8a5b8f..095bd81f 100644 --- a/src/handlers/xcursor.ts +++ b/src/handlers/xcursor.ts @@ -1,5 +1,5 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"; -import CommonFormats from "src/CommonFormats.ts"; +import CommonFormats, { Category } from "src/CommonFormats.ts"; class xcursorHandler implements FormatHandler { @@ -15,7 +15,7 @@ class xcursorHandler implements FormatHandler { from: true, to: false, internal: "xcur", - category: "image", + category: Category.IMAGE, lossless: true }, ];