forked from mirrors/misskey
fix: false positive not exists error if sourceCode is empty (#17434)
* fix: false positive not exists error if sourceCode is empty * Return empty array for empty sourceCode * lint --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
parent
af73d795e0
commit
3a27ae0757
2 changed files with 2 additions and 1 deletions
|
|
@ -80,7 +80,7 @@ export class LocaleInliner {
|
|||
await fs.mkdir(path.join(this.outputDir, localeName), { recursive: true });
|
||||
const localeLogger = localeName === 'ja-JP' ? this.logger : blankLogger; // we want to log for single locale only
|
||||
for (const chunk of this.chunks) {
|
||||
if (!chunk.sourceCode || !chunk.modifications) {
|
||||
if (chunk.sourceCode == null || !chunk.modifications) {
|
||||
throw new Error(`Source code or modifications for ${chunk.fileName} is not available.`);
|
||||
}
|
||||
const fileLogger = localeLogger.prefixed(`${chunk.fileName} (${chunk.chunkName}): `);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ interface WalkerContext {
|
|||
}
|
||||
|
||||
export function collectModifications(sourceCode: string, fileName: string, fileLogger: Logger, inliner: LocaleInliner): TextModification[] {
|
||||
if (sourceCode === '') return [];
|
||||
let programNode: RolldownESTree.Program;
|
||||
try {
|
||||
programNode = parseAst(sourceCode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue