mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
fix: apply fix from eslint
This commit is contained in:
@ -17,9 +17,7 @@ export const i18nImporter = () => {
|
||||
});
|
||||
|
||||
const srcPath = resolve(__dirname, '..', 'src');
|
||||
const plugins = globSync([
|
||||
'src/i18n/resources/*.json',
|
||||
]).map((path) => {
|
||||
const plugins = globSync(['src/i18n/resources/*.json']).map((path) => {
|
||||
const nameWithExt = basename(path);
|
||||
const name = nameWithExt.replace(extname(nameWithExt), '');
|
||||
|
||||
|
||||
@ -49,7 +49,9 @@ export const pluginVirtualModuleGenerator = (
|
||||
for (const { name } of plugins) {
|
||||
const checkMode = mode === 'main' ? 'backend' : mode;
|
||||
// HACK: To avoid situation like importing renderer plugins in main
|
||||
writer.writeLine(` ...(${snakeToCamel(name)}Plugin['${checkMode}'] ? { "${name}": ${snakeToCamel(name)}Plugin } : {}),`);
|
||||
writer.writeLine(
|
||||
` ...(${snakeToCamel(name)}Plugin['${checkMode}'] ? { "${name}": ${snakeToCamel(name)}Plugin } : {}),`,
|
||||
);
|
||||
}
|
||||
writer.writeLine('};');
|
||||
writer.blankLine();
|
||||
|
||||
@ -3,11 +3,18 @@ import { resolve, basename, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { createFilter } from 'vite';
|
||||
import { Project, ts, ObjectLiteralExpression, VariableDeclarationKind } from 'ts-morph';
|
||||
import {
|
||||
Project,
|
||||
ts,
|
||||
ObjectLiteralExpression,
|
||||
VariableDeclarationKind,
|
||||
} from 'ts-morph';
|
||||
|
||||
import type { PluginOption } from 'vite';
|
||||
|
||||
export default function (mode: 'backend' | 'preload' | 'renderer' | 'none'): PluginOption {
|
||||
export default function (
|
||||
mode: 'backend' | 'preload' | 'renderer' | 'none',
|
||||
): PluginOption {
|
||||
const pluginFilter = createFilter([
|
||||
'src/plugins/*/index.{js,ts}',
|
||||
'src/plugins/*',
|
||||
@ -100,14 +107,17 @@ export default function (mode: 'backend' | 'preload' | 'renderer' | 'none'): Plu
|
||||
objExpr.getProperty(propertyNames[index])?.remove();
|
||||
}
|
||||
|
||||
const stubObjExpr = src.addVariableStatement({
|
||||
isExported: true,
|
||||
declarationKind: VariableDeclarationKind.Const,
|
||||
declarations: [{
|
||||
name: 'pluginStub',
|
||||
initializer: (writer) => writer.write(objExpr!.getText()),
|
||||
}]
|
||||
})
|
||||
const stubObjExpr = src
|
||||
.addVariableStatement({
|
||||
isExported: true,
|
||||
declarationKind: VariableDeclarationKind.Const,
|
||||
declarations: [
|
||||
{
|
||||
name: 'pluginStub',
|
||||
initializer: (writer) => writer.write(objExpr.getText()),
|
||||
},
|
||||
],
|
||||
})
|
||||
.getDeclarations()[0]
|
||||
.getInitializer() as ObjectLiteralExpression;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user