Socket
Socket
Sign inDemoInstall

normalize-transforms

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-transforms - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

lib/templates/json.js

67

lib/index.js

@@ -10,9 +10,2 @@

module.exports = transform
var transforms = transform.transforms = {}
var names = transform.names = []
var defaults = transform.options = {
// default options
// automatically compile to CommonJS
cjs: true,
}

@@ -22,8 +15,6 @@ fs.readdirSync(__dirname).forEach(function (type) {

if (/\.js$/.test(type)) return
fs.readdirSync(path.join(__dirname, type)).forEach(function (name) {
if (name[0] === '.') return
names.push(name = name.replace(/\.js$/, ''))
defaults[name] = {} // all plugins are enabled by default
transforms[name] = require('./' + type + '/' + name)
name = name.replace(/\.js$/, '')
transform[name] = require('./' + type + '/' + name)
})

@@ -33,40 +24,18 @@ })

function transform(options) {
options = options || Object.create(transform.options)
var fns = []
if (options.uglifyjs)
fns.push(transforms.uglifyjs(options))
if (options.cleancss)
fns.push(transforms.cleancss(options))
if (options.autoprefixer)
fns.push(transforms.autoprefixer(options))
if (options.less)
fns.push(transforms.less(options))
if (options.sass)
fns.push(transforms.sass(options))
if (options.stylus)
fns.push(transforms.stylus(options))
if (options.jstransform || options.cjs)
fns.push(transforms.jstransform(options))
if (options.regenerator)
fns.push(transforms.regenerator(options))
fns.push(deshebang)
if (options.jade) // .jade -> .js, .jade -> .html
fns.push(transforms.jade(options))
if (options.markdown) // .md|markdown -> .html
fns.push(transforms.markdown(options))
if (options.react) // .jsx -> .js
fns.push(transforms.react(options))
if (options.coffeescript) // .coffee -> .js
fns.push(transforms.coffeescript(options))
fns.push(Walker.plugins.text(options))
fns.push(Walker.plugins.json(options))
fns.push(Walker.plugins.css(options))
if (options.domify) // .html -> .js
fns.push(transforms.domify(options))
fns.push(Walker.plugins.js(options))
fns.push(Walker.plugins.file(options))
return compose(fns)
return compose([
deshebang,
transform.less(options),
transform.sass(options),
transform.stylus(options),
transform.jade(options),
transform.markdown(options),
transform.react(options),
transform.coffeescript(options),
transform.json(options),
Walker.plugins.css(options),
transform.text(options), // after css for .css.js
transform.domify(options), // after text for .html.js
Walker.plugins.js(options),
Walker.plugins.file(options),
])
}

@@ -6,3 +6,3 @@

var re = /.+\.coffee\.js$/
var re = /.+\.(coffee|litcoffee)\.js$/

@@ -23,3 +23,4 @@ module.exports = function (options) {

file.type = 'js'
var code = coffee.compile(yield* file.getString(), {
var string = yield* file.getString()
var code = coffee.compile(string, {
bare: true,

@@ -30,2 +31,3 @@ filename: file.source,

file.string = code.js
file.map = code.v3SourceMap

@@ -32,0 +34,0 @@ yield* next

@@ -13,3 +13,3 @@

+ 'import domify from "' + url + '";\n\n'
+ 'export default ' // var el = ?
+ 'export default '

@@ -16,0 +16,0 @@ return function* transformDomify(next) {

// when react switches to recast, this will go into the builder
var debug = require('debug')('normalize-transforms:react')

@@ -11,2 +13,3 @@

options = options.react || {}
options.sourceMap = true

@@ -13,0 +16,0 @@ return function* transformReact(next) {

@@ -59,4 +59,4 @@

url = url || ('https://nlz.io/github/visionmedia/jade/' + version + '/lib/runtime.js')
runtime = runtime || ('var jade = require("' + url + '");\n\n')
runtime = runtime || ('import jade from "' + url + '";\n\n')
}
}

@@ -21,4 +21,5 @@

yield* file.setSource(file.uri.match(/^.*\.(md|markdown)/i)[0])
var string = yield* file.getString()
file.type = 'html'
file.string = yield marked.bind(null, yield* file.getString(), options)
file.string = yield marked.bind(null, string, options)

@@ -25,0 +26,0 @@ yield* next

{
"name": "normalize-transforms",
"description": "Transforms for normalize-walker",
"version": "0.3.0",
"version": "0.4.0",
"author": {

@@ -15,16 +15,10 @@ "name": "Jonathan Ong",

"debug": "*",
"type-is": "1",
"mime-types": "1",
"composition": "1",
"comment-shebang": "1",
"esprima-error-formatter": "1",
"normalize-log": "0",
"normalize-walker": "0",
"is-module": "1",
"jstransform": "6",
"es6-module-jstransform": "0",
"autoprefixer": "2",
"clean-css": "2",
"uglify-js": "2"
"normalize-walker": "0"
},
"devDependencies": {
"regenerator": "0",
"jade": "1",

@@ -40,8 +34,14 @@ "marked": "0",

"mocha": "1",
"should": "3"
"should": "3",
"istanbul-harmony": "0"
},
"main": "lib",
"scripts": {
"test": "mocha --harmony-generators --reporter spec --require should --bail"
}
"test": "mocha --harmony-generators --reporter spec --require should --bail",
"test-cov": "node --harmony-generators node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should",
"test-travis": "node --harmony-generators node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should"
},
"files": [
"lib"
]
}
# Walker Transforms
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
For documentations, go to https://normalize.github.io/docs.html#transforms.

@@ -28,1 +33,10 @@

Feel free to fork this and use it as a replacement for `nlz(1)` or your app.
[npm-image]: https://img.shields.io/npm/v/normalize-transforms.svg?style=flat
[npm-url]: https://npmjs.org/package/normalize-transforms
[travis-image]: https://img.shields.io/travis/normalize/transforms.js.svg?style=flat
[travis-url]: https://travis-ci.org/normalize/transforms.js
[coveralls-image]: https://img.shields.io/coveralls/normalize/transforms.js.svg?style=flat
[coveralls-url]: https://coveralls.io/r/normalize/transforms.js?branch=master
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat
[gittip-url]: https://www.gittip.com/jonathanong/
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