Build composable Camino packages with explicit type and source dependencies
This commit is contained in:
@@ -15,7 +15,7 @@ export type StructuralEdit =
|
||||
| { operation: "quixos-pin"; source: { repository: string; commit: string } }
|
||||
| {
|
||||
operation: "dependency";
|
||||
kind: "interface" | "package";
|
||||
kind: "interface" | "package" | "build";
|
||||
name: string;
|
||||
source: { repository: string; commit: string } | null;
|
||||
};
|
||||
@@ -29,6 +29,8 @@ const selectable = new Set([
|
||||
"packageResourceDecl",
|
||||
"atomDecl",
|
||||
"valueMember",
|
||||
"moduleMember",
|
||||
"moduleExport",
|
||||
"relationshipMember",
|
||||
"operationMember",
|
||||
"packageOperationExport",
|
||||
@@ -155,7 +157,7 @@ export const editStructure = (source: string, edit: StructuralEdit): string => {
|
||||
if (edit.operation === "dependency") {
|
||||
const parsed = parseQuixosLockDocument(source);
|
||||
if (!parsed.ok) throw new Error("Cannot scaffold an invalid lockfile");
|
||||
if (!["interface", "package"].includes(edit.kind) || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(edit.name))
|
||||
if (!["interface", "package", "build"].includes(edit.kind) || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(edit.name))
|
||||
throw new Error("Invalid dependency selector");
|
||||
const parser = new QuixosLockParser(new CommonTokenStream(new QuixosLockLexer(CharStream.fromString(source))));
|
||||
const tree = parser.document();
|
||||
|
||||
Reference in New Issue
Block a user