mwg API
    Preparing search index...

    Function mergePackage

    • Adds a package to a content set (a new set; the old one is untouched). Dependencies named by import must already be in the set. Two versions of one package may coexist: the newest owns the plain packageId:id names, every version answers to packageId@version:id.

      Parameters

      Returns PackageSet

      import { encodePackage, loadPackage, mergePackage, packageContent } from '@datamoc/mwg/mwl';

      const source = "[{ tag: 'package', id: 'marta', version: '1.0.0' }, { tag: 'sound_effect', id: 'ouch', chip: 'sn76489' }]";
      const bytes = await encodePackage([{ path: 'content.mwl', data: new TextEncoder().encode(source) }]);
      const set = mergePackage(await loadPackage(bytes));
      console.log(Object.keys(packageContent(set).soundEffects)); // ['marta:ouch']