@easy-web/cms-adapters 1.5.0 → 1.6.0
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/content/index.d.ts +1 -0
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +1 -0
- package/dist/content/index.js.map +1 -1
- package/dist/content/trait-field-sets.d.ts +6 -0
- package/dist/content/trait-field-sets.d.ts.map +1 -0
- package/dist/content/trait-field-sets.js +74 -0
- package/dist/content/trait-field-sets.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/preview-assets/emitter.d.ts +3 -0
- package/dist/preview-assets/emitter.d.ts.map +1 -1
- package/dist/preview-assets/emitter.js +128 -121
- package/dist/preview-assets/emitter.js.map +1 -1
- package/dist/preview-assets/types.d.ts +3 -1
- package/dist/preview-assets/types.d.ts.map +1 -1
- package/dist/preview-assets/types.js +6 -4
- package/dist/preview-assets/types.js.map +1 -1
- package/dist/recipe.d.ts +222 -0
- package/dist/recipe.d.ts.map +1 -0
- package/dist/recipe.js +119 -0
- package/dist/recipe.js.map +1 -0
- package/package.json +2 -2
package/dist/content/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { field } from './fields.js';
|
|
2
2
|
export { fieldSets } from './field-sets.js';
|
|
3
|
+
export { fieldsForTraits, type TraitFieldOptions } from './trait-field-sets.js';
|
|
3
4
|
export { defineContentType, defineSingleton } from './define.js';
|
|
4
5
|
export { toAstroSchema } from './astro-schema.js';
|
|
5
6
|
export type { FieldDef, ContentTypeDef, SingletonDef } from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACzE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvF,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACzE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvF,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/content/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { field } from './fields.js';
|
|
2
2
|
export { fieldSets } from './field-sets.js';
|
|
3
|
+
export { fieldsForTraits } from './trait-field-sets.js';
|
|
3
4
|
export { defineContentType, defineSingleton } from './define.js';
|
|
4
5
|
export { toAstroSchema } from './astro-schema.js';
|
|
5
6
|
export { toDecapCollections, toDecapFiles, buildDecapConfig } from './decap-config.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA0B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentTrait } from '@easy-web/core/contracts';
|
|
2
|
+
import type { UiOptions } from './field-sets.js';
|
|
3
|
+
import type { FieldDef, Folders } from './types.js';
|
|
4
|
+
export type TraitFieldOptions = UiOptions & Folders;
|
|
5
|
+
export declare function fieldsForTraits(traits: readonly ContentTrait[], options?: TraitFieldOptions): readonly FieldDef[];
|
|
6
|
+
//# sourceMappingURL=trait-field-sets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trait-field-sets.d.ts","sourceRoot":"","sources":["../../src/content/trait-field-sets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC;AAyEpD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,GAAE,iBAAsB,GAAG,SAAS,QAAQ,EAAE,CAErH"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { field } from './fields.js';
|
|
2
|
+
function labels(options) {
|
|
3
|
+
const en = options.uiLocale === 'en';
|
|
4
|
+
return {
|
|
5
|
+
title: en ? 'Title' : 'Titel',
|
|
6
|
+
slug: 'Slug',
|
|
7
|
+
summary: en ? 'Summary' : 'Zusammenfassung',
|
|
8
|
+
body: en ? 'Content' : 'Inhalt',
|
|
9
|
+
image: en ? 'Image' : 'Bild',
|
|
10
|
+
photos: en ? 'Photos' : 'Fotos',
|
|
11
|
+
order: en ? 'Order' : 'Reihenfolge',
|
|
12
|
+
taxonomy: en ? 'Taxonomy' : 'Taxonomie',
|
|
13
|
+
publishDate: en ? 'Published date' : 'Veröffentlichungsdatum',
|
|
14
|
+
modifiedDate: en ? 'Modified date' : 'Änderungsdatum',
|
|
15
|
+
startDate: en ? 'Start date' : 'Startdatum',
|
|
16
|
+
endDate: en ? 'End date' : 'Enddatum',
|
|
17
|
+
location: en ? 'Location' : 'Ort',
|
|
18
|
+
cta: en ? 'Call to action' : 'Handlungsaufforderung',
|
|
19
|
+
ctaLabel: en ? 'Label' : 'Beschriftung',
|
|
20
|
+
amount: en ? 'Amount' : 'Betrag',
|
|
21
|
+
currency: en ? 'Currency' : 'Währung',
|
|
22
|
+
featured: en ? 'Featured' : 'Hervorgehoben',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function fieldsForTrait(trait, options) {
|
|
26
|
+
const label = labels(options);
|
|
27
|
+
switch (trait) {
|
|
28
|
+
case 'title':
|
|
29
|
+
return [field.string('title', { label: label.title })];
|
|
30
|
+
case 'slug':
|
|
31
|
+
return [field.string('slug', { label: label.slug, pattern: ['^[a-z0-9]+(?:-[a-z0-9]+)*$', 'Use lowercase kebab-case.'] })];
|
|
32
|
+
case 'summary':
|
|
33
|
+
return [field.text('summary', { label: label.summary })];
|
|
34
|
+
case 'body':
|
|
35
|
+
return [field.body({ label: label.body })];
|
|
36
|
+
case 'image':
|
|
37
|
+
return [field.image('image', { label: label.image, alt: 'required', ...options })];
|
|
38
|
+
case 'photos':
|
|
39
|
+
return [field.images('photos', { label: label.photos, ...options })];
|
|
40
|
+
case 'order':
|
|
41
|
+
return [field.number('order', { label: label.order })];
|
|
42
|
+
case 'taxonomy':
|
|
43
|
+
return [field.list('taxonomy', { label: label.taxonomy, field: field.string('term', { label: label.taxonomy }) })];
|
|
44
|
+
case 'publication':
|
|
45
|
+
return [
|
|
46
|
+
field.date('publishDate', { label: label.publishDate }),
|
|
47
|
+
field.date('modifiedDate', { label: label.modifiedDate, required: false }),
|
|
48
|
+
];
|
|
49
|
+
case 'schedule':
|
|
50
|
+
return [
|
|
51
|
+
field.date('startDate', { label: label.startDate }),
|
|
52
|
+
field.date('endDate', { label: label.endDate, required: false }),
|
|
53
|
+
];
|
|
54
|
+
case 'location':
|
|
55
|
+
return [field.string('location', { label: label.location })];
|
|
56
|
+
case 'cta':
|
|
57
|
+
return [field.object('cta', { label: label.cta, fields: [
|
|
58
|
+
field.string('label', { label: label.ctaLabel }),
|
|
59
|
+
field.string('href', { label: 'Link' }),
|
|
60
|
+
field.boolean('external', { label: 'External' }),
|
|
61
|
+
] })];
|
|
62
|
+
case 'money':
|
|
63
|
+
return [
|
|
64
|
+
field.number('amount', { label: label.amount, valueType: 'float' }),
|
|
65
|
+
field.select('currency', { label: label.currency, options: Intl.supportedValuesOf('currency') }),
|
|
66
|
+
];
|
|
67
|
+
case 'featured':
|
|
68
|
+
return [field.boolean('featured', { label: label.featured })];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function fieldsForTraits(traits, options = {}) {
|
|
72
|
+
return traits.flatMap((trait) => fieldsForTrait(trait, options));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=trait-field-sets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trait-field-sets.js","sourceRoot":"","sources":["../../src/content/trait-field-sets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,SAAS,MAAM,CAAC,OAA0B;IACtC,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC;IACrC,OAAO;QACH,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;QAC7B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB;QAC3C,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QAC/B,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;QAC5B,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;QAC/B,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa;QACnC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW;QACvC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,wBAAwB;QAC7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Ac,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './types/index.js';
|
|
2
2
|
export * from './scaffold/index.js';
|
|
3
|
-
export { field, fieldSets, defineContentType, defineSingleton, toAstroSchema, toDecapCollections, toDecapFiles, buildDecapConfig } from './content/index.js';
|
|
4
|
-
export type { FieldDef, ContentTypeDef, SingletonDef, InferData } from './content/index.js';
|
|
3
|
+
export { field, fieldSets, fieldsForTraits, defineContentType, defineSingleton, toAstroSchema, toDecapCollections, toDecapFiles, buildDecapConfig } from './content/index.js';
|
|
4
|
+
export type { FieldDef, ContentTypeDef, SingletonDef, InferData, TraitFieldOptions } from './content/index.js';
|
|
5
5
|
export { easyWebCmsPreviewAssets } from './preview-assets/index.js';
|
|
6
6
|
export type { CmsPreviewAssetFolder, CmsPreviewAssetOptions } from './preview-assets/index.js';
|
|
7
|
+
export { CMS_MEDIA_RECIPE_ID, cmsMediaRecipe } from './recipe.js';
|
|
8
|
+
export type { CmsMediaRecipeOptions } from './recipe.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9K,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './types/index.js';
|
|
2
2
|
export * from './scaffold/index.js';
|
|
3
|
-
export { field, fieldSets, defineContentType, defineSingleton, toAstroSchema, toDecapCollections, toDecapFiles, buildDecapConfig } from './content/index.js';
|
|
3
|
+
export { field, fieldSets, fieldsForTraits, defineContentType, defineSingleton, toAstroSchema, toDecapCollections, toDecapFiles, buildDecapConfig } from './content/index.js';
|
|
4
4
|
export { easyWebCmsPreviewAssets } from './preview-assets/index.js';
|
|
5
|
+
export { CMS_MEDIA_RECIPE_ID, cmsMediaRecipe } from './recipe.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE9K,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { AstroIntegrationLogger } from 'astro';
|
|
2
2
|
import { type PreviewAssetMapping } from './types.js';
|
|
3
|
+
export declare class CmsPreviewAssetSafetyError extends Error {
|
|
4
|
+
readonly name = "CmsPreviewAssetSafetyError";
|
|
5
|
+
}
|
|
3
6
|
export declare function emitPreviewAssets(outputRoot: string, mappings: readonly PreviewAssetMapping[], logger: AstroIntegrationLogger): Promise<void>;
|
|
4
7
|
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/preview-assets/emitter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/preview-assets/emitter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAMpB,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,gCAAgC;CAC9C;AA6HD,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,SAAS,mBAAmB,EAAE,EACxC,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
|
|
@@ -1,169 +1,176 @@
|
|
|
1
1
|
import * as fs from 'node:fs/promises';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { BROWSER_IMAGE_EXTENSIONS, MAX_INPUT_BYTES,
|
|
4
|
-
class
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.destination = destination;
|
|
10
|
-
}
|
|
3
|
+
import { BROWSER_IMAGE_EXTENSIONS, MAX_AGGREGATE_INPUT_BYTES, MAX_INPUT_BYTES, MAX_PREVIEW_FILES, PREVIEW_MANIFEST, RASTER_EXTENSIONS, } from './types.js';
|
|
4
|
+
export class CmsPreviewAssetSafetyError extends Error {
|
|
5
|
+
name = 'CmsPreviewAssetSafetyError';
|
|
6
|
+
}
|
|
7
|
+
function unsafe(message) {
|
|
8
|
+
throw new CmsPreviewAssetSafetyError(`[easy-web-cms-preview-assets] ${message}`);
|
|
11
9
|
}
|
|
12
10
|
async function loadSharp() {
|
|
13
11
|
try {
|
|
14
12
|
return (await import('sharp')).default;
|
|
15
13
|
}
|
|
16
14
|
catch (error) {
|
|
17
|
-
|
|
18
|
-
throw new Error('[easy-web-cms-preview-assets] Sharp is required when this integration is enabled. Install "sharp@^0.35.0" in the site.', { cause: error });
|
|
19
|
-
}
|
|
20
|
-
throw error;
|
|
15
|
+
throw new Error('[easy-web-cms-preview-assets] Sharp is required when this integration is enabled. Install "sharp@^0.35.0" in the site.', { cause: error });
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
|
-
|
|
18
|
+
function contained(root, target) {
|
|
19
|
+
const relative = path.relative(root, target);
|
|
20
|
+
return relative !== '' && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
21
|
+
}
|
|
22
|
+
async function assertPlainDirectory(directory) {
|
|
23
|
+
const stat = await fs.lstat(directory);
|
|
24
|
+
if (stat.isSymbolicLink())
|
|
25
|
+
unsafe(`directory is a symlink or reparse point: ${directory}`);
|
|
26
|
+
if (!stat.isDirectory())
|
|
27
|
+
unsafe(`path component is not a directory: ${directory}`);
|
|
28
|
+
}
|
|
29
|
+
async function enumerate(sourceRoot, outputRoot, publicPath) {
|
|
24
30
|
try {
|
|
25
|
-
|
|
26
|
-
const nested = await Promise.all(entries.map(async (entry) => {
|
|
27
|
-
const fullPath = path.join(root, entry.name);
|
|
28
|
-
if (entry.isDirectory())
|
|
29
|
-
return enumerate(fullPath);
|
|
30
|
-
return entry.isFile() ? [fullPath] : [];
|
|
31
|
-
}));
|
|
32
|
-
return nested.flat().sort();
|
|
31
|
+
await assertPlainDirectory(sourceRoot);
|
|
33
32
|
}
|
|
34
33
|
catch (error) {
|
|
35
34
|
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
36
35
|
return [];
|
|
37
36
|
throw error;
|
|
38
37
|
}
|
|
38
|
+
const candidates = [];
|
|
39
|
+
const walk = async (directory) => {
|
|
40
|
+
await assertPlainDirectory(directory);
|
|
41
|
+
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
42
|
+
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
43
|
+
const input = path.join(directory, entry.name);
|
|
44
|
+
const stat = await fs.lstat(input);
|
|
45
|
+
if (entry.isSymbolicLink() || stat.isSymbolicLink())
|
|
46
|
+
unsafe(`source contains a symlink or reparse point: ${input}`);
|
|
47
|
+
if (entry.isDirectory()) {
|
|
48
|
+
await walk(input);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (!entry.isFile() || !stat.isFile())
|
|
52
|
+
unsafe(`source contains a non-regular file or reparse point: ${input}`);
|
|
53
|
+
const relative = path.relative(sourceRoot, input);
|
|
54
|
+
if (!contained(sourceRoot, input))
|
|
55
|
+
unsafe(`source file escapes configured root: ${input}`);
|
|
56
|
+
const extension = path.extname(relative).toLowerCase();
|
|
57
|
+
if (!BROWSER_IMAGE_EXTENSIONS.has(extension))
|
|
58
|
+
unsafe(`unsupported preview extension: ${relative}`);
|
|
59
|
+
if (stat.size > MAX_INPUT_BYTES)
|
|
60
|
+
unsafe(`preview file exceeds 10 MiB: ${relative}`);
|
|
61
|
+
const output = path.join(outputRoot, ...publicPath.slice(1).split('/'), relative);
|
|
62
|
+
if (!contained(outputRoot, output))
|
|
63
|
+
unsafe(`preview output escapes build root: ${relative}`);
|
|
64
|
+
candidates.push({ input, relative, output, size: stat.size });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
await walk(sourceRoot);
|
|
68
|
+
return candidates;
|
|
39
69
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
function validateBounds(candidates) {
|
|
71
|
+
if (candidates.length > MAX_PREVIEW_FILES)
|
|
72
|
+
unsafe(`preview file count exceeds ${MAX_PREVIEW_FILES}`);
|
|
73
|
+
const aggregate = candidates.reduce((sum, file) => sum + file.size, 0);
|
|
74
|
+
if (aggregate > MAX_AGGREGATE_INPUT_BYTES)
|
|
75
|
+
unsafe('preview files exceed 100 MiB aggregate');
|
|
76
|
+
const folded = new Map();
|
|
77
|
+
for (const candidate of candidates) {
|
|
78
|
+
const key = candidate.output.toLocaleLowerCase('en-US');
|
|
79
|
+
const previous = folded.get(key);
|
|
80
|
+
if (previous && previous !== candidate.output)
|
|
81
|
+
unsafe(`case-collision between ${previous} and ${candidate.output}`);
|
|
82
|
+
folded.set(key, candidate.output);
|
|
49
83
|
}
|
|
50
84
|
}
|
|
51
|
-
async function
|
|
85
|
+
async function readManifest(outputRoot) {
|
|
86
|
+
const manifestPath = path.join(outputRoot, PREVIEW_MANIFEST);
|
|
52
87
|
try {
|
|
53
|
-
await fs.
|
|
54
|
-
|
|
88
|
+
const parsed = JSON.parse(await fs.readFile(manifestPath, 'utf8'));
|
|
89
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.files) || parsed.files.some((file) => typeof file !== 'string')) {
|
|
90
|
+
unsafe(`invalid preview manifest: ${manifestPath}`);
|
|
91
|
+
}
|
|
92
|
+
for (const file of parsed.files) {
|
|
93
|
+
const target = path.resolve(outputRoot, ...file.split('/'));
|
|
94
|
+
if (!contained(outputRoot, target))
|
|
95
|
+
unsafe(`manifest path escapes build root: ${file}`);
|
|
96
|
+
}
|
|
97
|
+
return new Set(parsed.files);
|
|
55
98
|
}
|
|
56
99
|
catch (error) {
|
|
57
100
|
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
58
|
-
return;
|
|
101
|
+
return new Set();
|
|
59
102
|
throw error;
|
|
60
103
|
}
|
|
61
104
|
}
|
|
62
|
-
async function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
throw new PreviewOutputPathError(directory, 'path component is not a directory');
|
|
68
|
-
}
|
|
69
|
-
async function ensureSecureParent(outputRoot, target) {
|
|
70
|
-
const relativeTarget = path.relative(outputRoot, target);
|
|
71
|
-
if (relativeTarget === '' || relativeTarget === '..' || relativeTarget.startsWith(`..${path.sep}`) || path.isAbsolute(relativeTarget)) {
|
|
72
|
-
throw new PreviewOutputPathError(target, 'target escapes the Astro output root');
|
|
73
|
-
}
|
|
74
|
-
await assertDirectory(outputRoot);
|
|
75
|
-
const parentParts = path.dirname(relativeTarget).split(path.sep).filter((part) => part.length > 0 && part !== '.');
|
|
105
|
+
async function secureParent(outputRoot, target) {
|
|
106
|
+
if (!contained(outputRoot, target))
|
|
107
|
+
unsafe(`output escapes build root: ${target}`);
|
|
108
|
+
await assertPlainDirectory(outputRoot);
|
|
109
|
+
const parts = path.dirname(path.relative(outputRoot, target)).split(path.sep).filter((part) => part && part !== '.');
|
|
76
110
|
let current = outputRoot;
|
|
77
|
-
for (const part of
|
|
111
|
+
for (const part of parts) {
|
|
78
112
|
current = path.join(current, part);
|
|
79
113
|
try {
|
|
80
|
-
await
|
|
114
|
+
await assertPlainDirectory(current);
|
|
81
115
|
}
|
|
82
116
|
catch (error) {
|
|
83
117
|
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT'))
|
|
84
118
|
throw error;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
catch (mkdirError) {
|
|
89
|
-
if (!(mkdirError instanceof Error && 'code' in mkdirError && mkdirError.code === 'EEXIST'))
|
|
90
|
-
throw mkdirError;
|
|
91
|
-
}
|
|
92
|
-
await assertDirectory(current);
|
|
119
|
+
await fs.mkdir(current);
|
|
120
|
+
await assertPlainDirectory(current);
|
|
93
121
|
}
|
|
94
122
|
}
|
|
95
123
|
}
|
|
96
|
-
async function
|
|
97
|
-
if (data.byteLength > MAX_OUTPUT_BYTES)
|
|
98
|
-
throw new RangeError('emitted rendition exceeds 5 MiB');
|
|
99
|
-
await ensureSecureParent(outputRoot, target);
|
|
100
|
-
await assertVacant(target);
|
|
101
|
-
await ensureSecureParent(outputRoot, target);
|
|
102
|
-
const temporary = `${target}.easy-web-${process.pid}-${crypto.randomUUID()}.tmp`;
|
|
124
|
+
async function exists(target) {
|
|
103
125
|
try {
|
|
104
|
-
await fs.
|
|
105
|
-
|
|
126
|
+
await fs.lstat(target);
|
|
127
|
+
return true;
|
|
106
128
|
}
|
|
107
129
|
catch (error) {
|
|
108
|
-
|
|
130
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
131
|
+
return false;
|
|
109
132
|
throw error;
|
|
110
133
|
}
|
|
111
134
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT'))
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
const files = await enumerate(mapping.sourceRoot);
|
|
127
|
-
let emitted = 0;
|
|
128
|
-
let skipped = 0;
|
|
129
|
-
const warnings = [];
|
|
130
|
-
for (const input of files) {
|
|
131
|
-
const relative = path.relative(mapping.sourceRoot, input);
|
|
132
|
-
const extension = path.extname(input).toLowerCase();
|
|
133
|
-
const stat = await fs.stat(input);
|
|
134
|
-
if (!BROWSER_IMAGE_EXTENSIONS.has(extension) || stat.size > MAX_INPUT_BYTES) {
|
|
135
|
-
skipped += 1;
|
|
136
|
-
warnings.push(`${relative}: unsupported format or input exceeds 25 MiB`);
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
try {
|
|
140
|
-
const original = await fs.readFile(input);
|
|
141
|
-
const data = RASTER_EXTENSIONS.has(extension)
|
|
142
|
-
? await rasterPipeline(sharp, original, extension).toBuffer()
|
|
143
|
-
: original;
|
|
144
|
-
const target = path.join(outputRoot, ...mapping.publicPath.slice(1).split('/'), relative);
|
|
145
|
-
await atomicWrite(outputRoot, target, data);
|
|
146
|
-
emitted += 1;
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
if (error instanceof PreviewOutputPathError || (error instanceof Error && error.message.includes('output collision')))
|
|
150
|
-
throw error;
|
|
151
|
-
skipped += 1;
|
|
152
|
-
warnings.push(`${relative}: ${error instanceof Error ? error.message : String(error)}`);
|
|
153
|
-
}
|
|
135
|
+
function rasterPipeline(sharp, input, extension) {
|
|
136
|
+
const pipeline = sharp(input).rotate().resize(1600, 1600, { fit: 'inside', withoutEnlargement: true });
|
|
137
|
+
switch (extension) {
|
|
138
|
+
case '.jpg':
|
|
139
|
+
case '.jpeg': return pipeline.jpeg({ quality: 80 });
|
|
140
|
+
case '.png': return pipeline.png({ compressionLevel: 9 });
|
|
141
|
+
case '.webp': return pipeline.webp({ quality: 80 });
|
|
142
|
+
default: throw new TypeError(`unsupported raster extension ${extension}`);
|
|
154
143
|
}
|
|
155
|
-
return { emitted, skipped, warnings };
|
|
156
144
|
}
|
|
157
145
|
export async function emitPreviewAssets(outputRoot, mappings, logger) {
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
146
|
+
await assertPlainDirectory(outputRoot);
|
|
147
|
+
const nested = await Promise.all(mappings.map((mapping) => enumerate(mapping.sourceRoot, outputRoot, mapping.publicPath)));
|
|
148
|
+
const candidates = nested.flat();
|
|
149
|
+
validateBounds(candidates);
|
|
150
|
+
const previous = await readManifest(outputRoot);
|
|
151
|
+
const next = new Set(candidates.map((candidate) => path.relative(outputRoot, candidate.output).split(path.sep).join('/')));
|
|
152
|
+
for (const stale of previous) {
|
|
153
|
+
if (!next.has(stale))
|
|
154
|
+
await fs.rm(path.resolve(outputRoot, ...stale.split('/')), { force: true });
|
|
155
|
+
}
|
|
156
|
+
const sharp = candidates.some((candidate) => RASTER_EXTENSIONS.has(path.extname(candidate.relative).toLowerCase()))
|
|
157
|
+
? await loadSharp() : undefined;
|
|
158
|
+
for (const candidate of candidates) {
|
|
159
|
+
const relativeOutput = path.relative(outputRoot, candidate.output).split(path.sep).join('/');
|
|
160
|
+
await secureParent(outputRoot, candidate.output);
|
|
161
|
+
if (await exists(candidate.output) && !previous.has(relativeOutput))
|
|
162
|
+
unsafe(`output collision with unowned file: ${relativeOutput}`);
|
|
163
|
+
const original = await fs.readFile(candidate.input);
|
|
164
|
+
const extension = path.extname(candidate.relative).toLowerCase();
|
|
165
|
+
const data = RASTER_EXTENSIONS.has(extension) ? await rasterPipeline(sharp, original, extension).toBuffer() : original;
|
|
166
|
+
const temporary = `${candidate.output}.easy-web-${process.pid}-${crypto.randomUUID()}.tmp`;
|
|
167
|
+
await fs.writeFile(temporary, data);
|
|
168
|
+
if (previous.has(relativeOutput))
|
|
169
|
+
await fs.rm(candidate.output, { force: true });
|
|
170
|
+
await fs.rename(temporary, candidate.output);
|
|
171
|
+
}
|
|
172
|
+
const manifest = { version: 1, files: [...next].sort() };
|
|
173
|
+
await fs.writeFile(path.join(outputRoot, PREVIEW_MANIFEST), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
174
|
+
logger.info(`Emitted ${candidates.length} bounded CMS preview asset(s).`);
|
|
168
175
|
}
|
|
169
176
|
//# sourceMappingURL=emitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/preview-assets/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACL,wBAAwB,
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/preview-assets/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,YAAY,CAAC;AAMpB,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,4BAA4B,CAAC;CAC9C;AAED,SAAS,MAAM,CAAC,OAAe;IAC7B,MAAM,IAAI,0BAA0B,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,KAAK,UAAU,SAAS;IACtB,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,wHAAwH,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9J,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,MAAc;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAA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C,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,KAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACxH,MAAM,SAAS,GAAG,GAAG,SAAS,CAAC,MAAM,aAAa,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;QAC3F,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC;YAAE,MAAM,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjF,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,QAAQ,GAAa,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IACnE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9G,MAAM,CAAC,IAAI,CAAC,WAAW,UAAU,CAAC,MAAM,gCAAgC,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -11,6 +11,8 @@ export type PreviewAssetMapping = CmsPreviewAssetFolder & {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const BROWSER_IMAGE_EXTENSIONS: Set<string>;
|
|
13
13
|
export declare const RASTER_EXTENSIONS: Set<string>;
|
|
14
|
+
export declare const MAX_PREVIEW_FILES = 500;
|
|
14
15
|
export declare const MAX_INPUT_BYTES: number;
|
|
15
|
-
export declare const
|
|
16
|
+
export declare const MAX_AGGREGATE_INPUT_BYTES: number;
|
|
17
|
+
export declare const PREVIEW_MANIFEST = ".easy-web-cms-preview-assets.json";
|
|
16
18
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/preview-assets/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,aAEnC,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAE5B,CAAC;AAEH,eAAO,MAAM,eAAe,QAAmB,CAAC;AAChD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/preview-assets/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,aAEnC,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAE5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,eAAe,QAAmB,CAAC;AAChD,eAAO,MAAM,yBAAyB,QAAoB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,sCAAsC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export const BROWSER_IMAGE_EXTENSIONS = new Set([
|
|
2
|
-
'.
|
|
2
|
+
'.gif', '.jpeg', '.jpg', '.png', '.svg', '.webp',
|
|
3
3
|
]);
|
|
4
4
|
export const RASTER_EXTENSIONS = new Set([
|
|
5
|
-
'.
|
|
5
|
+
'.jpeg', '.jpg', '.png', '.webp',
|
|
6
6
|
]);
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
7
|
+
export const MAX_PREVIEW_FILES = 500;
|
|
8
|
+
export const MAX_INPUT_BYTES = 10 * 1024 * 1024;
|
|
9
|
+
export const MAX_AGGREGATE_INPUT_BYTES = 100 * 1024 * 1024;
|
|
10
|
+
export const PREVIEW_MANIFEST = '.easy-web-cms-preview-assets.json';
|
|
9
11
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/preview-assets/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IAC9C,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/preview-assets/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IAC9C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mCAAmC,CAAC"}
|
package/dist/recipe.d.ts
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
export declare const CMS_MEDIA_RECIPE_ID = "cms.decap-media";
|
|
3
|
+
declare const cmsMediaRecipeOptionsSchema: z.ZodObject<{
|
|
4
|
+
composition: z.ZodReadonly<z.ZodObject<{
|
|
5
|
+
contentLocales: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ContentLocale", "out">>>;
|
|
6
|
+
contentTypes: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
7
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
8
|
+
title: "title";
|
|
9
|
+
slug: "slug";
|
|
10
|
+
summary: "summary";
|
|
11
|
+
body: "body";
|
|
12
|
+
image: "image";
|
|
13
|
+
photos: "photos";
|
|
14
|
+
order: "order";
|
|
15
|
+
taxonomy: "taxonomy";
|
|
16
|
+
publication: "publication";
|
|
17
|
+
schedule: "schedule";
|
|
18
|
+
location: "location";
|
|
19
|
+
cta: "cta";
|
|
20
|
+
money: "money";
|
|
21
|
+
featured: "featured";
|
|
22
|
+
}>>>;
|
|
23
|
+
currency: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">>;
|
|
24
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
25
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
27
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
28
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
29
|
+
homepage: "homepage";
|
|
30
|
+
list: "list";
|
|
31
|
+
detail: "detail";
|
|
32
|
+
navigation: "navigation";
|
|
33
|
+
"cms-admin": "cms-admin";
|
|
34
|
+
}>>>;
|
|
35
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
36
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
37
|
+
title: "title";
|
|
38
|
+
slug: "slug";
|
|
39
|
+
summary: "summary";
|
|
40
|
+
body: "body";
|
|
41
|
+
image: "image";
|
|
42
|
+
photos: "photos";
|
|
43
|
+
order: "order";
|
|
44
|
+
taxonomy: "taxonomy";
|
|
45
|
+
publication: "publication";
|
|
46
|
+
schedule: "schedule";
|
|
47
|
+
location: "location";
|
|
48
|
+
cta: "cta";
|
|
49
|
+
money: "money";
|
|
50
|
+
featured: "featured";
|
|
51
|
+
}>>>;
|
|
52
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
53
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
55
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
57
|
+
homepage: "homepage";
|
|
58
|
+
list: "list";
|
|
59
|
+
detail: "detail";
|
|
60
|
+
navigation: "navigation";
|
|
61
|
+
"cms-admin": "cms-admin";
|
|
62
|
+
}>>>;
|
|
63
|
+
}, z.core.$strict>>]>>>;
|
|
64
|
+
reservedRoutes: z.ZodReadonly<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
65
|
+
}, z.core.$strict>>;
|
|
66
|
+
backend: z.ZodObject<{
|
|
67
|
+
repo: z.ZodString;
|
|
68
|
+
tenantId: z.ZodString;
|
|
69
|
+
appId: z.ZodString;
|
|
70
|
+
branch: z.ZodDefault<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
mediaRoots: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
73
|
+
uiLocale: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
de: "de";
|
|
75
|
+
en: "en";
|
|
76
|
+
}>>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export type CmsMediaRecipeOptions = z.infer<typeof cmsMediaRecipeOptionsSchema>;
|
|
79
|
+
export declare const cmsMediaRecipe: {
|
|
80
|
+
id: string;
|
|
81
|
+
version: string;
|
|
82
|
+
protocolVersion: 1;
|
|
83
|
+
compatibleCliRange: string;
|
|
84
|
+
compatibleRuntimeRange: string;
|
|
85
|
+
provides: string[];
|
|
86
|
+
requires: string[];
|
|
87
|
+
conflicts: never[];
|
|
88
|
+
order: {
|
|
89
|
+
priority: number;
|
|
90
|
+
key: string;
|
|
91
|
+
};
|
|
92
|
+
optionsSchema: z.ZodObject<{
|
|
93
|
+
composition: z.ZodReadonly<z.ZodObject<{
|
|
94
|
+
contentLocales: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "ContentLocale", "out">>>;
|
|
95
|
+
contentTypes: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
|
|
96
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
97
|
+
title: "title";
|
|
98
|
+
slug: "slug";
|
|
99
|
+
summary: "summary";
|
|
100
|
+
body: "body";
|
|
101
|
+
image: "image";
|
|
102
|
+
photos: "photos";
|
|
103
|
+
order: "order";
|
|
104
|
+
taxonomy: "taxonomy";
|
|
105
|
+
publication: "publication";
|
|
106
|
+
schedule: "schedule";
|
|
107
|
+
location: "location";
|
|
108
|
+
cta: "cta";
|
|
109
|
+
money: "money";
|
|
110
|
+
featured: "featured";
|
|
111
|
+
}>>>;
|
|
112
|
+
currency: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "CurrencyCode", "out">>;
|
|
113
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
114
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
116
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
117
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
118
|
+
homepage: "homepage";
|
|
119
|
+
list: "list";
|
|
120
|
+
detail: "detail";
|
|
121
|
+
navigation: "navigation";
|
|
122
|
+
"cms-admin": "cms-admin";
|
|
123
|
+
}>>>;
|
|
124
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
125
|
+
traits: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
126
|
+
title: "title";
|
|
127
|
+
slug: "slug";
|
|
128
|
+
summary: "summary";
|
|
129
|
+
body: "body";
|
|
130
|
+
image: "image";
|
|
131
|
+
photos: "photos";
|
|
132
|
+
order: "order";
|
|
133
|
+
taxonomy: "taxonomy";
|
|
134
|
+
publication: "publication";
|
|
135
|
+
schedule: "schedule";
|
|
136
|
+
location: "location";
|
|
137
|
+
cta: "cta";
|
|
138
|
+
money: "money";
|
|
139
|
+
featured: "featured";
|
|
140
|
+
}>>>;
|
|
141
|
+
id: z.core.$ZodBranded<z.ZodString, "ContentTypeId", "out">;
|
|
142
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
143
|
+
labels: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
144
|
+
routes: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
145
|
+
bindings: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
146
|
+
homepage: "homepage";
|
|
147
|
+
list: "list";
|
|
148
|
+
detail: "detail";
|
|
149
|
+
navigation: "navigation";
|
|
150
|
+
"cms-admin": "cms-admin";
|
|
151
|
+
}>>>;
|
|
152
|
+
}, z.core.$strict>>]>>>;
|
|
153
|
+
reservedRoutes: z.ZodReadonly<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
154
|
+
}, z.core.$strict>>;
|
|
155
|
+
backend: z.ZodObject<{
|
|
156
|
+
repo: z.ZodString;
|
|
157
|
+
tenantId: z.ZodString;
|
|
158
|
+
appId: z.ZodString;
|
|
159
|
+
branch: z.ZodDefault<z.ZodString>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
mediaRoots: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
162
|
+
uiLocale: z.ZodDefault<z.ZodEnum<{
|
|
163
|
+
de: "de";
|
|
164
|
+
en: "en";
|
|
165
|
+
}>>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
outputContributions: ({
|
|
168
|
+
kind: "dependency";
|
|
169
|
+
id: string;
|
|
170
|
+
target: string;
|
|
171
|
+
} | {
|
|
172
|
+
kind: "file";
|
|
173
|
+
id: string;
|
|
174
|
+
target: string;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "configuration";
|
|
177
|
+
id: string;
|
|
178
|
+
target: string;
|
|
179
|
+
} | {
|
|
180
|
+
kind: "route";
|
|
181
|
+
id: string;
|
|
182
|
+
target: string;
|
|
183
|
+
})[];
|
|
184
|
+
validators: never[];
|
|
185
|
+
generate: ({ options }: import("@easy-web/core/recipes").RecipeGenerationContext<{
|
|
186
|
+
composition: Readonly<{
|
|
187
|
+
contentLocales: readonly (string & z.core.$brand<"ContentLocale">)[];
|
|
188
|
+
contentTypes: readonly (Readonly<{
|
|
189
|
+
traits: readonly ("body" | "image" | "summary" | "order" | "title" | "cta" | "location" | "slug" | "photos" | "taxonomy" | "publication" | "schedule" | "money" | "featured")[];
|
|
190
|
+
id: string & z.core.$brand<"ContentTypeId">;
|
|
191
|
+
primary: boolean;
|
|
192
|
+
labels: Readonly<Record<string, string>>;
|
|
193
|
+
routes: Readonly<Record<string, string>>;
|
|
194
|
+
bindings: readonly ("list" | "navigation" | "homepage" | "detail" | "cms-admin")[];
|
|
195
|
+
currency?: (string & z.core.$brand<"CurrencyCode">) | undefined;
|
|
196
|
+
}> | Readonly<{
|
|
197
|
+
traits: readonly ("body" | "image" | "summary" | "order" | "title" | "cta" | "location" | "slug" | "photos" | "taxonomy" | "publication" | "schedule" | "money" | "featured")[];
|
|
198
|
+
id: string & z.core.$brand<"ContentTypeId">;
|
|
199
|
+
primary: boolean;
|
|
200
|
+
labels: Readonly<Record<string, string>>;
|
|
201
|
+
routes: Readonly<Record<string, string>>;
|
|
202
|
+
bindings: readonly ("list" | "navigation" | "homepage" | "detail" | "cms-admin")[];
|
|
203
|
+
}>)[];
|
|
204
|
+
reservedRoutes: readonly string[];
|
|
205
|
+
}>;
|
|
206
|
+
backend: {
|
|
207
|
+
repo: string;
|
|
208
|
+
tenantId: string;
|
|
209
|
+
appId: string;
|
|
210
|
+
branch: string;
|
|
211
|
+
};
|
|
212
|
+
mediaRoots: readonly string[];
|
|
213
|
+
uiLocale: "de" | "en";
|
|
214
|
+
}>) => {
|
|
215
|
+
files: {
|
|
216
|
+
path: string;
|
|
217
|
+
content: string;
|
|
218
|
+
}[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
export default cmsMediaRecipe;
|
|
222
|
+
//# sourceMappingURL=recipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAU9B,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAGrD,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiB/B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAyDhF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCsB,CAAC;AAElD,eAAe,cAAc,CAAC"}
|
package/dist/recipe.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
import { contentCompositionSchema, } from '@easy-web/core/contracts';
|
|
3
|
+
import { buildDecapConfig } from './content/decap-config.js';
|
|
4
|
+
import { defineContentType } from './content/define.js';
|
|
5
|
+
import { fieldsForTraits } from './content/trait-field-sets.js';
|
|
6
|
+
export const CMS_MEDIA_RECIPE_ID = 'cms.decap-media';
|
|
7
|
+
const rootSchema = z.string().regex(/^src\/assets\/[a-z0-9]+(?:[/-][a-z0-9]+)*$/);
|
|
8
|
+
const cmsMediaRecipeOptionsSchema = z.strictObject({
|
|
9
|
+
composition: contentCompositionSchema,
|
|
10
|
+
backend: z.strictObject({
|
|
11
|
+
repo: z.string().min(1),
|
|
12
|
+
tenantId: z.string().min(1),
|
|
13
|
+
appId: z.string().min(1),
|
|
14
|
+
branch: z.string().min(1).default('main'),
|
|
15
|
+
}),
|
|
16
|
+
mediaRoots: z.array(rootSchema).min(1).max(20).superRefine((roots, context) => {
|
|
17
|
+
const folded = new Set();
|
|
18
|
+
roots.forEach((root, index) => {
|
|
19
|
+
const key = root.toLocaleLowerCase('en-US');
|
|
20
|
+
if (folded.has(key))
|
|
21
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: [index], message: 'Media roots must not case-collide' });
|
|
22
|
+
folded.add(key);
|
|
23
|
+
});
|
|
24
|
+
}).readonly(),
|
|
25
|
+
uiLocale: z.enum(['de', 'en']).default('de'),
|
|
26
|
+
});
|
|
27
|
+
function identifierTraits(traits) {
|
|
28
|
+
if (traits.includes('title'))
|
|
29
|
+
return ['title'];
|
|
30
|
+
if (traits.includes('slug'))
|
|
31
|
+
return ['slug'];
|
|
32
|
+
return ['title'];
|
|
33
|
+
}
|
|
34
|
+
function runtimeDefinitions(options) {
|
|
35
|
+
const mediaFolder = options.mediaRoots[0];
|
|
36
|
+
const publicFolder = `/${mediaFolder}`;
|
|
37
|
+
return options.composition.contentTypes.map((contentType) => {
|
|
38
|
+
const traits = contentType.traits.includes('title') || contentType.traits.includes('slug')
|
|
39
|
+
? contentType.traits
|
|
40
|
+
: [...identifierTraits(contentType.traits), ...contentType.traits];
|
|
41
|
+
return defineContentType({
|
|
42
|
+
name: contentType.id,
|
|
43
|
+
label: contentType.labels[options.uiLocale] ?? Object.values(contentType.labels)[0] ?? contentType.id,
|
|
44
|
+
folder: `src/content/${contentType.id}`,
|
|
45
|
+
format: 'md',
|
|
46
|
+
slug: '{{slug}}',
|
|
47
|
+
locales: options.composition.contentLocales,
|
|
48
|
+
mediaFolder,
|
|
49
|
+
publicFolder,
|
|
50
|
+
fields: fieldsForTraits(traits, { uiLocale: options.uiLocale, mediaFolder, publicFolder }),
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function definitionsSource(composition, mediaFolder, uiLocale) {
|
|
55
|
+
const definitions = composition.contentTypes.map((contentType) => {
|
|
56
|
+
const traits = contentType.traits.includes('title') || contentType.traits.includes('slug')
|
|
57
|
+
? contentType.traits
|
|
58
|
+
: [...identifierTraits(contentType.traits), ...contentType.traits];
|
|
59
|
+
const label = contentType.labels[uiLocale] ?? Object.values(contentType.labels)[0] ?? contentType.id;
|
|
60
|
+
return `export const ${contentType.id.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())} = defineContentType({\n`
|
|
61
|
+
+ ` name: ${JSON.stringify(contentType.id)}, label: ${JSON.stringify(label)}, folder: ${JSON.stringify(`src/content/${contentType.id}`)},\n`
|
|
62
|
+
+ ` format: 'md', slug: '{{slug}}', locales: contentLocales,\n`
|
|
63
|
+
+ ` mediaFolder, publicFolder, fields: fieldsForTraits(${JSON.stringify(traits)}, { uiLocale: ${JSON.stringify(uiLocale)}, mediaFolder, publicFolder }),\n});`;
|
|
64
|
+
});
|
|
65
|
+
return `import { defineContentType, fieldsForTraits } from '@easy-web/cms-adapters';\n\n`
|
|
66
|
+
+ `export const contentLocales = ${JSON.stringify(composition.contentLocales)} as const;\n`
|
|
67
|
+
+ `export const mediaFolder = ${JSON.stringify(mediaFolder)};\nexport const publicFolder = ${JSON.stringify(`/${mediaFolder}`)};\n\n`
|
|
68
|
+
+ `${definitions.join('\n\n')}\n`;
|
|
69
|
+
}
|
|
70
|
+
function contentConfigSource(composition) {
|
|
71
|
+
const imports = composition.contentTypes.map((contentType) => contentType.id.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()));
|
|
72
|
+
const entries = composition.contentTypes.map((contentType, index) => {
|
|
73
|
+
const name = imports[index];
|
|
74
|
+
return ` ${JSON.stringify(contentType.id)}: defineCollection({ loader: glob({ pattern: '**/*.md', base: ${JSON.stringify(`./src/content/${contentType.id}`)} }), schema: toAstroSchema(${name}) }),`;
|
|
75
|
+
});
|
|
76
|
+
return `import { defineCollection } from 'astro:content';\nimport { glob } from 'astro/loaders';\nimport { toAstroSchema } from '@easy-web/cms-adapters';\nimport { ${imports.join(', ')} } from './content/definitions';\n\nexport const collections = {\n${entries.join('\n')}\n};\n`;
|
|
77
|
+
}
|
|
78
|
+
const adminHtml = `<!doctype html>\n<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex"><title>Content Manager</title><link rel="cms-config-url" href="/admin/config.yml" type="text/yaml"></head><body><script src="https://unpkg.com/decap-cms@3.16.3/dist/decap-cms.js"></script></body></html>\n`;
|
|
79
|
+
export const cmsMediaRecipe = {
|
|
80
|
+
id: CMS_MEDIA_RECIPE_ID,
|
|
81
|
+
version: '1.5.0',
|
|
82
|
+
protocolVersion: 1,
|
|
83
|
+
compatibleCliRange: '^0.1.0',
|
|
84
|
+
compatibleRuntimeRange: '^1.5.0',
|
|
85
|
+
provides: ['cms.decap-media', 'content.typed-definitions', 'media.preview-copy'],
|
|
86
|
+
requires: ['site.shell'],
|
|
87
|
+
conflicts: [],
|
|
88
|
+
order: { priority: 30, key: 'cms' },
|
|
89
|
+
optionsSchema: cmsMediaRecipeOptionsSchema,
|
|
90
|
+
outputContributions: [
|
|
91
|
+
{ kind: 'dependency', id: 'cms.dependencies', target: 'package.json' },
|
|
92
|
+
{ kind: 'file', id: 'cms.definitions', target: 'src/content/definitions.ts' },
|
|
93
|
+
{ kind: 'configuration', id: 'cms.schema', target: 'src/content.config.ts' },
|
|
94
|
+
{ kind: 'configuration', id: 'cms.decap-config', target: 'public/admin/config.yml' },
|
|
95
|
+
{ kind: 'route', id: 'cms.admin', target: 'public/admin/index.html' },
|
|
96
|
+
{ kind: 'configuration', id: 'cms.astro-markdown-preview', target: 'astro.config.mjs' },
|
|
97
|
+
],
|
|
98
|
+
validators: [],
|
|
99
|
+
generate: ({ options }) => {
|
|
100
|
+
const parsed = cmsMediaRecipeOptionsSchema.parse(options);
|
|
101
|
+
const definitions = runtimeDefinitions(parsed);
|
|
102
|
+
const config = buildDecapConfig({
|
|
103
|
+
backend: { name: 'azure', repo: parsed.backend.repo, tenant_id: parsed.backend.tenantId, app_id: parsed.backend.appId, branch: parsed.backend.branch },
|
|
104
|
+
mediaFolder: parsed.mediaRoots[0], publicFolder: `/${parsed.mediaRoots[0]}`, locale: parsed.uiLocale,
|
|
105
|
+
contentTypes: definitions,
|
|
106
|
+
});
|
|
107
|
+
const folders = parsed.mediaRoots.map((source) => ({ source, publicPath: `/${source}` }));
|
|
108
|
+
return { files: [
|
|
109
|
+
{ path: 'package.json', content: `${JSON.stringify({ dependencies: { '@easy-web/core': '^1.5.0', '@easy-web/cms-adapters': '^1.5.0', astro: '^7.3.5', sharp: '^0.35.0' } }, null, 2)}\n` },
|
|
110
|
+
{ path: 'src/content/definitions.ts', content: definitionsSource(parsed.composition, parsed.mediaRoots[0], parsed.uiLocale) },
|
|
111
|
+
{ path: 'src/content.config.ts', content: contentConfigSource(parsed.composition) },
|
|
112
|
+
{ path: 'public/admin/config.yml', content: `${JSON.stringify(config, null, 2)}\n` },
|
|
113
|
+
{ path: 'public/admin/index.html', content: adminHtml },
|
|
114
|
+
{ path: 'astro.config.mjs', content: `import { defineConfig } from 'astro/config';\nimport easyWebMarkdown from '@easy-web/core/markdown';\nimport { easyWebCmsPreviewAssets } from '@easy-web/cms-adapters';\n\nexport default defineConfig({ markdown: { remarkPlugins: [easyWebMarkdown] }, integrations: [easyWebCmsPreviewAssets({ folders: ${JSON.stringify(folders)} })] });\n` },
|
|
115
|
+
] };
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
export default cmsMediaRecipe;
|
|
119
|
+
//# sourceMappingURL=recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../src/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EACL,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAClF,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD,WAAW,EAAE,wBA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2
2
|
"name": "@easy-web/cms-adapters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Decap CMS integration for the easy-web ecosystem — AdminPage component, frontmatter types, and config scaffold.",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@easy-web/core": "1.
|
|
25
|
+
"@easy-web/core": "1.6.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"astro": ">=6.0.0 <8.0.0",
|