agent-contracts 0.22.6 → 0.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +27 -12
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1247,7 +1247,7 @@ declare function mergeDsl(base: AnyRecord, project: AnyRecord): AnyRecord;
|
|
|
1247
1247
|
interface ResolveResult {
|
|
1248
1248
|
data: Record<string, unknown>;
|
|
1249
1249
|
projectPath: string;
|
|
1250
|
-
|
|
1250
|
+
basePaths: string[];
|
|
1251
1251
|
}
|
|
1252
1252
|
declare function resolve(projectDirOrFile: string): Promise<ResolveResult>;
|
|
1253
1253
|
|
package/dist/index.js
CHANGED
|
@@ -50090,24 +50090,39 @@ function mergeDsl(base, project) {
|
|
|
50090
50090
|
|
|
50091
50091
|
// src/resolver/resolve.ts
|
|
50092
50092
|
import { dirname as dirname2, resolve as resolvePath } from "path";
|
|
50093
|
-
async function
|
|
50094
|
-
const
|
|
50095
|
-
const projectResult = await loadDsl(absPath);
|
|
50096
|
-
const projectData = projectResult.data;
|
|
50097
|
-
const extendsValue = projectData["extends"];
|
|
50093
|
+
async function resolveExtendsChain(data, filePath, seen) {
|
|
50094
|
+
const extendsValue = data["extends"];
|
|
50098
50095
|
if (typeof extendsValue !== "string") {
|
|
50099
|
-
return {
|
|
50100
|
-
data: projectData,
|
|
50101
|
-
projectPath: projectResult.filePath
|
|
50102
|
-
};
|
|
50096
|
+
return { data, basePaths: [] };
|
|
50103
50097
|
}
|
|
50104
|
-
const projectDir = dirname2(
|
|
50098
|
+
const projectDir = dirname2(filePath);
|
|
50105
50099
|
const baseResult = await resolveBase(extendsValue, projectDir);
|
|
50106
|
-
const
|
|
50100
|
+
const basePath = baseResult.filePath;
|
|
50101
|
+
if (seen.has(basePath)) {
|
|
50102
|
+
throw new BaseResolveError(
|
|
50103
|
+
`Circular extends detected: ${basePath}`
|
|
50104
|
+
);
|
|
50105
|
+
}
|
|
50106
|
+
seen.add(basePath);
|
|
50107
|
+
const { data: resolvedBase, basePaths: ancestorPaths } = await resolveExtendsChain(baseResult.data, basePath, seen);
|
|
50108
|
+
const merged = mergeDsl(resolvedBase, data);
|
|
50107
50109
|
return {
|
|
50108
50110
|
data: merged,
|
|
50111
|
+
basePaths: [...ancestorPaths, basePath]
|
|
50112
|
+
};
|
|
50113
|
+
}
|
|
50114
|
+
async function resolve3(projectDirOrFile) {
|
|
50115
|
+
const absPath = resolvePath(projectDirOrFile);
|
|
50116
|
+
const projectResult = await loadDsl(absPath);
|
|
50117
|
+
const { data, basePaths } = await resolveExtendsChain(
|
|
50118
|
+
projectResult.data,
|
|
50119
|
+
projectResult.filePath,
|
|
50120
|
+
/* @__PURE__ */ new Set()
|
|
50121
|
+
);
|
|
50122
|
+
return {
|
|
50123
|
+
data,
|
|
50109
50124
|
projectPath: projectResult.filePath,
|
|
50110
|
-
|
|
50125
|
+
basePaths
|
|
50111
50126
|
};
|
|
50112
50127
|
}
|
|
50113
50128
|
|