@stryke/capnp 0.10.4 → 0.10.5

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
@@ -210,6 +210,20 @@ function slash(path) {
210
210
  }
211
211
  __name(slash, "slash");
212
212
 
213
+ // ../path/src/is-file.ts
214
+ function isFile(path, additionalPath) {
215
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path) : path, {
216
+ throwIfNoEntry: false
217
+ })?.isFile());
218
+ }
219
+ __name(isFile, "isFile");
220
+ function isDirectory(path, additionalPath) {
221
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path) : path, {
222
+ throwIfNoEntry: false
223
+ })?.isDirectory());
224
+ }
225
+ __name(isDirectory, "isDirectory");
226
+
213
227
  // ../path/src/correct-path.ts
214
228
  function normalizeWindowsPath2(input = "") {
215
229
  if (!input) {
@@ -222,6 +236,99 @@ __name(normalizeWindowsPath2, "normalizeWindowsPath");
222
236
  // ../path/src/get-workspace-root.ts
223
237
  var import_config_tools = require("@storm-software/config-tools");
224
238
 
239
+ // ../path/src/get-parent-path.ts
240
+ var resolveParentPath = /* @__PURE__ */ __name((path, count = 1) => {
241
+ let parentPath = path.replaceAll(/\/+$/g, "");
242
+ for (let i = 0; i < count; i++) {
243
+ parentPath = joinPaths(parentPath, "..");
244
+ }
245
+ return parentPath;
246
+ }, "resolveParentPath");
247
+ var getParentPath = /* @__PURE__ */ __name((name, cwd, options) => {
248
+ const ignoreCase = options?.ignoreCase ?? true;
249
+ const skipCwd = options?.skipCwd ?? false;
250
+ const targetType = options?.targetType ?? "both";
251
+ let dir = cwd;
252
+ if (skipCwd) {
253
+ dir = resolveParentPath(cwd);
254
+ }
255
+ let names = Array.isArray(name) ? name : [
256
+ name
257
+ ];
258
+ if (ignoreCase) {
259
+ names = names.map((name2) => name2.toLowerCase());
260
+ }
261
+ while (true) {
262
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
263
+ if (target) {
264
+ return joinPaths(dir, target);
265
+ }
266
+ const parentDir = resolveParentPath(dir);
267
+ if (parentDir === dir) {
268
+ return void 0;
269
+ }
270
+ dir = parentDir;
271
+ }
272
+ }, "getParentPath");
273
+
274
+ // ../path/src/is-root-dir.ts
275
+ var isSystemRoot = /* @__PURE__ */ __name((dir) => {
276
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
277
+ }, "isSystemRoot");
278
+
279
+ // ../path/src/get-workspace-root.ts
280
+ var WORKSPACE_ROOT_CONTENT = [
281
+ "package-lock.json",
282
+ "yarn.lock",
283
+ "pnpm-lock.yaml",
284
+ "bun.lock",
285
+ "nx.json",
286
+ "knip.json",
287
+ "pnpm-workspace.yaml",
288
+ "LICENSE",
289
+ ".all-contributorsrc",
290
+ ".whitesource",
291
+ "syncpack.config.js",
292
+ "syncpack.json",
293
+ "socket.yaml",
294
+ "lefthook.yaml",
295
+ ".npmrc",
296
+ ".log4brains.yml",
297
+ ".huskyrc",
298
+ ".husky",
299
+ ".lintstagedrc",
300
+ ".commitlintrc",
301
+ "lefthook.yml",
302
+ ".github",
303
+ ".nx",
304
+ ".vscode",
305
+ "patches"
306
+ ];
307
+ function getWorkspaceRoot(dir = process.cwd()) {
308
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
309
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
310
+ }
311
+ const root = (0, import_config_tools.findWorkspaceRootSafe)(dir);
312
+ if (root) {
313
+ return root;
314
+ }
315
+ let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
316
+ if (result) {
317
+ return result;
318
+ }
319
+ result = dir;
320
+ while (result && !isSystemRoot(result)) {
321
+ result = getParentPath("storm-workspace.json", result, {
322
+ skipCwd: true
323
+ });
324
+ if (result) {
325
+ return result;
326
+ }
327
+ }
328
+ return dir;
329
+ }
330
+ __name(getWorkspaceRoot, "getWorkspaceRoot");
331
+
225
332
  // ../path/src/file-path-fns.ts
226
333
  function findFileName(filePath, options = {}) {
227
334
  const { requireExtension = false, withExtension = true } = options;
@@ -255,6 +362,20 @@ var import_promises5 = require("fs/promises");
255
362
  // src/compile.ts
256
363
  var import_console2 = require("@storm-software/config-tools/logger/console");
257
364
 
365
+ // ../path/src/is-parent-path.ts
366
+ function isParentPath(childPath, parentPath) {
367
+ const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
368
+ const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
369
+ return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
370
+ }
371
+ __name(isParentPath, "isParentPath");
372
+
373
+ // ../path/src/replace.ts
374
+ function replacePath(childPath, parentPath = process.cwd()) {
375
+ return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
376
+ }
377
+ __name(replacePath, "replacePath");
378
+
258
379
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
259
380
  var import_typescript = __toESM(require("typescript"), 1);
260
381
 
@@ -8008,7 +8129,7 @@ async function capnpc(options) {
8008
8129
  if (output) {
8009
8130
  if (!existsSync(output)) {
8010
8131
  (0, import_console2.writeWarning)(`Output directory "${output}" does not exist, it will be created...`);
8011
- await createDirectory(output);
8132
+ await createDirectory(replacePath(output, getWorkspaceRoot()));
8012
8133
  }
8013
8134
  opts.push(`-o-:${output}`);
8014
8135
  } else {
package/bin/capnpc.js CHANGED
@@ -179,6 +179,20 @@ function slash(path) {
179
179
  }
180
180
  __name(slash, "slash");
181
181
 
182
+ // ../path/src/is-file.ts
183
+ function isFile(path, additionalPath) {
184
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
185
+ throwIfNoEntry: false
186
+ })?.isFile());
187
+ }
188
+ __name(isFile, "isFile");
189
+ function isDirectory(path, additionalPath) {
190
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
191
+ throwIfNoEntry: false
192
+ })?.isDirectory());
193
+ }
194
+ __name(isDirectory, "isDirectory");
195
+
182
196
  // ../path/src/correct-path.ts
183
197
  function normalizeWindowsPath2(input = "") {
184
198
  if (!input) {
@@ -191,6 +205,99 @@ __name(normalizeWindowsPath2, "normalizeWindowsPath");
191
205
  // ../path/src/get-workspace-root.ts
192
206
  import { findWorkspaceRootSafe } from "@storm-software/config-tools";
193
207
 
208
+ // ../path/src/get-parent-path.ts
209
+ var resolveParentPath = /* @__PURE__ */ __name((path, count = 1) => {
210
+ let parentPath = path.replaceAll(/\/+$/g, "");
211
+ for (let i = 0; i < count; i++) {
212
+ parentPath = joinPaths(parentPath, "..");
213
+ }
214
+ return parentPath;
215
+ }, "resolveParentPath");
216
+ var getParentPath = /* @__PURE__ */ __name((name, cwd, options) => {
217
+ const ignoreCase = options?.ignoreCase ?? true;
218
+ const skipCwd = options?.skipCwd ?? false;
219
+ const targetType = options?.targetType ?? "both";
220
+ let dir = cwd;
221
+ if (skipCwd) {
222
+ dir = resolveParentPath(cwd);
223
+ }
224
+ let names = Array.isArray(name) ? name : [
225
+ name
226
+ ];
227
+ if (ignoreCase) {
228
+ names = names.map((name2) => name2.toLowerCase());
229
+ }
230
+ while (true) {
231
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
232
+ if (target) {
233
+ return joinPaths(dir, target);
234
+ }
235
+ const parentDir = resolveParentPath(dir);
236
+ if (parentDir === dir) {
237
+ return void 0;
238
+ }
239
+ dir = parentDir;
240
+ }
241
+ }, "getParentPath");
242
+
243
+ // ../path/src/is-root-dir.ts
244
+ var isSystemRoot = /* @__PURE__ */ __name((dir) => {
245
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
246
+ }, "isSystemRoot");
247
+
248
+ // ../path/src/get-workspace-root.ts
249
+ var WORKSPACE_ROOT_CONTENT = [
250
+ "package-lock.json",
251
+ "yarn.lock",
252
+ "pnpm-lock.yaml",
253
+ "bun.lock",
254
+ "nx.json",
255
+ "knip.json",
256
+ "pnpm-workspace.yaml",
257
+ "LICENSE",
258
+ ".all-contributorsrc",
259
+ ".whitesource",
260
+ "syncpack.config.js",
261
+ "syncpack.json",
262
+ "socket.yaml",
263
+ "lefthook.yaml",
264
+ ".npmrc",
265
+ ".log4brains.yml",
266
+ ".huskyrc",
267
+ ".husky",
268
+ ".lintstagedrc",
269
+ ".commitlintrc",
270
+ "lefthook.yml",
271
+ ".github",
272
+ ".nx",
273
+ ".vscode",
274
+ "patches"
275
+ ];
276
+ function getWorkspaceRoot(dir = process.cwd()) {
277
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
278
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
279
+ }
280
+ const root = findWorkspaceRootSafe(dir);
281
+ if (root) {
282
+ return root;
283
+ }
284
+ let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
285
+ if (result) {
286
+ return result;
287
+ }
288
+ result = dir;
289
+ while (result && !isSystemRoot(result)) {
290
+ result = getParentPath("storm-workspace.json", result, {
291
+ skipCwd: true
292
+ });
293
+ if (result) {
294
+ return result;
295
+ }
296
+ }
297
+ return dir;
298
+ }
299
+ __name(getWorkspaceRoot, "getWorkspaceRoot");
300
+
194
301
  // ../path/src/file-path-fns.ts
195
302
  function findFileName(filePath, options = {}) {
196
303
  const { requireExtension = false, withExtension = true } = options;
@@ -224,6 +331,20 @@ import { writeFile as writeFile2 } from "node:fs/promises";
224
331
  // src/compile.ts
225
332
  import { writeWarning as writeWarning2 } from "@storm-software/config-tools/logger/console";
226
333
 
334
+ // ../path/src/is-parent-path.ts
335
+ function isParentPath(childPath, parentPath) {
336
+ const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
337
+ const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
338
+ return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
339
+ }
340
+ __name(isParentPath, "isParentPath");
341
+
342
+ // ../path/src/replace.ts
343
+ function replacePath(childPath, parentPath = process.cwd()) {
344
+ return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
345
+ }
346
+ __name(replacePath, "replacePath");
347
+
227
348
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
228
349
  import ts from "typescript";
229
350
 
@@ -7977,7 +8098,7 @@ async function capnpc(options) {
7977
8098
  if (output) {
7978
8099
  if (!existsSync(output)) {
7979
8100
  writeWarning2(`Output directory "${output}" does not exist, it will be created...`);
7980
- await createDirectory(output);
8101
+ await createDirectory(replacePath(output, getWorkspaceRoot()));
7981
8102
  }
7982
8103
  opts.push(`-o-:${output}`);
7983
8104
  } else {
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  createDirectory,
3
3
  existsSync,
4
- resolveOptions
5
- } from "./chunk-4CXBQVXH.js";
4
+ getWorkspaceRoot,
5
+ resolveOptions,
6
+ slash
7
+ } from "./chunk-NKATTHKT.js";
6
8
  import {
7
9
  CompositeList,
8
10
  Message,
@@ -56,6 +58,20 @@ import {
56
58
  // src/compile.ts
57
59
  import { writeWarning } from "@storm-software/config-tools/logger/console";
58
60
 
61
+ // ../path/src/is-parent-path.ts
62
+ function isParentPath(childPath, parentPath) {
63
+ const normalizedChild = slash(childPath.replace(/\\/g, "/").replace(/\/$/, ""));
64
+ const normalizedParent = slash(parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
65
+ return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
66
+ }
67
+ __name(isParentPath, "isParentPath");
68
+
69
+ // ../path/src/replace.ts
70
+ function replacePath(childPath, parentPath = process.cwd()) {
71
+ return isParentPath(childPath, parentPath) ? slash(childPath).replace(slash(parentPath), "").replace(/^\//, "") : childPath;
72
+ }
73
+ __name(replacePath, "replacePath");
74
+
59
75
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
60
76
  import ts from "typescript";
61
77
 
@@ -4057,7 +4073,7 @@ async function capnpc(options) {
4057
4073
  if (output) {
4058
4074
  if (!existsSync(output)) {
4059
4075
  writeWarning(`Output directory "${output}" does not exist, it will be created...`);
4060
- await createDirectory(output);
4076
+ await createDirectory(replacePath(output, getWorkspaceRoot()));
4061
4077
  }
4062
4078
  opts.push(`-o-:${output}`);
4063
4079
  } else {
@@ -2,7 +2,9 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkZU4BKCAMcjs = require('./chunk-ZU4BKCAM.cjs');
5
+
6
+
7
+ var _chunkSH2ISQVRcjs = require('./chunk-SH2ISQVR.cjs');
6
8
 
7
9
 
8
10
 
@@ -56,6 +58,20 @@ var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
56
58
  // src/compile.ts
57
59
  var _console = require('@storm-software/config-tools/logger/console');
58
60
 
61
+ // ../path/src/is-parent-path.ts
62
+ function isParentPath(childPath, parentPath) {
63
+ const normalizedChild = _chunkSH2ISQVRcjs.slash.call(void 0, childPath.replace(/\\/g, "/").replace(/\/$/, ""));
64
+ const normalizedParent = _chunkSH2ISQVRcjs.slash.call(void 0, parentPath.replace(/\\/g, "/").replace(/\/$/, ""));
65
+ return normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
66
+ }
67
+ _chunkUSNT2KNTcjs.__name.call(void 0, isParentPath, "isParentPath");
68
+
69
+ // ../path/src/replace.ts
70
+ function replacePath(childPath, parentPath = process.cwd()) {
71
+ return isParentPath(childPath, parentPath) ? _chunkSH2ISQVRcjs.slash.call(void 0, childPath).replace(_chunkSH2ISQVRcjs.slash.call(void 0, parentPath), "").replace(/^\//, "") : childPath;
72
+ }
73
+ _chunkUSNT2KNTcjs.__name.call(void 0, replacePath, "replacePath");
74
+
59
75
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=503a440bd2bef41c0cb22819bc4ced5a7f04993fb999f0d944e284220f14916b_typescript@5.9.2/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
60
76
  var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
61
77
 
@@ -4055,9 +4071,9 @@ async function capnpc(options) {
4055
4071
  if (dataBuf.byteLength === 0) {
4056
4072
  const opts = [];
4057
4073
  if (output) {
4058
- if (!_chunkZU4BKCAMcjs.existsSync.call(void 0, output)) {
4074
+ if (!_chunkSH2ISQVRcjs.existsSync.call(void 0, output)) {
4059
4075
  _console.writeWarning.call(void 0, `Output directory "${output}" does not exist, it will be created...`);
4060
- await _chunkZU4BKCAMcjs.createDirectory.call(void 0, output);
4076
+ await _chunkSH2ISQVRcjs.createDirectory.call(void 0, replacePath(output, _chunkSH2ISQVRcjs.getWorkspaceRoot.call(void 0, )));
4061
4077
  }
4062
4078
  opts.push(`-o-:${output}`);
4063
4079
  } else {
@@ -4086,7 +4102,7 @@ async function capnpc(options) {
4086
4102
  }
4087
4103
  _chunkUSNT2KNTcjs.__name.call(void 0, capnpc, "capnpc");
4088
4104
  async function compile(dataBuf, options) {
4089
- const resolvedOptions = await _chunkZU4BKCAMcjs.resolveOptions.call(void 0, options);
4105
+ const resolvedOptions = await _chunkSH2ISQVRcjs.resolveOptions.call(void 0, options);
4090
4106
  if (!resolvedOptions) {
4091
4107
  _console.writeWarning.call(void 0, "\u2716 Unable to resolve Cap'n Proto compiler options - the program will terminate", {
4092
4108
  logLevel: "all"
@@ -735,6 +735,20 @@ function slash(path) {
735
735
  }
736
736
  __name(slash, "slash");
737
737
 
738
+ // ../path/src/is-file.ts
739
+ function isFile(path, additionalPath) {
740
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
741
+ throwIfNoEntry: false
742
+ })?.isFile());
743
+ }
744
+ __name(isFile, "isFile");
745
+ function isDirectory(path, additionalPath) {
746
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path) : path, {
747
+ throwIfNoEntry: false
748
+ })?.isDirectory());
749
+ }
750
+ __name(isDirectory, "isDirectory");
751
+
738
752
  // ../path/src/correct-path.ts
739
753
  function normalizeWindowsPath2(input = "") {
740
754
  if (!input) {
@@ -760,6 +774,99 @@ import { relative } from "node:path";
760
774
  // ../path/src/get-workspace-root.ts
761
775
  import { findWorkspaceRootSafe } from "@storm-software/config-tools";
762
776
 
777
+ // ../path/src/get-parent-path.ts
778
+ var resolveParentPath = /* @__PURE__ */ __name((path, count = 1) => {
779
+ let parentPath = path.replaceAll(/\/+$/g, "");
780
+ for (let i = 0; i < count; i++) {
781
+ parentPath = joinPaths(parentPath, "..");
782
+ }
783
+ return parentPath;
784
+ }, "resolveParentPath");
785
+ var getParentPath = /* @__PURE__ */ __name((name, cwd, options) => {
786
+ const ignoreCase = options?.ignoreCase ?? true;
787
+ const skipCwd = options?.skipCwd ?? false;
788
+ const targetType = options?.targetType ?? "both";
789
+ let dir = cwd;
790
+ if (skipCwd) {
791
+ dir = resolveParentPath(cwd);
792
+ }
793
+ let names = Array.isArray(name) ? name : [
794
+ name
795
+ ];
796
+ if (ignoreCase) {
797
+ names = names.map((name2) => name2.toLowerCase());
798
+ }
799
+ while (true) {
800
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
801
+ if (target) {
802
+ return joinPaths(dir, target);
803
+ }
804
+ const parentDir = resolveParentPath(dir);
805
+ if (parentDir === dir) {
806
+ return void 0;
807
+ }
808
+ dir = parentDir;
809
+ }
810
+ }, "getParentPath");
811
+
812
+ // ../path/src/is-root-dir.ts
813
+ var isSystemRoot = /* @__PURE__ */ __name((dir) => {
814
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
815
+ }, "isSystemRoot");
816
+
817
+ // ../path/src/get-workspace-root.ts
818
+ var WORKSPACE_ROOT_CONTENT = [
819
+ "package-lock.json",
820
+ "yarn.lock",
821
+ "pnpm-lock.yaml",
822
+ "bun.lock",
823
+ "nx.json",
824
+ "knip.json",
825
+ "pnpm-workspace.yaml",
826
+ "LICENSE",
827
+ ".all-contributorsrc",
828
+ ".whitesource",
829
+ "syncpack.config.js",
830
+ "syncpack.json",
831
+ "socket.yaml",
832
+ "lefthook.yaml",
833
+ ".npmrc",
834
+ ".log4brains.yml",
835
+ ".huskyrc",
836
+ ".husky",
837
+ ".lintstagedrc",
838
+ ".commitlintrc",
839
+ "lefthook.yml",
840
+ ".github",
841
+ ".nx",
842
+ ".vscode",
843
+ "patches"
844
+ ];
845
+ function getWorkspaceRoot(dir = process.cwd()) {
846
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
847
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
848
+ }
849
+ const root = findWorkspaceRootSafe(dir);
850
+ if (root) {
851
+ return root;
852
+ }
853
+ let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
854
+ if (result) {
855
+ return result;
856
+ }
857
+ result = dir;
858
+ while (result && !isSystemRoot(result)) {
859
+ result = getParentPath("storm-workspace.json", result, {
860
+ skipCwd: true
861
+ });
862
+ if (result) {
863
+ return result;
864
+ }
865
+ }
866
+ return dir;
867
+ }
868
+ __name(getWorkspaceRoot, "getWorkspaceRoot");
869
+
763
870
  // ../path/src/file-path-fns.ts
764
871
  function findFileName(filePath, options = {}) {
765
872
  const { requireExtension = false, withExtension = true } = options;
@@ -905,5 +1012,7 @@ __name(resolveOptions, "resolveOptions");
905
1012
  export {
906
1013
  existsSync2 as existsSync,
907
1014
  createDirectory,
1015
+ slash,
1016
+ getWorkspaceRoot,
908
1017
  resolveOptions
909
1018
  };
@@ -735,6 +735,20 @@ function slash(path) {
735
735
  }
736
736
  _chunkUSNT2KNTcjs.__name.call(void 0, slash, "slash");
737
737
 
738
+ // ../path/src/is-file.ts
739
+ function isFile(path, additionalPath) {
740
+ return Boolean(_optionalChain([_fs.statSync.call(void 0, additionalPath ? joinPaths(additionalPath, path) : path, {
741
+ throwIfNoEntry: false
742
+ }), 'optionalAccess', _13 => _13.isFile, 'call', _14 => _14()]));
743
+ }
744
+ _chunkUSNT2KNTcjs.__name.call(void 0, isFile, "isFile");
745
+ function isDirectory(path, additionalPath) {
746
+ return Boolean(_optionalChain([_fs.statSync.call(void 0, additionalPath ? joinPaths(additionalPath, path) : path, {
747
+ throwIfNoEntry: false
748
+ }), 'optionalAccess', _15 => _15.isDirectory, 'call', _16 => _16()]));
749
+ }
750
+ _chunkUSNT2KNTcjs.__name.call(void 0, isDirectory, "isDirectory");
751
+
738
752
  // ../path/src/correct-path.ts
739
753
  function normalizeWindowsPath2(input = "") {
740
754
  if (!input) {
@@ -760,10 +774,103 @@ var _path = require('path');
760
774
  // ../path/src/get-workspace-root.ts
761
775
  var _configtools = require('@storm-software/config-tools');
762
776
 
777
+ // ../path/src/get-parent-path.ts
778
+ var resolveParentPath = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (path, count = 1) => {
779
+ let parentPath = path.replaceAll(/\/+$/g, "");
780
+ for (let i = 0; i < count; i++) {
781
+ parentPath = joinPaths(parentPath, "..");
782
+ }
783
+ return parentPath;
784
+ }, "resolveParentPath");
785
+ var getParentPath = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (name, cwd, options) => {
786
+ const ignoreCase = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _17 => _17.ignoreCase]), () => ( true));
787
+ const skipCwd = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.skipCwd]), () => ( false));
788
+ const targetType = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.targetType]), () => ( "both"));
789
+ let dir = cwd;
790
+ if (skipCwd) {
791
+ dir = resolveParentPath(cwd);
792
+ }
793
+ let names = Array.isArray(name) ? name : [
794
+ name
795
+ ];
796
+ if (ignoreCase) {
797
+ names = names.map((name2) => name2.toLowerCase());
798
+ }
799
+ while (true) {
800
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
801
+ if (target) {
802
+ return joinPaths(dir, target);
803
+ }
804
+ const parentDir = resolveParentPath(dir);
805
+ if (parentDir === dir) {
806
+ return void 0;
807
+ }
808
+ dir = parentDir;
809
+ }
810
+ }, "getParentPath");
811
+
812
+ // ../path/src/is-root-dir.ts
813
+ var isSystemRoot = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (dir) => {
814
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
815
+ }, "isSystemRoot");
816
+
817
+ // ../path/src/get-workspace-root.ts
818
+ var WORKSPACE_ROOT_CONTENT = [
819
+ "package-lock.json",
820
+ "yarn.lock",
821
+ "pnpm-lock.yaml",
822
+ "bun.lock",
823
+ "nx.json",
824
+ "knip.json",
825
+ "pnpm-workspace.yaml",
826
+ "LICENSE",
827
+ ".all-contributorsrc",
828
+ ".whitesource",
829
+ "syncpack.config.js",
830
+ "syncpack.json",
831
+ "socket.yaml",
832
+ "lefthook.yaml",
833
+ ".npmrc",
834
+ ".log4brains.yml",
835
+ ".huskyrc",
836
+ ".husky",
837
+ ".lintstagedrc",
838
+ ".commitlintrc",
839
+ "lefthook.yml",
840
+ ".github",
841
+ ".nx",
842
+ ".vscode",
843
+ "patches"
844
+ ];
845
+ function getWorkspaceRoot(dir = process.cwd()) {
846
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
847
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
848
+ }
849
+ const root = _configtools.findWorkspaceRootSafe.call(void 0, dir);
850
+ if (root) {
851
+ return root;
852
+ }
853
+ let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);
854
+ if (result) {
855
+ return result;
856
+ }
857
+ result = dir;
858
+ while (result && !isSystemRoot(result)) {
859
+ result = getParentPath("storm-workspace.json", result, {
860
+ skipCwd: true
861
+ });
862
+ if (result) {
863
+ return result;
864
+ }
865
+ }
866
+ return dir;
867
+ }
868
+ _chunkUSNT2KNTcjs.__name.call(void 0, getWorkspaceRoot, "getWorkspaceRoot");
869
+
763
870
  // ../path/src/file-path-fns.ts
764
871
  function findFileName(filePath, options = {}) {
765
872
  const { requireExtension = false, withExtension = true } = options;
766
- const result = _nullishCoalesce(_optionalChain([normalizeWindowsPath2, 'call', _13 => _13(filePath), 'optionalAccess', _14 => _14.split, 'call', _15 => _15(_optionalChain([filePath, 'optionalAccess', _16 => _16.includes, 'call', _17 => _17("\\")]) ? "\\" : "/"), 'optionalAccess', _18 => _18.pop, 'call', _19 => _19()]), () => ( ""));
873
+ const result = _nullishCoalesce(_optionalChain([normalizeWindowsPath2, 'call', _20 => _20(filePath), 'optionalAccess', _21 => _21.split, 'call', _22 => _22(_optionalChain([filePath, 'optionalAccess', _23 => _23.includes, 'call', _24 => _24("\\")]) ? "\\" : "/"), 'optionalAccess', _25 => _25.pop, 'call', _26 => _26()]), () => ( ""));
767
874
  if (requireExtension === true && !result.includes(".")) {
768
875
  return EMPTY_STRING;
769
876
  }
@@ -836,7 +943,7 @@ async function listFiles(filesGlob, options) {
836
943
  const result = (await list(filesGlob, _defu2.default.call(void 0, {
837
944
  withFileTypes: true
838
945
  }, _nullishCoalesce(options, () => ( {}))))).filter((ret) => ret.isFile());
839
- if (!_optionalChain([options, 'optionalAccess', _20 => _20.withFileTypes])) {
946
+ if (!_optionalChain([options, 'optionalAccess', _27 => _27.withFileTypes])) {
840
947
  return result.map((file) => file.fullpath());
841
948
  }
842
949
  return result;
@@ -906,4 +1013,6 @@ _chunkUSNT2KNTcjs.__name.call(void 0, resolveOptions, "resolveOptions");
906
1013
 
907
1014
 
908
1015
 
909
- exports.existsSync = existsSync2; exports.createDirectory = createDirectory; exports.resolveOptions = resolveOptions;
1016
+
1017
+
1018
+ exports.existsSync = existsSync2; exports.createDirectory = createDirectory; exports.slash = slash; exports.getWorkspaceRoot = getWorkspaceRoot; exports.resolveOptions = resolveOptions;
package/dist/compile.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkIRIBPNFPcjs = require('./chunk-IRIBPNFP.cjs');
5
- require('./chunk-ZU4BKCAM.cjs');
4
+ var _chunkGTDJDX77cjs = require('./chunk-GTDJDX77.cjs');
5
+ require('./chunk-SH2ISQVR.cjs');
6
6
  require('./chunk-KXWOF6H4.cjs');
7
7
  require('./chunk-USNT2KNT.cjs');
8
8
 
9
9
 
10
10
 
11
- exports.capnpc = _chunkIRIBPNFPcjs.capnpc; exports.compile = _chunkIRIBPNFPcjs.compile;
11
+ exports.capnpc = _chunkGTDJDX77cjs.capnpc; exports.compile = _chunkGTDJDX77cjs.compile;