1ls 0.1.12 → 0.1.14

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 (66) hide show
  1. package/README.md +285 -11
  2. package/dist/browser/constants.d.ts +1 -1
  3. package/dist/browser/index.js +11 -11
  4. package/dist/cli/constants.d.ts +1 -1
  5. package/dist/{utils → cli}/stream.d.ts +1 -1
  6. package/dist/completions/1ls.bash +11 -19
  7. package/dist/completions/1ls.zsh +146 -40
  8. package/dist/completions/constants.d.ts +124 -0
  9. package/dist/completions/constants.ts +41 -0
  10. package/dist/completions/index.d.ts +17 -0
  11. package/dist/completions/index.ts +197 -0
  12. package/dist/completions/install-completions.sh +8 -7
  13. package/dist/{shared/constants.d.ts → constants.d.ts} +1 -1
  14. package/dist/expression/constants.d.ts +2 -0
  15. package/dist/expression/index.d.ts +3 -12
  16. package/dist/expression/utils.d.ts +14 -1
  17. package/dist/file/constants.d.ts +4 -0
  18. package/dist/file/filters.d.ts +7 -0
  19. package/dist/file/grep.d.ts +10 -0
  20. package/dist/file/index.d.ts +7 -0
  21. package/dist/file/info.d.ts +4 -0
  22. package/dist/file/io.d.ts +5 -0
  23. package/dist/{utils → file}/types.d.ts +0 -17
  24. package/dist/file/walk.d.ts +4 -0
  25. package/dist/formats/index.d.ts +1 -1
  26. package/dist/formats/types.d.ts +1 -0
  27. package/dist/formats/yaml/index.d.ts +2 -0
  28. package/dist/formats/yaml/types.d.ts +8 -0
  29. package/dist/formats/yaml/utils.d.ts +28 -0
  30. package/dist/index.js +82 -65
  31. package/dist/interactive/builder/constants.d.ts +14 -0
  32. package/dist/interactive/{builder.d.ts → builder/index.d.ts} +1 -1
  33. package/dist/interactive/builder/types.d.ts +4 -0
  34. package/dist/interactive/builder/utils.d.ts +7 -0
  35. package/dist/interactive/methods/constants.d.ts +10 -0
  36. package/dist/interactive/methods/index.d.ts +4 -0
  37. package/dist/interactive/methods/types.d.ts +8 -0
  38. package/dist/interactive/preview/constants.d.ts +4 -0
  39. package/dist/interactive/preview/index.d.ts +5 -0
  40. package/dist/interactive/preview/types.d.ts +6 -0
  41. package/dist/interactive/tooltip/constants.d.ts +3 -0
  42. package/dist/interactive/tooltip/index.d.ts +20 -0
  43. package/dist/interactive/tooltip/types.d.ts +13 -0
  44. package/dist/interactive/types.d.ts +5 -7
  45. package/dist/{utils/logger.d.ts → logger.d.ts} +10 -1
  46. package/dist/navigator/builtins/constants.d.ts +62 -0
  47. package/dist/navigator/builtins/index.d.ts +6 -0
  48. package/dist/navigator/builtins/types.d.ts +3 -0
  49. package/dist/navigator/builtins/utils.d.ts +12 -0
  50. package/dist/navigator/json/constants.d.ts +2 -0
  51. package/dist/navigator/json/index.d.ts +22 -0
  52. package/dist/navigator/json/types.d.ts +3 -0
  53. package/dist/navigator/json/utils.d.ts +14 -0
  54. package/dist/shortcuts/constants.d.ts +15 -0
  55. package/dist/shortcuts/index.d.ts +9 -0
  56. package/dist/shortcuts/types.d.ts +6 -0
  57. package/dist/types.d.ts +21 -2
  58. package/dist/version.d.ts +1 -1
  59. package/package.json +18 -10
  60. package/dist/formats/yaml.d.ts +0 -3
  61. package/dist/interactive/methods.d.ts +0 -12
  62. package/dist/navigator/json.d.ts +0 -31
  63. package/dist/utils/constants.d.ts +0 -12
  64. package/dist/utils/file.d.ts +0 -27
  65. package/dist/utils/index.d.ts +0 -7
  66. package/dist/utils/shortcuts.d.ts +0 -8
@@ -1,5 +1,18 @@
1
- import { LiteralNode } from "../types";
1
+ import type { Token, ASTNode, LiteralNode, PropertyAccessNode, IndexAccessNode, SliceAccessNode, MethodCallNode, ObjectOperationNode, ObjectOperationType, ArraySpreadNode, ArrowFunctionNode, RootNode, RecursiveDescentNode, OptionalAccessNode, NullCoalescingNode } from "../types";
2
2
  import { BOOLEAN_LITERALS } from "./constants";
3
3
  export declare const isBooleanLiteral: (value: string) => value is (typeof BOOLEAN_LITERALS)[number];
4
4
  export declare const createLiteralNode: (value: string | number | boolean | null) => LiteralNode;
5
5
  export declare const tryParseLiteralIdentifier: (identifier: string) => LiteralNode | undefined;
6
+ export declare const createErrorMessage: (token: Token, message: string) => string;
7
+ export declare const createPropertyAccessNode: (property: string, object?: ASTNode) => PropertyAccessNode;
8
+ export declare const createIndexAccessNode: (index: number, object?: ASTNode) => IndexAccessNode;
9
+ export declare const createSliceAccessNode: (start: number | undefined, end: number | undefined, object?: ASTNode) => SliceAccessNode;
10
+ export declare const createMethodCallNode: (method: string, args: ASTNode[], object?: ASTNode) => MethodCallNode;
11
+ export declare const createObjectOperationNode: (operation: ObjectOperationType, object?: ASTNode) => ObjectOperationNode;
12
+ export declare const createArraySpreadNode: (object?: ASTNode) => ArraySpreadNode;
13
+ export declare const createArrowFunctionNode: (params: string[], body: ASTNode) => ArrowFunctionNode;
14
+ export declare const createRootNode: (expression?: ASTNode) => RootNode;
15
+ export declare const createRecursiveDescentNode: (object?: ASTNode) => RecursiveDescentNode;
16
+ export declare const createOptionalAccessNode: (expression: ASTNode, object?: ASTNode) => OptionalAccessNode;
17
+ export declare const createNullCoalescingNode: (left: ASTNode, right: ASTNode) => NullCoalescingNode;
18
+ export declare const isValidObjectOperation: (value: string) => value is ObjectOperationType;
@@ -0,0 +1,4 @@
1
+ export declare const SUPPORTED_CODE_EXTENSIONS: readonly [".ts", ".js", ".tsx", ".jsx"];
2
+ export declare const SUPPORTED_DATA_EXTENSIONS: readonly [".json", ".yml", ".yaml"];
3
+ export declare const SUPPORTED_TEXT_EXTENSIONS: readonly [".md", ".txt"];
4
+ export declare const DEFAULT_SEARCH_EXTENSIONS: readonly [".ts", ".js", ".tsx", ".jsx", ".json", ".yml", ".yaml", ".md", ".txt"];
@@ -0,0 +1,7 @@
1
+ import type { FileInfo } from "./types";
2
+ export declare const isHiddenFile: (entry: string) => boolean;
3
+ export declare const shouldIncludeHiddenFile: (entry: string, includeHidden: boolean) => boolean;
4
+ export declare const matchesExtensionFilter: (ext: string, extensions: string[] | undefined) => boolean;
5
+ export declare const matchesPatternFilter: (name: string, pattern: RegExp | undefined) => boolean;
6
+ export declare const shouldIncludeFile: (info: FileInfo, extensions: string[] | undefined, pattern: RegExp | undefined) => boolean;
7
+ export declare const isWithinDepthLimit: (depth: number, maxDepth: number | undefined) => boolean;
@@ -0,0 +1,10 @@
1
+ import type { GrepOptions, GrepResult } from "./types";
2
+ export declare const createRegexFromPattern: (pattern: string | RegExp, ignoreCase: boolean) => RegExp;
3
+ export declare const createGrepResult: (filePath: string, lineNumber: number, matchIndex: number, lineContent: string, lines: readonly string[], contextSize: number | undefined) => GrepResult;
4
+ export declare const logVerboseError: (filePath: string, error: unknown, verbose: boolean) => void;
5
+ export declare const extractMatchesFromLine: (line: string, lineIndex: number, regex: RegExp, filePath: string, allLines: readonly string[], contextSize: number | undefined) => GrepResult[];
6
+ export declare const shouldStopSearching: (currentCount: number, maxMatches: number | undefined) => boolean;
7
+ export declare const searchFileContent: (filePath: string, regex: RegExp, options: GrepOptions) => Promise<GrepResult[]>;
8
+ export declare const searchInDirectory: (path: string, regex: RegExp, options: GrepOptions) => Promise<GrepResult[]>;
9
+ export declare function grep(pattern: string, path: string, options?: GrepOptions): Promise<GrepResult[]>;
10
+ export declare function grep(pattern: RegExp, path: string, options?: GrepOptions): Promise<GrepResult[]>;
@@ -0,0 +1,7 @@
1
+ export type { FileInfo, ListOptions, GrepOptions, GrepResult } from "./types";
2
+ export { SUPPORTED_CODE_EXTENSIONS, SUPPORTED_DATA_EXTENSIONS, SUPPORTED_TEXT_EXTENSIONS, DEFAULT_SEARCH_EXTENSIONS, } from "./constants";
3
+ export { readFile, serializeContent, writeFile } from "./io";
4
+ export { createFileInfo, getFileInfo } from "./info";
5
+ export { isHiddenFile, shouldIncludeHiddenFile, matchesExtensionFilter, matchesPatternFilter, shouldIncludeFile, isWithinDepthLimit, } from "./filters";
6
+ export { processDirectoryEntry, walkDirectory, listFiles } from "./walk";
7
+ export { createRegexFromPattern, createGrepResult, logVerboseError, extractMatchesFromLine, shouldStopSearching, searchFileContent, searchInDirectory, grep, } from "./grep";
@@ -0,0 +1,4 @@
1
+ import { stat } from "node:fs/promises";
2
+ import type { FileInfo } from "./types";
3
+ export declare const createFileInfo: (path: string, stats: Awaited<ReturnType<typeof stat>>) => FileInfo;
4
+ export declare const getFileInfo: (path: string) => Promise<FileInfo>;
@@ -0,0 +1,5 @@
1
+ export declare function readFile(path: string): Promise<unknown>;
2
+ export declare function readFile(path: string, parseJson: true): Promise<unknown>;
3
+ export declare function readFile(path: string, parseJson: false): Promise<string>;
4
+ export declare const serializeContent: (content: unknown) => string;
5
+ export declare const writeFile: (path: string, content: unknown) => Promise<void>;
@@ -30,20 +30,3 @@ export interface GrepResult {
30
30
  match: string;
31
31
  context?: string[];
32
32
  }
33
- export type DataFormat = "json" | "json5" | "yaml" | "toml" | "xml" | "ini" | "csv" | "tsv" | "protobuf" | "javascript" | "typescript" | "env" | "ndjson" | "lines" | "text";
34
- export interface ShortcutMapping {
35
- short: string;
36
- full: string;
37
- description: string;
38
- type: "array" | "object" | "string" | "any";
39
- }
40
- export declare const LogLevel: {
41
- readonly ERROR: 0;
42
- readonly WARN: 1;
43
- readonly INFO: 2;
44
- readonly DEBUG: 3;
45
- };
46
- export type LogLevelType = (typeof LogLevel)[keyof typeof LogLevel];
47
- export interface LogData {
48
- [key: string]: unknown;
49
- }
@@ -0,0 +1,4 @@
1
+ import type { FileInfo, ListOptions } from "./types";
2
+ export declare const processDirectoryEntry: (currentDir: string, entry: string, depth: number, options: ListOptions) => Promise<FileInfo[]>;
3
+ export declare const walkDirectory: (currentDir: string, depth: number, options: ListOptions) => Promise<FileInfo[]>;
4
+ export declare const listFiles: (dir: string, options?: ListOptions) => Promise<FileInfo[]>;
@@ -1,4 +1,4 @@
1
- import type { DataFormat } from "../utils/types";
1
+ import type { DataFormat } from "./types";
2
2
  export declare function parseLines(input: string): string[];
3
3
  export declare function parseInput(input: string, format?: DataFormat): Promise<unknown>;
4
4
  export declare function detectFormat(input: string): DataFormat;
@@ -1,3 +1,4 @@
1
+ export type DataFormat = "json" | "json5" | "yaml" | "toml" | "xml" | "ini" | "csv" | "tsv" | "protobuf" | "javascript" | "typescript" | "env" | "ndjson" | "lines" | "text";
1
2
  export interface CSVOptions {
2
3
  delimiter: string;
3
4
  }
@@ -0,0 +1,2 @@
1
+ export { parseYAMLValue, findPreviousKey } from "./utils";
2
+ export declare const parseYAML: (input: string) => unknown;
@@ -0,0 +1,8 @@
1
+ export interface StackFrame {
2
+ container: Record<string, unknown> | unknown[];
3
+ indent: number;
4
+ pendingKey?: string;
5
+ }
6
+ export interface AnchorStore {
7
+ [key: string]: unknown;
8
+ }
@@ -0,0 +1,28 @@
1
+ export declare const getIndent: (line: string) => number;
2
+ export declare const countQuotes: (text: string) => number;
3
+ export declare const isCommentOutsideQuotes: (line: string, commentIdx: number) => boolean;
4
+ export declare const stripComment: (line: string) => string;
5
+ export declare const isMultilineIndicator: (value: string) => boolean;
6
+ export declare const isDocumentMarker: (trimmed: string) => boolean;
7
+ export declare const isListItemLine: (trimmed: string) => boolean;
8
+ export declare const getListItemContent: (trimmed: string) => string;
9
+ export declare const hasValidColonKey: (value: string) => boolean;
10
+ export declare const parseKeyValue: (line: string) => {
11
+ key: string;
12
+ value: string;
13
+ } | null;
14
+ export declare const extractAnchorFromValue: (value: string) => {
15
+ anchorName: string | null;
16
+ cleanValue: string;
17
+ };
18
+ export declare const extractAnchorFromKey: (key: string) => {
19
+ cleanKey: string;
20
+ anchorName: string | null;
21
+ };
22
+ export declare const parseYAMLValue: (value: string) => unknown;
23
+ export declare const findPreviousKey: (lines: string[], currentIndex: number) => string | null;
24
+ export declare const collectMultilineContent: (lines: string[], startIdx: number, baseIndent: number) => {
25
+ contentLines: string[];
26
+ endIdx: number;
27
+ };
28
+ export declare const formatMultilineValue: (contentLines: string[], style: "|" | ">") => string;