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

@poi/bs-loader

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poi/bs-loader - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1-rc.0

53

index.js
const fs = require('fs')
const importCwd = require('import-cwd')
const pify = require('pify')
const path = require('path')
const { exec } = require('child_process')
let bsbCommand
function runBuild(cwd /*: string */) /*: Promise<string> */ {
return new Promise((resolve, reject) => {
exec(bsbCommand, { maxBuffer: Infinity, cwd }, (err, stdout, stderr) => {
const output = `${stdout.toString()}\n${stderr.toString()}`
if (err) {
reject(output)
} else {
resolve(output)
}
})
})
}
function readFile(...args) {
return new Promise((resolve, reject) => {
fs.readFile(...args, (err, data) => {
if (err) return reject(err)
resolve(data)
})
})
}
module.exports = async function() {
const callback = this.async()
if (!bsbCommand) {
try {
bsbCommand = require.resolve(
path.resolve('./node_modules/bs-platform/bin/bsb.exe')
)
} catch (e) {
try {
bsbCommand = require.resolve(path.resolve('./node_modules/.bin/bsb'))
} catch (err) {
return callback(
new Error(`Cannot find module 'bs-platform' in '${process.cwd()}'`)
)
}
}
}
try {
const bsb = importCwd('bsb-js')
await bsb.runBuild()
await runBuild()
const outputFile = this.resourcePath.replace(/\.(re|ml)$/, '.bs.js')
const content = await pify(fs.readFile)(outputFile, 'utf8')
const content = await readFile(outputFile, 'utf8')
callback(null, content)
} catch (err) {
callback(err)
callback(typeof err === 'string' ? new Error(err) : err)
}
}

8

package.json
{
"name": "@poi/bs-loader",
"version": "0.0.0",
"version": "0.0.1-rc.0",
"publishConfig": {

@@ -10,7 +10,3 @@ "access": "public"

],
"license": "MIT",
"dependencies": {
"import-cwd": "^2.1.0",
"pify": "^3.0.0"
}
"license": "MIT"
}
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