@caiquecamargo/vite-plugin-netlify-cms 0.0.13 → 0.0.15

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 +0,0 @@
1
- export {};
@@ -1,41 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { BooleanWidget, CodeWidget, ColorWidget, DateTimeWidget, FileCollection, FileCollectionEntry, FileWidget, FolderCollection, HiddenWidget, ImageWidget, ListWidget, MapWidget, MarkdownWidget, NetlifyCMSConfig, NumberWidget, ObjectWidget, RelationWidget, SelectWidget, StringWidget, TextWidget } from "./types";
3
- export declare const defineConfig: (config: NetlifyCMSConfig) => NetlifyCMSConfig;
4
- export declare const defineFolderCollection: (collection: FolderCollection) => FolderCollection;
5
- export declare const defineFileCollection: (collection: FileCollection) => FileCollection;
6
- export declare const defineFileCollectionEntry: (collection: FileCollectionEntry) => FileCollectionEntry;
7
- export declare const defineBooleanWidget: (widget: Omit<BooleanWidget, "widget">) => BooleanWidget;
8
- export declare const defineCodeWidget: (widget: Omit<CodeWidget, "widget">) => CodeWidget;
9
- export declare const defineColorWidget: (widget: Omit<ColorWidget, "widget">) => ColorWidget;
10
- export declare const defineDateTimeWidget: (widget: Omit<DateTimeWidget, "widget">) => {
11
- default?: string | undefined;
12
- name: string;
13
- label?: string | undefined;
14
- required?: boolean | undefined;
15
- pattern?: string[] | undefined;
16
- comment?: string | undefined;
17
- format?: string | undefined;
18
- date_format?: string | boolean | undefined;
19
- time_format?: string | boolean | undefined;
20
- picker_utc?: boolean | undefined;
21
- widget: string;
22
- };
23
- export declare const defineHiddenWidget: (widget: Omit<HiddenWidget, "widget">) => HiddenWidget;
24
- export declare const defineFileWidget: (widget: Omit<FileWidget, "widget">) => FileWidget;
25
- export declare const defineImageWidget: (widget: Omit<ImageWidget, "widget">) => ImageWidget;
26
- export declare const defineListWidget: (widget: Omit<ListWidget, "widget">) => ListWidget;
27
- export declare const defineMapWidget: (widget: Omit<MapWidget, "widget">) => MapWidget;
28
- export declare const defineNumberWidget: (widget: Omit<NumberWidget, "widget">) => NumberWidget;
29
- export declare const defineObjectWidget: (widget: Omit<ObjectWidget, "widget">) => ObjectWidget;
30
- export declare const defineRelationWidget: (widget: Omit<RelationWidget, "widget">) => RelationWidget;
31
- export declare const defineSelectWidget: (widget: Omit<SelectWidget, "widget">) => SelectWidget;
32
- export declare const defineStringWidget: (widget: Omit<StringWidget, "widget">) => StringWidget;
33
- export declare const defineTextWidget: (widget: Omit<TextWidget, "widget">) => TextWidget;
34
- export declare const defineMarkdownWidget: (widget: Omit<MarkdownWidget, "widget">) => MarkdownWidget;
35
- export type NetlifyCMSEntry = {
36
- configFile?: string;
37
- config?: NetlifyCMSConfig;
38
- saveFolder?: string;
39
- };
40
- export declare const createConfig: (root: string, entry?: NetlifyCMSEntry) => Promise<void>;
41
- export default function (entry?: NetlifyCMSEntry): Promise<Plugin>;
@@ -1,336 +0,0 @@
1
- type Widgets = "boolean" | "code" | "color" | "datetime" | "hidden" | "file" | "image" | "list" | "map" | "number" | "object" | "relation" | "select" | "string" | "text" | "markdown";
2
- interface BaseCollectionField {
3
- name: string;
4
- label?: string;
5
- widget: Widgets;
6
- required?: boolean;
7
- pattern?: string[];
8
- comment?: string;
9
- }
10
- export interface BooleanWidget extends BaseCollectionField {
11
- widget: "boolean";
12
- default?: boolean;
13
- }
14
- export interface CodeWidget extends BaseCollectionField {
15
- widget: "code";
16
- default_language?: string;
17
- allow_language_selection?: boolean;
18
- keys?: string;
19
- output_code_only?: boolean;
20
- }
21
- export interface ColorWidget extends BaseCollectionField {
22
- widget: "color";
23
- default?: string;
24
- allowInput?: boolean;
25
- enableAlpha?: boolean;
26
- }
27
- export interface DateTimeWidget extends BaseCollectionField {
28
- widget: "datetime";
29
- default?: string;
30
- format?: string;
31
- date_format?: string | boolean;
32
- time_format?: string | boolean;
33
- picker_utc?: boolean;
34
- }
35
- export interface HiddenWidget extends BaseCollectionField {
36
- widget: "hidden";
37
- default?: any;
38
- }
39
- export interface FileWidget extends BaseCollectionField {
40
- widget: "file";
41
- default?: string;
42
- media_library?: Record<string, unknown>;
43
- allow_multiple?: boolean;
44
- config?: Record<string, unknown>;
45
- media_folder?: string;
46
- choose_url?: boolean;
47
- }
48
- export interface ImageWidget extends BaseCollectionField {
49
- widget: "image";
50
- default?: string;
51
- media_library?: Record<string, unknown>;
52
- allow_multiple?: boolean;
53
- config?: Record<string, unknown>;
54
- media_folder?: string;
55
- choose_url?: boolean;
56
- }
57
- export interface ListWidget extends BaseCollectionField {
58
- widget: "list";
59
- default?: string[] | CollectionField[];
60
- allow_add?: boolean;
61
- collapsed?: boolean;
62
- summary?: string;
63
- minimize_collapsed?: boolean;
64
- label_singular?: string;
65
- field?: CollectionField;
66
- fields?: CollectionField[];
67
- types?: ObjectWidget[];
68
- max?: number;
69
- min?: number;
70
- add_to_top?: boolean;
71
- }
72
- export interface MapWidget extends BaseCollectionField {
73
- widget: "map";
74
- default?: string;
75
- decimals?: number;
76
- type?: "Point" | "LineString" | "Polygon";
77
- }
78
- export interface NumberWidget extends BaseCollectionField {
79
- widget: "number";
80
- default?: string | number;
81
- value_type?: "int" | "float";
82
- min?: number;
83
- max?: number;
84
- step?: number;
85
- }
86
- export interface ObjectWidget extends BaseCollectionField {
87
- widget: "object";
88
- default?: CollectionField[];
89
- collapsed?: boolean;
90
- summary?: string;
91
- fields: CollectionField[];
92
- }
93
- export interface RelationWidget extends BaseCollectionField {
94
- widget: "relation";
95
- default?: any;
96
- collection: string;
97
- value_field: string;
98
- search_fields: string[];
99
- file?: string;
100
- display_fields?: string[];
101
- multiple?: boolean;
102
- min?: number;
103
- max?: number;
104
- options_length?: number;
105
- }
106
- export interface SelectWidget extends BaseCollectionField {
107
- widget: "select";
108
- default?: string | {
109
- label: string;
110
- value: string;
111
- };
112
- options?: string[] | {
113
- label: string;
114
- value: string;
115
- }[];
116
- multiple?: boolean;
117
- min?: number;
118
- max?: number;
119
- }
120
- export interface StringWidget extends BaseCollectionField {
121
- widget: "string";
122
- default?: string;
123
- }
124
- export interface TextWidget extends BaseCollectionField {
125
- widget: "text";
126
- default?: string;
127
- }
128
- type MarkdownButtons = "bold" | "italic" | "code" | "link" | "heading-one" | "heading-two" | "heading-three | heading-four" | "heading-five" | "heading-six" | "quote" | "bulleted-list" | "numbered-list";
129
- export interface MarkdownWidget extends BaseCollectionField {
130
- widget: "markdown";
131
- default?: string;
132
- buttons?: MarkdownButtons[];
133
- editor_components?: ("image" | "code-block")[];
134
- modes?: ("raw" | "rich_text")[];
135
- sanitize_preview?: boolean;
136
- }
137
- export type CollectionField = BooleanWidget | CodeWidget | ColorWidget | DateTimeWidget | HiddenWidget | FileWidget | ImageWidget | ListWidget | MapWidget | NumberWidget | ObjectWidget | RelationWidget | SelectWidget | StringWidget | TextWidget | MarkdownWidget;
138
- export interface Collection {
139
- /**
140
- * unique identifier for the collection, used as the key
141
- * when referenced in other contexts (like the relation widget)
142
- */
143
- name: string;
144
- /**
145
- * Identifier field for the collection.
146
- *
147
- * defaults to title
148
- */
149
- identifier_field?: string;
150
- /**
151
- * label for the collection in the editor UI;
152
- * defaults to the value of name
153
- */
154
- label?: string;
155
- /**
156
- * singular label for certain elements in the editor;
157
- * defaults to the value of label
158
- */
159
- label_singular?: string;
160
- /**
161
- * optional text, displayed below the label when viewing a collection
162
- */
163
- description?: string;
164
- /**
165
- * for publish_mode: editorial_workflow only;
166
- * false hides UI publishing controls for a collection;
167
- *
168
- * defaults to true
169
- */
170
- publish?: boolean;
171
- /**
172
- * true hides a collection in the CMS UI;
173
- *
174
- * defaults to false.
175
- * Useful when using the relation widget to hide referenced collections.
176
- */
177
- hide?: boolean;
178
- /**
179
- * false prevents users from deleting items in a collection;
180
- *
181
- * defaults to true
182
- */
183
- delete?: boolean;
184
- /**
185
- * These settings determine how collection files are parsed and saved.
186
- */
187
- extension?: "yml" | "yaml" | "toml" | "json" | "md" | "markdown" | "html";
188
- /**
189
- * These settings determine how collection files are parsed and saved.
190
- */
191
- format?: "yml" | "yaml" | "toml" | "json" | "frontmatter" | "yaml-frontmatter" | "toml-frontmatter" | "json-frontmatter";
192
- frontmatter_delimiter?: string;
193
- /**
194
- * specifies a template for generating new filenames
195
- * based on a file's creation date and title field
196
- */
197
- slug?: string;
198
- /**
199
- * A string representing the path where content in this collection can be found on the live site.
200
- */
201
- preview_path?: string;
202
- /**
203
- * The name of a date field for parsing date-based template tags from preview_path
204
- */
205
- preview_path_date_field?: string;
206
- /**
207
- * The fields option maps editor UI widgets to field-value pairs in the saved file
208
- */
209
- fields: CollectionField[];
210
- /**
211
- * changes options for the editor view of a collection
212
- */
213
- editor?: {
214
- preview?: boolean;
215
- };
216
- summary?: string;
217
- /**
218
- * An optional list of sort fields to show in the UI.
219
- */
220
- sortable_fields?: string;
221
- /**
222
- * An optional list of predefined view filters to show in the UI.
223
- */
224
- view_filters?: string;
225
- /**
226
- * An optional list of predefined view groups to show in the UI.
227
- */
228
- view_groups?: string;
229
- }
230
- export interface FileCollection {
231
- name: string;
232
- label?: string;
233
- files: FileCollectionEntry[];
234
- }
235
- export interface FileCollectionEntry extends Collection {
236
- /**
237
- * specifies the collection type and location;
238
- * details in Collection Types
239
- */
240
- file: string;
241
- }
242
- export interface FolderCollection extends Collection {
243
- /**
244
- * specifies the collection type and location;
245
- * details in Collection Types
246
- */
247
- folder: string;
248
- /**
249
- * optional filter for folder collections; details in Collection Types
250
- */
251
- filter?: string;
252
- /**
253
- * true allows users to create new items in the collection;
254
- *
255
- * defaults to false
256
- */
257
- create?: boolean;
258
- }
259
- export type NetlifyCMSConfig = {
260
- backend: {
261
- /**
262
- * The name of the backend to use.
263
- */
264
- name: "git-gateway" | "github" | "gitlab" | "bitbucket";
265
- /**
266
- * [org-or-username]/[repo-name] Required for github, gitlab,
267
- * bitbucket and ignored by git-gateway.
268
- */
269
- repo?: string;
270
- /**
271
- * The branch where published content is stored.
272
- * All CMS commits and PRs are made to this branch.
273
- *
274
- * @default master
275
- */
276
- branch?: string;
277
- /**
278
- * The API endpoint. Only necessary in certain cases,
279
- * like with GitHub Enterprise or self-hosted GitLab.
280
- *
281
- * @default https://api.github.com (GitHub),
282
- * @default https://gitlab.com/api/v4 (GitLab)
283
- * @default https://api.bitbucket.org/2.0 (Bitbucket)
284
- */
285
- api_root?: string;
286
- /**
287
- * Sets the site_id query param sent to the API endpoint.
288
- * Non-Netlify auth setups will often need to set this for
289
- * local development to work properly.
290
- *
291
- * @default location.hostname (or cms.netlify.com when on localhost)
292
- */
293
- site_doamin?: string;
294
- /**
295
- * OAuth client hostname (just the base domain, no path).
296
- * Required when using an external OAuth server or self-hosted GitLab.
297
- *
298
- * @default https://api.netlify.com (GitHub, Bitbucket)
299
- * @default https://gitlab.com (GitLab)
300
- */
301
- base_url?: string;
302
- /**
303
- * Path to append to base_url for authentication requests.
304
- *
305
- * @default auth (GitHub, Bitbucket)
306
- * @default oauth/authorize (GitLab)
307
- */
308
- auth_endpoint?: string;
309
- /**
310
- * Pull (or Merge) Requests label prefix when using editorial workflow.
311
- *
312
- * @default netlify-cms/
313
- */
314
- cms_label_prefix?: string;
315
- };
316
- publish_mode?: "editorial_workflow";
317
- media_folder: string;
318
- public_folder?: string;
319
- media_library?: {
320
- name: string;
321
- config?: Record<string, unknown>;
322
- };
323
- site_url?: string;
324
- display_url?: string;
325
- logo_url?: string;
326
- locale?: string;
327
- show_preview_links?: boolean;
328
- search?: boolean;
329
- slug?: {
330
- encoding?: "unicode" | "ascii";
331
- clean_accents?: boolean;
332
- sanitize_replacement?: string;
333
- };
334
- collections: (FileCollection | FolderCollection)[];
335
- };
336
- export {};