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

relic-lang

v1.1.1

Published

Relic, a compiler for JS(X) and TS(X)

Downloads

10

Readme

Relic

Relic is a coding language made to compile implicit yet readable code to pure, modern JavaScript. Since Relic is just a compiler for JavaScript, it can handle and compile expressions of both languages.

This package is still under development, and is not recommended to be used in production. Some parts of JavaScript are still not supported.

Overview

Relic

MyTypes as '', 1, false, null, foo: \bar

for index, value in MyTypes
  _type = typeof value

  console.log `{_type} value at {index}`

JavaScript output

let MyTypes;

MyTypes = [
    '', 1, false, null, { foo: "bar" }
];

for (index in (_j = MyTypes)) {
    value = _j[index];

    _type = typeof value;

    console.log(`${_type} value at ${index}`);
}

Installation

With Node.js

# for local development...
npm install --save-dev relic-lang

# if you'd like to use 'els' command globally...
npm install -g relic-lang

Usage

Command Line Interface

# with `.rcconfig`
rc

# compile a file manually
rc -c path/to/file.els

# compile a directory
rc -c path/to/folder path/to/destination

On Node.js

import Relic from 'relic-lang'

// prints "hello('world!');"
console.log(
  Relic.compile("hello 'world!'").output
);

// ---------

// parse a Relic Object Notation file
import fs from 'fs'

var RON = fs
  .readFileSync('path/to/.ron', { encoding: 'utf-8' });

console.log(
  Relic.toJSON(RON)
)

References

Structure of a .rcconfig file

(.rcconfig has the syntax of a .ron file)

Do not place newlines between properties, or the file will be treated as an array.

sourceDir: 'path/to/folder'
# or...
sourceRoot: 'path/to/root' # optional
files:
  'my-file.rc'
  'another-file.rc'
# -----
compilerOptions:
  # whether you want a source map to be generated
  sourceMaps: yes or no
  # whether to place the source map as a data URI 
  # or generate a '.js.map' file containing the map
  inlineMap: yes or no
  # the output directory for all scripts
  # use '@' for same directory
  outDir: 'path/to/destination'
  # the extension of the output files
  # if .elson, the output will be .json
  # set to '.rc.js' by default
  outExtension: '.js'
  # -----------------
  # --- For TypeScript support (still working on it)
  # -----------------
  # whether the output will be a TypeScript file
  # (only for files containing typed expressions) 
  preserveTS: yes or no
  # skip all diagnostics if there's any
  # if false, the file will not be compiled
  # if there's any error
  omitDiagnostics: yes or no