Replace lodash 'defaults' usage with ES6 Spread initializer (#11797)
Co-authored-by: Corey Farrell <git@cfware.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import defaults from "lodash/defaults";
|
||||
import debounce from "lodash/debounce";
|
||||
import { sync as makeDirSync } from "make-dir";
|
||||
import slash from "slash";
|
||||
@@ -48,15 +47,10 @@ export default async function ({
|
||||
const dest = getDest(relative, base);
|
||||
|
||||
try {
|
||||
const res = await util.compile(
|
||||
src,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: slash(path.relative(dest + "/..", src)),
|
||||
},
|
||||
babelOptions,
|
||||
),
|
||||
);
|
||||
const res = await util.compile(src, {
|
||||
...babelOptions,
|
||||
sourceFileName: slash(path.relative(dest + "/..", src)),
|
||||
});
|
||||
|
||||
if (!res) return FILE_TYPE.IGNORED;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// @flow
|
||||
|
||||
import convertSourceMap from "convert-source-map";
|
||||
import defaults from "lodash/defaults";
|
||||
import sourceMap from "source-map";
|
||||
import slash from "slash";
|
||||
import { sync as makeDirSync } from "make-dir";
|
||||
@@ -127,16 +126,10 @@ export default async function ({
|
||||
async function stdin(): Promise<void> {
|
||||
const code = await readStdin();
|
||||
|
||||
const res = await util.transform(
|
||||
cliOptions.filename,
|
||||
code,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: "stdin",
|
||||
},
|
||||
babelOptions,
|
||||
),
|
||||
);
|
||||
const res = await util.transform(cliOptions.filename, code, {
|
||||
...babelOptions,
|
||||
sourceFileName: "stdin",
|
||||
});
|
||||
|
||||
output([res]);
|
||||
}
|
||||
@@ -177,22 +170,17 @@ export default async function ({
|
||||
sourceFilename = slash(sourceFilename);
|
||||
|
||||
try {
|
||||
return await util.compile(
|
||||
filename,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: sourceFilename,
|
||||
// Since we're compiling everything to be merged together,
|
||||
// "inline" applies to the final output file, but not to the individual
|
||||
// files being concatenated.
|
||||
sourceMaps:
|
||||
babelOptions.sourceMaps === "inline"
|
||||
? true
|
||||
: babelOptions.sourceMaps,
|
||||
},
|
||||
babelOptions,
|
||||
),
|
||||
);
|
||||
return await util.compile(filename, {
|
||||
...babelOptions,
|
||||
sourceFileName: sourceFilename,
|
||||
// Since we're compiling everything to be merged together,
|
||||
// "inline" applies to the final output file, but not to the individual
|
||||
// files being concatenated.
|
||||
sourceMaps:
|
||||
babelOptions.sourceMaps === "inline"
|
||||
? true
|
||||
: babelOptions.sourceMaps,
|
||||
});
|
||||
} catch (err) {
|
||||
if (!cliOptions.watch) {
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user