normalize-transforms
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -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/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7
42
3
13864
14
356
1
+ Addedmime-types@1
+ Addedtype-is@1
- Removedautoprefixer@2
- Removedclean-css@2
- Removedes6-module-jstransform@0
- Removedesprima-error-formatter@1
- Removedis-module@1
- Removedjstransform@6
- Removeduglify-js@2
- Removedalign-text@0.1.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedautoprefixer@2.2.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@0.1.1(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcaniuse-db@1.0.30001680(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedclean-css@2.2.23(transitive)
- Removedcliui@2.1.0(transitive)
- Removedcommander@2.2.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedes6-module-jstransform@0.1.4(transitive)
- Removedesprima-error-formatter@1.0.0(transitive)
- Removedesprima-fb@3001.1.0-dev-harmony-fb6001.1.0-dev-harmony-fb(transitive)
- Removedfs-extra@0.10.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-module@1.0.0(transitive)
- Removedjs-base64@2.1.9(transitive)
- Removedjsonfile@1.2.0(transitive)
- Removedjstransform@3.0.06.3.2(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedncp@0.5.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpostcss@2.1.2(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsource-map@0.1.310.1.430.5.7(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyargs@3.10.0(transitive)