@highstate/backend 0.7.9 → 0.7.10
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/highstate.manifest.json +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/library/local.ts +2 -5
- package/src/project/local.ts +5 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"sourceHashes": {
|
3
|
-
"./dist/index.js": "
|
3
|
+
"./dist/index.js": "e5fc1ecef50b0c434ff63c631362ecbc196b32f1b7c0d92a16b1511df017ad6c",
|
4
4
|
"./dist/shared/index.js": "ce531a480a772514e20f94ec9116c98580dba419c8f5507bb85b6cef40a5c1ae",
|
5
5
|
"./dist/library/worker/main.js": "11bbed95f67a1756408bcbea93b87af1ed913ebbf7dbd35978027b0b3e219c05",
|
6
6
|
"./dist/library/package-resolution-worker.js": "4bfa368ad35a64c109df9e5a468c057791164760fe166c4eb5d9a889dee4d7bc"
|
package/dist/index.js
CHANGED
@@ -343,8 +343,8 @@ var LocalLibraryBackend = class _LocalLibraryBackend {
|
|
343
343
|
if (unit.source.package !== libraryPackage.name) {
|
344
344
|
continue;
|
345
345
|
}
|
346
|
-
const relativePath = unit.source.path ? `./dist/${unit.source.path}
|
347
|
-
const sourceHash = manifest?.sourceHashes?.[relativePath];
|
346
|
+
const relativePath = unit.source.path ? `./dist/${unit.source.path}` : `./dist`;
|
347
|
+
const sourceHash = manifest?.sourceHashes?.[`${relativePath}/index.js`];
|
348
348
|
if (!sourceHash) {
|
349
349
|
this.logger.warn(`source hash not found for unit: "%s"`, unit.type);
|
350
350
|
continue;
|
@@ -559,6 +559,7 @@ import { z as z5 } from "zod";
|
|
559
559
|
import {
|
560
560
|
getInstanceId
|
561
561
|
} from "@highstate/contract";
|
562
|
+
import { stringify, parse } from "yaml";
|
562
563
|
var localProjectBackendConfig = z5.object({
|
563
564
|
HIGHSTATE_BACKEND_PROJECT_PROJECTS_DIR: z5.string().optional()
|
564
565
|
});
|
@@ -573,7 +574,7 @@ var LocalProjectBackend = class _LocalProjectBackend {
|
|
573
574
|
async getProjectIds() {
|
574
575
|
try {
|
575
576
|
const files = await readdir(this.projectsDir);
|
576
|
-
return files.filter((file) => file.endsWith(".
|
577
|
+
return files.filter((file) => file.endsWith(".yaml")).map((file) => file.replace(/\.yaml$/, ""));
|
577
578
|
} catch (error) {
|
578
579
|
throw new Error("Failed to get project names", { cause: error });
|
579
580
|
}
|
@@ -810,13 +811,13 @@ var LocalProjectBackend = class _LocalProjectBackend {
|
|
810
811
|
}
|
811
812
|
}
|
812
813
|
getProjectPath(projectId) {
|
813
|
-
return `${this.projectsDir}/${projectId}.
|
814
|
+
return `${this.projectsDir}/${projectId}.yaml`;
|
814
815
|
}
|
815
816
|
async loadProject(projectId) {
|
816
817
|
const projectPath = this.getProjectPath(projectId);
|
817
818
|
try {
|
818
819
|
const content = await readFile2(projectPath, "utf-8");
|
819
|
-
return projectModelSchema.parse(
|
820
|
+
return projectModelSchema.parse(parse(content));
|
820
821
|
} catch (error) {
|
821
822
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
822
823
|
return { instances: {}, hubs: {} };
|
@@ -826,7 +827,7 @@ var LocalProjectBackend = class _LocalProjectBackend {
|
|
826
827
|
}
|
827
828
|
async writeProject(projectId, project) {
|
828
829
|
const projectPath = this.getProjectPath(projectId);
|
829
|
-
const content =
|
830
|
+
const content = stringify(project, void 0, 2);
|
830
831
|
await writeFile(projectPath, content);
|
831
832
|
}
|
832
833
|
async withInstance(projectId, instanceId, callback) {
|