prettier.__internal.inferParser for new CLI (#15745)
* prettier.__internal.inferParser for new CLI * Don't resolve plugins if parser found in options
This commit is contained in:
1 parent
97c53fb8b6
commit
96e8120667
1 file changed
+7
@@ -6,6 +6,7 @@ import {
|
||||
getSupportInfo as getSupportInfoWithoutPlugins,
|
||||
normalizeOptionSettings,
|
||||
} from "./main/support.js";
|
||||
import inferParserWithoutPlugins from "./utils/infer-parser.js";
|
||||
import getFileInfoWithoutPlugins from "./common/get-file-info.js";
|
||||
import {
|
||||
loadBuiltinPlugins,
|
||||
@@ -80,6 +81,10 @@ const getFileInfo = withPlugins(getFileInfoWithoutPlugins);
|
||||
/** @type {typeof getSupportInfoWithoutPlugins} */
|
||||
const getSupportInfo = withPlugins(getSupportInfoWithoutPlugins, 0);
|
||||
|
||||
const inferParser = withPlugins((file, options) =>
|
||||
inferParserWithoutPlugins(options, { physicalFile: file }),
|
||||
);
|
||||
|
||||
// Internal shared with cli
|
||||
const sharedWithCli = {
|
||||
errors,
|
||||
@@ -89,6 +94,8 @@ const sharedWithCli = {
|
||||
normalizeOptions,
|
||||
getSupportInfoWithoutPlugins,
|
||||
normalizeOptionSettings,
|
||||
inferParser: (file, options) =>
|
||||
Promise.resolve(options?.parser ?? inferParser(file, options)),
|
||||
vnopts: {
|
||||
ChoiceSchema: vnopts.ChoiceSchema,
|
||||
apiDescriptor: vnopts.apiDescriptor,
|
||||
|
||||
Reference in new issue
Block a user