Selaa lähdekoodia

Make mustache.mjs work with Deno

Minor adjustments needed to make the TypeScript compiler
that is built into Deno, be happy with how mustache.js'
ES module source looks in terms of function parameters
passed and object mutability.

Refs https://github.com/phillipj/mustache.js/pull/1
tags/v3.2.0
Vincent LE GOFF Phillip Johnsen 6 vuotta sitten
vanhempi
commit
c28d73b530
3 muutettua tiedostoa jossa 24 lisäystä ja 8 poistoa
  1. +12
    -4
      mustache.js
  2. +1
    -1
      mustache.min.js
  3. +11
    -3
      mustache.mjs

+ 12
- 4
mustache.js Näytä tiedosto

@@ -3,7 +3,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Mustache = factory()); (global = global || self, global.Mustache = factory());
}(this, function () { 'use strict';
}(this, (function () { 'use strict';


/*! /*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript * mustache.js - Logic-less {{mustache}} templates with JavaScript
@@ -527,7 +527,7 @@
*/ */
Writer.prototype.render = function render (template, view, partials, tags) { Writer.prototype.render = function render (template, view, partials, tags) {
var tokens = this.parse(template, tags); var tokens = this.parse(template, tags);
var context = (view instanceof Context) ? view : new Context(view);
var context = (view instanceof Context) ? view : new Context(view, undefined);
return this.renderTokens(tokens, context, partials, template, tags); return this.renderTokens(tokens, context, partials, template, tags);
}; };


@@ -652,7 +652,15 @@
var mustache = { var mustache = {
name: 'mustache.js', name: 'mustache.js',
version: '3.1.0', version: '3.1.0',
tags: [ '{{', '}}' ]
tags: [ '{{', '}}' ],
clearCache: undefined,
escape: undefined,
parse: undefined,
render: undefined,
to_html: undefined,
Scanner: undefined,
Context: undefined,
Writer: undefined
}; };


// All high-level mustache.* functions use this writer. // All high-level mustache.* functions use this writer.
@@ -715,4 +723,4 @@


return mustache; return mustache;


}));
})));

+ 1
- 1
mustache.min.js
File diff suppressed because it is too large
Näytä tiedosto


+ 11
- 3
mustache.mjs Näytä tiedosto

@@ -520,7 +520,7 @@ Writer.prototype.parse = function parse (template, tags) {
*/ */
Writer.prototype.render = function render (template, view, partials, tags) { Writer.prototype.render = function render (template, view, partials, tags) {
var tokens = this.parse(template, tags); var tokens = this.parse(template, tags);
var context = (view instanceof Context) ? view : new Context(view);
var context = (view instanceof Context) ? view : new Context(view, undefined);
return this.renderTokens(tokens, context, partials, template, tags); return this.renderTokens(tokens, context, partials, template, tags);
}; };


@@ -645,7 +645,15 @@ Writer.prototype.rawValue = function rawValue (token) {
var mustache = { var mustache = {
name: 'mustache.js', name: 'mustache.js',
version: '3.1.0', version: '3.1.0',
tags: [ '{{', '}}' ]
tags: [ '{{', '}}' ],
clearCache: undefined,
escape: undefined,
parse: undefined,
render: undefined,
to_html: undefined,
Scanner: undefined,
Context: undefined,
Writer: undefined
}; };


// All high-level mustache.* functions use this writer. // All high-level mustache.* functions use this writer.
@@ -706,4 +714,4 @@ mustache.Scanner = Scanner;
mustache.Context = Context; mustache.Context = Context;
mustache.Writer = Writer; mustache.Writer = Writer;


export default mustache;
export default mustache;

Loading…
Peruuta
Tallenna