spliterator 6.1.0 → 6.2.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.
Files changed (183) hide show
  1. package/README.md +18 -0
  2. package/out/index.d.ts +26 -25
  3. package/out/index.d.ts.map +1 -1
  4. package/out/index.js +26 -25
  5. package/out/index.js.map +1 -1
  6. package/out/lib/AsyncSpliterator.d.ts.map +1 -1
  7. package/out/lib/AsyncSpliterator.js +28 -0
  8. package/out/lib/AsyncSpliterator.js.map +1 -1
  9. package/out/lib/CharacterSequence.d.ts +16 -1
  10. package/out/lib/CharacterSequence.d.ts.map +1 -1
  11. package/out/lib/CharacterSequence.js +37 -0
  12. package/out/lib/CharacterSequence.js.map +1 -1
  13. package/out/lib/core/AsyncSpliterator.d.ts +227 -0
  14. package/out/lib/core/AsyncSpliterator.d.ts.map +1 -0
  15. package/out/lib/core/AsyncSpliterator.js +510 -0
  16. package/out/lib/core/AsyncSpliterator.js.map +1 -0
  17. package/out/lib/core/BufferController.d.ts +77 -0
  18. package/out/lib/core/BufferController.d.ts.map +1 -0
  19. package/out/lib/core/BufferController.js +118 -0
  20. package/out/lib/core/BufferController.js.map +1 -0
  21. package/out/lib/core/CharacterSequence.d.ts +72 -0
  22. package/out/lib/core/CharacterSequence.d.ts.map +1 -0
  23. package/out/lib/core/CharacterSequence.js +347 -0
  24. package/out/lib/core/CharacterSequence.js.map +1 -0
  25. package/out/lib/core/CompositeDataView.d.ts +111 -0
  26. package/out/lib/core/CompositeDataView.d.ts.map +1 -0
  27. package/out/lib/core/CompositeDataView.js +241 -0
  28. package/out/lib/core/CompositeDataView.js.map +1 -0
  29. package/out/lib/core/IndexQueue.d.ts +48 -0
  30. package/out/lib/core/IndexQueue.d.ts.map +1 -0
  31. package/out/lib/core/IndexQueue.js +111 -0
  32. package/out/lib/core/IndexQueue.js.map +1 -0
  33. package/out/lib/core/SlidingWindow.d.ts +47 -0
  34. package/out/lib/core/SlidingWindow.d.ts.map +1 -0
  35. package/out/lib/core/SlidingWindow.js +63 -0
  36. package/out/lib/core/SlidingWindow.js.map +1 -0
  37. package/out/lib/core/Spliterator.d.ts +96 -0
  38. package/out/lib/core/Spliterator.d.ts.map +1 -0
  39. package/out/lib/core/Spliterator.js +330 -0
  40. package/out/lib/core/Spliterator.js.map +1 -0
  41. package/out/lib/core/wasm_base64.d.ts +19 -0
  42. package/out/lib/core/wasm_base64.d.ts.map +1 -0
  43. package/out/lib/core/wasm_base64.js +19 -0
  44. package/out/lib/core/wasm_base64.js.map +1 -0
  45. package/out/lib/core/wasm_module.d.ts +57 -0
  46. package/out/lib/core/wasm_module.d.ts.map +1 -0
  47. package/out/lib/core/wasm_module.js +34 -0
  48. package/out/lib/core/wasm_module.js.map +1 -0
  49. package/out/lib/formats/CSVSpliterator.d.ts +131 -0
  50. package/out/lib/formats/CSVSpliterator.d.ts.map +1 -0
  51. package/out/lib/formats/CSVSpliterator.js +172 -0
  52. package/out/lib/formats/CSVSpliterator.js.map +1 -0
  53. package/out/lib/formats/JSONSpliterator.d.ts +44 -0
  54. package/out/lib/formats/JSONSpliterator.d.ts.map +1 -0
  55. package/out/lib/formats/JSONSpliterator.js +77 -0
  56. package/out/lib/formats/JSONSpliterator.js.map +1 -0
  57. package/out/lib/formats/PSVSpliterator.d.ts +21 -0
  58. package/out/lib/formats/PSVSpliterator.d.ts.map +1 -0
  59. package/out/lib/formats/PSVSpliterator.js +22 -0
  60. package/out/lib/formats/PSVSpliterator.js.map +1 -0
  61. package/out/lib/formats/TSVSpliterator.d.ts +21 -0
  62. package/out/lib/formats/TSVSpliterator.d.ts.map +1 -0
  63. package/out/lib/formats/TSVSpliterator.js +22 -0
  64. package/out/lib/formats/TSVSpliterator.js.map +1 -0
  65. package/out/lib/formats/TextSpliterator.d.ts +53 -0
  66. package/out/lib/formats/TextSpliterator.d.ts.map +1 -0
  67. package/out/lib/formats/TextSpliterator.js +67 -0
  68. package/out/lib/formats/TextSpliterator.js.map +1 -0
  69. package/out/lib/formats/XLSXSpliterator.d.ts +143 -0
  70. package/out/lib/formats/XLSXSpliterator.d.ts.map +1 -0
  71. package/out/lib/formats/XLSXSpliterator.js +161 -0
  72. package/out/lib/formats/XLSXSpliterator.js.map +1 -0
  73. package/out/lib/formats/casing.d.ts +27 -0
  74. package/out/lib/formats/casing.d.ts.map +1 -0
  75. package/out/lib/formats/casing.js +68 -0
  76. package/out/lib/formats/casing.js.map +1 -0
  77. package/out/lib/formats/row-emitters.d.ts +35 -0
  78. package/out/lib/formats/row-emitters.d.ts.map +1 -0
  79. package/out/lib/formats/row-emitters.js +50 -0
  80. package/out/lib/formats/row-emitters.js.map +1 -0
  81. package/out/lib/internal/shared.d.ts +155 -0
  82. package/out/lib/internal/shared.d.ts.map +1 -0
  83. package/out/lib/internal/shared.js +41 -0
  84. package/out/lib/internal/shared.js.map +1 -0
  85. package/out/lib/internal/utils.d.ts +37 -0
  86. package/out/lib/internal/utils.d.ts.map +1 -0
  87. package/out/lib/internal/utils.js +39 -0
  88. package/out/lib/internal/utils.js.map +1 -0
  89. package/out/lib/io/adaptive-source.d.ts +39 -0
  90. package/out/lib/io/adaptive-source.d.ts.map +1 -0
  91. package/out/lib/io/adaptive-source.js +95 -0
  92. package/out/lib/io/adaptive-source.js.map +1 -0
  93. package/out/lib/io/writer.d.ts +45 -0
  94. package/out/lib/io/writer.d.ts.map +1 -0
  95. package/out/lib/io/writer.js +57 -0
  96. package/out/lib/io/writer.js.map +1 -0
  97. package/out/lib/iterators/AsyncSequence.d.ts +180 -0
  98. package/out/lib/iterators/AsyncSequence.d.ts.map +1 -0
  99. package/out/lib/iterators/AsyncSequence.js +432 -0
  100. package/out/lib/iterators/AsyncSequence.js.map +1 -0
  101. package/out/lib/iterators/chunks.d.ts +20 -0
  102. package/out/lib/iterators/chunks.d.ts.map +1 -0
  103. package/out/lib/iterators/chunks.js +36 -0
  104. package/out/lib/iterators/chunks.js.map +1 -0
  105. package/out/lib/iterators/pivot.d.ts +30 -0
  106. package/out/lib/iterators/pivot.d.ts.map +1 -0
  107. package/out/lib/iterators/pivot.js +47 -0
  108. package/out/lib/iterators/pivot.js.map +1 -0
  109. package/out/lib/iterators/zip.d.ts +33 -0
  110. package/out/lib/iterators/zip.d.ts.map +1 -0
  111. package/out/lib/iterators/zip.js +59 -0
  112. package/out/lib/iterators/zip.js.map +1 -0
  113. package/out/lib/parallel/merge-async-iterators.d.ts +12 -0
  114. package/out/lib/parallel/merge-async-iterators.d.ts.map +1 -0
  115. package/out/lib/parallel/merge-async-iterators.js +39 -0
  116. package/out/lib/parallel/merge-async-iterators.js.map +1 -0
  117. package/out/lib/parallel/parallel-map-runtime.d.ts +22 -0
  118. package/out/lib/parallel/parallel-map-runtime.d.ts.map +1 -0
  119. package/out/lib/parallel/parallel-map-runtime.js +60 -0
  120. package/out/lib/parallel/parallel-map-runtime.js.map +1 -0
  121. package/out/lib/parallel/parallel-map-worker-entry.d.ts +11 -0
  122. package/out/lib/parallel/parallel-map-worker-entry.d.ts.map +1 -0
  123. package/out/lib/parallel/parallel-map-worker-entry.js +41 -0
  124. package/out/lib/parallel/parallel-map-worker-entry.js.map +1 -0
  125. package/out/lib/parallel/parallel-map-workers.d.ts +57 -0
  126. package/out/lib/parallel/parallel-map-workers.d.ts.map +1 -0
  127. package/out/lib/parallel/parallel-map-workers.js +82 -0
  128. package/out/lib/parallel/parallel-map-workers.js.map +1 -0
  129. package/out/lib/parallel/parallel-map.d.ts +28 -0
  130. package/out/lib/parallel/parallel-map.d.ts.map +1 -0
  131. package/out/lib/parallel/parallel-map.js +30 -0
  132. package/out/lib/parallel/parallel-map.js.map +1 -0
  133. package/out/lib/parallel/segment-runtime.d.ts +27 -0
  134. package/out/lib/parallel/segment-runtime.d.ts.map +1 -0
  135. package/out/lib/parallel/segment-runtime.js +41 -0
  136. package/out/lib/parallel/segment-runtime.js.map +1 -0
  137. package/out/lib/parallel/segment-worker-entry.d.ts +10 -0
  138. package/out/lib/parallel/segment-worker-entry.d.ts.map +1 -0
  139. package/out/lib/parallel/segment-worker-entry.js +59 -0
  140. package/out/lib/parallel/segment-worker-entry.js.map +1 -0
  141. package/out/lib/parallel/segment-workers.d.ts +56 -0
  142. package/out/lib/parallel/segment-workers.d.ts.map +1 -0
  143. package/out/lib/parallel/segment-workers.js +110 -0
  144. package/out/lib/parallel/segment-workers.js.map +1 -0
  145. package/out/lib/parallel/segments.d.ts +31 -0
  146. package/out/lib/parallel/segments.d.ts.map +1 -0
  147. package/out/lib/parallel/segments.js +52 -0
  148. package/out/lib/parallel/segments.js.map +1 -0
  149. package/out/lib/wasm_base64.d.ts +4 -1
  150. package/out/lib/wasm_base64.d.ts.map +1 -1
  151. package/out/lib/wasm_base64.js +4 -1
  152. package/out/lib/wasm_base64.js.map +1 -1
  153. package/out/lib/wasm_module.d.ts +15 -0
  154. package/out/lib/wasm_module.d.ts.map +1 -1
  155. package/out/lib/wasm_module.js +2 -1
  156. package/out/lib/wasm_module.js.map +1 -1
  157. package/out/node/cli/commands/csv.d.ts +113 -0
  158. package/out/node/cli/commands/csv.d.ts.map +1 -1
  159. package/out/node/cli/commands/csv.js +34 -36
  160. package/out/node/cli/commands/csv.js.map +1 -1
  161. package/out/node/cli/commands/iterate.d.ts +92 -0
  162. package/out/node/cli/commands/iterate.d.ts.map +1 -1
  163. package/out/node/cli/commands/iterate.js +26 -28
  164. package/out/node/cli/commands/iterate.js.map +1 -1
  165. package/out/node/cli/commands/parallel.d.ts +102 -0
  166. package/out/node/cli/commands/parallel.d.ts.map +1 -0
  167. package/out/node/cli/commands/parallel.js +426 -0
  168. package/out/node/cli/commands/parallel.js.map +1 -0
  169. package/out/node/cli/index.js +5 -0
  170. package/out/node/cli/index.js.map +1 -1
  171. package/out/node/cli/spec.d.ts +51 -0
  172. package/out/node/cli/spec.d.ts.map +1 -0
  173. package/out/node/cli/spec.js +78 -0
  174. package/out/node/cli/spec.js.map +1 -0
  175. package/out/node/cli/utils.d.ts +36 -18
  176. package/out/node/cli/utils.d.ts.map +1 -1
  177. package/out/node/cli/utils.js +48 -39
  178. package/out/node/cli/utils.js.map +1 -1
  179. package/out/node/fs/index.d.ts +1 -1
  180. package/out/node/fs/index.d.ts.map +1 -1
  181. package/out/node/fs/index.js +1 -1
  182. package/out/node/fs/index.js.map +1 -1
  183. package/package.json +6 -6
@@ -4,6 +4,119 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file Command to split a CSV file into JSONL format.
6
6
  */
7
+ export declare const spec: {
8
+ readonly name: "csv";
9
+ readonly usage: "csv [source] [destination] [options]";
10
+ readonly description: "Split a CSV file into JSONL format.";
11
+ readonly options: {
12
+ readonly split: {
13
+ readonly type: "string";
14
+ readonly short: "s";
15
+ readonly hint: "delimiter";
16
+ readonly default: "\n";
17
+ readonly description: "Delimiter to split lines on.";
18
+ };
19
+ readonly join: {
20
+ readonly type: "string";
21
+ readonly short: "j";
22
+ readonly hint: "delimiter";
23
+ readonly default: "\n";
24
+ readonly description: "Delimiter to join lines with.";
25
+ };
26
+ readonly "skip-empty": {
27
+ readonly type: "boolean";
28
+ readonly short: "e";
29
+ readonly default: true;
30
+ readonly description: "Skip empty lines.";
31
+ };
32
+ readonly take: {
33
+ readonly type: "number";
34
+ readonly short: "t";
35
+ readonly hint: "count";
36
+ readonly description: "Number of lines to take.";
37
+ readonly validate: (value: number) => boolean;
38
+ readonly validationMessage: "Option --take must be a non-negative integer.";
39
+ };
40
+ readonly drop: {
41
+ readonly type: "number";
42
+ readonly short: "p";
43
+ readonly hint: "count";
44
+ readonly default: 0;
45
+ readonly description: "Number of lines to drop.";
46
+ readonly validate: (value: number) => boolean;
47
+ readonly validationMessage: "Option --drop must be a non-negative integer.";
48
+ };
49
+ readonly debug: {
50
+ readonly type: "boolean";
51
+ readonly short: "v";
52
+ readonly default: false;
53
+ readonly description: "Enable debug logging.";
54
+ };
55
+ readonly "reader-high-water-mark": {
56
+ readonly type: "number";
57
+ readonly short: "w";
58
+ readonly hint: "bytes";
59
+ readonly default: number;
60
+ readonly description: "Input stream buffer size.";
61
+ readonly validate: (value: number) => boolean;
62
+ readonly validationMessage: "Option --reader-high-water-mark must be a positive integer.";
63
+ };
64
+ readonly "writer-high-water-mark": {
65
+ readonly type: "number";
66
+ readonly short: "W";
67
+ readonly hint: "bytes";
68
+ readonly default: number;
69
+ readonly description: "Output stream buffer size.";
70
+ readonly validate: (value: number) => boolean;
71
+ readonly validationMessage: "Option --writer-high-water-mark must be a positive integer.";
72
+ };
73
+ readonly filter: {
74
+ readonly type: "string";
75
+ readonly short: "f";
76
+ readonly hint: "path";
77
+ readonly description: "JS module exporting a default filter.";
78
+ };
79
+ readonly source: {
80
+ readonly type: "string";
81
+ readonly short: "i";
82
+ readonly hint: "path";
83
+ readonly description: "Source file, if not given positionally.";
84
+ };
85
+ readonly destination: {
86
+ readonly type: "string";
87
+ readonly short: "o";
88
+ readonly hint: "path";
89
+ readonly description: "Destination file, if not given positionally.";
90
+ };
91
+ readonly header: {
92
+ readonly type: "boolean";
93
+ readonly short: "H";
94
+ readonly default: true;
95
+ readonly description: "Treat the first row as a header.";
96
+ };
97
+ readonly transformers: {
98
+ readonly type: "string";
99
+ readonly short: "T";
100
+ readonly hint: "path";
101
+ readonly description: "JS module exporting transformer functions.";
102
+ };
103
+ readonly "column-delimiter": {
104
+ readonly type: "string";
105
+ readonly short: "c";
106
+ readonly hint: "delimiter";
107
+ readonly default: ",";
108
+ readonly description: "Delimiter to split columns on.";
109
+ };
110
+ readonly mode: {
111
+ readonly type: "string";
112
+ readonly short: "m";
113
+ readonly hint: "mode";
114
+ readonly choices: ["object", "array"];
115
+ readonly default: "object";
116
+ readonly description: "Output mode.";
117
+ };
118
+ };
119
+ };
7
120
  export declare const help: string;
8
121
  export declare function run(args: string[]): Promise<void>;
9
122
  //# sourceMappingURL=csv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../../node/cli/commands/csv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,eAAO,MAAM,IAAI,QAWL,CAAA;AAEZ,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EvD"}
1
+ {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../../node/cli/commands/csv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,eAAO,MAAM,IAAI;mBACV,KAAK;oBACJ,sCAAsC;0BAChC,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAGvC,IAAI,EAAE,SAAS;qBAAE,KAAK,EAAE,GAAG;qBAAE,OAAO;qBAAQ,WAAW,EAAE,kCAAkC;;;qBAEpG,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,GAAG;qBACV,IAAI,EAAE,MAAM;qBACZ,WAAW,EAAE,4CAA4C;;;qBAGzD,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,GAAG;qBACV,IAAI,EAAE,WAAW;qBACjB,OAAO,EAAE,GAAG;qBACZ,WAAW,EAAE,gCAAgC;;;qBAEtC,IAAI,EAAE,QAAQ;qBAAE,KAAK,EAAE,GAAG;qBAAE,IAAI,EAAE,MAAM;qBAAE,OAAO;qBAAS,OAAO,EAAE,QAAQ;qBAAE,WAAW,EAAE,cAAc;;;CAElF,CAAA;AAEhC,eAAO,MAAM,IAAI,QAA0B,CAAA;AAE3C,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DvD"}
@@ -5,55 +5,53 @@
5
5
  * @file Command to split a CSV file into JSONL format.
6
6
  */
7
7
  import { resolve as resolvePath } from "node:path";
8
- import { parseArgs } from "node:util";
9
8
  import { CharacterSequence, CSVSpliterator, } from "spliterator";
10
9
  import { createFileWritableStream, createReadStream } from "spliterator/node/fs";
11
- import { commonOptions, commonOptionsHelp, resolveIO, toNumber, usageError } from "../utils.js";
10
+ import { parseCommand, renderCommandHelp } from "../spec.js";
11
+ import { commonOptionSpecs, resolveIO } from "../utils.js";
12
12
  const MODES = ["object", "array"];
13
- export const help = [
14
- "Split a CSV file into JSONL format.",
15
- "",
16
- "Usage: spliterator csv [source] [destination] [options]",
17
- "",
18
- "Options:",
19
- commonOptionsHelp,
20
- " -H, --header Whether the CSV file has a header (default: true, disable with --no-header)",
21
- " -T, --transformers <path> Path to JS file exporting transformer functions",
22
- " -c, --column-delimiter <str> Delimiter to split columns on (default: ,)",
23
- ` -m, --mode <mode> Output mode: ${MODES.join(" | ")} (default: object)`,
24
- ].join("\n");
25
- export async function run(args) {
26
- const { values, positionals } = parseArgs({
27
- args,
28
- allowPositionals: true,
29
- allowNegative: true,
30
- options: {
31
- ...commonOptions,
32
- header: { type: "boolean", short: "H", default: true },
33
- transformers: { type: "string", short: "T" },
34
- "column-delimiter": { type: "string", short: "c", default: "," },
35
- mode: { type: "string", short: "m", default: "object" },
13
+ export const spec = {
14
+ name: "csv",
15
+ usage: "csv [source] [destination] [options]",
16
+ description: "Split a CSV file into JSONL format.",
17
+ options: {
18
+ ...commonOptionSpecs,
19
+ header: { type: "boolean", short: "H", default: true, description: "Treat the first row as a header." },
20
+ transformers: {
21
+ type: "string",
22
+ short: "T",
23
+ hint: "path",
24
+ description: "JS module exporting transformer functions.",
36
25
  },
37
- });
26
+ "column-delimiter": {
27
+ type: "string",
28
+ short: "c",
29
+ hint: "delimiter",
30
+ default: ",",
31
+ description: "Delimiter to split columns on.",
32
+ },
33
+ mode: { type: "string", short: "m", hint: "mode", choices: MODES, default: "object", description: "Output mode." },
34
+ },
35
+ };
36
+ export const help = renderCommandHelp(spec);
37
+ export async function run(args) {
38
+ const { values, positionals } = parseCommand(spec, args);
38
39
  if (values.help) {
39
40
  console.log(help);
40
41
  return;
41
42
  }
42
43
  const [source, destination] = resolveIO(positionals, values);
43
- if (!MODES.includes(values.mode)) {
44
- usageError(`Option --mode expects one of: ${MODES.join(", ")}.`);
45
- }
46
- const take = toNumber("take", values.take);
47
- const drop = toNumber("drop", values.drop);
48
- const readerHighWaterMark = toNumber("reader-high-water-mark", values["reader-high-water-mark"]);
49
- const writerHighWaterMark = toNumber("writer-high-water-mark", values["writer-high-water-mark"]);
44
+ const take = values.take;
45
+ const drop = values.drop;
46
+ const readerHighWaterMark = values["reader-high-water-mark"];
47
+ const writerHighWaterMark = values["writer-high-water-mark"];
50
48
  const joinDelimiter = new CharacterSequence(values.join).decode();
51
49
  let transformers = {};
52
- if (values.transformers) {
50
+ if (typeof values.transformers === "string") {
53
51
  transformers = await import(resolvePath(values.transformers));
54
52
  }
55
53
  let filter = () => true;
56
- if (values.filter) {
54
+ if (typeof values.filter === "string") {
57
55
  const module = await import(resolvePath(values.filter));
58
56
  filter = module.default;
59
57
  }
@@ -69,7 +67,7 @@ export async function run(args) {
69
67
  mode: values.mode,
70
68
  delimiter: values.split,
71
69
  autoDispose: true,
72
- header: values.header,
70
+ header: Boolean(values.header),
73
71
  transformers,
74
72
  columnDelimiter: values["column-delimiter"],
75
73
  take,
@@ -1 +1 @@
1
- {"version":3,"file":"csv.js","sourceRoot":"","sources":["../../../../node/cli/commands/csv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EACN,iBAAiB,EACjB,cAAc,GAKd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEhF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAA0B,MAAM,aAAa,CAAA;AAEvH,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAoC,CAAA;AAEpE,MAAM,CAAC,MAAM,IAAI,GAAG;IACn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Q;QAEnB,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;QACvC,MAAM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;AACrB,CAAC"}
@@ -4,6 +4,98 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file Default command — iterate over a file, line by line.
6
6
  */
7
+ export declare const spec: {
8
+ readonly name: "";
9
+ readonly usage: "[source] [destination] [options]";
10
+ readonly description: "Iterate over a file line by line, writing transformed output to a new file.";
11
+ readonly options: {
12
+ readonly split: {
13
+ readonly type: "string";
14
+ readonly short: "s";
15
+ readonly hint: "delimiter";
16
+ readonly default: "\n";
17
+ readonly description: "Delimiter to split lines on.";
18
+ };
19
+ readonly join: {
20
+ readonly type: "string";
21
+ readonly short: "j";
22
+ readonly hint: "delimiter";
23
+ readonly default: "\n";
24
+ readonly description: "Delimiter to join lines with.";
25
+ };
26
+ readonly "skip-empty": {
27
+ readonly type: "boolean";
28
+ readonly short: "e";
29
+ readonly default: true;
30
+ readonly description: "Skip empty lines.";
31
+ };
32
+ readonly take: {
33
+ readonly type: "number";
34
+ readonly short: "t";
35
+ readonly hint: "count";
36
+ readonly description: "Number of lines to take.";
37
+ readonly validate: (value: number) => boolean;
38
+ readonly validationMessage: "Option --take must be a non-negative integer.";
39
+ };
40
+ readonly drop: {
41
+ readonly type: "number";
42
+ readonly short: "p";
43
+ readonly hint: "count";
44
+ readonly default: 0;
45
+ readonly description: "Number of lines to drop.";
46
+ readonly validate: (value: number) => boolean;
47
+ readonly validationMessage: "Option --drop must be a non-negative integer.";
48
+ };
49
+ readonly debug: {
50
+ readonly type: "boolean";
51
+ readonly short: "v";
52
+ readonly default: false;
53
+ readonly description: "Enable debug logging.";
54
+ };
55
+ readonly "reader-high-water-mark": {
56
+ readonly type: "number";
57
+ readonly short: "w";
58
+ readonly hint: "bytes";
59
+ readonly default: number;
60
+ readonly description: "Input stream buffer size.";
61
+ readonly validate: (value: number) => boolean;
62
+ readonly validationMessage: "Option --reader-high-water-mark must be a positive integer.";
63
+ };
64
+ readonly "writer-high-water-mark": {
65
+ readonly type: "number";
66
+ readonly short: "W";
67
+ readonly hint: "bytes";
68
+ readonly default: number;
69
+ readonly description: "Output stream buffer size.";
70
+ readonly validate: (value: number) => boolean;
71
+ readonly validationMessage: "Option --writer-high-water-mark must be a positive integer.";
72
+ };
73
+ readonly filter: {
74
+ readonly type: "string";
75
+ readonly short: "f";
76
+ readonly hint: "path";
77
+ readonly description: "JS module exporting a default filter.";
78
+ };
79
+ readonly source: {
80
+ readonly type: "string";
81
+ readonly short: "i";
82
+ readonly hint: "path";
83
+ readonly description: "Source file, if not given positionally.";
84
+ };
85
+ readonly destination: {
86
+ readonly type: "string";
87
+ readonly short: "o";
88
+ readonly hint: "path";
89
+ readonly description: "Destination file, if not given positionally.";
90
+ };
91
+ readonly transformer: {
92
+ readonly type: "string";
93
+ readonly short: "T";
94
+ readonly hint: "path";
95
+ readonly description: "JS module exporting a default transformer.";
96
+ };
97
+ };
98
+ };
7
99
  export declare const help: string;
8
100
  export declare function run(args: string[]): Promise<void>;
9
101
  //# sourceMappingURL=iterate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterate.d.ts","sourceRoot":"","sources":["../../../../node/cli/commands/iterate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,eAAO,MAAM,IAAI,QAQL,CAAA;AAEZ,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEvD"}
1
+ {"version":3,"file":"iterate.d.ts","sourceRoot":"","sources":["../../../../node/cli/commands/iterate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH,eAAO,MAAM,IAAI;mBACV,EAAE;oBACD,kCAAkC;0BAC5B,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAIxF,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,GAAG;qBACV,IAAI,EAAE,MAAM;qBACZ,WAAW,EAAE,4CAA4C;;;CAG5B,CAAA;AAEhC,eAAO,MAAM,IAAI,QAA0B,CAAA;AAE3C,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DvD"}
@@ -5,46 +5,44 @@
5
5
  * @file Default command — iterate over a file, line by line.
6
6
  */
7
7
  import { resolve as resolvePath } from "node:path";
8
- import { parseArgs } from "node:util";
9
8
  import { CharacterSequence, Spliterator } from "spliterator";
10
9
  import { createFileWritableStream, createReadStream } from "spliterator/node/fs";
11
- import { commonOptions, commonOptionsHelp, resolveIO, toNumber, } from "../utils.js";
12
- export const help = [
13
- "Iterate over a file, line by line, writing the transformed output to a new file.",
14
- "",
15
- "Usage: spliterator [source] [destination] [options]",
16
- "",
17
- "Options:",
18
- commonOptionsHelp,
19
- " -T, --transformer <path> Path to JS file exporting a default transformer function",
20
- ].join("\n");
21
- export async function run(args) {
22
- const { values, positionals } = parseArgs({
23
- args,
24
- allowPositionals: true,
25
- allowNegative: true,
26
- options: {
27
- ...commonOptions,
28
- transformer: { type: "string", short: "T" },
10
+ import { parseCommand, renderCommandHelp } from "../spec.js";
11
+ import { commonOptionSpecs, resolveIO, } from "../utils.js";
12
+ export const spec = {
13
+ name: "",
14
+ usage: "[source] [destination] [options]",
15
+ description: "Iterate over a file line by line, writing transformed output to a new file.",
16
+ options: {
17
+ ...commonOptionSpecs,
18
+ transformer: {
19
+ type: "string",
20
+ short: "T",
21
+ hint: "path",
22
+ description: "JS module exporting a default transformer.",
29
23
  },
30
- });
24
+ },
25
+ };
26
+ export const help = renderCommandHelp(spec);
27
+ export async function run(args) {
28
+ const { values, positionals } = parseCommand(spec, args);
31
29
  if (values.help) {
32
30
  console.log(help);
33
31
  return;
34
32
  }
35
33
  const [source, destination] = resolveIO(positionals, values);
36
- const take = toNumber("take", values.take);
37
- const drop = toNumber("drop", values.drop);
38
- const readerHighWaterMark = toNumber("reader-high-water-mark", values["reader-high-water-mark"]);
39
- const writerHighWaterMark = toNumber("writer-high-water-mark", values["writer-high-water-mark"]);
34
+ const take = values.take;
35
+ const drop = values.drop;
36
+ const readerHighWaterMark = values["reader-high-water-mark"];
37
+ const writerHighWaterMark = values["writer-high-water-mark"];
40
38
  let transformer = (line) => line;
41
39
  const joinDelimiter = new CharacterSequence(values.join);
42
- if (values.transformer) {
40
+ if (typeof values.transformer === "string") {
43
41
  const module = await import(resolvePath(values.transformer));
44
42
  transformer = module.default;
45
43
  }
46
44
  let filter = () => true;
47
- if (values.filter) {
45
+ if (typeof values.filter === "string") {
48
46
  const module = await import(resolvePath(values.filter));
49
47
  filter = module.default;
50
48
  }
@@ -57,10 +55,10 @@ export async function run(args) {
57
55
  const writer = writeStream.getWriter();
58
56
  const spliterator = Spliterator.from(readStream, {
59
57
  delimiter: values.split,
60
- skipEmpty: values["skip-empty"],
58
+ skipEmpty: Boolean(values["skip-empty"]),
61
59
  take,
62
60
  drop,
63
- debug: values.debug,
61
+ debug: Boolean(values.debug),
64
62
  });
65
63
  for await (const line of spliterator) {
66
64
  const transformed = await transformer(line);
@@ -1 +1 @@
1
- {"version":3,"file":"iterate.js","sourceRoot":"","sources":["../../../../node/cli/commands/iterate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEhF,OAAO,EACN,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,QAAQ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AE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAA;IAEF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAA;QAE3C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAA;QAE/B,IAAI,CAAC,IAAI;YAAE,SAAQ;QAEnB,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC/B,MAAM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;AACrB,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license MIT
4
+ * @author Teffen Ellis, et al.
5
+ * @file Run commands concurrently over delimited records or record-aligned blocks.
6
+ */
7
+ export declare const spec: {
8
+ readonly name: "parallel";
9
+ readonly usage: "parallel [options] -- <command> [arguments...]";
10
+ readonly description: "Run a command concurrently over delimited input. Record mode substitutes {} in arguments, or appends the record when {} is absent. Pipe mode sends record-aligned blocks to each command's standard input.";
11
+ readonly options: {
12
+ readonly jobs: {
13
+ readonly type: "number";
14
+ readonly short: "j";
15
+ readonly hint: "count";
16
+ readonly default: number;
17
+ readonly description: "Maximum concurrent jobs.";
18
+ readonly validate: (value: number) => boolean;
19
+ readonly validationMessage: "Option --jobs must be a positive integer.";
20
+ };
21
+ readonly split: {
22
+ readonly type: "string";
23
+ readonly short: "s";
24
+ readonly hint: "delimiter";
25
+ readonly default: "\n";
26
+ readonly description: "Delimiter to split records on.";
27
+ };
28
+ readonly null: {
29
+ readonly type: "boolean";
30
+ readonly short: "0";
31
+ readonly default: false;
32
+ readonly description: "Use NUL-delimited input.";
33
+ };
34
+ readonly pipe: {
35
+ readonly type: "boolean";
36
+ readonly default: false;
37
+ readonly description: "Send record-aligned blocks to child stdin.";
38
+ };
39
+ readonly block: {
40
+ readonly type: "string";
41
+ readonly hint: "size";
42
+ readonly default: "1MiB";
43
+ readonly description: "Target pipe block size.";
44
+ };
45
+ readonly "keep-order": {
46
+ readonly type: "boolean";
47
+ readonly short: "k";
48
+ readonly default: false;
49
+ readonly description: "Emit output in input order.";
50
+ };
51
+ readonly group: {
52
+ readonly type: "boolean";
53
+ readonly default: true;
54
+ readonly description: "Keep each job's output together.";
55
+ };
56
+ readonly "line-buffer": {
57
+ readonly type: "boolean";
58
+ readonly default: false;
59
+ readonly description: "Emit complete lines without mixing partial lines.";
60
+ };
61
+ readonly halt: {
62
+ readonly type: "string";
63
+ readonly hint: "mode";
64
+ readonly choices: readonly ["never", "soon", "now"];
65
+ readonly default: "never";
66
+ readonly description: "Failure policy.";
67
+ };
68
+ readonly tag: {
69
+ readonly type: "boolean";
70
+ readonly default: false;
71
+ readonly description: "Prefix output lines with the input sequence number.";
72
+ };
73
+ readonly "dry-run": {
74
+ readonly type: "boolean";
75
+ readonly default: false;
76
+ readonly description: "Print commands without executing them.";
77
+ };
78
+ readonly source: {
79
+ readonly type: "string";
80
+ readonly short: "i";
81
+ readonly hint: "path";
82
+ readonly description: "Read input from a file instead of stdin.";
83
+ };
84
+ readonly "skip-empty": {
85
+ readonly type: "boolean";
86
+ readonly short: "e";
87
+ readonly description: "Skip empty records (the record-mode default).";
88
+ };
89
+ readonly "reader-high-water-mark": {
90
+ readonly type: "number";
91
+ readonly short: "w";
92
+ readonly hint: "bytes";
93
+ readonly default: number;
94
+ readonly description: "Input stream buffer size.";
95
+ readonly validate: (value: number) => boolean;
96
+ readonly validationMessage: "Option --reader-high-water-mark must be a positive integer.";
97
+ };
98
+ };
99
+ };
100
+ export declare const help: string;
101
+ export declare function run(args: string[]): Promise<void>;
102
+ //# sourceMappingURL=parallel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../../node/cli/commands/parallel.ts"],"names":[],"mappings":"A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