handlebars.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import runtime from './handlebars.runtime';
  2. // Compiler imports
  3. import AST from './handlebars/compiler/ast';
  4. import {
  5. parser as Parser,
  6. parse,
  7. parseWithoutProcessing
  8. } from './handlebars/compiler/base';
  9. import { Compiler, compile, precompile } from './handlebars/compiler/compiler';
  10. import JavaScriptCompiler from './handlebars/compiler/javascript-compiler';
  11. import Visitor from './handlebars/compiler/visitor';
  12. import noConflict from './handlebars/no-conflict';
  13. let _create = runtime.create;
  14. function create() {
  15. let hb = _create();
  16. hb.compile = function(input, options) {
  17. return compile(input, options, hb);
  18. };
  19. hb.precompile = function(input, options) {
  20. return precompile(input, options, hb);
  21. };
  22. hb.AST = AST;
  23. hb.Compiler = Compiler;
  24. hb.JavaScriptCompiler = JavaScriptCompiler;
  25. hb.Parser = Parser;
  26. hb.parse = parse;
  27. hb.parseWithoutProcessing = parseWithoutProcessing;
  28. return hb;
  29. }
  30. let inst = create();
  31. inst.create = create;
  32. noConflict(inst);
  33. inst.Visitor = Visitor;
  34. inst['default'] = inst;
  35. export default inst;