75 Commits

Author SHA1 Message Date
Samuel Reed
c307bbb3a9 Fix PathHoister hoisting before a same-scope variable declaration.
Seems we didn't have tests running for this very simple case.

Also fixes #5520
2017-05-01 14:32:11 -07:00
Samuel Reed
c3e8cc8ad6 Fix PathHoister error attaching after export declarations.
Fixes #5369.

See also 4ee385e96c/packages/babel-plugin-transform-class-properties/src/index.js (L167)
2017-05-01 12:41:29 -07:00
Henry Zhu
62375cdf12 v7.0.0-alpha.9 2017-04-18 10:41:30 -04:00
Henry Zhu
25ae8c8554 v7.0.0-alpha.8 2017-04-17 15:12:31 -04:00
Henry Zhu
c732f5e1d0 v7.0.0-alpha.7 2017-04-05 17:13:26 -04:00
Henry Zhu
f3ef03abfd use caret for devDeps 2017-03-27 16:32:13 -04:00
Henry Zhu
7a1ccf076c Misc (#5545)
* normalize npmignores

* fixup eslint ignore, etc

* lint

* remove unused

* rm from gitignore

* use strict
2017-03-25 21:46:16 -04:00
Henry Zhu
ab68800e06 v7.0.0-alpha.3 2017-03-23 15:49:01 -04:00
Samuel Reed
f20da57317 Fix PathHoister attaching to default parameters. (#5415)
* Fix PathHoister attaching to default parameters.

Ref: #5315

* Update hoister.js
2017-03-22 16:37:53 -04:00
Henry Zhu
230712e091 Internal: back to fixed, publish everything (#5436) 2017-03-08 22:56:00 -05:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Henry Zhu
11e54a6bd3 v7.0.0-alpha.1 2017-03-02 16:04:47 -05:00
Henry Zhu
d33d023594 Merge remote-tracking branch 'origin/master' into merge-master 2017-02-23 18:54:15 -05:00
Joe Lencioni
69c6d27794 Improve syntax highlighting in readme for JSX (#5331) [skip ci] 2017-02-16 20:36:05 -05:00
Daniel Tschinder
6c03cb0783
Merge branch 'master' into merge-master
# Conflicts:
#	lerna.json
#	packages/babel-cli/package.json
#	packages/babel-core/package.json
#	packages/babel-generator/package.json
#	packages/babel-helper-builder-react-jsx/package.json
#	packages/babel-helper-function-name/package.json
#	packages/babel-helper-optimise-call-expression/package.json
#	packages/babel-helper-replace-supers/package.json
#	packages/babel-helper-transform-fixture-test-runner/package.json
#	packages/babel-helpers/package.json
#	packages/babel-plugin-transform-class-properties/package.json
#	packages/babel-plugin-transform-es2015-block-scoping/package.json
#	packages/babel-plugin-transform-es2015-classes/package.json
#	packages/babel-plugin-transform-es2015-modules-commonjs/package.json
#	packages/babel-plugin-transform-es2015-modules-systemjs/package.json
#	packages/babel-plugin-transform-es2015-modules-umd/package.json
#	packages/babel-plugin-transform-es2015-parameters/package.json
#	packages/babel-plugin-transform-react-jsx/package.json
#	packages/babel-register/package.json
#	packages/babel-template/package.json
#	packages/babel-traverse/package.json
#	packages/babel/package.json
2017-02-14 12:46:23 +01:00
Logan Smyth
48573f1fb4 v6.23.0 2017-02-13 17:14:12 -08:00
Ben Alpert
14d3c2e256 Avoid adding unnecessary closure for block scoping (#5246)
When you write

```
for (const x of l) {
  setTimeout(() => x);
}
```

we need to add a closure because the variable is meant to be block-scoped and recreated each time the block runs. We do this.

However, we also add the closure when no loop is present. This isn't necessary, because if no loop is present then each piece of code runs at most once. I changed the transform to only add a closure if a variable is referenced from within a loop.
2017-02-13 13:46:00 -08:00
Samuel Reed
2aa2de8c6f feature: Support pure expressions in transform-react-constant-elements (#4812) 2017-02-12 20:02:38 -08:00
Samuel Reed
f4e3dfee74 Fix PathHoister hoisting before bindings. (#5153)
Fixes #5149 and enables a few additional safe hoists.
2017-02-12 18:35:08 -08:00
Samuel Reed
eb91bd831c Fix PathHoister hoisting JSX member expressions on "this". (#5143)
The PathHoister ignored member references on "this", causing it
to potentially hoist an expression above its function scope.

This patch tells the hoister to watch for "this", and if seen,
mark the nearest non-arrow function scope as the upper limit
for hoistng.

This fixes #4397 and is an alternative to #4787.
2017-02-12 18:34:07 -08:00
Kai Cataldo
e09ea222c9 Remove babel-runtime from packages' dependencies (#5218) 2017-01-27 09:04:35 -05:00
Jordan Jones
1742035a98 [7.0] Fixes #5108, browser.js and browser.js test removed (#5124)
* Fixes #5108, browser.js and browser.js test removed

* Moved api/node.js to index.js and adjusted associated file references
2017-01-19 22:43:11 -05:00
Jason Aslakson
ef25bebfa8 fix issue #5012 - Cannot read property 'declarations' of null (#5019)
- temporary fix
2017-01-19 21:36:18 -05:00
Henry Zhu
e9fc38bcd3 v6.22.0 2017-01-19 19:33:22 -05:00
Toru Kobayashi
3871236723 transform-react-constant-elements hoists Composite Components (#5137) [skip ci] 2017-01-17 14:47:04 -05:00
Sergey Rubanov
292c3ca206 Refactor test packages to use ES modules instead of CJS (#5138) 2017-01-16 11:25:04 -05:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Scott Kyle
c438209718 Fix constant elements hoisted before declarator (#4804)
When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
2016-12-03 20:19:32 -08:00
Scott Kyle
5a9509205b Fix constant elements hoisted out of block (#4419)
When block scoped variables caused the block to be wrapped in a closure, the variable `bindings` remained in parent function scope, which caused the JSX element to be hoisted out of the closure.
2016-12-03 19:54:53 -08:00
Brian Ng
66dfd8f0c1 Fix some React transform README issues [skip ci] (#4917) 2016-11-30 12:19:54 -05:00
Henry Zhu
e86f62b304 README: add --save-dev [skip ci]
Closes gh-4910
2016-11-29 08:40:27 -05:00
Brian Ng
4a14202e92 Update React transform READMEs from babel.github.io [skip ci] (#4903)
* Update React transform READMEs from babel.github.io [skip ci]

* Drop inline-elements polyfill message (move to website)
2016-11-28 20:50:17 -05:00
Samuel Reed
5678e61c0f fix binding kind of destructured variables. (#4813)
Fixes #4516 and any other code that hoists into a scope
where function params are destructured.
2016-11-08 13:51:54 -05:00
Sebastian McKenzie
3b4b3656a8 Fix React constant elements transform from hoisting elements to positions where their referenced bindings haven't been evaluated yet (#3596) 2016-07-27 10:54:21 -04:00
Henry Zhu
77ac82b9f5 v6.9.1 2016-05-29 15:50:04 -04:00
Leonid Nikiforenko
822e8804d5 Make JSXText Immutable (#3510) 2016-05-25 23:30:29 -04:00
Henry Zhu
05bf216339 v6.8.0 2016-05-02 19:43:49 -04:00
Henry Zhu
4c23b01798 change plugins to use babel-runtime 6 2016-04-24 20:06:23 -04:00
Henry Zhu
f9f8ad6eff v6.5.0 2016-02-06 19:06:41 -05:00
Henry Zhu
8cac20d845 v6.4.0 2016-01-06 15:34:12 -05:00
Amjad Masad
0d8e5a9e86 Fix over-parenthesizing of function expressions 2015-12-24 14:55:51 -08:00
Sebastian McKenzie
7b36967416 v6.3.13 2015-12-04 22:56:51 +11:00
Sebastian McKenzie
ae831c2270 v6.3.12 2015-12-04 22:56:13 +11:00
Sebastian McKenzie
5b6a39f227 v6.1.20 2015-11-13 03:38:54 -08:00
Ben Alpert
d1b8db1532 React inlining: Refactor to reduce parsing cost
- Have the `jsx` helper do the `defaultProps` work instead of calling `defaultProps` inline.
- Put `key` after `props` and make it optional.
- Inline `children` as rest args instead of in the object.
- Rename `createRawReactElement` to `jsx`. I wish I was kidding.

Most of these are silly microoptimizations. In my test file (based off an internal RN app), this reduces the parsing overhead of inlining from around 1% to 0.1% in JSC and from 0.6% to 0.0% in V8 (compared to element inlining before this commit).

Once parsed, the initial render with inlining is the same speed as not inlining in JSC and ~1% slower in V8. A second initial render in the same context (reusing the function objects, JIT, etc) is 2.0% faster in JSC and 5.5% faster in V8.
2015-11-12 18:05:57 -08:00
Sebastian McKenzie
4a1e5c17b4 v6.1.18 2015-11-12 13:46:30 -08:00
Sebastian McKenzie
23fd185590 v6.1.17 2015-11-12 13:40:25 -08:00
Sebastian McKenzie
c4c66687ea v6.1.16 2015-11-12 13:33:20 -08:00
Sebastian McKenzie
9c91b555f9 v6.1.15 2015-11-12 12:15:47 -08:00
Sebastian McKenzie
f127f81cb7 v6.1.14 2015-11-12 12:01:18 -08:00