From: Gabriel Loiácono <32134586+loiacon@users.noreply.github.com> Date: Thu, 28 Nov 2019 15:49:39 +0000 (-0300) Subject: style(compiler): changed object-assign to spread (#507) X-Git-Tag: v3.0.0-alpha.0~135 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=812a0626ce8d218882486733633499142a7f1dab;p=thirdparty%2Fvuejs%2Fcore.git style(compiler): changed object-assign to spread (#507) --- diff --git a/packages/compiler-core/__tests__/transform.spec.ts b/packages/compiler-core/__tests__/transform.spec.ts index f2660e64f7..baaddd788f 100644 --- a/packages/compiler-core/__tests__/transform.spec.ts +++ b/packages/compiler-core/__tests__/transform.spec.ts @@ -30,7 +30,7 @@ describe('compiler: transform', () => { // across calls const calls: any[] = [] const plugin: NodeTransform = (node, context) => { - calls.push([node, Object.assign({}, context)]) + calls.push([node, { ...context }]) } transform(ast, { diff --git a/packages/compiler-sfc/src/compileStyle.ts b/packages/compiler-sfc/src/compileStyle.ts index 0780cf6940..b61c46f36b 100644 --- a/packages/compiler-sfc/src/compileStyle.ts +++ b/packages/compiler-sfc/src/compileStyle.ts @@ -132,14 +132,8 @@ function preprocess( options: StyleCompileOptions, preprocessor: StylePreprocessor ): StylePreprocessorResults { - return preprocessor.render( - options.source, - options.map, - Object.assign( - { - filename: options.filename - }, - options.preprocessOptions - ) - ) + return preprocessor.render(options.source, options.map, { + filename: options.filename, + ...options.preprocessOptions + }) } diff --git a/packages/compiler-sfc/src/stylePreprocessors.ts b/packages/compiler-sfc/src/stylePreprocessors.ts index 5e820ddfe9..e391c6b7dc 100644 --- a/packages/compiler-sfc/src/stylePreprocessors.ts +++ b/packages/compiler-sfc/src/stylePreprocessors.ts @@ -14,12 +14,13 @@ export interface StylePreprocessorResults { const scss: StylePreprocessor = { render(source, map, options) { const nodeSass = require('sass') - const finalOptions = Object.assign({}, options, { + const finalOptions = { + ...options, data: source, file: options.filename, outFile: options.filename, sourceMap: !!map - }) + } try { const result = nodeSass.renderSync(finalOptions) @@ -41,11 +42,10 @@ const scss: StylePreprocessor = { const sass: StylePreprocessor = { render(source, map, options) { - return scss.render( - source, - map, - Object.assign({}, options, { indentedSyntax: true }) - ) + return scss.render(source, map, { + ...options, + indentedSyntax: true + }) } } @@ -58,7 +58,7 @@ const less: StylePreprocessor = { let error: Error | null = null nodeLess.render( source, - Object.assign({}, options, { syncImport: true }), + { ...options, syncImport: true }, (err: Error | null, output: any) => { error = err result = output