From 58a9a3f9b8aad3a500611dcbb6fa3ac0777bda6b Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Thu, 7 Nov 2019 09:28:47 -0500 Subject: [PATCH] reinstate banner --- src/compiler/compile/Component.ts | 3 +-- src/compiler/compile/create_module.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 4d8abadf34..67b2cd4380 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -240,8 +240,7 @@ export default class Component { const { compile_options, name } = this; const { format = 'esm' } = compile_options; - // TODO reinstate banner (along with fragment marker comments) - const banner = `/* ${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'} */`; + const banner = `${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'}`; const program: any = { type: 'Program', body: result }; diff --git a/src/compiler/compile/create_module.ts b/src/compiler/compile/create_module.ts index 76e68e758f..ce6443e899 100644 --- a/src/compiler/compile/create_module.ts +++ b/src/compiler/compile/create_module.ts @@ -44,7 +44,7 @@ function edit_source(source, sveltePath) { function esm( program: any, name: Identifier, - _banner: string, + banner: string, sveltePath: string, internal_path: string, helpers: Array<{ name: string; alias: Identifier }>, @@ -98,6 +98,8 @@ function esm( }; program.body = b` + /* ${banner} */ + ${import_declaration} ${internal_globals} ${imports} @@ -112,7 +114,7 @@ function esm( function cjs( program: any, name: Identifier, - _banner: string, + banner: string, sveltePath: string, internal_path: string, helpers: Array<{ name: string; alias: Identifier }>, @@ -188,6 +190,8 @@ function cjs( const exports = module_exports.map(x => b`exports.${{ type: 'Identifier', name: x.as }} = ${{ type: 'Identifier', name: x.name }};`); program.body = b` + /* ${banner} */ + "use strict"; ${internal_requires} ${internal_globals}