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.
ams - asset management system - plugin enabled build tool with jquery like API
AMS - asset management system for nodejs. The goal is to have a flexible and powerful system for dependency management and preprocessing of static files.
npm install ams
var ams = require('ams');
Create a build instance from passed root path. Returns build Instance. Instance properties are:
this.root
- passed path to the src dir.this.options
- current options object, contains all options for all methods.this.paths
- like require.paths.this.data
- key/value hash of path/contentsExample:
var build = ams.build.create('/path/to/src');
Find files to be added to the build instance. Returns build Instance.
Defaults are:
{
detect: null, // path to the file, where static 'require' dependencies tracking should start from,
pattern: /\.[\w]+$/, // regexp to match files, is used if detect is not defined
filter: null, // regexp to filter files, is used if detect is not defined
rec: true, // recursive search, is used if detect is not defined
paths: null // like require.paths to resolve deps
}
Example:
build.find();
Add file or files (array) from given path, optionally define the target dir. Returns build Instance.
Example:
build.add('/path/to/file');
// or
build.add(['/path/to/file1', '/path/to/file2']);
Run processors over files previously added to the build instance. Returns build Instance.
Defaults are:
{
uglifyjs: true, // minify javascript using uglifyjs
cssvendor: true, // add css vendor prefixes like -webkit, -moz etc.
dataimage: true, // inline small images using data:image base64 encoded data for css and html
cssimport: true, // parse @import declarations and inline css files
cssabspath: true, // absolutize paths in css files (relative to the root)
htmlabspath: true, // absolutize paths in html files (relative to the root)
cssmin: true, // minify css using js port of yahoos compressor for css
jstransport: true, // wrap javascript code in commonjs transport proposal, can be used with requirejs later
texttransport: true // wrap any data into js transport string, f.e. to load html templates using requirejs from cdn
}
You can turn off any processor, add your own, or set any options for every processor.
Example:
build.process({
uglifyjs: false,
cssabspath: {
host: 'http://localhost:8888',
verbose: true
}
})
If options is a function, it will be called for each file and act like a custom preprocessor.
Example:
build.process(function(path, data) {
// `path` is path to the file
// `data` is contents of the file
// `this` is reference to build instance
});
Combine all files of current build instance to one, of course without mixing css and js etc. Returns build Instance.
Example:
build.combine({
js: 'main.js',
css: 'main.css'
});
Remove all files and dirs from given dir. Returns build Instance.
Example:
build.cleanup('/path/to/dir');
Write proccessed files to disk in passed dir. Returns build Instance.
Example:
build.write('/path/to/public/dir');
Write a success message to stdout, pass a message string optionally. Returns build Instance.
var ams = require('ams');
var publ = __dirname + '/public',
src = __dirname + '/src',
host = 'http://localhost:8888';
ams.build
// create a build for the dir
.create(src)
// find all files in it
.find()
// change processors options
.process({
cssabspath: {
host: host,
verbose: true
},
htmlabspath: {
host: host,
verbose: true
},
texttransport: false,
uglifyjs: {
verbose: true
}
})
// combine all js files
.combine({
js: 'main.js'
})
// write them to disk
.write(publ)
// stdout success message
.end();
FAQs
ams - asset management system - plugin enabled build tool with jquery like API
The npm package ams receives a total of 10 weekly downloads. As such, ams popularity was classified as not popular.
We found that ams 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.