MCPcopy Create free account
hub / github.com/observablehq/framework / CallExpression

Function CallExpression

src/javascript/transpile.ts:170–183  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

168 }
169 },
170 CallExpression(node) {
171 const source = node.arguments[0];
172 if (isImportMetaResolve(node) && isStringLiteral(source)) {
173 const value = getStringLiteralValue(source);
174 const resolution = isPathImport(value) && !isJavaScript(value) ? resolveFile(value) : resolveImport(value);
175 output.replaceLeft(
176 node.start,
177 node.end,
178 isPathImport(resolution)
179 ? `new URL(${JSON.stringify(resolution)}, location).href`
180 : JSON.stringify(resolution)
181 );
182 }
183 }
184 });
185}
186

Callers

nothing calls this directly

Calls 8

isImportMetaResolveFunction · 0.85
isStringLiteralFunction · 0.85
getStringLiteralValueFunction · 0.85
isPathImportFunction · 0.85
replaceLeftMethod · 0.80
isJavaScriptFunction · 0.70
resolveFileFunction · 0.50
resolveImportFunction · 0.50

Tested by

no test coverage detected