Commit Graph

982 Commits

Author SHA1 Message Date
Bhuwan Khattar 2939e942fa Random @providesModule related fixes
Reviewed By: jeanlauliac

Differential Revision: D4507885

fbshipit-source-id: 34d1a7be26febf7d93b65ba8fff635ab44e6459d
2017-02-06 08:04:36 -08:00
Jean Lauliac e04b3bf52e packager: reestablish changes reverted by d63f9c
Reviewed By: cpojer

Differential Revision: D4514889

fbshipit-source-id: de5d1350cbcea7a26395e532fefd78a816167b4a
2017-02-06 07:04:10 -08:00
Bhuwan Khattar 310c5d4163 Replace @provides with @providesModule
Reviewed By: davidaurelio

Differential Revision: D4494624

fbshipit-source-id: 192cc77126a99b3a3baeb806ed605c2194c4713a
2017-02-02 09:04:07 -08:00
Christoph Pojer 09797f281b Remove `react-packager` indirection.
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.

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

Reviewed By: jeanlauliac

Differential Revision: D4487867

fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
2017-02-02 05:34:12 -08:00
Jean Lauliac e1a131eb08 packager: JSTransform cleanup: remove options object
Summary: We can simplify as there's only one option, and it seems to me we can also make it required, as otherwise the `JSTransformer` is essentially doing nothing. I don't believe we still have use cases where no transform happens at all, even in OSS?

Reviewed By: davidaurelio

Differential Revision: D4481723

fbshipit-source-id: b2e3830b206d56242d298ff3a7b5f4587ecfd29a
2017-01-31 05:27:06 -08:00
Jean Lauliac 16fd44b3c0 packager: JSTransform cleanup: remove opts.methods
Summary: It's not used from any callsite as far as I can see.

Reviewed By: davidaurelio

Differential Revision: D4481708

fbshipit-source-id: 2c503fb7ef20f9370a950c315832f3ace4709739
2017-01-31 04:49:44 -08:00
Jean Lauliac 485dcb1e79 packager: JSTransform cleanup: remove opts.worker
Summary: it's not used from any callsite as far as I can see.

Reviewed By: davidaurelio

Differential Revision: D4481699

fbshipit-source-id: 4cf63ef7953d6cfc58e7ef4f22ecb99bf51e76a0
2017-01-31 04:49:43 -08:00
Jean Lauliac fd5933b63d packager: JSTransform cleanup: remove transformTimeoutInterval
Summary: It's not used in any callsite.

Reviewed By: cpojer

Differential Revision: D4481683

fbshipit-source-id: 3fa55693f5f56b4fb6c455ad77d7780f69be81a9
2017-01-31 04:49:43 -08:00
Jean Lauliac 0ebea9b5b5 packager: json reporter
Summary: The idea is to make it easier to interact with tools consuming the packager's output. For example, Nuclide. Do you think that'd work well?

Reviewed By: davidaurelio

Differential Revision: D4482041

fbshipit-source-id: 6c64d7963195a4d786ed8902640f9e9f279f5f83
2017-01-31 04:49:43 -08:00
Jean Lauliac 9577837f99 packager: simplify ScribeLogger-test
Reviewed By: cpojer

Differential Revision: D4481570

fbshipit-source-id: 27beae850806d8d7f526a3196b2962a18e514007
2017-01-31 04:49:43 -08:00
Jean Lauliac 00940db5d5 packager: add utilities to log errors internally
Reviewed By: davidaurelio

Differential Revision: D4468471

fbshipit-source-id: 10deb5014d06e4d3bb9d3122eef362c09f74d044
2017-01-31 04:49:43 -08:00
Jean Lauliac 94f1c6b34a packager: backticks for module names
Reviewed By: cpojer

Differential Revision: D4468850

fbshipit-source-id: 281064a81ff1262094711f4e800effcd17fb7e4d
2017-01-26 11:30:18 -08:00
Jean Lauliac 7883debebc packager: remove rogue terminal.log()
Reviewed By: cpojer

Differential Revision: D4468825

fbshipit-source-id: 29320f50cabc6002401e470a9ac278e9cb6673d3
2017-01-26 11:30:18 -08:00
Jean Lauliac ec5cd2a59a packager: add BatchProcessor-test
Reviewed By: davidaurelio

Differential Revision: D4468735

fbshipit-source-id: 8d20b44ef20aa24e72cd53182dbc34139a10df41
2017-01-26 11:30:18 -08:00
cpojer a35016bd49 Merge branch 'master' of ../react-native 2017-01-26 13:33:56 +00:00
cpojer 3f0b26916e Move 2017-01-26 13:31:04 +00:00
cpojer f8eda9b735 Initial repository structure. 2017-01-26 12:56:40 +00:00
Jean Lauliac c227d162ef packager: server/runServer.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4462611

fbshipit-source-id: 22f4cc299e2a30fe260dbe8d4c67323ceb8178e8
2017-01-26 03:43:33 -08:00
Jean Lauliac 735e50efc4 packager: server/server.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4462520

fbshipit-source-id: dc08aef691a78acb571a4da8038343184019d09f
2017-01-26 03:43:33 -08:00
Jean Lauliac 30f915e818 Backed out changeset 35b573bece59
Reviewed By: davidaurelio

Differential Revision: D4461681

fbshipit-source-id: f5c45f713f2fe68443986a2822aa325b01dd5075
2017-01-26 03:43:33 -08:00
Liu Zhanhong 795c1d5148 Sync with Resolver/polyfills/require.js
Summary:
I don't know which version is better, but it should sync with `Resolver/polyfills/require.js: 168`
```js
    // keep args in sync with with defineModuleCode in
    // packager/react-packager/src/Resolver/index.js
    // and packager/react-packager/src/ModuleGraph/worker.js
    factory(global, require, moduleObject, exports, dependencyMap);
```
Closes https://github.com/facebook/react-native/pull/12033

Differential Revision: D4461635

Pulled By: davidaurelio

fbshipit-source-id: 1a17e6cbac5525dc09609b658bef82a23574b00c
2017-01-25 03:58:30 -08:00
Jing Chen cbc808dc86 Revert stacked revisions on packager that causes packager to instacrash
Reviewed By: fkgozali, bestander

Differential Revision: D4456911

fbshipit-source-id: 35b573bece59c59c0700ef2d8ab26c0b7150d3cf
2017-01-24 11:43:36 -08:00
David Aurelio f6e068bcf0 Add tests for source map generator
Summary: This adds test for our high-perf source map generator.

Reviewed By: cpojer

Differential Revision: D4455547

fbshipit-source-id: 293bfe09c9c020259ae3daa4fa52f829248cca3c
2017-01-24 08:58:42 -08:00
Jean Lauliac 7eef41bc00 packager: extract BatchProcessor module
Reviewed By: davidaurelio

Differential Revision: D4449820

fbshipit-source-id: f54e6dd53ba4d211694e0bdc955af846d25778b8
2017-01-24 03:43:36 -08:00
Jean Lauliac 83ed3acc58 packager: move error handling from Module to GlobalTransformCache
Reviewed By: davidaurelio

Differential Revision: D4449685

fbshipit-source-id: 4f57cfe132036f476e36933bd2ffcb9f23c42ccc
2017-01-24 03:43:36 -08:00
Jean Lauliac 3a98e93069 packager: GlobalTransformCache: remove global variable
Reviewed By: davidaurelio

Differential Revision: D4449333

fbshipit-source-id: b9546b90d2fd5ddca9c1ee2719c6c454b60bdfa4
2017-01-24 03:43:36 -08:00
David Aurelio d728fa4ec1 add tests
Summary: Tests for things introduced over the last 10 weeks

Reviewed By: cpojer

Differential Revision: D4442404

fbshipit-source-id: cf7a14f237360fde083b7e2ffcd9d70aafd0ced6
2017-01-23 03:58:24 -08:00
Radek Czemerys 673b1713f3 Fix typo in ResolutionRequest.js
Summary:
Small fix:
Fix typo in error message - should be `npm start --reset-cache`
Closes https://github.com/facebook/react-native/pull/11983

Reviewed By: AsyncDBConnMarkedDownDBException

Differential Revision: D4443749

Pulled By: hramos

fbshipit-source-id: eeaa531180c58a85df482fe3162b2a0b2169c891
2017-01-20 17:43:27 -08:00
David Aurelio a9a2ac3d17 amend babel definitions to allow inline plugins without configuration
Summary: Updates babel flow defs to allow for inline plugins without configuration arguments.

Reviewed By: jeanlauliac

Differential Revision: D4442217

fbshipit-source-id: 1b4392bf13977d97984c72cff65b28e62f602300
2017-01-20 10:43:29 -08:00
David Aurelio 8139d2a602 Even faster source map generation
Summary:
This replaces a polymorphic method with three separate methods that support the different used invocations.

In isolation, this leads to a 25% speedup.

Shoutout to trueadm for teaching me about this.

Reviewed By: trueadm

Differential Revision: D4436781

fbshipit-source-id: 3dce83556debf19d5305c4566a56b9e9565e85bc
2017-01-20 07:13:26 -08:00
Gabe Levi ec6d380a7a Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Gabe Levi 78df7bd070 Deploy v0.38.0
Reviewed By: jeffmo

Differential Revision: D4428858

fbshipit-source-id: 10dc69349a2b563e1fa444a8b0612e3b2d4ccd1c
2017-01-18 11:13:30 -08:00
David Aurelio 279f11a344 Fix loading minified bundle over HTTP
Summary: Sets `generateSourceMaps` to true when requesting a bundle in non-dev mode or minified.

Reviewed By: bestander, cpojer

Differential Revision: D4415492

fbshipit-source-id: 9b4dcbd577a535dab143bb7a067210fbd831bf1a
2017-01-13 10:43:27 -08:00
David Aurelio c8962a1d9b Fix packager breakages on node4
Summary:
This fixes issues that only surface when running with node4 / npm2.
Closes https://github.com/facebook/react-native/pull/11888

Differential Revision: D4415021

Pulled By: bestander

fbshipit-source-id: 8672cd892c9dae41cc7b5b7b3227eb24dd780d22
2017-01-13 09:28:41 -08:00
Andrew Imm 66714e45da Allow project-specific config for RN CLI using providesModuleNodeModules
Reviewed By: davidaurelio

Differential Revision: D4409046

fbshipit-source-id: 5af0d08542935a784f4737653ccac49fd7517aff
2017-01-12 21:13:36 -08:00
David Aurelio ae6cd177de create better debuggable source maps
Summary:
Introduces a new mechanism to build source maps that allows us to use real mapping segments instead of just mapping line-by-line.

This mechanism is only used when building development bundles to improve the debugging experience in Chrome.

The new mechanism takes advantage of a new feature in babel-generator that exposes raw mapping objects. These raw mapping objects are converted to arrays with 2, 4, or 5 for the most compact representation possible.
We no longer generate a source map for the bundle that maps each line to itself in conjunction with configuring babel generator to retain lines.

Instead, we create a source map with a large mappings object produced from the mappings of each individual file in conjunction with a “carry over” – the number of preceding lines in the bundle.

The implementation makes a couple of assumptions that hold true for babel transform results, e.g. mappings being in the order of the generated code, and that a block of mappings always belongs to the same source file. In addition, the implementation avoids allocation of objects and strings at all costs. All calculations are purely numeric, and base64 vlq produces numeric ascii character codes. These are written to a preallocated buffer objects, which is turned to a string only at the end of the building process. This implementation is ~5x faster than using the source-map library.

In addition to providing development source maps that work better, we can now also produce individual high-quality source maps for production builds and combine them to an “index source map”. This approach is unfeasable for development source maps, because index source map consistently crash Chrome.

Better production source maps are useful to get precise information about source location and symbol names when symbolicating stack traces from crashes in production.

Reviewed By: jeanlauliac

Differential Revision: D4382290

fbshipit-source-id: 365a176fa142729d0a4cef43edeb81084361e54d
2017-01-12 14:28:41 -08:00
Jean Lauliac 48a7ede4d2 packager: do not try to fetch uncached files
Reviewed By: davidaurelio

Differential Revision: D4403623

fbshipit-source-id: 8319e6bac365fe5fcebefd4f338faf145f662ecb
2017-01-12 10:43:32 -08:00
David Aurelio b9307f21eb High-perf source map builder
Summary:
Adds a high performance source map builder that has certain restrictions compared to the `'source-map'` package:

- mappings have to be in the order of the generated source
- source files have to be started/ended separately on the generator. That means building up mappings is optimized for blocks of mappings that all belong to the same source file (or no file)

The implementation avoids allocation of complex value, i.e. strings and objects as much as possible by preallocating a buffer and using numeric character values throughout. The buffer is converted to a string only at the end.

This implementation is ~5✕ faster than using `'source-map'`.

Reviewed By: jeanlauliac

Differential Revision: D4392260

fbshipit-source-id: 406381302d951b919243a2b15e8bb75981e9f979
2017-01-09 11:43:28 -08:00
Jean Lauliac 5cdfc42c71 packager: socket timeout for global cache
Reviewed By: davidaurelio

Differential Revision: D4393059

fbshipit-source-id: 23c0c9ab69388ffd6de136d07728d44d1d8a947a
2017-01-09 11:13:32 -08:00
Jean Lauliac f6cf189037 packager: disable global cache stdout
Reviewed By: davidaurelio

Differential Revision: D4392486

fbshipit-source-id: bc1c33c781335b4af2d735596bbcdf7520312777
2017-01-09 10:13:33 -08:00
Jean Lauliac 455982d41c packager: create the reporter higher in the stack
Reviewed By: davidaurelio

Differential Revision: D4392283

fbshipit-source-id: 4cd470ca0cbddcbb515407b5249272a758849b82
2017-01-09 10:13:33 -08:00
Jean Lauliac 7b5d796953 packager: remove validateOpts for Bundler class
Reviewed By: davidaurelio, cpojer

Differential Revision: D4380831

fbshipit-source-id: e3b5b2c39e83bf0b49028820e0f17daef27d7b3c
2017-01-06 06:13:54 -08:00
Jean Lauliac 6eb417e69d packager: remove validateOpts for Server class
Summary: Remove the validateOpts() that prevents full Flow typing. In turn, having full Flow typing will allow us to remove 'defaults' across the codebase, that are source of inconsistencies.

Reviewed By: davidaurelio, cpojer

Differential Revision: D4377823

fbshipit-source-id: 8bb0a6b5069de64a9bb9d63892cd08854da91777
2017-01-06 06:13:54 -08:00
Jean Lauliac fbfc52c832 packager: enable @flow in react-packager/index.js
Reviewed By: cpojer

Differential Revision: D4377411

fbshipit-source-id: 300d239d8e2818f0488549feafc98fd3451e452d
2017-01-06 06:13:54 -08:00
Jean Lauliac 8adb91f7e2 packager: centralize babelRegisterOnly callsites
Reviewed By: davidaurelio

Differential Revision: D4380987

fbshipit-source-id: db34e56b2025fb072798ef2cc3e52f3d1cb7c33c
2017-01-06 06:13:54 -08:00
Chris Hopman 2165eedb71 Add --sourcemap-sources-root to RN packager
Reviewed By: davidaurelio

Differential Revision: D4357122

fbshipit-source-id: dc19474aa54ea4684a6b1c586a9d1e5da0980327
2017-01-04 20:58:33 -08:00
David Aurelio ebf8731ae4 Revamp debug logging
Summary:
- Switch namespace prefix from `ReactNativePackager:` to `RNP:`
- Add logging for handled requests
- Log transform cache key
- Add logging for transform cache hits/misses

Reviewed By: jeanlauliac

Differential Revision: D4377867

fbshipit-source-id: 9ec2060432f8c5e68561d3fe8ec7127f76c4a081
2017-01-04 07:13:32 -08:00
David Aurelio 9d80ce2898 Use `version` from `packager/package.json` for cache key
Reviewed By: jeanlauliac

Differential Revision: D4380910

fbshipit-source-id: 25d980bdf46046c3d53a4b2e120fd86a5534af6a
2017-01-04 06:58:35 -08:00
Jean Lauliac 9676468f78 packager: enable @flow in node-haste types.js
Reviewed By: cpojer

Differential Revision: D4377132

fbshipit-source-id: 5a1c0fb34c85974135c326065fd0c54f44282286
2017-01-04 05:28:42 -08:00
Jean Lauliac 754e7015d9 packager: AssetModule: @flow
Reviewed By: cpojer

Differential Revision: D4377137

fbshipit-source-id: 991619c0a42319a3bb4bf28dab4dd0fe1a474def
2017-01-03 09:58:35 -08:00