@se-studio/markdown-renderer 1.0.83 → 1.0.84
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/CHANGELOG.md +10 -0
- package/dist/WordPressMarkdownExporter.d.ts +17 -0
- package/dist/WordPressMarkdownExporter.d.ts.map +1 -0
- package/dist/WordPressMarkdownExporter.js +106 -0
- package/dist/WordPressMarkdownExporter.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @se-studio/markdown-renderer
|
|
2
2
|
|
|
3
|
+
## 1.0.84
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bulk version bump: patch for all packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @se-studio/contentful-rest-api@1.0.120
|
|
10
|
+
- @se-studio/core-data-types@1.0.120
|
|
11
|
+
- @se-studio/wordpress-rest-api@1.0.1
|
|
12
|
+
|
|
3
13
|
## 1.0.83
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CmsFetchOptionsLike } from '@se-studio/wordpress-rest-api';
|
|
2
|
+
import { type WordPressConfig, type WordPressConverterContext } from '@se-studio/wordpress-rest-api';
|
|
3
|
+
import type { ContentData } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Fetches WordPress-backed content for markdown export / search indexing (parallel to {@link MarkdownExporter}).
|
|
6
|
+
*/
|
|
7
|
+
export declare class WordPressMarkdownExporter {
|
|
8
|
+
private config;
|
|
9
|
+
private converterContext;
|
|
10
|
+
private fetchOptions;
|
|
11
|
+
constructor(config: WordPressConfig, converterContext: WordPressConverterContext, fetchOptions: CmsFetchOptionsLike);
|
|
12
|
+
fetchContent(type: 'page' | 'article' | 'articleType' | 'blogPost' | 'customType' | 'person' | 'tag', slug: string, params?: {
|
|
13
|
+
articleType?: string;
|
|
14
|
+
customType?: string;
|
|
15
|
+
}): Promise<ContentData | null>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=WordPressMarkdownExporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WordPressMarkdownExporter.d.ts","sourceRoot":"","sources":["../src/WordPressMarkdownExporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAO/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,YAAY,CAAsB;gBAGxC,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,yBAAyB,EAC3C,YAAY,EAAE,mBAAmB;IAO7B,YAAY,CAChB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,EACvF,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAyH/B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { wordpressCategoryRest, wordpressCustomTypeRest, wordpressPageRest, wordpressPersonRest, wordpressPostRest, wordpressTagRest, } from '@se-studio/wordpress-rest-api';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches WordPress-backed content for markdown export / search indexing (parallel to {@link MarkdownExporter}).
|
|
4
|
+
*/
|
|
5
|
+
export class WordPressMarkdownExporter {
|
|
6
|
+
config;
|
|
7
|
+
converterContext;
|
|
8
|
+
fetchOptions;
|
|
9
|
+
constructor(config, converterContext, fetchOptions) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.converterContext = converterContext;
|
|
12
|
+
this.fetchOptions = fetchOptions;
|
|
13
|
+
}
|
|
14
|
+
async fetchContent(type, slug, params) {
|
|
15
|
+
if (type === 'page') {
|
|
16
|
+
const response = await wordpressPageRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
17
|
+
if (!response.data)
|
|
18
|
+
return null;
|
|
19
|
+
const page = response.data;
|
|
20
|
+
return {
|
|
21
|
+
contentType: 'page',
|
|
22
|
+
data: page,
|
|
23
|
+
context: {
|
|
24
|
+
pageContext: { page },
|
|
25
|
+
current: { type: 'Page', id: page.id },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (type === 'article') {
|
|
30
|
+
const response = await wordpressPostRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
31
|
+
if (!response.data)
|
|
32
|
+
return null;
|
|
33
|
+
const article = response.data;
|
|
34
|
+
const at = params?.articleType;
|
|
35
|
+
if (at && article.articleType?.slug && article.articleType.slug !== at) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
contentType: 'article',
|
|
40
|
+
data: article,
|
|
41
|
+
context: {
|
|
42
|
+
pageContext: { article, articleType: article.articleType },
|
|
43
|
+
current: { type: 'Article', id: article.id },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (type === 'customType') {
|
|
48
|
+
const response = await wordpressCustomTypeRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
49
|
+
if (!response.data)
|
|
50
|
+
return null;
|
|
51
|
+
const customType = response.data;
|
|
52
|
+
return {
|
|
53
|
+
contentType: 'customType',
|
|
54
|
+
data: customType,
|
|
55
|
+
context: {
|
|
56
|
+
pageContext: { customType },
|
|
57
|
+
current: { type: 'Custom type', id: customType.id },
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (type === 'articleType') {
|
|
62
|
+
const response = await wordpressCategoryRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
63
|
+
if (!response.data)
|
|
64
|
+
return null;
|
|
65
|
+
const articleType = response.data;
|
|
66
|
+
return {
|
|
67
|
+
contentType: 'articleType',
|
|
68
|
+
data: articleType,
|
|
69
|
+
context: {
|
|
70
|
+
pageContext: { articleType },
|
|
71
|
+
current: { type: 'ArticleType', id: articleType.id },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (type === 'person') {
|
|
76
|
+
const response = await wordpressPersonRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
77
|
+
if (!response.data)
|
|
78
|
+
return null;
|
|
79
|
+
const person = response.data;
|
|
80
|
+
return {
|
|
81
|
+
contentType: 'person',
|
|
82
|
+
data: person,
|
|
83
|
+
context: {
|
|
84
|
+
pageContext: { person, customType: person.customType },
|
|
85
|
+
current: { type: 'Person', id: person.id },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (type === 'tag') {
|
|
90
|
+
const response = await wordpressTagRest(this.config, this.converterContext, slug, this.fetchOptions);
|
|
91
|
+
if (!response.data)
|
|
92
|
+
return null;
|
|
93
|
+
const tag = response.data;
|
|
94
|
+
return {
|
|
95
|
+
contentType: 'tag',
|
|
96
|
+
data: tag,
|
|
97
|
+
context: {
|
|
98
|
+
pageContext: { tag },
|
|
99
|
+
current: { type: 'Tag', id: tag.id },
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=WordPressMarkdownExporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WordPressMarkdownExporter.js","sourceRoot":"","sources":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IAAI,CAAC;YAC1B,OAAO;gBACL,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE;oBACP,WAAW,EAAE,EAAE,GAAG,EAAE;oBACpB,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE;iBAClB;aACrB,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
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,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/markdown-renderer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.84",
|
|
4
4
|
"description": "Markdown renderer for Contentful content",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
"@contentful/rich-text-types": "^17.2.5",
|
|
26
26
|
"html-entities": "^2.6.0",
|
|
27
27
|
"js-yaml": "^4.1.1",
|
|
28
|
-
"@se-studio/contentful-rest-api": "1.0.
|
|
29
|
-
"@se-studio/core-data-types": "1.0.
|
|
28
|
+
"@se-studio/contentful-rest-api": "1.0.120",
|
|
29
|
+
"@se-studio/core-data-types": "1.0.120",
|
|
30
|
+
"@se-studio/wordpress-rest-api": "1.0.1"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@biomejs/biome": "^2.4.10",
|