New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-jstransformer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-jstransformer - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

5

HISTORY.md
# Changelog
## v0.5.1
- Switch to minimatch for filtering files
- Update dependencies
## v0.5.0: 2015-07-11

@@ -4,0 +9,0 @@

47

index.js
var jstransformer = require('jstransformer')
var toTransformer = require('inputformat-to-jstransformer')
var path = require('path')
var extend = require('extend')
var async = require('async')
var clone = require('clone')
var match = require('minimatch').match
var transformers = {}
/**
* Get the transformer from the given name.
*
* @return The JSTransformer; null if it doesn't exist.
*/
* Get the transformer from the given name.
*
* @return The JSTransformer; null if it doesn't exist.
*/
function getTransformer (name) {

@@ -24,11 +25,9 @@ if (name in transformers) {

module.exports = function (opts) {
// Prepare the options.
opts = opts || {}
opts.pattern = opts.pattern || '[!_]*'
// Execute the plugin.
return function (files, metalsmith, done) {
/**
* Return whether or not we are to process the given file.
*/
function filterFile (file, done) {
done(path.basename(file).charAt(0) !== '_')
}
/**
* Process the given file. Call done() when done processing.

@@ -86,3 +85,3 @@ */

// See if we should add the default output format.
if (files[file].jstransformer_filepath.length === 1) {
if (files[file].jstransformer_filepath.length === 1 && files[file].jstransformer_outputFormat) {
files[file].jstransformer_filepath.push(files[file].jstransformer_outputFormat)

@@ -103,15 +102,15 @@ }

// Filter out each file that we don't need to act on.
async.filter(Object.keys(files), filterFile, function (results) {
// Process each individual file.
async.map(results, processFile, function (err) {
if (err) {
done(err)
} else {
// Now rename all the files.
async.map(results, renameFile, done)
}
})
// Filter out all the files we are to ignore.
var results = match(Object.keys(files), opts.pattern, { matchBase: true })
// Process each file.
async.map(results, processFile, function (err) {
if (err) {
done(err)
} else {
// Now rename all the files.
async.map(results, renameFile, done)
}
})
}
}
{
"name": "metalsmith-jstransformer",
"version": "0.5.0",
"version": "0.5.1",
"description": "Metalsmith JSTransformer Plugin",
"main": "index.js",
"files": [

@@ -30,3 +29,4 @@ "index.js"

"inputformat-to-jstransformer": "^1.1.2",
"jstransformer": "^0.0.2"
"jstransformer": "0.0.*",
"minimatch": "^2.0.8"
},

@@ -33,0 +33,0 @@ "devDependencies": {

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