summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js30
1 files changed, 9 insertions, 21 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index 0bb1816..a81a99c 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -1,18 +1,10 @@
-var compilerbase = require("./base");
+import { COMPILER_REVISION, REVISION_CHANGES, log } from "../base";
-exports.attach = function(Handlebars) {
-
-compilerbase.attach(Handlebars);
-
-// BEGIN(BROWSER)
-/*jshint eqnull:true*/
-
-var Literal = function(value) {
+function Literal(value) {
this.value = value;
-};
-
+}
-var JavaScriptCompiler = Handlebars.JavaScriptCompiler = function() {};
+function JavaScriptCompiler() {}
JavaScriptCompiler.prototype = {
// PUBLIC API: You can override these methods in a subclass to provide
@@ -51,7 +43,7 @@ JavaScriptCompiler.prototype = {
this.environment = environment;
this.options = options || {};
- Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n");
+ log('debug', this.environment.disassemble() + "\n\n");
this.name = this.environment.name;
this.isChild = !!context;
@@ -162,8 +154,8 @@ JavaScriptCompiler.prototype = {
var source = this.mergeSource();
if (!this.isChild) {
- var revision = Handlebars.COMPILER_REVISION,
- versions = Handlebars.REVISION_CHANGES[revision];
+ var revision = COMPILER_REVISION,
+ versions = REVISION_CHANGES[revision];
source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source;
}
@@ -173,7 +165,7 @@ JavaScriptCompiler.prototype = {
return Function.apply(this, params);
} else {
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}';
- Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
+ log('debug', functionSource + "\n\n");
return functionSource;
}
},
@@ -849,8 +841,4 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
return false;
};
-// END(BROWSER)
-
-return Handlebars;
-
-};
+export default JavaScriptCompiler;