fix(build): migrate build tooling to tsbuild v4 and tsbundle config while updating sitemap integration
This commit is contained in:
@@ -17,7 +17,7 @@ export class BuiltInRoutesController {
|
||||
feedMetadata?: plugins.smartfeed.IFeedOptions;
|
||||
articleGetterFunction?: () => Promise<plugins.tsclass.content.IArticle[]>;
|
||||
blockWaybackMachine?: boolean;
|
||||
getSitemapUrls: () => plugins.smartsitemap.IUrlInfo[];
|
||||
getSitemapUrls: () => plugins.smartsitemap.ISitemapUrl[];
|
||||
};
|
||||
|
||||
constructor(options: typeof BuiltInRoutesController.prototype.options) {
|
||||
@@ -64,9 +64,8 @@ export class BuiltInRoutesController {
|
||||
throw new plugins.smartserve.RouteNotFoundError(ctx.path, ctx.method);
|
||||
}
|
||||
|
||||
const smartsitemap = new plugins.smartsitemap.SmartSitemap();
|
||||
const urls = this.options.getSitemapUrls();
|
||||
const sitemapXml = await smartsitemap.createSitemapFromUrlInfoArray(urls);
|
||||
const sitemapXml = plugins.smartsitemap.SmartSitemap.create().addUrls(urls).toXml();
|
||||
|
||||
return new Response(sitemapXml, {
|
||||
status: 200,
|
||||
@@ -80,9 +79,8 @@ export class BuiltInRoutesController {
|
||||
throw new plugins.smartserve.RouteNotFoundError(ctx.path, ctx.method);
|
||||
}
|
||||
|
||||
const smartsitemap = new plugins.smartsitemap.SmartSitemap();
|
||||
const articles = await this.options.articleGetterFunction();
|
||||
const sitemapNewsXml = await smartsitemap.createSitemapNewsFromArticleArray(articles);
|
||||
const sitemapNewsXml = plugins.smartsitemap.SmartSitemap.fromArticles(articles, { publicationName: this.options.domain || 'News' }).toXml();
|
||||
|
||||
return new Response(sitemapNewsXml, {
|
||||
status: 200,
|
||||
@@ -127,7 +125,7 @@ export class BuiltInRoutesController {
|
||||
@plugins.smartserve.Get('/sw-dash')
|
||||
async getSwDash(ctx: plugins.smartserve.IRequestContext): Promise<Response> {
|
||||
// Import shared HTML from interfaces
|
||||
const { SW_DASH_HTML } = await import('../../dist_ts_interfaces/serviceworker.js');
|
||||
const { SW_DASH_HTML } = await import('../../ts_interfaces/serviceworker.js');
|
||||
return new Response(SW_DASH_HTML, {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'text/html' },
|
||||
|
||||
Reference in New Issue
Block a user