Commit Graph

580 Commits

Author SHA1 Message Date
Rafael Oleza 5ee6de217d Disable using babel-generated sourcemaps from the metro bundler server
Reviewed By: jeanlauliac

Differential Revision: D5785354

fbshipit-source-id: be1a5c114b12af356804ff3b4ed6c4263d66fa0c
2017-09-11 08:27:56 -07:00
Jean Lauliac 36b2f8d67f RN packager: wrap-worker-fn.js: syncify
Reviewed By: davidaurelio

Differential Revision: D5803796

fbshipit-source-id: d6b7d169a2c17864e8ce68d82df8e898d966e404
2017-09-11 07:41:44 -07:00
Jean Lauliac 69eb3430b6 RN packager: transform-module.js: syncify everything
Reviewed By: davidaurelio

Differential Revision: D5803768

fbshipit-source-id: 06c28e6c30fce347780d953312646a449d0026d9
2017-09-11 07:41:44 -07:00
Jean Lauliac 7ccbcc5ebc metro-bundler: fix Flow errors in OSS
Reviewed By: cpojer

Differential Revision: D5775151

fbshipit-source-id: 730ab160fdf5ea35f8047eb55a7e2844ba7a7c14
2017-09-08 06:39:36 -07:00
Rafael Oleza 286c5ccdd9 Bump metro-bundler to 0.16.0
Reviewed By: davidaurelio

Differential Revision: D5793558

fbshipit-source-id: c5d7f3029b889987613034150ba13a72b4850421
2017-09-08 06:23:47 -07:00
Jean Lauliac 890de8436f xplat/js: switch to new oncall javascript_foundation
Reviewed By: cpojer

Differential Revision: D5774897

fbshipit-source-id: 6b3246aeda9fe3bee89065ed2ac244282e496373
2017-09-08 03:39:34 -07:00
Rafael Oleza 177c4fb1ab Do not bundle deleted modules in HMR
Reviewed By: mjesun

Differential Revision: D5777831

fbshipit-source-id: dd3551194eca99097cea5a1944555cd8adff9f19
2017-09-07 10:21:19 -07:00
Marshall Roch 14428a67e5 @allow-large-files Flow v0.54.0
Reviewed By: leebyron

Differential Revision: D5773490

fbshipit-source-id: 2c54bb6326f23edbe9a969f3010f79da8189923e
2017-09-06 03:31:10 -07:00
Jean Lauliac a94654255b packager-worker-for-buck: include all entries point for getting extra configuration
Reviewed By: davidaurelio

Differential Revision: D5764794

fbshipit-source-id: a9bddd05a66c1d5a45f5dd4d04517dbe86ea5b76
2017-09-05 10:54:17 -07:00
Rafael Oleza 0265758e5e Create brand-new HMR server using the Delta Bundler
Reviewed By: mjesun

Differential Revision: D5765024

fbshipit-source-id: 3f51ab1564a93b8268e51c0a0a97ea3ef5bd6681
2017-09-05 07:21:06 -07:00
Rafael Oleza 387a55de40 Make the DeltaCalculator and the DeltaTransformer emit change events
Reviewed By: jeanlauliac

Differential Revision: D5765042

fbshipit-source-id: 5b45cc425b6afb4f8cead80ce967263936baa8c1
2017-09-05 07:21:06 -07:00
Rafael Oleza 8b6d69b645 Return the inverseDependencies from the Delta Bundler to support HMR
Reviewed By: jeanlauliac

Differential Revision: D5763905

fbshipit-source-id: 6b95c8dfded5fc30ec2e7a558ab25550d9a1c333
2017-09-05 07:21:06 -07:00
Miguel Jimenez Esun d4a93eb2fa Update Jest to v21
Reviewed By: cpojer

Differential Revision: D5765333

fbshipit-source-id: 94ea448c4380fdc68f42f84eb3963322ea18ec70
2017-09-05 05:25:02 -07:00
Rafael Oleza 1f90522a13 Upgrade metro-bunder to v0.15.0
Summary: Some breaking changes require a new release.

Reviewed By: cpojer

Differential Revision: D5766207

fbshipit-source-id: d0ebc5cb46fbd2ad167c0a3369d0f354346f61b9
2017-09-05 05:25:02 -07:00
Rafael Oleza e18d4e1b89 Enable delta bundler on metro-bundler behind a cli argument
Reviewed By: mjesun

Differential Revision: D5761110

fbshipit-source-id: 83127f63679caffbc4f335f52f6f5eda398e8c05
2017-09-04 13:53:55 -07:00
Rafael Oleza 7b17ca335d Add DeltaPatcher module to handle Delta bundles
Reviewed By: jeanlauliac

Differential Revision: D5761096

fbshipit-source-id: 8c8ef5fb720b08e3f4f097c5a76f793dc4f1c1da
2017-09-04 13:53:55 -07:00
Rafael Oleza 52fcaf4a10 Delta Bundler: Initial implementation of the Delta Bundler
Reviewed By: jeanlauliac

Differential Revision: D5760233

fbshipit-source-id: 5f829d48401889b1391719564119951a1cf3c792
2017-09-04 13:53:55 -07:00
Rafael Oleza 8c8cfb364f Expose some private methods from the Bundler and the DependencyGraph
Reviewed By: jeanlauliac

Differential Revision: D5755556

fbshipit-source-id: cff95e3464154883fd872bf8ab916276a1f09027
2017-09-04 13:53:55 -07:00
Rafael Oleza 70a0916dd2 Change signature of Resolver.wrapModule() to not depend on ResolutionResponse
Reviewed By: mjesun

Differential Revision: D5757102

fbshipit-source-id: 1cb514612ec431e48d669607c5332f26d19f53a0
2017-09-04 13:53:55 -07:00
Rafael Oleza ebb14a56c6 Add prependPolyfills option param to getDependencies()
Reviewed By: jeanlauliac

Differential Revision: D5755548

fbshipit-source-id: 599d3fb6d9acb34f5970ad83947daeb5f28f86d3
2017-09-04 13:53:55 -07:00
Rafael Oleza 9c251076cf Fix sourceMap flow annotations by making them nullable
Reviewed By: mjesun

Differential Revision: D5755671

fbshipit-source-id: 19be8475b1f1b54bc55b64a1de4b8a446e125c65
2017-09-04 13:53:55 -07:00
Miguel Jimenez Esun 2377f04f4a Always report filename
Reviewed By: cpojer

Differential Revision: D5764824

fbshipit-source-id: cb90e429176764d4a1043fd57bbfee223361a182
2017-09-04 13:53:55 -07:00
Jean Lauliac 6e415bcb2f metro-bunder: v0.14.0
Summary: Some breaking changes require a new release.

Reviewed By: cpojer

Differential Revision: D5763898

fbshipit-source-id: 0580c9b1256c2c019adc5fb2f771c54d7e7a0bf1
2017-09-04 04:42:16 -07:00
Rafael Oleza 717a8c7f61 Improve HMR performance by allowing to specify bundlingOptions to getShallowDependencies() method
Reviewed By: jeanlauliac

Differential Revision: D5745205

fbshipit-source-id: a69ac40bb676a809e3786681179e2b4bac392ce6
2017-09-01 08:51:22 -07:00
Jean Lauliac 8907de28ac metro-bundler: v0.13
Reviewed By: cpojer

Differential Revision: D5754623

fbshipit-source-id: b70bfa105e6752db5350b82433bd64e1ca45f33b
2017-09-01 07:36:11 -07:00
Jean Lauliac 1142f05d59 metro-bundler: v0.12
Reviewed By: cpojer

Differential Revision: D5745702

fbshipit-source-id: 6dc88811525e1595f58b23b7d0ebd5cc9f309785
2017-08-31 10:52:51 -07:00
Jean Lauliac 1c6a96f2b3 metro-bundler: ModuleGraph/output: @format
Reviewed By: cpojer

Differential Revision: D5745469

fbshipit-source-id: 7aa923736d6eb257f547a6d41b4329ce3406c805
2017-08-31 07:24:33 -07:00
Miguel Jimenez Esun 9254941133 Treat package.json's first
Reviewed By: fkgozali

Differential Revision: D5736600

fbshipit-source-id: f2947d4b1fb057ea33dd84e3c8cd878d5bfeda49
2017-08-30 12:08:48 -07:00
Rafael Oleza 909480887e Fix flow types of getShallowDependencies()
Reviewed By: mjesun

Differential Revision: D5735278

fbshipit-source-id: b9a2797a89a3893a5196ef8fe15d2ab8aa00e544
2017-08-30 08:20:38 -07:00
Rafael Oleza 21cc11c5ae Only include hmr transforms when in dev mode
Reviewed By: arcanis

Differential Revision: D5732348

fbshipit-source-id: cc70d3ee6531f1f8345d6a04827ca802382525d8
2017-08-30 03:54:59 -07:00
Miguel Jimenez Esun 84ae805e78 Make metro-bundler use a no-op transformer by default
Summary: When starting to use `metro-bundler` as a standalone server, I found quite complicated the fact that it needs a transformer by default. Moreover, the transformer is not passed as a reference to a JS object, but as a path to a required file. I removed the need to be required, and defaulted to a dummy, basic transform, that does nothing by default. This avoids having to create an extra file and linking to it (potentially needing to involve `path` and other extra modules).

Reviewed By: cpojer

Differential Revision: D5622906

fbshipit-source-id: 0c2b1bec86fa542b3c05de42c89d4b5bb4384b34
2017-08-29 09:42:50 -07:00
yeyuanfeng 3731fa7c3c TransformCaching: fix GC condition judgement error
Summary:
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

**Summary**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
I am sending this PR to fix an error in TransformCaching module. See this issue [TransformCaching module try to collect cache every time I build bundle #46](https://github.com/facebook/metro-bundler/issues/46).

**Test plan**

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->
```
/**
   * When restarting packager we want to avoid running the collection over
   * again, so we store the last collection time in a file and we check that
   * first.
   */
  _collectCacheIfOldSync() {
    const {_rootPath} = this;
    const cacheCollectionFilePath = path.join(_rootPath, 'last_collected');
    const lastCollected = Number.parseInt(
      tryReadFileSync(cacheCollectionFilePath) || '',
      10,
    );
    if (
      Number.isInteger(lastCollected) &&
      Date.now() - lastCollected < GARBAGE_COLLECTION_PERIOD
    ) {
      return;
    }
    const effectiveCacheDirPath = path.join(_rootPath, CACHE_SUB_DIR);
    mkdirp.sync(effectiveCacheDirPath);
    collectCacheSync(effectiveCacheDirPath);
    fs.writeFileSync(cacheCollectionFilePath, Date.now().toString());
  }
```
Steps:
1. Create a new react-native project.
2. Put your breakpoint at this sentence `collectCacheSync(effectiveCacheDirPath);`.
3. Bundle the project, program will break at `collectCacheSync(effectiveCacheDirPath);`
4. Resume the program, finish the first time bundle.
5. Bundle again, this time program won't break.
Closes https://github.com/facebook/metro-bundler/pull/48

Differential Revision: D5726161

Pulled By: jeanlauliac

fbshipit-source-id: 0865f1bf25d6eb36f067ac3dc7764df9fd5026dc
2017-08-29 08:27:24 -07:00
Rafael Oleza 50ef3138cf Metro HMR: Add file parameter to getShallowDependencies()
Reviewed By: jeanlauliac

Differential Revision: D5687991

fbshipit-source-id: c2db3986c6a5ec81ed1350ded92dfcf1b529c2bc
2017-08-24 08:20:34 -07:00
Rafael Oleza 679309987b Fix HMR when adding/renaming assets
Summary:
The HMR logic used to try to calculate the dependencies of every new added (or modified) file, including assets. This resulted in a TransformError.

This commit adds a check that stops the HMR bundling once it finds out that the updated file is an asset

Reviewed By: cpojer

Differential Revision: D5697391

fbshipit-source-id: faf7ccad76ac4922b70ed1c7ce8ce32b03c4e8ee
2017-08-24 07:40:35 -07:00
Miguel Jimenez Esun b2331471d5 Remove the timeout
Summary: We were not using the timeout at all, so we decided to remove it. Also, the current value is pretty high, so it should never fail unless there's something really bad.

Reviewed By: jeanlauliac

Differential Revision: D5640839

fbshipit-source-id: 3eaa567a6828902376fe5df9fe3f4e96b83a23bd
2017-08-23 07:50:36 -07:00
Jean Lauliac 87aa1cc166 worker-farm: add @format
Reviewed By: davidaurelio

Differential Revision: D5658177

fbshipit-source-id: 59565a57243c6f8ce0d9aceaad5dc542992cd45b
2017-08-21 04:50:46 -07:00
Jean Lauliac bf25e49665 metro-bundler: collect-dependencies: harden requirements for require()
Reviewed By: davidaurelio

Differential Revision: D5658522

fbshipit-source-id: 2970d62bcb18d57595c666d680407a23eccda77b
2017-08-21 04:35:59 -07:00
Jean Lauliac 6a0efc0853 metro-bundler: ModuleGraph worker: @format
Reviewed By: davidaurelio

Differential Revision: D5658384

fbshipit-source-id: 918017a117e5fb574b3f6801104b4db2708a0eff
2017-08-21 04:35:59 -07:00
Ben Nham 72455941ba add number of files changed to bundle response
Reviewed By: davidaurelio

Differential Revision: D5650181

fbshipit-source-id: 16c7842a79bec6cf4fb5bfeffc4bc8a835c7ce83
2017-08-21 04:06:22 -07:00
Andres Suarez 6d4b8e0c8d Upgrade to babylon@6.18.0
Reviewed By: davidaurelio

Differential Revision: D5652526

fbshipit-source-id: 4e1f217c924b9eee33e9f9eae447962617af7e22
2017-08-18 11:21:41 -07:00
Alex Dvornikov 5cd43a675b Default to "compact: false" in the code generate phase
Reviewed By: davidaurelio

Differential Revision: D5630578

fbshipit-source-id: 5049be735f41f1207b8ca329f4a78fc92f683c23
2017-08-18 05:05:43 -07:00
Jean Lauliac 936b8c31e7 metro-bundler: elaborate the global cache test a bit
Reviewed By: davidaurelio

Differential Revision: D5650882

fbshipit-source-id: b1f283f00e6e200f3b731126ed7a273fe782aeaa
2017-08-18 04:13:53 -07:00
Jean Lauliac 55986976b1 metro-bundler: temporary increase of the transform timeout
Summary:
We'll revert when the root problem is fixed, that should mitigate for now.

What might be the root problem, I believe, is that when there are some cached files already on the machine, we immediately try to build all the dependencies, but the worker farm is queuing these and it takes a long time to finish. The timeout should include only the transformation time, not the queuing. I'll fix that separately.

Reviewed By: mjesun

Differential Revision: D5650380

fbshipit-source-id: f4b045876cc822caee3998f69ca98ea986709bf4
2017-08-17 11:36:12 -07:00
Jean Lauliac c6794aabd9 metro-bundler: extract calls to require.async()
Reviewed By: davidaurelio

Differential Revision: D5639493

fbshipit-source-id: d74aae95a238cf97b7daafad41ce9cbdccc84c1b
2017-08-17 06:41:18 -07:00
Jean Lauliac 66182916de metro-bundler: extract-dependencies: nit fix
Reviewed By: davidaurelio

Differential Revision: D5639285

fbshipit-source-id: 1f163160e72cb8a63c0c23846ad1b6cc3da13602
2017-08-17 06:41:15 -07:00
David Aurelio 35979c7b00 JSTransformer: pass on `--heap-growing-percent`
Reviewed By: jeanlauliac

Differential Revision: D5648906

fbshipit-source-id: 240b3044dd1268cf5f8bb41710647050368ddefb
2017-08-17 05:08:49 -07:00
Miguel Jimenez Esun b3b2d10500 Do not assume we are using processRequest in an express app
Summary: It might be that Metro bundler is getting used directly with the `http` module and not within an express app. If that's the case, the `next` method will not exist, so we have to guard against it.

Reviewed By: davidaurelio

Differential Revision: D5639944

fbshipit-source-id: bcee4a70f6a7b643218b11af0d8aedbc7762eead
2017-08-17 04:42:10 -07:00
Rafael Oleza e4acb91914 Remove hot parameter from HMR url
Summary: This is the last piece of work to make all the clients do a single request for both HMR/non-HMR modes. I'm not completely sure how this URL is used by the client, but it does not need the `hot` param.

Reviewed By: davidaurelio

Differential Revision: D5639946

fbshipit-source-id: a76f9ba7b9ace625352a156761d3ee2809f80c92
2017-08-16 19:12:43 -07:00
Rafael Oleza 409a2ae809 Always use the HMR transforms when building the bundle from the metro-bundler server
Summary:
This diff enables the HMR transforms for any bundle requested through the metro-bundler HTTP server, so it ignores the `hot` parameter passed in the URL.

This allows much faster switches when enabling/disabling HMR, since metro-bundler does not need to re-compile each single file again, while not impacting substantially build times when HMR is off.

I've done some lightweight benchmarks on my machine and these are the results (all the tests have been done after running metro-bundler with a clean cache and restarting the app).

**Before**

Time to build (HMR off): 1x (baseline)
Time to build (HMR on): 1.90x

**This diff**

Time to build (HMR off): 1.009x
Time to build (HMR on): 1.036x

(The reason why now it takes double the time to load the HMR bundle than the non-HMR bundle after launching the app is because the device after a restart always asks for the non-HMR bundle and afterwards the HMR bundle, causing the server to have to build both bundles).

**Bundle size**
In terms of bundle size, adding the HMR transforms increases the size by around 3-4% (this regression is due to the wrappers added around React components, and will depend on the app).

**Next steps**

There are two improvements to do after this diff:

1. Remove the `hot=true` parameter from the clients when they request the bundle. This will reduce by half the memory used by metro-bundler when switching from non-HMR to HMR (or when opening the app with HMR enabled), since metro-bundler caches the bundles based on url.
2. After this diff, the `hot` parameter in the various options objects will not make much sense, so my suggestion is to just remove it from everywhere and instead of checking for that parameter in the transformer, check for `dev=true` there.

Reviewed By: davidaurelio

Differential Revision: D5623623

fbshipit-source-id: cb76b9182e55f442e2987fcf59eee2ba2571578e
2017-08-15 18:44:03 -07:00
Jean Lauliac a78be6ce0a metro-bundler: get longer stack traces in workers
Reviewed By: davidaurelio

Differential Revision: D5630365

fbshipit-source-id: df397afe80f12a6d8a587cb3e657bcb22b2377f3
2017-08-15 08:43:11 -07:00
Miguel Jimenez Esun e9d815c1fa Reduce source map in 44.5 MiB for Nuclide
Reviewed By: pakoito, davidaurelio

Differential Revision: D5611240

fbshipit-source-id: b0090f6d07d3e08408fc27e91e462a2019130880
2017-08-14 12:07:37 -07:00
Jean Lauliac 08947acde3 RN cli: remove project temp dir experiment
Reviewed By: mjesun

Differential Revision: D5621056

fbshipit-source-id: 464353bc3e68e9e3657e1fbb02aca467b2daa5ca
2017-08-14 03:56:06 -07:00
David Aurelio 30d85a4b05 Terminal: Throttle output to ~30fps
Reviewed By: rafeca

Differential Revision: D5612088

fbshipit-source-id: 3567eb477e771ec680f17ae273dc4daae91614c0
2017-08-11 14:40:24 -07:00
Miguel Jimenez Esun 506e3ec358 Update Jest to 20.1.0-echo.1
Reviewed By: cpojer

Differential Revision: D5591819

fbshipit-source-id: 91830096988d88a6f0601d73225a12ae31e61a17
2017-08-10 07:37:05 -07:00
Brian Vaughn 36b22341b5 React 16 beta 5 sync (5495e49...c3718c4)
Reviewed By: spicyj

Differential Revision: D5564030

fbshipit-source-id: fd3e6133df7ee8e7488a3c515ce6c783c11d9401
2017-08-09 12:25:12 -07:00
David Aurelio 7e6816d99c Remove unused type imports
Reviewed By: cpojer

Differential Revision: D5579025

fbshipit-source-id: b1b4a73db59ec071b18c873a8e676f0722ae109a
2017-08-07 17:44:04 -07:00
Miguel Jimenez Esun 38fce3a7fb Remove redundant calls for addModuleIdsToModuleWrapper
Reviewed By: davidaurelio

Differential Revision: D5526561

fbshipit-source-id: e3452899062587d3b4b5f87a7de01cb0be7a3cb9
2017-08-01 09:52:45 -07:00
David Aurelio 35e5b486c3 Make `ResolveFn` sync
Summary: now that `ResolutionRequest.resolveDependency` is synchronous, we can also make `ResolveFn` synchronous.

Reviewed By: fkgozali

Differential Revision: D5528094

fbshipit-source-id: 0b40df29024b809a99b7e577716b24e9fa499578
2017-07-31 17:46:01 -07:00
David Aurelio 0272069002 Only write assets referenced in a bundle
Summary: Adds filtering to the assets written from a Buck build, so that we don’t write all assets present in libs, but rather only the ones included in the bundle.

Reviewed By: cpojer

Differential Revision: D5522844

fbshipit-source-id: fcca3567b726dfab1ecf9560932fd6e1a174b31f
2017-07-31 10:12:11 -07:00
Jean Lauliac e032e6621f metro-bundler: upgrade all jest refs to delta.4
Reviewed By: mjesun

Differential Revision: D5503722

fbshipit-source-id: ca5d1e684e6b909804ae2be8c2055439dda611f5
2017-07-28 13:02:53 -07:00
Jean Lauliac f332dbee47 metro-bundler: Resolver @format
Reviewed By: cpojer

Differential Revision: D5514920

fbshipit-source-id: 59b8ab3555aca1703b22049382f39d1d67401c4f
2017-07-28 13:02:53 -07:00
David Aurelio 2dda50893f 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:15:34 -07:00
Dmitry Zakharov 43457e6674 Make intentions clearer in code of require.js
Reviewed By: javache

Differential Revision: D5479898

fbshipit-source-id: de73d5cffed4200b81f1d8335a3962a37702df63
2017-07-27 13:59:47 -07:00
Jean Lauliac 1a75751a3b metro-bundler: hash enableBabelRCLookup in global cache
Reviewed By: mjesun

Differential Revision: D5502800

fbshipit-source-id: f6cb01e57a3a385c256f1e77420ca670fe77e5de
2017-07-27 12:29:58 -07:00
Jean Lauliac c37f730c57 metro-bundler: 0.11.0
Reviewed By: davidaurelio

Differential Revision: D5494606

fbshipit-source-id: 2049fe162b76fa6ffeec9f87871276057d84f892
2017-07-27 11:51:18 -07:00
Jean Lauliac 14b88b6ad4 metro-bundler: @format lib/
Reviewed By: cpojer

Differential Revision: D5493458

fbshipit-source-id: 05ac2895125b1419996a66f3ef155bc2cec11c02
2017-07-26 12:24:22 -07:00
Christoph Nakazawa 521e25bded Improve Metro's TransformError message for transform errors.
Reviewed By: davidaurelio

Differential Revision: D5470538

fbshipit-source-id: dea3e798c26964bb789917e73bb06a7629af7aa4
2017-07-25 13:54:43 -07:00
Jean Lauliac ce0da03a05 metro-bundler: moar @format
Reviewed By: mjesun

Differential Revision: D5484885

fbshipit-source-id: f9ae126931f0c9f611ee5b5b96243656e86f4ba4
2017-07-24 22:37:19 -07:00
Jean Lauliac 9f1cce4e89 metro-bundler: bundle test: fix test for no polyfills
Reviewed By: mjesun

Differential Revision: D5481856

fbshipit-source-id: b5516d7d74ba15886f1126f6d881a66559d0fb1e
2017-07-24 22:37:19 -07:00
Jean Lauliac 5ba56250b5 metro-bundler: remove hardcoded AssetRegistry path
Reviewed By: davidaurelio

Differential Revision: D5452553

fbshipit-source-id: e0a6f56d3bc03f4ba7f34fbee1ae418495dcc6cd
2017-07-24 17:07:30 -07:00
Jean Lauliac 74e78ee43f metro-bundler: @format node-haste subdir
Summary: Format everything, one subdir at a time.

Reviewed By: mjesun

Differential Revision: D5481590

fbshipit-source-id: 6d9157e6857d61b8116bcf9285bd4be415c5ba01
2017-07-24 15:30:30 -07:00
James Ide 0f3d7117d4 Add an option to enable/disable .babelrc lookup
Summary:
By default, when Babel transforms a file, it looks for .babelrc in the file's directory and all parent directories until it finds a .babelrc file. This means that when Metro tries to transform `<PROJECT_ROOT>/node_modules/dep/mod.js`, it searches for `<PROJECT_ROOT>/node_modules/dep/.babelrc`. If that .babelrc actually exists, Babel will try to apply it.

In practice, this often causes problems because packages that include .babelrc often do so unintentionally -- they don't intend for the package consumer to look at that .babelrc file. One thing we've done a lot is `rm` all .babelrc files under node_modules -- this commit effectively achieves the same in a less destructive way by telling Babel not to look up .babelrc files. (To clarify, Metro will still apply the .babelrc file in the project root.)

Since the current behavior is to look at .babelrc files, this commit keeps that behavior for now. We'll consider overriding the default behavior (that is, making Babel not lookup .babelrc files) in the default configuration of Expo/RN projects. If this goes well and we empirically find that people are having a better time, we may want to consider flipping this option's default in Metro, so that Metro tells Babel not to look up .babelrc files by default.
Closes https://github.com/facebook/metro-bundler/pull/31

Differential Revision: D5469620

Pulled By: jeanlauliac

fbshipit-source-id: fe7a1042feafff843e1a6d8cc9487eb6ff8e8358
2017-07-24 13:43:26 -07:00
Jean Lauliac 42d61ea63a metro-bundler: global cache: add uri info to the FetchFailedError
Reviewed By: davidaurelio

Differential Revision: D5451939

fbshipit-source-id: 8fa460f714919488ab7a592e123e91adde4ed4c2
2017-07-24 12:09:46 -07:00
Jean Lauliac fd6c2a4013 v0.10.0
Summary: Closes https://github.com/facebook/metro-bundler/pull/32

Differential Revision: D5469676

Pulled By: jeanlauliac

fbshipit-source-id: 68cf83d43582fa0543e28810df48915911760ce3
2017-07-21 04:54:57 -07:00
Janic Duplessis 16bb5571c6 Add Content-Length header to *.bundle responses
Summary:
The main goal of this is to be able to show bundle download progress in a follow up PR for react-native.

**Test plan**
Tested that it is possible to show bundle download progress in react-native using this header and added unit test.
Closes https://github.com/facebook/metro-bundler/pull/28

Reviewed By: davidaurelio

Differential Revision: D5443344

Pulled By: jeanlauliac

fbshipit-source-id: 63fd655c964d7df526125fbe55eb9c7cccd7dba9
2017-07-21 03:51:48 -07:00
Jean Lauliac 3cc83da403 metro-bundler: Server: report ambiguous module resolution better
Reviewed By: mjesun

Differential Revision: D5444129

fbshipit-source-id: 311d20c7ee4c00ec2d4c52d83bd6c5a94221b552
2017-07-20 10:21:49 -07:00
Miguel Jimenez Esun 3cbc2f3ec4 Revert D5388655: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5388655

fbshipit-source-id: 2f92d6ae69f4772195aeca7493f53209388b3ad0
2017-07-19 12:14:28 -07:00
Miguel Jimenez Esun d7521c53ae BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5388655

fbshipit-source-id: dc403f3d5e2d807529eb8569a85c45fec36a6a3e
2017-07-19 11:11:16 -07:00
Jean Lauliac 1ae97c72a2 fix inner yarn.lock
Summary:
I corrupted the yarn.lock when trying to downgrade that module. This change brings the correct resolution in the `yarn.lock`.
Closes https://github.com/facebook/metro-bundler/pull/29

Differential Revision: D5452305

Pulled By: jeanlauliac

fbshipit-source-id: 54026cfd9cf269e2b432dd92f16bd6db9fa4603c
2017-07-19 09:14:47 -07:00
Jean Lauliac 7f68aa8493 metro-bundler: TerminalReporter: fix comment
Reviewed By: davidaurelio

Differential Revision: D5442902

fbshipit-source-id: bb9ccc05c4a6a69027448bad42880313732304a1
2017-07-18 10:31:48 -07:00
Jean Lauliac e023fe12d2 metro-bundler: downgrade block-scoping Babel plugin
Summary: Downgrade the locked version of Babel block scoping, kinda temporarily until we upgrade internally. This makes in on par with the version we use internally, so that the `basic_bundle` test had the same results on both infrastructures. This doesn't change a single thing for `metro-bundler` consumers, because this `yarn.lock` file is only used for testing/CI, not when the library is installed as part of a project.

Reviewed By: cpojer

Differential Revision: D5442368

fbshipit-source-id: f3033e450855f7d61ac775a46719d7b1743960c5
2017-07-18 08:13:02 -07:00
Jean Lauliac 9815cd6e6f metro-bunder: fix DependencyGraph-test for new jest-haste-map duplicates API
Summary: Now we have a nice specific error type for duplicates errors. This changeset have been commited before but was reverted as part of a stack, so here we go again.

Reviewed By: cpojer

Differential Revision: D5442363

fbshipit-source-id: 068c8decaf20cd4f9a73d9d54984030c79cff606
2017-07-18 08:13:02 -07:00
Jean Lauliac be9219b852 metro-bundler: Resolver: explicit option list
Summary: I appears `Object.assign` is not properly typed-checked by Flow, and silently so, so I propose we switch to an explicit list until we find an alternative solution. I prefer to have strong typing especially for options, and as the lack of typing has caused breakage before.

Reviewed By: cpojer

Differential Revision: D5442319

fbshipit-source-id: 82b0ec760c7dea6da6f7932896243147ce12ebf9
2017-07-18 04:40:35 -07:00
Jean Lauliac f58a9fa922 metro-bundler: Resolver: handle empty blacklistRE
Reviewed By: cpojer

Differential Revision: D5442309

fbshipit-source-id: f00283bf659100d9269c85b188e2e2fd44cbdc99
2017-07-18 04:40:34 -07:00
Mehdi Mulani e4b94a4d77 Revert D5424282, D5433438, D5424365, D5417982 to unbreak React Native
fbshipit-source-id: 0b32966feabeff6b785dae52a173854e6805f150
2017-07-17 16:37:39 -07:00
Jean Lauliac 635e41027c metro-bundler: put __tests__ blacklisting into default blacklist instead
Summary: I'd like to get rid of the function as blacklist, because it's impossible to process properly at the `jest-haste-map` level (https://github.com/facebook/jest/pull/4047). The reason we use a function in Metro bundler is because we excludes all the `__tests__` modules. However, I removed this exclusion completely, and I could build our package without any problem and with no difference in the final bundle. I can only assume, then, that this line is only here for slightly increasing performance. Therefore, I think it's reasonnable to move it as part of the default blacklist shipped with Metro bundler instead.

Reviewed By: cpojer

Differential Revision: D5434351

fbshipit-source-id: dea39f6299985143d25fcb3b7b365d793acd64a9
2017-07-17 11:24:06 -07:00
Jean Lauliac 40c4317086 metro-bunder: fix DependencyGraph-test for new jest-haste-map duplicates API
Summary: Now we have a nice specific error type for duplicates errors.

Reviewed By: cpojer

Differential Revision: D5433438

fbshipit-source-id: 47cad9ca6bf0bdec91a158ccb2807b6c5571966a
2017-07-17 09:36:03 -07:00
Miguel Jimenez Esun ffbc1c80a8 Remove default polyfills from metro-bundler
Reviewed By: davidaurelio

Differential Revision: D5423673

fbshipit-source-id: a66655cd72d56eb60a8a79a298ebfbc746b5ad10
2017-07-17 03:10:18 -07:00
Miguel Jimenez Esun 3f4135e444 Update Jest to 20.1.0, chi.1
Reviewed By: davidaurelio

Differential Revision: D5423945

fbshipit-source-id: deb58ba9288883b5d671148aeaa59da6629d0de4
2017-07-14 10:07:30 -07:00
Jean Lauliac 4399621d36 metro-bundler: upgrade jest to 20.1
Summary: This put it on par with the version we use on other projects. This new version breaks assumptions about the way Promise/ticks/timers use to work, and I was not able to make it work properly synchronously. Since it's fragile anyway (because rely on Promise and feature internals), I propose the switch to async as done in this changeset. If `res.end` is not called, tests will just timeout instead.

Reviewed By: cpojer

Differential Revision: D5423823

fbshipit-source-id: 015e808a2cf2b8297a36b16feeb811a6e745a835
2017-07-14 08:11:09 -07:00
Jean Lauliac 2ee051599a metro-bundler: fix DependencyGraph-test
Reviewed By: mjesun

Differential Revision: D5423513

fbshipit-source-id: a0093bb8d26d4c16790ed90cae21350451ebe04a
2017-07-14 07:42:11 -07:00
Miguel Jimenez Esun e787159f9e Revert D5406562: Remove default polyfills from metro-bundler
Differential Revision: D5406562

fbshipit-source-id: fe8222b9f6c04117dc0e0226c34f0f39df701c0d
2017-07-13 11:23:01 -07:00
Miguel Jimenez Esun abf49f0a02 Remove default polyfills from metro-bundler
Reviewed By: davidaurelio

Differential Revision: D5406562

fbshipit-source-id: 76a8850ab8e987407421084054d1d0eb23ff645d
2017-07-13 09:13:08 -07:00
Jean Lauliac ec01441adf metro-bundler: ModuleResolution: extract _loadAsFileOrDir()
Summary: Going one step further, we can start working around the throwing version. To simply some code, I also piggybacked the addition of helper functions `resolvedAs` and `failedFor` in this changeset, hope it's okay. I can split if necessary.

Reviewed By: davidaurelio

Differential Revision: D5415196

fbshipit-source-id: 1bd5955b5733866af52fa873bcd1d9e4ce8215cf
2017-07-13 08:37:07 -07:00
Jean Lauliac 4a9c7b9f30 metro-bundler: ModuleResolution: inline loadAsDirOrThrow
Reviewed By: cpojer, davidaurelio

Differential Revision: D5407426

fbshipit-source-id: 0e45b671d6696745ea37b99071f4e5bc2a6b4106
2017-07-13 06:24:43 -07:00
Jean Lauliac bc75b94b7e metro-bundler: ModuleResolution: remove loadAsFileOrThrow
Reviewed By: cpojer

Differential Revision: D5406612

fbshipit-source-id: bd20e1c9aa23b6988ab02c8c0459335874d7d346
2017-07-13 06:24:43 -07:00
Jean Lauliac 392a129b56 package-json-sync-test: verify metro-bundler dependencies as well
Reviewed By: davidaurelio

Differential Revision: D5370620

fbshipit-source-id: fdcbcd0b9bb78f37745ace28f9f8c17b8b8fd52e
2017-07-11 03:38:03 -07:00
Christoph Nakazawa b26b048c78 Revert D5321193: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5321193

fbshipit-source-id: 9113ed78e59ae9e9f3f86ca2fda2db3bd8c0dd7c
2017-07-07 10:51:29 -07:00
David Aurelio 0e4b4f7c7b Update `throat` dependency to 3.2.0
Summary: it has flow definitions now. OMG!

Reviewed By: cpojer

Differential Revision: D5381183

fbshipit-source-id: bdb3863b24da9802eeeb8a7d08f05d629f735178
2017-07-07 09:18:27 -07:00
Miguel Jimenez Esun 298d8b3e3e BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5321193

fbshipit-source-id: fd4805b28c8a2b986842e23570a64003370d2067
2017-07-07 07:42:13 -07:00
Jean Lauliac 029483d796 metro-bundler: tweak babel-register callsite
Summary:
This fixes https://github.com/facebook/react-native/issues/14530 on my local repro. The reason the original problem appears is because when requiring the preset itself, what I think is a bug in babel-register kicks in and it starts transforming the presets themselves. That fails because these preset don't actually have the correct transforms plugins installed/specified in their `package.json` (they do it at prepublish time).
Closes https://github.com/facebook/metro-bundler/pull/21

Reviewed By: cpojer

Differential Revision: D5380795

Pulled By: jeanlauliac

fbshipit-source-id: 023fd6b36dc7ebd26961878edd71d423ea9856b5
2017-07-07 04:10:28 -07:00
Jean Lauliac 7450484d94 metro-bundler: fix DependencyGraph-test
Reviewed By: mjesun

Differential Revision: D5371267

fbshipit-source-id: 689f7c5b2920cb15d7ba6c50c34a94344b2a686b
2017-07-07 03:23:27 -07:00
David Aurelio 7111cf6e4e Bump dependencies
Summary: Bump dependencies to the same version that react native uses

Reviewed By: jeanlauliac

Differential Revision: D5364009

fbshipit-source-id: 302db951a5509584da13a18a7fab6965e0b1e394
2017-07-06 14:36:22 -07:00
David Aurelio efa753c2e4 Restore file header for RAM bundles
Summary: Restores the ability to write the expected header for indexed RAM bundles by avoiding to stringify buffers as utf8. Some minor cleanups included

Reviewed By: javache

Differential Revision: D5351839

fbshipit-source-id: 056661b064336ff74571b9f44c16d709fc59145b
2017-06-30 11:07:02 -07:00
Jean Lauliac b96d886982 metro-bundler: upgrade jest-haste-map
Reviewed By: cpojer

Differential Revision: D5346860

fbshipit-source-id: 16e9eeeb28804af81428745fda4ffc05a461845c
2017-06-29 08:36:14 -07:00
Christopher Chedeau e0ea0aae1d Codemod prettier to 1.5.2
Differential Revision: D5339725

fbshipit-source-id: 631338436a7d69b0ab0721507bdab4ae4e207065
2017-06-28 13:00:25 -07:00
David Aurelio 429c1e8032 Use `jest-docblock`
Summary:
Remove our internal docbloc module and use `jest-docblock` instead.

The development server is using `jest-haste-map` exclusively, which in turn relies on `jest-docblock`, which differs slightly from our own docblock module.

Depending on only one version greatly reduces the number of edge cases

Reviewed By: cpojer

Differential Revision: D5328472

fbshipit-source-id: 4a31d8159519e01a83fda04b76e8f14f0beb16af
2017-06-27 03:51:37 -07:00
Chris Blappert f7ad406c23 Packager postprocessing hook
Reviewed By: davidaurelio

Differential Revision: D5244060

fbshipit-source-id: 3f5f9ab9aeeb63eca13d6dab089c2bda42f70c33
2017-06-26 10:36:25 -07:00
David Aurelio 3cf8242128 Trim doc block annotations after parsing
Summary:
Trims doc block annotations. This mitigates problems with leading and trailing spaces in `providesModule` annotations.

This module doesn’t have tests, but it is exclusively used for `providesModule` annotations right now.

Reviewed By: mjesun

Differential Revision: D5319814

fbshipit-source-id: de55df5b4b199738f9b01151eb86f3c863485b15
2017-06-26 06:11:42 -07:00
David Aurelio 01e1ff3b0a metro-bundler: fix e2e test
Reviewed By: jeanlauliac

Differential Revision: D5310764

fbshipit-source-id: 275285086f92e7cb6a4e94afeb8ec535c663097c
2017-06-24 17:08:15 -07:00
David Aurelio 5f0c5b231e Allow to resolve assets with explicit platform extension
Summary: Given a file `test.android.png`, this allows it to be found as `test.android` for arbitrary platforms.

Reviewed By: bestander

Differential Revision: D5305807

fbshipit-source-id: d869a1da0cc502f853314790385734897f269d6a
2017-06-23 16:40:33 -07:00
David Aurelio b62669e2da Publish v0.9.0
Reviewed By: bestander

Differential Revision: D5310936

fbshipit-source-id: a4d1b5f273c3fd6ba631834175d7e37e8589ef16
2017-06-23 13:07:43 -07:00
David Aurelio 08699062d5 npm package has `src/` rather than `build/`
Summary:
We use custom npm scripts (`prepare-release`, `cleanup-release`) to

- move `src` to `src.orig`, and `build` to `src` before creating the tarball
- move everything back afterwards

We run these scripts with lerna before and after publishing. Custom hooks avoid problems with `prepublishOnly` and `postpublish` not being run at opportune times, `prepack` and `postpack` not being supported by npm v4 and yarn, and using `lerna run prepublishOnly` resulting in duplicated execution of the command.

This ensures that development is closer to what is pulled in from npm.

Reviewed By: jeanlauliac

Differential Revision: D5310133

fbshipit-source-id: 6b9885c88b936ef3fe5f1858738ad63d581a8731
2017-06-23 09:06:33 -07:00
Pieter De Baets a0fcbd7f11 Always stub console object
Summary: In some execution environment there's no console object available.

Reviewed By: davidaurelio

Differential Revision: D5303105

fbshipit-source-id: 1d348640c966c9460105ea92ec8a5087ee1b75f1
2017-06-23 08:01:59 -07:00
Miguel Jimenez Esun 30458c15ae WIP: Adding an output to provide a dot file with the dependency graph
Reviewed By: davidaurelio

Differential Revision: D5284123

fbshipit-source-id: e7c7519c4fefb66245dab3c5f205a8643067693a
2017-06-21 07:06:30 -07:00
Miguel Jimenez Esun b462183830 Adding support for RAM bundles - multiple files version
Reviewed By: davidaurelio

Differential Revision: D5277684

fbshipit-source-id: 77041375026d5c186022c8108acace7b519902fb
2017-06-20 11:57:15 -07:00
James Ide be1843cddc Add font file extensions (otf and ttf) to default supported extensions
Summary:
This makes it a little more convenient to dynamically load font files. We currently do with help from the "assetExts" config flag and find that we specify it a lot. Would you be interested in taking this PR?
Closes https://github.com/facebook/metro-bundler/pull/14

Differential Revision: D5284158

Pulled By: jeanlauliac

fbshipit-source-id: d102cf4776b9e3659c33e15d9d72f7ea0ea52d57
2017-06-20 11:08:28 -07:00
Jean Lauliac 089461c0a8 metor-bundler: DependencyGraph-test: fixes last remaining tests with proper end()-ing
Summary:
With these last fixes, the test is now finishing properly instead of hanging up forever! This means tests should now hopefully pass on CircleCI, amazing!

I had to disable a test that was actually broken, I'd like to fix that in a separate changeset.

Reviewed By: davidaurelio

Differential Revision: D5282917

fbshipit-source-id: d61b13ed40da7cd43a542ad916158a2aefecda18
2017-06-20 04:44:49 -07:00
Jean Lauliac 1566ae81dd metro-bundler: DependencyGraph-test: re-enable win32 test subset for any platform
Reviewed By: davidaurelio

Differential Revision: D5275358

fbshipit-source-id: c14b8a054a85bff0374c5f3ef7e4edc7a1d1f06d
2017-06-20 03:37:19 -07:00
James Ide 75fa67e14d Add the blacklist creation function to the list of exports
Summary:
We use a custom rn-cli.config.js file that specifies a custom blacklist. In addition to blacklisting some of our own directories, we still want to keep RN's default rules for what to blacklist so we also call into the packager's blacklist.
Closes https://github.com/facebook/metro-bundler/pull/13

Differential Revision: D5275117

Pulled By: davidaurelio

fbshipit-source-id: 0ad79fa47b8730af5a2c4e9ecbedf02b7d673b6c
2017-06-19 10:51:08 -07:00
Jean Lauliac d60b783e82 metro-bundler: DependencyGraph-test: use processDgraph for 'file watch updating' section
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`

Reviewed By: davidaurelio

Differential Revision: D5274139

fbshipit-source-id: 82e919e0f7248ddd01de9c8fa3908c3943184016
2017-06-19 10:07:25 -07:00
Jean Lauliac 3248d9945a metro-bundler: DependencyGraph-test: use processDgraph for 'node_modules (win32)' section
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`

Reviewed By: davidaurelio

Differential Revision: D5274137

fbshipit-source-id: d4f46d9b2c02622c81bd178c2b76c9cea89b6dd0
2017-06-19 10:07:25 -07:00
Jean Lauliac 88f0f0acfc metro-bundler: DependencyGraph-test: use processDgraph for 'node_modules (posix)' section
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`

Reviewed By: davidaurelio

Differential Revision: D5274132

fbshipit-source-id: 9a19482f969f105d4e2ec6dffc5ae901a5a7da32
2017-06-19 10:07:25 -07:00
Christoph Pojer 54c4aed3b4 Print proper error from uglify
Reviewed By: jeanlauliac

Differential Revision: D5264809

fbshipit-source-id: 2a2c7c9af74e8c87acf68e2e9205c85b7aea2fb9
2017-06-16 10:25:44 -07:00
David Aurelio 2a085f0c1b Display snippets of TransformErrors
Reviewed By: cpojer

Differential Revision: D5247080

fbshipit-source-id: a0c4515476246e6da4c33c9129f6273af838d04f
2017-06-16 09:39:03 -07:00
Miguel Jiménez Esún af67937bba Export source maps utilities
Reviewed By: kittens

Differential Revision: D5249991

fbshipit-source-id: e2ad21bfa3497bc08c5afdcb0c7d9b76dc5dcc25
2017-06-15 10:38:57 -07:00
Mark Vayngrib ee31015d5c add breaking test, fix edge case for replacing browser "main" field
Summary:
**Summary**

fixes edge case for replacing browser "main" field, when "main" field value is a file name rather than a file path

**Test plan**

added breaking test in 1st commit, fix in 2nd commit
Closes https://github.com/facebook/metro-bundler/pull/3

Reviewed By: cpojer

Differential Revision: D5255292

Pulled By: jeanlauliac

fbshipit-source-id: 65764144adfcda9f6dbdf8f5f754186b05e1a8bb
2017-06-15 09:11:41 -07:00
David Aurelio 1e6b34f415 Backed out changeset db8638eebe2d
Reviewed By: alexeylang

Differential Revision: D5246311

fbshipit-source-id: cb12964c27a6d1e6fa719a979a8f0ebcc8efae8a
2017-06-14 09:53:06 -07:00
David Aurelio 20ed5b8d3a Remove `retainLines` and `sourceMaps` options
Summary:
`retainLines` is no longer necessary with the much improved source map generation.
`sourceMaps` is handled by the transformer itself.

Reviewed By: cpojer

Differential Revision: D5237103

fbshipit-source-id: e5c6bf5aa9d553fce9c3f4d59b3ea0057d45cfdc
2017-06-14 09:38:25 -07:00
Jean Lauliac d437b31fea metro-bundler: DependencyGraph-test: switch a bunch of tests to processDgraph()
Reviewed By: davidaurelio

Differential Revision: D5245656

fbshipit-source-id: 276e7406af2f6afb361d14b5c6e1dd5b9f1f6ddb
2017-06-14 08:08:44 -07:00
Jean Lauliac 4012f96c25 metro-bundler: DependencyGraph-test: proof of concept for proper test cleanup
Summary: The `DependencyGraph-test` hangs forever if run in isolation because the watch mode is not properly ended. I propose we just wrap each test in a function that does the correct thing, and also migrate tests to `async`/`await`.

Reviewed By: cpojer

Differential Revision: D5245477

fbshipit-source-id: ea30c0e637e0c7b85afe4c76c5e985846ae9b243
2017-06-14 07:13:19 -07:00
David Aurelio e87a8205d8 Handle synchronous errors in `worker.transformCode`
Summary: `worker.transformCode` is a callback-taking function, but did not properly guard against errors thrown in its body.

Reviewed By: cpojer

Differential Revision: D5245253

fbshipit-source-id: 3fd08b68dd8605f664b316652ebd1f9497b2dac9
2017-06-14 05:06:20 -07:00
David Aurelio fdc8f37a5b Replace `RNP:` debug prefix with `Metro:`
Reviewed By: jeanlauliac

Differential Revision: D5236970

fbshipit-source-id: 8bd1d38f009018e9cafef13188bee82351614890
2017-06-14 04:54:42 -07:00
Jean Lauliac 7e9f368ee5 metro-bundler: recreate temp dir if does not exist
Summary: That happens after a reboot on macOS for example, because temp dir is wiped.

Reviewed By: davidaurelio

Differential Revision: D5236249

fbshipit-source-id: be19cd97a7488850e3195b3fc419779ed0df2c38
2017-06-14 04:36:31 -07:00
Christoph Pojer 9127fce33c 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:21:40 -07:00
Jean Lauliac 626fe47667 metro-bundler: fix percent progress output
Reviewed By: davidaurelio

Differential Revision: D5236226

fbshipit-source-id: efbbf46f4212a66a6357b7d87059f89354b6f50b
2017-06-13 08:40:52 -07:00
Jean Lauliac d3195fa528 ResolutionRequest: extract module resolution
Reviewed By: davidaurelio

Differential Revision: D5218015

fbshipit-source-id: 6e34df5913d96a0b518f9403309658ea0b559730
2017-06-13 07:27:24 -07:00
Miguel Jiménez Esún b559412a08 Pass bundle options to the reporter to provide additional information
Reviewed By: jeanlauliac

Differential Revision: D5172384

fbshipit-source-id: f2e4cf677f8113060b257ddec6b585870786a336
2017-06-12 10:52:16 -07:00
David Aurelio 573d9edfd0 Upgrade uglify to v3 + es support
Summary: Upgrades uglify to version 3 with (experimental) ES6 support turned on.

Reviewed By: cpojer

Differential Revision: D5227245

fbshipit-source-id: db8638eebe2daf40b60570cac34905e9a7288705
2017-06-12 10:11:20 -07:00
David Aurelio 2678b8fb0d Add nested yarn.lock 2017-06-12 18:07:19 +01:00
Jean Lauliac 5bae61e611 metro-bundler: fix DependencyGraph-test
Reviewed By: cpojer

Differential Revision: D5227270

fbshipit-source-id: 3d36394cafa658070d84d7b5ace2af48d20cc9d7
2017-06-12 07:09:12 -07:00
Jean Lauliac d4bb0d3282 metro-bunder: caching: when using project dir, keep cache itself in temp
Summary: I wanted to settle #18056064 once and for all. This solution both uses (1) random generation of temp dir, and (2) minimal overhead in the repo. The reason random generation of temporary folder directory names should always be used is the same as why [`mktemp(3)` should never be used](http://man7.org/linux/man-pages/man3/mktemp.3.html#BUGS). The reason we don't want the cache to be fully stored locally (2) is because watchman would catch too many change events we don't care about, hitting performance. Additionally, (1) has the benefit that when one clones the repo from fresh, it'll also always start with a fresh cache. (1) uses a function equivalent to [`mkdtemp(3)`](http://man7.org/linux/man-pages/man3/mkdtemp.3.html), that we cannot use here because it's POSIX and not exposed by the Node.js API.

Reviewed By: davidaurelio

Differential Revision: D5199698

fbshipit-source-id: a660ebbc470e1fe90ed1ab9d0c9fda063b06f90c
2017-06-12 04:50:58 -07:00
David Aurelio 4460ed5307 Unify invocations to `uglify.minify`
Summary: Puts all invocations of `uglify.minify` into one place to facilitate the upgrade to Uglify 3

Reviewed By: cpojer

Differential Revision: D5218415

fbshipit-source-id: 8085255205f80bfda06e0092c9e268a85947763b
2017-06-12 02:22:13 -07:00
Miguel Jiménez Esún bc654954a7 Add prettier to metro-bundler, fixing code styling issues
Reviewed By: cpojer

Differential Revision: D5215552

fbshipit-source-id: 64106d322ccd3a39701a41e4efda4975db9aa52c
2017-06-12 01:20:50 -07:00
Christoph Pojer 150aa19fcb Remove babelRegisterOnly call in workers
Reviewed By: jeanlauliac

Differential Revision: D5208950

fbshipit-source-id: 093c1a67ed830480b42f556ee2d6be4ecfce9f0d
2017-06-09 07:22:26 -07:00
Jean Lauliac c1ff8b5b81 metro-bundler: rename Terminal back to normal
Summary: The 'class' suffix was just to workaround case-insensitivity on macOS.

Reviewed By: cpojer

Differential Revision: D5208747

fbshipit-source-id: 46bff156145880b9a894ff70b0c3dff0895a6d6c
2017-06-08 12:54:15 -07:00
David Aurelio 127f3312ed Fix mock inclusion
Summary:
The 'fs' mock was set up to require 'graceful-fs', which used to delegate to the corresponding mock. After turning off automocking, this no longer necessarily works.
This moves the mock to `fs.js` and makes the mock for graceful-fs require the fs mock via a relative path.

Reviewed By: cpojer

Differential Revision: D5209130

fbshipit-source-id: d468577e09d18382d0b9602ad0964dd880ec2366
2017-06-08 10:15:23 -07:00
Jean Lauliac 795c436cb1 FBGlobalTransformCache: retry 3 times, wait between retries
Summary: That should improve the hit rate a little bit, notably for the cache-filling script. On OSS side, this changeset only adds the sleep() function as `FBGlobalTransformCache` is not exposed.

Reviewed By: cpojer

Differential Revision: D5201196

fbshipit-source-id: c2d8e1a1b03edd9e7747b3202c574b0783f4117d
2017-06-08 09:36:39 -07:00
Jean Lauliac 71275b4018 metro-bundler: ResolutionRequest: remove dep on HasteFS type
Summary: We don't actually need this object anymore, just the function to test a file existence. This simplification allows us to phase out the 'old' HasteFS object easier, as well as adding retry logic using the real filesystem.

Reviewed By: cpojer

Differential Revision: D5208550

fbshipit-source-id: a03317e4385d793643e2dbee5d6782491d20e33c
2017-06-08 09:08:30 -07:00
Christoph Pojer 802094c6f0 @format JSTransformer
Reviewed By: jeanlauliac

Differential Revision: D5208868

fbshipit-source-id: 3b80197c4e879974f9129ccfc4e4a7ca7d4b4258
2017-06-08 07:37:49 -07:00
Christoph Pojer 5e6d70d4d6 Disable automocking from tests
Summary: We are flipping the switch all over Facebook, now that this part of the code is isolated we can do it in Metro as well.

Reviewed By: davidaurelio

Differential Revision: D5199449

fbshipit-source-id: 20c1bacc6dd2d314bd76bc5cc0ecd13266bf81c6
2017-06-08 05:52:18 -07:00
Jean Lauliac 01ecd43c62 FBGlobalTransformCache: retry on server-side errors
Reviewed By: cpojer

Differential Revision: D5200923

fbshipit-source-id: 9fd0d65e8d663437d27a3837580b07e386f70120
2017-06-07 11:22:12 -07:00
Christoph Pojer ef7965df63 Update package.json
Reviewed By: jeanlauliac

Differential Revision: D5183469

fbshipit-source-id: 89c17c80398afb7755d8e7dec5116e62fbbc520e
2017-06-06 12:37:37 -07:00
Jean Lauliac de34d9677c metro-bundler: fix integration test
Reviewed By: cpojer

Differential Revision: D5192165

fbshipit-source-id: 9ec8c8e5b6580e72c94771ff865337eb20e5dc94
2017-06-06 11:56:16 -07:00
Christoph Pojer 3d6b143d72 Add .npmignore
Reviewed By: davidaurelio

Differential Revision: D5190512

fbshipit-source-id: 7ab4b19f5b2c0f2ed5b1c28f3818e988313d96a4
2017-06-06 08:41:04 -07:00
Christoph Pojer 7085ed9f93 Update README
Reviewed By: jeanlauliac

Differential Revision: D5183348

fbshipit-source-id: d71bd7a6c5f20cd8954072814918adf4194abc57
2017-06-06 03:29:08 -07:00
Jean Lauliac 9dad135be1 Revert D5129231: packager: enable throwOnModuleCollision for jest-haste-map
Differential Revision: D5129231

fbshipit-source-id: 23e7f9246b55773dab98ee0cbcf38b1c8d5b4f30
2017-06-05 04:07:18 -07:00
Jean Lauliac c1ed0d872b add fake AssetRegistry module 2017-06-02 18:37:14 +01:00
Christoph Pojer 8977650ba3 New README
Summary: This is a basic README for the new repo. We'll eventually expand on this as more pieces get open sourced and we'll evolve the three identifying tags over time.

Reviewed By: jeanlauliac

Differential Revision: D5172314

fbshipit-source-id: 8e5dd8567eadbcb839ee9860a22929fd6a77ee2e
2017-06-02 09:37:05 -07:00
Jean Lauliac 3b705a1124 react-native: attachHMRServer: make it generic
Reviewed By: cpojer

Differential Revision: D5172344

fbshipit-source-id: ab8b39e1924d66d37da9734455ed9a72cf59906e
2017-06-02 09:37:05 -07:00
Kevin Gozali de70d376ca add --dev flag to the packager's dependencies command
Summary:
The packager dependencies CLI command always operates on --dev=true today. This means any tooling that needs to get the production dependencies (--dev=false) will always get the dev-mode list instead. For instance:

```
if (__DEV__) {
  require('Foobar');
}
```

Previously, `Foobar.js` will always be listed in the CLI output. With this change, setting `--dev false` option will correctly skip `Foobar.js` in the output.

Reviewed By: cpojer

Differential Revision: D5163184

fbshipit-source-id: 203221ee5d6ecb7df575442f12f6c4c489bfbd46
2017-06-01 14:06:30 -07:00
Jean Lauliac 7974a5b745 metro-bundler: AssetServer: remove fs timeouts
Reviewed By: cpojer

Differential Revision: D5164550

fbshipit-source-id: 2d294906c7deb67468dd9f85aa5ca998bdadcef3
2017-06-01 10:08:23 -07:00
Jean Lauliac 9095fd12bf metro-bundler: fix integration test for OSS
Summary: This should fix the e2e test for OSS.

Reviewed By: cpojer

Differential Revision: D5164267

fbshipit-source-id: d858b4811f0eb80ca7363177f4f384b66af13994
2017-06-01 10:08:23 -07:00
Christoph Pojer bbdc4b8152 Update to metro-bundler from npm
Reviewed By: kittens

Differential Revision: D5163718

fbshipit-source-id: c21d3b9b6201d1a9509686cf235b611549652975
2017-06-01 04:38:32 -07:00
Jean Lauliac 98847474cd metro-bundler: Terminal: remove global state
Reviewed By: cpojer

Differential Revision: D5155075

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

Differential Revision: D5154653

fbshipit-source-id: 482bf9829263d5d8f3d0b951ee58e2020236cc2c
2017-05-31 11:08:01 -07:00
Jean Lauliac db5e2e5a8a metro-bundler: ResolutionRequest: extract FileNameResolver
Summary: I want to untangle `ResolutionRequest` once and for all, that starts by pulling stuff out :-)

Reviewed By: cpojer

Differential Revision: D5155316

fbshipit-source-id: a46ee9b40c6705edcac169adcfdffe25058ec810
2017-05-31 10:51:31 -07:00
Jean Lauliac 51da59f9e6 metro-bundler: use buildID instead of entry path for reporting
Summary: This fixes a longstanding bug that happens when 2 bundles with the same entry path but different options (dev, minify, etc.) get mixed up in the reporting. To prevent that we just use a unique build ID for each bundle that the Server handles separately.

Reviewed By: cpojer

Differential Revision: D5147049

fbshipit-source-id: da5c9cfe8c6a5d888b5be737947800d213081d86
2017-05-31 04:06:52 -07:00
Jean Lauliac 90824bdd98 packager: Server: more consistent error handling
Reviewed By: cpojer

Differential Revision: D5137887

fbshipit-source-id: fe73f9a74ac7091fcad66d91859e2ff90733ce45
2017-05-30 06:23:33 -07:00
Jean Lauliac e554efaee4 packager: AsyncTaskGroup: @flow
Reviewed By: cpojer

Differential Revision: D5137195

fbshipit-source-id: 7d61d8f920ea5db7f70415e9f8fb7749a279bec8
2017-05-30 04:51:18 -07:00
Christoph Pojer 76ec909780 Stop requiring setupBabel from within packager/ folder.
Reviewed By: davidaurelio

Differential Revision: D5137246

fbshipit-source-id: 3072aaa6fd74a135980f1f0a7b078a82dd85f09d
2017-05-30 04:42:14 -07:00
Werner Roets e65e6a5da6 Fixed grammar/sentence structure
Summary:
Somebody had to fix it :)
Closes https://github.com/facebook/react-native/pull/13028

Differential Revision: D5145067

Pulled By: shergin

fbshipit-source-id: dc7a56824284c3a599b4b2a41a235e045510a013
2017-05-28 22:29:26 -07:00
Jean Lauliac 06732d9272 packager: Module: get rid of callbacks
Summary: By getting rid of callbacks, we get a code that's pretty halved in size, and much easier to read, but we also fix bugs! When some of the code of Module would throw, we wouldn't catch it, meaning that packager would crash entirely. That's the case for when we have a Haste name mistach, for example. This changeste fixes that by instead capturing exceptions through the Promise chain, that bubble up all the way to the `Server` and reasonnably handled. People can then fix the Haste nane mismatch and refresh right away, and it'll work as expected.

Reviewed By: davidaurelio

Differential Revision: D5137408

fbshipit-source-id: b9e938b93e8d23738af49106bbae1fce97d7a5db
2017-05-26 10:21:23 -07:00
Jean Lauliac 29d2aa65ac packager: add basic top-level integration test
Summary: I'd like us to start having some decent testing at the packager/bundler level to check that there are no major breakage hapenning. This changeset introduce a simple test that just test the `buildBundle` public API. On the same model, I'd like to test the server API and behavior, and things such as hot module reloading. I hope this will also highlight the gross inconsistencies of the API, for example the Bundle/BundleBase hierarchy, that we can proceed to fix later.

Reviewed By: davidaurelio, cpojer

Differential Revision: D5121817

fbshipit-source-id: e0f3758c7fbb7a85cf51fb3cbc34c12d5374b7d3
2017-05-26 03:20:57 -07:00
glevi@fb.com 5ad47b1a24 Deploy v0.47.0 to xplat/js
Reviewed By: zertosh

Differential Revision: D5135644

fbshipit-source-id: f979970f8d0c4e082ec1302084d4def6652557c8
2017-05-25 23:05:52 -07:00
David Aurelio 6ac824264d Fix code generation for indexed RAM bundles
Summary:
Code generation for indexed RAM bundles did not append module ID and dependencies. This fixes that.

Eventually, we only want to have the call to `addModuleIdsToModuleWrapper` in one place.

Reviewed By: jeanlauliac

Differential Revision: D5129255

fbshipit-source-id: 7f6148dd607bbf7c97e9df7936a07bde3f05b3aa
2017-05-25 10:21:31 -07:00
David Aurelio 683c8ddad8 Allow RAM bundle output
Summary: Hooks up indexed RAM bundle output for the build.

Reviewed By: jeanlauliac

Differential Revision: D5121515

fbshipit-source-id: 47a540d8ec016a36e21e1daa2876f582dbdb8504
2017-05-25 10:21:30 -07:00
Jean Lauliac 7f64874c7d packager: use tempdir by default
Reviewed By: davidaurelio

Differential Revision: D5129430

fbshipit-source-id: 3277341226754fd0a86d2ba3c6d64f3fa1b86e84
2017-05-25 09:05:58 -07:00
Jean Lauliac e155303543 packager: enable throwOnModuleCollision for jest-haste-map
Reviewed By: davidaurelio

Differential Revision: D5129231

fbshipit-source-id: dbb8f0096c29efaca865a788fb25c21c9cbbc5cb
2017-05-25 07:59:10 -07:00
Jean Lauliac feec96b762 packager: docBlock: @flow
Reviewed By: cpojer

Differential Revision: D5129050

fbshipit-source-id: b77d535b2f5aefef28346709bc1bb9fea5edade9
2017-05-25 06:06:35 -07:00
Jean Lauliac f0ee61c438 packager: upgrade jest-haste-map version
Summary: This allows us to get the new fix for recovery on duplicate modules.

Reviewed By: cpojer

Differential Revision: D5128975

fbshipit-source-id: 5a2b60430bbca1806a97798c482af8522366e071
2017-05-25 05:07:05 -07:00
Jean Lauliac c03a76b01a packager: TransformCaching: make choice of cache explicit in the API
Summary:
This changeset moves the creation of the transform cache at the top-level of the bundler so that:

* we can use alternative folders, such as the project path itself, that I think will be more robust especially for OSS;
* we can disable the cache completely, that is useful in some cases (for example, the script that fills the global cache).

The reasons I believe a local project path is more robust are:

* there are less likely conflicts between different users and different projects on a single machine;
* the cache is de facto cleaned up if you clone a fresh copy of a project, something I think is desirable;
* some people have been reporting that `tmpDir` just returns nothing;
* finally, it prevents another user from writing malicious transformed code in the cache into the shared temp dir—only people with write access to the project have write access to the cache, that is consistent.

Reviewed By: davidaurelio

Differential Revision: D5113121

fbshipit-source-id: 74392733a0be306a7119516d7905fc43cd8c778e
2017-05-25 04:25:35 -07:00
Christoph Pojer 5db8ac9d48 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:59:46 -07:00
David Aurelio f0e629b8bf Move packager core logic from `local-cli` to `packager`
Summary: Moves packager core logic to `packager/...` to prepare the open source split.

Reviewed By: cpojer

Differential Revision: D5116162

fbshipit-source-id: 06ee2406026686789f67acc88df41773866c3cd3
2017-05-24 08:10:56 -07:00
David Aurelio 3e8991548b Add support for RAM bundle groups
Summary: Adds support for “RAM bundle groups” (common section for module groups) to the new Buck integration

Reviewed By: jeanlauliac

Differential Revision: D5112065

fbshipit-source-id: 038c06b8f4133c7fcd39aba8bb04a5ef42594f3e
2017-05-24 08:10:56 -07:00
Jean Lauliac 502f24a266 packager: TransformCache: extract choice of root path outside of class
Summary: This is a first step towards doing an experiment I was talking about, that is, using the local directory (the directory where the config file lives) instead of the tmp dir, that is fragile.

Reviewed By: davidaurelio

Differential Revision: D5112326

fbshipit-source-id: 819636209972115e41213867f3eb78fbdf6ed9df
2017-05-24 07:52:32 -07:00
Christoph Pojer 20f7633d53 Fix DependencyGraph-test in OS.
Reviewed By: davidaurelio

Differential Revision: D5113955

fbshipit-source-id: 892331815393ca314e84112551f516a20126068f
2017-05-23 16:25:48 -07:00
David Aurelio 06bb33eba0 Move packager launcher scripts outside of `packager/`
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.

Reviewed By: javache

Differential Revision: D5112193

fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
2017-05-23 16:08:29 -07:00
Jean Lauliac 607268001a packager: ResolutionRequest: refactor _loadAsDir and dependents
Summary:
Working on refactoring error handling in `_loadAsDir` I figured out it was oftentimes problematic to pass on the candidates out of the functions as an array, as in practice there's always a single "candidates" object passed out. Also, using an array prevented nice Flow typing and forced additional invariants to be added. So I replaced that by a return value that explicitely can be either a module, or resolution candidates. That way the semantic is more clear: we don't get any candidates if we did resolve properly, and at the same time we enforce returning candidates if we could not resolve any module.

At first I wanted to just have type `{module: TModule} | {candidate: TCandidate}`, but Flow would hit edge cases, so instead I added a field `type` that make it explicit what is the result of the resolution, and allows Flow to refine the type fully after we test that field. This allows us to remove the extraneous invariants. Also, a nice thing is that at a few places, even if the type of the candididate is different, Flow allows us to return the "resolved" object just as it is, that prevents using more memory and causing more garbage collection than necessary.

Since we're creating more objects with that solution, this will be slightly less performant than returning `Module` objects directly, but I don't think it is worth micro optimizing this at that point. If really we see this to be causing trouble later, I'd try to find solutions such as reusing a pool of objects. Ex. we could pass the result `Resolution` object as argument instead of returning a fresh one, but that would make the code less legible, more complex.

Reviewed By: davidaurelio

Differential Revision: D5111501

fbshipit-source-id: f41cdab00640124081cfdf07668169bb2d5c00be
2017-05-23 12:37:24 -07:00
Jean Lauliac d012a1fc84 packager: ResolutionRequest: use _loadAsFile from _loadAsDir
Summary: We can switch that case easily since it was already discarding the error if any would happen.

Reviewed By: davidaurelio

Differential Revision: D5103851

fbshipit-source-id: a0991f626e94a45efbf666561041af258fdbef0a
2017-05-23 12:37:24 -07:00
David Aurelio 05936a53d4 Covariant properties for `ModuleTransportLike`
Summary:
Make all properties of `ModuleTraansportLike` covariant to enforce read-only behavior at all sites using it.
The type only exists for compatibility reasons between old and new output functionality, and covariant properties give us stronger guarantees.

Reviewed By: jeanlauliac

Differential Revision: D5111667

fbshipit-source-id: 674658b07eb3a229cbc4344cb636e4a9ea4126d1
2017-05-23 10:37:40 -07:00
David Aurelio 132d71f0a3 Simplify `File` type: `map` is nullable, but not optional
Summary:
Simplifies the `File` type by making `map` a non-optional, but nullable property.
Also adds helper functions for empty/virtual modules

Reviewed By: jeanlauliac

Differential Revision: D5111580

fbshipit-source-id: 9cab6634a9bdb0522dc36aec2abccaef9cf35339
2017-05-23 10:37:40 -07:00
David Aurelio 7b5d91f359 Create an `OutputFn` that can build indexed RAM bundles
Summary: Adds functionality to assemble an indexed source map to the new Buck integration. This implementation supports startup section optimisations. Hooking it up, and grouping optimisations will be in follow-ups.

Reviewed By: jeanlauliac

Differential Revision: D5106985

fbshipit-source-id: cc4c6ac8cfe4e718fc8bb2a8a93cb88914c92e0b
2017-05-23 10:37:40 -07:00
Jean Lauliac 20d7a7cdc8 packager: add missing dep
Reviewed By: davidaurelio

Differential Revision: D5111613

fbshipit-source-id: bf3b574e6166601d52127540e7970839d7019b6c
2017-05-23 09:26:05 -07:00
Christoph Pojer f2572cf7b5 Minor lint fixes
Reviewed By: jeanlauliac

Differential Revision: D5111517

fbshipit-source-id: 5cf8884334b881fb9a2b1b490972faf45c0c569b
2017-05-23 06:53:42 -07:00
Christoph Pojer 4ebe1e70fc Properly mock `path` in DependencyGraph-test
Reviewed By: jeanlauliac

Differential Revision: D5111337

fbshipit-source-id: ceca2ec8917eda9ca34d65324d8b8c2a468eed1c
2017-05-23 05:11:29 -07:00
Christoph Pojer f8a724121b Add @format to a few files
Reviewed By: davidaurelio

Differential Revision: D5111297

fbshipit-source-id: bde11df412dd694edca78d6a61f4c69e5abba60a
2017-05-23 05:11:29 -07:00
Jean Lauliac 71e6312e01 packager: DependencyGraph: @format
Reviewed By: davidaurelio

Differential Revision: D5103697

fbshipit-source-id: 43e2adc9bfd5902a95ad85333da1df323bddf755
2017-05-22 11:55:35 -07:00
Jean Lauliac 91fdb10abf packager: ResolutionRequest: empty module is special case
Summary: Because we don't want to test for `empty-module.ios.js`, etc. We know the module is supposed to be here. This simpler version makes it easier for me to switch the rest of the `loadAsFile` callsites to the "candidates" system to the "candidates" system.

Reviewed By: davidaurelio

Differential Revision: D5103816

fbshipit-source-id: 7e7d9be27573a1f33d562aeb850759e073fbc72f
2017-05-22 11:39:27 -07:00
Jean Lauliac 307eede076 packager: add preprocess for buck worker
Summary: For the Buck integration (work-in-progress), we want to add the ability to do some custom preprocessing similar to the packager server. The signature is different so I prefer to have a separate function for that. Also we don't need the transform options right now, I suggest we don't add them for now and add them later if necessary.

Reviewed By: davidaurelio

Differential Revision: D5094632

fbshipit-source-id: 1775ddef90b331deabc5be3e57a67436bce06c82
2017-05-22 09:08:45 -07:00