Skip to content
Snippets Groups Projects
Unverified Commit 813a8bc6 authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

fix: dynamically load prettier (#19948)


Co-authored-by: default avatarRhys Arkins <rhys@arkins.net>
parent 5bf6eaba
No related branches found
No related tags found
No related merge requests found
...@@ -14,4 +14,12 @@ function re2() { ...@@ -14,4 +14,12 @@ function re2() {
return require('re2'); return require('re2');
} }
module.exports = { dirname: __dirname, re2, pkg }; /**
* return's prettier
* @returns {typeof import('prettier')}
*/
function prettier() {
return require('prettier');
}
module.exports = { dirname: __dirname, re2, pkg, prettier };
import detectIndent from 'detect-indent'; import detectIndent from 'detect-indent';
import JSON5 from 'json5'; import JSON5 from 'json5';
import prettier, { BuiltInParserName } from 'prettier'; import type { BuiltInParserName } from 'prettier';
import upath from 'upath'; import upath from 'upath';
import { migrateConfig } from '../../../../config/migration'; import { migrateConfig } from '../../../../config/migration';
import { prettier } from '../../../../expose.cjs';
import { logger } from '../../../../logger'; import { logger } from '../../../../logger';
import { readLocalFile } from '../../../../util/fs'; import { readLocalFile } from '../../../../util/fs';
import { getFileList } from '../../../../util/git'; import { getFileList } from '../../../../util/git';
...@@ -68,7 +69,7 @@ export async function applyPrettierFormatting( ...@@ -68,7 +69,7 @@ export async function applyPrettierFormatting(
useTabs: indent?.type === 'tab', useTabs: indent?.type === 'tab',
}; };
return prettier.format(content, options); return prettier().format(content, options);
} finally { } finally {
logger.trace('applyPrettierFormatting - END'); logger.trace('applyPrettierFormatting - END');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment