@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.
@@ -1,175 +1,179 @@
1
- import { z } from 'zod';
2
- import { Project, SourceFile } from 'ts-morph';
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
- files: z.ZodArray<z.ZodObject<{
12
- type: z.ZodLiteral<"components" | "lib" | "css" | "route" | "ui" | "block">;
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
- declare const registryInfoSchema: z.ZodObject<{
26
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
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
- name: string;
42
- components: CompiledComponent[];
43
- info: z.output<typeof registryInfoSchema>;
43
+ name: string;
44
+ components: CompiledComponent[];
45
+ info: z.output<typeof registryInfoSchema>;
44
46
  }
45
47
  interface ComponentFile {
46
- type: NamespaceType;
47
- path: string;
48
- target?: string;
48
+ type: NamespaceType;
49
+ path: string;
50
+ target?: string;
49
51
  }
50
52
  interface Component {
51
- name: string;
52
- title?: string;
53
- description?: string;
54
- files: ComponentFile[];
55
- /**
56
- * Don't list the component in registry index file
57
- */
58
- unlisted?: boolean;
59
- /**
60
- * Map imported file paths, inherit from registry if not defined.
61
- */
62
- onResolve?: OnResolve;
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
- dependencies?: Record<string, string>;
66
- devDependencies?: Record<string, string>;
67
+ dependencies?: Record<string, string>;
68
+ devDependencies?: Record<string, string>;
67
69
  }
68
70
  interface Registry extends Omit<z.input<typeof registryInfoSchema>, 'indexes'> {
69
- name: string;
70
- packageJson: string | PackageJson;
71
- tsconfigPath: string;
72
- components: Component[];
73
- /**
74
- * The directory of registry, used to resolve relative paths
75
- */
76
- dir: string;
77
- /**
78
- * Map import paths of components
79
- */
80
- onResolve?: OnResolve;
81
- /**
82
- * When a referenced file is not found in component files, this function is called.
83
- * @returns file, or `false` to mark as external.
84
- */
85
- onUnknownFile?: (absolutePath: string) => ComponentFile | false | undefined;
86
- dependencies?: Record<string, string | null>;
87
- devDependencies?: Record<string, string | null>;
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
- readonly raw: Registry;
91
- readonly project: Project;
92
- resolver: RegistryResolver;
93
- constructor(registry: Registry);
94
- private readPackageJson;
95
- createSourceFile(file: string): Promise<SourceFile>;
96
- compile(): Promise<CompiledRegistry>;
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
- private readonly compiler;
100
- private readonly deps;
101
- private readonly devDeps;
102
- private readonly fileToComponent;
103
- constructor(compiler: RegistryCompiler, packageJson?: PackageJson);
104
- getDepFromSpecifier(specifier: string): string;
105
- getDepInfo(name: string): {
106
- type: 'runtime' | 'dev';
107
- name: string;
108
- version: string | null;
109
- } | undefined;
110
- getComponentByName(name: string): Component | undefined;
111
- getSubComponent(file: string): {
112
- component: Component;
113
- file: ComponentFile;
114
- } | undefined;
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
- type: 'file';
118
- /**
119
- * Absolute path
120
- */
121
- file: string;
119
+ type: 'file';
120
+ /**
121
+ * Absolute path
122
+ */
123
+ file: string;
122
124
  } | {
123
- type: 'dependency';
124
- dep: string;
125
- specifier: string;
125
+ type: 'dependency';
126
+ dep: string;
127
+ specifier: string;
126
128
  } | {
127
- type: 'sub-component';
128
- resolved: {
129
- type: 'local';
130
- component: Component;
131
- file: ComponentFile;
132
- } | {
133
- type: 'remote';
134
- component: Component;
135
- file: ComponentFile;
136
- registryName: string;
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
- type: 'custom';
141
- specifier: string;
142
+ type: 'custom';
143
+ specifier: string;
142
144
  };
143
145
  declare class ComponentCompiler {
144
- private readonly compiler;
145
- private readonly component;
146
- private readonly processedFiles;
147
- private readonly registry;
148
- private readonly subComponents;
149
- private readonly devDependencies;
150
- private readonly dependencies;
151
- constructor(compiler: RegistryCompiler, component: Component);
152
- private toImportPath;
153
- build(): Promise<CompiledComponent>;
154
- private buildFileAndDeps;
155
- private resolveImport;
156
- private buildFile;
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
- registries: CompiledRegistry[];
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
- dir: string;
166
- /**
167
- * Remove previous outputs
168
- *
169
- * @defaultValue false
170
- */
171
- cleanDir?: boolean;
172
- log?: boolean;
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 { type CompiledRegistry, type Component, ComponentCompiler, type ComponentFile, type MonoRegistry, type OnResolve, type PackageJson, type Reference, type Registry, RegistryCompiler, type SourceReference, combineRegistry, resolveFromRemote, writeFumadocsRegistry };
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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