Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hashart

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashart - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

art/nes.js

6

art/automata.js

@@ -108,3 +108,7 @@ const { Art } = require("./_base.js");

const lookup = Object.fromEntries(this.ruleToLookup(rule * 256));
const lookup = {};
this.ruleToLookup(rule * 256).forEach(([seq, val]) => {
lookup[seq] = val;
});
for (let i = 0; i < Math.floor(h / bitSize) + 1; i++) {

@@ -111,0 +115,0 @@ row = this.nextRow(row, lookup);

2

art/mario.js

@@ -5,3 +5,3 @@ const { Art } = require("./_base.js");

class Mario extends Art {
// requires SRC_ROOT/vendor/rom.nes
// requires SRC_ROOT/vendor/roms/mariobros.nes
constructor() {

@@ -8,0 +8,0 @@ super({

@@ -22,2 +22,4 @@ const { Circle } = require("./circle.js");

const { Automata } = require("./automata.js");
const { Nes } = require("./nes.js");
const { Spinner } = require("./spinner.js");

@@ -46,2 +48,4 @@ module.exports = {

automata: Automata,
nes: Nes,
spinner: Spinner,
};
{
"name": "hashart",
"version": "0.0.6",
"version": "0.0.7",
"scripts": {

@@ -14,3 +14,2 @@ "dev": "next dev",

"devDependencies": {
"nodemon": "^2.0.7",
"canvas": "^2.7.0",

@@ -20,5 +19,7 @@ "classnames": "^2.2.6",

"express": "^4.17.1",
"glob": "^7.2.0",
"jsnes": "^1.1.0",
"lodash.debounce": "^4.0.8",
"next": "^11.1.2",
"nodemon": "^2.0.7",
"react": "^17.0.2",

@@ -25,0 +26,0 @@ "react-dom": "^17.0.2"

@@ -31,3 +31,3 @@ ## hashart

```
docker run --rm -p "3000:3000" -v "/path/to/mariobros.nes:/app/vendor/rom.nes" docker.pkg.github.com/jdan/hashart/hashart-srv:latest
docker run --rm -p "3000:3000" -v "/path/to/mariobros.nes:/app/vendor/roms/mariobros.nes" docker.pkg.github.com/jdan/hashart/hashart-srv:latest
```

@@ -34,0 +34,0 @@

@@ -11,3 +11,3 @@ /**

const VENDOR_PATH = path.join(__dirname, "../vendor");
const ROM_PATH = path.join(VENDOR_PATH, "rom.nes");
const ROM_PATH = path.join(VENDOR_PATH, "roms/mariobros.nes");
const STATE_PATH = path.join(VENDOR_PATH, "state.json");

@@ -27,3 +27,5 @@

if (!fs.existsSync(ROM_PATH)) {
console.log("vendor/rom.nes not found, skipping state generation...");
console.log(
"vendor/roms/mariobros.nes not found, skipping state generation..."
);
return;

@@ -30,0 +32,0 @@ } else if (fs.existsSync(STATE_PATH)) {

@@ -6,3 +6,5 @@ const express = require("express");

const fs = require("fs");
const glob = require("glob");
const jsnes = require("jsnes");
const path = require("path");
const pieces = require("./art/pieces.js");

@@ -33,3 +35,3 @@ const generateState = require("./scripts/generate-state.js");

<li><a href="/mario/800/600/jdan.png">/mario/800/600/jdan.png</a> (requires $ROOT/vendor/rom.nes)</li>
<li><a href="/mario/800/600/jdan.png">/mario/800/600/jdan.png</a> (requires $ROOT/vendor/roms/mariobros.nes)</li>
</ul>

@@ -72,3 +74,5 @@

if (!state) {
res.send("State snapshot not found (does $ROOT/vendor/rom.nes exist?)");
res.send(
"State snapshot not found (does $ROOT/vendor/roms/mariobros.nes exist?)"
);
return;

@@ -93,2 +97,29 @@ }

};
} else if (piece === "nes") {
let latestFrameBuffer = null;
const nes = new jsnes.NES({
onFrame: function (frameBuffer) {
latestFrameBuffer = frameBuffer;
},
});
const romsGlob = path.join(__dirname, "vendor/roms/**/*.nes");
const roms = glob.sync(romsGlob);
if (roms.length === 0) {
res.send("No roms found (place them in $ROOT/vendor/roms)");
return;
}
const secondCanvas = createCanvas(parseInt(width), parseInt(height));
props = {
nes,
roms,
fs,
path,
getFrameBuffer() {
return latestFrameBuffer;
},
secondCtx: secondCanvas.getContext("2d"),
};
}

@@ -95,0 +126,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc