Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-pluginutils

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-pluginutils - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

src/addExtension.js

4

CHANGELOG.md
# rollup-pluginutils changelog
## 1.1.0
* Add `addExtension` function
## 1.0.1

@@ -4,0 +8,0 @@

@@ -35,3 +35,20 @@ 'use strict';

function basename(path) {
return path.split(/(\/|\\)/).pop();
}
function extname(path) {
var match = /\.[^\.]+$/.exec(basename(path));
if (!match) return '';
return match[0];
}
function addExtension(filename) {
var ext = arguments.length <= 1 || arguments[1] === undefined ? '.js' : arguments[1];
if (!extname(filename)) filename += ext;
return filename;
}
exports.createFilter = createFilter;
exports.addExtension = addExtension;
//# sourceMappingURL=pluginutils.cjs.js.map

@@ -33,3 +33,19 @@ import { resolve } from 'path';

export { createFilter };
function basename(path) {
return path.split(/(\/|\\)/).pop();
}
function extname(path) {
var match = /\.[^\.]+$/.exec(basename(path));
if (!match) return '';
return match[0];
}
function addExtension(filename) {
var ext = arguments.length <= 1 || arguments[1] === undefined ? '.js' : arguments[1];
if (!extname(filename)) filename += ext;
return filename;
}
export { createFilter, addExtension };
//# sourceMappingURL=pluginutils.es6.js.map

2

package.json
{
"name": "rollup-pluginutils",
"description": "Functionality commonly needed by Rollup plugins",
"version": "1.0.1",
"version": "1.1.0",
"main": "dist/pluginutils.cjs.js",

@@ -6,0 +6,0 @@ "jsnext:main": "dist/pluginutils.es6.js",

@@ -15,6 +15,21 @@ # rollup-pluginutils

### addExtension
```js
import { addExtension } from 'rollup-pluginutils';
export default function myPlugin ( options = {} ) {
return {
resolveId ( code, id ) {
// only adds an extension if there isn't one already
id = addExtension( id ); // `foo` -> `foo.js`, `foo.js -> foo.js`
id = addExtension( id, '.myext' ); // `foo` -> `foo.myext`, `foo.js -> `foo.js`
}
};
}
```
### createFilter
So far, this is the only exported function.
```js

@@ -21,0 +36,0 @@ import { createFilter } from 'rollup-pluginutils';

export { default as createFilter } from './createFilter';
export { default as addExtension } from './addExtension';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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