|
1 |
| -import { dirname, extname } from "node:path"; |
| 1 | +import { dirname } from "node:path"; |
2 | 2 | import { fileURLToPath } from "node:url";
|
3 | 3 |
|
4 | 4 | import { castArray, isNil, isPlainObject, isString, pickBy } from "lodash-es";
|
5 | 5 | import { readPackageUp } from "read-pkg-up";
|
6 | 6 | import { cosmiconfig } from "cosmiconfig";
|
7 |
| -import resolveFrom from "resolve-from"; |
| 7 | +import importFrom from "import-from-esm"; |
8 | 8 | import debugConfig from "debug";
|
9 | 9 | import { repoUrl } from "./git.js";
|
10 | 10 | import PLUGINS_DEFINITIONS from "./definitions/plugins.js";
|
@@ -33,17 +33,7 @@ export default async (context, cliOptions) => {
|
33 | 33 | options = {
|
34 | 34 | ...(await castArray(extendPaths).reduce(async (eventualResult, extendPath) => {
|
35 | 35 | const result = await eventualResult;
|
36 |
| - const resolvedPath = resolveFrom.silent(__dirname, extendPath) || resolveFrom(cwd, extendPath); |
37 |
| - const importAssertions = |
38 |
| - extname(resolvedPath) === ".json" |
39 |
| - ? { |
40 |
| - assert: { |
41 |
| - type: "json", |
42 |
| - }, |
43 |
| - } |
44 |
| - : undefined; |
45 |
| - |
46 |
| - const { default: extendsOptions } = await import(resolvedPath, importAssertions); |
| 36 | + const extendsOptions = (await importFrom.silent(__dirname, extendPath)) || (await importFrom(cwd, extendPath)); |
47 | 37 |
|
48 | 38 | // For each plugin defined in a shareable config, save in `pluginsPath` the extendable config path,
|
49 | 39 | // so those plugin will be loaded relative to the config file
|
|
0 commit comments