Граф коммитов

785 Коммитов

Автор SHA1 Сообщение Дата
benjaminhughes c83fc07973 Making babel to use the babelrc file if we find it
Summary:
This PR tells babel where the babelrc file is if it has been found in the project root. I know you guys are relying on babel to find it when you tell babel the filename and sourceFilename, this works fine in normal js/node projects, here is an example where this will not work.

We have a big repo that can contain a few react-native / js projects. Our build system is similar to BUCK and we keep our third party dependencies in a separate folder (having a global package.json at the project route is not feasible as everyone will have to install every apps dependencies even when they don't need them), the structure looks a bit like this:

`third_party/js/.` packages from node_modules
`common/js/` common code used by numerous apps, common components, services etc.
`my_app/native` the app

What's happening is something from `my_app/native` (where the .babelrc file is) is requiring something from `common/js` which is then requiring something from `third_party/js` and so babel has no idea what .babelrc file to use and
Closes https://github.com/facebook/react-native/pull/8131

Differential Revision: D4167844

Pulled By: hramos

fbshipit-source-id: 3569981e26ff8f8c632d8ae365a1f43a3483b13b
2016-11-11 11:28:48 -08:00
Jean Lauliac 00b688b0d3 packager ModuleTransport.js: @flow
Reviewed By: cpojer

Differential Revision: D4166900

fbshipit-source-id: 0b8c1730f00f9a9d4a17586967edae8cbd4f296b
2016-11-11 09:43:48 -08:00
Jean Lauliac bc9bbb5533 packager worker: enable possibility to add Flow annotations
Reviewed By: matryoshcow

Differential Revision: D4160456

fbshipit-source-id: bbc2420126d8e8b725c0b7b359b35f09dfe8c8d6
2016-11-11 05:29:30 -08:00
Jean Lauliac b6b9d37225 packager: fix lint
Reviewed By: matryoshcow

Differential Revision: D4160163

fbshipit-source-id: 8eeb7dd83c0d80c1c62b760039615ce97782bd3e
2016-11-11 05:29:30 -08:00
Jean Lauliac 7a073d3b13 packager TransformCache.js: use directory specific to project
Reviewed By: davidaurelio

Differential Revision: D4159761

fbshipit-source-id: 1f4b1bbcf4c4fbb834a672e38cb2cf55f425b28b
2016-11-11 05:13:42 -08:00
Jean Lauliac 4785a60115 packager worker/index.js: do not write to cache directly
Reviewed By: davidaurelio

Differential Revision: D4159970

fbshipit-source-id: 133ce5797e94a39fe60cbb9983edd561ce7d818e
2016-11-10 09:13:54 -08:00
Jean Lauliac b2653ed36c packager Module.js: make transformCode function required
Reviewed By: davidaurelio

Differential Revision: D4147343

fbshipit-source-id: 4c00a5905e698a9d257a632f3b02b63587b4644a
2016-11-10 09:13:54 -08:00
Jean Lauliac f40aafac8a packager Module.js: remove extractRequires
Reviewed By: davidaurelio

Differential Revision: D4147275

fbshipit-source-id: 7c1d7d16f6b8164d7031963618aeab2857f5d497
2016-11-10 09:13:54 -08:00
David Aurelio 08950700fe Various cleanups around polyfill transformation
Summary:
- Put `isPolyfill` parameter into `options` object
- Save information whether a file is a polyfill
- Sort properties alphabetically
- Rename parameters

Reviewed By: cpojer

Differential Revision: D4153203

fbshipit-source-id: 67da97546a15c899112b74da6072acdea18d10e8
2016-11-10 08:13:57 -08:00
Christoph Pojer 2382ffe9bc Update Jest + jest-haste-map
Reviewed By: matryoshcow

Differential Revision: D4149694

fbshipit-source-id: 4f8378c419ddc7978e05dfcf2112e833775391be
2016-11-10 06:28:38 -08:00
Jean Lauliac edf975d903 packager Module.js: fix concurrency issues
Reviewed By: matryoshcow

Differential Revision: D4159743

fbshipit-source-id: 41515f2a29344b648c4c52100056d2054e3edff7
2016-11-10 05:58:41 -08:00
Wojciech Ogrodowczyk f25e422417 Disallow object assign explanation
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

Provides better documentation for a confusing (and common) error message. Solves https://github.com/facebook/react-native/issues/3634

> **Test plan (required)**

This is just an error message shown in dev environment. I ran the tests and they pass.
Closes https://github.com/facebook/react-native/pull/10472

Differential Revision: D4053818

Pulled By: hramos

fbshipit-source-id: e80dc6ab787a8d8cabbcb442c438c07269401ff7
2016-11-10 00:28:31 -08:00
Tim Yung ad95aea51d RN: Fix Broken Symbolication
Reviewed By: fkgozali

Differential Revision: D4159009

fbshipit-source-id: 6f91428a769db820c49d7300138a06350f52e63e
2016-11-09 22:58:45 -08:00
Ovidiu Viorel Iepure 8e803643ec Fix lint warnings in JSTransformer
Summary: Fix lint warnings throughout JSTransformer.

Reviewed By: bestander

Differential Revision: D4148161

fbshipit-source-id: ac73a9e3919b1c66fef0e447083b44039900f963
2016-11-09 09:31:12 -08:00
David Aurelio ef31c68911 Add support for wrapping polyfills
Summary: This adds support to wrap polyfills differently from regular modules (`(function(global){ ... }(this))` instead of `__d(function...)`.

Reviewed By: cpojer

Differential Revision: D4147031

fbshipit-source-id: c19e968c1498cac653ab2649e3089d8c29571926
2016-11-09 07:43:30 -08:00
Ovidiu Viorel Iepure 90a696597c Fix lint warnings in Bundler index
Summary: Fix lint warnings starting at Bundler index

Reviewed By: davidaurelio

Differential Revision: D4147587

fbshipit-source-id: 6d86bdd4d43a08661498c2bf8b6b21c8c3573d88
2016-11-08 12:28:47 -08:00
Ovidiu Viorel Iepure b12db7645e Use native Promises
Summary: Use native Promises in React Native Packager. Remove all the non-standard `Promise.done()` calls throughout the codebase & replace `Promise.denodeify` with the stand-alone `denodeify` module.

Reviewed By: davidaurelio

Differential Revision: D4146965

fbshipit-source-id: 1730531c914863ac3c52626801d9f91c28eed717
2016-11-08 12:28:47 -08:00
Ovidiu Viorel Iepure 68f085a2b6 Fix lint warning in Logger
Summary: Fix a lint warning in the Logger.

Reviewed By: davidaurelio

Differential Revision: D4147924

fbshipit-source-id: cd874ebd5f67d85e54c7dc3d9435df9ad672e9fe
2016-11-08 12:13:43 -08:00
Ovidiu Viorel Iepure 934de2d94a Fix lint warnings in Server implementation
Reviewed By: davidaurelio

Differential Revision: D4148018

fbshipit-source-id: 051cba96b2c4ac74709d45c2b388632122009c84
2016-11-08 11:58:50 -08:00
David Aurelio 4301cfc066 improve options parser
Reviewed By: jeanlauliac

Differential Revision: D4146832

fbshipit-source-id: a54284ccc3fa4d6e1628886b748b21b9b9af2cff
2016-11-08 10:13:40 -08:00
Jean Lauliac 07295e3c08 packager ResolutionResponse: @flow
Reviewed By: davidaurelio

Differential Revision: D4146739

fbshipit-source-id: 0b8e65dfaa2f28c4498fb17b8d980da9271fe8d6
2016-11-08 04:58:44 -08:00
Jean Lauliac 5415f9b916 declareOpts: @flow
Reviewed By: cpojer

Differential Revision: D4146711

fbshipit-source-id: edd360b3dd8444c7ec5be5c69db97e1e0906a730
2016-11-08 04:58:44 -08:00
Jean Lauliac b3ee9b68d4 react-packager/src/Bundler/index.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4139968

fbshipit-source-id: dc77ea6f0971b5d378883d89290a773205f97c18
2016-11-08 04:58:44 -08:00
Jean Lauliac ea016db37b JSTransformer/worker: cache transformed code as separate files
Reviewed By: davidaurelio, cpojer

Differential Revision: D4051477

fbshipit-source-id: 0179ce18dd20c00083ae05b5cf5f925659e7c056
2016-11-08 03:43:37 -08:00
Andres Suarez ba8bbcbe2f Remove prepack bundle functionality
Reviewed By: davidaurelio

Differential Revision: D4138495

fbshipit-source-id: 52793fc1a8ef8b2fc461156607c360f34c4cb362
2016-11-07 03:43:37 -08:00
Jean Lauliac b54fd91f77 RM node-haste DependencyGraph: @flow
Summary: In addition to adding flow in that file, I also had to fix `Module.js` and others to make everything compatible together.

Reviewed By: davidaurelio

Differential Revision: D4118829

fbshipit-source-id: 4f6dbc515741c38817cc4c9757e981fabb03915a
2016-11-04 10:43:39 -07:00
David Aurelio 27af120ed4 Prepare `__d` fn for Buck integration
Summary:
The new Packager/Buck integration passes module factory functions as first argument, so that the complete call can be amended at the end safely at a later point in time.
The call expression as a whole is covered perfectly by the created source map. Appending to that code later won’t break mappings.

`__d` now also accepts an additional `dependencyMap` parameter, which so far is only used by the new Packager/Buck integration. It enables module-local dependency IDs, thus eliminating the need to insert `correct` module IDs when building a bundle. Advantages are that source maps are no longer affected, and that builds can be quicker.

Reviewed By: cpojer

Differential Revision: D4124333

fbshipit-source-id: 12eba15d0b9d8c6624280a2ba1e7e4bc654bc83d
2016-11-04 05:13:44 -07:00
Jing Chen 24418677ef Silently fail for requires on Android again until we can fix loading image assets from both repos
Reviewed By: blairvanderhoof

Differential Revision: D4128218

fbshipit-source-id: d743cdb7a73efc2f46c42217a49c6094fcd3808a
2016-11-04 00:58:48 -07:00
mike qin 0221b27489 increase MAX_WAIT_TIME
Summary:
increase the `MAX_WAIT_TIME` in FileWatcher since live reloading doesn't work for a lot of users on windows when developing android. There may be a better timeout than arbitrarily tripling it, I'm sure the original developer would be able to pick out a good one, but many of us have used this change to finally be able to use RN here on windows.

fixes https://github.com/facebook/react-native/issues/8784 https://github.com/facebook/react-native/issues/7257
Closes https://github.com/facebook/react-native/pull/10690

Differential Revision: D4126110

Pulled By: mkonicek

fbshipit-source-id: 9b6f188fe9d39bcdcc2b38392dfc644a518296b2
2016-11-03 18:13:41 -07:00
David Aurelio 0e078d16ae Make sure that write streams are closed
Reviewed By: jeanlauliac

Differential Revision: D4117716

fbshipit-source-id: c12f07c6a0e016ac14543878491a8b4160099e21
2016-11-03 13:29:10 -07:00
Ovidiu Viorel Iepure 2ac6c754c1 File transform events
Summary: Correctly generate log entries for file transforms and ping telemetry using the new Logger API.

Reviewed By: bestander, cpojer

Differential Revision: D4081325

fbshipit-source-id: 7d50d54eb673a0276512db6ad5ff21c344495612
2016-11-03 07:44:10 -07:00
Ovidiu Viorel Iepure 14ada406b7 Instrumentation API
Reviewed By: cpojer

Differential Revision: D4074413

fbshipit-source-id: fd2dff17168f426680fd9dc8456f8b1ae3f55318
2016-11-03 07:44:10 -07:00
David Aurelio c0c80d7ace Add flow to require implementation, always warn when modules are accepted by name
Reviewed By: matryoshcow

Differential Revision: D4124228

fbshipit-source-id: 461087caf4add07db376bb71ae5ba42bf3536cd3
2016-11-03 05:58:30 -07:00
Jean Lauliac ea536dd4bf RM Polyfill.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4118256

fbshipit-source-id: b9d906cd94c0548c28a62fa636c6da7bcf894ba9
2016-11-03 04:58:46 -07:00
Jean Lauliac 35614db349 RM fastfs.js: @flow
Reviewed By: cpojer

Differential Revision: D4118175

fbshipit-source-id: ad9d1f98bcde0c1be17d36c74c3662e6e55165f8
2016-11-03 04:58:46 -07:00
Jean Lauliac 7f56907d8f RN Package.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4118006

fbshipit-source-id: ad8fdcb67351a9e53af0a7acbf16f269daf31f50
2016-11-02 13:43:43 -07:00
Jean Lauliac 23f0238805 RN ModuleCache.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4117759

fbshipit-source-id: 158f6e50cb9211f87acce17047ed3e959e6c271f
2016-11-02 13:43:43 -07:00
Alexander Blom 27f504e9e3 Add Console agent
Summary: Adds the Console agent which we hook from our console polyfill. It captures the stack and strips the frames of the polyfill.

Reviewed By: davidaurelio

Differential Revision: D4021502

fbshipit-source-id: 49cb700a139270485b7595e85e52d50c9a620db6
2016-11-02 12:29:15 -07:00
Pieter De Baets 44025f4931 Stop silently failing for requires on Android
Reviewed By: bestander

Differential Revision: D4117128

fbshipit-source-id: a11996a322d38e884aad2f095342c1ea723b0d89
2016-11-02 08:58:42 -07:00
David Aurelio 29888b540b buck worker tool: catch errors thrown from commands, and respond with errors.
Reviewed By: cpojer

Differential Revision: D4057884

fbshipit-source-id: acfe0cc57b541a534dd640380c69f591c1fb83c6
2016-11-01 05:58:43 -07:00
Jean Lauliac 66406cc6f9 extract-dependencies.js: fix out-of-date comment
Summary: We actually use the AST, not regexes. Fix comment.

Reviewed By: davidaurelio

Differential Revision: D4104797

fbshipit-source-id: e37d168bd541d9d222667d0d168aa6b6099c1275
2016-10-31 11:43:37 -07:00
Jean Lauliac bd867c1105 Module.js: add @flow
Reviewed By: cpojer

Differential Revision: D4095611

fbshipit-source-id: d87509153eab3d8dbcd65b8c6c6ffb3e5746685f
2016-10-31 04:28:29 -07:00
Pooya Parsa cd97128ba3 os.tmpDir() is deprecated
Summary:
According to [5e5ec2cd1e](https://github.com/nodejs/node/commit/5e5ec2cd1e) os.tmpDir() is now deprecated in node.js 7 and `os.tmpdir()` is preferred :)

Current status:
Bundler shows annoying warning every time it runs :)
Closes https://github.com/facebook/react-native/pull/10620

Differential Revision: D4101498

fbshipit-source-id: 0de8cc30f684f1f22191c64fa2c7ce73c5abf9ea
2016-10-29 13:59:01 -07:00
Christine Abernathy 9d86a1295e Fix Xcode build error on non-standard setup
Summary:
This change is related to https://github.com/facebook/react-native/issues/9677 that can happen when trying to get an Xcode release build, which in turn calls  `react-native-xcode.sh` and if one has a non-standard file setup, ex:

```
ios/
 |_ (iOS related code)
js/
 |
 |_ index.ios.js
     node_modules
     package.json
     (other React Native JS code)
```

The error output in this case is:

```
+ DEST=/Users/caabernathy/Library/Developer/Xcode/DerivedData/Mixer-ffglwypovddbciahtlducaeuqxqa/Build/Products/Release-iphonesimulator/Mixer.app
+ [[ Release = \D\e\b\u\g ]]
+ BUNDLE_FILE=/Users/caabernathy/Library/Developer/Xcode/DerivedData/Mixer-ffglwypovddbciahtlducaeuqxqa/Build/Products/Release-iphonesimulator/Mixer.app/main.jsbundle
+ node /Users/caabernathy/Facebook/OpenSource/Apps/RWMixer/Sample/Build/Mixer-Challenge/js/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/caabernathy/Library/Developer/X
Closes https://github.com/facebook/react-native/pull/10262

Differential Revision: D4100083

Pulled By: lacker

fbshipit-source-id: 476f38990d09d5c26c22df77630b1a71b42959e2
2016-10-28 18:44:36 -07:00
Jean Lauliac 6a774f0af1 node-haste/Cache: @flow
Reviewed By: davidaurelio

Differential Revision: D4043681

fbshipit-source-id: 8c82b394f4df9bb0d580f405ce472c69224485f5
2016-10-24 10:29:06 -07:00
Ovidiu Viorel Iepure b68790cd57 Activity session
Summary: Add session ID to be appended to every event in the current Packager session.

Reviewed By: davidaurelio

Differential Revision: D4029580

fbshipit-source-id: 8c34c1f44ee63f845d15f8f89e491ab5c936fb21
2016-10-24 05:43:43 -07: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
David Aurelio 254b1ec6b3 Add support for relative paths to ResolutionRequest
Summary:
This makes ResolutionRequest stop calling `dirname` when arriving at `"."`, not only at `parse(path).root`.
Needed for Buck integration, as we are using relative paths there

Reviewed By: cpojer

Differential Revision: D4058723

fbshipit-source-id: d1856043193cfad3f750577ba0f63f03f8effe7a
2016-10-22 06:13:42 -07:00
Christoph Pojer fb4f34bc9b Remove fastpath
Summary: I originally added fastpath to node-haste to speed up `path` operations by an order of magnitude. Now we are exclusively using Node 6 at FB so we don't need to ship this thing any more.

Reviewed By: bestander

Differential Revision: D4029092

fbshipit-source-id: 064cf67f4f79ce4f2774fb4e430d22eef4a95434
2016-10-20 00:14:03 -07:00
David Aurelio 0c7bc9801c Create integration types and code to use module resolution logic from node-haste
Summary:
This creates flow types for the module resolution code in node-haste, and implementations of types used by that code.

The idea is to use that code until we can replace it with something leaner, and provide objects that don’t touch the file system. These objects will be initialized with the static data provided by ModuleGraph/worker.

Reviewed By: cpojer

Differential Revision: D4037372

fbshipit-source-id: 2698dbb630f4122fc1d839d06e414d0963bd6ff2
2016-10-19 06:58:39 -07:00