MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / resolveImportUri

Function resolveImportUri

packages/language/src/utils.ts:512–520  ·  view source on GitHub ↗
(imp: ModelImport)

Source from the content-addressed store, hash-verified

510 * Returns `undefined` if the import cannot be resolved.
511 */
512export function resolveImportUri(imp: ModelImport) {
513 if (!imp.path) {
514 return undefined;
515 }
516 const doc = AstUtils.getDocument(imp);
517 const dir = path.dirname(doc.uri.fsPath);
518 const importPath = imp.path.endsWith('.zmodel') ? imp.path : `${imp.path}.zmodel`;
519 return URI.file(path.resolve(dir, importPath));
520}
521
522/**
523 * Gets data models and type defs in the ZModel schema.

Callers 1

resolveImportFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected