Commit Graph

342 Commits

Author SHA1 Message Date
Tadeu Zagallo ad622f20f2 Fix wrong source map test
Reviewed By: @javache
2015-10-05 11:15:20 -07:00
Martín Bigio 9a22b1e78b Introduce internal `server` command
Reviewed By: @frantic

Differential Revision: D2449459
2015-10-05 09:21:34 -07:00
Martín Bigio 7ad418a396 Move fbobjc bundle command to cli
Reviewed By: @frantic

Differential Revision: D2457072
2015-10-05 09:21:27 -07:00
Tadeu Zagallo 753cc7683c Fix minified source maps
Summary: @​public

The source maps generated by uglify are already stringified, and therefore were
being stringified twice.

Reviewed By: @martinbigio

Differential Revision: D2498242
2015-10-05 08:48:25 -07:00
Amjad Masad 8356b609a5 Use different cache keys for Package objects (fixes #2949)
Summary: @​public

Dead-lock trying to read package.json because it's both a "module" and a "package". in `Module.getName` it uses the cache key "name" and tries to call `Package.getName` which uses the same cache key and we end up returning the same promise that we're trying to resolve resulting in a dead-lock.

This changes the cache keys for the packages that adds a prefix "package-".

Reviewed By: @vjeux

Differential Revision: D2506979
2015-10-04 12:37:25 -07:00
James Ide ac069aaf12 Update the packager's version check message for Node 4.0
Summary: Users should use Node 4.0 instead of io.js. This isn't a hard requirement since io.js still works but it's simpler if everyone is on the latest version.
Closes https://github.com/facebook/react-native/pull/2547

Reviewed By: @​svcscm

Differential Revision: D2506388

Pulled By: @vjeux
2015-10-03 11:49:21 -07:00
Tadeu Zagallo d447edc5ed Fix profiler setup
Summary: @​public

Update packager entry and profiler pre-built dylib +
Update makefile to make it easier to use different versions of Xcode
and shortcircuit when using the wrong version.

Reviewed By: @jspahrsummers

Differential Revision: D2498157
2015-10-01 15:05:23 -07:00
shlomiatar 535ee40818 Fix DependencyResolver to support ES6 multiline imports
Summary: *This is a PR to fix #1939 (DependencyResolver fails to handle ES6 modules import statements with new lines)*

**This PR includes:**
- A fix to the problematic regular expression
- Updated tests that support the new line style.

**Summary:**
We found out that while the packager does its module wrapping thing for lines like this:
```js
import theDefault, { named1, named2 } from 'src/mylib';
```
It fails to do the same for multi line imports:
```js
import theDefault, {
  named1,
  named2
} from 'src/mylib';
```
We've tracked done the issue to a [faulty regular expression in replacePatterns.js](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/DependencyResolver/replacePatterns.js#L12)

You can see various import statements with the problematic regular expression [here](http://regexr.com/3bc8m)

We've figure out a better regular expression (you can play around with it [here](http://regexr.com/3bd3s))Closes https://github.com/facebook/react-native/pull/1940

Reviewed By: @​svcscm

Differential Revision: D2498519

Pulled By: @vjeux
2015-10-01 12:17:21 -07:00
Martin Konicek 8cc6145979 Fix packager docs 2015-10-01 20:10:13 +01:00
Martin Konicek 52d504258b Mention debug.js in packager docs 2015-10-01 19:59:41 +01:00
Martin Konicek ff0f054c78 Another note about verbose output for RN packager 2015-10-01 19:53:05 +01:00
Martin Konicek ee0b19a528 Add a note about verbose output for RN packager 2015-10-01 19:46:09 +01:00
Kyle Corbitt 9c4b476679 enable es6 module syntax
Summary: This is an updated copy of #1993, which was approved by @vjeux but hasn't been rebased. It whitelists the es6 module syntax and updates the JS Environment docs to match. cc @ide @​hkjorgensenCloses https://github.com/facebook/react-native/pull/3175

Reviewed By: @​svcscm

Differential Revision: D2498360

Pulled By: @vjeux
2015-10-01 10:57:23 -07:00
Amjad Masad 502d277ff2 Error on name collisions
Summary: @​public
This moves us from warnings on name collisions to errors. If the error happens in initialization it will fatal out.

However, if the error happens while working (after initialization) then I did my best to make it recoverable. The rational behind this is that if you're working and you're changing names, you may introduce a duplication while moving things around. It will suck if you have to restart the server every time you do that.

Reviewed By: @frantic

Differential Revision: D2493098
2015-09-30 21:02:50 -07:00
Amjad Masad 0ad05043f5 Fix more name collisions
Summary: @​public
Add more duplicate files to the blacklist.

Reviewed By: @vjeux

Differential Revision: D2493066
2015-09-29 22:01:21 -07:00
Amjad Masad 9211b9b3cf Introduce `getOrderedDependencyPaths` that gets all concrete dependecy paths
Summary: @​public
Since we added packager-managed assets -- internally we still think of asset dependency as a single "module". In reality there are multiple files that represent this module. This becomes important with the `getDependencies` API which is used by Buck to inform it on what to rebuild. Since `getDependencies` deals with modules, and is more of an internal API, I've introduced a new one and would go on to deprecate this.

Reviewed By: @frantic

Differential Revision: D2487207
2015-09-29 18:34:21 -07:00
Amjad Masad 42b5cd59e4 Fix debug namespaces
Summary: @​public
Have a top-level debug namespace: `ReactNativePackager`
And add a couple of debugs in the transformer. This is ground work for adding a verbose option.

Reviewed By: @DmitrySoshnikov

Differential Revision: D2489960
2015-09-29 16:10:22 -07:00
Amjad Masad 256fa18ab2 remove randomness
Reviewed By: @javache

Differential Revision: D2490001
2015-09-29 12:44:22 -07:00
Amjad Masad ca007aabb4 Pass in the platform options when loading dependencies
Reviewed By: @jingc

Differential Revision: D2488262
2015-09-29 09:22:00 -07:00
Pieter De Baets e885628245 Don't call originalConsole methods when they don't exist
Reviewed By: @vjeux

Differential Revision: D2485562
2015-09-29 09:21:48 -07:00
yiminghe 4978855d72 support es6.constants by default. Fixes #2932
Summary: In javascriptcore(ios9), this code will run as expected(output 0 1):

```js
for(let i=0; i<2; i++) {
  const data = i;
  console.log(data);
}
```

But when debug in chrome, the above code will fail without `use strict` prologue (if you add prologue, rn will fail with red screen `Const declarations are not supported in strict mode`): https://code.google.com/p/v8/issues/detail?id=4432.

So it's better to transpile contant by default.

Closes https://github.com/facebook/react-native/pull/2955

Reviewed By: @​svcscm

Differential Revision: D2483398

Pulled By: @vjeux
2015-09-26 15:50:24 -07:00
Amjad Masad fa0da5682b Fix haste resolution (and better warnings)
Summary: @​public

Fix the haste resolution algorithm. Changed the map data structure from a list of modules, to a list of modules grouped by platform.
This considerably simplifies the "getModule" method and makes it easy to properly warn about colliding module names.
This also fixes a bug where we used to include `.web` files when we shouldn't (see task).

Reviewed By: @vjeux

Differential Revision: D2482969
2015-09-25 20:35:45 -07:00
Christopher Chedeau 76846f7e33 Remove all the duplicate module warnings
Summary: @​public

@amasad added a warning when there are two @​providesModule with the same name. This removes all those warnings by blacklisting the internal version of those files. Once we get of the big react-tools/ hack, we'll be able to remove all those :)

Reviewed By: @amasad

Differential Revision: D2482521
2015-09-25 19:24:24 -07:00
Justin Spahr-Summers 1487ebfe01 Revert packager randomization revert 2015-09-25 10:24:06 -07:00
Justin Spahr-Summers e2fdd59784 Revert packager module randomization 2015-09-25 07:41:25 -07:00
Amjad Masad 9293e54085 Warn and randomize colliding name selection
Summary: @​public

The issue of colliding haste modules have came up many times and have wasted countless engineering hours. This will start warning about it and will also start selecting modules at random so that people don't depend on undefined behavior.

Additionally, this surfaced an issue where with assets we may fatally throw if the directory doesn't exist. This is fixed by checking the existence of the directory before trying to match files in it.

Reviewed By: @jingc

Differential Revision: D2478480
2015-09-25 00:19:27 -07:00
Martin Bigio bf88e46ebb Print to console instead of debug uncaught exceptions
Reviewed By: @jingc

Differential Revision: D2478099
2015-09-24 15:57:26 -07:00
Martin Bigio eee11eaeed Log server state when client is unexpetedly closed
Reviewed By: @javache

Differential Revision: D2473036
2015-09-24 08:20:20 -07:00
Jan Kassens 974ec059e8 Fix for displayName transform
Summary: The `react.displayName` transform was added in 93b9329b75.

That diff missed to update the `.babelrc` where the comment says it should stay
in sync (I'm not sure where it's used though). I added a comment in the other
direction so this can be prevented in the future.

I also updated the `cacheVersion` so we actually transform the code again to add
the missing displayName properties to unchanged components.
Closes https://github.com/facebook/react-native/pull/2905

Reviewed By: @vjeux

Differential Revision: D2473447

Pulled By: @kassens
2015-09-24 08:20:02 -07:00
oveddan 8db35d492b Have the chrome debugger run javascript within a web worker, to remove the global document.
Summary: To make the chrome debugger environment consisten with the JSC executer environment,
where there is no `window.document`, make the chrome debugger run the javascript inside a web worker.

This fixes #1473
Closes https://github.com/facebook/react-native/pull/1632

Reviewed By: @martinbigio

Differential Revision: D2471710

Pulled By: @vjeux
2015-09-24 08:19:55 -07:00
Charlie Cheever dc7681e946 Also call the original `console` methods if they exist
Summary: Ex. When `console.log` or similar is called, this will call
the original method, which can be quite useful.

For example, under iOS, this will log to the Safari console debugger,
which has an expandable UI for inspecting objects, etc., and is also
just useful if you are using that as a REPL.

I don't believe this incurs a meaningful performance penalty unless
the console is open, but it would be easy to stick behind a flag
if that is a problem.
Closes https://github.com/facebook/react-native/pull/2486

Reviewed By: @​svcscm

Differential Revision: D2472470

Pulled By: @vjeux
2015-09-23 19:29:24 -07:00
Thomas Aylott 30e9bf6077 TextMate support for launchEditor
Reviewed By: @frantic

Differential Revision: D2467263
2015-09-23 19:28:44 -07:00
Martin Bigio 407247fe1e Don't swallow client errors
Reviewed By: @​swarr

Differential Revision: D2472285
2015-09-23 12:43:23 -07:00
Tadeu Zagallo 1ab650f958 Remove use of const from packager and add systrace internally
Reviewed By: @martinbigio

Differential Revision: D2471270
2015-09-23 10:56:31 -07:00
Amjad Masad 45ed000d4b Remove server error listener so that it throws
Summary: @​public
We swallow errors like it's nobody's business :(
Having an error handler that `reject`s after the promise has been resolved is a no-op. In node, if there is no `error` event handler then the error would throw.

So after we start listening and we want to resolve the promise, we remove the error listener so that we make sure errors actually throw.

Finally, I made the `uncaughtError` handler log `error.stack` so we can get an idea of what's going on.

Reviewed By: @martinbigio

Differential Revision: D2468472
2015-09-22 15:48:29 -07:00
Amjad Masad 30cca276fa Return concrete file paths to the client
Reviewed By: @martinbigio

Differential Revision: D2465182
2015-09-22 15:45:25 -07:00
Martín Bigio c4cb95f2d7 Add logging information when client's socket gets closed unexpetedly
Reviewed By: @amasad

Differential Revision: D2468293
2015-09-22 15:21:35 -07:00
Amjad Masad f39e3fe113 Simplify over-engineered Activity module
Summary: @​public
I've noticed that the logs can be sometimes misleading, as when an Activity ends it doesn't log immediatly. A sync `console.log` would log before it although the Acitivity should've finished before.

Turns out we wait before writing out the logs to the console. I don't see any reason for this. Looking at the `Activity` module it's over-engineered. This diff makes logging sync and simplfies the module.

Reviewed By: @martinbigio

Differential Revision: D2467922
2015-09-22 14:25:37 -07:00
Amjad Masad 7806c0875b Log exit code
Reviewed By: @martinbigio

Differential Revision: D2467457
2015-09-22 12:40:25 -07:00
Martín Bigio 833ca598bc Introduce react native CLI
Reviewed By: @frantic

Differential Revision: D2430522
2015-09-22 09:02:32 -07:00
Martin Bigio daba14264c Remove `node_modules` dir early fail check
Reviewed By: @vjeux

Differential Revision: D2464127
2015-09-21 17:51:35 -07:00
Christoph Pojer d088750163 Fix tests + enable inline requires on react-native
Reviewed By: @sahrens, @vjeux

Differential Revision: D2456607
2015-09-21 14:39:44 -07:00
Martin Bigio 8f5b2ccbe0 Log uncaught exceptions on the socket server
Reviewed By: @frantic

Differential Revision: D2462114
2015-09-21 12:08:29 -07:00
Pieter De Baets d94ed42e1c Enable Jest tests
Reviewed By: @amasad

Differential Revision: D2422290
2015-09-20 16:48:35 -07:00
Christoph Pojer fa01b2e4cb Codemod tests to use top-level-requires
Reviewed By: @DmitrySoshnikov

Differential Revision: D2456250
2015-09-19 15:41:29 -07:00
Christoph Pojer 3fca7f4d7b inline requires + preprocessor updates
Reviewed By: @DmitrySoshnikov

Differential Revision: D2455903
2015-09-19 15:22:33 -07:00
DengYun 450cd5c406 Generate module name seperated by '/' on Windows.
Summary: I think packager on different platform should generate same output if possible. So packager should replace '\\' in module name with '/' on Windows.

Closes https://github.com/facebook/react-native/pull/2813

Reviewed By: @​svcscm

Differential Revision: D2458634

Pulled By: @martinbigio
2015-09-18 15:15:28 -07:00
mqli f5409c1a51 Fixing the packager infinite loop on Windows
Summary: The issue here https://github.com/facebook/react-native/issues/2787

The root path '/' dosn't match windows root path
Closes https://github.com/facebook/react-native/pull/2789

Reviewed By: @​svcscm

Differential Revision: D2452718

Pulled By: @martinbigio
2015-09-18 06:05:22 -07:00
facebook-github-bot-6 0d09f22dbf Get back 100% in sync with fb codebase 2015-09-16 10:30:53 -07:00
Martín Bigio 41850a962f defeat race condition when replying to client
Summary: @​public

The server dies after 30 seconds if it has no jobs on it's queue. The problem is that the jobs counter gets decreased before returning the bytes to the client. As a consequence, it's possible that the server dies while it's returning the bytes to the client, or just after it finished returning the bytes to the client.

To avoid both issues lets move the counter decrease a few lines below and bump the timer to make sure we have time to fully write the bytes on the socket and let the client close the connection before the server dies.

Reviewed By: @vjeux

Differential Revision: D2445264
2015-09-15 16:25:25 -07:00