Skip to content

Commit

Permalink
Drop Haste (#11303)
Browse files Browse the repository at this point in the history
* Use relative paths in packages/react

* Use relative paths in packages/react-art

* Use relative paths in packages/react-cs

* Use relative paths in other packages

* Fix as many issues as I can

This uncovered an interesting problem where ./b from package/src/a would resolve to a different instantiation of package/src/b in Jest.

Either this is a showstopper or we can solve it by completely fobbidding remaining /src/.

* Fix all tests

It seems we can't use relative requires in tests anymore. Otherwise Jest becomes confused between real file and symlink.
jestjs/jest#3830

This seems bad... Except that we already *don't* want people to create tests that import individual source files.
All existing cases of us doing so are actually TODOs waiting to be fixed.

So perhaps this requirement isn't too bad because it makes bad code looks bad.

Of course, if we go with this, we'll have to lint against relative requires in tests.
It also makes moving things more painful.

* Prettier

* Remove @providesModule

* Fix remaining Haste imports I missed earlier

* Fix up paths to reflect new flat structure

* Fix Flow

* Fix CJS and UMD builds

* Fix FB bundles

* Fix RN bundles

* Prettier

* Fix lint

* Fix warning printing and error codes

* Fix buggy return

* Fix lint and Flow

* Use Yarn on CI

* Unbreak Jest

* Fix lint

* Fix aliased originals getting included in DEV

Shouldn't affect correctness (they were ignored) but fixes DEV size regression.

* Record sizes

* Fix weird version in package.json

* Tweak bundle labels

* Get rid of output option by introducing react-dom/server.node

* Reconciler should depend on prop-types

* Update sizes last time
  • Loading branch information
gaearon authored Oct 24, 2017
1 parent edf86be commit fa973be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const React = require('react');
const emptyObject = require('fbjs/lib/emptyObject');
const invariant = require('fbjs/lib/invariant');

const describeComponentFrame = require('describeComponentFrame');
const getComponentName = require('getComponentName');
const describeComponentFrame = require('shared/describeComponentFrame');
const getComponentName = require('shared/getComponentName');

class ReactShallowRenderer {
static createRenderer = function() {
Expand Down
10 changes: 5 additions & 5 deletions src/ReactTestRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
'use strict';

var ReactFiberReconciler = require('react-reconciler');
var ReactFiberTreeReflection = require('ReactFiberTreeReflection');
var ReactGenericBatching = require('ReactGenericBatching');
var ReactFiberTreeReflection = require('shared/ReactFiberTreeReflection');
var ReactGenericBatching = require('events/ReactGenericBatching');
var emptyObject = require('fbjs/lib/emptyObject');
var ReactTypeOfWork = require('ReactTypeOfWork');
var ReactTypeOfWork = require('shared/ReactTypeOfWork');
var invariant = require('fbjs/lib/invariant');
var {
Fragment,
Expand All @@ -24,8 +24,8 @@ var {
HostRoot,
} = ReactTypeOfWork;

import type {Fiber} from 'ReactFiber';
import type {FiberRoot} from 'ReactFiberRoot';
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';

type TestRendererOptions = {
createNodeMock: (element: React$Element<any>) => any,
Expand Down

0 comments on commit fa973be

Please sign in to comment.