@stryke/capnp 0.11.0 → 0.11.2

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/bin/capnpc.cjs CHANGED
@@ -37,44 +37,67 @@ module.exports = __toCommonJS(capnpc_exports);
37
37
  var import_console3 = require("@storm-software/config-tools/logger/console");
38
38
  var import_utilities = require("@storm-software/config-tools/utilities");
39
39
 
40
- // ../path/src/exists.ts
40
+ // ../fs/src/exists.ts
41
41
  var import_node_fs = require("fs");
42
42
  var import_promises = require("fs/promises");
43
- var existsSync = /* @__PURE__ */ __name((filePath) => {
43
+ function existsSync(filePath) {
44
44
  return (0, import_node_fs.existsSync)(filePath);
45
- }, "existsSync");
45
+ }
46
+ __name(existsSync, "existsSync");
46
47
 
47
48
  // ../types/src/base.ts
48
49
  var EMPTY_STRING = "";
49
50
  var $NestedValue = Symbol("NestedValue");
50
51
 
51
- // ../path/src/file-path-fns.ts
52
- var import_node_path = require("path");
52
+ // ../path/src/cwd.ts
53
+ function cwd() {
54
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
55
+ return process.cwd().replace(/\\/g, "/");
56
+ }
57
+ return "/";
58
+ }
59
+ __name(cwd, "cwd");
53
60
 
54
- // ../path/src/is-file.ts
55
- var import_node_fs2 = require("fs");
61
+ // ../path/src/regex.ts
62
+ var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
63
+ var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
64
+ var UNC_REGEX = /^[/\\]{2}/;
65
+ var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
66
+ var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
67
+
68
+ // ../path/src/slash.ts
69
+ function slash(path) {
70
+ if (path.startsWith("\\\\?\\")) {
71
+ return path;
72
+ }
73
+ return path.replace(/\\/g, "/");
74
+ }
75
+ __name(slash, "slash");
76
+
77
+ // ../path/src/is-type.ts
78
+ function isAbsolutePath(path) {
79
+ return ABSOLUTE_PATH_REGEX.test(slash(path));
80
+ }
81
+ __name(isAbsolutePath, "isAbsolutePath");
82
+ function isAbsolute(path) {
83
+ return isAbsolutePath(path);
84
+ }
85
+ __name(isAbsolute, "isAbsolute");
56
86
 
57
87
  // ../path/src/join-paths.ts
58
- var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
59
88
  function normalizeWindowsPath(input = "") {
60
89
  if (!input) {
61
90
  return input;
62
91
  }
63
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
92
+ return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
64
93
  }
65
94
  __name(normalizeWindowsPath, "normalizeWindowsPath");
66
- var _UNC_REGEX = /^[/\\]{2}/;
67
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
68
- var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
69
- var isAbsolute = /* @__PURE__ */ __name(function(p) {
70
- return _IS_ABSOLUTE_RE.test(p);
71
- }, "isAbsolute");
72
- var correctPaths = /* @__PURE__ */ __name(function(path) {
95
+ function correctPaths(path) {
73
96
  if (!path || path.length === 0) {
74
97
  return ".";
75
98
  }
76
99
  path = normalizeWindowsPath(path);
77
- const isUNCPath = path.match(_UNC_REGEX);
100
+ const isUNCPath = path.match(UNC_REGEX);
78
101
  const isPathAbsolute = isAbsolute(path);
79
102
  const trailingSeparator = path[path.length - 1] === "/";
80
103
  path = normalizeString(path, !isPathAbsolute);
@@ -87,7 +110,7 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
87
110
  if (trailingSeparator) {
88
111
  path += "/";
89
112
  }
90
- if (_DRIVE_LETTER_RE.test(path)) {
113
+ if (DRIVE_LETTER_REGEX.test(path)) {
91
114
  path += "/";
92
115
  }
93
116
  if (isUNCPath) {
@@ -97,8 +120,9 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
97
120
  return `//${path}`;
98
121
  }
99
122
  return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
100
- }, "correctPaths");
101
- var joinPaths = /* @__PURE__ */ __name(function(...segments) {
123
+ }
124
+ __name(correctPaths, "correctPaths");
125
+ function joinPaths(...segments) {
102
126
  let path = "";
103
127
  for (const seg of segments) {
104
128
  if (!seg) {
@@ -118,7 +142,8 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
118
142
  }
119
143
  }
120
144
  return correctPaths(path);
121
- }, "joinPaths");
145
+ }
146
+ __name(joinPaths, "joinPaths");
122
147
  function normalizeString(path, allowAboveRoot) {
123
148
  let res = "";
124
149
  let lastSegmentLength = 0;
@@ -181,18 +206,6 @@ function normalizeString(path, allowAboveRoot) {
181
206
  }
182
207
  __name(normalizeString, "normalizeString");
183
208
 
184
- // ../path/src/regex.ts
185
- var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
186
-
187
- // ../path/src/slash.ts
188
- function slash(path) {
189
- if (path.startsWith("\\\\?\\")) {
190
- return path;
191
- }
192
- return path.replace(/\\/g, "/");
193
- }
194
- __name(slash, "slash");
195
-
196
209
  // ../path/src/correct-path.ts
197
210
  function normalizeWindowsPath2(input = "") {
198
211
  if (!input) {
@@ -201,9 +214,67 @@ function normalizeWindowsPath2(input = "") {
201
214
  return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
202
215
  }
203
216
  __name(normalizeWindowsPath2, "normalizeWindowsPath");
204
-
205
- // ../path/src/get-workspace-root.ts
206
- var import_config_tools = require("@storm-software/config-tools");
217
+ function normalizeString2(path, allowAboveRoot) {
218
+ let res = "";
219
+ let lastSegmentLength = 0;
220
+ let lastSlash = -1;
221
+ let dots = 0;
222
+ let char = null;
223
+ for (let index = 0; index <= path.length; ++index) {
224
+ if (index < path.length) {
225
+ char = path[index];
226
+ } else if (char === "/") {
227
+ break;
228
+ } else {
229
+ char = "/";
230
+ }
231
+ if (char === "/") {
232
+ if (lastSlash === index - 1 || dots === 1) {
233
+ } else if (dots === 2) {
234
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
235
+ if (res.length > 2) {
236
+ const lastSlashIndex = res.lastIndexOf("/");
237
+ if (lastSlashIndex === -1) {
238
+ res = "";
239
+ lastSegmentLength = 0;
240
+ } else {
241
+ res = res.slice(0, lastSlashIndex);
242
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
243
+ }
244
+ lastSlash = index;
245
+ dots = 0;
246
+ continue;
247
+ } else if (res.length > 0) {
248
+ res = "";
249
+ lastSegmentLength = 0;
250
+ lastSlash = index;
251
+ dots = 0;
252
+ continue;
253
+ }
254
+ }
255
+ if (allowAboveRoot) {
256
+ res += res.length > 0 ? "/.." : "..";
257
+ lastSegmentLength = 2;
258
+ }
259
+ } else {
260
+ if (res.length > 0) {
261
+ res += `/${path.slice(lastSlash + 1, index)}`;
262
+ } else {
263
+ res = path.slice(lastSlash + 1, index);
264
+ }
265
+ lastSegmentLength = index - lastSlash - 1;
266
+ }
267
+ lastSlash = index;
268
+ dots = 0;
269
+ } else if (char === "." && dots !== -1) {
270
+ ++dots;
271
+ } else {
272
+ dots = -1;
273
+ }
274
+ }
275
+ return res;
276
+ }
277
+ __name(normalizeString2, "normalizeString");
207
278
 
208
279
  // ../path/src/file-path-fns.ts
209
280
  function findFileName(filePath, options = {}) {
@@ -226,8 +297,49 @@ function findFilePath(filePath) {
226
297
  return result === "/" ? result : result.replace(/\/$/, "");
227
298
  }
228
299
  __name(findFilePath, "findFilePath");
300
+ function resolve(...paths) {
301
+ paths = paths.map((argument) => normalizeWindowsPath2(argument));
302
+ let resolvedPath = "";
303
+ let resolvedAbsolute = false;
304
+ for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
305
+ const path = index >= 0 ? paths[index] : cwd();
306
+ if (!path || path.length === 0) {
307
+ continue;
308
+ }
309
+ resolvedPath = `${path}/${resolvedPath}`;
310
+ resolvedAbsolute = isAbsolute(path);
311
+ }
312
+ resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
313
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
314
+ return `/${resolvedPath}`;
315
+ }
316
+ return resolvedPath.length > 0 ? resolvedPath : ".";
317
+ }
318
+ __name(resolve, "resolve");
319
+ function relative(from, to) {
320
+ const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
321
+ const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
322
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
323
+ return _to.join("/");
324
+ }
325
+ const _fromCopy = [
326
+ ..._from
327
+ ];
328
+ for (const segment of _fromCopy) {
329
+ if (_to[0] !== segment) {
330
+ break;
331
+ }
332
+ _from.shift();
333
+ _to.shift();
334
+ }
335
+ return [
336
+ ..._from.map(() => ".."),
337
+ ..._to
338
+ ].join("/");
339
+ }
340
+ __name(relative, "relative");
229
341
  function relativePath(from, to, withEndSlash = false) {
230
- return (0, import_node_path.relative)(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
342
+ return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
231
343
  }
232
344
  __name(relativePath, "relativePath");
233
345
 
@@ -7849,7 +7961,7 @@ var isError = /* @__PURE__ */ __name((obj) => {
7849
7961
  }, "isError");
7850
7962
 
7851
7963
  // ../fs/src/read-file.ts
7852
- var import_node_fs3 = require("fs");
7964
+ var import_node_fs2 = require("fs");
7853
7965
  var import_promises2 = require("fs/promises");
7854
7966
  var readFile = /* @__PURE__ */ __name(async (filePath) => {
7855
7967
  try {
@@ -7865,12 +7977,12 @@ var readFile = /* @__PURE__ */ __name(async (filePath) => {
7865
7977
  }, "readFile");
7866
7978
 
7867
7979
  // ../fs/src/write-file.ts
7868
- var import_node_fs5 = require("fs");
7980
+ var import_node_fs4 = require("fs");
7869
7981
  var import_promises4 = require("fs/promises");
7870
7982
 
7871
7983
  // ../fs/src/helpers.ts
7872
7984
  var import_nanotar = require("nanotar");
7873
- var import_node_fs4 = require("fs");
7985
+ var import_node_fs3 = require("fs");
7874
7986
  var import_promises3 = require("fs/promises");
7875
7987
 
7876
7988
  // ../fs/src/json.ts
@@ -7980,8 +8092,8 @@ async function capnpc(options) {
7980
8092
  process.stdin.on("data", (chunk) => {
7981
8093
  chunks.push(chunk);
7982
8094
  });
7983
- await new Promise((resolve) => {
7984
- process.stdin.on("end", resolve);
8095
+ await new Promise((resolve2) => {
8096
+ process.stdin.on("end", resolve2);
7985
8097
  });
7986
8098
  const reqBuffer = import_node_buffer2.Buffer.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
7987
8099
  let i = 0;
@@ -8001,7 +8113,7 @@ async function capnpc(options) {
8001
8113
  }
8002
8114
  opts.push("-o-");
8003
8115
  }
8004
- dataBuf = await new Promise((resolve) => {
8116
+ dataBuf = await new Promise((resolve2) => {
8005
8117
  (0, import_node_child_process.exec)(`capnpc ${opts.join(" ")} ${schemas.join(" ")}`, {
8006
8118
  encoding: "buffer"
8007
8119
  }, (error, stdout, stderr) => {
@@ -8011,7 +8123,7 @@ async function capnpc(options) {
8011
8123
  if (error) {
8012
8124
  throw error;
8013
8125
  }
8014
- resolve(stdout);
8126
+ resolve2(stdout);
8015
8127
  });
8016
8128
  });
8017
8129
  }
package/bin/capnpc.js CHANGED
@@ -4,46 +4,69 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
4
4
 
5
5
  // bin/capnpc.ts
6
6
  import { writeFatal as writeFatal2, writeInfo, writeSuccess, writeWarning as writeWarning3 } from "@storm-software/config-tools/logger/console";
7
- import { exitWithError, exitWithSuccess, findWorkspaceRootSafe as findWorkspaceRootSafe2, handleProcess } from "@storm-software/config-tools/utilities";
7
+ import { exitWithError, exitWithSuccess, findWorkspaceRootSafe, handleProcess } from "@storm-software/config-tools/utilities";
8
8
 
9
- // ../path/src/exists.ts
9
+ // ../fs/src/exists.ts
10
10
  import { existsSync as existsSyncFs } from "node:fs";
11
11
  import { access, constants } from "node:fs/promises";
12
- var existsSync = /* @__PURE__ */ __name((filePath) => {
12
+ function existsSync(filePath) {
13
13
  return existsSyncFs(filePath);
14
- }, "existsSync");
14
+ }
15
+ __name(existsSync, "existsSync");
15
16
 
16
17
  // ../types/src/base.ts
17
18
  var EMPTY_STRING = "";
18
19
  var $NestedValue = Symbol("NestedValue");
19
20
 
20
- // ../path/src/file-path-fns.ts
21
- import { relative } from "node:path";
21
+ // ../path/src/cwd.ts
22
+ function cwd() {
23
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
24
+ return process.cwd().replace(/\\/g, "/");
25
+ }
26
+ return "/";
27
+ }
28
+ __name(cwd, "cwd");
29
+
30
+ // ../path/src/regex.ts
31
+ var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
32
+ var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
33
+ var UNC_REGEX = /^[/\\]{2}/;
34
+ var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
35
+ var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
36
+
37
+ // ../path/src/slash.ts
38
+ function slash(path) {
39
+ if (path.startsWith("\\\\?\\")) {
40
+ return path;
41
+ }
42
+ return path.replace(/\\/g, "/");
43
+ }
44
+ __name(slash, "slash");
22
45
 
23
- // ../path/src/is-file.ts
24
- import { lstatSync, statSync } from "node:fs";
46
+ // ../path/src/is-type.ts
47
+ function isAbsolutePath(path) {
48
+ return ABSOLUTE_PATH_REGEX.test(slash(path));
49
+ }
50
+ __name(isAbsolutePath, "isAbsolutePath");
51
+ function isAbsolute(path) {
52
+ return isAbsolutePath(path);
53
+ }
54
+ __name(isAbsolute, "isAbsolute");
25
55
 
26
56
  // ../path/src/join-paths.ts
27
- var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
28
57
  function normalizeWindowsPath(input = "") {
29
58
  if (!input) {
30
59
  return input;
31
60
  }
32
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
61
+ return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
33
62
  }
34
63
  __name(normalizeWindowsPath, "normalizeWindowsPath");
35
- var _UNC_REGEX = /^[/\\]{2}/;
36
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
37
- var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
38
- var isAbsolute = /* @__PURE__ */ __name(function(p) {
39
- return _IS_ABSOLUTE_RE.test(p);
40
- }, "isAbsolute");
41
- var correctPaths = /* @__PURE__ */ __name(function(path) {
64
+ function correctPaths(path) {
42
65
  if (!path || path.length === 0) {
43
66
  return ".";
44
67
  }
45
68
  path = normalizeWindowsPath(path);
46
- const isUNCPath = path.match(_UNC_REGEX);
69
+ const isUNCPath = path.match(UNC_REGEX);
47
70
  const isPathAbsolute = isAbsolute(path);
48
71
  const trailingSeparator = path[path.length - 1] === "/";
49
72
  path = normalizeString(path, !isPathAbsolute);
@@ -56,7 +79,7 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
56
79
  if (trailingSeparator) {
57
80
  path += "/";
58
81
  }
59
- if (_DRIVE_LETTER_RE.test(path)) {
82
+ if (DRIVE_LETTER_REGEX.test(path)) {
60
83
  path += "/";
61
84
  }
62
85
  if (isUNCPath) {
@@ -66,8 +89,9 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
66
89
  return `//${path}`;
67
90
  }
68
91
  return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
69
- }, "correctPaths");
70
- var joinPaths = /* @__PURE__ */ __name(function(...segments) {
92
+ }
93
+ __name(correctPaths, "correctPaths");
94
+ function joinPaths(...segments) {
71
95
  let path = "";
72
96
  for (const seg of segments) {
73
97
  if (!seg) {
@@ -87,7 +111,8 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
87
111
  }
88
112
  }
89
113
  return correctPaths(path);
90
- }, "joinPaths");
114
+ }
115
+ __name(joinPaths, "joinPaths");
91
116
  function normalizeString(path, allowAboveRoot) {
92
117
  let res = "";
93
118
  let lastSegmentLength = 0;
@@ -150,18 +175,6 @@ function normalizeString(path, allowAboveRoot) {
150
175
  }
151
176
  __name(normalizeString, "normalizeString");
152
177
 
153
- // ../path/src/regex.ts
154
- var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
155
-
156
- // ../path/src/slash.ts
157
- function slash(path) {
158
- if (path.startsWith("\\\\?\\")) {
159
- return path;
160
- }
161
- return path.replace(/\\/g, "/");
162
- }
163
- __name(slash, "slash");
164
-
165
178
  // ../path/src/correct-path.ts
166
179
  function normalizeWindowsPath2(input = "") {
167
180
  if (!input) {
@@ -170,9 +183,67 @@ function normalizeWindowsPath2(input = "") {
170
183
  return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
171
184
  }
172
185
  __name(normalizeWindowsPath2, "normalizeWindowsPath");
173
-
174
- // ../path/src/get-workspace-root.ts
175
- import { findWorkspaceRootSafe } from "@storm-software/config-tools";
186
+ function normalizeString2(path, allowAboveRoot) {
187
+ let res = "";
188
+ let lastSegmentLength = 0;
189
+ let lastSlash = -1;
190
+ let dots = 0;
191
+ let char = null;
192
+ for (let index = 0; index <= path.length; ++index) {
193
+ if (index < path.length) {
194
+ char = path[index];
195
+ } else if (char === "/") {
196
+ break;
197
+ } else {
198
+ char = "/";
199
+ }
200
+ if (char === "/") {
201
+ if (lastSlash === index - 1 || dots === 1) {
202
+ } else if (dots === 2) {
203
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
204
+ if (res.length > 2) {
205
+ const lastSlashIndex = res.lastIndexOf("/");
206
+ if (lastSlashIndex === -1) {
207
+ res = "";
208
+ lastSegmentLength = 0;
209
+ } else {
210
+ res = res.slice(0, lastSlashIndex);
211
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
212
+ }
213
+ lastSlash = index;
214
+ dots = 0;
215
+ continue;
216
+ } else if (res.length > 0) {
217
+ res = "";
218
+ lastSegmentLength = 0;
219
+ lastSlash = index;
220
+ dots = 0;
221
+ continue;
222
+ }
223
+ }
224
+ if (allowAboveRoot) {
225
+ res += res.length > 0 ? "/.." : "..";
226
+ lastSegmentLength = 2;
227
+ }
228
+ } else {
229
+ if (res.length > 0) {
230
+ res += `/${path.slice(lastSlash + 1, index)}`;
231
+ } else {
232
+ res = path.slice(lastSlash + 1, index);
233
+ }
234
+ lastSegmentLength = index - lastSlash - 1;
235
+ }
236
+ lastSlash = index;
237
+ dots = 0;
238
+ } else if (char === "." && dots !== -1) {
239
+ ++dots;
240
+ } else {
241
+ dots = -1;
242
+ }
243
+ }
244
+ return res;
245
+ }
246
+ __name(normalizeString2, "normalizeString");
176
247
 
177
248
  // ../path/src/file-path-fns.ts
178
249
  function findFileName(filePath, options = {}) {
@@ -195,6 +266,47 @@ function findFilePath(filePath) {
195
266
  return result === "/" ? result : result.replace(/\/$/, "");
196
267
  }
197
268
  __name(findFilePath, "findFilePath");
269
+ function resolve(...paths) {
270
+ paths = paths.map((argument) => normalizeWindowsPath2(argument));
271
+ let resolvedPath = "";
272
+ let resolvedAbsolute = false;
273
+ for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
274
+ const path = index >= 0 ? paths[index] : cwd();
275
+ if (!path || path.length === 0) {
276
+ continue;
277
+ }
278
+ resolvedPath = `${path}/${resolvedPath}`;
279
+ resolvedAbsolute = isAbsolute(path);
280
+ }
281
+ resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
282
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
283
+ return `/${resolvedPath}`;
284
+ }
285
+ return resolvedPath.length > 0 ? resolvedPath : ".";
286
+ }
287
+ __name(resolve, "resolve");
288
+ function relative(from, to) {
289
+ const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
290
+ const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
291
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
292
+ return _to.join("/");
293
+ }
294
+ const _fromCopy = [
295
+ ..._from
296
+ ];
297
+ for (const segment of _fromCopy) {
298
+ if (_to[0] !== segment) {
299
+ break;
300
+ }
301
+ _from.shift();
302
+ _to.shift();
303
+ }
304
+ return [
305
+ ..._from.map(() => ".."),
306
+ ..._to
307
+ ].join("/");
308
+ }
309
+ __name(relative, "relative");
198
310
  function relativePath(from, to, withEndSlash = false) {
199
311
  return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
200
312
  }
@@ -7949,8 +8061,8 @@ async function capnpc(options) {
7949
8061
  process.stdin.on("data", (chunk) => {
7950
8062
  chunks.push(chunk);
7951
8063
  });
7952
- await new Promise((resolve) => {
7953
- process.stdin.on("end", resolve);
8064
+ await new Promise((resolve2) => {
8065
+ process.stdin.on("end", resolve2);
7954
8066
  });
7955
8067
  const reqBuffer = Buffer3.alloc(chunks.reduce((l, chunk) => l + chunk.byteLength, 0));
7956
8068
  let i = 0;
@@ -7970,7 +8082,7 @@ async function capnpc(options) {
7970
8082
  }
7971
8083
  opts.push("-o-");
7972
8084
  }
7973
- dataBuf = await new Promise((resolve) => {
8085
+ dataBuf = await new Promise((resolve2) => {
7974
8086
  exec(`capnpc ${opts.join(" ")} ${schemas.join(" ")}`, {
7975
8087
  encoding: "buffer"
7976
8088
  }, (error, stdout, stderr) => {
@@ -7980,7 +8092,7 @@ async function capnpc(options) {
7980
8092
  if (error) {
7981
8093
  throw error;
7982
8094
  }
7983
- resolve(stdout);
8095
+ resolve2(stdout);
7984
8096
  });
7985
8097
  });
7986
8098
  }
@@ -7998,7 +8110,7 @@ function createProgram() {
7998
8110
  writeInfo("\u26A1 Running Storm Cap'n Proto Compiler Tools", {
7999
8111
  logLevel: "all"
8000
8112
  });
8001
- const root = findWorkspaceRootSafe2(process.cwd());
8113
+ const root = findWorkspaceRootSafe(process.cwd());
8002
8114
  process.env.STORM_WORKSPACE_ROOT ??= root;
8003
8115
  process.env.NX_WORKSPACE_ROOT_PATH ??= root;
8004
8116
  if (root) {