Skip to content

Commit

Permalink
3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed Nov 6, 2020
1 parent 85cfb06 commit 32fff04
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"settings": {
"react": {
"pragma": "h"
"pragma": "h",
"version": "*"
}
}
}
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [3.5.0] - 2020-11-06

- Compatibility with Hyperapp [v2.0.6](https://github.com/hyperapp/hyperapp/releases/tag/2.0.6)
after internal VNode schema change.

## [3.4.0] - 2020-05-25

- Hybrid npm package with both CommonJS and ESM versions
Expand Down Expand Up @@ -61,7 +66,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Initial public release.

[unreleased]: https://github.com/kriasoft/hyperapp-render/compare/v3.4.0...HEAD
[unreleased]: https://github.com/kriasoft/hyperapp-render/compare/v3.5.0...HEAD
[3.5.0]: https://github.com/kriasoft/hyperapp-render/compare/v3.4.0...v3.5.0
[3.4.0]: https://github.com/kriasoft/hyperapp-render/compare/v3.3.0...v3.4.0
[3.3.0]: https://github.com/kriasoft/hyperapp-render/compare/v3.2.0...v3.3.0
[3.2.0]: https://github.com/kriasoft/hyperapp-render/compare/v3.1.0...v3.2.0
Expand Down
1 change: 1 addition & 0 deletions benchmark/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"peerDependencies": false
}],
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off"
}
}
8 changes: 5 additions & 3 deletions dist/hyperapp-render.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hyperapp-render.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/hyperapp-render.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hyperapp-render.min.js.map

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "hyperapp-render",
"version": "3.4.0",
"version": "3.5.0",
"description": "Render Hyperapp to an HTML string with SSR and Node.js streaming support",
"repository": "kriasoft/hyperapp-render",
"author": "Vladimir Kutepov",
Expand Down Expand Up @@ -40,29 +40,29 @@
"@types/node": "*"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/preset-env": "^7.3.4",
"@babel/register": "^7.0.0",
"babel-jest": "^24.5.0",
"@babel/core": "^7.12.3",
"@babel/plugin-transform-react-jsx": "^7.12.5",
"@babel/preset-env": "^7.12.1",
"@babel/register": "^7.12.1",
"babel-jest": "^26.6.3",
"benchr": "^4.3.0",
"eslint": "^5.15.2",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"fs-extra": "^7.0.1",
"husky": "^1.3.1",
"hyperapp": "^1.2.9",
"jest": "^24.5.0",
"prettier": "^1.16.4",
"rollup": "^1.6.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-uglify": "^6.0.2",
"typescript": "^3.3.3333"
"eslint": "^7.12.1",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.21.5",
"fs-extra": "^9.0.1",
"husky": "^4.3.0",
"hyperapp": "^1.2.10",
"jest": "^26.6.3",
"prettier": "^2.1.2",
"rollup": "^2.33.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.0.5"
},
"scripts": {
"lint": "node tools/lint.js",
Expand Down
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ export function concatClassNames(value) {
// "msTransition" => "-ms-transition"
function hyphenateStyleName(styleName) {
if (!styleNameCache.has(styleName)) {
const name = styleName
.replace(uppercasePattern, '-$&')
.toLowerCase()
.replace(msPattern, '-ms-')
const name = styleName.replace(uppercasePattern, '-$&').toLowerCase().replace(msPattern, '-ms-')

// returns 'undefined' instead of the 'Map' object in IE11
styleNameCache.set(styleName, name)
Expand Down Expand Up @@ -253,11 +250,13 @@ export function renderer(view, state, actions) {
children: node,
footer: '',
})
} else if (node.tag === 3) {
out += escapeHtml(node.type)
} else if (node.type === 3) {
out += escapeHtml(node.name)
} else if (typeof node === 'object') {
out += renderFragment(
node.name || node.nodeName,
node.name || node.type || node.nodeName,
node.props || node.attributes,
node.children,
stack,
Expand Down
2 changes: 2 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
}],
"jsx-a11y/accessible-emoji": "off",
"jsx-a11y/alt-text": "off",
"jsx-a11y/control-has-associated-label": "off",
"react/jsx-curly-brace-presence": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/no-unknown-property": "off",
"react/prop-types": "off",
"react/style-prop-object": "off"
Expand Down
24 changes: 23 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ describe('renderToString(view, state, actions)', () => {
expect(html).toBe('<meta/><link/>')
})

it('should support Hyperapp V2', () => {
it('should support Hyperapp v2.0.0', () => {
const VNode = {
name: 'div',
props: {},
Expand All @@ -471,6 +471,28 @@ describe('renderToString(view, state, actions)', () => {
expect(html).toBe('<div>foo bar baz</div>')
})

it('should support Hyperapp v2.0.6', () => {
const VNode = {
type: 'div',
props: {},
children: [
{
type: 'foo bar baz',
props: {},
children: [],
node: null,
key: null,
tag: 3,
},
],
node: null,
key: null,
tag: 1,
}
const html = renderToString(VNode)
expect(html).toBe('<div>foo bar baz</div>')
})

it('should support Hyperapp V2 lazy nodes', () => {
const VNode = {
lazy: {
Expand Down
4 changes: 2 additions & 2 deletions tools/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs-extra')
const rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const { uglify } = require('rollup-plugin-uglify')
const { terser } = require('rollup-plugin-terser')
const pkg = require('../package.json')

// The source files to be compiled by Rollup
Expand Down Expand Up @@ -72,7 +72,7 @@ async function build() {
],
comments: false,
}),
...(file.output.endsWith('.min.js') ? [uglify({ output: { comments: '/^!/' } })] : []),
...(file.output.endsWith('.min.js') ? [terser({ output: { comments: '/^!/' } })] : []),
],
})

Expand Down

0 comments on commit 32fff04

Please sign in to comment.