import { compilePackages, encodePackage, loadPackage, mergePackage } from '@datamoc/mwg/mwl';
const source = "[{ tag: 'package', id: 'marta', version: '1.0.0' }, { tag: 'character', id: 'marta', hitpoints: 28 }]";
const bytes = await encodePackage([{ path: 'content.mwl', data: new TextEncoder().encode(source) }]);
console.log(compilePackages(mergePackage(await loadPackage(bytes))).roots[0]?.attributes.id); // 'marta:marta'
Compiles a content set: each character expands into a
unit_typenamedpackageId:id, and the result is an ordinary compiled game, with the packages'_()strings inmessagesand the packages' media paths inassets. A set with no package compiles to an empty game.