@bcts/dcbor-cli 1.0.0-alpha.13
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/LICENSE +48 -0
- package/README.md +105 -0
- package/dist/cli.cjs +132 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +133 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +202 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +202 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/src-Ce085uR8.mjs +407 -0
- package/dist/src-Ce085uR8.mjs.map +1 -0
- package/dist/src-M5HM-SCU.cjs +490 -0
- package/dist/src-M5HM-SCU.cjs.map +1 -0
- package/package.json +87 -0
- package/src/cli.ts +239 -0
- package/src/cmd/array.ts +41 -0
- package/src/cmd/default.ts +108 -0
- package/src/cmd/index.ts +19 -0
- package/src/cmd/map.ts +41 -0
- package/src/cmd/match.ts +196 -0
- package/src/format.ts +82 -0
- package/src/index.ts +41 -0
- package/src/run.ts +134 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Cbor, Result } from "@bcts/dcbor";
|
|
2
|
+
|
|
3
|
+
//#region src/format.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Input format options
|
|
7
|
+
*/
|
|
8
|
+
type InputFormat = "diag" | "hex" | "bin";
|
|
9
|
+
/**
|
|
10
|
+
* Output format options
|
|
11
|
+
*/
|
|
12
|
+
type OutputFormat = "diag" | "hex" | "bin" | "none";
|
|
13
|
+
/**
|
|
14
|
+
* Format CBOR output in the specified format
|
|
15
|
+
* Equivalent to Rust's format_output function
|
|
16
|
+
*/
|
|
17
|
+
declare function formatOutput(cbor: Cbor, outFormat: OutputFormat, annotate: boolean): Result<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Read binary data from a buffer
|
|
20
|
+
*/
|
|
21
|
+
declare function readData(data: Uint8Array): Uint8Array;
|
|
22
|
+
/**
|
|
23
|
+
* Read string data from a buffer
|
|
24
|
+
*/
|
|
25
|
+
declare function readString(data: Uint8Array): string;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/cmd/array.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* Command arguments for array composition
|
|
30
|
+
*/
|
|
31
|
+
interface ArrayCommandArgs {
|
|
32
|
+
/** Each element is parsed as a dCBOR item in diagnostic notation */
|
|
33
|
+
elements: string[];
|
|
34
|
+
/** The output format (default: hex) */
|
|
35
|
+
out: OutputFormat;
|
|
36
|
+
/** Output with annotations */
|
|
37
|
+
annotate: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Execute array command
|
|
41
|
+
*/
|
|
42
|
+
declare function execArray(args: ArrayCommandArgs): Result<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Create an Exec implementation for array command
|
|
45
|
+
*/
|
|
46
|
+
declare function createArrayCommand(args: ArrayCommandArgs): Exec;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/cmd/default.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* Command arguments for default parsing behavior
|
|
51
|
+
*/
|
|
52
|
+
interface DefaultCommandArgs {
|
|
53
|
+
/** Input dCBOR in the format specified by `in`. Optional - reads from stdin if not provided */
|
|
54
|
+
input?: string | undefined;
|
|
55
|
+
/** The input format (default: diag) */
|
|
56
|
+
in: InputFormat;
|
|
57
|
+
/** The output format (default: hex) */
|
|
58
|
+
out: OutputFormat;
|
|
59
|
+
/** Output with annotations */
|
|
60
|
+
annotate: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute default command with a reader function for stdin
|
|
64
|
+
*/
|
|
65
|
+
declare function execDefaultWithReader(args: DefaultCommandArgs, readString: () => string, readData: () => Uint8Array): Result<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute default command (reads from stdin if input not provided)
|
|
68
|
+
*/
|
|
69
|
+
declare function execDefault(args: DefaultCommandArgs, stdinContent?: string): Result<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Create an Exec implementation for default command
|
|
72
|
+
*/
|
|
73
|
+
declare function createDefaultCommand(args: DefaultCommandArgs, stdinContent?: string): Exec;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/cmd/map.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* Command arguments for map composition
|
|
78
|
+
*/
|
|
79
|
+
interface MapCommandArgs {
|
|
80
|
+
/** Alternating keys and values parsed as dCBOR items in diagnostic notation */
|
|
81
|
+
kvPairs: string[];
|
|
82
|
+
/** The output format (default: hex) */
|
|
83
|
+
out: OutputFormat;
|
|
84
|
+
/** Output with annotations */
|
|
85
|
+
annotate: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Execute map command
|
|
89
|
+
*/
|
|
90
|
+
declare function execMap(args: MapCommandArgs): Result<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Create an Exec implementation for map command
|
|
93
|
+
*/
|
|
94
|
+
declare function createMapCommand(args: MapCommandArgs): Exec;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/cmd/match.d.ts
|
|
97
|
+
/**
|
|
98
|
+
* Match output format options
|
|
99
|
+
*/
|
|
100
|
+
type MatchOutputFormat = "paths" | "diag" | "hex" | "bin";
|
|
101
|
+
/**
|
|
102
|
+
* Command arguments for match command
|
|
103
|
+
*/
|
|
104
|
+
interface MatchCommandArgs {
|
|
105
|
+
/** The pattern to match against */
|
|
106
|
+
pattern: string;
|
|
107
|
+
/** dCBOR input (hex, diag, or binary). If not provided, reads from stdin */
|
|
108
|
+
input?: string | undefined;
|
|
109
|
+
/** Input format (default: diag) */
|
|
110
|
+
in: InputFormat;
|
|
111
|
+
/** Output format (default: paths) */
|
|
112
|
+
out: MatchOutputFormat;
|
|
113
|
+
/** Disable indentation of path elements */
|
|
114
|
+
noIndent: boolean;
|
|
115
|
+
/** Show only the last element of each path */
|
|
116
|
+
lastOnly: boolean;
|
|
117
|
+
/** Add annotations to output */
|
|
118
|
+
annotate: boolean;
|
|
119
|
+
/** Include capture information in output */
|
|
120
|
+
captures: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Execute match command
|
|
124
|
+
*/
|
|
125
|
+
declare function execMatch(args: MatchCommandArgs, stdinContent?: string): Result<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Create an Exec implementation for match command
|
|
128
|
+
*/
|
|
129
|
+
declare function createMatchCommand(args: MatchCommandArgs, stdinContent?: string): Exec;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/cmd/index.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* Trait for command execution
|
|
134
|
+
* Equivalent to Rust's `pub trait Exec`
|
|
135
|
+
*/
|
|
136
|
+
interface Exec {
|
|
137
|
+
exec(): Result<string>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/run.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Command type discriminator
|
|
143
|
+
*/
|
|
144
|
+
type Command = {
|
|
145
|
+
type: "array";
|
|
146
|
+
elements: string[];
|
|
147
|
+
out: OutputFormat;
|
|
148
|
+
annotate: boolean;
|
|
149
|
+
} | {
|
|
150
|
+
type: "map";
|
|
151
|
+
kvPairs: string[];
|
|
152
|
+
out: OutputFormat;
|
|
153
|
+
annotate: boolean;
|
|
154
|
+
} | {
|
|
155
|
+
type: "match";
|
|
156
|
+
pattern: string;
|
|
157
|
+
input?: string | undefined;
|
|
158
|
+
in: InputFormat;
|
|
159
|
+
out: MatchOutputFormat;
|
|
160
|
+
noIndent: boolean;
|
|
161
|
+
lastOnly: boolean;
|
|
162
|
+
annotate: boolean;
|
|
163
|
+
captures: boolean;
|
|
164
|
+
} | {
|
|
165
|
+
type: "default";
|
|
166
|
+
input?: string | undefined;
|
|
167
|
+
in: InputFormat;
|
|
168
|
+
out: OutputFormat;
|
|
169
|
+
annotate: boolean;
|
|
170
|
+
};
|
|
171
|
+
interface RunOptions {
|
|
172
|
+
command: Command;
|
|
173
|
+
stdinContent?: string | undefined;
|
|
174
|
+
}
|
|
175
|
+
interface RunResult {
|
|
176
|
+
output: string;
|
|
177
|
+
isBinary: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Main execution function
|
|
181
|
+
* Equivalent to Rust's run<I, T, R, W> function
|
|
182
|
+
*/
|
|
183
|
+
declare function run(options: RunOptions): {
|
|
184
|
+
ok: true;
|
|
185
|
+
value: RunResult;
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
error: Error;
|
|
189
|
+
};
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/index.d.ts
|
|
192
|
+
/**
|
|
193
|
+
* @bcts/dcbor-cli - Command line parser/validator for deterministic CBOR (dCBOR)
|
|
194
|
+
*
|
|
195
|
+
* A command line tool for composing, parsing and validating Gordian dCBOR.
|
|
196
|
+
*
|
|
197
|
+
* @packageDocumentation
|
|
198
|
+
*/
|
|
199
|
+
declare const VERSION = "1.0.0-alpha.13";
|
|
200
|
+
//#endregion
|
|
201
|
+
export { type ArrayCommandArgs, type Command, type DefaultCommandArgs, type Exec, type InputFormat, type MapCommandArgs, type MatchCommandArgs, type MatchOutputFormat, type OutputFormat, type RunOptions, type RunResult, VERSION, createArrayCommand, createDefaultCommand, createMapCommand, createMatchCommand, execArray, execDefault, execDefaultWithReader, execMap, execMatch, formatOutput, readData, readString, run };
|
|
202
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/format.ts","../src/cmd/array.ts","../src/cmd/default.ts","../src/cmd/map.ts","../src/cmd/match.ts","../src/cmd/index.ts","../src/run.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAmCS,KAfG,WAAA,GAeH,MAAA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AKA;AAMA;;AAEa,cOzBA,OAAA,GPyBA,gBAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Cbor, Result } from "@bcts/dcbor";
|
|
2
|
+
|
|
3
|
+
//#region src/format.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Input format options
|
|
7
|
+
*/
|
|
8
|
+
type InputFormat = "diag" | "hex" | "bin";
|
|
9
|
+
/**
|
|
10
|
+
* Output format options
|
|
11
|
+
*/
|
|
12
|
+
type OutputFormat = "diag" | "hex" | "bin" | "none";
|
|
13
|
+
/**
|
|
14
|
+
* Format CBOR output in the specified format
|
|
15
|
+
* Equivalent to Rust's format_output function
|
|
16
|
+
*/
|
|
17
|
+
declare function formatOutput(cbor: Cbor, outFormat: OutputFormat, annotate: boolean): Result<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Read binary data from a buffer
|
|
20
|
+
*/
|
|
21
|
+
declare function readData(data: Uint8Array): Uint8Array;
|
|
22
|
+
/**
|
|
23
|
+
* Read string data from a buffer
|
|
24
|
+
*/
|
|
25
|
+
declare function readString(data: Uint8Array): string;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/cmd/array.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* Command arguments for array composition
|
|
30
|
+
*/
|
|
31
|
+
interface ArrayCommandArgs {
|
|
32
|
+
/** Each element is parsed as a dCBOR item in diagnostic notation */
|
|
33
|
+
elements: string[];
|
|
34
|
+
/** The output format (default: hex) */
|
|
35
|
+
out: OutputFormat;
|
|
36
|
+
/** Output with annotations */
|
|
37
|
+
annotate: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Execute array command
|
|
41
|
+
*/
|
|
42
|
+
declare function execArray(args: ArrayCommandArgs): Result<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Create an Exec implementation for array command
|
|
45
|
+
*/
|
|
46
|
+
declare function createArrayCommand(args: ArrayCommandArgs): Exec;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/cmd/default.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* Command arguments for default parsing behavior
|
|
51
|
+
*/
|
|
52
|
+
interface DefaultCommandArgs {
|
|
53
|
+
/** Input dCBOR in the format specified by `in`. Optional - reads from stdin if not provided */
|
|
54
|
+
input?: string | undefined;
|
|
55
|
+
/** The input format (default: diag) */
|
|
56
|
+
in: InputFormat;
|
|
57
|
+
/** The output format (default: hex) */
|
|
58
|
+
out: OutputFormat;
|
|
59
|
+
/** Output with annotations */
|
|
60
|
+
annotate: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute default command with a reader function for stdin
|
|
64
|
+
*/
|
|
65
|
+
declare function execDefaultWithReader(args: DefaultCommandArgs, readString: () => string, readData: () => Uint8Array): Result<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute default command (reads from stdin if input not provided)
|
|
68
|
+
*/
|
|
69
|
+
declare function execDefault(args: DefaultCommandArgs, stdinContent?: string): Result<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Create an Exec implementation for default command
|
|
72
|
+
*/
|
|
73
|
+
declare function createDefaultCommand(args: DefaultCommandArgs, stdinContent?: string): Exec;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/cmd/map.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* Command arguments for map composition
|
|
78
|
+
*/
|
|
79
|
+
interface MapCommandArgs {
|
|
80
|
+
/** Alternating keys and values parsed as dCBOR items in diagnostic notation */
|
|
81
|
+
kvPairs: string[];
|
|
82
|
+
/** The output format (default: hex) */
|
|
83
|
+
out: OutputFormat;
|
|
84
|
+
/** Output with annotations */
|
|
85
|
+
annotate: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Execute map command
|
|
89
|
+
*/
|
|
90
|
+
declare function execMap(args: MapCommandArgs): Result<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Create an Exec implementation for map command
|
|
93
|
+
*/
|
|
94
|
+
declare function createMapCommand(args: MapCommandArgs): Exec;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/cmd/match.d.ts
|
|
97
|
+
/**
|
|
98
|
+
* Match output format options
|
|
99
|
+
*/
|
|
100
|
+
type MatchOutputFormat = "paths" | "diag" | "hex" | "bin";
|
|
101
|
+
/**
|
|
102
|
+
* Command arguments for match command
|
|
103
|
+
*/
|
|
104
|
+
interface MatchCommandArgs {
|
|
105
|
+
/** The pattern to match against */
|
|
106
|
+
pattern: string;
|
|
107
|
+
/** dCBOR input (hex, diag, or binary). If not provided, reads from stdin */
|
|
108
|
+
input?: string | undefined;
|
|
109
|
+
/** Input format (default: diag) */
|
|
110
|
+
in: InputFormat;
|
|
111
|
+
/** Output format (default: paths) */
|
|
112
|
+
out: MatchOutputFormat;
|
|
113
|
+
/** Disable indentation of path elements */
|
|
114
|
+
noIndent: boolean;
|
|
115
|
+
/** Show only the last element of each path */
|
|
116
|
+
lastOnly: boolean;
|
|
117
|
+
/** Add annotations to output */
|
|
118
|
+
annotate: boolean;
|
|
119
|
+
/** Include capture information in output */
|
|
120
|
+
captures: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Execute match command
|
|
124
|
+
*/
|
|
125
|
+
declare function execMatch(args: MatchCommandArgs, stdinContent?: string): Result<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Create an Exec implementation for match command
|
|
128
|
+
*/
|
|
129
|
+
declare function createMatchCommand(args: MatchCommandArgs, stdinContent?: string): Exec;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/cmd/index.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* Trait for command execution
|
|
134
|
+
* Equivalent to Rust's `pub trait Exec`
|
|
135
|
+
*/
|
|
136
|
+
interface Exec {
|
|
137
|
+
exec(): Result<string>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/run.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Command type discriminator
|
|
143
|
+
*/
|
|
144
|
+
type Command = {
|
|
145
|
+
type: "array";
|
|
146
|
+
elements: string[];
|
|
147
|
+
out: OutputFormat;
|
|
148
|
+
annotate: boolean;
|
|
149
|
+
} | {
|
|
150
|
+
type: "map";
|
|
151
|
+
kvPairs: string[];
|
|
152
|
+
out: OutputFormat;
|
|
153
|
+
annotate: boolean;
|
|
154
|
+
} | {
|
|
155
|
+
type: "match";
|
|
156
|
+
pattern: string;
|
|
157
|
+
input?: string | undefined;
|
|
158
|
+
in: InputFormat;
|
|
159
|
+
out: MatchOutputFormat;
|
|
160
|
+
noIndent: boolean;
|
|
161
|
+
lastOnly: boolean;
|
|
162
|
+
annotate: boolean;
|
|
163
|
+
captures: boolean;
|
|
164
|
+
} | {
|
|
165
|
+
type: "default";
|
|
166
|
+
input?: string | undefined;
|
|
167
|
+
in: InputFormat;
|
|
168
|
+
out: OutputFormat;
|
|
169
|
+
annotate: boolean;
|
|
170
|
+
};
|
|
171
|
+
interface RunOptions {
|
|
172
|
+
command: Command;
|
|
173
|
+
stdinContent?: string | undefined;
|
|
174
|
+
}
|
|
175
|
+
interface RunResult {
|
|
176
|
+
output: string;
|
|
177
|
+
isBinary: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Main execution function
|
|
181
|
+
* Equivalent to Rust's run<I, T, R, W> function
|
|
182
|
+
*/
|
|
183
|
+
declare function run(options: RunOptions): {
|
|
184
|
+
ok: true;
|
|
185
|
+
value: RunResult;
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
error: Error;
|
|
189
|
+
};
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/index.d.ts
|
|
192
|
+
/**
|
|
193
|
+
* @bcts/dcbor-cli - Command line parser/validator for deterministic CBOR (dCBOR)
|
|
194
|
+
*
|
|
195
|
+
* A command line tool for composing, parsing and validating Gordian dCBOR.
|
|
196
|
+
*
|
|
197
|
+
* @packageDocumentation
|
|
198
|
+
*/
|
|
199
|
+
declare const VERSION = "1.0.0-alpha.13";
|
|
200
|
+
//#endregion
|
|
201
|
+
export { type ArrayCommandArgs, type Command, type DefaultCommandArgs, type Exec, type InputFormat, type MapCommandArgs, type MatchCommandArgs, type MatchOutputFormat, type OutputFormat, type RunOptions, type RunResult, VERSION, createArrayCommand, createDefaultCommand, createMapCommand, createMatchCommand, execArray, execDefault, execDefaultWithReader, execMap, execMatch, formatOutput, readData, readString, run };
|
|
202
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/format.ts","../src/cmd/array.ts","../src/cmd/default.ts","../src/cmd/map.ts","../src/cmd/match.ts","../src/cmd/index.ts","../src/run.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAmCS,KAfG,WAAA,GAeH,MAAA,GAAA,KAAA,GAAA,KAAA;AAqCT;AAOA;;KAtDY,YAAA;;ACZZ;AAYA;AAWA;iBDLgB,YAAA,OACR,iBACK,kCAEV;;;AErBH;AAcgB,iBF4CA,QAAA,CE5CqB,IAAA,EF4CN,UE5CM,CAAA,EF4CO,UE5CP;;;;AAI5B,iBF+CO,UAAA,CE/CP,IAAA,EF+CwB,UE/CxB,CAAA,EAAA,MAAA;;;;;;AFwCO,UC3DC,gBAAA,CD2Dc;EAOf;;;OC9DT;EAJU;EAYD,QAAA,EAAA,OAAS;AAWzB;;;;ACtBiB,iBDWD,SAAA,CCXmB,IAI7B,EDO0B,gBCLzB,CAAA,EDK4C,MCLhC,CAAA,MAAA,CAAA;AAQnB;;;AAIG,iBDIa,kBAAA,CCJb,IAAA,EDIsC,gBCJtC,CAAA,EDIyD,ICJzD;;;;;;AFwCa,UE1DC,kBAAA,CF0Dc;EAOf;;;ME7DV;EDLW;EAYD,GAAA,ECLT,YDKkB;EAWT;;;;ACtBhB;AAcA;AACQ,iBADQ,qBAAA,CACR,IAAA,EAAA,kBAAA,EAAA,UAAA,EAAA,GAA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,MAAA,GAAA,SAAqB;EAC7B,EAAA,EIVE,WJUF;EAEU,GAAA,EIXP,iBJWO;EACf,QAAA,EAAA,OAAA;EAAM,QAAA,EAAA,OAAA;EAuDO,QAAA,EAAA,OAAW;EAgBX,QAAA,EAAA,OAAA;;;;EC1FC,EAAA,EGgBP,WHhBO;EAYD,GAAA,EGKL,YHLY;EAWP,QAAA,EAAA,OAAA;;UGFC,UAAA;WACN;EFbC,YAAA,CAAA,EAAA,MAAiB,GAAA,SAAA;AAK7B;AAiDgB,UErCC,SAAA,CFqCQ;EAmHT,MAAA,EAAA,MAAA;;;;AC/KhB;;;iBCgCgB,GAAA,UACL;EArCC,EAAA,EAAA,IAAA;EACkC,KAAA,EAqCxB,SArCwB;CACH,GAAA;EAKjC,EAAA,EAAA,KAAA;EACC,KAAA,EA8B6C,KA9B7C;CASD;;;;;;ANTV;AAKA;AAMA;;AAEa,cOzBA,OAAA,GPyBA,gBAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as createMapCommand, c as execDefault, d as execArray, f as formatOutput, i as execMatch, l as execDefaultWithReader, m as readString, n as run, o as execMap, p as readData, r as createMatchCommand, s as createDefaultCommand, t as VERSION, u as createArrayCommand } from "./src-Ce085uR8.mjs";
|
|
2
|
+
|
|
3
|
+
export { VERSION, createArrayCommand, createDefaultCommand, createMapCommand, createMatchCommand, execArray, execDefault, execDefaultWithReader, execMap, execMatch, formatOutput, readData, readString, run };
|