Commit Graph

369 Commits

Author SHA1 Message Date
Dan Abramov
5be6a1a6d1 Drop name and commonerConfig from package.json (#11244) 2017-10-17 13:34:01 +01:00
Dan Abramov
043d369210 Simplify Jest-specific tests (#11243)
* Delete tests that only mattered during createElement transition

They were added after #2576, but were only important when React.createElement was introduced as a migration path.
Now that elements are used consistently, these tests shouldn't be necessary.

I created a separate test specifically for scryRenderedComponentsWithType() though because that was the only one.

* Simplify mocking test setup

Today, the only remaining special behavior for Jest mocks is we let them render undefined.

We don't plan to introduce any other special behavior for them in the future.
(In fact, we already decided against replicating this special behavior for functional components.)

Therefore, we can remove dependency on Jest automocking mechanism in these tests completely,
and just explicitly mock the render method which is the only one for which we have special behavior.

For clarity, we add an explicit test for mockComponent() API (whose naming is a bit of a lie).
2017-10-17 13:05:44 +01:00
Dan Abramov
49d4381c67 Simplify Jest config a little bit (#11242)
* Inline getTestDocument into test cases

* Remove mention of mock file we do not use

* Remove unused configuration entries

* Move eslint-rules package into the scripts/ folder
2017-10-16 23:17:00 +01:00
Dan Abramov
b5a2a1349d Bump Jest version (#11241) 2017-10-16 21:38:34 +01:00
Andrew Clark
3ffb5d0876 Deterministic updates (#10715)
* Deterministic updates

High priority updates typically require less work to render than
low priority ones. It's beneficial to flush those first, in their own
batch, before working on more expensive low priority ones. We do this
even if a high priority is scheduled after a low priority one.

However, we don't want this reordering of updates to affect the terminal
state. State should be deterministic: once all work has been flushed,
the final state should be the same regardless of how they were
scheduled.

To get both properties, we store updates on the queue in insertion
order instead of priority order (always append). Then, when processing
the queue, we skip over updates with insufficient priority. Instead of
removing updates from the queue right after processing them, we only
remove them if there are no unprocessed updates before it in the list.

This means that updates may be processed more than once.

As a bonus, the new implementation is simpler and requires less code.

* Fix ceiling function

Mixed up the operators.

* Remove addUpdate, addReplaceState, et al

These functions don't really do anything. Simpler to use a single
insertUpdateIntoFiber function.

Also splits scheduleUpdate into two functions:

- scheduleWork traverses a fiber's ancestor path and updates their
  expiration times.
- scheduleUpdate inserts an update into a fiber's update queue, then
  calls scheduleWork.

* Remove getExpirationTime

The last remaining use for getExpirationTime was for top-level async
updates. I moved that check to scheduleUpdate instead.

* Move UpdateQueue insertions back to class module

Moves UpdateQueue related functions out of the scheduler and back into
the class component module. It's a bit awkward that now we need to pass
around createUpdateExpirationForFiber, too. But we can still do without
addUpdate, replaceUpdate, et al.

* Store callbacks as an array of Updates

Simpler this way.

Also moves commitCallbacks back to UpdateQueue module.

* beginUpdateQueue -> processUpdateQueue

* Updates should never have an expiration of NoWork

* Rename expiration related functions

* Fix update queue Flow types

Gets rid of an unneccessary null check
2017-10-13 17:21:25 -07:00
Brian Vaughn
ebb1d316bd Delete documentation and website source (#11137)
* Deleted docs folder

* Deleted www folder

* Remove Netlify website build command

* Removed refs to docs and www from ESlint config

* Removed refs to www/docs from Flow config

* Removed unnecessary .gitignore config

* Updated license check to remove refs to docs

* Removed gh-pages specific portions of Circle build scripts
There may be more that we can remove (eg set_up_github_keys.sh) but I'm not positive

* Removed docs specific license
2017-10-06 10:18:05 -07:00
Brian Vaughn
96fde8a09a Add new docs website (#10896)
Adds a new docs website, built with Gatsby JS, to replace the old Jekyll site. Source code for the new site lives in /www (although markdown and YML data still comes from the legacy /docs folder).

Changes to either markdown or website source code can be previewed on Netlify. The react-js bot should automatically add comments to each PR with preview links. (This preview is generated by running the newly-added yarn build:docs command in the root package.json.)

The majority of the changes in this PR are contained within the new /www directory. However some minor modifications have been made to existing content in the /docs directory:

* Modified frontmatter author block to always be an array
* Small markdown formatting tweaks
2017-09-28 10:18:04 -07:00
Dan Abramov
aad0970192 Remove Stack (part 1, safe: unused files and tests) (#10794)
* Remove Fiber Jest project

* Remove Stack reconciler and ReactDOMStack code

* Fix tests depending on Stack internals

* Fix Flow
2017-09-27 15:15:20 +01:00
Andrew Clark
5c6ef40446 v16.0.0 2017-09-26 08:50:33 -07:00
Sophie Alpert
e932ad68be Version bumps to use MIT license 2017-09-25 18:17:44 -07:00
Dan Abramov
b741916d37 16.0.0-rc.3 2017-09-14 13:59:29 +01:00
Sophie Alpert
8db2e11d97 Bump versions for 16.0.0-rc.2 (pick)
NOTE: This commit is not exactly what went out as RC2 because I forgot to push. See tag v16.0.0-rc.2 (d06680ea9e) instead. Bumping the version here so we're at the right place though.
2017-09-08 15:44:56 -07:00
Flarnie Marchan
49c8d717a0 16.0.0-rc.1 (#10630) 2017-09-06 15:43:22 -07:00
Brian Vaughn
d8d7edde5d Upgrade flow-bin to 0.53.1 (#10510)
* Update flow-bin to 0.53.1

* Ran flow-upgrade utility
Manually corrected a few over-eager cases where it tried to replace our ReactElement sub-type.

* Replaced a couple of React.Element types with React

* Removed temporary ReactComponent/ReactComponent Flow types

* Prettier

* Replaced React with React based on Dan's PR feedback
2017-08-28 14:39:58 -07:00
Dominic Gannaway
e97143cca5 Use Closure Compiler for UMD/Node bundles instead of Uglify (#10236)
* Use GCC instead of Uglify for UMD/NODE bundles

* Prettier run

* Fixes fixtures that were alterated by Pretter and trailing function commas

* prettier on prettier

* updated prettier config

* altered prettier config slightly

* Reverted prettier changes

* updated results.json
2017-08-10 11:12:29 +01:00
Dominic Gannaway
b9e92c6747 Moved around package dependencies fixes #10335 (#10424) 2017-08-09 18:47:52 +01:00
Andrew Clark
32c9f7e827 Update Flow to 0.52 (#10417)
For opaque types
2017-08-08 19:02:10 -07:00
Brian Vaughn
c3718c48f0 16 beta 5 version bump and results JSON 2017-08-08 10:25:25 -07:00
Brian Vaughn
9ebd0c9e9a Updated packages and results JSON for 16 beta 4 2017-08-08 09:08:17 -07:00
Brian Vaughn
230d41218e Built 16.0.0 beta 3. Updated versions, results.json, and error codes 2017-08-03 16:05:28 -07:00
Dan Abramov
138224f6b3 16.0.0-beta.2 2017-07-27 18:06:26 +01:00
Brian Vaughn
834d2c6954 Updated package versions and Rollup results 2017-07-26 12:55:31 -07:00
Andrew Clark
b3943497c2 Upgrade to Flow v0.50.0 (#10249)
No particular reason, just hoping memory usage is maybe better.
2017-07-21 15:30:32 -07:00
Sebastian Markbåge
9011182c55 Configure Jest with Stack and Fiber as separate projects (#10214)
* Disable Fiber specific test run in CI

This disables the comparison against previously recorded test. Instead,
we'll rely on jest failures to fail tests.

* Extract jest config into two separate projects for Fiber and Stack

Allows us to run both in the same jest run. The setupMocks file is forked into
specific environment configuration for each project. This replaces the
environment variable.

I used copy pasta here to make it clear. We can abstract this later. It's clear
to me that simply extracting shared stuff is not the best way to abstract this.
setupMocks for example didn't need all the code in both branches.

I think that some of the stuff that is shared such as error message extracting
etc. should probably be lifted out into a stand-alone jest project instead of
being shared.

* Fix class equivalence test

There's a behavior change when projects are used which makes
setupTestFrameworkScriptFile not override the normal config.

This test should probably just move to a separate CI script or something
less hacky.

* Only run Fiber tests with scripts/fiber/record-tests
2017-07-19 10:35:45 -07:00
Sebastian Markbåge
12d5c7a842 Upgrade jest to 20.1.0-delta.1 (#10211)
* Upgrade jest to 20.1.0-delta.1

This includes multi-project support.

* Use isSpy polyfill that is not available in jest 20

* Remove use of jasmine.createSpyObj

We don't really need this and it's not in jest 20.

* Upgrade record-tests script to use the new jest 20 APIs
2017-07-18 17:24:54 -07:00
Martin V
242929bac1 Add Node v8.x support to devEngines in package.json (#10129) 2017-07-09 20:24:33 +01:00
Sasha Aickin
c01d3061bb Pin prettier to a specific version so that it produces the same output on dev machines and CI. (#10038) 2017-06-26 16:30:45 +01:00
Michael Ridgway
7b05946776 [#9627] Fix componentWillUnmount test case in isMounted tests (#9629)
* Fix componentWillUnmount test case in isMounted tests and add mixin tests

* Upgrade create-react-class to 15.6.0
2017-06-20 23:37:01 +01:00
Andrew Clark
11d67115f3 Update flow to 0.48 (#10006) 2017-06-19 11:45:36 -07:00
Andrew Clark
812244b57a Remove Animation priority
There's no advantage to scheduling updates with animation priority
versus scheduling sync work inside requestAnimationCallback. So we can
remove all the animation-specific code. Now there's only one type of
callback.
2017-06-19 09:53:19 -07:00
Andrew Clark
6a0c56cffc ReactNoop.flush methods return an array of yielded values
Allows us to make assertions on the values that are yielded when
performing work. In our existing tests, we do this manually by pushing
into an array.

ReactNoop.flushThrough extends this concept. It accepts an array of
expected values and flushes until those values are yielded.
2017-06-19 09:53:19 -07:00
Dan Abramov
47731c9f74 16.0.0-alpha.13 2017-06-09 15:00:01 +01:00
Brian Vaughn
8b6b2f26c4 Add NPM 5 to devEngines (#9838) 2017-06-02 08:03:28 -07:00
Dustan Kasten
5f99a48229 Update to Flow 0.47 (#9815)
* bump flow to 0.47

* Fix variadic function flow issues in fiber

* Fix variadic function flow issues in ReactFiberNative

* fix ReactDOM type issues with flow 0.47

* getChildHostContext *does* take an `instance` argument

* change recently added anys to mixedies

* HydrationContext needs a handle on the rootContainerInstance

* prettier
2017-06-01 12:17:21 -07:00
Flarnie Marchan
0f129973ea Move 'lighthouse' and 'nodegit' to 'optionalDependencies' (#9675)
**what is the change?:**
See title.

**why make this change?:**
Both these dependencies were causing issues when working on React internally at
FB.

'lighthouse' requires node >=6 and we don't want to folks working on React to
using that version of node.
https://github.com/GoogleChrome/lighthouse/blob/master/package.json#L11

'nodegit' for me throws an error related to libssh2 and it's annoying to make
this work in every OS. See https://github.com/nodegit/nodegit/issues/1266

**test plan:**
`npm/yarn install`
Runs with no errors on my CentOS machine and also on MacOSX laptop.

**issue:**
This is blocking work related to https://github.com/facebook/react/issues/9398
2017-05-12 15:41:30 +01:00
Ben Alpert
e736b4c4b9 "yarn prettier" only checks changed files (#9670)
CI still checks all of them.
2017-05-11 14:47:29 -07:00
Dominic Gannaway
a7d8ebd2b5 Add React benchmarking infrastructure (#9465)
* Initial commit for WIP benchmarking infrastructure

* fixed lint issues and ran prettier

* added <rootDir>/scripts/bench/ to ignore paths for Jest

* tidied up code and fixed a few bugs in the runner.js

* fixed eslint

* improved the benchmark output from the runner

* fixed typo

* tided up print output in runner.js

* throw error if chrome canary is not installed on mac

* added better bench stats output (tables)

* added benchmark diff to table results

* adds bundle size comparisons to results

* tidied up the results

* fixed prettier output

* attempt to trigger bech for circleci build

* fixes flow exlclusion for lighthouse module

* added class components benchmark

* cleaned up stats.js

* stability changes

* circleci node version to 7

* added another benchmark

* added colours to the different benchmarks to check if being cached

* force no-cache headers

* added more info messages

* refactor chrome launching.

* fixed an issue where launcher.kill might fail

* Move server to runner. Launch it only once.

* tidy up

* changes the logic in how the remote repo is checked out

* removes bench from circleci build

* removed colors from benchmarks (no longer needed)

* added CI integration comment

* added hacker news benchmark

* added skipBuild functionality

* relabelled remote

* Add confidence intervals

* added first meaningful paint

* removed some unused code

* reverted code.json

* updated benchmark runs back to 10

* no longer breaks when results contain missing bundles

* adds CPU throttling

* renamed build to remote-repo

* small fix to build

* fixed bad merge

* upped runs to 10 from 2 again

* properly pulls master

* removes old-bench

* runs benchmarks in headless mode

* adds a --headless option

* improved the git build process

* added README

* updated based feedback from review

* adds merge base commit sha

* addressing more PR feedback

* remove built JS react files

* updated .gitignore

* added combined bundle load times to the metrics
2017-05-09 17:13:54 +01:00
Andrew Clark
824e991241 Update flow to 0.45 (#9603) 2017-05-04 11:31:14 -07:00
Andrew Clark
535afaf759 16.0.0-alpha.12 2017-05-02 14:26:42 -07:00
Brian Vaughn
2905e56904 Bumped version numbers and built 16.0.0-alpha.11 2017-04-24 18:52:10 -07:00
Brian Vaughn
41290742e6 Bumped version numbers for alpha 10 (#9474) 2017-04-20 13:06:51 -07:00
Ben Alpert
b1768b5a48 Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00
Dan Abramov
e59506c478 Bump prop-types 2017-04-20 16:40:58 +01:00
Brian Vaughn
6cd7618bd7 Bumped versions for 16.0.0-alpha.9 and re-built 2017-04-11 14:40:56 -07:00
Brian Vaughn
2beec2f308 createClass + PropTypes + checkPropTypes warnings (#9399)
(Temporarily) re-adds getters with deprecation warnings for React.PropTypes, React.checkPropTypes, and React.createClass.

* 08bd020: Replace all references to React.PropTypes with prop-types to avoid triggering our own warning message.
* ef5b5c6: Removed several references to React.createClass that appeared after rebasing this branch. (reviewed by @flarnie)
* 524ce20: Added getters for createClass and PropTypes to the main React isomorphic object, behind one-time warning messages. (reviewed by @spicyj)
* db48f54: Fixed Rollup bundles to inline 'prop-types' and 'create-react-class' for UMD builds only. (reviewed by @spicyj, @trueadm )
* cf49cfd: Updated tests-passing.txt to remove tests that were deleted in this branch.
* d34109a: Responses to PR feedback from @spicyj. (Added package.json dependencies to packages/react and packages/react-dom. Renamed a var. Expanded on an inline comment.)
* 488c8d2: Added warning for moved package to React.checkPropTypes accessor too and updated build script.
* 83bcb29: Wordsmithing for deprecation notices (added fb.me links).
* afdc9d2: Tweaked legacy module inlining to remove order-of-deps constraint
* d1348b9: Removed $FlowFixMe.
* 7dbc3e7: More wordsmithing of deprecation notices based on Dan's feedback.
2017-04-11 14:28:03 -07:00
Ben Alpert
b1a06bd945 Fix ignore patterns in package.json (#9409) 2017-04-11 13:58:14 -07:00
Andrew Clark
957fbc92b1 react-create-class -> create-react-class 2017-04-10 17:06:32 -07:00
Dan Abramov
d88696941d 16.0.0-alpha.8 2017-04-07 18:47:23 +01:00
Dan Abramov
21bb8c00d4 16.0.0-alpha.7 2017-04-06 19:50:22 +01:00
Dan Abramov
398d449c48 Fix the print warnings script (#9344) 2017-04-05 18:54:48 +01:00