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