Commit Graph

15 Commits

Author SHA1 Message Date
Leo Balter
df0f9e16ae Use integration api to run Test262 tests
Summary:
This method provides an alternative way to run Test262 through a
stream of compiled test contents for each scenario (default, strict
mode), including all the necessary harness contents.

The logic to capture an execution success or failure is similar to
the original one - from scripts/test262-runner.js - and improvements
should be done as follow ups.

The filtering system is now done through a configuration yaml file,
using tests metadata and path locations. This filter is used as an
object that can be extended with further logic, but still offers a
single point to check for filtering.

The report system requires some improvements and these should also
be done as follow-ups. For now they provide a report for each
folder and the total results. Although, the results data contain
enough information to highly expand the report.

Some further improvements are expected and planned, this work
should be at least ready for an initial round for feedback review.
Closes https://github.com/facebook/prepack/pull/1122

Reviewed By: cblappert

Differential Revision: D6456700

Pulled By: hermanventer

fbshipit-source-id: ba56efcaa4eab847594cb7c1fbc908cf1fc66a80
2017-12-01 17:46:29 -08:00
Dominic Gannaway
810056d1ec Add React functional component folding
Summary:
Release note: Adds experimental React functional component folding optimizations

This PR is stacked upon PRs #1118 and #1117. Thus, those PRs should be merged before this PR is merged to reduce noise in the diff.

This PR adds a new React Reconciler into Prepack's serialization process, so that React components trees can be folded/inlined into a single component at build time. To fold a component tree, it must be explicitly done via `__registerReactComponentRoot(nameOfComponent)`.

This PR only attempts to fold React functional components, not React ES2015 class components (that will come in another PR at a later date). Furthermore, the `props` parameter on a root component must contain Flow type annotations (otherwise we will have no idea what the values might be). Support flow `propTypes` might also be an addition, but not for this PR.

If the reconciler comes across a component that it cannot fold/inline, it will "bail-out" and try and continue the process without that particular component being folded into the tree.

An example of how this all works (input):

```jsx
function App(props: {title: string}) {
  return (
    <div>
      <ChildComponent title={props.title} />
    </div>
  );
}

function ChildComponent(props) {
  return (
    <span>
      <SubChildComponent {...props} />
    </span>
  );
}

function SubChildComponent(props) {
  return <span>{props.title.toString()}</span>
}

__registerReactComponentRoot(App);

global.App = App;
```

Output:
```jsx
(function () {
  "use strict";

  var _$1 = this;

  var _0 = function (props) {
    var _$0 = props.title;
    return <div><span><span>{_$0}</span></span></div>;
  };

  _$1.App = _0;
}).call(this);
```
Closes https://github.com/facebook/prepack/pull/1120

Differential Revision: D6237333

Pulled By: trueadm

fbshipit-source-id: b58c7d8979ca79a766bb2ee2eb01a380d37c3101
2017-11-06 05:07:36 -08:00
Herman Venter
4944f2e939 Fix flow errors
Summary:
Update Flow and fix errors found by new version.

I'm none to sure the changes to the code are desirable. Perhaps the flow types for babel-types need to be updated?
Closes https://github.com/facebook/prepack/pull/1127

Differential Revision: D6222475

Pulled By: hermanventer

fbshipit-source-id: 208b89787914fc7d1e322cb14a6ff2374cd24b9a
2017-11-03 00:10:03 -07:00
Dominic Gannaway
e63daa5585 Add React/Jest testing infrastructure
Summary:
Release note: none

This PR adds the React/Jest testing infrastructure to Prepack and is stacked on the PR https://github.com/facebook/prepack/pull/1117. Thus, that PR should be merged before this PR is merged to reduce noise in the diff.

This will allow us to test various runtime outputs of React 16 when running original source vs Prepacked source to see if there are any issues/differences that might have an impact on applications. The primary reason for this is to track regressions for the component folding PRs that will land in the future.

Please note, this PR does not contain any reconciler changes, thus `__registerReactComponentRoot(App);` has been commented out of tests to ensure they don't prematurely fail. A follow up PR will enable them once the other React functional component folding PRs get landed.

This PR also adds some mock React globals to be used within tests (and maybe to be further integrated into folding at a future point too). The mocks include `React.Component` and `React.cloneElement` for now.

Furthermore, a `utils/json.js` utility file exists to help normalize the results from the React test renderer so that adjacent JSON text nodes get merged, which is something that may exist because of how the reconciler (once the PR lands) handles inlining of child nodes.

The command to run React tests is `yarn test-react`.
Closes https://github.com/facebook/prepack/pull/1118

Reviewed By: cblappert

Differential Revision: D6208263

Pulled By: trueadm

fbshipit-source-id: d54f3b0e1cc3240e1f142d3da08bc279e4153889
2017-11-02 04:40:33 -07:00
Wuhan Zhou
f6279bd814 Framework for debug adapter and mock ui
Summary:
Release note: none
Issue: #907

- Mock UI as a CLI to communicate with the adapter
- Starter code for the debugger adapter with an initialize request
Closes https://github.com/facebook/prepack/pull/1088

Differential Revision: D6108024

Pulled By: JWZ2018

fbshipit-source-id: 506ec039dcb1ff540872cb2e1a87a165cfd22e4d
2017-10-20 11:08:33 -07:00
Dominic Gannaway
cfc6993e9c Basic JSX/ReactElement support
Summary:
Release notes: adds JSX and ReactElement evaluation/serialization support

This adds JSX/ReactElement support to the Prepack serializer so `ReactElement` "like" objects can correctly be converted back to JSX syntax. Example:

```jsx
'use strict';

const externalThing = __abstract('function', 'externalThing');

function Test() {
  return <div>{ externalThing() }</div>
}

global.test = Test;
```

Becomes:
```jsx
'use strict';

var _$0 = this;

var _0 = function () {
  return <div>{_1()}</div>;
};

var _1 = externalThing;
_$0.test = _0;
```

I've also added a JSXElement -> ReactElement evaluator.
Closes https://github.com/facebook/prepack/pull/1051

Differential Revision: D6053275

Pulled By: trueadm

fbshipit-source-id: 7c31545751ceedba55cdd4581bc6de51a98b412a
2017-10-13 12:18:35 -07:00
chico
1edb96ade2 Update Flow to 0.54.0
Summary:
Closes #905

Error mentioned in issue above was fixed in d145b375ed
Closes https://github.com/facebook/prepack/pull/947

Differential Revision: D5812790

Pulled By: yinghuitan

fbshipit-source-id: 00779dd18a334d6b15cacf8d98b05b780e6844ee
2017-09-11 22:54:02 -07:00
Andres Suarez
69f5d05ebc Upgrade to babylon@6.18.0
Summary: babylon@6.18.0 has support for "opaque type alias" syntax (https://github.com/babel/babylon/releases/tag/v6.18.0 and https://medium.com/flow-type/hiding-implementation-details-with-flows-new-opaque-type-aliases-feature-40e188c2a3f9).

Reviewed By: cblappert

Differential Revision: D5706930

fbshipit-source-id: 8cdaee77b838812ebb012a352f7e77b74838b536
2017-08-29 16:26:03 -07:00
Herman Venter
f8bf43f673 Update yarn.lock
Summary:
Update Babylon and adjust expected pass count to match what I see on my laptop.

The difference was due to my version of Babylon (which is the latest for some or other reason I don't understand) giving a syntax error that did not occur with the version on the CI machine. Updating the yarn lock file gets the CI machine in sync with my laptop with respect to those tests.

Note that some String.prototype tests only pass with recent versions of Node.
Closes https://github.com/facebook/prepack/pull/831

Differential Revision: D5489742

Pulled By: hermanventer

fbshipit-source-id: 5732e47718c53d9f20de04fd64c1389524f33309
2017-07-25 14:27:51 -07:00
Nikolai Tillmann
649834eae9 @allow-large-files [prepack][PR] Updating Flow, and removing no longer needed suppression.
Summary: Closes https://github.com/facebook/prepack/pull/827

Differential Revision: D5484313

Pulled By: NTillmann

fbshipit-source-id: 7832fc792d8964735fb598e09389fb48e495d541
2017-07-24 18:26:49 -07:00
Jeffrey Tan
3c0b057e1a Enable eslint prettier plugin
Summary:
After adding this plugin, you just need to install https://github.com/AtomLinter/linter-eslint Atom package to surface ESLint errors(including prettier errors) in Nuclide linter UI. You also got auto-fix support in the Nuclide UI. Similarly, in VSCode, you can install https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint plugin to surface ESLint error in VSCode UI.
One caveat is that, eslint-plugin-prettier uses its own version of prettier(1.3.1) which may diverge from what we want. If we really found a file that diverge in formatting, we may have to add it into .eslintignore to ignore from UI/linter.
Closes https://github.com/facebook/prepack/pull/816

Differential Revision: D5444642

Pulled By: yinghuitan

fbshipit-source-id: 1670129d62e5e799a50c53d78387b5ded4c2c964
2017-07-18 14:09:05 -07:00
wdhorton
7f5ec3b43f Making Prettier a check-in gate
Summary:
This supersedes #760.

Additional changes over #760:
Pinning Prettier version to get some formatting always. (Different prettier versions were responsible for the observed flip-flopping of StringPrototype.js.)
Print output of prettier in wrapper script for better diagnosis / experience. (TODO: How to just pipe through console output? Couldn't get it to work.)
Updating problematic .js file for the last time.
Closes https://github.com/facebook/prepack/pull/787

Differential Revision: D5382336

Pulled By: NTillmann

fbshipit-source-id: 95ed988ef3f091493d2fb509b5481753d56901cd
2017-07-07 11:35:32 -07:00
wdhorton
f909b69a74 Enable Prettier and remove conflicting eslint rules.
Summary:
Per discussion in #729, this sets up prettier but doesn't actually run it on the codebase.
Closes https://github.com/facebook/prepack/pull/759

Reviewed By: Kishore-B-Rao

Differential Revision: D5343135

Pulled By: NTillmann

fbshipit-source-id: 638740d48b6fa797fa79b8b5fd3c032497cb0132
2017-06-29 12:23:49 -07:00
Chris Blappert
bc8651356f Weekly release v0.2.4: node8, bugfixes, new optimization
Summary: Change version number, yarn.lock in preparation of publishing new npm package

Reviewed By: NTillmann

Differential Revision: D5292317

fbshipit-source-id: d91edcbdbbcfe9a0e7ad2530700899e3ef3cfb60
2017-06-21 08:23:07 -07:00
Henry Zhu
923dea7aa3 Use preset-env (#512) 2017-05-23 17:30:54 -04:00