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

@zenparsing/skert

v0.0.16

Published

A JavaScript Dream

Downloads

6

Readme

SkertJS

JavaScript-to-JavaScript compiler tools for holistic language design.

About

SkertJS reimagines the future of JavaScript with simple features that address common problems and work well together.

Features

Top-Level Await

Top-level await allows the programmer to use use await expressions from the top level of a module body.

let response = await fetch(url);
let text = await response.text();
console.log(text);

NOTE: Currently, top-level await is not supported in modules with export declarations.

Call-With Operator

The call-with binary operator (->) allows the programmer to call a function as if it were a method.

function sayHello(obj, timeOfDay) {
  console.log(`Good ${ timeOfDay }, I'm ${ obj.name }.`);
}

let me = { name: '@zenparsing' };

me->sayHello('morning'); // "Good morning, I'm @zenparsing."

Method Extraction Operator

The method extraction prefix operator (&) allows the programmer to extract a method from an object. The extracted method is bound to the object.

let me = {
  name: '@zenparsing',
  hello() { return `Hello, I'm ${ this.name }.`; }
};

let hello = &me.hello;

console.log(hello); // "Hello, I'm @zenparsing."

// Method extraction is idempotent
console.log(hello === &me.hello); // true

Null Coalescing Operator

The null coalescing binary operator (??) allows the programmer to specify a default value when applied to null or undefined.

let obj = { x: 0, y: null };

console.log(obj.x ?? 1); // 0
console.log(obj.y ?? 1); // 1
console.log(obj.z ?? 1); // 1

Symbol Names

Symbol names allow the programmer to effectively use symbols that are local to a module or script.

let obj = {
  @foo: 1
};

console.log(obj.@foo); // 1
console.log(Reflect.ownKeys(obj)); // [Symbol('@foo')]

Build-Time Macros

Macros give the user the ability to transform the program structure at build-time.

import { deprecated } from './macros/deprecated.js';

#[deprecated]
function dontUseMeAnymore() {
  eval('You wrote a bad song Petey!');
}
import { templates } from 'ast-helpers';

export function deprecated(ast) {
  ast.body.statements.unshift(templates.statement`
    console.warn('This function is deprecated');
  `);
  return ast;
}

Class Mixins

Class mixins allow the programmer to copy additional methods from another class.

class A {
  a() { return 'a' }
}

class B {
  b() { return 'b' }
}

class C with A, B {}

const c = new C();

c.a(); // 'a'
c.b(); // 'b'

Class Initializer Blocks

Class initializer blocks allow the programmer to execute code when a class is defined.

class Widget extends HTMLElement {
  static {
    window.customElements.define('acme-widget', this);
  }
}

Install

npm install @zenparsing/skert

CLI

skertc [input_path] ...options

Options

  • --output [output_path], -o [output_path]: Specifies the output file or directory
  • --script: Parse the input file or files as scripts instead of modules
  • --cjs: Output CommonJS-formatted modules
  • --sourcemaps, -s: Output source maps

API

compile(code, options = {})

Compiles the specified input string and returns a CompileResult object.

Options

  • module (boolean): If true, the input is parsed as a module instead of a script.
  • transformModules (boolean): If true, modules are translated into CommonJS format.
  • context (Map): A map containing state which can be persisted between calls.
  • location (string): The path associated with code.
  • sourceMap (boolean | 'inline'): If, true a source map will be generated and attached to the result object. If 'inline', the source map will be added to the output code.

Example

import { compile } from '@zenparsing/skert';

let result = compile('export const x = 1;', {
  module: true,
});

console.log(result.output);

CompileResult

Properties

  • output (string): The compiled output
  • mappings (Array): A list of input-to-output source code mappings
  • sourceMap (null | JSON): A source map JSON object
  • context (Map): A Map representing compiler state