New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

goldfish-compiler

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goldfish-compiler

A CLI based compiler to convert es6 javascript to ASP Classic pages with dynamic polyfilling and hot-reloading.

  • 2.4.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-35.19%
Maintainers
1
Weekly downloads
 
Created
Source

Goldfish

A CLI based compiler to convert ES6 Javascript to ASP Classic pages with dynamic polyfilling and dependency management.

As of 2.2.x Goldfish now supports nested folders/file structures, so if you were using it flatly before 2.2.x bear that in mind.

Updates

  • Goldfish Compiler now uses Babel loosely to fix problems in the JScript environment - 2.4.2
  • Bugfixes - 2.4.1
  • Changed temp use, faster by ~50%+ - 2.4.0
  • Added use of .goldfish.json - 2.3.0
  • Add support for nested folders/file structures - 2.2.0

Features

  • Automatic and dynamic polyfilling from ES6 to ES3
  • Custom ASP include system
  • Not as fishy as it sounds

Getting Started

You must have Nodejs installed

npm install -g goldfish-compiler

Now, in any directory enter goldfish to build!

Default & Dev

Protip: Arguments like --in, --out and --ext are universal.

Types
  • goldfish - classic once-off
  • goldfish dev - hot-compiling on-save for development
Information
CommandParametersDefault
goldfishAll (see below)See below.
goldfish dev--min, --in, --out, --ext, --nolog, --nodeps, --hostSee below.
Parameters

All parameters are prefixed with double dash (i.e goldfish --min)

ArgumentDescriptionExampleDefault
minMinify the compiled files. Slower than the default pretty-printed files.na.disabled
outThe output location for the compiled files.goldfish --out api will output the files to a folder called "api".--out dist
inThe file location of the files to compile.goldfish --in src will build the files inside the folder "src".Current directory.
extThe file extension of the files to compile. ("." emitted.)goldfish --ext js will output the files in a folder called "api".--ext es6
nodepsDon't include the default included depedencies (i.e JSON2)na.disabled
nologDon't replace Javascript's console.log with Response.Writena.enabled
hostip and port for polyfill service API.192.168.0.1:5858https://polyfill.io/
vLog the current version.na.na.

All these arguments can be used in a .goldfish.json file in your working directory. So:

{
  "ext": "js",
  "host": "192.168.100.1:3000",
  "in": "./apis"
}

Order of importance is: command arguments > .goldfish.json > defaults

ASP Specific Methods

Here's an example of an ASM:

const user = "Shaggy"
Session("user") = user;

console.log(Session("user"))

Since that's invalid javascript, the compilers break and explode and nobody's happy. To fix this, add //* before JS breaking ASMs. The correct way to do this is:

const user = "Shaggy"
//* Session("user") = user;

console.log(Session("user"))

And viola!

Compiled File Structure

Let's say we have a ES6 file like this:

// example.es6
console.log('nice!');

...after goldfish is done, that becomes example.asp inside dist/:

<!--#include file="_pf.asp"-->
<!--#include file="_mpf.asp"-->

<script language="javascript" runat="server">
//Built 26-Mar-18, 12:13:02 PM, undefined
Response.Write('nice!');
</script>
Three files were created
  1. The _pf.asp file, which has all of the ES3 polyfills (in this case Array.prototype.map)
  2. The dependency file json.asp (which has JSON2 inside, as ASP Classic doesn't natively support JSON)
  3. The compiled file itself, minified and polyfilled all ready to go! (also replacing console.log with Response.Write). This file is wrapped with the appropriate Includes (see below) and wrapped in a try/catch function and wrapped with <script language="javascript" runat="server">...</script>.
Include System

Typically in ASP Classic you include other ASP files like this:

<!--#include file="./mypage.asp"-->

But, of course, when writing Javascript this doesn't work... so:

Including ASP Pages in ES6
// page1.asp
include('./mypage.asp'); // woah, js magic
...
const shaggy = "cool stuff, scoobs!"
...

...will become

<!--#include file="./mypage.asp"-->
...
var shaggy = "cool stuff, scoobs!";
...
License

Copyright (c) 2017, pxljoy.io (MIT License)

See LICENSE for more info.

Coded with ♥️ by pxljoy.io

FAQs

Package last updated on 25 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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