Fix getFileInfo (#18081)
This commit is contained in:
1 parent
d6f7f142ab
commit
3476a69e73
3 files changed
+10
-7
No files matched your search
@@ -16,7 +16,7 @@ async function logFileInfoOrDie(context) {
|
|||||||
const fileInfo = await getFileInfo(path.resolve(file), {
|
const fileInfo = await getFileInfo(path.resolve(file), {
|
||||||
ignorePath,
|
ignorePath,
|
||||||
withNodeModules,
|
withNodeModules,
|
||||||
plugins: plugins.length > 0 ? plugins : undefined,
|
plugins,
|
||||||
resolveConfig: config !== false,
|
resolveConfig: config !== false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { resolveConfig } from "../config/resolve-config.js";
|
import { resolveConfig } from "../config/resolve-config.js";
|
||||||
import { loadBuiltinPlugins, loadPlugins } from "../main/plugins/index.js";
|
import { loadPlugins } from "../main/plugins/index.js";
|
||||||
import { isIgnored } from "../utils/ignore.js";
|
import { isIgnored } from "../utils/ignore.js";
|
||||||
import inferParser from "../utils/infer-parser.js";
|
import inferParser from "../utils/infer-parser.js";
|
||||||
|
|
||||||
@@ -54,10 +54,10 @@ async function getParser(file, options) {
|
|||||||
return config.parser;
|
return config.parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
let plugins = options.plugins ?? config?.plugins ?? [];
|
const plugins = [
|
||||||
plugins = (
|
...options.plugins,
|
||||||
await Promise.all([loadBuiltinPlugins(), loadPlugins(plugins)])
|
...(await loadPlugins(config?.plugins ?? [])),
|
||||||
).flat();
|
];
|
||||||
|
|
||||||
return inferParser({ plugins }, { physicalFile: file });
|
return inferParser({ plugins }, { physicalFile: file });
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -11,6 +11,7 @@ import { closestMatch as closetLevenshteinMatch } from "leven";
|
|||||||
import picocolors from "picocolors";
|
import picocolors from "picocolors";
|
||||||
import * as vnopts from "vnopts";
|
import * as vnopts from "vnopts";
|
||||||
import * as errors from "./common/errors.js";
|
import * as errors from "./common/errors.js";
|
||||||
|
import getFileInfoWithoutPlugins from "./common/get-file-info.js";
|
||||||
import { mockable } from "./common/mockable.js";
|
import { mockable } from "./common/mockable.js";
|
||||||
import {
|
import {
|
||||||
clearCache as clearConfigCache,
|
clearCache as clearConfigCache,
|
||||||
@@ -90,6 +91,8 @@ const inferParser = withPlugins((file, options) =>
|
|||||||
inferParserWithoutPlugins(options, { physicalFile: file }),
|
inferParserWithoutPlugins(options, { physicalFile: file }),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getFileInfo = withPlugins(getFileInfoWithoutPlugins);
|
||||||
|
|
||||||
// Internal shared with cli
|
// Internal shared with cli
|
||||||
const sharedWithCli = {
|
const sharedWithCli = {
|
||||||
errors,
|
errors,
|
||||||
@@ -132,11 +135,11 @@ export {
|
|||||||
clearCache as clearConfigCache,
|
clearCache as clearConfigCache,
|
||||||
format,
|
format,
|
||||||
formatWithCursor,
|
formatWithCursor,
|
||||||
|
getFileInfo,
|
||||||
getSupportInfo,
|
getSupportInfo,
|
||||||
resolveConfig,
|
resolveConfig,
|
||||||
resolveConfigFile,
|
resolveConfigFile,
|
||||||
};
|
};
|
||||||
export { default as getFileInfo } from "./common/get-file-info.js";
|
|
||||||
export * as doc from "./document/public.js";
|
export * as doc from "./document/public.js";
|
||||||
export { default as version } from "./main/version.evaluate.js";
|
export { default as version } from "./main/version.evaluate.js";
|
||||||
export * as util from "./utils/public.js";
|
export * as util from "./utils/public.js";
|
||||||
Reference in new issue
Block a user