@optimize-lodash/rollup-plugin
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -18,2 +18,7 @@ import type { Plugin } from "rollup"; | ||
useLodashEs?: true; | ||
/** | ||
* Default: true. Appends '.js' to the end of optimized Lodash CJS imports. Required | ||
* by some bundling tools. | ||
*/ | ||
appendDotJs?: boolean; | ||
}; | ||
@@ -39,4 +44,5 @@ /** | ||
* @param useLodashEs set `true` to convert imports to use "lodash-es" (optional; default false) | ||
* @param appendDotJs default `true`; set `false` if you don't want `.js` appended to CJS lodash imports | ||
*/ | ||
export declare function optimizeLodashImports({ include, exclude, useLodashEs, }?: OptimizeLodashOptions): Plugin & Required<Pick<Plugin, "transform">>; | ||
export declare function optimizeLodashImports({ include, exclude, useLodashEs, appendDotJs, }?: OptimizeLodashOptions): Plugin & Required<Pick<Plugin, "transform">>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -26,4 +26,5 @@ "use strict"; | ||
* @param useLodashEs set `true` to convert imports to use "lodash-es" (optional; default false) | ||
* @param appendDotJs default `true`; set `false` if you don't want `.js` appended to CJS lodash imports | ||
*/ | ||
function optimizeLodashImports({ include, exclude, useLodashEs, } = {}) { | ||
function optimizeLodashImports({ include, exclude, useLodashEs, appendDotJs, } = {}) { | ||
const filter = pluginutils_1.createFilter(include, exclude); | ||
@@ -46,3 +47,10 @@ return { | ||
} | ||
return transform_1.transform({ code, id, parse, warn, useLodashEs }); | ||
return transform_1.transform({ | ||
code, | ||
id, | ||
parse, | ||
warn, | ||
useLodashEs, | ||
appendDotJs, | ||
}); | ||
}, | ||
@@ -49,0 +57,0 @@ }; |
{ | ||
"name": "@optimize-lodash/rollup-plugin", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Rewrite lodash imports with Rollup for improved tree-shaking.", | ||
@@ -43,26 +43,26 @@ "keywords": [ | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "21.0.0", | ||
"@rollup/plugin-node-resolve": "11.2.1", | ||
"@rollup/plugin-commonjs": "21.0.1", | ||
"@rollup/plugin-node-resolve": "13.1.1", | ||
"@tsconfig/node12": "1.0.9", | ||
"@types/estree": "0.0.50", | ||
"@types/jest": "27.0.2", | ||
"@types/lodash": "4.14.175", | ||
"@types/node": "12.20.28", | ||
"@typescript-eslint/eslint-plugin": "4.33.0", | ||
"@typescript-eslint/parser": "4.33.0", | ||
"@types/jest": "27.0.3", | ||
"@types/lodash": "4.14.178", | ||
"@types/node": "12.20.37", | ||
"@typescript-eslint/eslint-plugin": "5.7.0", | ||
"@typescript-eslint/parser": "5.7.0", | ||
"depcheck": "1.4.2", | ||
"eslint": "7.32.0", | ||
"eslint": "8.5.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-jest": "24.5.2", | ||
"eslint-plugin-unicorn": "36.0.0", | ||
"jest": "27.2.5", | ||
"eslint-plugin-jest": "25.3.0", | ||
"eslint-plugin-unicorn": "39.0.0", | ||
"jest": "27.4.5", | ||
"lodash": "4.17.21", | ||
"prettier": "2.4.1", | ||
"rollup": "2.39.1", | ||
"prettier": "2.5.1", | ||
"rollup": "2.61.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"ts-jest": "27.0.5", | ||
"ts-jest": "27.1.2", | ||
"typescript": "4.3.5" | ||
}, | ||
"dependencies": { | ||
"@optimize-lodash/transform": "^2.1.0", | ||
"@optimize-lodash/transform": "3.x", | ||
"@rollup/pluginutils": "4.x" | ||
@@ -74,3 +74,3 @@ }, | ||
"test": "jest", | ||
"test:ci": "jest --coverage", | ||
"test:ci": "jest --coverage --ci", | ||
"build": "rm -rf dist && tsc -p tsconfig.dist.json", | ||
@@ -77,0 +77,0 @@ "format": "prettier --write .", |
@@ -26,5 +26,5 @@ # Optimize `lodash` imports with Rollup.js | ||
```javascript | ||
import isNil from "lodash/isNil"; | ||
import isString from "lodash/isString"; | ||
import padStartFp from "lodash/fp/padStart"; | ||
import isNil from "lodash/isNil.js"; | ||
import isString from "lodash/isString.js"; | ||
import padStartFp from "lodash/fp/padStart.js"; | ||
``` | ||
@@ -47,3 +47,3 @@ | ||
```javascript | ||
import isNil from "lodash/isNil"; | ||
import isNil from "lodash/isNil.js"; | ||
``` | ||
@@ -99,2 +99,11 @@ | ||
### `appendDotJs` | ||
Type: `boolean`<br> | ||
Default: `true` | ||
If `true`, the plugin will append `.js` to the end of CommonJS lodash imports. | ||
Set to `false` if you don't want the `.js` suffix added (prior to v3.x, this was the default). | ||
## Limitations | ||
@@ -101,0 +110,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14774
102
139
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@optimize-lodash/transform@3.0.4(transitive)
+ Addedmagic-string@0.30.17(transitive)
- Removed@optimize-lodash/transform@2.1.0(transitive)
- Removedmagic-string@0.25.9(transitive)
- Removedsourcemap-codec@1.4.8(transitive)