tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

program-catalogue.js (1603B)


      1 import { packageReleases } from './packages.js';
      2 export const exampleGroups = ['Basic Examples', 'Practical Examples', 'Language & Runtime Explorations'];
      3 export function exampleGroup(entry) {
      4     return entry.category ?? (['microscope', 'parser', 'lexer'].includes(entry.id) ? 'Language & Runtime Explorations' : 'Practical Examples');
      5 }
      6 export function libraryLabel(name) {
      7     if (name === 'tricu-lib-packages-base')
      8         return 'base · convenience interface';
      9     if (name === 'tricu-lib-packages-io')
     10         return 'io · convenience interface';
     11     if (name === 'tricu-compiler')
     12         return 'compiler · combined toolchain';
     13     if (name === 'tricu-source-builder')
     14         return 'source-builder · native entrypoint';
     15     return name.replace(/^tricu-lib-/u, '').replace(/^tricu-/u, '');
     16 }
     17 // Publication names may be aliases of exactly the same native module. Prefer
     18 // filesystem library publications, while keeping distinct interfaces separate.
     19 // Historical releases remain in the registry and reachable by bundle hash.
     20 export function selectorLibraries(releases) {
     21     const latest = [...new Set(releases.map(r => r.name))].map(name => packageReleases(releases, name)[0]).filter(r => !r.demo);
     22     latest.sort((a, b) => Number(b.name.startsWith('tricu-lib-')) - Number(a.name.startsWith('tricu-lib-')) || a.name.localeCompare(b.name));
     23     const manifests = new Set();
     24     return latest.filter(r => { if (manifests.has(r.manifest))
     25         return false; manifests.add(r.manifest); return true; })
     26         .sort((a, b) => libraryLabel(a.name).localeCompare(libraryLabel(b.name)));
     27 }