-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(node-resolve)!: simplify builtins and remove `customResolveO…
…ptions` (#656) BREAKING CHANGES: See #656 * refactor handling builtins * remove duplicate code block * do not warn when using a builtin when no local version * add not about warnings to readme * update node-resolve, use `includeCoreModules`, and simplify this also removes `customResolveOptions` and adds `moduleDirectory` * remove console log * remove deprecated `only` option * remove `only` from types * update types test * lint index.d.ts * disable spaced-comment rule because it's breaking on .d.ts files * mention rollup `preserveSymlinks` option in readme * moduleDirectory => moduleDirectories * put filter in config object directly * add missing options to types.ts * add deprecation warnings/errors * handle deprecations in separate file * move catch closer to error * revert commonjs changes looks like auto lint messed up * remove old comment Co-authored-by: Andrew Powell <shellscape@users.noreply.github.com>
- Loading branch information
1 parent
094b105
commit 23b0bf7
Showing
27 changed files
with
421 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,8 @@ export default { | |
plugins: [ | ||
dynamicImportVars({ | ||
// options | ||
}) | ||
] | ||
}), | ||
], | ||
}; | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export default function handleDeprecatedOptions(opts) { | ||
const warnings = []; | ||
|
||
if (opts.customResolveOptions) { | ||
const { customResolveOptions } = opts; | ||
if (customResolveOptions.moduleDirectory) { | ||
// eslint-disable-next-line no-param-reassign | ||
opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory) | ||
? customResolveOptions.moduleDirectory | ||
: [customResolveOptions.moduleDirectory]; | ||
|
||
warnings.push( | ||
'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.' | ||
); | ||
} | ||
|
||
if (customResolveOptions.preserveSymlinks) { | ||
throw new Error( | ||
'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.' | ||
); | ||
} | ||
|
||
[ | ||
'basedir', | ||
'package', | ||
'extensions', | ||
'includeCoreModules', | ||
'readFile', | ||
'isFile', | ||
'isDirectory', | ||
'realpath', | ||
'packageFilter', | ||
'pathFilter', | ||
'paths', | ||
'packageIterator' | ||
].forEach((resolveOption) => { | ||
if (customResolveOptions[resolveOption]) { | ||
throw new Error( | ||
`node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.` | ||
); | ||
} | ||
}); | ||
} | ||
|
||
return { warnings }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.