Comparing version 1.0.2 to 1.1.0
43
index.js
// @flow | ||
const os = require('os') | ||
const { exec, execSync } = require('child_process') | ||
const { readFile, readFileSync } = require('fs') | ||
const {exec, execSync} = require('child_process') | ||
const {readFile, readFileSync} = require('fs') | ||
const utils = require('./utils') | ||
@@ -29,8 +29,6 @@ /*:: import type { BsModuleFormat } from 'read-bsconfig' */ | ||
/** | ||
* Runs `bsb` async | ||
*/ | ||
/** Runs `bsb` async */ | ||
function runBuild(cwd /*: string */) /*: Promise<string> */ { | ||
return new Promise((resolve, reject) => { | ||
exec(bsb, { maxBuffer: Infinity, cwd }, (err, stdout, stderr) => { | ||
exec(bsb, {maxBuffer: Infinity, cwd}, (err, stdout, stderr) => { | ||
const output = `${stdout.toString()}\n${stderr.toString()}` | ||
@@ -46,7 +44,5 @@ if (err) { | ||
/** | ||
* Runs `bsb` | ||
*/ | ||
function runBuildSync() { | ||
const output = execSync(bsb, { stdio: 'pipe' }) | ||
/** Runs `bsb` */ | ||
function runBuildSync(cwd /*: string */) /*: string */ { | ||
const output = execSync(bsb, {stdio: 'pipe', cwd}) | ||
@@ -66,5 +62,3 @@ return output.toString() | ||
/** | ||
* Compiles a Reason file to JS | ||
*/ | ||
/** Compiles a Reason file to JS */ | ||
function compileFile( | ||
@@ -74,3 +68,3 @@ buildDir /*: string */, | ||
path /*: string */, | ||
id /*: ?string */ = null | ||
id /*: ?string */ = null, | ||
) /*: Promise<Compilation> */ { | ||
@@ -92,3 +86,3 @@ if (id && buildRuns[id] !== undefined) { | ||
warnings: [], | ||
errors: [err] | ||
errors: [err], | ||
}) | ||
@@ -101,7 +95,7 @@ } else { | ||
warnings: utils.processBsbWarnings(output), | ||
errors: [] | ||
errors: [], | ||
}) | ||
} | ||
}) | ||
}) | ||
}), | ||
) | ||
@@ -111,15 +105,14 @@ .catch(err => ({ | ||
warnings: [], | ||
errors: utils.processBsbError(err) | ||
errors: utils.processBsbError(err), | ||
})) | ||
} | ||
/** | ||
* Compiles a Reason file to JS sync | ||
*/ | ||
/** Compiles a Reason file to JS sync */ | ||
function compileFileSync( | ||
buildDir /*: string */, | ||
moduleType /*: BsModuleFormat | 'js' */, | ||
path /*: string */ | ||
path /*: string */, | ||
) /*: string */ { | ||
try { | ||
runBuildSync() | ||
runBuildSync(buildDir) | ||
} catch (e) { | ||
@@ -138,3 +131,3 @@ throw utils.processBsbError(e.output.toString()) | ||
compileFile, | ||
compileFileSync | ||
compileFileSync, | ||
} |
{ | ||
"name": "bsb-js", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "JS library wrapping BuckleScript build", | ||
@@ -13,8 +13,3 @@ "main": "index.js", | ||
}, | ||
"keywords": [ | ||
"bsb", | ||
"bucklescript", | ||
"reason", | ||
"reasonml" | ||
], | ||
"keywords": ["bsb", "bucklescript", "reason", "reasonml"], | ||
"author": "Ryan Delaney <rrdelaney@outlook.com>", | ||
@@ -21,0 +16,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
6256
1
159