forked from mirrors/misskey
fix(backend): summalyのバージョンを埋め込んでビルドするようにし、同一チャンクに巻き込まれないように (#17595)
* fix(backend): summalyのバージョンを埋め込んでビルドするようにし、同一チャンクに巻き込まれないように * fix
This commit is contained in:
parent
c0a8c7f93a
commit
053e244582
3 changed files with 19 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { defineConfig } from 'rolldown';
|
import { defineConfig } from 'rolldown';
|
||||||
|
import { version as summalyVersion } from '@misskey-dev/summaly';
|
||||||
import type { Plugin, ExternalOption } from 'rolldown';
|
import type { Plugin, ExternalOption } from 'rolldown';
|
||||||
import { execa, execaNode } from 'execa';
|
import { execa, execaNode } from 'execa';
|
||||||
import type { ResultPromise } from 'execa';
|
import type { ResultPromise } from 'execa';
|
||||||
|
|
@ -84,6 +85,11 @@ export default defineConfig((args) => {
|
||||||
'file-type',
|
'file-type',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const define: Record<string, string> = {
|
||||||
|
// Summalyのバージョンを埋め込む
|
||||||
|
'_SUMMALY_VERSION_': JSON.stringify(summalyVersion),
|
||||||
|
};
|
||||||
|
|
||||||
if (isE2E) {
|
if (isE2E) {
|
||||||
return {
|
return {
|
||||||
input: './test-server/entry.ts',
|
input: './test-server/entry.ts',
|
||||||
|
|
@ -92,6 +98,9 @@ export default defineConfig((args) => {
|
||||||
plugins: [
|
plugins: [
|
||||||
esmShim(),
|
esmShim(),
|
||||||
],
|
],
|
||||||
|
transform: {
|
||||||
|
define,
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
keepNames: true,
|
keepNames: true,
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
|
|
@ -116,6 +125,9 @@ export default defineConfig((args) => {
|
||||||
esmShim(),
|
esmShim(),
|
||||||
(isWatchMode ? backendDevServerPlugin() : undefined),
|
(isWatchMode ? backendDevServerPlugin() : undefined),
|
||||||
],
|
],
|
||||||
|
transform: {
|
||||||
|
define,
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
keepNames: true,
|
keepNames: true,
|
||||||
minify: !isWatchMode,
|
minify: !isWatchMode,
|
||||||
|
|
|
||||||
6
packages/backend/src/@types/global.d.ts
vendored
Normal file
6
packages/backend/src/@types/global.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare const _SUMMALY_VERSION_: string;
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { version } from '@misskey-dev/summaly';
|
|
||||||
import type { SummalyResult } from '@misskey-dev/summaly';
|
import type { SummalyResult } from '@misskey-dev/summaly';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
|
|
@ -33,7 +32,7 @@ export class UrlPreviewService {
|
||||||
private loggerService: LoggerService,
|
private loggerService: LoggerService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.loggerService.getLogger('url-preview');
|
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
|
@bindThis
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue