From ecd7d54bffad05d8b92e4b1ebc7b5a881fc9dc42 Mon Sep 17 00:00:00 2001 From: Damir Date: Tue, 25 Oct 2022 05:03:54 +0200 Subject: [PATCH] Import only used lodash methods --- src/attributes.js | 7 ++++++- src/locals.js | 9 +++++++-- src/slots.js | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/attributes.js b/src/attributes.js index 176f5c0..a71725d 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -3,7 +3,12 @@ const {match} = require('posthtml/lib/api'); const parseAttrs = require('posthtml-attrs-parser'); const styleToObject = require('style-to-object'); -const {omit, keys, union, each, has, extend} = require('lodash'); +const omit = require('lodash/omit'); +const keys = require('lodash/keys'); +const union = require('lodash/union'); +const each = require('lodash/each'); +const has = require('lodash/has'); +const extend = require('lodash/extend'); /** * Map component attributes that it's not defined as locals to first element of node diff --git a/src/locals.js b/src/locals.js index 4e71f89..ba5eb3b 100644 --- a/src/locals.js +++ b/src/locals.js @@ -1,8 +1,13 @@ 'use strict'; -const merge = require('deepmerge'); const scriptDataLocals = require('posthtml-expressions/lib/locals'); -const {pick, keys, defaults, each, extend} = require('lodash'); +const merge = require('deepmerge'); +const pick = require('lodash/pick'); +const keys = require('lodash/keys'); +const defaults = require('lodash/defaults'); +const each = require('lodash/each'); +const extend = require('lodash/extend'); + const attributeTypes = ['merge', 'computed', 'aware']; /** diff --git a/src/slots.js b/src/slots.js index 834a789..562f8e0 100644 --- a/src/slots.js +++ b/src/slots.js @@ -2,7 +2,8 @@ const {match} = require('posthtml/lib/api'); const {render} = require('posthtml-render'); -const {each, omit} = require('lodash'); +const each = require('lodash/each'); +const omit = require('lodash/omit'); /** * Set filled slots