diff --git a/benchmark/demo.ts b/benchmark/demo.ts index b71093666..faf0fec4a 100644 --- a/benchmark/demo.ts +++ b/benchmark/demo.ts @@ -1,7 +1,5 @@ import * as Benchmark from 'benchmark' -import Liquid from '../src/liquid' -import TagToken from '../src/parser/tag-token' -import Context from '../src/context/context' +import { Context, TagToken, Liquid } from '../src/liquid' const engine = new Liquid({ root: __dirname, @@ -34,13 +32,13 @@ const template = ` ` -export default function () { +export function demo () { console.log('--- demo ---') return new Promise(resolve => { new Benchmark.Suite('demo') .add('demo', { defer: true, - fn: (d: any) => engine.parseAndRender(template, ctx).then(x => d.resolve(x)) + fn: (d: any) => engine.parseAndRender(template, ctx).then((x: any) => d.resolve(x)) }) .on('cycle', (event: any) => console.log(String(event.target))) .on('complete', resolve) diff --git a/benchmark/index.ts b/benchmark/index.ts index 3b48082d4..8145a1f1a 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -1,7 +1,7 @@ -import output from './output' -import tag from './tag' -import demo from './demo' -import layout from './layout' +import { output } from './output' +import { tag } from './tag' +import { demo } from './demo' +import { layout } from './layout' async function main () { await output() diff --git a/benchmark/layout.ts b/benchmark/layout.ts index e0d030215..df26a1c59 100644 --- a/benchmark/layout.ts +++ b/benchmark/layout.ts @@ -17,17 +17,17 @@ const template = ` {% block body %}a small body{% endblock %} ` -export default function () { +export function layout () { console.log('--- layout ---') return new Promise(resolve => { new Benchmark.Suite('layout') .add('cache=false', { defer: true, - fn: (d: any) => engine.parseAndRender(template, {}).then(x => d.resolve(x)) + fn: (d: any) => engine.parseAndRender(template, {}).then((x: any) => d.resolve(x)) }) .add('cache=true', { defer: true, - fn: (d: any) => cachingEngine.parseAndRender(template, {}).then(x => d.resolve(x)) + fn: (d: any) => cachingEngine.parseAndRender(template, {}).then((x: any) => d.resolve(x)) }) .on('cycle', (event: any) => console.log(String(event.target))) .on('complete', resolve) diff --git a/benchmark/output.ts b/benchmark/output.ts index 50a7f4cc3..1f4b3c748 100644 --- a/benchmark/output.ts +++ b/benchmark/output.ts @@ -3,7 +3,7 @@ import Liquid from '../src/liquid' const liquid = new Liquid() -export default function () { +export function output () { console.log('--- output ---') return new Promise(resolve => { new Benchmark.Suite('output') @@ -21,6 +21,6 @@ export default function () { function test (str: string) { return { defer: true, - fn: (d: any) => liquid.parseAndRender(str).then(x => d.resolve(x)) + fn: (d: any) => liquid.parseAndRender(str).then((x: any) => d.resolve(x)) } } diff --git a/benchmark/tag.ts b/benchmark/tag.ts index 292dc3591..17ec687ad 100644 --- a/benchmark/tag.ts +++ b/benchmark/tag.ts @@ -3,7 +3,7 @@ import Liquid from '../src/liquid' const liquid = new Liquid() -export default function () { +export function tag () { console.log('--- tag ---') return new Promise(resolve => { new Benchmark.Suite('tag') @@ -25,6 +25,6 @@ export default function () { function test (str: string) { return { defer: true, - fn: (d: any) => liquid.parseAndRender(str).then(x => d.resolve(x)) + fn: (d: any) => liquid.parseAndRender(str).then((x: any) => d.resolve(x)) } } diff --git a/demo/browser/index.html b/demo/browser/index.html index 4d6887cdf..210caca2d 100644 --- a/demo/browser/index.html +++ b/demo/browser/index.html @@ -8,7 +8,8 @@