-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e497a35
commit c9ab70a
Showing
33 changed files
with
254 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,2 @@ | ||
import runtime from './handlebars.runtime'; | ||
|
||
// Compiler imports | ||
import AST from './handlebars/compiler/ast'; | ||
import { | ||
parser as Parser, | ||
parse, | ||
parseWithoutProcessing | ||
} from './handlebars/compiler/base'; | ||
import { Compiler, compile, precompile } from './handlebars/compiler/compiler'; | ||
import JavaScriptCompiler from './handlebars/compiler/javascript-compiler'; | ||
import Visitor from './handlebars/compiler/visitor'; | ||
|
||
import noConflict from './handlebars/no-conflict'; | ||
|
||
let _create = runtime.create; | ||
function create() { | ||
let hb = _create(); | ||
|
||
hb.compile = function(input, options) { | ||
return compile(input, options, hb); | ||
}; | ||
hb.precompile = function(input, options) { | ||
return precompile(input, options, hb); | ||
}; | ||
|
||
hb.AST = AST; | ||
hb.Compiler = Compiler; | ||
hb.JavaScriptCompiler = JavaScriptCompiler; | ||
hb.Parser = Parser; | ||
hb.parse = parse; | ||
hb.parseWithoutProcessing = parseWithoutProcessing; | ||
|
||
return hb; | ||
} | ||
|
||
let inst = create(); | ||
inst.create = create; | ||
|
||
noConflict(inst); | ||
|
||
inst.Visitor = Visitor; | ||
|
||
inst['default'] = inst; | ||
|
||
export default inst; | ||
import handlebars from './handlebars/index.js'; | ||
export default handlebars; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,2 @@ | ||
import * as base from './handlebars/base'; | ||
|
||
// Each of these augment the Handlebars object. No need to setup here. | ||
// (This is done to easily share code between commonjs and browse envs) | ||
import SafeString from './handlebars/safe-string'; | ||
import Exception from './handlebars/exception'; | ||
import * as Utils from './handlebars/utils'; | ||
import * as runtime from './handlebars/runtime'; | ||
|
||
import noConflict from './handlebars/no-conflict'; | ||
|
||
// For compatibility and usage outside of module systems, make the Handlebars object a namespace | ||
function create() { | ||
let hb = new base.HandlebarsEnvironment(); | ||
|
||
Utils.extend(hb, base); | ||
hb.SafeString = SafeString; | ||
hb.Exception = Exception; | ||
hb.Utils = Utils; | ||
hb.escapeExpression = Utils.escapeExpression; | ||
|
||
hb.VM = runtime; | ||
hb.template = function(spec) { | ||
return runtime.template(spec, hb); | ||
}; | ||
|
||
return hb; | ||
} | ||
|
||
let inst = create(); | ||
inst.create = create; | ||
|
||
noConflict(inst); | ||
|
||
inst['default'] = inst; | ||
|
||
export default inst; | ||
import handlebars from './handlebars/index.runtime.js'; | ||
export default handlebars; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* istanbul ignore next */ | ||
export const isArray = | ||
Array.isArray || | ||
function(value) { | ||
return value && typeof value === 'object' | ||
? toString.call(value) === '[object Array]' | ||
: false; | ||
}; | ||
|
||
const SourceNode = function(line, column, srcFile, chunks) { | ||
this.src = ''; | ||
if (chunks) { | ||
this.add(chunks); | ||
} | ||
}; | ||
|
||
/* istanbul ignore next */ | ||
SourceNode.prototype = { | ||
add: function(chunks) { | ||
if (isArray(chunks)) { | ||
chunks = chunks.join(''); | ||
} | ||
this.src += chunks; | ||
}, | ||
prepend: function(chunks) { | ||
if (isArray(chunks)) { | ||
chunks = chunks.join(''); | ||
} | ||
this.src = chunks + this.src; | ||
}, | ||
toStringWithSourceMap: function() { | ||
return { code: this.toString() }; | ||
}, | ||
toString: function() { | ||
return this.src; | ||
} | ||
}; | ||
|
||
export { SourceNode }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.