@stryke/capnp 0.7.0 → 0.8.0

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
@@ -61,30 +61,6 @@ async function createDirectory(path) {
61
61
  }
62
62
  __name(createDirectory, "createDirectory");
63
63
 
64
- // ../fs/src/list-files.ts
65
- var import_defu = __toESM(require("defu"), 1);
66
- var import_glob = require("glob");
67
- var DEFAULT_OPTIONS = {
68
- dot: true
69
- };
70
- async function list(filesGlob, options) {
71
- return (0, import_glob.glob)(filesGlob, (0, import_defu.default)(options ?? {}, DEFAULT_OPTIONS));
72
- }
73
- __name(list, "list");
74
- async function listFiles(filesGlob, options) {
75
- const result = (await list(filesGlob, (0, import_defu.default)({
76
- withFileTypes: true
77
- }, options ?? {}))).filter((ret) => ret.isFile());
78
- if (!options?.withFileTypes) {
79
- return result.map((file) => file.fullpath());
80
- }
81
- return result;
82
- }
83
- __name(listFiles, "listFiles");
84
-
85
- // ../fs/src/read-file.ts
86
- var import_j_toml = require("@ltd/j-toml");
87
-
88
64
  // ../type-checks/src/get-object-tag.ts
89
65
  var getObjectTag = /* @__PURE__ */ __name((value) => {
90
66
  if (value == null) {
@@ -663,25 +639,6 @@ var readFile2 = /* @__PURE__ */ __name(async (filePath) => {
663
639
  throw new Error("An error occurred writing data to file");
664
640
  }
665
641
  }, "readFile");
666
- async function readJsonFile(path, options) {
667
- const content = await readFile2(path);
668
- if (options) {
669
- options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
670
- }
671
- try {
672
- return StormJSON.parseJson(content, options);
673
- } catch (error) {
674
- if (isError(error)) {
675
- error.message = error.message.replace("JSON", path);
676
- throw error;
677
- }
678
- throw new Error(`Failed to parse JSON: ${path}`);
679
- }
680
- }
681
- __name(readJsonFile, "readJsonFile");
682
-
683
- // ../path/src/file-path-fns.ts
684
- var import_node_path = require("path");
685
642
 
686
643
  // ../path/src/is-file.ts
687
644
  var import_node_fs4 = require("fs");
@@ -834,6 +791,9 @@ function normalizeWindowsPath2(input = "") {
834
791
  }
835
792
  __name(normalizeWindowsPath2, "normalizeWindowsPath");
836
793
 
794
+ // ../path/src/file-path-fns.ts
795
+ var import_node_path = require("path");
796
+
837
797
  // ../path/src/get-workspace-root.ts
838
798
  var import_config_tools = require("@storm-software/config-tools");
839
799
 
@@ -863,9 +823,52 @@ function relativePath(from, to, withEndSlash = false) {
863
823
  }
864
824
  __name(relativePath, "relativePath");
865
825
 
826
+ // ../fs/src/write-file.ts
827
+ var import_node_fs5 = require("fs");
828
+ var import_promises4 = require("fs/promises");
829
+
830
+ // ../fs/src/json.ts
831
+ async function readJsonFile(path, options) {
832
+ const content = await readFile2(path);
833
+ if (options) {
834
+ options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
835
+ }
836
+ try {
837
+ return StormJSON.parseJson(content, options);
838
+ } catch (error) {
839
+ if (isError(error)) {
840
+ error.message = error.message.replace("JSON", path);
841
+ throw error;
842
+ }
843
+ throw new Error(`Failed to parse JSON: ${path}`);
844
+ }
845
+ }
846
+ __name(readJsonFile, "readJsonFile");
847
+
848
+ // ../fs/src/list-files.ts
849
+ var import_defu = __toESM(require("defu"), 1);
850
+ var import_glob = require("glob");
851
+ var DEFAULT_OPTIONS = {
852
+ dot: true
853
+ };
854
+ async function list(filesGlob, options) {
855
+ return (0, import_glob.glob)(filesGlob, (0, import_defu.default)(options ?? {}, DEFAULT_OPTIONS));
856
+ }
857
+ __name(list, "list");
858
+ async function listFiles(filesGlob, options) {
859
+ const result = (await list(filesGlob, (0, import_defu.default)({
860
+ withFileTypes: true
861
+ }, options ?? {}))).filter((ret) => ret.isFile());
862
+ if (!options?.withFileTypes) {
863
+ return result.map((file) => file.fullpath());
864
+ }
865
+ return result;
866
+ }
867
+ __name(listFiles, "listFiles");
868
+
866
869
  // bin/capnpc.ts
867
870
  var import_commander = require("commander");
868
- var import_promises4 = require("fs/promises");
871
+ var import_promises5 = require("fs/promises");
869
872
  var import_typescript3 = __toESM(require("typescript"), 1);
870
873
 
871
874
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=824b6bae5f47936633f815d4ffa9019910937dad06e41df5249655046cadee7a_typescript@5.8.3/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
@@ -8074,7 +8077,7 @@ async function compileAction(options) {
8074
8077
  if (!existsSync(findFilePath(filePath))) {
8075
8078
  await createDirectory(findFilePath(filePath));
8076
8079
  }
8077
- await (0, import_promises4.writeFile)(
8080
+ await (0, import_promises5.writeFile)(
8078
8081
  filePath,
8079
8082
  // https://github.com/microsoft/TypeScript/issues/54632
8080
8083
  content.replace(/^\s+/gm, (match) => " ".repeat(match.length / 2))
package/bin/capnpc.js CHANGED
@@ -30,30 +30,6 @@ async function createDirectory(path) {
30
30
  }
31
31
  __name(createDirectory, "createDirectory");
32
32
 
33
- // ../fs/src/list-files.ts
34
- import defu from "defu";
35
- import { glob } from "glob";
36
- var DEFAULT_OPTIONS = {
37
- dot: true
38
- };
39
- async function list(filesGlob, options) {
40
- return glob(filesGlob, defu(options ?? {}, DEFAULT_OPTIONS));
41
- }
42
- __name(list, "list");
43
- async function listFiles(filesGlob, options) {
44
- const result = (await list(filesGlob, defu({
45
- withFileTypes: true
46
- }, options ?? {}))).filter((ret) => ret.isFile());
47
- if (!options?.withFileTypes) {
48
- return result.map((file) => file.fullpath());
49
- }
50
- return result;
51
- }
52
- __name(listFiles, "listFiles");
53
-
54
- // ../fs/src/read-file.ts
55
- import { parse as parseToml } from "@ltd/j-toml";
56
-
57
33
  // ../type-checks/src/get-object-tag.ts
58
34
  var getObjectTag = /* @__PURE__ */ __name((value) => {
59
35
  if (value == null) {
@@ -632,25 +608,6 @@ var readFile2 = /* @__PURE__ */ __name(async (filePath) => {
632
608
  throw new Error("An error occurred writing data to file");
633
609
  }
634
610
  }, "readFile");
635
- async function readJsonFile(path, options) {
636
- const content = await readFile2(path);
637
- if (options) {
638
- options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
639
- }
640
- try {
641
- return StormJSON.parseJson(content, options);
642
- } catch (error) {
643
- if (isError(error)) {
644
- error.message = error.message.replace("JSON", path);
645
- throw error;
646
- }
647
- throw new Error(`Failed to parse JSON: ${path}`);
648
- }
649
- }
650
- __name(readJsonFile, "readJsonFile");
651
-
652
- // ../path/src/file-path-fns.ts
653
- import { relative } from "node:path";
654
611
 
655
612
  // ../path/src/is-file.ts
656
613
  import { lstatSync, statSync } from "node:fs";
@@ -803,6 +760,9 @@ function normalizeWindowsPath2(input = "") {
803
760
  }
804
761
  __name(normalizeWindowsPath2, "normalizeWindowsPath");
805
762
 
763
+ // ../path/src/file-path-fns.ts
764
+ import { relative } from "node:path";
765
+
806
766
  // ../path/src/get-workspace-root.ts
807
767
  import { findWorkspaceRootSafe } from "@storm-software/config-tools";
808
768
 
@@ -832,9 +792,52 @@ function relativePath(from, to, withEndSlash = false) {
832
792
  }
833
793
  __name(relativePath, "relativePath");
834
794
 
795
+ // ../fs/src/write-file.ts
796
+ import { writeFileSync as writeFileSyncFs } from "node:fs";
797
+ import { writeFile as writeFileFs } from "node:fs/promises";
798
+
799
+ // ../fs/src/json.ts
800
+ async function readJsonFile(path, options) {
801
+ const content = await readFile2(path);
802
+ if (options) {
803
+ options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
804
+ }
805
+ try {
806
+ return StormJSON.parseJson(content, options);
807
+ } catch (error) {
808
+ if (isError(error)) {
809
+ error.message = error.message.replace("JSON", path);
810
+ throw error;
811
+ }
812
+ throw new Error(`Failed to parse JSON: ${path}`);
813
+ }
814
+ }
815
+ __name(readJsonFile, "readJsonFile");
816
+
817
+ // ../fs/src/list-files.ts
818
+ import defu from "defu";
819
+ import { glob } from "glob";
820
+ var DEFAULT_OPTIONS = {
821
+ dot: true
822
+ };
823
+ async function list(filesGlob, options) {
824
+ return glob(filesGlob, defu(options ?? {}, DEFAULT_OPTIONS));
825
+ }
826
+ __name(list, "list");
827
+ async function listFiles(filesGlob, options) {
828
+ const result = (await list(filesGlob, defu({
829
+ withFileTypes: true
830
+ }, options ?? {}))).filter((ret) => ret.isFile());
831
+ if (!options?.withFileTypes) {
832
+ return result.map((file) => file.fullpath());
833
+ }
834
+ return result;
835
+ }
836
+ __name(listFiles, "listFiles");
837
+
835
838
  // bin/capnpc.ts
836
839
  import { Command, Option } from "commander";
837
- import { writeFile } from "node:fs/promises";
840
+ import { writeFile as writeFile2 } from "node:fs/promises";
838
841
  import ts2 from "typescript";
839
842
 
840
843
  // ../../node_modules/.pnpm/capnp-es@0.0.11_patch_hash=824b6bae5f47936633f815d4ffa9019910937dad06e41df5249655046cadee7a_typescript@5.8.3/node_modules/capnp-es/dist/shared/capnp-es.CbTQkT9D.mjs
@@ -8043,7 +8046,7 @@ async function compileAction(options) {
8043
8046
  if (!existsSync(findFilePath(filePath))) {
8044
8047
  await createDirectory(findFilePath(filePath));
8045
8048
  }
8046
- await writeFile(
8049
+ await writeFile2(
8047
8050
  filePath,
8048
8051
  // https://github.com/microsoft/TypeScript/issues/54632
8049
8052
  content.replace(/^\s+/gm, (match) => " ".repeat(match.length / 2))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/capnp",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "A package to assist in running the Cap'n Proto compiler and creating Cap'n Proto serialization protocol schemas.",
6
6
  "repository": {
@@ -115,8 +115,8 @@
115
115
  "peerDependencies": { "typescript": ">=4.0.0" },
116
116
  "peerDependenciesMeta": { "typescript": { "optional": false } },
117
117
  "dependencies": {
118
- "@stryke/fs": "^0.20.7",
119
- "@stryke/path": "^0.7.6",
118
+ "@stryke/fs": "^0.21.0",
119
+ "@stryke/path": "^0.8.0",
120
120
  "hex2dec": "^1.1.2"
121
121
  },
122
122
  "devDependencies": {