Skip to content

Commit

Permalink
chore: remove trim-right dependency (#10420)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Sep 10, 2019
1 parent daf25af commit 8183103
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/babel-generator/package.json
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions packages/babel-generator/src/buffer.js
@@ -1,5 +1,4 @@
import type SourceMap from "./source-map";
import trimRight from "trim-right";

const SPACES_RE = /^[ \t]+$/;

Expand Down Expand Up @@ -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(),
};
Expand Down
3 changes: 1 addition & 2 deletions packages/babel-helper-fixtures/src/index.js
@@ -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";
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8183103

Please sign in to comment.