Summary: Bump version of alpha version of Prepack.
Reviewed By: gaearon
Differential Revision: D8892572
fbshipit-source-id: 129a265b5c8a725d4a09daa6811c0cc1a7ba2249
Summary:
- Support modeling of shapes of optimized function arguments
- fix test262 to fail CircleCI test if not enough tests pass
- upgrades Prepack to use Babel 7.0.0-beta.53
- Nuclide compatibility fix
Reviewed By: gaearon
Differential Revision: D8892151
fbshipit-source-id: 8f1397d25d26e822709ed53c8e6d37055fe396ec
Summary:
`flow check` runs a complete Flow check.
This is good for CI, but it means every re-check after edit is as slow as first check.
I'm changing local `yarn flow` to use a Flow server instead. This should speed up rechecks locally somewhat. Still won't save us from large recheck cycles, but at least we're not starting from a clean slate every time.
I'm adding `yarn flow-ci` with old behavior for the CI.
Finally, I replaced `--merge-timeout` with an equivalent recently added config option. This ensures it's respected both for the server and for the full check. Without it, the server dies.
Pull Request resolved: https://github.com/facebook/prepack/pull/2245
Differential Revision: D8891234
Pulled By: gaearon
fbshipit-source-id: 2c309a1718ed00ca5839cb3a586386e3e779f029
Summary:
Release note: none
The main part of this PR is to ensure that completions and the effects they complete are always 1-1.
Along the way some bugs got fixed#2241.
This also includes a little side project: limiting the console spew when doing "yarn test-serializer --fast", which is something I do all the time and I'm much happier this way.
Pull Request resolved: https://github.com/facebook/prepack/pull/2258
Differential Revision: D8864448
Pulled By: hermanventer
fbshipit-source-id: a7f257a7e07211ecd6069b84330aa3305609c5d2
Summary:
Since I'm adding a new experiment I figured I'd delete an equivalent sized one.
Last year I added an option that runs the Prepack program by invoking Node.js JS runtime which lets us prepack the whole module system and initialization. It's essentially a packager with perfect Node.js module resolution semantics. It did this by modeling Node's native environment as Prepack bindings.
This PR removes that whole option.
There's a few reasons why I don't think that worked out as a good idea.
- It's not solving a real need. It is hard to keep different module systems in tact. There is always something in the ecosystem that breaks down and using the canonical one solves that. However, in practice, if there is a need for bundling the ecosystem itself adapts to the toolchain. So it's not actually that hard to bundle up a CLI even with Webpack, even if it's strictly not 100% compatible, by tweaking a few downstream depenencies.
- Running the resulting bundle is tricky. The resulting bundle includes the JS parts of Node. This overlaps with what Node.js adds at runtime so it runs it twice. The ideal is actually to build a custom distribution of Node.js but this is generally overkill for what people want.
- Bindings change a lot. While Node.js's API notoriously doesn't change much. The internals do change a lot. By picking the API boundary in the middle of the internals of Node.js, it risks changing with any version. While technically observable changes, nobody else relies on these details. If this option was worth its weight, someone could probably maintain it but so far that has not been the case so we had to disable this option in CI to upgrade Node.
However, going forward I think there are alternative approaches we can explore.
- First class module system. This is something we really need at some point. A first class module system would be able to load Node.js module files from disk and package them up while excluding others. It doesn't have to be literally Node.js's module system. Close enough is ok. Especially as standards compliant ECMAScript modules get more popular. This lets us target compiling output that runs after Node's initialization.
- By introducing havocing and membranes in the boundaries, it becomes possible to initialize Node.js modules without actually knowing the internal of the boundaries.
- We've started optimizing residual functions which is much more interesting. However, this requires that code puts some constraints on how it works with its environment. It's not designed to be fully backwards compatible. That's probably a good thing but that also means that we can put constraints on the modules being Prepacked.
This removes the ability to prepack Prepack itself which is unfortunate but already wasn't being tested. To speed up Prepack itself, the [LLVM backend](https://github.com/facebook/prepack/pull/2264) seems much more useful if it can ever work on Prepack itself.
Pull Request resolved: https://github.com/facebook/prepack/pull/2267
Differential Revision: D8863788
Pulled By: sebmarkbage
fbshipit-source-id: d777ec9a95c8523b3386cfad553d9f691ec59074
Summary:
Release notes: upgrades Prepack to use Babel 7.0.0-beta.53
This is a big PR that updates all of Prepack to Babel 7. Babylon is now `babel/parser` and pretty much all of the the previous Babel packages are now located in scoped packages. I had to make a bunch of changes around Jest/Flow/Webpack to get this all working. The build times of building Prepack itself seem considerably faster (easily twice as fast locally). I followed most of the Babel 6 -> 7 upgrade guide from the Babel site in terms of changing nodes and type definitions to match the new ones.
Pull Request resolved: https://github.com/facebook/prepack/pull/2256
Differential Revision: D8850583
Pulled By: trueadm
fbshipit-source-id: 2d2aaec25c6a1ccd1ec0c08c5e7e2a71f78ac2d8
Summary:
stop abstract loops from getting stuck in infinite loops when body contains a return, throw or break completion
Object.assign should no longer lose values when snapshotting in certain cases
Allow __optimize to work in conditional contexts
Move abstract Object.assign temporals into a helper function
new color scheme for the website
Add ability to rewrite generated code via global.__output
adds an optimization to Object.assign that attempts to merge calls together where possible
Added --expectedCounts parameter to test262-runner so that success can depend on the value of the time-out and the version of the test suite that is used.
Updated the test262 submodule to latest version
Reviewed By: cblappert
Differential Revision: D8837068
fbshipit-source-id: 218879046dbb0e307cbf3a13ba9a66d11e99a3f0
Summary:
This will fail CI if we forgot to run `yarn prettier` before committing.
We do the same in React repo. It prevents committing stale files that later cause unexpected changes.
Pull Request resolved: https://github.com/facebook/prepack/pull/2212
Differential Revision: D8784406
Pulled By: gaearon
fbshipit-source-id: ca948b8e088be8886c8ba865f280ba8d72750f69
Summary:
Improved source location information
Only havoc abstract value args when really necessary
Debugger recognizes sourcemaps and opens the correct file/line when debugging in Nuclide.
Make React tests fast
Special case an expression simplification for Instant Render
Fix temporal assignments to intrinsics that happen inside non deterministic loops
Enhanced handling of Array.map applied to abstract arrays
Support dynamic invariants via __assume
We got a logo!
Add React Native mocks to Prepack
Reviewed By: simonhj
Differential Revision: D8739156
fbshipit-source-id: d535dfe0c5bcbee4aaed28f75d45cbedcc51344b
Summary:
Release notes: none
Make it easier to do local development testing of our internal bundle without having to hack the settings each time.
Closes https://github.com/facebook/prepack/pull/2202
Differential Revision: D8731922
Pulled By: trueadm
fbshipit-source-id: 71d92c3b90f448667c4a9ada1f1b0848ece5003b
Summary:
Release notes: adds React Native mocks to Prepack
This adds React Native mocks to Prepack and a few basic tests to demonstrate inlining of `View` and `Text`.
Closes https://github.com/facebook/prepack/pull/2096
Differential Revision: D8723932
Pulled By: NTillmann
fbshipit-source-id: 38bd265cd8935ebdf30266ec337378b4ea5b09d6
Summary:
Currently we have a single giant file with all tests, and a giant snapshot. This is both slow, and hard to work with and iterate on.
In this PR I will refactor our test setup.
- [x] Split it up into multiple files (gets the test running from 45s to 27s)
- [x] Run Prettier on test files
- [x] Split tests further for better performance
- [x] Make it possible to run one test file
- [x] Fix the issue with double test re-runs in watch mode on changes in the test file
- [x] Refactor error handling
- [x] Run Prettier on fixtures
- [x] Add a fast mode with `yarn test-react-fast <Filename>`
- [x] Fix double reruns on failure
Potential followups:
- [x] Figure out why test interruption broke (need https://github.com/facebook/jest/issues/6599 and https://github.com/facebook/jest/issues/6598 fixed)
- [x] Revisit weird things like `this['React']` assignment with a funny comment in every test
Closes https://github.com/facebook/prepack/pull/2187
Differential Revision: D8713639
Pulled By: gaearon
fbshipit-source-id: 5edbfa4e61610ecafff17c0e5e7f84d44cd51168
Summary: Drop eslint-plugin-babel because the plugin doesn't appear to be used at all in this project.
Reviewed By: mjesun
Differential Revision: D8298145
fbshipit-source-id: 4c81abc838cdc6619e8f900d032057ec7008c623
Summary:
@public
Bump Prettier to use version 1.13.4
All code changes are caused by running Prettier and should only affect files that have an `format` header.
All other changes caused by yarn.
Reviewed By: ryanmce
Differential Revision: D8251255
fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
Summary:
For reference, the commit with the release version can be seen here: 7e9e713b3a
Closes https://github.com/facebook/prepack/pull/2079
Differential Revision: D8248778
Pulled By: sb98052
fbshipit-source-id: 3f6533e8e083adfb0b964a5d4e7657964f93da96
Summary: Bump PrePack version to new alpha
Reviewed By: NTillmann
Differential Revision: D8162723
fbshipit-source-id: 13b374d62bfba4fe628c3591c9fd4a4dabb47674
Summary:
Fixing havocing of bindings.
adds support for ReactDOM.createPortal inlining
Stop using joinEffectsAndPromoteNested
opt out of optimizing a React component in a tree with `__doNotRender`
if left and right in createFromConditionalOp are equal, do early return
all serializer tests now get linted via ESlint for correct output
all globals emitted reference the global identifier
Support for --delayInitializations for optimized functions
Fix abstract values not being coerced into strings for the Error constructor
Reviewed By: NTillmann
Differential Revision: D8162599
fbshipit-source-id: e28495eeb4445d99cb93afc2dce331af077c4faf
Summary:
Support switch statements where the switch value is abstract and one or more cases throw.
Fixed bug with implicitly converting unknown values to Object.
The React reconciler now throw a FatalError upon encountering side-effects in a render.
Fix while and for loops with unlabeled breaks
Removing --simpleClosures option.
Improve code generation in presence of exceptions.
Default to StrictMode when mixed StrictMode is serialized between function entries.
Better debug logging with --debugScopes
Allocate by using `new Array(n)`.
Fix problems with duplicated and missing statements.
Do not generate code for unreachable global code statements.
Simplify the ToObject serialization output.
Serialization outputFixes an issue with getOwnPropertyDescriptor when dealing with a native prototype function.
More compact code generation by avoiding introducing local variables for abstract values when possible.
Fixes problem with result of Array.filter (and similar) applied to arrays with unknown properties.
Adds support for spread syntax.
Speeding up Prepack by 22%, saving 8% memory.
Add reading wiki link to places.
Make some files flow strict.
Better crash logging.
Provide error feedback when timing out.
Implement const/let pattern declarations.
Adds support for more console methods.
More simplification rules.
Stop the prototype cycle check if an object (e.g. proxy) uses non-ordinary prototype methods.
Fix numerous problems with code ordering.
issues fixed
Reviewed By: simonhj
Differential Revision: D8048481
fbshipit-source-id: 36a464feb74233f68f3476c74f4070103e6a2584
Summary:
Release notes: adds experimental `react-dom/server` ahead-of-time rendering to string
This PR was part of a small 1-2 day hackathton to see the applicability of creating a server-side renderer based almost entirely to be a 1:1 of `ReactDOMServer` from `react-dom/server` package. This is by no means a full, complete server renderer but is the foundations for us to do further work on this path in the future. Currently, it consists of a single Jest test, to ensure the output of the Hacker News benchmark matches that of the current ReactDOMServer `renderToString` output.
The performance results look very promising (there are some `console.time` lines you can comment out in the test to see the performance for yourself). This implantation essentially compiles away `react` and `react-dom/server` and instead injects runtime helper functions that do things that cannot be statically determined ahead of time.
Lots of features are missing behind `invariant` TODOs. This was done intentionally.
Closes https://github.com/facebook/prepack/pull/1940
Differential Revision: D8075964
Pulled By: trueadm
fbshipit-source-id: 33b3c7ba26b41871ccd15ad8bde4ad257009fed6
Summary:
Update to 72. Run yarn flow and verify it's all good
Closes https://github.com/facebook/prepack/pull/1939
Differential Revision: D7961902
Pulled By: lxfind
fbshipit-source-id: 246d8abef788685d4d6e57406e15f8f8e56650c2
Summary:
Release note: None
ESLint crashes with the flow fix I did earlier. Turns out updating ESLint to latest version fixed it.
Closes https://github.com/facebook/prepack/pull/1927
Reviewed By: NTillmann
Differential Revision: D7946856
Pulled By: yinghuitan
fbshipit-source-id: 44995ed89b516651d85918c6b08b6048916bbb09
Summary:
Allow break/continue to be guarded by abstract conditions inside loops
Collect fine-grained statistics on memory usage
Resolves issues with outer declarations moving into nested scopes
Fixes simplification bug involving comparisons with NaN
Support temporal assignment to object properties using unknown property names
Support multiple assignments to unknown properties in optimized functions
Adds ReactDOM mocks to fb-www compatibility mode
Adds pure scope support for abstract arguments with UpdateExpression
Fixed code duplication bug
10% memory savings when running Prepack
Lots of bug fixes, especially around optimized functions.
Reviewed By: yinghuitan
Differential Revision: D7855871
fbshipit-source-id: f0af26e08dda39a4b125120f9294f85d90e55186
Summary:
Release note: none
Enable test fb-www 12.
While I'm at it, also update package.json to get rid of deprecated -- option and thus shut up a warning about it in CircleCI.
Closes https://github.com/facebook/prepack/pull/1817
Differential Revision: D7824465
Pulled By: hermanventer
fbshipit-source-id: ed88bd1ed8b02c560faf58be24a6592b3e55b86b
Summary:
* `test-react` now gets run before `test-serializer-with-coverage` on the CI
* fixes a regression where on* events would not be stripped in React firstRender mode
* Use 66% less memory, run 42% faster
Reviewed By: NTillmann
Differential Revision: D7759044
fbshipit-source-id: ddb9bfdabf3c0c0ed34215ac3ad69e8bdd159e09
Summary:
This adds a React-specific internal test for Prepack to fbsource. It's meant to be land-blocking.
I checked in a manually edited bundle that has no dependencies except `react` and `react-dom` (so it's not too difficult to maintain). I also checked in a snapshot test for what it should render.
The test step consists of running the Jest test (to verify it works *before* Prepack), then using the existing `debug-fb-www` command to produce a bundle, and finally running the same Jest test again.
Currently this only checks the initialization path. When render path serializer bugs are fixed, we can run the same bundle in the render mode as well (and catch further regressions).
Reviewed By: NTillmann
Differential Revision: D7675812
fbshipit-source-id: 99fe3bd700ae3557ee6245f1e8e1e835399625b5
Summary:
Updates Prettier to v1.12.1, using `xplat/js/scripts/prettier-bump.js` based on the playbook by https://our.intern.facebook.com/intern/wiki/Prettier/upgrade-guide/
All changes related to upgrading or running Prettier
allow-many-files
allow-large-files
bypass-lint
drop-conflicts
ignore-conflict-markers
ignore-signed-source
ignore-nocommit
Reviewed By: benjaffe, ryanmce, yungsters
Differential Revision: D7652946
fbshipit-source-id: 396d45c675e93f2298cd2920d927630c81867447
Summary: Bump PrePack alpha version in preperation for next release
Reviewed By: yinghuitan
Differential Revision: D7679290
fbshipit-source-id: 464ca03b4c0e92287bed6100082ae6cd1f658976
Summary:
Works on windows now
There was nothing that verified that our yarn.lock was up-to-date in our CI. Added the `--frozen-lockfile` option to CircleCI and `package.json` to make sure that we update the `yarn.lock` when we put up a commit.
Improved code generation in the presence of branching
CI uses Node 8.9.4 for better performance and prepublishOnly for NPM publishing
Execute Do/While loop condition in the proper place
Introducting new option --invariantLevel NUMBER and dropping --omitInvariants
Adds`createRef` and `forwardRef` to the React compiler
Diagnostic PP1001 for variable write conflict among optimized functions
Reviewed By: yinghuitan
Differential Revision: D7679206
fbshipit-source-id: e6f78c679e26b3827af47ff1d8ff320f242c62f1