How to use the react-tools.transform function in react-tools

To help you get started, we’ve selected a few react-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spmjs / spm / lib / utils / deps.js View on Github external
function transform(code, file) {
  // 转换 jsx 代码
  if (code.indexOf('/** @jsx React.DOM */') > -1) {
    code = ReactTools.transform(code);
  }

  // 依赖转换
  code = crequire(code, function(item) {
    return 'window[\'' + normalizeDep(item.path, file) + '\']';
  });

  return code;
}
github danvk / mocha-react / tests / jsx-stub-transform.js View on Github external
function transform(filename) {
  if (shouldStub(filename)) {
    delete require.cache[filename];
    return reactStub;
  } else {
    var content = fs.readFileSync(filename, 'utf8');
    return ReactTools.transform(content, {harmony: true});
  }
}
github exokitxr / zeo / public / js / plugins / cors / server.js View on Github external
req.on('end', () => {
        const js = ReactTools.transform(b);

        console.log('cors client transform', {
          req: b,
          res: js,
        });

        res.type('application/javascript');
        res.send(js);
      });
    }
github redexp / react-separate-template / cli.js View on Github external
convert(js, html, function (err, jsx) {
    if (err) {
        throw err;
    }

    if (app.type === 'js') {
        jsx = react.transform(jsx);
    }

    if (app.target === 'stdout') {
        console.log(jsx);
    }
    else {
        fs.writeFileSync(fileJsx, jsx);
    }
});
github ptmt / tryflow / app / server.compiled / index.js View on Github external
function flowES6toES5(code) {
  return beautify(
    reactTools.transform(code, {
      harmony: true,
      stripTypes: true
    }), {
      indent_size: 4
  });
}
github thomaspark / fontcdn / node_modules / react-infinite / preprocessor.js View on Github external
process: function(source) {
    return ReactTools.transform(source, {
      harmony: true
    });
  }
};
github seatgeek / react-infinite / preprocessor.js View on Github external
process: function(source) {
    return ReactTools.transform(source, {
      harmony: true
    });
  }
};
github PaulLeCam / react-leaflet / preprocessor.js View on Github external
process: function(src, filename) {
    return filename.indexOf("node_modules") === -1
      ? ReactTools.transform(src, {harmony: true})
      : src;
  }
};