Web Application Specification Languages (WASL) 1.0

Npm package version
Npm package monthly downloads
License: AGPL v3
Discord

WASL is a specification language for defining Web applications. It allows JavaScript developers to specify a JSON tree of source files and custom scripts. This then executes a program stored across the Web.

Note: WASL is a core technology of the Brains@Play Framework

The Details

WASL files inherit heavily from the package.json file from Node.js, allowing for less duplication of work when publishing to NPM.

The specification is written in JSON Schema and validated using Ajv. Typescript types are generaged using json-schema-to-typescript.

Each version of wasl is archived in the versions folder of this repository.

Design Highlights

  • New components and listeners fields that declare application code files and associations with other files.
  • The adoption of ES Plugins to instantiate Web Components through a configuration object

Example WASL File

{
    "components": {
        "first": {
            "src": "first.wasl.json",
            "extensions": {
                "arbitrary": {
                    "x": 1080,
                    "y": 720
                }
            }
        } ,
        "second": {
            "href": "https://example.com/second",
            "children": {
                "third": true
            }
        },
         "third": {
            "src": "./test.js"
        } 
    },

    "listeners": {
        "first.component": {
            "second": true
        }
    }
}

The Libraries

The libraries in this repo validate and load WASL files into JavaScript.

Libraries

  1. wasl - Load the src keys into a WASL file.
  2. wasl-validate - Validation of a WASL file using JSON Schema (Ajv)
  3. wasl-run - Minimal execution of a WASL graph loaded using wasl

Features

  • Validation of original JSON files and loaded objects against the JSON Schema
  • Automatic merging of ESM imports specified using the src key (anywhere in the WASL file!) to their containing objects.

Errors vs Warnings

Errors indicate that the WASL file will not run.

Warnings indicate that there is suboptimal syntax in the files themselves. However, these are corrected to load the file and don't impact loaded object format.

Contributing

Note: Use Node v16.15.0 or higher (which support import assertions for JSON files) to run the tests

Acknowledgments

This library is maintained by Garrett Flynn and Joshua Brewster, who use contract work and community contributions through Open Collective to support themselves.

Backers

Support us with a monthly donation and help us continue our activities!






























Sponsors

Become a sponsor and get your logo here with a link to your site!