22 lines
622 B
TypeScript
22 lines
622 B
TypeScript
import type { Config } from "../../core/config";
|
|
import { Target } from "./target";
|
|
|
|
export type PackerFactory = new (config: Config) => Packer;
|
|
|
|
export class Packer extends Target {
|
|
static factory: Record<string, Record<string, PackerFactory>> = {};
|
|
|
|
call() {
|
|
throw "Not Implemented";
|
|
}
|
|
|
|
static register(platform: string, name: string, packer: PackerFactory) {
|
|
if (!Packer.factory[platform]) Packer.factory[platform] = {};
|
|
Packer.factory[platform][name] = packer;
|
|
}
|
|
|
|
static new(config: Config, platform: string, name: string): Packer {
|
|
return new Packer.factory[platform][name](config);
|
|
}
|
|
}
|