chore: remove trim-right dependency (#10420)

This commit is contained in:
Huáng Jùnliàng 2019-09-10 09:17:22 -04:00 committed by Nicolò Ribaudo
parent daf25af47c
commit 81831032c3
3 changed files with 3 additions and 6 deletions

View File

@ -17,8 +17,7 @@
"@babel/types": "^7.6.0",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0",
"trim-right": "^1.0.1"
"source-map": "^0.5.0"
},
"devDependencies": {
"@babel/helper-fixtures": "^7.6.0",

View File

@ -1,5 +1,4 @@
import type SourceMap from "./source-map";
import trimRight from "trim-right";
const SPACES_RE = /^[ \t]+$/;
@ -43,7 +42,7 @@ export default class Buffer {
const result = {
// Whatever trim is used here should not execute a regex against the
// source string since it may be arbitrarily large after all transformations
code: trimRight(this._buf.join("")),
code: this._buf.join("").trimRight(),
map: null,
rawMappings: map && map.getRawMappings(),
};

View File

@ -1,5 +1,4 @@
import cloneDeep from "lodash/cloneDeep";
import trimEnd from "lodash/trimEnd";
import resolve from "try-resolve";
import clone from "lodash/clone";
import extend from "lodash/extend";
@ -275,7 +274,7 @@ export function multiple(entryLoc, ignore?: Array<string>) {
export function readFile(filename) {
if (fs.existsSync(filename)) {
let file = trimEnd(fs.readFileSync(filename, "utf8"));
let file = fs.readFileSync(filename, "utf8").trimRight();
file = file.replace(/\r\n/g, "\n");
return file;
} else {