1ls 0.0.1 → 0.0.3

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 (50) hide show
  1. package/README.md +141 -16
  2. package/dist/cli/constants.d.ts +3 -0
  3. package/dist/completions/1ls.bash +63 -0
  4. package/dist/completions/1ls.zsh +79 -0
  5. package/dist/completions/install-completions.sh +52 -0
  6. package/dist/expression/constants.d.ts +1 -0
  7. package/dist/expression/index.d.ts +43 -0
  8. package/dist/expression/utils.d.ts +5 -0
  9. package/dist/formats/constants.d.ts +51 -0
  10. package/dist/formats/csv.d.ts +4 -0
  11. package/dist/formats/env.d.ts +2 -0
  12. package/dist/formats/index.d.ts +4 -0
  13. package/dist/formats/ini.d.ts +2 -0
  14. package/dist/formats/javascript.d.ts +2 -0
  15. package/dist/formats/json5.d.ts +3 -0
  16. package/dist/formats/ndjson.d.ts +1 -0
  17. package/dist/formats/protobuf.d.ts +2 -0
  18. package/dist/formats/toml.d.ts +2 -0
  19. package/dist/formats/types.d.ts +41 -0
  20. package/dist/formats/typescript.d.ts +1 -0
  21. package/dist/formats/utils.d.ts +11 -0
  22. package/dist/formats/xml.d.ts +5 -0
  23. package/dist/formats/yaml.d.ts +3 -0
  24. package/dist/formatter/output.d.ts +1 -1
  25. package/dist/index.js +73 -28
  26. package/dist/interactive/app.d.ts +1 -0
  27. package/dist/interactive/builder.d.ts +10 -0
  28. package/dist/interactive/fuzzy.d.ts +6 -0
  29. package/dist/interactive/input.d.ts +7 -0
  30. package/dist/interactive/methods.d.ts +12 -0
  31. package/dist/interactive/navigator.d.ts +2 -0
  32. package/dist/interactive/renderer-builder.d.ts +3 -0
  33. package/dist/interactive/renderer.d.ts +2 -0
  34. package/dist/interactive/state.d.ts +5 -0
  35. package/dist/interactive/terminal.d.ts +19 -0
  36. package/dist/interactive/types.d.ts +45 -0
  37. package/dist/lexer/constants.d.ts +4 -0
  38. package/dist/{parser/lexer.d.ts → lexer/index.d.ts} +3 -1
  39. package/dist/navigator/json.d.ts +20 -3
  40. package/dist/navigator/types.d.ts +2 -0
  41. package/dist/types.d.ts +1 -0
  42. package/dist/utils/constants.d.ts +1 -0
  43. package/dist/utils/file.d.ts +24 -3
  44. package/dist/utils/index.d.ts +7 -0
  45. package/dist/utils/logger.d.ts +1 -10
  46. package/dist/utils/stream.d.ts +1 -1
  47. package/dist/utils/types.d.ts +12 -1
  48. package/package.json +14 -11
  49. package/dist/parser/parser.d.ts +0 -25
  50. package/dist/utils/parsers.d.ts +0 -8
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # 1ls - One Line Script
2
2
 
3
- A lightweight, fast JSON/YAML/CSV processor with JavaScript syntax. Built with Bun for blazing performance.
3
+ A 0 dependency, lightweight, fast data processor with familiar JavaScript syntax.
4
4
 
5
5
  ## Why 1ls?
6
6
 
7
7
  - **JavaScript Syntax**: Use familiar JavaScript array methods and syntax instead of learning jq's DSL
8
- - **Multi-format**: Works with JSON, YAML, TOML, CSV, TSV out of the box
9
- - **Fast**: Built with Bun for exceptional performance
8
+ - **Multi-format**: Works with JSON, JSON5, YAML, TOML, XML, INI, CSV, TSV, ENV, NDJSON, JavaScript, TypeScript, and more
9
+ - **Fast**: Built for speed; no deps, compiled by Bun
10
10
  - **Intuitive**: Property access with dot notation, just like JavaScript
11
11
  - **Powerful**: Full support for array methods, arrow functions, and object operations
12
12
  - **Shortcuts**: Built-in shortcuts for common operations (e.g., `.mp` for `.map`)
@@ -14,12 +14,12 @@ A lightweight, fast JSON/YAML/CSV processor with JavaScript syntax. Built with B
14
14
  ## Installation
15
15
 
16
16
  ```bash
17
- # Using Bun
18
- bun install -g 1ls
19
-
20
- # Using npm
17
+ # Using npm (or bun)
21
18
  npm install -g 1ls
22
19
 
20
+ # Using Homebrew (macOS/Linux)
21
+ brew install yowainwright/tap/1ls
22
+
23
23
  # Using curl
24
24
  curl -fsSL https://raw.githubusercontent.com/yowainwright/1ls/main/install.sh | bash
25
25
  ```
@@ -42,10 +42,94 @@ echo '[1, 2, 3]' | 1ls '.map(x => x * 2)'
42
42
  # Chain operations
43
43
  echo '[{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]' | 1ls '.filter(x => x.age > 26).map(x => x.name)'
44
44
  # Output: ["Alice"]
45
+
46
+ # Interactive mode - explore JSON with fuzzy search
47
+ 1ls readFile data.json
48
+ # Opens interactive explorer with fuzzy search, arrow key navigation, and live preview
45
49
  ```
46
50
 
47
51
  ## Examples
48
52
 
53
+ ### Interactive Mode
54
+
55
+ Explore JSON interactively with fuzzy search and build expressions with method discovery:
56
+
57
+ ```bash
58
+ # Open interactive explorer from a file (automatic when no expression)
59
+ 1ls readFile data.json
60
+
61
+ # Works with all supported formats
62
+ 1ls readFile config.yaml
63
+ 1ls readFile config.toml
64
+
65
+ # For remote data, save to a file first
66
+ curl https://api.github.com/users/github > /tmp/user.json
67
+ 1ls readFile /tmp/user.json
68
+
69
+ # Or use an expression directly (non-interactive)
70
+ 1ls readFile data.json '.users.filter(x => x.active)'
71
+ ```
72
+
73
+ #### Mode 1: Path Explorer
74
+
75
+ Navigate and search JSON paths:
76
+
77
+ - **Fuzzy search**: Type to filter paths (e.g., "user.name" matches `.users[0].name`, `.user.username`, etc.)
78
+ - **Live preview**: See values as you navigate
79
+ - **Type information**: Shows String, Number, Array, Object, Boolean, or null
80
+ - **↑/↓**: Navigate, **Enter**: Select, **Tab**: Build expression, **Esc/q**: Quit
81
+
82
+ #### Mode 2: Expression Builder
83
+
84
+ Build complex expressions with guided method selection:
85
+
86
+ **Workflow:**
87
+ 1. Navigate to a path in Explorer mode → Press **Tab**
88
+ 2. Type to fuzzy search methods → **→** to accept
89
+ 3. Type to fuzzy search properties → **→** to complete
90
+ 4. Repeat to chain methods
91
+ 5. Press **Enter** to execute
92
+
93
+ **Example Session:**
94
+ ```
95
+ 1. Navigate to .users (Array) → Tab
96
+ 2. Type "fil" → → (accepts .filter(x => ...))
97
+ 3. Type "act" → → (completes with x.active, back to method selection)
98
+ 4. Type "map" → → (accepts .map(x => ...))
99
+ 5. Type "name" → → (completes with x.name)
100
+ 6. Enter → executes: .users.filter(x => x.active).map(x => x.name)
101
+ ```
102
+
103
+ **Undo mistakes:**
104
+ - Press **←** at any time to undo the last segment
105
+ - Example: `.users.filter(x => x.active).map(x => x.name)` → **←** → `.users.filter(x => x.active)`
106
+
107
+ **Available Methods by Type:**
108
+
109
+ **Array**: map, filter, reduce, find, findIndex, some, every, sort, reverse, slice, concat, join, flat, flatMap, length
110
+
111
+ **String**: toUpperCase, toLowerCase, trim, trimStart, trimEnd, split, replace, replaceAll, substring, slice, startsWith, endsWith, includes, match, length
112
+
113
+ **Object**: {keys}, {values}, {entries}, {length}
114
+
115
+ **Number**: toFixed, toString
116
+
117
+ **Keyboard Shortcuts:**
118
+ - **↑/↓**: Navigate methods/properties
119
+ - **→ or Tab**: Accept/complete method or property (autocomplete-style)
120
+ - **←**: Undo last segment (remove to previous dot)
121
+ - **Enter**: Execute expression
122
+ - **Type**: Fuzzy search methods/properties
123
+ - **Esc**: Go back to Explorer / Quit
124
+ - **q**: Quit (from Explorer)
125
+
126
+ **Use cases:**
127
+ - Exploring unfamiliar API responses
128
+ - Building filter/map chains interactively
129
+ - Discovering available methods for each type
130
+ - Learning JavaScript array/string methods
131
+ - Prototyping complex data transformations
132
+
49
133
  ### Working with JSON
50
134
 
51
135
  ```bash
@@ -110,11 +194,34 @@ John,30
110
194
  Jane,25' | 1ls '.map(x => x.name)'
111
195
  # Output: ["John", "Jane"]
112
196
 
197
+ # ENV file input
198
+ echo 'DATABASE_URL=postgres://localhost/db
199
+ PORT=3000
200
+ DEBUG=true' | 1ls '.PORT'
201
+ # Output: 3000
202
+
203
+ # NDJSON (Newline-Delimited JSON) - great for logs
204
+ echo '{"level":"error","msg":"Failed"}
205
+ {"level":"info","msg":"Started"}
206
+ {"level":"error","msg":"Timeout"}' | 1ls '.filter(x => x.level === "error")'
207
+ # Output: [{"level":"error","msg":"Failed"}, {"level":"error","msg":"Timeout"}]
208
+
113
209
  # Specify input format explicitly
114
210
  cat data.yaml | 1ls --input-format yaml '.users[0].name'
115
211
  cat data.csv | 1ls --input-format csv '.filter(x => x.age > 25)'
212
+ cat app.env | 1ls --input-format env '.DATABASE_URL'
213
+ cat logs.ndjson | 1ls --input-format ndjson '.filter(x => x.level === "error")'
116
214
  ```
117
215
 
216
+ **Supported Formats:**
217
+ - JSON, JSON5 (JSON with comments/trailing commas)
218
+ - YAML, TOML, XML, INI
219
+ - CSV, TSV
220
+ - ENV files (.env)
221
+ - NDJSON (Newline-Delimited JSON for logs)
222
+ - JavaScript, TypeScript (with `export default`)
223
+ - Plain text, line-by-line
224
+
118
225
  ### File Operations
119
226
 
120
227
  ```bash
@@ -157,6 +264,7 @@ echo '["a", "b"]' | 1ls '.jn(",")' # Short for .join()
157
264
  |--------|-------|-------------|
158
265
  | `--help` | `-h` | Show help |
159
266
  | `--version` | `-v` | Show version |
267
+ | `--interactive` | | Interactive fuzzy search explorer |
160
268
  | `--raw` | `-r` | Output raw strings, not JSON |
161
269
  | `--pretty` | `-p` | Pretty print output |
162
270
  | `--compact` | `-c` | Compact output |
@@ -294,6 +402,26 @@ done
294
402
  - Efficient streaming for large files
295
403
  - Native binary compilation
296
404
 
405
+ ## Development
406
+
407
+ ```bash
408
+ # Clone the repository
409
+ git clone https://github.com/yowainwright/1ls.git
410
+ cd 1ls
411
+
412
+ # Install dependencies
413
+ bun install
414
+
415
+ # Run tests
416
+ bun test
417
+
418
+ # Build
419
+ bun run build
420
+
421
+ # Build binaries
422
+ bun run build:binary:all
423
+ ```
424
+
297
425
  ## Contributing
298
426
 
299
427
  Contributions are welcome! Please check out the [Contributing Guide](CONTRIBUTING.md).
@@ -309,17 +437,14 @@ MIT © Jeff Wainwright
309
437
  | Syntax | JavaScript | DSL | JavaScript |
310
438
  | Performance | ⚡ Fast (Bun) | ⚡ Fast | 🚀 Good |
311
439
  | Learning Curve | Easy | Steep | Easy |
312
- | Multi-format | | | |
313
- | Shortcuts | | | |
314
- | Arrow Functions | | | |
315
- | File Operations | | | |
440
+ | Multi-format | | x | x |
441
+ | Interactive Mode | | x | |
442
+ | Shortcuts | | x | x |
443
+ | Arrow Functions | | x | |
444
+ | File Operations | ✓ | x | x |
316
445
 
317
446
  ## Troubleshooting
318
447
 
319
- ### Installation Issues
320
- - Ensure Bun is installed: `curl -fsSL https://bun.sh/install | bash`
321
- - Check PATH includes Bun location
322
-
323
448
  ### Expression Errors
324
449
  - Wrap expressions in quotes to prevent shell interpretation
325
450
  - Use single quotes for expressions containing dollar signs
@@ -332,4 +457,4 @@ MIT © Jeff Wainwright
332
457
 
333
458
  - [GitHub Repository](https://github.com/yowainwright/1ls)
334
459
  - [Documentation](https://1ls.dev)
335
- - [Issue Tracker](https://github.com/yowainwright/1ls/issues)
460
+ - [Issue Tracker](https://github.com/yowainwright/1ls/issues)
@@ -0,0 +1,3 @@
1
+ import { DataFormat } from "../utils/types";
2
+ export declare const VALID_OUTPUT_FORMATS: readonly ["json", "yaml", "csv", "table"];
3
+ export declare const VALID_INPUT_FORMATS: DataFormat[];
@@ -0,0 +1,63 @@
1
+ #!/bin/bash
2
+ # Bash completion for 1ls
3
+
4
+ _1ls_complete() {
5
+ local cur prev opts
6
+ COMPREPLY=()
7
+ cur="${COMP_WORDS[COMP_CWORD]}"
8
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
9
+
10
+ # Main options
11
+ opts="--help --version --raw --pretty --compact --type --format --list --grep --find --recursive --ignore-case --line-numbers --ext --max-depth --shortcuts --shorten --expand readFile"
12
+
13
+ # Format options
14
+ format_opts="json yaml csv table"
15
+
16
+ # Common JSON path starters
17
+ json_paths=". .[] .{keys} .{values} .{entries}"
18
+
19
+ # Common shorthand methods
20
+ shortcuts=".mp .flt .rd .fnd .sm .evr .srt .rvs .jn .kys .vls .ents .lc .uc .trm"
21
+
22
+ case "${prev}" in
23
+ --format)
24
+ COMPREPLY=( $(compgen -W "${format_opts}" -- ${cur}) )
25
+ return 0
26
+ ;;
27
+ --list|--find|readFile)
28
+ # File/directory completion
29
+ COMPREPLY=( $(compgen -f -- ${cur}) )
30
+ return 0
31
+ ;;
32
+ --ext)
33
+ # Common extensions
34
+ COMPREPLY=( $(compgen -W "js ts tsx jsx json md txt yml yaml xml html css" -- ${cur}) )
35
+ return 0
36
+ ;;
37
+ --shorten|--expand)
38
+ # JSON expressions
39
+ COMPREPLY=( $(compgen -W "${json_paths}" -- ${cur}) )
40
+ return 0
41
+ ;;
42
+ *)
43
+ ;;
44
+ esac
45
+
46
+ # If current word starts with -, show options
47
+ if [[ ${cur} == -* ]]; then
48
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
49
+ return 0
50
+ fi
51
+
52
+ # If current word starts with ., suggest JSON paths and shortcuts
53
+ if [[ ${cur} == .* ]]; then
54
+ all_paths="${json_paths} ${shortcuts}"
55
+ COMPREPLY=( $(compgen -W "${all_paths}" -- ${cur}) )
56
+ return 0
57
+ fi
58
+
59
+ # Default to options
60
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
61
+ }
62
+
63
+ complete -F _1ls_complete 1ls
@@ -0,0 +1,79 @@
1
+ #compdef 1ls
2
+ # Zsh completion for 1ls
3
+
4
+ _1ls() {
5
+ local -a opts format_opts shortcuts json_paths
6
+
7
+ # Main options
8
+ opts=(
9
+ '--help[Show help]'
10
+ '--version[Show version]'
11
+ '--raw[Raw output (no formatting)]'
12
+ '--pretty[Pretty print JSON]'
13
+ '--compact[Compact JSON]'
14
+ '--type[Show value type info]'
15
+ '--format[Output format]:format:(json yaml csv table)'
16
+ '--list[List files in directory]:directory:_files -/'
17
+ '--grep[Search for pattern]:pattern:'
18
+ '--find[Path to search in]:path:_files'
19
+ '--recursive[Recursive search]'
20
+ '--ignore-case[Case insensitive search]'
21
+ '--line-numbers[Show line numbers]'
22
+ '--ext[Filter by extensions]:extensions:'
23
+ '--max-depth[Maximum recursion depth]:depth:'
24
+ '--shortcuts[Show all available shortcuts]'
25
+ '--shorten[Convert expression to shorthand]:expression:'
26
+ '--expand[Convert shorthand to full form]:expression:'
27
+ 'readFile[Read from file]:file:_files'
28
+ )
29
+
30
+ # Common shorthand methods
31
+ shortcuts=(
32
+ '.mp:map - Transform each element'
33
+ '.flt:filter - Filter elements'
34
+ '.rd:reduce - Reduce to single value'
35
+ '.fnd:find - Find first match'
36
+ '.sm:some - Test if any match'
37
+ '.evr:every - Test if all match'
38
+ '.srt:sort - Sort elements'
39
+ '.rvs:reverse - Reverse order'
40
+ '.jn:join - Join to string'
41
+ '.kys:keys - Get object keys'
42
+ '.vls:values - Get object values'
43
+ '.ents:entries - Get object entries'
44
+ '.lc:toLowerCase - Convert to lowercase'
45
+ '.uc:toUpperCase - Convert to uppercase'
46
+ '.trm:trim - Remove whitespace'
47
+ )
48
+
49
+ # JSON path examples
50
+ json_paths=(
51
+ '.:Root object'
52
+ '.[]:All array elements'
53
+ '.{keys}:Object keys'
54
+ '.{values}:Object values'
55
+ '.{entries}:Object entries'
56
+ )
57
+
58
+ # Check context and provide appropriate completions
59
+ local curcontext="$curcontext" state line
60
+ typeset -A opt_args
61
+
62
+ _arguments -C \
63
+ "${opts[@]}" \
64
+ '*:: :->args'
65
+
66
+ case $state in
67
+ args)
68
+ # If typing starts with ., offer shortcuts and paths
69
+ if [[ $words[$CURRENT] == .* ]]; then
70
+ _describe -t shortcuts 'shortcuts' shortcuts
71
+ _describe -t paths 'json paths' json_paths
72
+ else
73
+ _arguments "${opts[@]}"
74
+ fi
75
+ ;;
76
+ esac
77
+ }
78
+
79
+ _1ls "$@"
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+
3
+ echo "Installing 1ls shell completions..."
4
+
5
+ # Detect shell
6
+ if [ -n "$BASH_VERSION" ]; then
7
+ SHELL_NAME="bash"
8
+ elif [ -n "$ZSH_VERSION" ]; then
9
+ SHELL_NAME="zsh"
10
+ else
11
+ echo "Unsupported shell. Only bash and zsh are supported."
12
+ exit 1
13
+ fi
14
+
15
+ # Get the directory of this script
16
+ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
17
+
18
+ if [ "$SHELL_NAME" = "bash" ]; then
19
+ # Bash installation
20
+ if [ -d "$HOME/.bash_completion.d" ]; then
21
+ cp "$SCRIPT_DIR/1ls.bash" "$HOME/.bash_completion.d/"
22
+ echo "Installed to ~/.bash_completion.d/"
23
+ echo "Add this to your ~/.bashrc if not already present:"
24
+ echo " source ~/.bash_completion.d/1ls.bash"
25
+ elif [ -f "$HOME/.bashrc" ]; then
26
+ echo "" >> "$HOME/.bashrc"
27
+ echo "# 1ls completions" >> "$HOME/.bashrc"
28
+ echo "source $SCRIPT_DIR/1ls.bash" >> "$HOME/.bashrc"
29
+ echo "Added to ~/.bashrc"
30
+ else
31
+ echo "Could not find suitable location for bash completions"
32
+ echo "Please manually source: $SCRIPT_DIR/1ls.bash"
33
+ fi
34
+ elif [ "$SHELL_NAME" = "zsh" ]; then
35
+ # Zsh installation
36
+ if [ -d "$HOME/.zsh/completions" ]; then
37
+ cp "$SCRIPT_DIR/1ls.zsh" "$HOME/.zsh/completions/_1ls"
38
+ echo "Installed to ~/.zsh/completions/"
39
+ elif [ -d "/usr/local/share/zsh/site-functions" ]; then
40
+ cp "$SCRIPT_DIR/1ls.zsh" "/usr/local/share/zsh/site-functions/_1ls"
41
+ echo "Installed to /usr/local/share/zsh/site-functions/"
42
+ else
43
+ mkdir -p "$HOME/.zsh/completions"
44
+ cp "$SCRIPT_DIR/1ls.zsh" "$HOME/.zsh/completions/_1ls"
45
+ echo "Installed to ~/.zsh/completions/"
46
+ echo "Add this to your ~/.zshrc if not already present:"
47
+ echo " fpath=(~/.zsh/completions \$fpath)"
48
+ echo " autoload -U compinit && compinit"
49
+ fi
50
+ fi
51
+
52
+ echo "Reload your shell or run 'source ~/.${SHELL_NAME}rc' to enable completions"
@@ -0,0 +1 @@
1
+ export declare const BOOLEAN_LITERALS: readonly ["true", "false", "null"];
@@ -0,0 +1,43 @@
1
+ import { Token, ASTNode, PropertyAccessNode, IndexAccessNode, SliceAccessNode, MethodCallNode, ObjectOperationNode, ObjectOperationType, ArraySpreadNode, ArrowFunctionNode, RootNode } from "../types";
2
+ export declare function createErrorMessage(token: Token, message: string): string;
3
+ export declare function createPropertyAccessNode(property: string, object?: ASTNode): PropertyAccessNode;
4
+ export declare function createIndexAccessNode(index: number, object?: ASTNode): IndexAccessNode;
5
+ export declare function createSliceAccessNode(start: number | undefined, end: number | undefined, object?: ASTNode): SliceAccessNode;
6
+ export declare function createMethodCallNode(method: string, args: ASTNode[], object?: ASTNode): MethodCallNode;
7
+ export declare function createObjectOperationNode(operation: ObjectOperationType, object?: ASTNode): ObjectOperationNode;
8
+ export declare function createArraySpreadNode(object?: ASTNode): ArraySpreadNode;
9
+ export declare function createArrowFunctionNode(params: string[], body: ASTNode): ArrowFunctionNode;
10
+ export declare function createRootNode(expression?: ASTNode): RootNode;
11
+ export declare const VALID_OBJECT_OPERATIONS: readonly ObjectOperationType[];
12
+ export declare function isValidObjectOperation(value: string): value is ObjectOperationType;
13
+ export declare class ExpressionParser {
14
+ private tokens;
15
+ private position;
16
+ private current;
17
+ constructor(tokens: readonly Token[]);
18
+ parse(): RootNode;
19
+ private parseExpression;
20
+ private parsePrimary;
21
+ private parsePrimaryNode;
22
+ private parseAccessChain;
23
+ private parseBracketAccess;
24
+ private parseNumericIndexOrSlice;
25
+ private parseSliceFromColon;
26
+ private parseArrayAccess;
27
+ private parseObjectOperation;
28
+ private parseIdentifierOrFunction;
29
+ private parseArrowFunction;
30
+ private parseFunctionBody;
31
+ private parseBinaryExpression;
32
+ private parseFunctionTerm;
33
+ private parseIdentifierChain;
34
+ private parseMethodCall;
35
+ private parseMethodArguments;
36
+ private parseMethodArgument;
37
+ private parseFunctionParams;
38
+ private parsePostfix;
39
+ private parsePostfixDot;
40
+ private parseNumber;
41
+ private advance;
42
+ private expect;
43
+ }
@@ -0,0 +1,5 @@
1
+ import { LiteralNode } from "../types";
2
+ import { BOOLEAN_LITERALS } from "./constants";
3
+ export declare const isBooleanLiteral: (value: string) => value is (typeof BOOLEAN_LITERALS)[number];
4
+ export declare const createLiteralNode: (value: string | number | boolean | null) => LiteralNode;
5
+ export declare const tryParseLiteralIdentifier: (identifier: string) => LiteralNode | undefined;
@@ -0,0 +1,51 @@
1
+ export declare const CSV: {
2
+ readonly NUMBER: RegExp;
3
+ };
4
+ export declare const YAML: {
5
+ readonly INTEGER: RegExp;
6
+ readonly FLOAT: RegExp;
7
+ };
8
+ export declare const TOML: {
9
+ readonly INTEGER: RegExp;
10
+ readonly FLOAT: RegExp;
11
+ };
12
+ export declare const XML: {
13
+ readonly NUMBER: RegExp;
14
+ readonly ATTRIBUTES: RegExp;
15
+ readonly SELF_CLOSING: RegExp;
16
+ readonly OPEN_TAG: RegExp;
17
+ readonly NESTED_TAGS: RegExp;
18
+ readonly COMPLETE_TAGS: RegExp;
19
+ readonly XML_DECLARATION: RegExp;
20
+ };
21
+ export declare const INI: {
22
+ readonly NUMBER: RegExp;
23
+ };
24
+ export declare const JSON5: {
25
+ readonly TRAILING_COMMA: RegExp;
26
+ readonly UNQUOTED_KEY: RegExp;
27
+ };
28
+ export declare const JS: {
29
+ readonly EXPORT: RegExp;
30
+ };
31
+ export declare const TS: {
32
+ readonly TYPE_ANNOTATION: RegExp;
33
+ readonly INTERFACE: RegExp;
34
+ readonly TYPE_ALIAS: RegExp;
35
+ readonly GENERIC: RegExp;
36
+ readonly EXPORT: RegExp;
37
+ };
38
+ export declare const DETECTION: {
39
+ readonly JSON5_FEATURES: RegExp;
40
+ readonly SECTION_HEADER: RegExp;
41
+ readonly TOML_SECTION: RegExp;
42
+ readonly TOML_QUOTED_VALUES: RegExp;
43
+ readonly TOML_SYNTAX: RegExp;
44
+ readonly INI_SYNTAX: RegExp;
45
+ readonly JS_EXPORT: RegExp;
46
+ readonly TS_TYPE_ANNOTATION: RegExp;
47
+ readonly TS_INTERFACE: RegExp;
48
+ readonly TS_TYPE_ALIAS: RegExp;
49
+ readonly ENV_FEATURES: RegExp;
50
+ readonly NDJSON_FEATURES: RegExp;
51
+ };
@@ -0,0 +1,4 @@
1
+ export declare function parseCSVLine(line: string, delimiter: string): string[];
2
+ export declare function parseCSVValue(value: string): unknown;
3
+ export declare function parseCSV(input: string, delimiter?: string): unknown[];
4
+ export declare function parseTSV(input: string): unknown[];
@@ -0,0 +1,2 @@
1
+ export declare function parseENVValue(value: string): unknown;
2
+ export declare function parseENV(input: string): Record<string, unknown>;
@@ -0,0 +1,4 @@
1
+ import type { DataFormat } from "../utils/types";
2
+ export declare function parseLines(input: string): string[];
3
+ export declare function parseInput(input: string, format?: DataFormat): Promise<unknown>;
4
+ export declare function detectFormat(input: string): DataFormat;
@@ -0,0 +1,2 @@
1
+ export declare function parseINIValue(value: string): unknown;
2
+ export declare function parseINI(input: string): Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ export declare function stripJSComments(input: string): string;
2
+ export declare function parseJavaScript(input: string): unknown;
@@ -0,0 +1,3 @@
1
+ export declare function stripJSON5Comments(input: string): string;
2
+ export declare function normalizeJSON5(input: string): string;
3
+ export declare function parseJSON5(input: string): unknown;
@@ -0,0 +1 @@
1
+ export declare function parseNDJSON(input: string): unknown[];
@@ -0,0 +1,2 @@
1
+ export declare function parseProtobuf(_input: string): unknown;
2
+ export declare function parseProtobufJSON(input: string): unknown;
@@ -0,0 +1,2 @@
1
+ export declare function parseTOMLValue(value: string): unknown;
2
+ export declare function parseTOML(input: string): unknown;
@@ -0,0 +1,41 @@
1
+ export interface CSVOptions {
2
+ delimiter: string;
3
+ }
4
+ export interface TOMLTable {
5
+ [key: string]: unknown;
6
+ }
7
+ export interface YAMLParseContext {
8
+ stack: unknown[];
9
+ indentStack: number[];
10
+ currentList: unknown[] | null;
11
+ listIndent: number;
12
+ }
13
+ export interface XMLAttributes {
14
+ _attributes?: Record<string, unknown>;
15
+ _text?: unknown;
16
+ [key: string]: unknown;
17
+ }
18
+ export interface ParseState {
19
+ result: string[];
20
+ inString: boolean;
21
+ delimiter: string;
22
+ skip: number;
23
+ }
24
+ export interface XMLParseState {
25
+ buffer: string[];
26
+ depth: number;
27
+ skip: number;
28
+ }
29
+ export interface XMLElementState {
30
+ elements: string[];
31
+ buffer: string[];
32
+ depth: number;
33
+ skip: number;
34
+ }
35
+ export interface INIParseState {
36
+ result: Record<string, unknown>;
37
+ currentSection: string;
38
+ }
39
+ export interface ENVParseState {
40
+ result: Record<string, unknown>;
41
+ }
@@ -0,0 +1 @@
1
+ export declare function parseTypeScript(input: string): unknown;
@@ -0,0 +1,11 @@
1
+ export declare const TRUTHY_VALUES: readonly ["true", "yes", "on"];
2
+ export declare const FALSY_VALUES: readonly ["false", "no", "off"];
3
+ export declare const NULL_VALUES: readonly ["null", "~", ""];
4
+ export declare const isTruthyValue: (value: string) => value is (typeof TRUTHY_VALUES)[number];
5
+ export declare const isFalsyValue: (value: string) => value is (typeof FALSY_VALUES)[number];
6
+ export declare const isNullValue: (value: string) => value is (typeof NULL_VALUES)[number];
7
+ export declare const parseBooleanValue: (value: string) => boolean | undefined;
8
+ export declare const parseNullValue: (value: string) => null | undefined;
9
+ export declare const tryParseNumber: (value: string) => number | undefined;
10
+ export declare const countQuotes: (line: string, endPos: number) => number;
11
+ export declare const isQuoteBalanced: (quoteCount: number) => boolean;
@@ -0,0 +1,5 @@
1
+ export declare function parseXMLValue(value: string): unknown;
2
+ export declare function parseXMLAttributes(attrString: string): Record<string, unknown>;
3
+ export declare function parseXMLElement(xml: string): unknown;
4
+ export declare function parseXMLChildren(content: string): Record<string, unknown>;
5
+ export declare function parseXML(input: string): unknown;
@@ -0,0 +1,3 @@
1
+ export declare function parseYAMLValue(value: string): unknown;
2
+ export declare function findPreviousKey(lines: string[], currentIndex: number): string | null;
3
+ export declare function parseYAML(input: string): unknown;
@@ -2,7 +2,7 @@ import { CliOptions } from "../types";
2
2
  export declare class Formatter {
3
3
  private options;
4
4
  constructor(options: CliOptions);
5
- format(data: any): string;
5
+ format(data: unknown): string;
6
6
  private formatRaw;
7
7
  private formatJson;
8
8
  private formatWithType;