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

Function findImportMetaResolve

src/javascript/imports.ts:94–105  ·  view source on GitHub ↗
(node: CallExpression)

Source from the content-addressed store, hash-verified

92 }
93
94 function findImportMetaResolve(node: CallExpression) {
95 const source = node.arguments[0];
96 if (!isImportMetaResolve(node) || !isStringLiteral(source)) return;
97 const name = decodeURI(getStringLiteralValue(source));
98 if (isPathImport(name)) {
99 const localPath = resolveLocalPath(path, name);
100 if (!localPath) throw syntaxError(`non-local import: ${name}`, node, input); // prettier-ignore
101 addImport({name: relativePath(path, localPath), type: "local", method: "resolve"});
102 } else {
103 addImport({name, type: "global", method: "resolve"});
104 }
105 }
106
107 return imports;
108}

Callers

nothing calls this directly

Calls 8

isImportMetaResolveFunction · 0.85
isStringLiteralFunction · 0.85
getStringLiteralValueFunction · 0.85
isPathImportFunction · 0.85
resolveLocalPathFunction · 0.85
syntaxErrorFunction · 0.85
addImportFunction · 0.85
relativePathFunction · 0.85

Tested by

no test coverage detected