Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

@optimize-lodash/rollup-plugin

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@optimize-lodash/rollup-plugin - npm Package Compare versions

Comparing version
2.1.0
to
3.0.0
+7
-1
dist/index.d.ts

@@ -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
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAgB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGlE,oBAAY,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;CACpB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,EACP,WAAW,GACZ,GAAE,qBAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA2B3E"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAgB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGlE,oBAAY,qBAAqB,GAAG;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,GACZ,GAAE,qBAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAkC3E"}

@@ -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 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,qDAAkE;AAClE,0DAA0E;AAoB1E,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,qBAAqB,CAAC,EACpC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AAI,EAAE;gBAC1C,IAAI,CAAC,KAAK,CACR,iEACE,MAAA,OAAO,CAAC,MAAM,mCAAI,WACpB,EAAE,CACH,CAAC;aACH;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEpC,wBAAwB;YACxB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;gBACf,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,qBAAe,CAAC;gBACrB,IAAI;gBACJ,EAAE;gBACF,KAAK;gBACL,IAAI;gBACJ,WAAW;gBACX,WAAW;aACZ,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAvCD,sDAuCC"}
{
"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 @@