mwg API
    Preparing search index...

    Function packageContent

    • The namespaced view of a set: every id becomes packageId:id, and every reference written without a prefix is resolved to the same package first. A reference that already has a prefix points at another package and is left alone. Each item records the package it came from.

      Parameters

      Returns PackageContent

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

      const source = "[{ tag: 'package', id: 'marta', version: '1.0.0' }, { tag: 'music', id: 'theme', src: 'song' }]";
      const bytes = await encodePackage([{ path: 'content.mwl', data: new TextEncoder().encode(source) }]);
      console.log(packageContent(mergePackage(await loadPackage(bytes))).music['marta:theme']?.src); // 'marta:song'