From 90b9dc84ad1e3340c51f78339d13110b0e09dbda Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Tue, 4 Apr 2017 07:09:54 -0400 Subject: [PATCH] fix broken proto helper --- src/generators/dom/index.js | 2 +- src/index.js | 3 ++- test/generator/index.js | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index 1aad7df481..5bfb472e86 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -394,7 +394,7 @@ export default function dom ( parsed, source, options ) { const sharedPath = options.shared === true ? 'svelte/shared.js' : options.shared; const prototypeBase = `${name}.prototype` + ( templateProperties.methods ? `, ${generator.alias( 'template' )}.methods` : '' ); - const proto = sharedPath ? generator.helper( 'proto ' ) : deindent` + const proto = sharedPath ? `${generator.helper( 'proto' )} ` : deindent` { ${ [ 'get', 'fire', 'observe', 'on', 'set', '_flush' ] diff --git a/src/index.js b/src/index.js index 7de2a9b821..b7f158a84f 100644 --- a/src/index.js +++ b/src/index.js @@ -2,10 +2,11 @@ import parse from './parse/index.js'; import validate from './validate/index.js'; import generate from './generators/dom/index.js'; import generateSSR from './generators/server-side-rendering/index.js'; +import { assign } from './shared/index.js'; import { version } from '../package.json'; function normalizeOptions ( options ) { - return Object.assign( { + return assign( { generate: 'dom', // a filename is necessary for sourcemap generation diff --git a/test/generator/index.js b/test/generator/index.js index 8ee4280828..6ca442623b 100644 --- a/test/generator/index.js +++ b/test/generator/index.js @@ -141,8 +141,12 @@ describe( 'generate', () => { component.destroy(); assert.equal( target.innerHTML, '' ); } + + Object.assign = Object_assign; }) .catch( err => { + Object.assign = Object_assign; + if ( config.error && !unintendedError ) { config.error( assert, err ); } @@ -151,9 +155,6 @@ describe( 'generate', () => { if ( !config.show ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console throw err; } - }) - .then( () => { - Object.assign = Object_assign; }); }); }