New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@optimize-lodash/transform

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@optimize-lodash/transform - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

3

dist/index.d.ts

@@ -17,3 +17,3 @@ import type { Node } from "acorn";

export declare type WarnFunction = (message: string) => void;
export declare function transform({ code, id, parse, warn, useLodashEs, }: {
export declare function transform({ code, id, parse, warn, useLodashEs, appendDotJs, }: {
code: string;

@@ -24,3 +24,4 @@ id: string;

useLodashEs?: true;
appendDotJs?: boolean;
}): CodeWithSourcemap | UNCHANGED;
//# sourceMappingURL=index.d.ts.map

@@ -13,3 +13,3 @@ "use strict";

exports.UNCHANGED = null;
function transform({ code, id, parse, warn, useLodashEs, }) {
function transform({ code, id, parse, warn, useLodashEs, appendDotJs = true, }) {
// before parsing, check if we can skip the whole file

@@ -54,3 +54,3 @@ if (!code.includes("lodash")) {

? lodash_specifiers_to_es_1.lodashSpecifiersToEs(node.source.value, node.specifiers)
: lodash_specifiers_to_cjs_1.lodashSpecifiersToCjs(node.source.value, node.specifiers);
: lodash_specifiers_to_cjs_1.lodashSpecifiersToCjs(node.source.value, node.specifiers, appendDotJs);
// write

@@ -57,0 +57,0 @@ magicString.overwrite(node.start, node.end, imports.join("\n"));

@@ -8,4 +8,5 @@ import type { ImportSpecifier } from "estree";

* @param specifiers from an AST; assumes they are all ImportSpecifiers
* @param appendDotJs optional, default is true; adds '.js' to the end of imports
*/
export declare function lodashSpecifiersToCjs(base: string, specifiers: Array<ImportSpecifier>): Array<string>;
export declare function lodashSpecifiersToCjs(base: string, specifiers: Array<ImportSpecifier>, appendDotJs?: boolean): Array<string>;
//# sourceMappingURL=lodash-specifiers-to-cjs.d.ts.map

@@ -10,7 +10,8 @@ "use strict";

* @param specifiers from an AST; assumes they are all ImportSpecifiers
* @param appendDotJs optional, default is true; adds '.js' to the end of imports
*/
function lodashSpecifiersToCjs(base, specifiers) {
return specifiers.map(({ imported, local }) => `import ${imported.name !== local.name ? local.name : imported.name} from "${base}/${imported.name}";`);
function lodashSpecifiersToCjs(base, specifiers, appendDotJs = true) {
return specifiers.map(({ imported, local }) => `import ${imported.name !== local.name ? local.name : imported.name} from "${base}/${imported.name}${appendDotJs ? ".js" : ""}";`);
}
exports.lodashSpecifiersToCjs = lodashSpecifiersToCjs;
//# sourceMappingURL=lodash-specifiers-to-cjs.js.map
{
"name": "@optimize-lodash/transform",
"version": "2.1.0",
"version": "3.0.0",
"description": "Rewrites lodash imports in a given source file to be specific.",

@@ -38,16 +38,16 @@ "keywords": [

"@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",
"acorn": "8.5.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",
"acorn": "8.6.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",
"prettier": "2.4.1",
"ts-jest": "27.0.5",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-unicorn": "39.0.0",
"jest": "27.4.5",
"prettier": "2.5.1",
"ts-jest": "27.1.2",
"typescript": "4.3.5"

@@ -63,3 +63,3 @@ },

"test": "jest",
"test:ci": "jest --coverage",
"test:ci": "jest --coverage --ci",
"build": "rm -rf dist && tsc -p tsconfig.dist.json",

@@ -66,0 +66,0 @@ "format": "prettier --write .",

@@ -13,1 +13,2 @@ # Optimize `lodash` imports

- [@optimize-lodash/rollup-plugin](https://www.npmjs.com/package/@optimize-lodash/rollup-plugin)
- [@optimize-lodash/esbuild-plugin (experimental)](https://www.npmjs.com/package/@optimize-lodash/esbuild-plugin)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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