MCPcopy Create free account
hub / github.com/facebook/memlab / loadCodeForUrl

Method loadCodeForUrl

packages/e2e/src/ScriptManager.ts:67–83  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

65 }
66
67 public loadCodeForUrl(url: string): Nullable<string> {
68 if (!this.urlToScriptMap.has(url)) {
69 return null;
70 }
71 const scriptInfo = this.urlToScriptMap.get(url) as ScriptInfo;
72 if (scriptInfo.code) {
73 return scriptInfo.code;
74 }
75 try {
76 scriptInfo.code = fs.readFileSync(scriptInfo.codePath, {
77 encoding: 'utf8',
78 });
79 } catch {
80 // do nothing
81 }
82 return scriptInfo.code ?? null;
83 }
84
85 public getClosureScopeTreeForUrl(url: string): Nullable<ClosureScope> {
86 const code = this.loadCodeForUrl(url);

Callers 2

displaySourceCodeFunction · 0.95

Calls 2

getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected