npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lionweb/utilities

v0.6.10

Published

LionWeb utilities

Downloads

302

Readme

The utilities package

license CI npm

An NPM package that can be added to a Node.js/NPM codebase as follows:

$ npm add @lionweb/utilities

It contains utilities on top of the core package, such as:

  • Diagram generation (PlantUML and Mermaid) from an M2.
  • “Textualization”, i.e. render a serialization chunk as text.
  • Sort the contents of a serialization chunk as much as possible, for the sake of comparing serialization chunks.
  • Compute metrics for a serialization chunk (also relative to a given M2).
  • Infer a (partial) M2 from a serialization chunk.
  • Generation of TypeScript type definitions from an M2.

Changelog

0.6.9

  • Make withoutAnnotations not modify the original serialization chunk.
  • (Use the littoral-templates package for textualization — of M2s, so far. This is a technical change, not a functional one, except for maybe some extra whitespace.)
  • Add reference utilities that all return ReferenceValue objects:
    • referenceValues(<source node>, <extraction facade>): all references within the given scope.
    • incomingReferences(<target node(s)>, <search scope>, <extraction facade>): all (unique) references coming into the given target node(s) from the search scope.
    • referencesToOutOfScopeNodes(<scope>, <extraction facade>) all reference targets that are not in the given scope.

0.6.8

  • Add a withoutAnnotations function that removes all annotations, and all their descendants, from a serialization chunk.
  • The inferLanguagesFromSerializationChunk function now detects whether a property is optional from null values in the serialization.

0.6.7

  • (Depend on @lionweb/core version 0.6.7.)

0.6.6

  • (Depend on @lionweb/core version 0.6.6.)

0.6.5

  • TS types generator now generates 1 file per language. The generator also has several fixes, and assumes that the generated code will be embedded in an ES6 module.

0.6.4

  • Rename inferLanguagesFromChunkinferLanguagesFromSerializationChunk (for consistency).
  • Extend the functionality of the measure metrics function.

0.6.3

  • Add a inferLanguagesFromChunk function that infers a language from a serialization chunk.
  • Renaming for consistency and clarity:
    • readChunkreadSerializationChunk
    • tryLoad[All]AsLanguagestryRead[All]AsLanguages
  • tryReadAllAsLanguages combines all serialization chunks (that are the result of serializing Languages) into one before attempting to deserialize, in order to have cross-language references resolve.

0.6.2

  • Add a function measure that computes metrics on a serialization chunk.

0.6.1

  • Improve PlantUML and Mermaid diagram generation:
    • Primitive types now rendered as classes marked as "<>".
    • Concepts or Annotations that extend the "Node" concept built into LionCore don't show that.
    • Optional (single-valued) features are now shown with a question mark (?) directly after the type, instead of being marked as "<>".
    • Fix/add support for annotations.
  • Remove all Ecore functionality (=issue #121)

0.6.0

  • Add support for annotations in diagram generation (PlantUML and Mermaid), and textualization.
  • Remove the shortenedSerializationChunk function, as it isn't used, nor very useful compared to the sorting and textualization.
  • Breaking name changes: rename asTextlanguageAsText, shortenedSerializationshortenedSerializationChunk, sortedSerializationsortedSerializationChunk.
  • Expose an isSerializedLanguages function.
  • Expose an orderedSerializationChunk function that aligns the JSON key-value pairs in a serialization chunk according to the specification of the serialization format. That means that key-value pairs appear in precisely the same order as they do in the specification, and that missing key-value pairs are put in and get their default values.
  • Expose a generic textual syntax for serialization chunks, through the genericTreeAsText function. This function is optionally language-aware: by providing an array of Languages as its second argument, it will try and look up LanguageEntity and Feature names instead of rendering their keys.

0.5.0

This is the first version corresponding to a release of LionWeb (version: 2023.1) as a whole.

  • Update for the presence of annotations on a(ny) Node.
  • Move the readChunk function from @lionweb/cli to @lionweb/utilities.
  • Also generate TypeScript type definitions for Annotations.
  • Sort everything in sortedSerialization.
  • Extend textual syntax for "multi-linguality".
  • Implement textual syntax for Annotations.
  • Breaking change: Change ID generation to hashing (hasher function).
  • (Make small, cosmetic fix in asText function.)
  • Add a function tsTypesForLanguage that generates TypeScript types.
  • Receive asText and ID checking from @lionweb/core.

No changelog has been kept for previous versions, regardless of whether these were published or not.

Development

Build it from source as follows:

npm run build