MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / getBundleSourcePath

Function getBundleSourcePath

Libraries/Image/resolveAssetSource.js:39–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39function 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
63function setCustomSourceTransformer(
64 transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource,

Callers 1

resolveAssetSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…