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.1.0 to 0.2.0

4

HISTORY.md
# Changelog
## v0.2.0: 2015-07-03
- Only act on existing JSTransformers
## v0.1.0: 2015-06-25
- Recursive file extension rendering

30

index.js
var jstransformer = require('jstransformer')
var listOfJsTransformers = require('list-of-jstransformers')
var transformers = {}

@@ -6,9 +7,14 @@

* Get the transformer from the given name.
*
* @return The JSTransformer; null if it doesn't exist.
*/
function getTransformer (name) {
if (transformers[name]) {
if (listOfJsTransformers.indexOf(name) >= 0) {
if (transformers[name]) {
return transformers[name]
}
transformers[name] = jstransformer(require('jstransformer-' + name))
return transformers[name]
}
transformers[name] = jstransformer(require('jstransformer-' + name))
return transformers[name]
return null
}

@@ -27,11 +33,11 @@

for (var i = transforms.length - 1; i >= 0; i--) {
// Retrieve the transform name.
var transformName = transforms[i]
var transformer = getTransformer(transformName)
// Process the content of the file with the transformer.
var input = files[file].contents.toString()
// TODO: Figure out what to do for options.
var output = transformer.render(input, files[file], files[file])
files[file].contents = new Buffer(output.body)
// Retrieve the transformer.
var transformer = getTransformer(transforms[i])
if (transformer) {
// Process the content of the file with the transformer.
var input = files[file].contents.toString()
// TODO: Figure out what to do for options.
var output = transformer.render(input, files[file], files[file])
files[file].contents = new Buffer(output.body)
}
}

@@ -38,0 +44,0 @@

{
"name": "metalsmith-jstransformer",
"version": "0.1.0",
"version": "0.2.0",
"description": "Metalsmith JSTransformer Plugin",

@@ -26,10 +26,11 @@ "main": "index.js",

"dependencies": {
"jstransformer": "^0.0.2"
"jstransformer": "^0.0.2",
"list-of-jstransformers": "0.0.2"
},
"devDependencies": {
"assert-dir-equal": "*",
"jstransformer-coffee-script": "*",
"jstransformer-jade": "*",
"jstransformer-styl": "*",
"jstransformer-uglify-js": "git://github.com/jstransformers/jstransformer-uglify-js.git#master",
"assert-dir-equal": "^1.0.1",
"jstransformer-coffee-script": "^0.1.0",
"jstransformer-jade": "0.0.3",
"jstransformer-styl": "^0.1.0",
"jstransformer-uglify-js": "^0.4.0",
"metalsmith": "^1.7.0",

@@ -36,0 +37,0 @@ "mocha": "*",

@@ -28,4 +28,3 @@ # Metalsmith JSTransformer Plugin [![NPM version](https://img.shields.io/npm/v/metalsmith-jstransformer.svg)](https://www.npmjs.org/package/metalsmith-jstransformer)

If you are using the command-line version of Metalsmith, you can install via npm, and then add the
`metalsmith-jstransformer` key to your `metalsmith.json` file:
If you are using the command-line version of Metalsmith, you can install via npm, and then add the `metalsmith-jstransformer` key to your `metalsmith.json` file:

@@ -42,4 +41,3 @@ ```json

If you are using the JS Api for Metalsmith, then you can require the module and add it to your
`.use()` directives:
If you are using the JS Api for Metalsmith, then you can require the module and add it to your `.use()` directives:

@@ -46,0 +44,0 @@ ```js

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