mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-01 19:45:51 +02:00
Follow up per locale bundle (#16381)
* fix docker build * enable check spdx license id in frontend-builder * fix eslint config * run eslint for frontend-builder in ci * fix eslint * add license headers * fix unnecessary comments * update changelog * fix generateDts * fix tsx
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
*/
|
||||
|
||||
import * as estreeWalker from 'estree-walker';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { CallExpression, Expression, Program, } from 'estree';
|
||||
import MagicString from 'magic-string';
|
||||
import type { AstNode } from 'rollup';
|
||||
import { assertType } from './utils.js';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { CallExpression, Expression, Program } from 'estree';
|
||||
import type { AstNode } from 'rollup';
|
||||
|
||||
// This plugin transforms `unref(i18n)` to `i18n` in the code, which is useful for removing unnecessary unref calls
|
||||
// and helps locale inliner runs after vite build to inline the locale data into the final build.
|
||||
//
|
||||
// locale inliner cannot know minifiedSymbol(i18n) is 'unref(i18n)' or 'otherFunctionsWithEffect(i18n)' so
|
||||
// it is necessary to remove unref calls before minification.
|
||||
export default function pluginRemoveUnrefI18n(
|
||||
export function pluginRemoveUnrefI18n(
|
||||
{
|
||||
i18nSymbolName = 'i18n',
|
||||
}: {
|
||||
@@ -42,12 +42,12 @@ export default function pluginRemoveUnrefI18n(
|
||||
magicString.remove(arg.end, node.end);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
return {
|
||||
code: magicString.toString(),
|
||||
map: magicString.generateMap({ hires: true }),
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user