rollup-plugin-commonjs
Advanced tools
Comparing version
# rollup-plugin-commonjs changelog | ||
## 8.2.0 | ||
* Avoid using `index` as a variable name ([#208](https://github.com/rollup/rollup-plugin-commonjs/pull/208)) | ||
## 8.1.1 | ||
@@ -4,0 +8,0 @@ |
@@ -163,3 +163,9 @@ 'use strict'; | ||
function getName ( id ) { | ||
return rollupPluginutils.makeLegalIdentifier( path.basename( id, path.extname( id ) ) ); | ||
var name = rollupPluginutils.makeLegalIdentifier( path.basename( id, path.extname( id ) ) ); | ||
if (name !== 'index') { | ||
return name; | ||
} else { | ||
var segments = path.dirname( id ).split( path.sep ); | ||
return rollupPluginutils.makeLegalIdentifier( segments[segments.length - 1] ); | ||
} | ||
} | ||
@@ -166,0 +172,0 @@ |
@@ -159,3 +159,9 @@ import { statSync } from 'fs'; | ||
function getName ( id ) { | ||
return makeLegalIdentifier( basename( id, extname( id ) ) ); | ||
var name = makeLegalIdentifier( basename( id, extname( id ) ) ); | ||
if (name !== 'index') { | ||
return name; | ||
} else { | ||
var segments = dirname( id ).split( sep ); | ||
return makeLegalIdentifier( segments[segments.length - 1] ); | ||
} | ||
} | ||
@@ -162,0 +168,0 @@ |
{ | ||
"name": "rollup-plugin-commonjs", | ||
"version": "8.1.1", | ||
"version": "8.2.0", | ||
"description": "Convert CommonJS modules to ES2015", | ||
@@ -11,3 +11,3 @@ "main": "dist/rollup-plugin-commonjs.cjs.js", | ||
"pretest": "npm run build", | ||
"build": "rm -rf dist/* && rollup -c", | ||
"build": "shx rm -rf dist/* && rollup -c", | ||
"dev": "rollup -c -w", | ||
@@ -37,2 +37,3 @@ "lint": "eslint src/*.js test/*.js", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"shx": "^0.2.2", | ||
"source-map": "^0.5.7", | ||
@@ -39,0 +40,0 @@ "source-map-support": "^0.4.16" |
@@ -1,7 +0,13 @@ | ||
import { basename, extname } from 'path'; | ||
import { basename, extname, dirname, sep } from 'path'; | ||
import { makeLegalIdentifier } from 'rollup-pluginutils'; | ||
export function getName ( id ) { | ||
return makeLegalIdentifier( basename( id, extname( id ) ) ); | ||
const name = makeLegalIdentifier( basename( id, extname( id ) ) ); | ||
if (name !== 'index') { | ||
return name; | ||
} else { | ||
const segments = dirname( id ).split( sep ); | ||
return makeLegalIdentifier( segments[segments.length - 1] ); | ||
} | ||
} | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
181820
1.5%14
7.69%1744
1.04%10
11.11%