jsx-transform
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -21,2 +21,3 @@ /*! | ||
var trimTrailingSpaces = require('./trimTrailingSpaces'); | ||
var through = require('through2'); | ||
@@ -92,3 +93,34 @@ /** | ||
/** | ||
* Return a browserify transform. | ||
* | ||
* See @link module:jsx-transform.transform for options. | ||
* | ||
* @example | ||
* | ||
* ```javascript | ||
* var browserify = require('browserify'); | ||
* var jsx = require('jsx-transform').browserify; | ||
* | ||
* browserify() | ||
* .transform(jsx(options)) | ||
* .bundle() | ||
* ``` | ||
* | ||
* @param {Object} options | ||
* @returns {Stream} browserify transform | ||
*/ | ||
function browserify(options) { | ||
return through(function (buf, enc, next) { | ||
try { | ||
this.push(transform(buf.toString('utf8'), options)); | ||
next(); | ||
} catch (err) { | ||
next(err); | ||
} | ||
}); | ||
} | ||
module.exports = { | ||
browserify: browserify, | ||
transform: transform, | ||
@@ -95,0 +127,0 @@ transformFile: transformFile, |
{ | ||
"name": "jsx-transform", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "JSX transpiler. Desugar JSX into JavaScript. A standard and configurable implementation of JSX decoupled from React.", | ||
@@ -32,3 +32,4 @@ "files": [ | ||
"dependencies": { | ||
"jstransform": "^10.1.0" | ||
"jstransform": "^10.1.0", | ||
"through2": "^0.6.5" | ||
}, | ||
@@ -35,0 +36,0 @@ "devDependencies": { |
@@ -121,2 +121,3 @@ # jsx-transform [![Build Status](http://img.shields.io/travis/alexmingoia/jsx-transform.svg?style=flat)](http://travis-ci.org/alexmingoia/jsx-transform) [![NPM version](http://img.shields.io/npm/v/jsx-transform.svg?style=flat)](https://npmjs.org/package/jsx-transform) [![Dependency Status](http://img.shields.io/david/alexmingoia/jsx-transform.svg?style=flat)](http://david-dm.org/alexmingoia/jsx-transform) | ||
* [jsx-transform~transformFile(path, options)](#module_jsx-transform..transformFile) | ||
* [jsx-transform~browserify(options)](#module_jsx-transform..browserify) | ||
@@ -157,2 +158,5 @@ <a name="module_jsx-transform..transform"></a> | ||
- jsx `String` - Constructor name (default: set by docblock). | ||
- passArray `String` - if false follows default react-tools/babel jsx behavour | ||
`DOM('h1', null, "hello", firstName + " " + lastName)` instead of | ||
`DOM('h1', null, ["Hello ", firstName + " " + lastName])`. | ||
@@ -172,4 +176,26 @@ **Scope**: inner function of [jsx-transform](#module_jsx-transform) | ||
**Returns**: `String` | ||
<a name="module_jsx-transform..browserify"></a> | ||
##jsx-transform~browserify(options) | ||
Return a browserify transform. | ||
See @link module:jsx-transform.transform for options. | ||
**Params** | ||
- options `Object` | ||
**Scope**: inner function of [jsx-transform](#module_jsx-transform) | ||
**Returns**: `Stream` - browserify transform | ||
**Example** | ||
```javascript | ||
var browserify = require('browserify'); | ||
var jsx = require('jsx-transform').browserify; | ||
browserify() | ||
.transform(jsx(options)) | ||
.bundle() | ||
``` | ||
## BSD Licensed | ||
@@ -176,0 +202,0 @@ |
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
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
21949
412
202
2
+ Addedthrough2@^0.6.5
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedthrough2@0.6.5(transitive)
+ Addedxtend@4.0.2(transitive)