handlebars.js 977 B

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