refactor: import babelify

This commit is contained in:
harttle
2018-08-17 01:32:16 +08:00
parent 87360d5207
commit fa7cd8f4ff
25 changed files with 102 additions and 89 deletions
+5 -5
View File
@@ -14,7 +14,7 @@ import {isTruthy, isFalsy, evalExp, evalValue} from './syntax.js'
import tags from './tags'
import filters from './filters'
import {anySeries} from './util/promise.js'
import Errors from './util/error.js'
import {ParseError, TokenizationEroor, RenderBreakError, AssertionError} from './util/error.js'
let _engine = {
init: function (tag, filter, options) {
@@ -174,10 +174,10 @@ function normalizeStringArray (value) {
}
const Types = {
ParseError: Errors.ParseError,
TokenizationEroor: Errors.TokenizationError,
RenderBreakError: Errors.RenderBreakError,
AssertionError: Errors.AssertionError
ParseError,
TokenizationEroor,
RenderBreakError,
AssertionError
}
factory.isTruthy = isTruthy
+1 -2
View File
@@ -1,5 +1,4 @@
'use strict'
const Liquid = require('..')
const Liquid = require('../index')
const assert = require('../util/assert.js')
const lexical = Liquid.lexical
const types = require('../scope').types
+5 -13
View File
@@ -21,13 +21,13 @@ function initLiquidError (err, token) {
(err.stack ? '\nFrom ' + err.stack : '')
}
function TokenizationError (message, token) {
export function TokenizationError (message, token) {
initLiquidError.call(this, {message: message}, token)
}
TokenizationError.prototype = Object.create(Error.prototype)
TokenizationError.prototype.constructor = TokenizationError
function ParseError (e, token) {
export function ParseError (e, token) {
_.assign(this, e)
this.originalError = e
@@ -36,7 +36,7 @@ function ParseError (e, token) {
ParseError.prototype = Object.create(Error.prototype)
ParseError.prototype.constructor = ParseError
function RenderError (e, tpl) {
export function RenderError (e, tpl) {
// return the original render error
if (e instanceof RenderError) {
return e
@@ -49,14 +49,14 @@ function RenderError (e, tpl) {
RenderError.prototype = Object.create(Error.prototype)
RenderError.prototype.constructor = RenderError
function RenderBreakError (message) {
export function RenderBreakError (message) {
initError.call(this)
this.message = message + ''
}
RenderBreakError.prototype = Object.create(Error.prototype)
RenderBreakError.prototype.constructor = RenderBreakError
function AssertionError (message) {
export function AssertionError (message) {
initError.call(this)
this.message = message + ''
}
@@ -98,11 +98,3 @@ function mkMessage (msg, token) {
}
return msg
}
module.exports = {
TokenizationError,
ParseError,
RenderBreakError,
AssertionError,
RenderError
}