mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 19:15:05 +00:00
Standarize options passed to the transformer
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
This commit is contained in:
parent
d0f0e8e248
commit
dd0900a03a
@ -54,6 +54,7 @@ module.exports = {
|
||||
ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
|
||||
dev: true,
|
||||
inlineRequires: true,
|
||||
minify: false,
|
||||
platform: '',
|
||||
projectRoot: '',
|
||||
retainLines: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user