Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
flatten-brunch-map
Advanced tools
Creates a file object for brunch plugins, combining source maps if neccesary
Creates the object to return by a Brunch plugin, with the new sourcemap merged with the preceding sourcemap if necessary.
npm install flatten-brunch-map --save
const flattenMap = require('flatten-brunch-map')
...
const pluginResult = flattenMap(fileParam, compiledCode, sourceMap)
const flattenMap = require('flatten-brunch-map')
const myCompiler = require('myCompiler')
class MyPlugin {
constructor (config) {
this.options = config.plugins.myPlugin || {}
// Tell to myCompiler if user wants sourcemap
this.options.sourceMaps = !!config.sourceMaps
}
compile (file) {
return new Promise((resolve, reject) => {
try {
// Do the plugin logic and then call flattenMap with the
// received param and the generated code and sourcemap.
const output = myCompiler(file.data, this.options)
const result = this.options.sourceMaps
? flattenMap(file, output.code, output.map) : output.code
resolve(result)
} catch (error) {
reject(error)
}
})
}
}
MyPlugin.prototype.brunchPlugin = true
MyPlugin.prototype.extension = 'js'
MyPlugin.prototype.type = 'javascript'
module.exports = MyPlugin
From v2.8.2, the plugin returns a normalized string or plain object with sources
defaulting to the received file path.
Like it? Don't forget your star :)
[2.10.1] - 2018-12-13
FAQs
Creates a file object for brunch plugins, combining source maps if neccesary
We found that flatten-brunch-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.