Socket
Socket
Sign inDemoInstall

@rollup/plugin-node-resolve

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-node-resolve - npm Package Compare versions

Comparing version 13.1.3 to 13.2.0

8

CHANGELOG.md
# @rollup/plugin-node-resolve ChangeLog
## v13.2.0
_2022-04-11_
### Features
- feat: Add the ability to pass a function into resolveOnly (#1152)
## v13.1.3

@@ -4,0 +12,0 @@

32

dist/cjs/index.js

@@ -24,3 +24,3 @@ 'use strict';

var version = "13.1.3";
var version = "13.2.0";

@@ -966,10 +966,19 @@ util.promisify(fs__default["default"].access);

const resolveOnly = options.resolveOnly.map((pattern) => {
if (pattern instanceof RegExp) {
return pattern;
}
const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(`^${normalized}$`);
});
// creates a function from the patterns to test if a particular module should be bundled.
const allowPatterns = (patterns) => {
const regexPatterns = patterns.map((pattern) => {
if (pattern instanceof RegExp) {
return pattern;
}
const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(`^${normalized}$`);
});
return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id));
};
const resolveOnly =
typeof options.resolveOnly === 'function'
? options.resolveOnly
: allowPatterns(options.resolveOnly);
const browserMapCache = new Map();

@@ -1016,7 +1025,4 @@ let preserveSymlinks;

if (
!isRelativeImport &&
resolveOnly.length &&
!resolveOnly.some((pattern) => pattern.test(id))
) {
// if it's not a relative import, and it's not requested, reject it.
if (!isRelativeImport && !resolveOnly(id)) {
if (normalizeInput(rollupOptions.input).includes(importee)) {

@@ -1023,0 +1029,0 @@ return null;

@@ -11,3 +11,3 @@ import path, { dirname, resolve, extname, normalize, sep } from 'path';

var version = "13.1.3";
var version = "13.2.0";

@@ -953,10 +953,19 @@ promisify(fs.access);

const resolveOnly = options.resolveOnly.map((pattern) => {
if (pattern instanceof RegExp) {
return pattern;
}
const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(`^${normalized}$`);
});
// creates a function from the patterns to test if a particular module should be bundled.
const allowPatterns = (patterns) => {
const regexPatterns = patterns.map((pattern) => {
if (pattern instanceof RegExp) {
return pattern;
}
const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(`^${normalized}$`);
});
return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id));
};
const resolveOnly =
typeof options.resolveOnly === 'function'
? options.resolveOnly
: allowPatterns(options.resolveOnly);
const browserMapCache = new Map();

@@ -1003,7 +1012,4 @@ let preserveSymlinks;

if (
!isRelativeImport &&
resolveOnly.length &&
!resolveOnly.some((pattern) => pattern.test(id))
) {
// if it's not a relative import, and it's not requested, reject it.
if (!isRelativeImport && !resolveOnly(id)) {
if (normalizeInput(rollupOptions.input).includes(importee)) {

@@ -1010,0 +1016,0 @@ return null;

{
"name": "@rollup/plugin-node-resolve",
"version": "13.1.3",
"version": "13.2.0",
"publishConfig": {

@@ -72,3 +72,3 @@ "access": "public"

"es5-ext": "^0.10.53",
"rollup": "^2.58.0",
"rollup": "^2.67.3",
"source-map": "^0.7.3",

@@ -75,0 +75,0 @@ "string-capitalize": "^1.0.1"

@@ -143,3 +143,3 @@ [npm]: https://img.shields.io/npm/v/@rollup/plugin-node-resolve

Type: `Array[...String|RegExp]`<br>
Type: `Array[...String|RegExp] | (module: string) => boolean`<br>
Default: `null`

@@ -149,4 +149,9 @@

Example: `resolveOnly: ['batman', /^@batcave\/.*$/]`
Alternatively, you may pass in a function that returns a boolean to confirm whether the module should be included or not.
Examples:
- `resolveOnly: ['batman', /^@batcave\/.*$/]`
- `resolveOnly: module => !module.includes('joker')`
### `rootDir`

@@ -153,0 +158,0 @@

@@ -84,3 +84,3 @@ import { Plugin } from 'rollup';

*/
resolveOnly?: ReadonlyArray<string | RegExp> | null;
resolveOnly?: ReadonlyArray<string | RegExp> | null | ((module: string) => boolean);

@@ -87,0 +87,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc