()
| 37 | } |
| 38 | |
| 39 | function getBundleSourcePath(): ?string { |
| 40 | if (_bundleSourcePath === undefined) { |
| 41 | const scriptURL = NativeModules.SourceCode.scriptURL; |
| 42 | if (!scriptURL) { |
| 43 | // scriptURL is falsy, we have nothing to go on here |
| 44 | _bundleSourcePath = null; |
| 45 | return _bundleSourcePath; |
| 46 | } |
| 47 | if (scriptURL.startsWith('assets://')) { |
| 48 | // running from within assets, no offline path to use |
| 49 | _bundleSourcePath = null; |
| 50 | return _bundleSourcePath; |
| 51 | } |
| 52 | if (scriptURL.startsWith('file://')) { |
| 53 | // cut off the protocol |
| 54 | _bundleSourcePath = scriptURL.substring(7, scriptURL.lastIndexOf('/') + 1); |
| 55 | } else { |
| 56 | _bundleSourcePath = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return _bundleSourcePath; |
| 61 | } |
| 62 | |
| 63 | function setCustomSourceTransformer( |
| 64 | transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource, |
no outgoing calls
no test coverage detected
searching dependent graphs…