fix: support windows absolute extends (#3062)

This commit is contained in:
Pierre Cavin
2023-11-16 20:04:02 -06:00
committed by GitHub
parent 26df1d2aa1
commit 0d06f62411
3 changed files with 26 additions and 13 deletions
+3 -13
View File
@@ -1,10 +1,10 @@
import { dirname, extname } from "node:path";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { castArray, isNil, isPlainObject, isString, pickBy } from "lodash-es";
import { readPackageUp } from "read-pkg-up";
import { cosmiconfig } from "cosmiconfig";
import resolveFrom from "resolve-from";
import importFrom from "import-from-esm";
import debugConfig from "debug";
import { repoUrl } from "./git.js";
import PLUGINS_DEFINITIONS from "./definitions/plugins.js";
@@ -33,17 +33,7 @@ export default async (context, cliOptions) => {
options = {
...(await castArray(extendPaths).reduce(async (eventualResult, extendPath) => {
const result = await eventualResult;
const resolvedPath = resolveFrom.silent(__dirname, extendPath) || resolveFrom(cwd, extendPath);
const importAssertions =
extname(resolvedPath) === ".json"
? {
assert: {
type: "json",
},
}
: undefined;
const { default: extendsOptions } = await import(resolvedPath, importAssertions);
const extendsOptions = (await importFrom.silent(__dirname, extendPath)) || (await importFrom(cwd, extendPath));
// For each plugin defined in a shareable config, save in `pluginsPath` the extendable config path,
// so those plugin will be loaded relative to the config file