@hanzo/docs-cli 1.1.0 → 1.2.1
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/dist/build/index.d.ts +147 -149
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +260 -410
- package/dist/build/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +582 -666
- package/dist/index.js.map +1 -0
- package/dist/schema/default.json +1 -0
- package/dist/schema/src.json +1 -0
- package/package.json +22 -22
package/dist/build/index.d.ts
CHANGED
|
@@ -1,181 +1,179 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { Project, SourceFile } from
|
|
3
|
-
import { Registry as Registry$1 } from 'shadcn/schema';
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Project, SourceFile } from "ts-morph";
|
|
4
3
|
|
|
4
|
+
//#region src/registry/schema.d.ts
|
|
5
5
|
type NamespaceType = (typeof namespaces)[number];
|
|
6
6
|
type CompiledComponent = z.input<typeof componentSchema>;
|
|
7
7
|
declare const namespaces: readonly ["components", "lib", "css", "route", "ui", "block"];
|
|
8
|
-
declare const indexSchema: z.ZodObject<{
|
|
9
|
-
name: z.ZodString;
|
|
10
|
-
title: z.ZodOptional<z.ZodString>;
|
|
11
|
-
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
8
|
declare const componentSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
files: z.ZodArray<z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"components" | "lib" | "css" | "route" | "ui" | "block">;
|
|
14
|
+
path: z.ZodString;
|
|
15
|
+
target: z.ZodOptional<z.ZodString>;
|
|
16
|
+
content: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
dependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
19
|
+
devDependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
20
|
+
subComponents: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"http">;
|
|
22
|
+
baseUrl: z.ZodString;
|
|
23
|
+
component: z.ZodString;
|
|
24
|
+
}, z.core.$strip>]>>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
declare const registryInfoSchema: z.ZodObject<{
|
|
27
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
31
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
32
|
+
indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
14
33
|
name: z.ZodString;
|
|
15
34
|
title: z.ZodOptional<z.ZodString>;
|
|
16
35
|
description: z.ZodOptional<z.ZodString>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
path: z.ZodString;
|
|
20
|
-
target: z.ZodOptional<z.ZodString>;
|
|
21
|
-
content: z.ZodString;
|
|
22
|
-
}, z.core.$strip>>;
|
|
23
|
-
dependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
24
|
-
devDependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
25
|
-
subComponents: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
registries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
38
|
}, z.core.$strip>;
|
|
27
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/build/compiler.d.ts
|
|
28
41
|
type OnResolve = (reference: SourceReference) => Reference;
|
|
29
42
|
interface CompiledRegistry {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
switchables?: Record<string, Switchable>;
|
|
43
|
+
name: string;
|
|
44
|
+
components: CompiledComponent[];
|
|
45
|
+
info: z.output<typeof registryInfoSchema>;
|
|
34
46
|
}
|
|
35
47
|
interface ComponentFile {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
interface Switchable {
|
|
41
|
-
specifier: string;
|
|
42
|
-
members: Record<string, string>;
|
|
48
|
+
type: NamespaceType;
|
|
49
|
+
path: string;
|
|
50
|
+
target?: string;
|
|
43
51
|
}
|
|
44
52
|
interface Component {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
name: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
files: ComponentFile[];
|
|
57
|
+
/**
|
|
58
|
+
* Don't list the component in registry index file
|
|
59
|
+
*/
|
|
60
|
+
unlisted?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Map imported file paths, inherit from registry if not defined.
|
|
63
|
+
*/
|
|
64
|
+
onResolve?: OnResolve;
|
|
57
65
|
}
|
|
58
66
|
interface PackageJson {
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
dependencies?: Record<string, string>;
|
|
68
|
+
devDependencies?: Record<string, string>;
|
|
61
69
|
}
|
|
62
|
-
interface Registry {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
devDependencies?: Record<string, string | null>;
|
|
70
|
+
interface Registry extends Omit<z.input<typeof registryInfoSchema>, 'indexes'> {
|
|
71
|
+
name: string;
|
|
72
|
+
packageJson: string | PackageJson;
|
|
73
|
+
tsconfigPath: string;
|
|
74
|
+
components: Component[];
|
|
75
|
+
/**
|
|
76
|
+
* The directory of registry, used to resolve relative paths
|
|
77
|
+
*/
|
|
78
|
+
dir: string;
|
|
79
|
+
/**
|
|
80
|
+
* Map import paths of components
|
|
81
|
+
*/
|
|
82
|
+
onResolve?: OnResolve;
|
|
83
|
+
/**
|
|
84
|
+
* When a referenced file is not found in component files, this function is called.
|
|
85
|
+
* @returns file, or `false` to mark as external.
|
|
86
|
+
*/
|
|
87
|
+
onUnknownFile?: (absolutePath: string) => ComponentFile | false | undefined;
|
|
88
|
+
dependencies?: Record<string, string | null>;
|
|
89
|
+
devDependencies?: Record<string, string | null>;
|
|
83
90
|
}
|
|
84
91
|
declare class RegistryCompiler {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
readonly raw: Registry;
|
|
93
|
+
readonly project: Project;
|
|
94
|
+
resolver: RegistryResolver;
|
|
95
|
+
constructor(registry: Registry);
|
|
96
|
+
private readPackageJson;
|
|
97
|
+
createSourceFile(file: string): Promise<SourceFile>;
|
|
98
|
+
compile(): Promise<CompiledRegistry>;
|
|
92
99
|
}
|
|
93
100
|
declare class RegistryResolver {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
private readonly compiler;
|
|
102
|
+
private readonly deps;
|
|
103
|
+
private readonly devDeps;
|
|
104
|
+
private readonly fileToComponent;
|
|
105
|
+
constructor(compiler: RegistryCompiler, packageJson?: PackageJson);
|
|
106
|
+
getDepFromSpecifier(specifier: string): string;
|
|
107
|
+
getDepInfo(name: string): {
|
|
108
|
+
type: 'runtime' | 'dev';
|
|
109
|
+
name: string;
|
|
110
|
+
version: string | null;
|
|
111
|
+
} | undefined;
|
|
112
|
+
getComponentByName(name: string): Component | undefined;
|
|
113
|
+
getSubComponent(file: string): {
|
|
114
|
+
component: Component;
|
|
115
|
+
file: ComponentFile;
|
|
116
|
+
} | undefined;
|
|
110
117
|
}
|
|
111
118
|
type SourceReference = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
type: 'file';
|
|
120
|
+
/**
|
|
121
|
+
* Absolute path
|
|
122
|
+
*/
|
|
123
|
+
file: string;
|
|
117
124
|
} | {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
type: 'dependency';
|
|
126
|
+
dep: string;
|
|
127
|
+
specifier: string;
|
|
121
128
|
} | {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
type: 'sub-component';
|
|
130
|
+
resolved: {
|
|
131
|
+
type: 'local';
|
|
132
|
+
component: Component;
|
|
133
|
+
file: ComponentFile;
|
|
134
|
+
} | {
|
|
135
|
+
type: 'remote';
|
|
136
|
+
component: Component;
|
|
137
|
+
file: ComponentFile;
|
|
138
|
+
registryName: string;
|
|
139
|
+
};
|
|
133
140
|
};
|
|
134
141
|
type Reference = SourceReference | {
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
type: 'custom';
|
|
143
|
+
specifier: string;
|
|
137
144
|
};
|
|
138
145
|
declare class ComponentCompiler {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
private readonly compiler;
|
|
147
|
+
private readonly component;
|
|
148
|
+
private readonly processedFiles;
|
|
149
|
+
private readonly registry;
|
|
150
|
+
private readonly subComponents;
|
|
151
|
+
private readonly devDependencies;
|
|
152
|
+
private readonly dependencies;
|
|
153
|
+
constructor(compiler: RegistryCompiler, component: Component);
|
|
154
|
+
private toImportPath;
|
|
155
|
+
build(): Promise<CompiledComponent>;
|
|
156
|
+
private buildFileAndDeps;
|
|
157
|
+
private resolveImport;
|
|
158
|
+
private buildFile;
|
|
152
159
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
declare function combineRegistry(...items: CompiledRegistry[]):
|
|
160
|
-
declare function
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}): Promise<void>;
|
|
170
|
-
declare function writeFumadocsRegistry(out: CompiledRegistry, options: {
|
|
171
|
-
dir: string;
|
|
172
|
-
/**
|
|
173
|
-
* Remove previous outputs
|
|
174
|
-
*
|
|
175
|
-
* @defaultValue false
|
|
176
|
-
*/
|
|
177
|
-
cleanDir?: boolean;
|
|
178
|
-
log?: boolean;
|
|
160
|
+
declare function resolveFromRemote(r: Registry, component: string, selectFile: (file: ComponentFile) => boolean): Reference | undefined;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/build/index.d.ts
|
|
163
|
+
interface MonoRegistry extends CompiledRegistry {
|
|
164
|
+
registries: CompiledRegistry[];
|
|
165
|
+
}
|
|
166
|
+
declare function combineRegistry(root: CompiledRegistry, ...items: CompiledRegistry[]): MonoRegistry;
|
|
167
|
+
declare function writeFumadocsRegistry(out: CompiledRegistry | MonoRegistry, options: {
|
|
168
|
+
dir: string;
|
|
169
|
+
/**
|
|
170
|
+
* Remove previous outputs
|
|
171
|
+
*
|
|
172
|
+
* @defaultValue false
|
|
173
|
+
*/
|
|
174
|
+
cleanDir?: boolean;
|
|
175
|
+
log?: boolean;
|
|
179
176
|
}): Promise<void>;
|
|
180
|
-
|
|
181
|
-
export {
|
|
177
|
+
//#endregion
|
|
178
|
+
export { CompiledRegistry, Component, ComponentCompiler, ComponentFile, MonoRegistry, OnResolve, PackageJson, Reference, Registry, RegistryCompiler, SourceReference, combineRegistry, resolveFromRemote, writeFumadocsRegistry };
|
|
179
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/registry/schema.ts","../../src/build/compiler.ts","../../src/build/index.ts"],"sourcesContent":[],"mappings":";;;;KAEY,aAAA,WAAwB;KAExB,iBAAA,GAAoB,CAAA,CAAE,aAAa;cAMlC;cAqBA,iBAAe,CAAA,CAAA;;;;;;;;;;;;;;;;EAAA,CAAA,eAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CAAA,eAAA,CAAA;AAaf,cAAA,kBAoBX,EApB6B,CAAA,CAAA,SAoB7B,CAAA;;;;;;;;;;;;;;;KCpDU,SAAA,eAAwB,oBAAoB;ADV5C,UCYK,gBAAA,CDZmB;EAExB,IAAA,EAAA,MAAA;EAMC,UAAA,ECMC,iBDNyE,EAAA;EAqB1E,IAAA,ECdL,CAAA,CAAE,MDcG,CAAA,OCdW,kBDyBtB,CAAA;;UCtBe,aAAA;QACT;;;;UAKS,SAAA;;;;SAIR;;;;;;;;cAUK;;UAGG,WAAA;iBACA;oBACG;;UAGH,QAAA,SAAiB,KAAK,CAAA,CAAE,aAAa;;wBAE9B;;cAEV;;;;;EDrBc;;AAa5B;cCkBc;;;;;4CAK8B;iBAE3B;oBACG;;cAGP,gBAAA;gBACG;oBACI;YACP;wBAEW;;kCAgBa,QAAA;aAOlB,QAAQ;;cAqCrB,gBAAA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