diff --git a/CHANGELOG.md b/CHANGELOG.md index 49795d8eb51..781ce9bb2c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +## 0.11.2 (September 16, 2014) + +### React Core + +#### New Features + +* Added support for `` element and associated `open` attribute +* Added support for `` element and associated `media` and `sizes` attributes +* Added `React.createElement` API in preparation for React v0.12 + * `React.createDescriptor` has been deprecated as a result + +### JSX + +* `` is now parsed into `React.DOM.picture` + +### React Tools + +* Update `esprima` and `jstransform` for correctness fixes +* The `jsx` executable now exposes a `--strip-types` flag which can be used to remove TypeScript-like type annotations + * This option is also exposed to `require('react-tools').transform` as `stripTypes` + ## 0.11.1 (July 24, 2014) ### React Core diff --git a/README.md b/README.md index 169423f2ca0..c1d10befb47 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,12 @@ The fastest way to get started is to serve JavaScript from the CDN (also availab ```html - + - + ``` -We've also built a [starter kit](http://facebook.github.io/react/downloads/react-0.11.1.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code. +We've also built a [starter kit](http://facebook.github.io/react/downloads/react-0.11.2.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code. If you'd like to use [bower](http://bower.io), it's as easy as: diff --git a/bin/jsx b/bin/jsx index 45009e435e2..af7cc1f1d95 100755 --- a/bin/jsx +++ b/bin/jsx @@ -11,6 +11,9 @@ require('commoner').version( }).option( '--harmony', 'Turns on JS transformations such as ES6 Classes etc.' +).option( + '--strip-types', + 'Strips out type annotations.' ).option( '--source-map-inline', 'Embed inline sourcemap in transformed source' @@ -18,7 +21,8 @@ require('commoner').version( // This is where JSX, ES6, etc. desugaring happens. var options = { harmony: this.options.harmony, - sourceMap: this.options.sourceMapInline + sourceMap: this.options.sourceMapInline, + stripTypes: this.options.stripTypes }; return transform(source, options); }); diff --git a/docs/_config.yml b/docs/_config.yml index 75ca27e2332..ae5ffcad656 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -34,4 +34,4 @@ sass: sass_dir: _css gems: - jekyll-redirect-from -react_version: 0.11.1 +react_version: 0.11.2 diff --git a/docs/_posts/2014-09-16-react-v0.11.2.md b/docs/_posts/2014-09-16-react-v0.11.2.md new file mode 100644 index 00000000000..b871e6d7a6f --- /dev/null +++ b/docs/_posts/2014-09-16-react-v0.11.2.md @@ -0,0 +1,46 @@ +--- +title: React v0.11.2 +author: Paul O’Shannessy +--- + +Today we're releasing React v0.11.2 to add a few small features. + +We're adding support for two more DOM elements, `` and ``, as well as the associated attributes needed to use these elements: `open`, `media`, and `sizes`. While not all browsers support these natively, some of our cutting edge users want to make use of them, so we're making them available to everybody. + +We're also doing some work to prepare for v0.12 and improve compatibility between the versions. To do this we are replacing `React.createDescriptor` with `React.createElement`. `createDescriptor` will continue to work with a warning and will be gone in v0.12. Chances are that this won't affect anybody. + +And lastly, on the heels of announcing Flow at [@Scale](http://atscaleconference.com/) yesterday, we're adding the ability to strip TypeScript-like type annotations as part of the `jsx` transform. To use, simply use the `--strip-types` flag on the command line, or set `stripTypes` in the `options` object when calling the API. We'll be talking about Flow more in the coming months. But for now, it's helpful to know that it is a flow-sensitive JavaScript type checker we will be open sourcing soon. + +The release is available for download from the CDN: + +* **React** + Dev build with warnings: + Minified build for production: +* **React with Add-Ons** + Dev build with warnings: + Minified build for production: +* **In-Browser JSX transformer** + + +We've also published version `0.11.2` of the `react` and `react-tools` packages on npm and the `react` package on bower. + +Please try these builds out and [file an issue on GitHub](https://github.com/facebook/react/issues/new) if you see anything awry. + +### React Core + +#### New Features + +* Added support for `` element and associated `open` attribute +* Added support for `` element and associated `media` and `sizes` attributes +* Added `React.createElement` API in preparation for React v0.12 + * `React.createDescriptor` has been deprecated as a result + +### JSX + +* `` is now parsed into `React.DOM.picture` + +### React Tools + +* Update `esprima` and `jstransform` for correctness fixes +* The `jsx` executable now exposes a `--strip-types` flag which can be used to remove TypeScript-like type annotations + * This option is also exposed to `require('react-tools').transform` as `stripTypes` diff --git a/docs/downloads/react-0.11.2.zip b/docs/downloads/react-0.11.2.zip new file mode 100644 index 00000000000..f08b9575fd2 Binary files /dev/null and b/docs/downloads/react-0.11.2.zip differ diff --git a/main.js b/main.js index f083a88ac7b..6973dbe5f93 100644 --- a/main.js +++ b/main.js @@ -31,16 +31,17 @@ module.exports = { function innerTransform(input, options) { options = options || {}; - var visitorList = getVisitors(options.harmony); - return transform(visitorList, input, options); -} -function getVisitors(harmony) { - if (harmony) { - return visitors.getAllVisitors(); - } else { - return visitors.transformVisitors.react; + var visitorSets = ['react']; + if (options.harmony) { + visitorSets.push('harmony'); + } + if (options.stripTypes) { + visitorSets.push('type-annotations'); } + + var visitorList = visitors.getVisitorsBySet(visitorSets); + return transform(visitorList, input, options); } function inlineSourceMap(sourceMap, sourceCode, sourceFilename) { diff --git a/npm-react/package.json b/npm-react/package.json index 7672ba2f030..8f3bf248cd7 100644 --- a/npm-react/package.json +++ b/npm-react/package.json @@ -1,7 +1,7 @@ { "name": "react", "description": "React is a JavaScript library for building user interfaces.", - "version": "0.11.1", + "version": "0.11.2", "keywords": [ "react" ], diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 93ecddd1f91..86b17ec5606 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -23,9 +23,9 @@ "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" }, "through": { - "version": "2.3.4", - "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "version": "2.3.6", + "from": "through@>=2.2.7 <3", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -57,9 +57,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" }, "combine-source-map": { "version": "0.3.0", @@ -243,9 +243,9 @@ "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-0.1.2.tgz", "dependencies": { "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" }, "JSONStream": { "version": "0.6.4", @@ -266,7 +266,7 @@ }, "minimist": { "version": "0.0.10", - "from": "minimist@~0.0.1", + "from": "minimist@~0.0.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" } } @@ -410,9 +410,9 @@ "from": "process@~0.6.0" }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -432,9 +432,9 @@ "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@>=2.2.7 <3", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -537,9 +537,9 @@ "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.1.0.tgz", "dependencies": { "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -678,7 +678,7 @@ "dependencies": { "readable-stream": { "version": "1.1.13", - "from": "readable-stream@>=1.1.13-1 <1.2.0-0", + "from": "readable-stream@~1.1.9", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", "dependencies": { "core-util-is": { @@ -782,9 +782,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -1014,9 +1014,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -1038,9 +1038,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" }, "esprima-fb": { "version": "3001.1.0-dev-harmony-fb", @@ -1106,9 +1106,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -2426,7 +2426,7 @@ }, "inherits": { "version": "1.0.0", - "from": "inherits@1", + "from": "inherits@~1.0.0", "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz" }, "once": { @@ -2618,7 +2618,7 @@ }, "rimraf": { "version": "2.2.8", - "from": "rimraf@~2.2.8", + "from": "rimraf@~2.2.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" }, "which": { @@ -2992,9 +2992,9 @@ } }, "through": { - "version": "2.3.4", + "version": "2.3.6", "from": "through@~2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" } } }, @@ -3046,7 +3046,7 @@ "dependencies": { "bl": { "version": "0.9.3", - "from": "bl@~0.9.0", + "from": "bl@^0.9.0", "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.3.tgz" }, "end-of-stream": { diff --git a/package.json b/package.json index d246c637324..2be2f69953a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-tools", "description": "A set of complementary tools to React, including the JSX transformer.", - "version": "0.11.1", + "version": "0.11.2", "keywords": [ "react", "jsx", diff --git a/src/browser/ui/React.js b/src/browser/ui/React.js index cbdc8fbd3c1..670fce9c560 100644 --- a/src/browser/ui/React.js +++ b/src/browser/ui/React.js @@ -146,6 +146,6 @@ if (__DEV__) { // Version exists only in the open-source version of React, not in Facebook's // internal version. -React.version = '0.11.1'; +React.version = '0.11.2'; module.exports = React; diff --git a/vendor/fbtransform/visitors.js b/vendor/fbtransform/visitors.js index e3e0b795598..a49b6bf2e52 100644 --- a/vendor/fbtransform/visitors.js +++ b/vendor/fbtransform/visitors.js @@ -8,6 +8,7 @@ var es6RestParameters = require('jstransform/visitors/es6-rest-param-visitors'); var es6Templates = require('jstransform/visitors/es6-template-visitors'); var react = require('./transforms/react'); var reactDisplayName = require('./transforms/reactDisplayName'); +var typesSyntax = require('jstransform/visitors/type-syntax'); /** * Map from transformName => orderedListOfVisitors. @@ -20,13 +21,33 @@ var transformVisitors = { 'es6-object-short-notation': es6ObjectShortNotation.visitorList, 'es6-rest-params': es6RestParameters.visitorList, 'es6-templates': es6Templates.visitorList, - 'react': react.visitorList.concat(reactDisplayName.visitorList) + 'react': react.visitorList.concat(reactDisplayName.visitorList), + 'types': typesSyntax.visitorList +}; + +var transformSets = { + 'harmony': [ + 'es6-arrow-functions', + 'es6-object-concise-method', + 'es6-object-short-notation', + 'es6-classes', + 'es6-rest-params', + 'es6-templates', + 'es6-destructuring' + ], + 'react': [ + 'react' + ], + 'type-annotations': [ + 'types' + ] }; /** * Specifies the order in which each transform should run. */ var transformRunOrder = [ + 'types', 'es6-arrow-functions', 'es6-object-concise-method', 'es6-object-short-notation', @@ -54,5 +75,34 @@ function getAllVisitors(excludes) { return ret; } +/** + * Given a list of visitor set names, return the ordered list of visitors to be + * passed to jstransform. + * + * @param {array} + * @return {array} + */ +function getVisitorsBySet(sets) { + var visitorsToInclude = sets.reduce(function(visitors, set) { + if (!transformSets.hasOwnProperty(set)) { + throw new Error('Unknown visitor set: ' + set); + } + transformSets[set].forEach(function(visitor) { + visitors[visitor] = true; + }); + return visitors; + }, {}); + + var visitorList = []; + for (var i = 0; i < transformRunOrder.length; i++) { + if (visitorsToInclude.hasOwnProperty(transformRunOrder[i])) { + visitorList = visitorList.concat(transformVisitors[transformRunOrder[i]]); + } + } + + return visitorList; +} + +exports.getVisitorsBySet = getVisitorsBySet; exports.getAllVisitors = getAllVisitors; exports.transformVisitors = transformVisitors;