@highstate/backend 0.20.0 → 0.21.1

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.
@@ -1,12 +1,9 @@
1
- import z2, { z } from 'zod';
2
- import { mkdir } from 'node:fs/promises';
3
- import { basename, dirname, relative } from 'node:path';
4
- import { findWorkspaceDir, readPackageJSON, resolvePackageJSON } from 'pkg-types';
5
-
1
+ // @bun
6
2
  // src/common/utils.ts
3
+ import { z } from "zod";
7
4
  async function runWithRetryOnError(runner, tryHandleError, maxRetries = 1) {
8
5
  let lastError;
9
- for (let i = 0; i < maxRetries + 1; i++) {
6
+ for (let i = 0;i < maxRetries + 1; i++) {
10
7
  try {
11
8
  return await runner();
12
9
  } catch (e) {
@@ -19,12 +16,13 @@ async function runWithRetryOnError(runner, tryHandleError, maxRetries = 1) {
19
16
  }
20
17
  throw lastError;
21
18
  }
22
- var AbortError = class extends Error {
19
+
20
+ class AbortError extends Error {
23
21
  constructor(message, options) {
24
22
  super(message, options);
25
23
  this.name = "AbortError";
26
24
  }
27
- };
25
+ }
28
26
  function isAbortError(error) {
29
27
  return error instanceof Error && error.name === "AbortError";
30
28
  }
@@ -68,6 +66,12 @@ function waitForAbort(signal) {
68
66
  signal.addEventListener("abort", () => resolve(), { once: true });
69
67
  });
70
68
  }
69
+
70
+ // src/common/codebase.ts
71
+ import { mkdir } from "fs/promises";
72
+ import { dirname, relative } from "path";
73
+ import { resolvePackageJSON } from "pkg-types";
74
+ import z2 from "zod";
71
75
  var codebaseConfig = z2.object({
72
76
  HIGHSTATE_CODEBASE_PATH: z2.string().optional()
73
77
  });
@@ -103,6 +107,9 @@ async function getCodebaseHighstatePath(config, logger) {
103
107
  }
104
108
  return codebaseHighstatePath;
105
109
  }
110
+ // src/common/local.ts
111
+ import { basename } from "path";
112
+ import { findWorkspaceDir, readPackageJSON } from "pkg-types";
106
113
  async function resolveMainLocalProject(projectPath, projectName) {
107
114
  if (!projectPath) {
108
115
  projectPath = await findWorkspaceDir();
@@ -116,12 +123,10 @@ async function resolveMainLocalProject(projectPath, projectName) {
116
123
  }
117
124
  return [projectPath, projectName];
118
125
  }
119
-
120
126
  // src/common/logger.ts
121
127
  function createProjectLogger(logger, projectId) {
122
128
  return logger.child({ projectId }, { msgPrefix: `[project:${projectId}] ` });
123
129
  }
124
-
125
130
  // src/common/tree.ts
126
131
  function renderTree(node) {
127
132
  const lines = [];
@@ -138,9 +143,7 @@ function renderTree(node) {
138
143
  const isLastChild = index === node.children.length - 1;
139
144
  renderNode(child, "", isLastChild);
140
145
  });
141
- return lines.join("\n");
146
+ return lines.join(`
147
+ `);
142
148
  }
143
-
144
- export { AbortError, codebaseConfig, createProjectLogger, errorToString, getCodebaseHighstatePath, isAbortErrorLike, renderTree, resolveMainLocalProject, runWithRetryOnError, stringArrayType, waitForAbort };
145
- //# sourceMappingURL=chunk-X2WG3WGL.js.map
146
- //# sourceMappingURL=chunk-X2WG3WGL.js.map
149
+ export { codebaseConfig, getCodebaseHighstatePath, resolveMainLocalProject, createProjectLogger, renderTree, runWithRetryOnError, AbortError, isAbortErrorLike, stringArrayType, errorToString, waitForAbort };
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/index.js": 3789547484,
4
- "./dist/shared/index.js": 2294499872,
5
- "./dist/library/worker/main.js": 2646015988,
6
- "./dist/library/package-resolution-worker.js": 85224351
3
+ "./dist/index.js": 542555825,
4
+ "./dist/shared/index.js": 998634541,
5
+ "./dist/library/worker/main.js": 3821435996,
6
+ "./dist/library/package-resolution-worker.js": 704325585
7
7
  }
8
8
  }