Summary:
Release notes: Introducting new option --invariantLevel NUMBER and dropping --omitInvariants
The new default is invariant level 0, which corresponds to the old --omitInvariants.
Level 1 is roughly what we used to do: Check invariants on (derived) abstract values.
Level 2 implements #1180: Checking that all accesses to built-ins do what Prepack expects them to do, including checks for when properties on built-ins are absent.
Level 3 adds checks for internal consistency, basically an internal debug level.
The serializer tests now run with the highest invariant level by default. The added invariants found a few issues that got addressed, including:
- Prepack exposes a TypedArray prototype, which is not a real thing. It's now marked as `__refuseSerialization`, and no invariants are emitted for such things.
- Global variables / properties on the global object are special. Those are not yet handled at level 2.
- Accesses to Prepack magic functions that generally start with `__` should not produce invariant checks.
- Magic code generation for loops should not take into account objects that are `__refuseSerialization`.
- All invariant statements get a unique id to make it easier to locate them.
- I marked some test cases which depend on counting occurrences in the output as "// omit invariants", as the additional invariants increased some such counts.
As part of testing, I also found it necessary to make the --invariantMode more useful; it now also allows specifying nativeLoggingHook which is the preferred way of logging in React Native.
To reduce the number of checks by a few orders of magnitude in practice, each property is only checked on first access. This is tracked by a global variable `__checkedBindings`.
This pull requests incorporates all aspects of the #1709 (which I abandoned).
Closes https://github.com/facebook/prepack/pull/1724
Reviewed By: simonhj
Differential Revision: D7575091
Pulled By: NTillmann
fbshipit-source-id: 585cd224ce66882f8e5f27d88c1ad08afeb96ee1
Summary:
Release notes: Removing --abstractEffectsInAdditionalFunctions option
It is now the new default, as nothing seems to depend on the old behavior.
Closes https://github.com/facebook/prepack/pull/1623
Differential Revision: D7342083
Pulled By: NTillmann
fbshipit-source-id: c02d13bddd0ff3d8a113a6a5a83c1bf35c96ba4d
Summary:
Release notes: none
Add `abstractEffectsInAdditionalFunctions` to be `true` for the REPL so we can demo cool features :)
Closes https://github.com/facebook/prepack/pull/1591
Differential Revision: D7272579
Pulled By: trueadm
fbshipit-source-id: e91a2665b50150213d3656956c673ec1efc15971
Summary:
Release notes: adds "node-react" compatibility mode
Adds the "node-react" compatibility mode, which is like "fb-www", but doesn't contain the internal FB mocks. This mode is ideal for library authors who might want to experiment with the features of the React compiler in an environment that has basic React/Relay mocks as well as `require` and `module.exports` partial support.
I'll be adding relevant documentation for this on the wiki too.
Closes https://github.com/facebook/prepack/pull/1528
Differential Revision: D7149660
Pulled By: trueadm
fbshipit-source-id: 3f00fa01bb881722b270393a27f817911c5a5256
Summary:
This addresses the issue https://github.com/facebook/prepack/issues/1282 although the issue also requests for --additionalFunctions option which is not part of this commit. User should now be able to see --lazyObjectsRuntime option in the options list on https://prepack.io/repl.html. Ideally this should be an enum but this will accept a freeform string in this revision.
Closes https://github.com/facebook/prepack/pull/1475
Differential Revision: D7059756
Pulled By: phanipattapu
fbshipit-source-id: 588f688a52e81d065cf19ac1fbd358a9332b81a0
Summary:
Release notes: adds option to parse and strip Flow annotations
In a [tweet I made at the end of last year](https://twitter.com/trueadm/status/944908776896978946) I linked to a REPL example that contained Flow type annotations. The example is now broken as we removed Flow type annotation parsing. :(
This PR adds this back behind the option `stripFlow` which is now enabled by default on the REPL and for React tests. I've also added a test to match the REPL for regression checking so this doesn't happen.
Closes https://github.com/facebook/prepack/pull/1439
Differential Revision: D6976663
Pulled By: trueadm
fbshipit-source-id: 47e28bc0986f1a1a252180f26200ce32314a4e5b
Summary:
Release notes: none
This PR changes `react-mocks` -> `fb-www` and adds some `RelayModern` mocks. This is mainly for internal testing to unblock work.
Closes https://github.com/facebook/prepack/pull/1347
Differential Revision: D6798242
Pulled By: trueadm
fbshipit-source-id: 9c8a4aeef074e2a29e44fdd26352633f47bbc862
Summary:
Release Note: Fix duplicate edges issue in Prepack heap visualization.
This PR did two things:
1. Fix duplicate edges issue in Prepack heap visualization by using unique identifier for edge id field.(#1300)
2. Prepack heap visualization supports two formats: 1. Dot language formatted used by CLI. 2. JSON format used by Vis.js library to visualize in website REPL. This PR allows both.
Closes https://github.com/facebook/prepack/pull/1308
Differential Revision: D6656452
Pulled By: yinghuitan
fbshipit-source-id: 123ec5c9a031bc43e0d71c1b0510956ef1463143
Summary:
Issue https://github.com/facebook/prepack/issues/1296.
The previous version of Tether Select that was used in the website had `z-index: 100;` (still can check it in `gh-pages` branch) but in the version that we use from CDN, in order to reduce the size of Prepack repo, there is no `z-index`. So I've added it to the website styles.
Closes https://github.com/facebook/prepack/pull/1298
Differential Revision: D6638548
Pulled By: NTillmann
fbshipit-source-id: 1fb05a37d7bd83a71936ac4aa4ed9a138825f032
Summary:
Release note: add heap graph visualization to website
Moved from #1243
- read in the heap graph data from prepackSources result
- display the graph using [visjs](http://visjs.org/)
Closes https://github.com/facebook/prepack/pull/1265
Differential Revision: D6571860
Pulled By: JWZ2018
fbshipit-source-id: 4c2d9bae91eaffff58df8909214d4c7bc56d1359
Summary:
Release note: none
To address issue #956 .
The idea is to have all documentation (aka "the website") in a single `docs/` directory on the `master` branch like [Jest](https://github.com/facebook/jest/tree/master/docs) and [Relay](https://github.com/facebook/relay/tree/master/docs) do. This directory then serves as a single source of truth to publish the `gh-pages` branch.
This PR:
- Moves the current content of the `gh-pages` branch to a `docs/` directory in `master`
- Provides a bash script for maintainers to easily publish the `gh-pages` branch from the `docs/` directory. The script also builds `prepack.min.js` from master to make sure gh-pages always has the latest version of prepack.
Additionally, I noticed the `gh-pages` branch had two `prepack.min.js` files (one in `./` and one in `./js/`). I removed the first one because it is apparently not used but it may break other websites if they references that file.
0. Fork the repo to avoid modifying the real website
1. Change the site
`> git checkout master`
`> echo ".nav { background-color: chartreuse; }" >> docs/css/style.css`
`> git add docs/css/style.css`
`> commit -m "The navigation bar looks better in green"`
`> git push`
2. Run the publication script:
`> ./scripts/publish-gh-pages.sh`
3. Verify that the gh-pages has been updated:
`> git checkout gh-pages`
`> git pull`
`> git diff HEAD~ # should show the line you added`
Closes https://github.com/facebook/prepack/pull/1223
Differential Revision: D6547395
Pulled By: j-nolan
fbshipit-source-id: 6e6d3aec97c0bcc2555c421d6f4a889bcd8df208