From 1bdd624b35210e64b5f644b0343fcce9c3f4f943 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 12 Sep 2017 07:59:37 -0400 Subject: [PATCH] prevent accidentally reintroducing ES6 into shared helpers --- src/interfaces.ts | 1 + src/shared/_build.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index acb967149982..93d1b608f2ab 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -55,6 +55,7 @@ export interface CompileOptions { hydratable?: boolean; legacy?: boolean; customElement?: CustomElementOptions | true; + css?: boolean; onerror?: (error: Error) => void; onwarn?: (warning: Warning) => void; diff --git a/src/shared/_build.js b/src/shared/_build.js index 3bbf0298ff31..0339ba558c16 100644 --- a/src/shared/_build.js +++ b/src/shared/_build.js @@ -16,6 +16,11 @@ fs.readdirSync(__dirname).forEach(file => { ast.body.forEach(node => { if (node.type !== 'ExportNamedDeclaration') return; + // check no ES6+ slipped in + acorn.parse(source.slice(node.declaration.start, node.end), { + ecmaVersion: 5 + }); + const declaration = node.declaration; if (!declaration) return; @@ -34,5 +39,7 @@ fs.readdirSync(__dirname).forEach(file => { fs.writeFileSync( 'src/generators/dom/shared.ts', `// this file is auto-generated, do not edit it -export default ${JSON.stringify(declarations, null, '\t')};` +const shared: Record = ${JSON.stringify(declarations, null, '\t')}; + +export default shared;` );