Commit Graph

67 Commits

Author SHA1 Message Date
David Aurelio c03ce7fdf3 Saner entry point
Summary: makes flow typing for the entry point more sound and fixes two issues

Reviewed By: BYK

Differential Revision: D5507650

fbshipit-source-id: 6b03f7de792ffcece4d0d61950e136a61ea7db2e
2017-07-27 18:05:49 -07:00
James Ide 113e046444 Control whether Metro tells Babel to lookup .babelrc files
Summary:
This adds support to RN's configuration file to let people turn off Babel's behavior of looking up .babelrc files. Most of the support for this feature is in Metro (https://github.com/facebook/metro-bundler/pull/31).
Closes https://github.com/facebook/react-native/pull/15136

Differential Revision: D5483241

Pulled By: jeanlauliac

fbshipit-source-id: c78096c1574c9f844c9f34aff73e6f97cb0b5e45
2017-07-26 15:31:03 -07:00
Jean Lauliac 65769b0c33 metro-bundler: remove hardcoded AssetRegistry path
Reviewed By: davidaurelio

Differential Revision: D5452553

fbshipit-source-id: e0a6f56d3bc03f4ba7f34fbee1ae418495dcc6cd
2017-07-24 17:16:39 -07:00
Alex Dvornikov 70edc2fd80 Upgrade metro-bundler to v0.10.0
Reviewed By: davidaurelio

Differential Revision: D5469746

fbshipit-source-id: 1d2c0f6c5bb9761cfc54b6c9fdbb1a9f20f535ea
2017-07-21 09:40:15 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Miguel Jimenez Esun 6dd9d16833 Move Array<string> to $ReadOnlyArray<string>. Separate polyfill list into a file.
Summary: Move the returned type of `getPolyfills` from a standard `Array` to a read-only one, so that we make sure the array is not modified once created. Also, refactor the list of polyfills included by default to a generic, central file, then require it both from the CLI utils as well as the development server.

Reviewed By: jeanlauliac

Differential Revision: D5406553

fbshipit-source-id: ab980288bb1c625338de469da77dd6fc70bcedbc
2017-07-13 03:38:23 -07:00
James Ide 9f87728f5d Change `polyfills` to `getPolyfills` function for more configurability
Summary:
Changing the `polyfills` option to `getPolyfills({platform})` will let us return a different set of polyfills for each platform. See https://github.com/facebook/metro-bundler/issues/25 for the motivation.
Closes https://github.com/facebook/react-native/pull/14943

Differential Revision: D5405878

Pulled By: mjesun

fbshipit-source-id: 908e49a286841f97655603d92d0fdfb000547510
2017-07-12 08:18:14 -07:00
Miguel Jimenez Esun ad0fe15e2e Move polyfills to react-native
Summary:
React Native bundler (aka Metro Bundler) was splitted from the main codebase some time ago (now it lives [[https://github.com/facebook/metro-bundler|here]]). To make it more agnostic, polyfills will be moved out from it, so people who doesn't need them does not include them. However, RN will still need them, so the first step is to copy them back to RN so that we can provide them to Metro Bundler later.

We also include a way of passing the list of polyfills to include, as an `Array<string>`. The field is called `polyfills`, and defaults to the traditional list that is currently included in the package manager [see here](be1843cddc/packages/metro-bundler/src/defaults.js (L27-L37)).

In future commits, `metro-bundler` will be able to manage the `polyfills` array passed to it, and use it, instead of the pre-defined ones.

Reviewed By: davidaurelio

Differential Revision: D5381614

fbshipit-source-id: 749d536b781843ecb3067803e44398cd6df941f1
2017-07-11 03:47:16 -07:00
Nurzhan Bakibayev c00abe53c3 Move inspector proxy out of the packager
Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
2017-07-10 06:31:23 -07:00
Christopher Chedeau c848c3820b Codemod prettier to 1.5.2
Differential Revision: D5339725

fbshipit-source-id: 631338436a7d69b0ab0721507bdab4ae4e207065
2017-06-28 12:50:30 -07:00
David Aurelio 1faf40b02a Upgrade metro-bundler to v0.9.0
Summary: Upgrade metro-bundler to v0.9.0. This version has no functional change. The only change is that the structure of the npm package reflects the structure of the source code.

Reviewed By: bestander

Differential Revision: D5315651

fbshipit-source-id: 3a69337106d4ccf708823c80d304941973360e8e
2017-06-24 17:15:55 -07:00
Christoph Pojer 29d9c35e12 Add --maxWorkers flag and allow transformers to run in-band.
Summary:
This diff cleans up some cruft and adds some features:

* It removes the usage of an env variable to control workers.
* It removes the lazy and handwavy calculation on how many workers to use for jest-haste-map. Jest itself uses the maximum amount of workers available and it has never been reported as an issue – especially since it is a one-time startup cost of about 3 seconds on a cold cache only.
* It adds a `--max-workers` flag to replace the env variable. This one is able to control both the number of workers for `jest-haste-map` as well as the transformers.
* It makes the transformers run in the parent process if 1 or fewer workers are are specified. This should help with debugging.

Once you approve this diff, I will publish a new version of metro to npm and update the version used in RN and remove the use of the env variable altogether: https://our.intern.facebook.com/intern/biggrep/?corpus=xplat&filename=&case=false&view=default&extre=&s=REACT_NATIVE_MAX_WORKERS&engine=apr_strmatch&context=false&filter[uninteresting]=false&filter[intern]=false&filter[test]=false&grep_regex=

Note: the process of adding a CLI option is really broken. Commander also has a weird API. We should consider building a better public API for Metro and then consider how to build a new CLI on top of it and simplify our internal integration. I really don't like how Metro is integrated across pieces of the RN cli in ways that is hard to manage. But that is a larger task for another time :)

Reviewed By: jeanlauliac

Differential Revision: D5217726

fbshipit-source-id: 74efddbb87755a9e744c816fbc62efa21f6a79bf
2017-06-13 09:16:03 -07:00
Andrew Imm 2c32acb755 Add https options to RN CLI server
Reviewed By: davidaurelio

Differential Revision: D5223852

fbshipit-source-id: 91025751ddf1f4ec4adcc768b69b936ee1a68edf
2017-06-12 16:15:37 -07:00
Jean Lauliac 07ee04d7bd metro-bundler: upgrade react-native-github to OSS bundler
Reviewed By: cpojer

Differential Revision: D5172542

fbshipit-source-id: 4ca6c9aad8f798ac6b8f1070f98b5d1d2098e726
2017-06-02 11:31:40 -07:00
Jean Lauliac 365c1bfcf9 metro-bundler: Terminal: remove global state
Reviewed By: cpojer

Differential Revision: D5155075

fbshipit-source-id: 1d64bdd0ae13087aca620b65892832e3a1229c4a
2017-06-01 03:04:04 -07:00
Christoph Pojer 57bb955ba1 Move remaining Metro Bundler files around.
Reviewed By: jeanlauliac

Differential Revision: D5154653

fbshipit-source-id: 482bf9829263d5d8f3d0b951ee58e2020236cc2c
2017-05-31 11:17:41 -07:00
Christoph Pojer 414da08a80 Stop requiring setupBabel from within packager/ folder.
Reviewed By: davidaurelio

Differential Revision: D5137246

fbshipit-source-id: 3072aaa6fd74a135980f1f0a7b078a82dd85f09d
2017-05-30 04:46:08 -07:00
Christoph Pojer 17e0478cf4 Remove setupBabel call from main entry point
Summary:
* Internally, we already set up babel before calling into metro-bundler.
* Externally, I moved the setup calls to outside the packager/ folder.

If somebody has a custom integration with RN, they would need to setup babel themselves up until we make the open source split. By the time this is released in open source, an npm version of metro-bundler will be available for use.

Next step: also do this for the worker and remove setupBabel from the metro repo.

Reviewed By: davidaurelio

Differential Revision: D5121429

fbshipit-source-id: e77c6ccc23bef1d13fd74c4727be2d7e09d2d0ca
2017-05-24 11:45:46 -07:00
eacaps e53046b9ec pass polyfillModuleNames into packager
Summary:
After examining how React Native sets up `process.env.NODE_ENV` using `global.__DEV__` from `prelude_dev.js` or `prelude.js` by treating them like polyfills I decided to use the same approach for environment variables. I setup my own rn-project.config.js file like so:

```
const blacklist = require('react-native/packager/blacklist');
const pathJoin = require('path').join;

module.exports = {
  getBlacklistRE: function() {
    return blacklist([/build\/.*/, /app\/assets\/webpack.*/]);
  },
  polyfillModuleNames: [pathJoin(__dirname, 'globals.js')]
};
```

I ran the packaging server using:
`react-native start --config=config/react-native/rn-project.config.js --reset-cache`

I expected my polyfillModuleNames to be passed into the Packager properly and be handled the same way the built-in polyfills worked. Unfortunately I noticed the Packager wasn't actually getting `opt.polyfillModuleNames`. Digging into the code a bit, it seems the local-cli wasn't passing the polyfillModuleNames from the config.

There are no specs for runServer.js but this change can be tested by using a config that contains polyfillModuleNames. Sample config and run command provided above simple `global.js` provided below:

```
global.process = global.process ? global.process : {};
global.process.env = global.process.env ? global.process.env : {};
global.process.env['PROJECT_ENV'] = 'staging';
```
Closes https://github.com/facebook/react-native/pull/13725

Differential Revision: D5077615

Pulled By: jeanlauliac

fbshipit-source-id: f66a8a8bda2702cd9a4e5b92f5335f43ab2f9089
2017-05-17 05:03:41 -07:00
Jean Lauliac c0e8d67e01 packager: server.js: @flow
Summary: I'd like to start typing the front-end so that it's easier to track adding new options, etc.

Reviewed By: davidaurelio

Differential Revision: D5069868

fbshipit-source-id: 9a18dca52efd486ca18f17d0ec434a5ec1c1649c
2017-05-17 05:03:41 -07:00
Jean Lauliac b98c33f1b4 packager: runServer: @flow
Summary: This makes it easier to verify correctness when adding new config/args.

Reviewed By: davidaurelio

Differential Revision: D5069537

fbshipit-source-id: 4d8058851900b23163d0f2744e91dd14dfcdd461
2017-05-17 05:03:41 -07:00
Jean Lauliac 4a86f93982 packager: add support for relative files with custom extensions
Reviewed By: cpojer

Differential Revision: D4994139

fbshipit-source-id: 5e47c5bc6f8b2cd750f1ca0df940c23234c66600
2017-05-04 05:21:44 -07:00
Lukas Piatkowski 976a181a1c Add additional post process of SourceMap after the minification of JS
Reviewed By: davidaurelio

Differential Revision: D4955229

fbshipit-source-id: ac4e5f917839d43d73b80d98b4813d8ccf1d41ef
2017-05-03 03:45:41 -07:00
David Aurelio 414d5a3023 Change postprocessing hook to work on `ModuleTransport` instances
Reviewed By: amnn

Differential Revision: D4962283

fbshipit-source-id: 25b609bcd4b8d7a881e35426010f15530548e301
2017-04-28 10:03:07 -07:00
Brent Vatne b80e2c8799 Move packager initialization events to reporter
Summary:
This PR depends on #13172

Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter.

- We [log a banner with some information about the port and what's going on](8c7b32d5f1/local-cli/server/server.js (L22-L32))
- Also [a message about looking for JS files](8c7b32d5f1/local-cli/server/server.js (L34-L38)) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing).
- If the packager fails to start, then [we log an error message](8c7b32d5f1/local-cli/server/server.js (L41-L61)).

This pull request changes those log messages to be handled by TerminalReporter. I tri
Closes https://github.com/facebook/react-native/pull/13209

Differential Revision: D4809759

Pulled By: davidaurelio

fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
2017-03-31 02:17:22 -07:00
Brent Vatne 5f5da4e122 Add support for custom log reporter cli option for local server
Summary:
In Expo tools such as XDE, exp we listen listen to stdout from the packager process and print it in our own buffer. In the case of XDE, an electron app, our log pane is DOM-based, and before printing each log chunk we need to remove special tty characters and sometimes parse it to get information that we need (eg: progress bar). By using a custom reporter, we can take the raw events and pass them along in a format that is easy to consume by XDE and exp. This same motivation applies to create-react-native-app, where we currently don't show a progress bar in the terminal, but we can with this change.

Create `LogReporter.js` in the root of a project with the CLI changes included in this PR.

```
class LogReporter {
  update(event) {
    console.log(JSON.stringify(event));
  }
}

module.exports = LogReporter;
```

Now, run `react-native start --customLogReporterPath=LogReporter.js` -- all of the raw events will be output as JSON (while the logs
Closes https://github.com/facebook/react-native/pull/13172

Differential Revision: D4795760

Pulled By: hramos

fbshipit-source-id: 80164b2f30e33a3f9965f4865a8404f8640a52c1
2017-03-30 18:15:49 -07:00
Charles Dick af590b0c74 remove the old heap profiler visualization code
Differential Revision: D4650983

fbshipit-source-id: 1f791acdd3e2d96e7881ea037045fafa2c6d781a
2017-03-15 06:47:34 -07:00
Bhuwan Khattar 234f4f538d Introduce HasteImpl
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.

This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations

Reviewed By: davidaurelio

Differential Revision: D4589372

fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
2017-02-27 14:04:58 -08:00
Dan Abramov 934cd82941 Move DevTools integration into its own repo
Summary:
The way React DevTools integration was set up in RN was not entirely supported by the React team, and we had to disable it in c3b25c9059 so that we can move forward with enabling Fiber support in React Native.

Here, I am moving the DevTools client setup from RN repo to [React DevTools repo](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/README.md#requirereact-devtools-coreconnecttodevtoolsoptions) so that we can keep it in sync with the rest of React DevTools. This is also a part of a larger effort to consolidate DevTools code (https://github.com/facebook/react-devtools/issues/489). It allows us to remove the double injection of the hook, an lets us replace the `eval` hack with a regular dependency. The implementation [lives here now](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools-core/src/backend.js).

This change re-enables Nuclide Inspector with React Native Stack reconciler and prepares it for compatibi
Closes https://github.com/facebook/react-native/pull/12316

Reviewed By: zertosh

Differential Revision: D4545322

Pulled By: gaearon

fbshipit-source-id: ab949916c1a92c6b41cd41e7e1edf9697a71de2e
2017-02-14 14:03:46 -08:00
Christoph Pojer a2c84d14ce Remove `react-packager` indirection.
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.

Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change?

Reviewed By: jeanlauliac

Differential Revision: D4487867

fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
2017-02-02 05:44:15 -08:00
Lukas Piatkowski c5f862b913 The jscProfileMiddleware require some FB only modules, so moving to internal
Reviewed By: cwdick

Differential Revision: D4441898

fbshipit-source-id: 0ab5aa4158fccf190e76d3582a8a12d9b1d23fa8
2017-01-25 10:43:54 -08:00
Andrew Imm 09a83f976e Allow project-specific config for RN CLI using providesModuleNodeModules
Reviewed By: davidaurelio

Differential Revision: D4409046

fbshipit-source-id: 5af0d08542935a784f4737653ccac49fd7517aff
2017-01-12 21:13:36 -08:00
Jean Lauliac ff50420b0f packager: create the reporter higher in the stack
Reviewed By: davidaurelio

Differential Revision: D4392283

fbshipit-source-id: 4cd470ca0cbddcbb515407b5249272a758849b82
2017-01-09 10:13:33 -08:00
Andrew Imm 67828a52bd Allow custom platforms for the RN Packager on a per-project basis
Reviewed By: cpojer

Differential Revision: D4255979

fbshipit-source-id: bf900b67ee30e2f994e96c9a6103ed2e53a87f88
2016-12-02 09:43:31 -08:00
David Aurelio 8ad2ab3b5e BREAKING: expose `getTransformOptions` directly in configuration
Summary:
Instead of exposing a `getTransformOptionsModulePath` function in configurations, we can simply expose a `getTransformOptions` *function*. The necessity of exposing a path comes from the olden days, where we had a server listening on a socket, and a client, talking to that server.

Since that architectural gem no longer exists, we can use functions directly, rather than passing paths to modules around.

Reviewed By: cpojer

Differential Revision: D4233551

fbshipit-source-id: ec1acef8e6495a2f1fd0911a5613c144e8ffd7c3
2016-11-28 07:28:33 -08:00
David Aurelio ca58e0af82 BREAKING kill deprecated asset support
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.

It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.

Reviewed By: matryoshcow

Differential Revision: D4231208

fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
2016-11-24 05:43:38 -08:00
Christoph Pojer a9338d6af1 New file watching implementation
Summary:
This is the next incremental step to rewrite node-haste. I apologize for the size of this diff but there is really no smaller way to do this. The current architecture passes a single file watcher instance into many classes that each subscribe to file changes. It's really hard to keep track of this. The new implementation reduces the listeners to two (will eventually be just one!) - one in DependencyGraph and one in it's parent's parent's parent (ugh! This doesn't make any sense). This should make it much more straightforward to understand what happens when a file changes.

I was able to remove a bunch of tests because jest's watcher takes care of things like ignore patterns. Some of the tests were specifically testing for whether the change events were invoked and they are now much more straightforward as well by manually invoking the `processFileChange` methods.

(Relanding a fixed version of D4161662)

Reviewed By: kentaromiura

Differential Revision: D4194378

fbshipit-source-id: 8c008247a911573f6b5f6b0b374d50d38f62a4f5
2016-11-16 20:13:26 -08:00
Martin Konicek 14ac051c19 Revert D4161662: [RNP] New file watching implementation
Differential Revision: D4161662

fbshipit-source-id: 00604387b4f4b808f95275458f1c653981f91b86
2016-11-16 10:28:31 -08:00
Christoph Pojer e8a623a2ab New file watching implementation
Reviewed By: davidaurelio

Differential Revision: D4161662

fbshipit-source-id: 9a2a399304c83b411a8b0b74ea015c18b599fbaf
2016-11-16 01:13:40 -08:00
Alexander Blom 655fe2796a Add packager inspector proxy
Summary:
Implements a multi-device proxy for the Chrome debugging protocol. Each device connects
to the proxy over a single websocket connection that is able to multiplex messages to multiple
Javascript VMs. An inspector instance running in Chrome can connect to a specific VM via this
proxy.

Reviewed By: davidaurelio

Differential Revision: D4088492

fbshipit-source-id: 3ee934e98604b5a378da732e687ca05fe3d23ce0
2016-11-15 08:59:02 -08:00
David Aurelio d7aa297762 Break out defaults, add flow for Config
Summary: In order to make `Config` and defaults available to our new code, I’ve added flow types and put default values into one shared modile

Reviewed By: cpojer

Differential Revision: D4044600

fbshipit-source-id: 875ed3ade69c5b22bb3c1b177e7bad732834d476
2016-10-22 06:13:42 -07:00
Lukas Piatkowski 2231b21ed0 #15.1 Extend packager server to receive signals from Sampling Profiler
Reviewed By: bestander

Differential Revision: D3606098

fbshipit-source-id: ec55030dd1b3a27f0595650da1ce01fe1ac9116c
2016-08-02 11:14:06 -07:00
androidtrunkagent 1ab4b2a792 Add support for passing in additional assetExts to packager
fbshipit-source-id: 42e508e37d960fbeb905a2ea8cb4741dba5c67fc
2016-08-02 10:27:25 -07:00
Charles Dick aba87550cc upload JSC heap capture to bundle server
Reviewed By: bestander

Differential Revision: D3642116

fbshipit-source-id: 9626078bb0f087f55d8270c8e0b082c74bd2df9d
2016-08-02 08:13:57 -07:00
Mike Grabowski e8b508144f Merge `rnpm cli` into react-native
Summary:
This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.).

It's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.

<s>This is still WIP and some of the commands are left commented out.</s>

For the `config` of `rnpm` (functions get info about project and dependency), <s>I am thinking we can merge them with</s> we decided to merge it with [`default.config.js`](e57683e420/local-cli/default.config.js (L33)), so they are available on the `new Config()` [instance](e57683e420/local-cli/cliEntry.js (L59)) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e
Closes https://github.com/facebook/react-native/pull/7899

Differential Revision: D3613193

Pulled By: bestander

fbshipit-source-id: 09a072f3b21e5239dfcd8da88a205bd28dc5d037
2016-07-30 09:13:46 -07:00
David Aurelio 970f9335a9 allow `rn.cli-config.js` w/o `getTransformModulePath`
Reviewed By: bestander

Differential Revision: D3509026

fbshipit-source-id: d7db3de13ecc92f6ddfdcec3029c78915e1e66c0
2016-07-01 06:58:37 -07:00
Siqi Liu dc3fce06ea Add Copy and Dismiss Button in RN Android Red Box
Summary:
Add "Copy" and "Dismiss" button when the RN Android redbox is shown, consistent with that in RN iOS.
  - "Copy" button copies all the messages shown in the redbox to the host system clipboard, the solution is posting redbox messages to packager and the the packager copies the messages onto the host clipboard.
  - "Dismiss" button always exits the redbox dialog.
  - Add shortcut as "Dismiss (ESC)" and "Reload (R, R).

Notice: Copy button is only supported on Mac OS by now (warning in packager on other platforms), because it's not easy for us to test on Windows or Linux. Will put the codes for other platforms on Github issues, hoping anyone could help test and add this feature, then send us a pull request.

Redbox Dialog in RN Android before:
{F61310489}
Redbox Dialog in RN Android now:
{F61659189}

Follow-up:
- We can adjust the button styles in redboxes.
- We can consider to add shortcut for "Copy" button.

Reviewed By: foghina

Differential Revision: D3392155

fbshipit-source-id: fc5dc2186718cac8706fb3c17d336160e61e3f4e
2016-06-30 08:13:22 -07:00
Philipp von Weitershausen dd9b3e13a9 Allow rn-cli.config.js to specify the default transformer
Summary:
This will allow consumers to supply their own transformer to all `react-native` cli commands by simply implementing `rn-cli.config.js` and overriding `getTransformModulePath()`. That way they don't have to fork various parts of the iOS and Android build system that React Native already provides just to add a `--transformer` command line argument.

**Test plan:** Applied this patch to the React Native version in my app, implemented `getTransformModulePath()` in my `rn-cli.config.js`, and verified that my custom transformer is invoked.
Closes https://github.com/facebook/react-native/pull/7961

Differential Revision: D3404201

Pulled By: foghina

fbshipit-source-id: c7eaa85de84d485d06d23a2ffea899821b2cf71c
2016-06-22 08:13:26 -07:00
Patricio Beltran d1690a8f9e Support vscode as a React Editor
Summary:
When opening a text editor from react native there are a list of editors being supported. This PR adds `VSCode` to that.

As a difference with the current supported editors, `VSCode` has a notion of `workspace` (a directory that contains all of the project's files). The `workspace` can be passed to `VSCode` as a parameter so that if the workspace is already open we don't get new instances of `VSCode` every time a new file is open. The `workspace` is gotten by comparing the file location with the different `project roots`.

This code relies on `VSCode`'s `code` command, which it's documentation can be found at: https://code.visualstudio.com/Docs/editor/codebasics#_launching-from-the-command-line
Closes https://github.com/facebook/react-native/pull/7757

Differential Revision: D3463761

fbshipit-source-id: ee9ec999747ad6d16d95ec8317f551f3535286c9
2016-06-21 11:09:24 -07:00
Philipp von Weitershausen 588f01e998 Packager: accept relative --transformer paths everywhere.
Summary:
`react-native start` already ensures that the `--transformer` path is understood to be relative to CWD, not to the module that ends up importing that file. `react-native bundle` and `react-native dependencies` didn't up until this point.

**Test plan:** Ensured that `react-native bundle ... --transformer ./relative/path` works with this patch applied.
Closes https://github.com/facebook/react-native/pull/7857

Differential Revision: D3393777

fbshipit-source-id: 303a226fae9c8087c3dd3b2e8d004462ca66665e
2016-06-06 17:58:25 -07:00