├── .editorconfig ├── .gitignore ├── .jshintrc ├── .travis.yml ├── config.js ├── jsx.js ├── license ├── package.json ├── readme.md ├── sample.jsx └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [package.json] 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | jspm_packages 4 | config.js 5 | sample.js 6 | sample.js.map 7 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 4, 10 | "newcap": true, 11 | "noarg": true, 12 | "quotmark": "single", 13 | "regexp": true, 14 | "undef": true, 15 | "unused": true, 16 | "strict": true, 17 | "trailing": true, 18 | "smarttabs": true 19 | } 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | System.config({ 2 | "paths": { 3 | "*": "*.js" 4 | } 5 | }); 6 | 7 | -------------------------------------------------------------------------------- /jsx.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var react = require('react-tools'); 4 | 5 | exports.translate = function(load) { 6 | var output = react.transformWithDetails(load.source, { es6module: true, sourceMap: true }); 7 | load.metadata.sourceMap = output.sourceMap; 8 | return output.code; 9 | }; 10 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plugin-jsx", 3 | "version": "1.2.1", 4 | "description": "JSX loader plugin", 5 | "main": "jsx", 6 | "files": [ 7 | "jsx.js" 8 | ], 9 | "scripts": { 10 | "test": "jspm install && jspm bundle sample.jsx! sample.js && node test.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/floatdrop/plugin-jsx.git" 15 | }, 16 | "keywords": [ 17 | "jspm", 18 | "jsx", 19 | "loader", 20 | "plugin" 21 | ], 22 | "author": "Vsevolod Strukchinsky ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/floatdrop/plugin-jsx/issues" 26 | }, 27 | "homepage": "https://github.com/floatdrop/plugin-jsx", 28 | "devDependencies": { 29 | "jspm": "^0.14.0" 30 | }, 31 | "jspm": { 32 | "dependencies": { 33 | "react-tools": "npm:react-tools@^0.13.0" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # plugin-jsx [![Build Status](https://travis-ci.org/floatdrop/plugin-jsx.svg)](https://travis-ci.org/floatdrop/plugin-jsx) 2 | 3 | > JSX loader plugin for [jspm](https://jspm.io) 4 | 5 | __Deprecation:__ [Use babel](http://facebook.github.io/react/blog/2015/06/12/deprecating-jstransform-and-react-tools.html). 6 | 7 | This plugin will translate JSX templates to JS. 8 | 9 | To use it you should install it with jspm: 10 | 11 | ``` 12 | jspm install jsx 13 | ``` 14 | 15 | After that you can include JSX templates in your modules: 16 | 17 | ```js 18 | var Component = require('component.jsx!'); 19 | ``` 20 | 21 | ### Tests 22 | 23 | ```bash 24 | npm install 25 | npm test 26 | ``` 27 | -------------------------------------------------------------------------------- /sample.jsx: -------------------------------------------------------------------------------- 1 | module.exports = function () { 2 | return
Hello JSX!!
; 3 | }; 4 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var code = require('fs').readFileSync('./sample.js'); 3 | assert.ok(/React\.createElement/.test(code)); 4 | --------------------------------------------------------------------------------