Skip to content

Commit

Permalink
Merge pull request #31 from remarkablemark/[email protected]
Browse files Browse the repository at this point in the history
Fix webpack error by reverting to [email protected] for v0.2.0
  • Loading branch information
remarkablemark authored Nov 18, 2016
2 parents b809226 + dfb86c2 commit 8ca104d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 40 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Parser('<p>Hello, world!</p>');
$ npm install html-react-parser
```

Or if you're using react <15.4:

```sh
$ npm install [email protected]
```

[CDN](https://unpkg.com/html-react-parser/):

```html
Expand Down
25 changes: 0 additions & 25 deletions lib/DOMPropertyConfig.js

This file was deleted.

9 changes: 5 additions & 4 deletions lib/attributes-to-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
/**
* Module dependencies.
*/
var HTMLDOMPropertyConfig = require('./DOMPropertyConfig').HTMLDOMPropertyConfig;
var utilities = require('./utilities');
var propertyConfig = require('./property-config');
var config = propertyConfig.config;
var isCustomAttribute = propertyConfig.HTMLDOMPropertyConfig.isCustomAttribute;

/**
* Make attributes compatible with React props.
Expand All @@ -24,20 +25,20 @@ function attributesToProps(attributes) {
propertyValue = attributes[propertyName];

// custom attributes (`data-` and `aria-`)
if (HTMLDOMPropertyConfig.isCustomAttribute(propertyName)) {
if (isCustomAttribute(propertyName)) {
props[propertyName] = propertyValue;
continue;
}

// make HTML DOM attribute/property consistent with React attribute/property
reactProperty = propertyConfig.html[propertyName.toLowerCase()];
reactProperty = config.html[propertyName.toLowerCase()];
if (reactProperty) {
props[reactProperty] = propertyValue;
continue;
}

// make SVG DOM attribute/property consistent with React attribute/property
reactProperty = propertyConfig.svg[propertyName];
reactProperty = config.svg[propertyName];
if (reactProperty) {
props[reactProperty] = propertyValue;
}
Expand Down
15 changes: 10 additions & 5 deletions lib/property-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* Module dependencies.
*/
var utilities = require('./utilities');
var DOMPropertyConfig = require('./DOMPropertyConfig');
var HTMLDOMPropertyConfig = DOMPropertyConfig.HTMLDOMPropertyConfig;
var SVGDOMPropertyConfig = DOMPropertyConfig.SVGDOMPropertyConfig;

// HTML and SVG DOM Property Configs
var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig');
var SVGDOMPropertyConfig = require('react/lib/SVGDOMPropertyConfig');

var config = {
html: {},
Expand Down Expand Up @@ -54,6 +55,10 @@ for (propertyName in SVGDOMPropertyConfig.Properties) {
}

/**
* Export React property config.
* Export React property configs.
*/
module.exports = config;
module.exports = {
config: config,
HTMLDOMPropertyConfig: HTMLDOMPropertyConfig,
SVGDOMPropertyConfig: SVGDOMPropertyConfig
};
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"author": "Mark <[email protected]>",
"main": "index.js",
"scripts": {
"build": "NODE_ENV=development webpack index.js dist/html-react-parser.js",
"build-unmin": "NODE_ENV=development webpack index.js dist/html-react-parser.js",
"build-min": "NODE_ENV=production webpack -p index.js dist/html-react-parser.min.js",
"prepublish": "npm run build && npm run build-min",
"clean": "rm -rf dist",
"prepublish": "npm run clean && npm run build-unmin && npm run build-min",
"test": "mocha",
"lint": "eslint index.js \"lib/**\" \"test/**\"",
"cover": "istanbul cover _mocha -- -R spec \"test/**/*\"",
Expand Down Expand Up @@ -36,15 +37,14 @@
"istanbul": "^0.4.5",
"jsdomify": "^2.1.0",
"mocha": "^3.0.2",
"react": "*",
"react-dom": "*",
"react": "15.3",
"react-dom": "15.3",
"webpack": "^1.13.2"
},
"peerDependencies": {
"react": ">=0.14"
"react": "<=15.3"
},
"browser": {
"./lib/html-to-dom-server.js": false,
"htmlparser2/lib/Parser": false,
"domhandler": false
},
Expand Down

0 comments on commit 8ca104d

Please sign in to comment.