Permalink
Switch branches/tags
Commits on Oct 10, 2018
  1. Bump metro@0.48.1

    rafeca authored and facebook-github-bot committed Oct 10, 2018
    Summary: iffitsships
    
    Reviewed By: pvdz
    
    Differential Revision: D10255800
    
    fbshipit-source-id: 6cf514dc210e2fcc706e9c6bd555a2b8c9326f21
  2. Remove sinon dependency

    rafeca authored and facebook-github-bot committed Oct 10, 2018
    Summary:
    This diff removes the `sinon` dependency from `metro` and `react-native-github`. It was only used in a handful of tests and having to learn and remember another mocking API just for these cases was not worth it IMO.
    
    While doing the migration, most of the things that `sinon` provides can be done with `jest` in a very similar (and user friendly) way.
    
    I've found, though, two small things that are more user friendly with `sinon`. I'm documenting them here because it may be worth adding them to jest:
    
    With `sinon`:
    
    ```
    stub.throws(new Error('foo'));
    ```
    
    With `jest`:
    
    ```
    mock.mockImplementation(() => {
      throw new Error('foo');
    });
    ```
    
    Taking into account that `jest` has a `mockRejectedValue` method for mocks (to return a rejected promise) I don't see any reason why it does not have a `mockThrowError` method.
    
    With `sinon`:
    
    ```
    expect(mock1.calledBefore(mock2)).toBeTruthy();
    ```
    
    With `jest`:
    
    ```
    expect(mock1.mock.invocationCallOrder[0]).toBeLessThan(
      mock2.mock.invocationCallOrder[0],
    );
    ```
    
    There's a community matcher that adds this matcher in `jest-extended`: https://github.com/jest-community/jest-extended#tohavebeencalledbefore, but we're not using `jest-extended` in `xplat/js`.
    
    Reviewed By: jeanlauliac
    
    Differential Revision: D10238331
    
    fbshipit-source-id: 5441125b69596ad85bf8f56d203cfd20759bc358
Commits on Oct 5, 2018
  1. Bump metro@0.48.0

    rafeca authored and facebook-github-bot committed Oct 5, 2018
    Summary: llamadance
    
    Reviewed By: jeanlauliac
    
    Differential Revision: D10216618
    
    fbshipit-source-id: 62284ab76651d3423b80f63b5d7bb355adbfaf06
  2. Expose enableBabelRuntime config param externally

    rafeca authored and facebook-github-bot committed Oct 5, 2018
    Summary:
    Up until now the `enableBabelRuntime` option in the `metro-react-native-preset` package was hardcoded in the transformer: our internal transformer set it to `false` and the opensource one was `true`.
    
    This diff now exposes this param out to the config of Metro (now that it's quite easy to expose things) so anybody can set it to false or true.
    
    This allows our end to end tests to set it to false to not have to deal with requires to `babel/runtime`.
    
    Reviewed By: davidaurelio
    
    Differential Revision: D10123776
    
    fbshipit-source-id: 97e744eeb567c8e86ab3c613ac71970d226ed2ca
Commits on Oct 4, 2018
  1. Bump metro@0.47.1

    rafeca authored and facebook-github-bot committed Oct 4, 2018
    Summary: We need a new version of Metro with D10119384 to make the new Embeds work well
    
    Reviewed By: davidaurelio
    
    Differential Revision: D10119385
    
    fbshipit-source-id: db7fc71c75c450720af41add466fc88ac38f3066
Commits on Sep 27, 2018
  1. Bump metro@0.47.0

    rafeca authored and facebook-github-bot committed Sep 27, 2018
    Summary: New version on the horizon :)
    
    Reviewed By: mjesun
    
    Differential Revision: D10051460
    
    fbshipit-source-id: 982604bd7a38d1d3ec642f6cd6fea1a40ab0d34f
Commits on Sep 26, 2018
  1. Make config object read-only

    rafeca authored and facebook-github-bot committed Sep 26, 2018
    Summary: This makes the Metro config type readonly, only a couple of things inside Metro needed to be tweaked :)
    
    Reviewed By: mjesun
    
    Differential Revision: D10028083
    
    fbshipit-source-id: 15f5d957a8ee7384d6156c973639d86240fd251f
  2. Remove duplicated config types

    rafeca authored and facebook-github-bot committed Sep 26, 2018
    Summary: This diff removes the `convertNewToOld` config method, which was only used by the unit tests (since there's no need to convert a new config object into an old one). As part of this, the config tests have been tweaked and simplified a bit, while keeping similar assertions and adding some more checks.
    
    Reviewed By: mjesun
    
    Differential Revision: D10015079
    
    fbshipit-source-id: ba4fbd09cd4f97168bc1a2dbcec2699a00243637
Commits on Sep 24, 2018
  1. Cleanup the transformer flow types

    rafeca authored and facebook-github-bot committed Sep 24, 2018
    Summary:
    Since the options that are passed to the `babelTransformer` are not exactly the same ones as the `transformer` receives, we need to have a specific object for them.
    
    This allows us to make the transformer options object strict (since unfortunately the `babeltransformer` options object comes from many places and needs a bit of work to be able to be strict...
    
    Reviewed By: mjesun
    
    Differential Revision: D9309173
    
    fbshipit-source-id: 0a92381968f17e5eb6c4740c1ca89580fa7ee4d3
  2. Remove absolute path parameter from transformers

    rafeca authored and facebook-github-bot committed Sep 24, 2018
    Summary:
    Up until now, transformers in Metro received the absolute path of a file, the relative path of a file and the projectRoot.
    
    This diff gets rid of the absolute path sent to the worker, since by having the projectRoot and the relative path, the absolute path can be easily calculated.
    
    This has been done to avoid having absolute paths as transform options, since we need to have custom logic to filter them out from the cache key generation, which is dangerous.
    
    Reviewed By: mjesun
    
    Differential Revision: D9195147
    
    fbshipit-source-id: e95c5c29272eec7f1a48af7cede4c6d6b4a8ffb7
  3. Bump metro@0.46.0

    rafeca authored and facebook-github-bot committed Sep 24, 2018
    Summary: monkey_publish
    
    Reviewed By: jeanlauliac
    
    Differential Revision: D10009619
    
    fbshipit-source-id: cde0a979e44940140c61494b35ac495c822d6f30
Commits on Sep 21, 2018
  1. Bump metro@0.45.6

    rafeca authored and facebook-github-bot committed Sep 21, 2018
    Summary: shiptoasting
    
    Reviewed By: pvdz
    
    Differential Revision: D9968663
    
    fbshipit-source-id: 4a1257f627c5bbc86dc686c3887c517f6972fe2b
Commits on Sep 20, 2018
  1. Bump metro@0.45.5

    rafeca authored and facebook-github-bot committed Sep 20, 2018
    Summary: shipship
    
    Reviewed By: mjesun
    
    Differential Revision: D9966914
    
    fbshipit-source-id: a61e15e1e2a8f84eddabd5d1968ce850f23c0d48
Commits on Sep 18, 2018
  1. Pass the maxWorkers config param correctly to Metro

    rafeca authored and facebook-github-bot committed Sep 18, 2018
    Summary:
    @public
    
    The React Native CLI is not passing the default `maxWorkers` param to Metro, making it run in a single thread and making the development process really slow.
    
    This fixes facebook/metro#253
    
    Reviewed By: mjesun
    
    Differential Revision: D9915500
    
    fbshipit-source-id: d15030af582e99fe20535c07e751cfe12e444f2f
  2. Upgrade babel-eslint to 9.0.0

    rafeca authored and facebook-github-bot committed Sep 18, 2018
    Summary: This diff updates babel-eslint to the stable 9.0.0 version, which uses babel 7.0.0 so we can get rid of babel-7.0.0-beta.52
    
    Reviewed By: rubennorte
    
    Differential Revision: D9894311
    
    fbshipit-source-id: b5276ea7d1b10725fffef13eb1338fe6415dbd36
  3. Remove some automocks from tests

    rafeca authored and facebook-github-bot committed Sep 18, 2018
    Summary:
    They are bad :D
    
    And they affect us when trying to migrate to the babel runtime helpers
    
    Reviewed By: pvdz
    
    Differential Revision: D9829462
    
    fbshipit-source-id: 15240a56e707e13775d57714646e4960cfe202df
Commits on Sep 14, 2018
  1. Bump metro@0.45.3

    rafeca authored and facebook-github-bot committed Sep 14, 2018
    Summary: This one gets rid of the dependency on `metro-visualizer`
    
    Reviewed By: mjesun
    
    Differential Revision: D9829876
    
    fbshipit-source-id: e3a52a2771bee386f8c1276004065fe480b3fc52
Commits on Sep 12, 2018
  1. Bump metro@0.45.2

    rafeca authored and facebook-github-bot committed Sep 12, 2018
    Summary: shipit
    
    Reviewed By: mjesun
    
    Differential Revision: D9788868
    
    fbshipit-source-id: c7bb4ca1cb67006cf53ccd1e003c4161cc7081ff
Commits on Sep 7, 2018
  1. Bump metro@0.45.1

    rafeca authored and facebook-github-bot committed Sep 6, 2018
    Summary:
    This version of metro contains experimental support for inlining import statements, which will unblock RAM bundling for opensource users that use imports, yay!!!
    
    Publishing as a minor version, since there are no breaking changes. This way, this will also be available already in RN 0.57, since it depends on Metro 0.57 (https://fburl.com/t2j2k2sw).
    
    /cc @[805780135:Eli White], @[1268286274:David Vacca], @[121800083:Héctor Ramos]
    
    Reviewed By: mjesun
    
    Differential Revision: D9682357
    
    fbshipit-source-id: ddd450649e55ee37701667cdff0e81165875e76d
Commits on Aug 30, 2018
  1. Bump metro@0.45.0

    rafeca authored and facebook-github-bot committed Aug 30, 2018
    Summary: shipitwithfiremissile
    
    Reviewed By: mjesun
    
    Differential Revision: D9558666
    
    fbshipit-source-id: 1e4102de3986832ae86f56e5d245e0a0b6c4fa17
  2. End metro server gracefully when there are some edge errors

    rafeca authored and facebook-github-bot committed Aug 30, 2018
    Summary: This diff fixes a couple of edge cases that caused Metro to keep the process running when there were some specific errors (specially around the `dependencies` command and the transformer path).
    
    Reviewed By: jrwats
    
    Differential Revision: D9551834
    
    fbshipit-source-id: 959cefcec9e2687dff89c94a871ae74c50d2dd77
Commits on Aug 29, 2018
  1. Upgrade to babel@7.0.0

    rafeca authored and facebook-github-bot committed Aug 29, 2018
    Summary: Now that babel7 is stable, we can upgrade Metro and fbsource to use it, yay!!!!!
    
    Reviewed By: mjesun
    
    Differential Revision: D9518571
    
    fbshipit-source-id: c85569cb3058235f4f9310949897f7955ecf7324
  2. Make the --transformer CLI argument override the babelTransformerPath

    rafeca authored and facebook-github-bot committed Aug 29, 2018
    Summary: D9070810 introduced a breaking change, making the `--transformer` CLI argument able to override the generic transformer instead of `babelTransformer`. Since we still have some scripts that assume `--transformer` is being used for overriding the babelTransformer path, we cannot do this breaking change yet, so this diff reverts the CLI handling to the old behaviour.
    
    Reviewed By: jrwats
    
    Differential Revision: D9550157
    
    fbshipit-source-id: 8b4e26fcb5bca6e4b2f63b1e1a014bce23a31452
Commits on Aug 28, 2018
  1. Bump metro@0.44.0

    rafeca authored and facebook-github-bot committed Aug 28, 2018
    Summary: shipit-splash
    
    Reviewed By: mjesun
    
    Differential Revision: D9504325
    
    fbshipit-source-id: 191f27ee33c1363f180b0c6c710f65096e139df1
Commits on Aug 23, 2018
  1. Expose the actual transformer in the config

    rafeca authored and facebook-github-bot committed Aug 23, 2018
    Summary:
    This diff exposes the new more generic way to configure transformers in `Metro` via the config parameter `transformerPath`.
    
    The new generic transformers can be used to transform any kind of file, since they don't call any JS-specific method and their API is generic. They only need to implement a single `transform` method:
    
    ```
    async function transform(
      absolutePath: string,
      relativePath: string,
      fileContents: Buffer,
      options: TransformOptions, // very soon these will be configurable
    ): Promise<{
      output: Array<mixed>,
      dependencies: Array<{
        name: string,
        data: mixed, // very soon
      }>,
    }> {
      // ...
    }
    ```
    
    Metro already had a `transformModulePath` config param, which was used to configure how babel was called in order to generate the AST. In order to avoid confusion, but keep the current open source transformer worker, I've renamed this param to `babelTransformerPath`. We can add a layer of compatibility and detect old config params in order to show a deprecation warning.
    
    Reviewed By: pvdz
    
    Differential Revision: D9070810
    
    fbshipit-source-id: aebde879736026c09537f5d236eae24c06640abf
  2. Standarize options passed to the transformer

    rafeca authored and facebook-github-bot committed Aug 23, 2018
    Summary:
    This is the first step to make transformers fully customizable (and not be tied to JS, or RN). In order to do that, I'm changing the signature of the transformers, which currently is:
    
    ```
    function transformCode(
      filename: string,
      localPath: LocalPath,
      transformerPath: string,
      options: WorkerOptions,
      assetExts: $ReadOnlyArray<string>,
      assetRegistryPath: string,
      minifierPath: string,
      asyncRequireModulePath: string,
      dynamicDepsInPackages: DynamicRequiresBehavior,
    )
    ```
    
    to be:
    
    ```
    async function transformCode(
      filename: string,
      localPath: LocalPath,
      options: WorkerOptions,
    )
    ```
    
    (so basically, all the RN-custom properties are moved to `WorkerOptions`, which in the future will be a generic to allow anybody pass any random option to their transformers).
    
    In order to make all this work, I've had to get rid of the logic that calculates the base cache key hash based on a subset of worker options (the ones that Metro knows that are not going to change between runs).
    
    This could potentially cause a perf regression (since we're now making the hash calculation a bit more costly), and in fact I could measure a ~400ms regression on the worse case scenario (which happens when restarting Metro and re-transforming a Wilde from a warm local cache).
    
    I've benchmarked this regression and could find that it's caused by the array of `assetExtensions` (which is potentially large). I have a followup diff to improve this, which is able to remove the regression completely.
    
    Reviewed By: pvdz
    
    Differential Revision: D8695766
    
    fbshipit-source-id: eccd18a4cbc91854f34d5c9ba7f95088f19483a1
  3. Fix default projectRoot + watchFolders computation

    rafeca authored and facebook-github-bot committed Aug 23, 2018
    Summary:
    @public
    
    This diff fixes the `projectRoot` calculation on React Native when the app does not have a config file. This should fix the issues reported in #20712
    
    Reviewed By: hramos
    
    Differential Revision: D9444982
    
    fbshipit-source-id: 4cb41fa5224d2addf92976cc119e49dea6a6346b
Commits on Aug 22, 2018
  1. Prevent cross origin requests to development server

    rafeca authored and facebook-github-bot committed Aug 22, 2018
    Summary:
    This diff adds a middleware to the RN development server to prevent processing requests coming from a third-party website.
    
    The way we choose to do it is to block any request that has an origin header and it's different than localhost. This will still allow simulators to work properly while blocking potential external websites to do malign CORS requests.
    
    This is just a first quick measure to block a potential attack vector while we implement full authentication in the RN development server
    
    Reviewed By: mjesun
    
    Differential Revision: D9238674
    
    fbshipit-source-id: b7bdc40dabc2f4d92f5ac84515f93b89efa4e833
Commits on Aug 13, 2018
  1. Fix passing the --reset-cache CLI argument to Metro

    rafeca authored and facebook-github-bot committed Aug 13, 2018
    Summary:
    @public
    
    While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: #20567 (comment)).
    
    This diff fixes this issue
    
    Reviewed By: mjesun
    
    Differential Revision: D9295634
    
    fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
Commits on Aug 2, 2018
  1. Bump metro@0.43.3

    rafeca authored and facebook-github-bot committed Aug 2, 2018
    Summary:
    This new release is going to contain 3 things:
    
    - Builtin TypeScript support
    - A fix on the traversal of dependencies
    - A fix on the way that RN loads the config file (@[100000044482482:ives] is working on the diff atm)
    
    Lots of things added in just 1 day! 😅
    
    Reviewed By: CompuIves
    
    Differential Revision: D9131710
    
    fbshipit-source-id: 6a5ec3b35f420d1a400611ce8e094a07807e3e44
Commits on Aug 1, 2018
  1. Bump metro@0.43.2

    rafeca authored and facebook-github-bot committed Aug 1, 2018
    Summary: shiptoasting
    
    Reviewed By: mjesun
    
    Differential Revision: D9116560
    
    fbshipit-source-id: 2688e8ea895199d3b2100fe69979afe37cbfecf3
Commits on Jul 20, 2018
  1. Bump metro@0.42.2

    rafeca authored and facebook-github-bot committed Jul 20, 2018
    Summary:
    shipit
    
    @public
    
    [skip-ci]
    
    Reviewed By: mjesun
    
    Differential Revision: D8931237
    
    fbshipit-source-id: db5bb09eb8ec01ae302cee16e4d6cb229f8244c9
Commits on Jul 17, 2018
  1. Fix hasteImpl path checks on Windows machines

    rafeca authored and facebook-github-bot committed Jul 17, 2018
    Summary:
    @public
    
    This fixes facebook/metro#181
    
    Reviewed By: mjesun
    
    Differential Revision: D8880071
    
    fbshipit-source-id: 27e232baa7f39a938af86de810ff5357f777e858
  2. Clean metro server correctly after bundle errors

    rafeca authored and facebook-github-bot committed Jul 17, 2018
    Summary:
    This is a very similar fix than D8858846, but done in the RN CLI (soon we'll be able to just call `Metro.runBuild()` from RN which will remove this duplication).
    
    This actually fixes the issues in the integtration tests (t31612131). It's just funny that two unrelated problems that are caused by the same issue located in two different places have been reported at the same time.
    
    Differential Revision: D8859276
    
    fbshipit-source-id: 805e111a406f2a7c1b3df3ab02accf4c4041a464
  3. Upgrade jest to 23.4.1

    rafeca authored and facebook-github-bot committed Jul 17, 2018
    Summary:
    This includes facebook/jest@8b8f5bc, which improves the watchman query to calculate the initial haste map to be much faster under Eden.
    
    **Time to initialize Metro after resetting jest-haste-map cache (Eden checkout)**
    
    * Before this diff: 3m14 (sometimes taking up to 15min!! after rebasing)
    * With this diff: 12s (quite constant after rebasing)
    
    (16X improvement)
    
    **Time to initialize Metro with a warm jest-haste-map cache (Eden checkout)**
    
    * Before this diff: 1.1s
    * With this diff: 1.1s
    
    (I haven't seen meaningful perf changes in non-eden checkouts)
    
    Reviewed By: mjesun
    
    Differential Revision: D8857820
    
    fbshipit-source-id: 5ce9da04a69bd02d121a8efe65bf369c7fa1e834