vite-plugin-decap-cms 0.3.0 → 0.3.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/index.cjs CHANGED
@@ -141,52 +141,44 @@ var VitePress = class {
141
141
  createOverwriteableField("string", {
142
142
  name: "layout",
143
143
  label: "Layout",
144
- required: false,
145
- default: "doc"
144
+ required: false
146
145
  }),
147
146
  createOverwriteableField("boolean", {
148
147
  name: "navbar",
149
148
  label: "Whether to display the navbar",
150
- default: true,
151
149
  required: false
152
150
  }, overwrites == null ? void 0 : overwrites.navbar),
153
151
  createOverwriteableField("boolean", {
154
152
  name: "sidebar",
155
153
  label: "Whether to display the sidebar",
156
- default: true,
157
154
  required: false
158
155
  }, overwrites == null ? void 0 : overwrites.sidebar),
159
156
  // TODO: add aside 'left' option
160
157
  createOverwriteableField("boolean", {
161
158
  name: "aside",
162
159
  label: "Whether to display the aside container",
163
- default: true,
164
160
  required: false
165
161
  }, overwrites == null ? void 0 : overwrites.aside),
166
162
  // TODO: add support for [number, number] | 'deep' | false
167
163
  createOverwriteableField("number", {
168
164
  name: "outline",
169
165
  label: "The header levels in the outline",
170
- default: 2,
171
166
  required: false
172
167
  }, overwrites == null ? void 0 : overwrites.outline),
173
168
  // TODO: add support for Date
174
169
  createOverwriteableField("boolean", {
175
170
  name: "lastUpdated",
176
171
  label: "Whether to display last updated text",
177
- default: true,
178
172
  required: false
179
173
  }, overwrites == null ? void 0 : overwrites.lastUpdated),
180
174
  createOverwriteableField("boolean", {
181
175
  name: "editLink",
182
176
  label: "Whether to display edit link text",
183
- default: true,
184
177
  required: false
185
178
  }, overwrites == null ? void 0 : overwrites.editLink),
186
179
  createOverwriteableField("boolean", {
187
180
  name: "footer",
188
181
  label: "Whether to display footer text",
189
- default: true,
190
182
  required: false
191
183
  }, overwrites == null ? void 0 : overwrites.footer),
192
184
  createOverwriteableField("string", {
@@ -242,8 +234,13 @@ var VitePress = class {
242
234
  * The object fields (`features`, `hero`, `heroActions`) can not be hidden and deleted.
243
235
  */
244
236
  static createHomePageFields(options) {
237
+ var _a;
245
238
  const { overwrites } = options != null ? options : {};
246
239
  const keys = ["hidden", "deleted"];
240
+ function addAdditionalFields(fields) {
241
+ var _a2;
242
+ return (_a2 = fields == null ? void 0 : fields.map((f) => objToSnakeCase(f))) != null ? _a2 : [];
243
+ }
247
244
  return [
248
245
  createField("hidden", {
249
246
  name: "layout",
@@ -298,9 +295,11 @@ var VitePress = class {
298
295
  createOverwriteableField("string", {
299
296
  name: "rel",
300
297
  required: false
301
- }, overwrites == null ? void 0 : overwrites.heroActionRel)
298
+ }, overwrites == null ? void 0 : overwrites.heroActionRel),
299
+ ...addAdditionalFields(options == null ? void 0 : options.additionalHeroActionFields)
302
300
  ].filter(filterUndefined)
303
- }, omit(overwrites == null ? void 0 : overwrites.heroActions, keys))
301
+ }, omit(overwrites == null ? void 0 : overwrites.heroActions, keys)),
302
+ ...addAdditionalFields(options == null ? void 0 : options.additionalHeroFields)
304
303
  ].filter(filterUndefined)
305
304
  }, omit(overwrites == null ? void 0 : overwrites.hero, keys)),
306
305
  createOverwriteableField("list", {
@@ -340,7 +339,8 @@ var VitePress = class {
340
339
  createOverwriteableField("string", {
341
340
  name: "rel",
342
341
  required: false
343
- }, overwrites == null ? void 0 : overwrites.featuresRel)
342
+ }, overwrites == null ? void 0 : overwrites.featuresRel),
343
+ ...addAdditionalFields((_a = options == null ? void 0 : options.additionalFeatureFields) != null ? _a : [])
344
344
  ].filter(filterUndefined)
345
345
  }, omit(overwrites == null ? void 0 : overwrites.features, keys))
346
346
  ];
package/dist/index.d.cts CHANGED
@@ -269,7 +269,7 @@ interface VitePressFieldOptions extends BaseVitePressFieldOptions<VitePressPageF
269
269
  type VitePressDefaultThemeFrontmatterKeys = 'layout' | 'navbar' | 'sidebar' | 'aside' | 'outline' | 'lastUpdated' | 'editLink' | 'footer' | 'pageClass';
270
270
  type VitePressDefaultThemeFieldOptions = BaseVitePressFieldOptions<VitePressDefaultThemeFrontmatterKeys>;
271
271
  type VitePressHomePageFrontmatterKeys = 'hero' | 'heroName' | 'heroText' | 'heroTagline' | 'heroImage' | 'heroActions' | 'heroActionTheme' | 'heroActionText' | 'heroActionLink' | 'heroActionTarget' | 'heroActionRel' | 'features' | 'featuresTitle' | 'featuresDetails' | 'featuresIcon' | 'featuresLink' | 'featuresLinkText' | 'featuresRel' | 'featuresTarget';
272
- type VitePressHomePageFieldOptions = BaseVitePressFieldOptions<VitePressHomePageFrontmatterKeys>;
272
+ type VitePressHomePageFieldOptions = BaseVitePressFieldOptions<VitePressHomePageFrontmatterKeys> & Partial<Record<'additionalHeroFields' | 'additionalHeroActionFields' | 'additionalFeatureFields', DecapCmsField[]>>;
273
273
  declare class VitePress {
274
274
  /**
275
275
  * Create fields for:
package/dist/index.d.ts CHANGED
@@ -269,7 +269,7 @@ interface VitePressFieldOptions extends BaseVitePressFieldOptions<VitePressPageF
269
269
  type VitePressDefaultThemeFrontmatterKeys = 'layout' | 'navbar' | 'sidebar' | 'aside' | 'outline' | 'lastUpdated' | 'editLink' | 'footer' | 'pageClass';
270
270
  type VitePressDefaultThemeFieldOptions = BaseVitePressFieldOptions<VitePressDefaultThemeFrontmatterKeys>;
271
271
  type VitePressHomePageFrontmatterKeys = 'hero' | 'heroName' | 'heroText' | 'heroTagline' | 'heroImage' | 'heroActions' | 'heroActionTheme' | 'heroActionText' | 'heroActionLink' | 'heroActionTarget' | 'heroActionRel' | 'features' | 'featuresTitle' | 'featuresDetails' | 'featuresIcon' | 'featuresLink' | 'featuresLinkText' | 'featuresRel' | 'featuresTarget';
272
- type VitePressHomePageFieldOptions = BaseVitePressFieldOptions<VitePressHomePageFrontmatterKeys>;
272
+ type VitePressHomePageFieldOptions = BaseVitePressFieldOptions<VitePressHomePageFrontmatterKeys> & Partial<Record<'additionalHeroFields' | 'additionalHeroActionFields' | 'additionalFeatureFields', DecapCmsField[]>>;
273
273
  declare class VitePress {
274
274
  /**
275
275
  * Create fields for:
package/dist/index.js CHANGED
@@ -114,52 +114,44 @@ var VitePress = class {
114
114
  createOverwriteableField("string", {
115
115
  name: "layout",
116
116
  label: "Layout",
117
- required: false,
118
- default: "doc"
117
+ required: false
119
118
  }),
120
119
  createOverwriteableField("boolean", {
121
120
  name: "navbar",
122
121
  label: "Whether to display the navbar",
123
- default: true,
124
122
  required: false
125
123
  }, overwrites == null ? void 0 : overwrites.navbar),
126
124
  createOverwriteableField("boolean", {
127
125
  name: "sidebar",
128
126
  label: "Whether to display the sidebar",
129
- default: true,
130
127
  required: false
131
128
  }, overwrites == null ? void 0 : overwrites.sidebar),
132
129
  // TODO: add aside 'left' option
133
130
  createOverwriteableField("boolean", {
134
131
  name: "aside",
135
132
  label: "Whether to display the aside container",
136
- default: true,
137
133
  required: false
138
134
  }, overwrites == null ? void 0 : overwrites.aside),
139
135
  // TODO: add support for [number, number] | 'deep' | false
140
136
  createOverwriteableField("number", {
141
137
  name: "outline",
142
138
  label: "The header levels in the outline",
143
- default: 2,
144
139
  required: false
145
140
  }, overwrites == null ? void 0 : overwrites.outline),
146
141
  // TODO: add support for Date
147
142
  createOverwriteableField("boolean", {
148
143
  name: "lastUpdated",
149
144
  label: "Whether to display last updated text",
150
- default: true,
151
145
  required: false
152
146
  }, overwrites == null ? void 0 : overwrites.lastUpdated),
153
147
  createOverwriteableField("boolean", {
154
148
  name: "editLink",
155
149
  label: "Whether to display edit link text",
156
- default: true,
157
150
  required: false
158
151
  }, overwrites == null ? void 0 : overwrites.editLink),
159
152
  createOverwriteableField("boolean", {
160
153
  name: "footer",
161
154
  label: "Whether to display footer text",
162
- default: true,
163
155
  required: false
164
156
  }, overwrites == null ? void 0 : overwrites.footer),
165
157
  createOverwriteableField("string", {
@@ -215,8 +207,13 @@ var VitePress = class {
215
207
  * The object fields (`features`, `hero`, `heroActions`) can not be hidden and deleted.
216
208
  */
217
209
  static createHomePageFields(options) {
210
+ var _a;
218
211
  const { overwrites } = options != null ? options : {};
219
212
  const keys = ["hidden", "deleted"];
213
+ function addAdditionalFields(fields) {
214
+ var _a2;
215
+ return (_a2 = fields == null ? void 0 : fields.map((f) => objToSnakeCase(f))) != null ? _a2 : [];
216
+ }
220
217
  return [
221
218
  createField("hidden", {
222
219
  name: "layout",
@@ -271,9 +268,11 @@ var VitePress = class {
271
268
  createOverwriteableField("string", {
272
269
  name: "rel",
273
270
  required: false
274
- }, overwrites == null ? void 0 : overwrites.heroActionRel)
271
+ }, overwrites == null ? void 0 : overwrites.heroActionRel),
272
+ ...addAdditionalFields(options == null ? void 0 : options.additionalHeroActionFields)
275
273
  ].filter(filterUndefined)
276
- }, omit(overwrites == null ? void 0 : overwrites.heroActions, keys))
274
+ }, omit(overwrites == null ? void 0 : overwrites.heroActions, keys)),
275
+ ...addAdditionalFields(options == null ? void 0 : options.additionalHeroFields)
277
276
  ].filter(filterUndefined)
278
277
  }, omit(overwrites == null ? void 0 : overwrites.hero, keys)),
279
278
  createOverwriteableField("list", {
@@ -313,7 +312,8 @@ var VitePress = class {
313
312
  createOverwriteableField("string", {
314
313
  name: "rel",
315
314
  required: false
316
- }, overwrites == null ? void 0 : overwrites.featuresRel)
315
+ }, overwrites == null ? void 0 : overwrites.featuresRel),
316
+ ...addAdditionalFields((_a = options == null ? void 0 : options.additionalFeatureFields) != null ? _a : [])
317
317
  ].filter(filterUndefined)
318
318
  }, omit(overwrites == null ? void 0 : overwrites.features, keys))
319
319
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-decap-cms",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Simplify the configuration of Decap cms for Vite projects",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,23 +34,23 @@
34
34
  "overrides": {
35
35
  "react": "^18.3.0",
36
36
  "@types/react": "^18.0.17",
37
- "react-dom": "^18.3.0"
37
+ "react-dom": "^18.3.1"
38
38
  },
39
39
  "dependencies": {
40
+ "decap-cms-core": "^3.3.7",
40
41
  "decap-server": "^3.0.4",
41
- "veaury": "^2.4.1",
42
- "yaml": "^2.4.5"
42
+ "veaury": "^2.4.2",
43
+ "yaml": "^2.5.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@types/node": "18",
46
- "@typescript-eslint/eslint-plugin": "^7.16.0",
47
- "@typescript-eslint/parser": "^7.16.0",
48
- "decap-cms-core": "^3.3.7",
47
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
48
+ "@typescript-eslint/parser": "^7.18.0",
49
49
  "eslint": "^8.57.0",
50
- "tsup": "^8.1.0",
51
- "typescript": "^5.5.3",
52
- "vite": "^5.3.3",
53
- "vitest": "^2.0.1",
54
- "vue": "^3.4.31"
50
+ "tsup": "^8.2.4",
51
+ "typescript": "^5.5.4",
52
+ "vite": "^5.3.5",
53
+ "vitest": "^2.0.5",
54
+ "vue": "^3.4.35"
55
55
  }
56
56
  }