@fumadocs/cli 1.2.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 +141 -137
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +257 -323
- package/dist/build/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +566 -751
- package/dist/index.js.map +1 -0
- package/package.json +16 -16
package/dist/build/index.d.ts
CHANGED
|
@@ -1,175 +1,179 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { Project, SourceFile } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Project, SourceFile } from "ts-morph";
|
|
3
3
|
|
|
4
|
+
//#region src/registry/schema.d.ts
|
|
4
5
|
type NamespaceType = (typeof namespaces)[number];
|
|
5
6
|
type CompiledComponent = z.input<typeof componentSchema>;
|
|
6
7
|
declare const namespaces: readonly ["components", "lib", "css", "route", "ui", "block"];
|
|
7
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<{
|
|
8
33
|
name: z.ZodString;
|
|
9
34
|
title: z.ZodOptional<z.ZodString>;
|
|
10
35
|
description: z.ZodOptional<z.ZodString>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
path: z.ZodString;
|
|
14
|
-
target: z.ZodOptional<z.ZodString>;
|
|
15
|
-
content: z.ZodString;
|
|
16
|
-
}, z.core.$strip>>;
|
|
17
|
-
dependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
18
|
-
devDependencies: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
19
|
-
subComponents: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
20
|
-
type: z.ZodLiteral<"http">;
|
|
21
|
-
baseUrl: z.ZodString;
|
|
22
|
-
component: z.ZodString;
|
|
23
|
-
}, z.core.$strip>]>>>;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
registries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
38
|
}, z.core.$strip>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
description: z.ZodOptional<z.ZodString>;
|
|
28
|
-
default: z.ZodOptional<z.ZodUnknown>;
|
|
29
|
-
}, z.core.$strip>>>;
|
|
30
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
-
indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
32
|
-
name: z.ZodString;
|
|
33
|
-
title: z.ZodOptional<z.ZodString>;
|
|
34
|
-
description: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, z.core.$strip>>>;
|
|
36
|
-
registries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
-
}, z.core.$strip>;
|
|
38
|
-
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/build/compiler.d.ts
|
|
39
41
|
type OnResolve = (reference: SourceReference) => Reference;
|
|
40
42
|
interface CompiledRegistry {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
name: string;
|
|
44
|
+
components: CompiledComponent[];
|
|
45
|
+
info: z.output<typeof registryInfoSchema>;
|
|
44
46
|
}
|
|
45
47
|
interface ComponentFile {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
type: NamespaceType;
|
|
49
|
+
path: string;
|
|
50
|
+
target?: string;
|
|
49
51
|
}
|
|
50
52
|
interface Component {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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;
|
|
63
65
|
}
|
|
64
66
|
interface PackageJson {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
dependencies?: Record<string, string>;
|
|
68
|
+
devDependencies?: Record<string, string>;
|
|
67
69
|
}
|
|
68
70
|
interface Registry extends Omit<z.input<typeof registryInfoSchema>, 'indexes'> {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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>;
|
|
88
90
|
}
|
|
89
91
|
declare class RegistryCompiler {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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>;
|
|
97
99
|
}
|
|
98
100
|
declare class RegistryResolver {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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;
|
|
115
117
|
}
|
|
116
118
|
type SourceReference = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
type: 'file';
|
|
120
|
+
/**
|
|
121
|
+
* Absolute path
|
|
122
|
+
*/
|
|
123
|
+
file: string;
|
|
122
124
|
} | {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
type: 'dependency';
|
|
126
|
+
dep: string;
|
|
127
|
+
specifier: string;
|
|
126
128
|
} | {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
+
};
|
|
138
140
|
};
|
|
139
141
|
type Reference = SourceReference | {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
type: 'custom';
|
|
143
|
+
specifier: string;
|
|
142
144
|
};
|
|
143
145
|
declare class ComponentCompiler {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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;
|
|
157
159
|
}
|
|
158
160
|
declare function resolveFromRemote(r: Registry, component: string, selectFile: (file: ComponentFile) => boolean): Reference | undefined;
|
|
159
|
-
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/build/index.d.ts
|
|
160
163
|
interface MonoRegistry extends CompiledRegistry {
|
|
161
|
-
|
|
164
|
+
registries: CompiledRegistry[];
|
|
162
165
|
}
|
|
163
166
|
declare function combineRegistry(root: CompiledRegistry, ...items: CompiledRegistry[]): MonoRegistry;
|
|
164
167
|
declare function writeFumadocsRegistry(out: CompiledRegistry | MonoRegistry, options: {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
dir: string;
|
|
169
|
+
/**
|
|
170
|
+
* Remove previous outputs
|
|
171
|
+
*
|
|
172
|
+
* @defaultValue false
|
|
173
|
+
*/
|
|
174
|
+
cleanDir?: boolean;
|
|
175
|
+
log?: boolean;
|
|
173
176
|
}): Promise<void>;
|
|
174
|
-
|
|
175
|
-
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;;;;;wBAMyB,gCACd;;;IDrGc,IAAA,EAAA,SAAA,GAAA,KAAA;IAAA,IAAA,EAAA,MAAA;;;oCC4JK;EA5LxB,eAAS,CAAA,IAAA,EAAA,MAAe,CAAA,EAAA;IAEnB,SAAA,WAAgB;IAEnB,IAAA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