fix(backend): summalyのバージョンを埋め込んでビルドするようにし、同一チャンクに巻き込まれないように (#17595)

* fix(backend): summalyのバージョンを埋め込んでビルドするようにし、同一チャンクに巻き込まれないように

* fix
This commit is contained in:
かっこかり 2026-06-20 22:46:38 +09:00 committed by GitHub
commit 053e244582
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import { defineConfig } from 'rolldown';
import { version as summalyVersion } from '@misskey-dev/summaly';
import type { Plugin, ExternalOption } from 'rolldown';
import { execa, execaNode } from 'execa';
import type { ResultPromise } from 'execa';
@ -84,6 +85,11 @@ export default defineConfig((args) => {
'file-type',
];
const define: Record<string, string> = {
// Summalyのバージョンを埋め込む
'_SUMMALY_VERSION_': JSON.stringify(summalyVersion),
};
if (isE2E) {
return {
input: './test-server/entry.ts',
@ -92,6 +98,9 @@ export default defineConfig((args) => {
plugins: [
esmShim(),
],
transform: {
define,
},
output: {
keepNames: true,
sourcemap: true,
@ -116,6 +125,9 @@ export default defineConfig((args) => {
esmShim(),
(isWatchMode ? backendDevServerPlugin() : undefined),
],
transform: {
define,
},
output: {
keepNames: true,
minify: !isWatchMode,

View file

@ -0,0 +1,6 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
declare const _SUMMALY_VERSION_: string;

View file

@ -4,7 +4,6 @@
*/
import { Inject, Injectable } from '@nestjs/common';
import { version } from '@misskey-dev/summaly';
import type { SummalyResult } from '@misskey-dev/summaly';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
@ -33,7 +32,7 @@ export class UrlPreviewService {
private loggerService: LoggerService,
) {
this.logger = this.loggerService.getLogger('url-preview');
this.summalyDefaultUserAgent = `SummalyBot/${version} (${this.config.url}; +https://github.com/misskey-dev/summaly/blob/master/README.md)`;
this.summalyDefaultUserAgent = `SummalyBot/${_SUMMALY_VERSION_} (${this.config.url}; +https://github.com/misskey-dev/summaly/blob/master/README.md)`;
}
@bindThis