Skip to content

Commit 8dc4b77

Browse files
committed
refactor: use lodash-es and bundle in dist
1 parent 72f6c9c commit 8dc4b77

File tree

10 files changed

+12
-16
lines changed

10 files changed

+12
-16
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"eslint-visitor-keys": "^4.2.0",
1919
"espree": "^10.3.0",
2020
"esquery": "^1.6.0",
21-
"lodash": "^4.17.21",
2221
"semver": "^7.6.3"
2322
},
2423
"devDependencies": {
@@ -31,7 +30,7 @@
3130
"@eslint/js": "^9.19.0",
3231
"@types/debug": "^4.1.7",
3332
"@types/estree": "^1.0.0",
34-
"@types/lodash": "^4.14.186",
33+
"@types/lodash-es": "^4.17.12",
3534
"@types/mocha": "^9.0.0",
3635
"@types/node": "^18.8.4",
3736
"@types/semver": "^7.3.12",
@@ -49,6 +48,7 @@
4948
"eslint-plugin-unicorn": "^57.0.0",
5049
"fs-extra": "^10.0.0",
5150
"jsonc-eslint-parser": "^2.0.3",
51+
"lodash-es": "^4.17.21",
5252
"mocha": "^9.1.3",
5353
"npm-run-all": "^4.1.5",
5454
"nyc": "^15.1.0",

rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import replace from "rollup-plugin-replace"
99

1010
const pkg = require("./package.json")
1111
const deps = new Set(
12-
["assert", "events", "path"].concat(Object.keys(pkg.dependencies))
12+
["assert", "events", "path"].concat(Object.keys(pkg.dependencies)),
1313
)
1414

1515
export default {
@@ -31,5 +31,5 @@ export default {
3131
"process.env.PACKAGE_VERSION": `"${pkg.version}"`,
3232
}),
3333
],
34-
external: id => deps.has(id) || id.startsWith("lodash"),
34+
external: (id) => deps.has(id),
3535
}

src/common/error-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ParseError, VDocumentFragment } from "../ast/index"
2-
import sortedIndexBy from "lodash/sortedIndexBy"
2+
import { sortedIndexBy } from "lodash-es"
33
/**
44
* Insert the given error.
55
* @param document The document that the node is belonging to.

src/common/lines-and-columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sortedLastIndex from "lodash/sortedLastIndex"
1+
import { sortedLastIndex } from "lodash-es"
22
import type { Location } from "../ast/index"
33
import type { LocationCalculator } from "./location-calculator"
44
/**

src/common/location-calculator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @copyright 2017 Toru Nagashima. All rights reserved.
44
* See LICENSE file in root directory for full license.
55
*/
6-
import sortedLastIndex from "lodash/sortedLastIndex"
6+
import { sortedLastIndex } from "lodash-es"
77
import type { Location } from "../ast/index"
88
import { LinesAndColumns } from "./lines-and-columns"
99

src/common/token-utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import sortedIndexBy from "lodash/sortedIndexBy"
2-
import sortedLastIndexBy from "lodash/sortedLastIndexBy"
1+
import { sortedIndexBy, sortedLastIndexBy } from "lodash-es"
32
import type { LocationRange, Token, VDocumentFragment } from "../ast/index"
43
import type { LinesAndColumns } from "./lines-and-columns"
54

src/external/node-event-generator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import type EventEmitter from "events"
55
import type { ESQueryOptions, Selector } from "esquery"
66
import esquery from "esquery"
7-
import union from "lodash/union"
8-
import intersection from "lodash/intersection"
9-
import memoize from "lodash/memoize"
7+
import { union, intersection, memoize } from "lodash-es"
108
import type { Node } from "../ast/index"
119

1210
interface NodeSelector {

src/external/token-store/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @fileoverview Define utilify functions for token store.
33
* @author Toru Nagashima
44
*/
5-
import sortedIndexBy from "lodash/sortedIndexBy"
5+
import { sortedIndexBy } from "lodash-es"
66
import type { HasLocation } from "../../ast/index"
77

88
/**

src/html/parser.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ import {
5050
getScriptParser,
5151
getParserLangFromSFC,
5252
} from "../common/parser-options"
53-
import sortedIndexBy from "lodash/sortedIndexBy"
54-
import sortedLastIndexBy from "lodash/sortedLastIndexBy"
53+
import { sortedIndexBy, sortedLastIndexBy } from "lodash-es"
5554
import type {
5655
CustomTemplateTokenizer,
5756
CustomTemplateTokenizerConstructor,

src/script/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @copyright 2017 Toru Nagashima. All rights reserved.
44
* See LICENSE file in root directory for full license.
55
*/
6-
import sortedIndexBy from "lodash/sortedIndexBy"
6+
import { sortedIndexBy } from "lodash-es"
77
import type {
88
ESLintArrayExpression,
99
ESLintArrayPattern,

0 commit comments

Comments
 (0)