barrelize 1.7.1 → 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 +1 -1
- 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 { };
|
package/lib/index.js
CHANGED
|
@@ -593,7 +593,7 @@ class CAC extends EventEmitter {
|
|
|
593
593
|
}
|
|
594
594
|
const cac = (name2 = "") => new CAC(name2);
|
|
595
595
|
const name = "barrelize";
|
|
596
|
-
const version$1 = "1.7.
|
|
596
|
+
const version$1 = "1.7.1";
|
|
597
597
|
function cliInit() {
|
|
598
598
|
const cli = cac(name);
|
|
599
599
|
cli.command("[config path]", "Generate barrel files").option("-w, --watch", "Watch for changes and regenerate barrel files automatically").action(
|
package/package.json
CHANGED
|
@@ -1,52 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"barrelize": "./bin/cli.js"
|
|
5
|
-
},
|
|
2
|
+
"name": "barrelize",
|
|
3
|
+
"version": "1.7.2",
|
|
6
4
|
"description": "Automatically generating index (barrel) files",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"zod": "^4.2.1"
|
|
5
|
+
"author": "Nizami",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"barrels",
|
|
9
|
+
"typescript",
|
|
10
|
+
"index.ts",
|
|
11
|
+
"index.js"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git@github.com/nizami/barrelize"
|
|
19
16
|
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./lib/index.js",
|
|
19
|
+
"types": "./lib/index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"import": "./lib/index.js",
|
|
23
|
-
"types": "./lib/
|
|
23
|
+
"types": "./lib/index.d.ts"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"barrelize": "./bin/cli.js"
|
|
28
|
+
},
|
|
26
29
|
"files": [
|
|
27
30
|
"bin",
|
|
28
31
|
"lib",
|
|
29
32
|
"schema.json"
|
|
30
33
|
],
|
|
31
|
-
"
|
|
32
|
-
"barrels",
|
|
33
|
-
"typescript",
|
|
34
|
-
"index.ts",
|
|
35
|
-
"index.js"
|
|
36
|
-
],
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"name": "barrelize",
|
|
39
|
-
"repository": {
|
|
40
|
-
"type": "git",
|
|
41
|
-
"url": "git@github.com/nizami/barrelize"
|
|
42
|
-
},
|
|
34
|
+
"sideEffects": false,
|
|
43
35
|
"scripts": {
|
|
44
36
|
"build": "npx barrelize && npm run schema && vite build",
|
|
45
37
|
"schema": "tsx scripts/schema.script.ts > schema.json",
|
|
46
38
|
"test": "vitest run"
|
|
47
39
|
},
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/parser": "^7.28.5",
|
|
42
|
+
"@microsoft/api-extractor": "^7.55.2",
|
|
43
|
+
"@types/node": "^25.0.3",
|
|
44
|
+
"cac": "^6.7.14",
|
|
45
|
+
"chokidar": "^5.0.0",
|
|
46
|
+
"glob": "^13.0.0",
|
|
47
|
+
"json5": "^2.2.3",
|
|
48
|
+
"tsx": "^4.21.0",
|
|
49
|
+
"typescript": "~5.9.3",
|
|
50
|
+
"unplugin-dts": "^1.0.0-beta.6",
|
|
51
|
+
"vite": "^7.3.0",
|
|
52
|
+
"vitest": "^4.0.16",
|
|
53
|
+
"zod": "^4.2.1"
|
|
54
|
+
}
|
|
52
55
|
}
|