forgepress 0.0.1 → 0.0.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.
Files changed (56) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +28 -83
  2. package/dist/_chunks/client.d.mts +1 -1
  3. package/dist/_chunks/config.mjs +61 -19
  4. package/dist/_chunks/{validate.mjs → content.mjs} +350 -217
  5. package/dist/_chunks/fetch.mjs +2 -2
  6. package/dist/_chunks/files.mjs +32 -0
  7. package/dist/_chunks/libs/diff.mjs +485 -0
  8. package/dist/_chunks/media.mjs +282 -0
  9. package/dist/_chunks/once.mjs +16 -0
  10. package/dist/_chunks/output.mjs +98 -252
  11. package/dist/_chunks/plugin.mjs +87 -0
  12. package/dist/_chunks/preview.mjs +248 -0
  13. package/dist/_chunks/project.d.mts +7 -0
  14. package/dist/_chunks/reader.mjs +5 -9
  15. package/dist/_chunks/reader2.mjs +150 -202
  16. package/dist/_chunks/references.mjs +8 -5
  17. package/dist/_chunks/resolve.d.mts +2 -0
  18. package/dist/_chunks/response.mjs +5 -0
  19. package/dist/_chunks/routes.mjs +9 -0
  20. package/dist/_chunks/serialize.mjs +82 -0
  21. package/dist/_chunks/settings.mjs +328 -0
  22. package/dist/_chunks/settings2.mjs +2 -0
  23. package/dist/_chunks/types.d.mts +229 -24
  24. package/dist/_chunks/types2.d.mts +25 -0
  25. package/dist/_chunks/value.mjs +123 -1
  26. package/dist/cli/bin.mjs +50 -37
  27. package/dist/editor/index.mjs +9961 -8653
  28. package/dist/index.d.mts +2 -3
  29. package/dist/index.mjs +14 -24
  30. package/dist/next/preview.d.mts +1 -0
  31. package/dist/next/preview.mjs +3 -0
  32. package/dist/next/reload.d.mts +1 -0
  33. package/dist/next/reload.mjs +20 -0
  34. package/dist/next/settings.d.mts +12 -0
  35. package/dist/next/settings.mjs +2 -0
  36. package/dist/plugin/next.d.mts +11 -0
  37. package/dist/plugin/next.mjs +213 -0
  38. package/dist/plugin/nuxt.d.mts +7 -0
  39. package/dist/plugin/nuxt.mjs +52 -0
  40. package/dist/plugin/watcher.d.mts +1 -0
  41. package/dist/plugin/watcher.mjs +23 -0
  42. package/dist/preview/index.d.mts +1 -2
  43. package/dist/preview/index.mjs +1 -243
  44. package/dist/preview/react.d.mts +1 -0
  45. package/dist/preview/react.mjs +34 -0
  46. package/dist/unplugin.d.mts +12 -17
  47. package/dist/unplugin.mjs +1 -500
  48. package/package.json +72 -8
  49. package/dist/_chunks/config.d.mts +0 -35
  50. package/dist/_chunks/entry.d.mts +0 -194
  51. package/dist/_chunks/libs/@oxc-project/types.d.mts +0 -1297
  52. package/dist/_chunks/libs/@rolldown/pluginutils.d.mts +0 -62
  53. package/dist/_chunks/libs/rolldown.d.mts +0 -4711
  54. package/dist/_chunks/output2.mjs +0 -333
  55. package/dist/_chunks/parse.mjs +0 -22
  56. package/dist/_chunks/types.mjs +0 -2
@@ -1,194 +0,0 @@
1
- interface FieldBase {
2
- label?: string;
3
- description?: string;
4
- optional?: boolean;
5
- translate?: boolean;
6
- }
7
- type FieldOptionType = 'text' | 'number' | 'boolean' | 'collection' | 'collections';
8
- interface FieldOption {
9
- label: string;
10
- type: FieldOptionType;
11
- description?: string;
12
- required?: true;
13
- }
14
- interface FieldTypeDefinition {
15
- type: string;
16
- label: string;
17
- options: Record<string, FieldOption>;
18
- }
19
- type OptionContent<TOption extends FieldOption> = TOption['type'] extends 'number' ? number : TOption['type'] extends 'boolean' ? boolean : TOption['type'] extends 'collections' ? readonly string[] : string;
20
- type RequiredOptions<TOptions> = { [TKey in keyof TOptions]: TOptions[TKey] extends {
21
- required: true;
22
- } ? TKey : never; }[keyof TOptions];
23
- type FieldOf<TDefinition extends FieldTypeDefinition> = TDefinition extends FieldTypeDefinition ? FieldBase & {
24
- type: TDefinition['type'];
25
- } & { [TKey in RequiredOptions<TDefinition['options']>]: OptionContent<TDefinition['options'][TKey]>; } & { [TKey in Exclude<keyof TDefinition['options'], RequiredOptions<TDefinition['options']>>]?: OptionContent<TDefinition['options'][TKey]>; } : never;
26
- declare const dynamic: {
27
- readonly type: "dynamic";
28
- readonly label: "Dynamic";
29
- readonly options: {
30
- readonly collections: {
31
- readonly label: "Collections";
32
- readonly type: "collections";
33
- readonly required: true;
34
- };
35
- };
36
- };
37
- type DynamicField = FieldOf<typeof dynamic>;
38
- interface DynamicBlock<TCollectionName extends string = string> {
39
- collection: TCollectionName;
40
- id: string;
41
- }
42
- type DynamicFieldContent<TField extends DynamicField> = DynamicBlock<TField['collections'][number]>[];
43
- interface MediaContent {
44
- url: string;
45
- alt?: string;
46
- width?: number;
47
- height?: number;
48
- }
49
- declare const image: {
50
- readonly type: "image";
51
- readonly label: "Image";
52
- readonly options: {
53
- readonly multiple: {
54
- readonly label: "Multiple";
55
- readonly type: "boolean";
56
- };
57
- };
58
- };
59
- type ImageField = FieldOf<typeof image>;
60
- type ImageFieldContent<TField extends ImageField> = TField['multiple'] extends true ? MediaContent[] : MediaContent;
61
- declare const number: {
62
- readonly type: "number";
63
- readonly label: "Number";
64
- readonly options: {
65
- readonly min: {
66
- readonly label: "Minimum";
67
- readonly type: "number";
68
- };
69
- readonly max: {
70
- readonly label: "Maximum";
71
- readonly type: "number";
72
- };
73
- readonly step: {
74
- readonly label: "Step";
75
- readonly type: "number";
76
- };
77
- readonly index: {
78
- readonly label: "Indexed";
79
- readonly type: "boolean";
80
- readonly description: "Listed in the collection manifest, so queries can filter and sort on it without loading every entry.";
81
- };
82
- };
83
- };
84
- type NumberField = FieldOf<typeof number>;
85
- type NumberFieldContent = number;
86
- declare const relation: {
87
- readonly type: "relation";
88
- readonly label: "Relation";
89
- readonly options: {
90
- readonly collection: {
91
- readonly label: "Collection";
92
- readonly type: "collection";
93
- readonly required: true;
94
- };
95
- readonly multiple: {
96
- readonly label: "Multiple";
97
- readonly type: "boolean";
98
- };
99
- readonly index: {
100
- readonly label: "Indexed";
101
- readonly type: "boolean";
102
- readonly description: "Listed in the collection manifest, so queries can filter and sort on it without loading every entry.";
103
- };
104
- };
105
- };
106
- type RelationField = FieldOf<typeof relation>;
107
- type RelationFieldContent<TField extends RelationField> = TField['multiple'] extends true ? string[] : string;
108
- declare const richtext: {
109
- readonly type: "richtext";
110
- readonly label: "Rich Text";
111
- readonly options: {};
112
- };
113
- type RichTextField = FieldOf<typeof richtext>;
114
- type RichTextFieldContent = string;
115
- declare const text: {
116
- readonly type: "text";
117
- readonly label: "Text";
118
- readonly options: {
119
- readonly validation: {
120
- readonly label: "Validation Pattern";
121
- readonly type: "text";
122
- };
123
- readonly index: {
124
- readonly label: "Indexed";
125
- readonly type: "boolean";
126
- readonly description: "Listed in the collection manifest, so queries can filter and sort on it without loading every entry.";
127
- };
128
- };
129
- };
130
- type TextField = FieldOf<typeof text>;
131
- type TextFieldContent = string;
132
- declare const video: {
133
- readonly type: "video";
134
- readonly label: "Video";
135
- readonly options: {
136
- readonly multiple: {
137
- readonly label: "Multiple";
138
- readonly type: "boolean";
139
- };
140
- };
141
- };
142
- type VideoField = FieldOf<typeof video>;
143
- type VideoFieldContent<TField extends VideoField> = TField['multiple'] extends true ? MediaContent[] : MediaContent;
144
- type Field = TextField | RichTextField | NumberField | ImageField | VideoField | RelationField | DynamicField;
145
- type FieldContent<TField extends Field> = TField extends DynamicField ? DynamicFieldContent<TField> : TField extends RelationField ? RelationFieldContent<TField> : TField extends ImageField ? ImageFieldContent<TField> : TField extends VideoField ? VideoFieldContent<TField> : TField extends TextField ? TextFieldContent : TField extends NumberField ? NumberFieldContent : TField extends RichTextField ? RichTextFieldContent : never;
146
- interface Collection {
147
- label?: string;
148
- description?: string;
149
- fields: Record<string, Field>;
150
- }
151
- export interface ForgePressSchema {
152
- collections: Record<string, Collection>;
153
- locales?: readonly string[];
154
- }
155
- export type SchemaLocale<TSchema extends ForgePressSchema> = TSchema['locales'] extends readonly string[] ? TSchema['locales'][number] : never;
156
- export interface ForgePressSchemaRegistry {}
157
- export type RegisteredSchema = ForgePressSchemaRegistry extends {
158
- schema: infer TSchema extends ForgePressSchema;
159
- } ? TSchema : ForgePressSchema;
160
- export type EntryStatus = 'published' | 'unpublished';
161
- export interface EntryMeta {
162
- id: string;
163
- status: EntryStatus;
164
- createdAt: string;
165
- updatedAt: string;
166
- }
167
- export interface EntryRef<TCollectionName extends string = string> {
168
- collection: TCollectionName;
169
- id: string;
170
- }
171
- export interface OutputMeta {
172
- id: string;
173
- createdAt: string;
174
- updatedAt: string;
175
- }
176
- export type Entry = EntryMeta & {
177
- [field: string]: unknown;
178
- };
179
- type Translated<TSchema extends ForgePressSchema, TContent> = [SchemaLocale<TSchema>] extends [never] ? TContent : Record<SchemaLocale<TSchema>, TContent>;
180
- type PartiallyTranslated<TSchema extends ForgePressSchema, TContent> = [SchemaLocale<TSchema>] extends [never] ? TContent : Partial<Record<SchemaLocale<TSchema>, TContent>>;
181
- type FieldValue<TSchema extends ForgePressSchema, TField extends Field, TOptional extends boolean> = TField extends {
182
- translate: true;
183
- } ? TOptional extends true ? PartiallyTranslated<TSchema, FieldContent<TField>> : Translated<TSchema, FieldContent<TField>> : FieldContent<TField>;
184
- type OptionalKeys<TCollection extends Collection> = { [TKey in keyof TCollection['fields']]-?: TCollection['fields'][TKey] extends {
185
- optional: true;
186
- } ? TKey : never; }[keyof TCollection['fields']];
187
- type RequiredKeys<TCollection extends Collection> = Exclude<keyof TCollection['fields'], OptionalKeys<TCollection>>;
188
- type CollectionContent<TSchema extends ForgePressSchema, TCollection extends Collection> = EntryMeta & { [TKey in RequiredKeys<TCollection>]: FieldValue<TSchema, TCollection['fields'][TKey], false>; } & { [TKey in OptionalKeys<TCollection>]?: FieldValue<TSchema, TCollection['fields'][TKey], true>; };
189
- type EntryOf<TSchema extends ForgePressSchema, TCollectionName extends keyof TSchema['collections']> = CollectionContent<TSchema, TSchema['collections'][TCollectionName]>;
190
- export type ForgePressEntry<TCollectionName extends keyof RegisteredSchema['collections']> = EntryOf<RegisteredSchema, TCollectionName>;
191
- type OutputValue<TField extends Field> = TField extends RelationField ? TField['multiple'] extends true ? EntryRef<TField['collection']>[] : EntryRef<TField['collection']> : FieldContent<TField>;
192
- type CollectionOutput<TCollection extends Collection> = OutputMeta & { [TKey in RequiredKeys<TCollection>]: OutputValue<TCollection['fields'][TKey]>; } & { [TKey in OptionalKeys<TCollection>]?: OutputValue<TCollection['fields'][TKey]>; };
193
- export type OutputOf<TSchema extends ForgePressSchema, TCollectionName extends keyof TSchema['collections']> = CollectionOutput<TSchema['collections'][TCollectionName]>;
194
- export type ForgePressOutput<TCollectionName extends keyof RegisteredSchema['collections']> = OutputOf<RegisteredSchema, TCollectionName>;