barrelize 1.7.0 → 1.7.2
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/lib/index.d.ts +138 -0
- package/lib/index.js +38560 -0
- package/package.json +36 -33
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { default as default_2, z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export declare const $BarrelConfig: z.ZodObject<{
|
|
4
|
+
root: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
5
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
6
|
+
include: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
7
|
+
exclude: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
8
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
9
|
+
replace: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
10
|
+
exports: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
|
|
11
|
+
bracketSpacing: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
singleQuote: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
semi: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
insertFinalNewline: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
|
|
17
|
+
export declare const $Config: z.ZodObject<{
|
|
18
|
+
$schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
bracketSpacing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
|
+
singleQuote: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
semi: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
22
|
+
insertFinalNewline: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
23
|
+
barrels: z.ZodPrefault<z.ZodArray<z.ZodObject<{
|
|
24
|
+
root: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
25
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
26
|
+
include: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
27
|
+
exclude: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
28
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
29
|
+
replace: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
30
|
+
exports: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>>;
|
|
31
|
+
bracketSpacing: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
singleQuote: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
+
semi: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
insertFinalNewline: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
|
|
38
|
+
export declare type BarrelConfig = z.infer<typeof $BarrelConfig>;
|
|
39
|
+
|
|
40
|
+
export declare function cliInit(): void;
|
|
41
|
+
|
|
42
|
+
export declare function colorize(text: string, foreground: TerminalColor, background?: TerminalColor): string;
|
|
43
|
+
|
|
44
|
+
export declare type Config = z.infer<typeof $Config>;
|
|
45
|
+
|
|
46
|
+
export declare type ExportInfo = {
|
|
47
|
+
name: string;
|
|
48
|
+
exportKind?: 'type' | 'value' | null | undefined;
|
|
49
|
+
exportName?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export declare type ExportPathInfo = {
|
|
53
|
+
originalPath: string;
|
|
54
|
+
modifiedPath: string;
|
|
55
|
+
exports?: string[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export declare function extractExports(sourcePath: string): Promise<ExportInfo[]>;
|
|
59
|
+
|
|
60
|
+
export declare function extractExportsFromFile(sourcePath: string, options: ExtractExportsOptions): Promise<ExportInfo[]>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Options for extracting exports from source files
|
|
64
|
+
*/
|
|
65
|
+
export declare type ExtractExportsOptions = {
|
|
66
|
+
/**
|
|
67
|
+
* Whether the source file is a TypeScript file
|
|
68
|
+
*/
|
|
69
|
+
isTypeScriptSource: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to recursively process imports
|
|
72
|
+
*/
|
|
73
|
+
recursive: boolean;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export declare function formatExportLine(path: ExportPathInfo, config: Config, barrelConfig: BarrelConfig): string;
|
|
77
|
+
|
|
78
|
+
export declare function generateBarrels(configDir: string, config: Config): Promise<void>;
|
|
79
|
+
|
|
80
|
+
export declare type GenerateCommandOptions = default_2.infer<typeof GenerateCommandOptionsSchema>;
|
|
81
|
+
|
|
82
|
+
export declare const GenerateCommandOptionsSchema: default_2.ZodObject<{
|
|
83
|
+
configPath: default_2.ZodString;
|
|
84
|
+
watch: default_2.ZodBoolean;
|
|
85
|
+
}, default_2.core.$strict>;
|
|
86
|
+
|
|
87
|
+
export declare function getExportedPathsFromContent(content: string): Promise<string[]>;
|
|
88
|
+
|
|
89
|
+
export declare function globPaths(rootDir: string, barrelConfig: BarrelConfig): Promise<string[]>;
|
|
90
|
+
|
|
91
|
+
export declare function handlePathExports(rootDir: string, barrelConfig: BarrelConfig, exportPaths: ExportPathInfo[]): Promise<void>;
|
|
92
|
+
|
|
93
|
+
export declare function handlePathOrder(config: BarrelConfig, paths: ExportPathInfo[]): Promise<void>;
|
|
94
|
+
|
|
95
|
+
export declare function handlePathReplace(config: BarrelConfig, paths: ExportPathInfo[]): Promise<void>;
|
|
96
|
+
|
|
97
|
+
export declare function handlePaths(configDir: string, barrelConfig: BarrelConfig): Promise<ExportPathInfo[]>;
|
|
98
|
+
|
|
99
|
+
export declare const INITIAL_CONFIG: z.input<typeof $Config>;
|
|
100
|
+
|
|
101
|
+
export declare function logDebug(message: string): void;
|
|
102
|
+
|
|
103
|
+
export declare function logError(message: string): void;
|
|
104
|
+
|
|
105
|
+
export declare function logInfo(message: string): void;
|
|
106
|
+
|
|
107
|
+
export declare function logWarning(message: string): void;
|
|
108
|
+
|
|
109
|
+
export declare function parseConfig(configPath: string): Config;
|
|
110
|
+
|
|
111
|
+
export declare type PathsDifferences = {
|
|
112
|
+
insertions: string[];
|
|
113
|
+
deletions: string[];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export declare function pathsDifferences(newPaths: string[], oldPaths: string[]): PathsDifferences;
|
|
117
|
+
|
|
118
|
+
export declare function runGenerateCommand(options: GenerateCommandOptions): Promise<void>;
|
|
119
|
+
|
|
120
|
+
export declare function runInitCommand(baseConfigFilePath: string): Promise<void>;
|
|
121
|
+
|
|
122
|
+
export declare enum TerminalColor {
|
|
123
|
+
BLACK = 0,
|
|
124
|
+
RED = 1,
|
|
125
|
+
GREEN = 2,
|
|
126
|
+
YELLOW = 3,
|
|
127
|
+
BLUE = 4,
|
|
128
|
+
MAGENTA = 5,
|
|
129
|
+
CYAN = 6,
|
|
130
|
+
WHITE = 7,
|
|
131
|
+
GRAY = 60
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare function tryParseRegex(s: string): RegExp | null;
|
|
135
|
+
|
|
136
|
+
export declare function watchBarrels(configDir: string, config: Config): Promise<void>;
|
|
137
|
+
|
|
138
|
+
export { };
|