Summary:
cc NTillmann
Following up https://github.com/facebook/prepack/issues/2285, website shows the generated coded even when there are some warnings.
Lot of changes because prettier wasn't applied to the files, but I basically only checked for the error buffer containing only items with `severity === 'Warning'` and create the `warning` result type to behave the same than `success` one.
Next step would be to show the code AND warning messages. Either using the same display than error messages or creating a variation of it (changing text color to yellow for example). I can do it if you want.
Let me know if this is what you were looking for.
Have a nice day !
P.S: not sure if this PR was supposed to be into `gh-pages` or `master`. Let me know if that needs to be changed.
Pull Request resolved: https://github.com/facebook/prepack/pull/2528
Differential Revision: D9882040
Pulled By: NTillmann
fbshipit-source-id: bc8266a673e6def023bfa65b93b94ea9c7ad5b1d
Summary:
The previous changes on "Do full joins" didn't remove all
uses of the delayUnsupportedRequires feature. This does it.
In particular, this fixes the internal prepack-test.
Reviewed By: hermanventer
Differential Revision: D9287509
fbshipit-source-id: f810f5e08a10cbd14272d776799a2a8f1442d1c8
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:
I haven't written the next parts yet but I figured let's put a link on the website so this doesn't get lost.
I think even the details there are useful enough for users and new contributors.
<img width="1513" alt="screen shot 2018-06-21 at 3 57 52 pm" src="https://user-images.githubusercontent.com/810438/41727325-f9ba32da-756b-11e8-94f0-c83b71df859b.png">
I put it at the top of Getting Started because IMO you'll want to read this (or at least see it) before trying to run Prepack.
I initially planned to put it in the docs themselves but only today realized there's no build process. I don't want to convert the guide to HTML so I'd rather keep it as a gist (and update it if necessary) in the meantime.
Closes https://github.com/facebook/prepack/pull/2147
Differential Revision: D8577403
Pulled By: gaearon
fbshipit-source-id: 2f7f64a0a4413066739b12c50b4d21779a16a568
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:
Fixing some incompatibility between heapGraph and `__optimize()`.
Essence of the issue was an implicit assumption that only one visitor would visit certain entries.
Original Issue: https://github.com/facebook/prepack/issues/1732
Closes https://github.com/facebook/prepack/pull/2021
Reviewed By: trueadm
Differential Revision: D8248761
Pulled By: caiismyname
fbshipit-source-id: dd27487b490e3924fdc0fe6aaca7f1c103e137cb
Summary:
Corrected matching end tags div and p tags fixed
Closes https://github.com/facebook/prepack/pull/1907
Differential Revision: D7925198
Pulled By: NTillmann
fbshipit-source-id: b92c2dbaada71e9afdd0193692b1ec2e401999e4
Summary:
Release Note: none
I just wanted to add the reading links as suggested in #1887
arrived to the wiki from Twitter -> the issue -> to the Wiki :)
Let me know if you want the copy updated and shifted around anywhere.
Closes https://github.com/facebook/prepack/pull/1948
Differential Revision: D7985678
Pulled By: NTillmann
fbshipit-source-id: 22cd999bf4ff8dd26618b06d94f751834533b726
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:
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