diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..8591b66 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "es2015" + ] +} diff --git a/.eslintignore b/.eslintignore index 24ba984..4add417 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ spec/spec.js *.md +webpack.config.spec.js diff --git a/README.md b/README.md index 0809c85..4f2a36b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ `npm install react-json-schema` -This library builds React elements from JSON by mapping JSON definitions to React components that you expose. The interest behind making this library is to allow non-programmers to construct a view using JSON, which can be stored and retrieved in a database. Use it as you'd like. +This library constructs React elements from JSON by mapping JSON definitions to React components that you expose. JSX is not a dependency for react-json-schema. -For a quick reference, you can jump to [full example](#putting-it-all-together). +For a quick reference, you can jump to the [full example](#putting-it-all-together). For 0.3.0+, you must use React 0.14.0+. You may use 0.2.0 for older versions. diff --git a/dist/react-json-schema.js b/dist/react-json-schema.js index e9e3fa0..eaccae0 100644 --- a/dist/react-json-schema.js +++ b/dist/react-json-schema.js @@ -1,26 +1,26 @@ 'use strict'; -Object.defineProperty(exports, '__esModule', { +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +Object.defineProperty(exports, "__esModule", { value: true }); -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var _react = require('react'); -var _node_modulesReactLibReactDOMFactories = require('../node_modules/react/lib/ReactDOMFactories'); +var _ReactDOMFactories = require('react/lib/ReactDOMFactories'); -var _node_modulesReactLibReactDOMFactories2 = _interopRequireDefault(_node_modulesReactLibReactDOMFactories); +var _ReactDOMFactories2 = _interopRequireDefault(_ReactDOMFactories); var _lodash = require('lodash'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + var _componentMap = null; -var ReactJsonSchema = (function () { +var ReactJsonSchema = function () { function ReactJsonSchema() { _classCallCheck(this, ReactJsonSchema); } @@ -67,7 +67,7 @@ var ReactJsonSchema = (function () { Component = schema.component; } else if (_componentMap && _componentMap[schema.component]) { Component = _componentMap[schema.component]; - } else if ((0, _lodash.has)(_node_modulesReactLibReactDOMFactories2['default'], schema.component)) { + } else if ((0, _lodash.has)(_ReactDOMFactories2.default, schema.component)) { Component = schema.component; } } else { @@ -93,7 +93,6 @@ var ReactJsonSchema = (function () { }]); return ReactJsonSchema; -})(); +}(); -exports['default'] = ReactJsonSchema; -module.exports = exports['default']; +exports.default = ReactJsonSchema; diff --git a/dist/react-json-schema.min.js b/dist/react-json-schema.min.js index a12536e..1d579ce 100644 --- a/dist/react-json-schema.min.js +++ b/dist/react-json-schema.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i