Socket
Socket
Sign inDemoInstall

bankai

Package Overview
Dependencies
362
Maintainers
5
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.1.3 to 5.2.0

66

bin.js
#!/usr/bin/env node
const explain = require('explain-error')
const mapLimit = require('map-limit')
const resolve = require('resolve')
const garnish = require('garnish')
const mkdirp = require('mkdirp')
const subarg = require('subarg')
const bole = require('bole')
const http = require('http')
const path = require('path')
const pump = require('pump')
const opn = require('opn')
const fs = require('fs')
var explain = require('explain-error')
var mapLimit = require('map-limit')
var resolve = require('resolve')
var garnish = require('garnish')
var mkdirp = require('mkdirp')
var subarg = require('subarg')
var bole = require('bole')
var http = require('http')
var path = require('path')
var pump = require('pump')
var opn = require('opn')
var fs = require('fs')
const bankai = require('./')
var bankai = require('./')
const argv = subarg(process.argv.slice(2), {
var argv = subarg(process.argv.slice(2), {
string: [ 'open', 'port' ],

@@ -41,3 +41,3 @@ boolean: [ 'optimize', 'verbose', 'help', 'version', 'debug' ],

const usage = `
var usage = `
Usage:

@@ -77,7 +77,7 @@ $ bankai <command> [options]

}
const cmd = argv._[0]
const _entry = argv._[1] || 'index.js'
const localEntry = './' + _entry.replace(/^.\//, '')
const entry = resolve.sync(localEntry, { basedir: process.cwd() })
const outputDir = argv._[2] || 'dist'
var cmd = argv._[0]
var _entry = argv._[1] || 'index.js'
var localEntry = './' + _entry.replace(/^.\//, '')
var entry = resolve.sync(localEntry, { basedir: process.cwd() })
var outputDir = argv._[2] || 'dist'
startLogging(argv.verbose)

@@ -113,4 +113,4 @@

function start (entry, argv, done) {
const assets = bankai(entry, argv)
const port = argv.port
var assets = bankai(entry, argv)
var port = argv.port

@@ -125,9 +125,11 @@ http.createServer((req, res) => {

}).listen(port, function () {
const relative = path.relative(process.cwd(), entry)
const addr = 'http://localhost:' + port
var relative = path.relative(process.cwd(), entry)
var addr = 'http://localhost:' + port
console.info('Started bankai for', relative, 'on', addr)
if (argv.open !== false) {
const app = (argv.open.length) ? argv.open : 'system browser'
var app = (argv.open.length) ? argv.open : 'system browser'
opn(addr, { app: argv.open || null })
.catch((err) => done(explain(err, `err running ${app}`)))
.catch(function (err) {
done(explain(err, `err running ${app}`))
})
.then(done)

@@ -140,8 +142,8 @@ }

mkdirp.sync(outputDir)
const assets = bankai(entry, argv)
const files = [ 'index.html', 'bundle.js', 'bundle.css' ]
var assets = bankai(entry, argv)
var files = [ 'index.html', 'bundle.js', 'bundle.css' ]
mapLimit(files, Infinity, iterator, done)
function iterator (file, done) {
const file$ = fs.createWriteStream(path.join(outputDir, file))
const source$ = assets[file.replace(/^.*\./, '')]()
var file$ = fs.createWriteStream(path.join(outputDir, file))
var source$ = assets[file.replace(/^.*\./, '')]()
pump(source$, file$, done)

@@ -152,6 +154,6 @@ }

function startLogging (verbose) {
const level = (verbose) ? 'debug' : 'info'
const pretty = garnish({ level: level, name: 'bankai' })
var level = (verbose) ? 'debug' : 'info'
var pretty = garnish({ level: level, name: 'bankai' })
pretty.pipe(process.stdout)
bole.output({ stream: pretty, level: level })
}

@@ -1,9 +0,9 @@

const css = require('sheetify')
const html = require('bel')
var css = require('sheetify')
var html = require('bel')
const prefix = css`
var prefix = css`
:host > h1 { font-size: 12rem }
`
const el = html`
var el = html`
<section class=${prefix}>

@@ -10,0 +10,0 @@ <h1>hello planet</h1>

@@ -1,13 +0,18 @@

const watchifyRequest = require('watchify-request')
const sheetify = require('sheetify/transform')
const cssExtract = require('css-extract')
const createHtml = require('create-html')
const browserify = require('browserify')
const concat = require('concat-stream')
const watchify = require('watchify')
const assert = require('assert')
const stream = require('stream')
const xtend = require('xtend')
const from = require('from2')
const pump = require('pump')
var collapser = require('bundle-collapser/plugin')
var watchifyRequest = require('watchify-request')
var sheetify = require('sheetify/transform')
var unassertify = require('unassertify')
var cssExtract = require('css-extract')
var createHtml = require('create-html')
var browserify = require('browserify')
var concat = require('concat-stream')
var uglifyify = require('uglifyify')
var watchify = require('watchify')
var yoyoify = require('yo-yoify')
var assert = require('assert')
var stream = require('stream')
var varify = require('varify')
var xtend = require('xtend')
var from = require('from2')
var pump = require('pump')

@@ -25,3 +30,3 @@ module.exports = Bankai

const self = this
var self = this

@@ -40,3 +45,3 @@ this.htmlDisabled = (opts.html === false)

this._html = (function () {
const base = {
var base = {
script: 'bundle.js',

@@ -46,3 +51,3 @@ css: (self.cssDisabled) ? null : 'bundle.css',

}
const html = createHtml(xtend(base, opts.html))
var html = createHtml(xtend(base, opts.html))
return new Buffer(html)

@@ -52,3 +57,3 @@ })()

this._js = (function () {
const base = {
var base = {
basedir: process.cwd(),

@@ -60,5 +65,5 @@ entries: [ entry ],

}
const jsOpts = xtend(base, opts.js)
var jsOpts = xtend(base, opts.js)
const b = (self.optimize)
var b = (self.optimize)
? browserify(jsOpts)

@@ -73,2 +78,10 @@ : watchify(browserify(jsOpts))

if (self.optimize) {
b.transform(unassertify, { global: true })
b.transform(yoyoify, { global: true })
b.transform(varify, { global: true })
b.transform(uglifyify, { global: true })
b.plugin(collapser, { global: true })
}
return watchifyRequest(b)

@@ -87,6 +100,6 @@

Bankai.prototype.js = function (req, res) {
const through$ = new stream.PassThrough()
var through$ = new stream.PassThrough()
this._js(req, res, function (err, buffer) {
if (err) return through$.emit('error', err)
const source$ = from([buffer])
var source$ = from([buffer])
pump(source$, through$)

@@ -109,6 +122,6 @@ })

if (!this._css) {
const self = this
const through = new stream.PassThrough()
var self = this
var through = new stream.PassThrough()
this.cssQueue.push(function () {
const source = from([self._css])
var source = from([self._css])
pump(source, through)

@@ -115,0 +128,0 @@ })

{
"name": "bankai",
"version": "5.1.3",
"version": "5.2.0",
"description": "DIY asset server",

@@ -32,2 +32,3 @@ "main": "index.js",

"browserify": "^13.1.0",
"bundle-collapser": "^1.2.1",
"concat-stream": "^1.5.2",

@@ -44,7 +45,11 @@ "create-html": "^1.1.0",

"resolve": "^1.1.7",
"sheetify": "^6.0.0",
"sheetify": "^6.0.1",
"subarg": "^1.0.0",
"uglifyify": "^3.0.4",
"unassertify": "^2.0.3",
"varify": "^0.1.1",
"watchify": "^3.7.0",
"watchify-request": "^2.1.0",
"xtend": "^4.0.1"
"xtend": "^4.0.1",
"yo-yoify": "^3.5.0"
},

@@ -51,0 +56,0 @@ "devDependencies": {

@@ -53,10 +53,10 @@ <h1 align="center">bankai</h1>

```js
const css = require('sheetify')
const html = require('bel')
var css = require('sheetify')
var html = require('bel')
const prefix = css`
var prefix = css`
:host > h1 { font-size: 12rem }
`
const el = html`
var el = html`
<section class=${prefix}>

@@ -72,8 +72,8 @@ <h1>hello planet</h1>

```js
const bankai = require('bankai')
const http = require('http')
const path = require('path')
var bankai = require('bankai')
var http = require('http')
var path = require('path')
const clientPath = path.join(__dirname, 'client.js')
const assets = bankai(clientPath)
var clientPath = path.join(__dirname, 'client.js')
var assets = bankai(clientPath)

@@ -80,0 +80,0 @@ http.createServer((req, res) => {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc