// across calls
const calls: any[] = []
const plugin: NodeTransform = (node, context) => {
- calls.push([node, Object.assign({}, context)])
+ calls.push([node, { ...context }])
}
transform(ast, {
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
+ })
}
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)
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
+ })
}
}
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