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

reactify

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactify - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

test/fixtures/utf8.js

4

CHANGELOG.md
# CHANGELOG
## 1.1.1
* Correctly handle streams with multibyte characters inside (#67 by @uggedal)
## 1.1.0

@@ -4,0 +8,0 @@

8

index.js

@@ -12,9 +12,13 @@ /**

var source = '';
var buf = [];
function write(chunk) {
return source += chunk;
if (!Buffer.isBuffer(chunk)) {
chunk = new Buffer(chunk)
}
return buf.push(chunk)
}
function compile() {
var source = Buffer.concat(buf).toString();
// jshint -W040

@@ -21,0 +25,0 @@ if (isJSXFile(filename, options)) {

{
"name": "reactify",
"version": "1.1.0",
"version": "1.1.1",
"description": "Browserify transform for JSX (a superset of JS used by React.js)",

@@ -14,2 +14,3 @@ "main": "index.js",

"es6-module-jstransform": "^0.1.3",
"concat-stream": "~1.4.8",
"jshint": "^2.5.10",

@@ -16,0 +17,0 @@ "mocha": "~1.9.0",

@@ -57,3 +57,26 @@ # reactify

## Troubleshooting
### Code in 3rd-party packages isn't being transformed by reactify
By default Browserify applies transforms only for modules in the current package. That means that if there are modules with JSX in packages in `node_modules/` directory then browserify will throw SyntaxError left and right even if you are using reactify.
The best way to fix that is ask package author to publish to npm with code compiled down to plain ES5 which is runnable in browsers and Node.js as-is.
Another approach is to ask to add
```
"browserify": {
"transform": ["reactify"]
}
```
to the package's `package.json`. That will make Browserify apply reactify transform for that package too.
Another way is to activate reactify with `-g` option which will instruct Browserify to apply reactify to every module it encounters:
```
% browserify -g reactify main.js
```
Note that this will lead to slower builds as every module will be parsed and transformed by reactify even if it doesn't have JSX code in it.
[Browserify]: http://browserify.org
[React]: http://facebook.github.io/react/

@@ -5,2 +5,4 @@ var assert = require('assert');

var reactify = require('../index');
var concat = require('concat-stream');
var fs = require('fs');

@@ -71,2 +73,13 @@ describe('reactify', function() {

it('handles utf-8 encoded input correctly', function(done) {
fs.createReadStream(__dirname + '/fixtures/utf8.js')
.pipe(reactify(''))
.pipe(concat(function(result) {
for (var i = 0; i < result.length; i++) {
assert(result.charAt(i) === 'å' || result.charAt(i) === '\n');
}
done();
}));
});
describe('transforming files with extensions other than .js/.jsx', function() {

@@ -73,0 +86,0 @@

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