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

convolvr-ecs

v1.5.29

Published

Functional, object oriented script language & interpreter for web workers and nodejs.

Downloads

16

Readme

ECS Language · npm version License: MIT Discord

Entity Control Script interpreter with api for Convolvr.

Install

npm install --save convolvr-ecs

Transpile into your favorite language!

ecs -t js main.ecs > main.js
ecs -t java main.ecs > main.java
ecs -t c main.ecs > main.c

Install your favorite Un-Parser:

import { ECS } from 'convolvr-ecs';
import { Java } from 'convolvr-ecc';

const augmentedAST: ParseResult = ECS.parse("for(x, 1000) { print(x * x); }");
const javaCode: string = ECS.transpile(augmentedAST, Java)

CLI usage:

ecs some-file.ecs
ecs # to enter interactive mode
npm start -- program.ecs # to run without npm link(ing)

Use with an Entity-Component System:

Component c = Component(); /* current component */

c.addComponent(new Component({
 attrs: { 
      geometry: { shape: "box", size: [2,2,2]}, 
      material: { color: 255 }  
 } 
})); 

c.events().staticCollisions.hit(fn( hitTelemetry ){    
      c.actions().chat.send("Robot: Owch!");
      c.actions.movement.setVelocity([0, -1, 0]);
});

^^^ See "WebWorker usage", below for implementation details.

JS module usage:

import { ECS } from 'convolvr-ecs';

const vm = ECS.makeRuntimeEnvironment(), 
      env = vm.makeEnvironment();

vm.parseAndEvaluate(
      "print('hello')", 
      env, 
      (errs) => console.warn(errs)
)

WebWorker usage:

Send command to ECS Web Worker

Handle response from ECS Web Worker

Hacking the interpreter:

git clone [email protected]:convolvr/ecs.git
cd ecs && npm install && npm run-script build
# npm start to start interactive mode

For the server-side implementation, check out https://github.com/SpaceHexagon/ecs

TODO: finish writing this readme

class Salad {
 Salad: fn() { },
 private sauce: "ceaser",
 final lettuce: "iceberg",
 static toppings: ["bacon", "chicken", "parmesean"],
 describe: fn() {
  return this.sauce + ", " + join(this.toppings, ",") 
 },
 toss: fn() { 
   let toppings = this.toppings;
   this.toppings = [ toppings[1], toppings[2], toppings[0] ]; 
 }
}
let dinner = new Salad();

dinner.describe();
dinner.toss();
let colors = [" ", "`", ".", "'", ",", "-", "+", "/", "\", "=", "L", "H", " ", "#", "@"];
let size = terminal.getDimensions();
for (y, size[1]) {
 let s = "-";
 let idx = 0;
 for (x, size[0]-1) {
   if ((x/2 + y/2) % 10 <5) {
    idx = (x/1+y)%4;
   }
   if ((x/2 - y/2)% 10 <5) {
    idx = 2+(x*y) % 9;
   }
   s = s + colors[idx];
  }
  print(s);
 }
-..................................................................................................
-.',-+/\=L.''''''''' `-+/\=L.',--------- `/\=L.',-+///////// `=L.',-+/\========= `.',-+/\=L........
-.,+\L'-/=.,+++++++ `.'L'-/=.,+\LLLLLLL `.'-/=.,+\L'------- `.'=.,+\L'-/======= `.',+\L'-/=.,,,,,,,
-.-\.-\.-\.-\..... `.' `\.-\.-\.-\\\\\ `.' `-\.-\.-\.----- `.' `.-\.-\.-\..... `.' `\.-\.-\.-\\\\\
-.+L-=,\'/.+L-=== `.' `.'\'/.+L-=,\\\ `.' `.'/.+L-=,\'/// `.' `.'+L-=,\'/.+++ `.' `.'-=,\'/.+L--- `
-./'\,=-L+./'\,= `.' `.' `L+./'\,=-L `.' `.' `./'\,=-L+. `.' `.' `'\,=-L+./' `.' `.' `,=-L+./'\, `.
-.\-.\-.\-.\-.\-..' `.' ```-.\-.\-.\-.' `.' ```\-.\-.\-.\.' `.' ```.\-.\-.\-..' `.' ```-.\-.\-.\-.'
-.=/-'L\+,.=/-'L\+ `.' `````.=/-'L\+,. `.' `````/-'L\+,.=/ `.' `````'L\+,.=/-' `.' `````\+,.=/-'L\
-.L=\/+-,'.L=\/+-,'.' ```````L=\/+-,'.L.' ```````\/+-,'.L=\.' ```````+-,'.L=\/+.' ```````,'.L=\/+-,
-................... `````````.......... `````````.......... `````````.......... `````````.........
-.',-+/\=L.',-+/\=L.'''''''''''-+/\=L.',-----------/\=L.',-+///////////=L.',-+/\===========.',-+/\=
-.,+\L'-/=.,+\L'-/=.,+++++++++ `L'-/=.,+\LLLLLLLLL `-/=.,+\L'--------- `=.,+\L'-/========= `,+\L'-/
-.-\.-\.-\.-\.-\.-\.-\....... `.'\.-\.-\.-\\\\\\\ `.'-\.-\.-\.------- `.'.-\.-\.-\....... `.'\.-\.-
-.+L-=,\'/.+L-=,\'/.+L-===== `.' `\'/.+L-=,\\\\\ `.' `/.+L-=,\'///// `.' `+L-=,\'/.+++++ `.' `-=,\'
-./'\,=-L+./'\,=-L+./'\,=== `.' `.'L+./'\,=-LLL `.' `.'./'\,=-L+... `.' `.''\,=-L+./''' `.' `.',=-L
-.\-.\-.\-.\-.\-.\-.\-.\-. `.' `.' `-.\-.\-.\- `.' `.' `\-.\-.\-.\ `.' `.' `.\-.\-.\-. `.' `.' `-.\
-.=/-'L\+,.=/-'L\+,.=/-'L\+.' `.' ```.=/-'L\+,..' `.' ```/-'L\+,.=/.' `.' ```'L\+,.=/-'.' `.' ```\+
-.L=\/+-,'.L=\/+-,'.L=\/+-,' `.' `````L=\/+-,'.L `.' `````\/+-,'.L=\ `.' `````+-,'.L=\/+ `.' `````,
-.............................' ```````...........' ```````...........' ```````...........' ```````
-.',-+/\=L.',-+/\=L.',-+/\=L.' `````````-+/\=L.',- `````````/\=L.',-+/ `````````=L.',-+/\= ````````
-.,+\L'-/=.,+\L'-/=.,+\L'-/=.,+++++++++++L'-/=.,+\LLLLLLLLLLL-/=.,+\L'-----------=.,+\L'-/=========
-.-\.-\.-\.-\.-\.-\.-\.-\.-\.-\......... `\.-\.-\.-\\\\\\\\\ `-\.-\.-\.--------- `.-\.-\.-\........
-.+L-=,\'/.+L-=,\'/.+L-=,\'/.+L-======= `.'\'/.+L-=,\\\\\\\ `.'/.+L-=,\'/////// `.'+L-=,\'/.+++++++
-./'\,=-L+./'\,=-L+./'\,=-L+./'\,===== `.' `L+./'\,=-LLLLL `.' `./'\,=-L+..... `.' `'\,=-L+./'''''
-.\-.\-.\-.\-.\-.\-.\-.\-.\-.\-.\-... `.' `.'-.\-.\-.\--- `.' `.'\-.\-.\-.\\\ `.' `.'.\-.\-.\-... `
-.=/-'L\+,.=/-'L\+,.=/-'L\+,.=/-'L\+ `.' `.' `.=/-'L\+,. `.' `.' `/-'L\+,.=/ `.' `.' `'L\+,.=/-' `.
-.L=\/+-,'.L=\/+-,'.L=\/+-,'.L=\/+-,'.' `.' ```L=\/+-,'.L.' `.' ```\/+-,'.L=\.' `.' ```+-,'.L=\/+.'
-..................................... `.' `````.......... `.' `````.......... `.' `````..........

Fractal example: https://tinyurl.com/y228w9qm

const colors = split('.,.,.,-,-,_,+,+,/,=,L,7,H,%,#,@', ',');
for(x, 120) {
 string out = "";
 for(y, 200) {
		int i=0;
		float cx=-2+x/50;
		float cy=-2+y/150;
		float zx=0;
		float zy=0;
		while(i<255&&(zx*zx-zy*zy)<4){
 	float xt=zx*zy;
		 	zx=zx*zx+zy*zy+cx;
			zy=2*xt+cy;
			i = i + 1;
		}
		out = out + colors[i%12];
 }
 print(out);
}