fix: break/continue omitting output before them, #123

BREAKING CHANGE: remove default export, now should be used like import
{Liquid} from 'liquidjs'
This commit is contained in:
harttle
2019-08-26 10:15:43 -05:00
committed by Jun Yang
parent 854e12ba53
commit ae45c4622e
99 changed files with 373 additions and 407 deletions
+3 -5
View File
@@ -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 = `
</ul>
`
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)
+4 -4
View File
@@ -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()
+3 -3
View File
@@ -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)
+2 -2
View File
@@ -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))
}
}
+2 -2
View File
@@ -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))
}
}