diff options
author | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:37:53 -0500 |
---|---|---|
committer | Timoney, Daniel (dt5972) <dtimoney@att.com> | 2017-02-15 10:40:37 -0500 |
commit | 324ee36fe31763e507b422ab0a88e4230045e205 (patch) | |
tree | d0b04520f6657601c918ce63fd27575977624187 /dgbuilder/dgeflows/node_modules/ejs | |
parent | f0c97e8db427481e28c0a16b789bc73801b35e47 (diff) |
Initial commit for OpenECOMP SDN-C OA&M
Change-Id: I7ab579fd0d206bf356f36d52dcdf4f71f1fa2680
Signed-off-by: Timoney, Daniel (dt5972) <dtimoney@att.com>
Former-commit-id: 2a9f0edd09581f907e62ec4689b5ac94dd5382ba
Diffstat (limited to 'dgbuilder/dgeflows/node_modules/ejs')
67 files changed, 2757 insertions, 0 deletions
diff --git a/dgbuilder/dgeflows/node_modules/ejs/Jakefile b/dgbuilder/dgeflows/node_modules/ejs/Jakefile new file mode 100644 index 00000000..0362e98d --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/Jakefile @@ -0,0 +1,45 @@ +var fs = require('fs') + , buildOpts = { + printStdout: true + , printStderr: true + }; + +task('build', ['browserify', 'minify'], function () { + console.log('Build completed.'); +}); + +desc('Cleans browerified/minified files and package files'); +task('clean', ['clobber'], function () { + jake.rmRf('./ejs.js'); + jake.rmRf('./ejs.min.js'); +}); + +task('browserify', {async: true}, function () { + jake.exec('./node_modules/browserify/bin/cmd.js lib/ejs.js > ejs.js', + buildOpts, function () { + console.log('Browserification completed.'); + setTimeout(complete, 0); + }); +}); + +task('minify', {async: true}, function () { + jake.exec('./node_modules/uglify-js/bin/uglifyjs ejs.js > ejs.min.js', + buildOpts, function () { + console.log('Minification completed.'); + setTimeout(complete, 0); + }); +}); + +publishTask('ejs', ['build'], function () { + this.packageFiles.include([ + 'Jakefile' + , 'README.md' + , 'package.json' + , 'ejs.js' + , 'ejs.min.js' + , 'lib/**' + , 'test/**' + ]); +}); + + diff --git a/dgbuilder/dgeflows/node_modules/ejs/README.md b/dgbuilder/dgeflows/node_modules/ejs/README.md new file mode 100644 index 00000000..cd0a9118 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/README.md @@ -0,0 +1,157 @@ +# EJS + +Embedded JavaScript templates + +[![Build Status](https://img.shields.io/travis/mde/ejs/master.svg?style=flat)](https://travis-ci.org/mde/ejs) +[![Developing Dependencies](https://img.shields.io/david/dev/mde/ejs.svg?style=flat)](https://david-dm.org/mde/ejs#info=devDependencies) + +## Installation + +```bash +$ npm install ejs +``` + +## Features + + * Control flow with `<% %>` + * Escaped output with `<%= %>` + * Unescaped raw output with `<%- %>` + * Trim-mode ('newline slurping') with `-%>` ending tag + * Custom delimiters (e.g., use '<? ?>' instead of '<% %>') + * Includes + * Client-side support + * Static caching of intermediate JavaScript + * Static caching of templates + * Complies with the [Express](http://expressjs.com) view system + +## Example + +```html +<% if (user) { %> + <h2><%= user.name %></h2> +<% } %> +``` + +## Usage + +```javascript +var template = ejs.compile(str, options); +template(data); +// => Rendered HTML string + +ejs.render(str, data, options); +// => Rendered HTML string +``` + +You can also use the shortcut `ejs.render(dataAndOptions);` where you pass +everything in a single object. In that case, you'll end up with local variables +for all the passed options. + +## Options + + - `cache` Compiled functions are cached, requires `filename` + - `filename` Used by `cache` to key caches, and for includes + - `context` Function execution context + - `compileDebug` When `false` no debug instrumentation is compiled + - `client` Returns standalone compiled function + - `delimiter` Character to use with angle brackets for open/close + - `debug` Output generated function body + - `_with` Whether or not to use `with() {}` constructs. If `false` then the locals will be stored in the `locals` object. + +## Tags + + - `<%` 'Scriptlet' tag, for control-flow, no output + - `<%=` Outputs the value into the template (HTML escaped) + - `<%-` Outputs the unescaped value into the template + - `<%#` Comment tag, no execution, no output + - `<%%` Outputs a literal '<%' + - `%>` Plain ending tag + - `-%>` Trim-mode ('newline slurp') tag, trims following newline + +## Includes + +Includes are relative to the template with the `include` call. (This +requires the 'filename' option.) For example if you have "./views/users.ejs" and +"./views/user/show.ejs" you would use `<%- include('user/show'); %>`. + +You'll likely want to use the raw output tag (`<%-`) with your include to avoid +double-escaping the HTML output. + +```html +<ul> + <% users.forEach(function(user){ %> + <%- include('user/show', {user: user}); %> + <% }); %> +</ul> +``` + +Includes are inserted at runtime, so you can use variables for the path in the +`include` call (for example `<%- include(somePath); %>`). Variables in your +top-level data object are available to all your includes, but local variables +need to be passed down. + +NOTE: Include preprocessor directives (`<% include user/show %>`) are +still supported. + +## Custom delimiters + +Custom delimiters can be applied on a per-template basis, or globally: + +```javascript +var ejs = require('ejs'), + users = ['geddy', 'neil', 'alex']; + +// Just one template +ejs.render('<?= users.join(" | "); ?>', {users: users}, {delimiter: '?'}); +// => 'geddy | neil | alex' + +// Or globally +ejs.delimiter = '$'; +ejs.render('<$= users.join(" | "); $>', {users: users}); +// => 'geddy | neil | alex' +``` + +## Layouts + +EJS does not specifically support blocks, but layouts can be implemented by +including headers and footers, like so: + + +```html +<%- include('header'); -%> +<h1> + Title +</h1> +<p> + My page +</p> +<%- include('footer'); -%> +``` + +## Client-side support + +Go to the [Latest Release](https://github.com/mde/ejs/releases/latest), download +`./ejs.js` or `./ejs.min.js`. + +Include one of these on your page, and `ejs.render(str)`. + +## Related projects + +There are a number of implementations of EJS: + + * TJ's implementation, the v1 of this library: https://github.com/tj/ejs + * Jupiter Consulting's EJS: http://www.embeddedjs.com/ + * EJS Embedded JavaScript Framework on Google Code: https://code.google.com/p/embeddedjavascript/ + * Sam Stephenson's Ruby implementation: https://rubygems.org/gems/ejs + * Erubis, an ERB implementation which also runs JavaScript: http://www.kuwata-lab.com/erubis/users-guide.04.html#lang-javascript + +## License + +Licensed under the Apache License, Version 2.0 +(<http://www.apache.org/licenses/LICENSE-2.0>) + +- - - +EJS Embedded JavaScript templates copyright 2112 +mde@fleegix.org. + + diff --git a/dgbuilder/dgeflows/node_modules/ejs/ejs.js b/dgbuilder/dgeflows/node_modules/ejs/ejs.js new file mode 100644 index 00000000..389e45e4 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/ejs.js @@ -0,0 +1,924 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +(function (process){ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +var fs = require('fs') + , utils = require('./utils') + , jsCache = {} + , _VERSION_STRING = require('../package.json').version + , _DEFAULT_DELIMITER = '%' + , _DEFAULT_LOCALS_NAME = 'locals' + , _REGEX_STRING = '(<%%|<%=|<%-|<%#|<%|%>|-%>)' + , _OPTS = [ 'cache', 'filename', 'delimiter', 'scope', 'context' + , 'debug', 'compileDebug', 'client', '_with' + ] + , _TRAILING_SEMCOL = /;\s*$/; + +exports.localsName = _DEFAULT_LOCALS_NAME; + +exports.resolveInclude = function(name, filename) { + var path = require('path') + , dirname = path.dirname + , extname = path.extname + , resolve = path.resolve + , includePath = resolve(dirname(filename), name) + , ext = extname(name); + if (!ext) { + includePath += '.ejs'; + } + return includePath; +} + + +// Returns a possibly cached template function, set by options.cache. +// `template` is the string of EJS to compile. +// If template is undefined then the file specified in options.filename is +// read. +function handleCache(options, template) { + var fn + , path = options.filename + , hasTemplate = template !== undefined; + + if (options.cache) { + if (!path) { + throw new Error('cache option requires a filename'); + } + fn = jsCache[path]; + if (fn) { + return fn; + } + if (!hasTemplate) { + template = fs.readFileSync(path, {encoding: 'utf8'}); + } + } + else if (!hasTemplate) { + if (!path) { + throw new Error('Internal EJS error: no file name or template ' + + 'provided'); + } + template = fs.readFileSync(path, {encoding: 'utf8'}); + } + fn = exports.compile(template.trim(), options); + if (options.cache) { + jsCache[path] = fn; + } + return fn; +} + +function includeFile(path, options) { + var opts = utils.shallowCopy({}, options || /* istanbul ignore next */ {}); + if (!opts.filename) { + throw new Error('`include` requires the \'filename\' option.'); + } + opts.filename = exports.resolveInclude(path, opts.filename); + return handleCache(opts); +} + +function includeSource(path, options) { + var opts = utils.shallowCopy({}, options || {}) + , includePath + , template; + if (!opts.filename) { + throw new Error('`include` requires the \'filename\' option.'); + } + includePath = exports.resolveInclude(path, opts.filename); + template = fs.readFileSync(includePath).toString().trim(); + + opts.filename = includePath; + var templ = new Template(template, opts); + templ.generateSource(); + return templ.source; +} + +function rethrow(err, str, filename, lineno){ + var lines = str.split('\n') + , start = Math.max(lineno - 3, 0) + , end = Math.min(lines.length, lineno + 3); + + // Error context + var context = lines.slice(start, end).map(function (line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +function cpOptsInData(data, opts) { + _OPTS.forEach(function (p) { + if (typeof data[p] != 'undefined') { + opts[p] = data[p]; + } + }); + delete data.__expressRender__; +} + +function compile(template, opts) { + var templ; + + // v1 compat + // 'scope' is 'context' + // FIXME: Remove this in a future version + if (opts && opts.scope) { + if (!opts.context) { + opts.context = opts.scope; + } + delete opts.scope; + } + templ = new Template(template, opts); + return templ.compile(); +} +exports.compile = compile; + +// template, [data], [opts] +// Have to include an empty data object if you want opts and no data +exports.render = function (template, data, opts) { + data = data || {}; + opts = opts || {}; + var fn; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 2) { + cpOptsInData(data, opts); + } + + fn = handleCache(opts, template); + return fn.call(opts.context, data); +}; + +// path, [data], [opts], cb +// Have to include an empty data object if you want opts and no data +exports.renderFile = function () { + var args = Array.prototype.slice.call(arguments) + , path = args.shift() + , cb = args.pop() + , data = args.shift() || {} + , opts = args.pop() || {} + , result + , failed = false; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 3) { + cpOptsInData(data, opts); + } + opts.filename = path; + + try { + result = handleCache(opts)(data); + } + catch(err) { + return process.nextTick(function () { + cb(err); + }); + } + process.nextTick(function () { + cb(null, result); + }); +}; + +exports.clearCache = function () { + jsCache = {}; +}; + +function Template(text, opts) { + opts = opts || {}; + var options = {}; + this.templateText = text; + this.mode = null; + this.truncate = false; + this.currentLine = 1; + this.source = ''; + options.client = opts.client || false; + options.escapeFunction = opts.escape || utils.escapeXML; + options.compileDebug = opts.compileDebug !== false; + options.debug = !!opts.debug; + options.filename = opts.filename; + options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; + options._with = typeof opts._with != 'undefined' ? opts._with : true; + options.cache = opts.cache || false; + this.opts = options; + + this.regex = this.createRegex(); +} + +Template.modes = { + EVAL: 'eval' + , ESCAPED: 'escaped' + , RAW: 'raw' + , COMMENT: 'comment' + , LITERAL: 'literal' +}; + +Template.prototype = new function () { + this.createRegex = function () { + var str = _REGEX_STRING + , delim = utils.escapeRegExpChars(this.opts.delimiter); + str = str.replace(/%/g, delim); + return new RegExp(str); + }; + + this.compile = function () { + var src + , fn + , opts = this.opts + , escape = opts.escapeFunction; + + if (!this.source) { + this.generateSource(); + var prepended = 'var __output = [];'; + if (opts._with !== false) { + prepended += ' with (' + exports.localsName + ' || {}) { '; + } + this.source = prepended + this.source; + if (opts._with !== false) { + this.source += '}'; + } + this.source += ';return __output.join("").trim();'; + } + + if (opts.compileDebug) { + src = 'var __line = 1' + + ', __lines = ' + JSON.stringify(this.templateText) + + ', __filename = ' + (opts.filename ? + JSON.stringify(opts.filename) : 'undefined') + + '; try {' + + this.source + '} catch (e) { rethrow(e, __lines, __filename, __line); }'; + } + else { + src = this.source; + } + + if (opts.debug) { + console.log(src); + } + + if (opts.client) { + if (escape !== utils.escapeXML) { + src = 'escape = escape || ' + escape.toString() + ';\n' + src; + } + else { + src = utils.escapeFuncStr + + 'escape = escape || ' + + escape.toString() + ';\n' + + src; + } + if (opts.compileDebug) { + src = 'rethrow = rethrow || ' + rethrow.toString() + ';\n' + src; + } + } + + try { + fn = new Function(exports.localsName + ', escape, include, rethrow', src); + } + catch(e) { + if (e instanceof SyntaxError) { + if (opts.filename) { + e.message += ' in ' + opts.filename; + } + e.message += ' while compiling ejs'; + throw e; + } + } + + if (opts.client) { + return fn; + } + + // Return a callable function which will execute the function + // created by the source-code, with the passed data as locals + return function (data) { + var include = function (path, includeData) { + var d = utils.shallowCopy({}, data); + if (includeData) { + d = utils.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn(data || {}, escape, include, rethrow); + }; + + }; + + this.generateSource = function () { + var self = this + , matches = this.parseTemplateText() + , d = this.opts.delimiter; + + if (matches && matches.length) { + matches.forEach(function (line, index) { + var closing + , include + , includeOpts + , includeSrc; + // If this is an opening tag, check for closing tags + // FIXME: May end up with some false positives here + // Better to store modes as k/v with '<' + delimiter as key + // Then this can simply check against the map + if ( line.indexOf('<' + d) === 0 // If it is a tag + && line.indexOf('<' + d + d) !== 0) { // and is not escaped + closing = matches[index + 2]; + if (!(closing == d + '>' || closing == '-' + d + '>')) { + throw new Error('Could not find matching close tag for "' + line + '".'); + } + } + // HACK: backward-compat `include` preprocessor directives + if ((include = line.match(/^\s*include\s+(\S+)/))) { + includeOpts = utils.shallowCopy({}, self.opts); + includeSrc = includeSource(include[1], includeOpts); + includeSrc = ';(function(){' + includeSrc + '})();'; + self.source += includeSrc; + } + else { + self.scanLine(line); + } + }); + } + + }; + + this.parseTemplateText = function () { + var str = this.templateText + , pat = this.regex + , result = pat.exec(str) + , arr = [] + , firstPos + , lastPos; + + while (result) { + firstPos = result.index; + lastPos = pat.lastIndex; + + if (firstPos !== 0) { + arr.push(str.substring(0, firstPos)); + str = str.slice(firstPos); + } + + arr.push(result[0]); + str = str.slice(result[0].length); + result = pat.exec(str); + } + + if (str) { + arr.push(str); + } + + return arr; + }; + + this.scanLine = function (line) { + var self = this + , d = this.opts.delimiter + , newLineCount = 0; + + function _addOutput() { + if (self.truncate) { + line = line.replace('\n', ''); + } + + // Preserve literal slashes + line = line.replace(/\\/g, '\\\\'); + + // Convert linebreaks + line = line.replace(/\n/g, '\\n'); + line = line.replace(/\r/g, '\\r'); + + // Escape double-quotes + // - this will be the delimiter during execution + line = line.replace(/"/g, '\\"'); + self.source += ';__output.push("' + line + '");'; + } + + newLineCount = (line.split('\n').length - 1); + + switch (line) { + case '<' + d: + this.mode = Template.modes.EVAL; + break; + case '<' + d + '=': + this.mode = Template.modes.ESCAPED; + break; + case '<' + d + '-': + this.mode = Template.modes.RAW; + break; + case '<' + d + '#': + this.mode = Template.modes.COMMENT; + break; + case '<' + d + d: + this.mode = Template.modes.LITERAL; + this.source += ';__output.push("' + line.replace('<' + d + d, '<' + d) + '");'; + break; + case d + '>': + case '-' + d + '>': + if (this.mode == Template.modes.LITERAL) { + _addOutput(); + } + + this.mode = null; + this.truncate = line.indexOf('-') === 0; + break; + default: + // In script mode, depends on type of tag + if (this.mode) { + // If '//' is found without a line break, add a line break. + switch (this.mode) { + case Template.modes.EVAL: + case Template.modes.ESCAPED: + case Template.modes.RAW: + if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { + line += '\n'; + } + } + switch (this.mode) { + // Just executing code + case Template.modes.EVAL: + this.source += ';' + line; + break; + // Exec, esc, and output + case Template.modes.ESCAPED: + // Add the exec'd, escaped result to the output + // Have to prevent the string-coercion of `undefined` and `null` + // in the `escape` function -- making a `join` call like below unnecessary + this.source += ';__output.push(escape(' + + line.replace(_TRAILING_SEMCOL, '').trim() + '))'; + break; + // Exec and output + case Template.modes.RAW: + // Add the exec'd result to the output + // Using `join` here prevents string-coercion of `undefined` and `null` + // without filtering out falsey values like zero + this.source += ';__output.push(' + + line.replace(_TRAILING_SEMCOL, '').trim() + ')'; + break; + case Template.modes.COMMENT: + // Do nothing + break; + // Literal <%% mode, append as raw output + case Template.modes.LITERAL: + _addOutput(); + break; + } + } + // In string mode, just add the output + else { + _addOutput(); + } + } + + if (self.opts.compileDebug && newLineCount) { + this.currentLine += newLineCount; + this.source += ';__line = ' + this.currentLine + ';'; + } + }; +}; + +// Express support +exports.__express = exports.renderFile; + +// Add require support +/* istanbul ignore else */ +if (require.extensions) { + require.extensions['.ejs'] = function (module, filename) { + filename = filename || /* istanbul ignore next */ module.filename; + var options = { + filename: filename + , client: true + } + , template = fs.readFileSync(filename).toString().trim() + , fn = compile(template, options); + module._compile('module.exports = ' + fn.toString() + ';', filename); + }; +} + +exports.VERSION = _VERSION_STRING; + +/* istanbul ignore if */ +if (typeof window != 'undefined') { + window.ejs = exports; +} + +}).call(this,require('_process')) +},{"../package.json":6,"./utils":2,"_process":5,"fs":3,"path":4}],2:[function(require,module,exports){ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +var regExpChars = /[|\\{}()[\]^$+*?.]/g; + +exports.escapeRegExpChars = function (string) { + // istanbul ignore if + if (!string) { + return ''; + } + return String(string).replace(regExpChars, '\\$&'); +}; + +var encodeHTMLRules = { + '&': '&' + , '<': '<' + , '>': '>' + , '"': '"' + , "'": ''' + } + , matchHTML = /[&<>\'"]/g; + +exports.escapeFuncStr = + 'var encodeHTMLRules = {' ++ '"&": "&"' ++ ', "<": "<"' ++ ', ">": ">"' ++ ', \'"\': """' ++ ', "\'": "'"' ++ '}' ++ ', matchHTML = /[&<>\'"]/g;'; + +exports.escapeXML = function (markup) { + return markup == undefined + ? '' + : String(markup) + .replace(matchHTML, function(m) { + return encodeHTMLRules[m] || m; + }); +}; + +exports.shallowCopy = function (to, from) { + for (var p in from) { + to[p] = from[p]; + } + return to; +}; + + +},{}],3:[function(require,module,exports){ + +},{}],4:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +}).call(this,require('_process')) +},{"_process":5}],5:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; +var queue = []; +var draining = false; + +function drainQueue() { + if (draining) { + return; + } + draining = true; + var currentQueue; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + var i = -1; + while (++i < len) { + currentQueue[i](); + } + len = queue.length; + } + draining = false; +} +process.nextTick = function (fun) { + queue.push(fun); + if (!draining) { + setTimeout(drainQueue, 0); + } +}; + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],6:[function(require,module,exports){ +module.exports={ + "name": "ejs", + "description": "Embedded JavaScript templates", + "keywords": [ + "template", + "engine", + "ejs" + ], + "version": "2.2.3", + "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", + "contributors": [ + "Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)" + ], + "license": "Apache-2.0", + "main": "./lib/ejs.js", + "repository": { + "type": "git", + "url": "git://github.com/mde/ejs.git" + }, + "bugs": "https://github.com/mde/ejs/issues", + "homepage": "https://github.com/mde/ejs", + "dependencies": {}, + "devDependencies": { + "browserify": "^8.0.3", + "uglify-js": "^2.4.16", + "mocha": "^2.1.0", + "jake": "^8.0.0", + "istanbul": "~0.3.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "coverage": "istanbul cover node_modules/mocha/bin/_mocha" + } +} +},{}]},{},[1]); diff --git a/dgbuilder/dgeflows/node_modules/ejs/ejs.min.js b/dgbuilder/dgeflows/node_modules/ejs/ejs.min.js new file mode 100644 index 00000000..fdda012b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/ejs.min.js @@ -0,0 +1 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(process){"use strict";var fs=require("fs"),utils=require("./utils"),jsCache={},_VERSION_STRING=require("../package.json").version,_DEFAULT_DELIMITER="%",_DEFAULT_LOCALS_NAME="locals",_REGEX_STRING="(<%%|<%=|<%-|<%#|<%|%>|-%>)",_OPTS=["cache","filename","delimiter","scope","context","debug","compileDebug","client","_with"],_TRAILING_SEMCOL=/;\s*$/;exports.localsName=_DEFAULT_LOCALS_NAME;exports.resolveInclude=function(name,filename){var path=require("path"),dirname=path.dirname,extname=path.extname,resolve=path.resolve,includePath=resolve(dirname(filename),name),ext=extname(name);if(!ext){includePath+=".ejs"}return includePath};function handleCache(options,template){var fn,path=options.filename,hasTemplate=template!==undefined;if(options.cache){if(!path){throw new Error("cache option requires a filename")}fn=jsCache[path];if(fn){return fn}if(!hasTemplate){template=fs.readFileSync(path,{encoding:"utf8"})}}else if(!hasTemplate){if(!path){throw new Error("Internal EJS error: no file name or template "+"provided")}template=fs.readFileSync(path,{encoding:"utf8"})}fn=exports.compile(template.trim(),options);if(options.cache){jsCache[path]=fn}return fn}function includeFile(path,options){var opts=utils.shallowCopy({},options||{});if(!opts.filename){throw new Error("`include` requires the 'filename' option.")}opts.filename=exports.resolveInclude(path,opts.filename);return handleCache(opts)}function includeSource(path,options){var opts=utils.shallowCopy({},options||{}),includePath,template;if(!opts.filename){throw new Error("`include` requires the 'filename' option.")}includePath=exports.resolveInclude(path,opts.filename);template=fs.readFileSync(includePath).toString().trim();opts.filename=includePath;var templ=new Template(template,opts);templ.generateSource();return templ.source}function rethrow(err,str,filename,lineno){var lines=str.split("\n"),start=Math.max(lineno-3,0),end=Math.min(lines.length,lineno+3);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function cpOptsInData(data,opts){_OPTS.forEach(function(p){if(typeof data[p]!="undefined"){opts[p]=data[p]}});delete data.__expressRender__}function compile(template,opts){var templ;if(opts&&opts.scope){if(!opts.context){opts.context=opts.scope}delete opts.scope}templ=new Template(template,opts);return templ.compile()}exports.compile=compile;exports.render=function(template,data,opts){data=data||{};opts=opts||{};var fn;if(arguments.length==2){cpOptsInData(data,opts)}fn=handleCache(opts,template);return fn.call(opts.context,data)};exports.renderFile=function(){var args=Array.prototype.slice.call(arguments),path=args.shift(),cb=args.pop(),data=args.shift()||{},opts=args.pop()||{},result,failed=false;if(arguments.length==3){cpOptsInData(data,opts)}opts.filename=path;try{result=handleCache(opts)(data)}catch(err){return process.nextTick(function(){cb(err)})}process.nextTick(function(){cb(null,result)})};exports.clearCache=function(){jsCache={}};function Template(text,opts){opts=opts||{};var options={};this.templateText=text;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";options.client=opts.client||false;options.escapeFunction=opts.escape||utils.escapeXML;options.compileDebug=opts.compileDebug!==false;options.debug=!!opts.debug;options.filename=opts.filename;options.delimiter=opts.delimiter||exports.delimiter||_DEFAULT_DELIMITER;options._with=typeof opts._with!="undefined"?opts._with:true;options.cache=opts.cache||false;this.opts=options;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype=new function(){this.createRegex=function(){var str=_REGEX_STRING,delim=utils.escapeRegExpChars(this.opts.delimiter);str=str.replace(/%/g,delim);return new RegExp(str)};this.compile=function(){var src,fn,opts=this.opts,escape=opts.escapeFunction;if(!this.source){this.generateSource();var prepended="var __output = [];";if(opts._with!==false){prepended+=" with ("+exports.localsName+" || {}) { "}this.source=prepended+this.source;if(opts._with!==false){this.source+="}"}this.source+=';return __output.join("").trim();'}if(opts.compileDebug){src="var __line = 1"+", __lines = "+JSON.stringify(this.templateText)+", __filename = "+(opts.filename?JSON.stringify(opts.filename):"undefined")+"; try {"+this.source+"} catch (e) { rethrow(e, __lines, __filename, __line); }"}else{src=this.source}if(opts.debug){console.log(src)}if(opts.client){if(escape!==utils.escapeXML){src="escape = escape || "+escape.toString()+";\n"+src}else{src=utils.escapeFuncStr+"escape = escape || "+escape.toString()+";\n"+src}if(opts.compileDebug){src="rethrow = rethrow || "+rethrow.toString()+";\n"+src}}try{fn=new Function(exports.localsName+", escape, include, rethrow",src)}catch(e){if(e instanceof SyntaxError){if(opts.filename){e.message+=" in "+opts.filename}e.message+=" while compiling ejs";throw e}}if(opts.client){return fn}return function(data){var include=function(path,includeData){var d=utils.shallowCopy({},data);if(includeData){d=utils.shallowCopy(d,includeData)}return includeFile(path,opts)(d)};return fn(data||{},escape,include,rethrow)}};this.generateSource=function(){var self=this,matches=this.parseTemplateText(),d=this.opts.delimiter;if(matches&&matches.length){matches.forEach(function(line,index){var closing,include,includeOpts,includeSrc;if(line.indexOf("<"+d)===0&&line.indexOf("<"+d+d)!==0){closing=matches[index+2];if(!(closing==d+">"||closing=="-"+d+">")){throw new Error('Could not find matching close tag for "'+line+'".')}}if(include=line.match(/^\s*include\s+(\S+)/)){includeOpts=utils.shallowCopy({},self.opts);includeSrc=includeSource(include[1],includeOpts);includeSrc=";(function(){"+includeSrc+"})();";self.source+=includeSrc}else{self.scanLine(line)}})}};this.parseTemplateText=function(){var str=this.templateText,pat=this.regex,result=pat.exec(str),arr=[],firstPos,lastPos;while(result){firstPos=result.index;lastPos=pat.lastIndex;if(firstPos!==0){arr.push(str.substring(0,firstPos));str=str.slice(firstPos)}arr.push(result[0]);str=str.slice(result[0].length);result=pat.exec(str)}if(str){arr.push(str)}return arr};this.scanLine=function(line){var self=this,d=this.opts.delimiter,newLineCount=0;function _addOutput(){if(self.truncate){line=line.replace("\n","")}line=line.replace(/\\/g,"\\\\");line=line.replace(/\n/g,"\\n");line=line.replace(/\r/g,"\\r");line=line.replace(/"/g,'\\"');self.source+=';__output.push("'+line+'");'}newLineCount=line.split("\n").length-1;switch(line){case"<"+d:this.mode=Template.modes.EVAL;break;case"<"+d+"=":this.mode=Template.modes.ESCAPED;break;case"<"+d+"-":this.mode=Template.modes.RAW;break;case"<"+d+"#":this.mode=Template.modes.COMMENT;break;case"<"+d+d:this.mode=Template.modes.LITERAL;this.source+=';__output.push("'+line.replace("<"+d+d,"<"+d)+'");';break;case d+">":case"-"+d+">":if(this.mode==Template.modes.LITERAL){_addOutput()}this.mode=null;this.truncate=line.indexOf("-")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(line.lastIndexOf("//")>line.lastIndexOf("\n")){line+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=";"+line;break;case Template.modes.ESCAPED:this.source+=";__output.push(escape("+line.replace(_TRAILING_SEMCOL,"").trim()+"))";break;case Template.modes.RAW:this.source+=";__output.push("+line.replace(_TRAILING_SEMCOL,"").trim()+")";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:_addOutput();break}}else{_addOutput()}}if(self.opts.compileDebug&&newLineCount){this.currentLine+=newLineCount;this.source+=";__line = "+this.currentLine+";"}}};exports.__express=exports.renderFile;if(require.extensions){require.extensions[".ejs"]=function(module,filename){filename=filename||module.filename;var options={filename:filename,client:true},template=fs.readFileSync(filename).toString().trim(),fn=compile(template,options);module._compile("module.exports = "+fn.toString()+";",filename)}}exports.VERSION=_VERSION_STRING;if(typeof window!="undefined"){window.ejs=exports}}).call(this,require("_process"))},{"../package.json":6,"./utils":2,_process:5,fs:3,path:4}],2:[function(require,module,exports){"use strict";var regExpChars=/[|\\{}()[\]^$+*?.]/g;exports.escapeRegExpChars=function(string){if(!string){return""}return String(string).replace(regExpChars,"\\$&")};var encodeHTMLRules={"&":"&","<":"<",">":">",'"':""","'":"'"},matchHTML=/[&<>\'"]/g;exports.escapeFuncStr="var encodeHTMLRules = {"+'"&": "&"'+', "<": "<"'+', ">": ">"'+', \'"\': """'+', "\'": "'"'+"}"+", matchHTML = /[&<>'\"]/g;";exports.escapeXML=function(markup){return markup==undefined?"":String(markup).replace(matchHTML,function(m){return encodeHTMLRules[m]||m})};exports.shallowCopy=function(to,from){for(var p in from){to[p]=from[p]}return to}},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:5}],5:[function(require,module,exports){var process=module.exports={};var queue=[];var draining=false;function drainQueue(){if(draining){return}draining=true;var currentQueue;var len=queue.length;while(len){currentQueue=queue;queue=[];var i=-1;while(++i<len){currentQueue[i]()}len=queue.length}draining=false}process.nextTick=function(fun){queue.push(fun);if(!draining){setTimeout(drainQueue,0)}};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],6:[function(require,module,exports){module.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"2.2.3",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",contributors:["Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)"],license:"Apache-2.0",main:"./lib/ejs.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{},devDependencies:{browserify:"^8.0.3","uglify-js":"^2.4.16",mocha:"^2.1.0",jake:"^8.0.0",istanbul:"~0.3.5"},engines:{node:">=0.10.0"},scripts:{test:"mocha",coverage:"istanbul cover node_modules/mocha/bin/_mocha"}}},{}]},{},[1]);
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/lib/ejs.js b/dgbuilder/dgeflows/node_modules/ejs/lib/ejs.js new file mode 100644 index 00000000..a0d4ae54 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/lib/ejs.js @@ -0,0 +1,525 @@ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +var fs = require('fs') + , utils = require('./utils') + , jsCache = {} + , _VERSION_STRING = require('../package.json').version + , _DEFAULT_DELIMITER = '%' + , _DEFAULT_LOCALS_NAME = 'locals' + , _REGEX_STRING = '(<%%|<%=|<%-|<%#|<%|%>|-%>)' + , _OPTS = [ 'cache', 'filename', 'delimiter', 'scope', 'context' + , 'debug', 'compileDebug', 'client', '_with' + ] + , _TRAILING_SEMCOL = /;\s*$/; + +exports.localsName = _DEFAULT_LOCALS_NAME; + +exports.resolveInclude = function(name, filename) { + var path = require('path') + , dirname = path.dirname + , extname = path.extname + , resolve = path.resolve + , includePath = resolve(dirname(filename), name) + , ext = extname(name); + if (!ext) { + includePath += '.ejs'; + } + return includePath; +} + + +// Returns a possibly cached template function, set by options.cache. +// `template` is the string of EJS to compile. +// If template is undefined then the file specified in options.filename is +// read. +function handleCache(options, template) { + var fn + , path = options.filename + , hasTemplate = template !== undefined; + + if (options.cache) { + if (!path) { + throw new Error('cache option requires a filename'); + } + fn = jsCache[path]; + if (fn) { + return fn; + } + if (!hasTemplate) { + template = fs.readFileSync(path, {encoding: 'utf8'}); + } + } + else if (!hasTemplate) { + if (!path) { + throw new Error('Internal EJS error: no file name or template ' + + 'provided'); + } + template = fs.readFileSync(path, {encoding: 'utf8'}); + } + fn = exports.compile(template.trim(), options); + if (options.cache) { + jsCache[path] = fn; + } + return fn; +} + +function includeFile(path, options) { + var opts = utils.shallowCopy({}, options || /* istanbul ignore next */ {}); + if (!opts.filename) { + throw new Error('`include` requires the \'filename\' option.'); + } + opts.filename = exports.resolveInclude(path, opts.filename); + return handleCache(opts); +} + +function includeSource(path, options) { + var opts = utils.shallowCopy({}, options || {}) + , includePath + , template; + if (!opts.filename) { + throw new Error('`include` requires the \'filename\' option.'); + } + includePath = exports.resolveInclude(path, opts.filename); + template = fs.readFileSync(includePath).toString().trim(); + + opts.filename = includePath; + var templ = new Template(template, opts); + templ.generateSource(); + return templ.source; +} + +function rethrow(err, str, filename, lineno){ + var lines = str.split('\n') + , start = Math.max(lineno - 3, 0) + , end = Math.min(lines.length, lineno + 3); + + // Error context + var context = lines.slice(start, end).map(function (line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +function cpOptsInData(data, opts) { + _OPTS.forEach(function (p) { + if (typeof data[p] != 'undefined') { + opts[p] = data[p]; + } + }); + delete data.__expressRender__; +} + +function compile(template, opts) { + var templ; + + // v1 compat + // 'scope' is 'context' + // FIXME: Remove this in a future version + if (opts && opts.scope) { + if (!opts.context) { + opts.context = opts.scope; + } + delete opts.scope; + } + templ = new Template(template, opts); + return templ.compile(); +} +exports.compile = compile; + +// template, [data], [opts] +// Have to include an empty data object if you want opts and no data +exports.render = function (template, data, opts) { + data = data || {}; + opts = opts || {}; + var fn; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 2) { + cpOptsInData(data, opts); + } + + fn = handleCache(opts, template); + return fn.call(opts.context, data); +}; + +// path, [data], [opts], cb +// Have to include an empty data object if you want opts and no data +exports.renderFile = function () { + var args = Array.prototype.slice.call(arguments) + , path = args.shift() + , cb = args.pop() + , data = args.shift() || {} + , opts = args.pop() || {} + , result + , failed = false; + + // No options object -- if there are optiony names + // in the data, copy them to options + if (arguments.length == 3) { + cpOptsInData(data, opts); + } + opts.filename = path; + + try { + result = handleCache(opts)(data); + } + catch(err) { + return process.nextTick(function () { + cb(err); + }); + } + process.nextTick(function () { + cb(null, result); + }); +}; + +exports.clearCache = function () { + jsCache = {}; +}; + +function Template(text, opts) { + opts = opts || {}; + var options = {}; + this.templateText = text; + this.mode = null; + this.truncate = false; + this.currentLine = 1; + this.source = ''; + options.client = opts.client || false; + options.escapeFunction = opts.escape || utils.escapeXML; + options.compileDebug = opts.compileDebug !== false; + options.debug = !!opts.debug; + options.filename = opts.filename; + options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER; + options._with = typeof opts._with != 'undefined' ? opts._with : true; + options.cache = opts.cache || false; + this.opts = options; + + this.regex = this.createRegex(); +} + +Template.modes = { + EVAL: 'eval' + , ESCAPED: 'escaped' + , RAW: 'raw' + , COMMENT: 'comment' + , LITERAL: 'literal' +}; + +Template.prototype = new function () { + this.createRegex = function () { + var str = _REGEX_STRING + , delim = utils.escapeRegExpChars(this.opts.delimiter); + str = str.replace(/%/g, delim); + return new RegExp(str); + }; + + this.compile = function () { + var src + , fn + , opts = this.opts + , escape = opts.escapeFunction; + + if (!this.source) { + this.generateSource(); + var prepended = 'var __output = [];'; + if (opts._with !== false) { + prepended += ' with (' + exports.localsName + ' || {}) { '; + } + this.source = prepended + this.source; + if (opts._with !== false) { + this.source += '}'; + } + this.source += ';return __output.join("").trim();'; + } + + if (opts.compileDebug) { + src = 'var __line = 1' + + ', __lines = ' + JSON.stringify(this.templateText) + + ', __filename = ' + (opts.filename ? + JSON.stringify(opts.filename) : 'undefined') + + '; try {' + + this.source + '} catch (e) { rethrow(e, __lines, __filename, __line); }'; + } + else { + src = this.source; + } + + if (opts.debug) { + console.log(src); + } + + if (opts.client) { + if (escape !== utils.escapeXML) { + src = 'escape = escape || ' + escape.toString() + ';\n' + src; + } + else { + src = utils.escapeFuncStr + + 'escape = escape || ' + + escape.toString() + ';\n' + + src; + } + if (opts.compileDebug) { + src = 'rethrow = rethrow || ' + rethrow.toString() + ';\n' + src; + } + } + + try { + fn = new Function(exports.localsName + ', escape, include, rethrow', src); + } + catch(e) { + if (e instanceof SyntaxError) { + if (opts.filename) { + e.message += ' in ' + opts.filename; + } + e.message += ' while compiling ejs'; + throw e; + } + } + + if (opts.client) { + return fn; + } + + // Return a callable function which will execute the function + // created by the source-code, with the passed data as locals + return function (data) { + var include = function (path, includeData) { + var d = utils.shallowCopy({}, data); + if (includeData) { + d = utils.shallowCopy(d, includeData); + } + return includeFile(path, opts)(d); + }; + return fn(data || {}, escape, include, rethrow); + }; + + }; + + this.generateSource = function () { + var self = this + , matches = this.parseTemplateText() + , d = this.opts.delimiter; + + if (matches && matches.length) { + matches.forEach(function (line, index) { + var closing + , include + , includeOpts + , includeSrc; + // If this is an opening tag, check for closing tags + // FIXME: May end up with some false positives here + // Better to store modes as k/v with '<' + delimiter as key + // Then this can simply check against the map + if ( line.indexOf('<' + d) === 0 // If it is a tag + && line.indexOf('<' + d + d) !== 0) { // and is not escaped + closing = matches[index + 2]; + if (!(closing == d + '>' || closing == '-' + d + '>')) { + throw new Error('Could not find matching close tag for "' + line + '".'); + } + } + // HACK: backward-compat `include` preprocessor directives + if ((include = line.match(/^\s*include\s+(\S+)/))) { + includeOpts = utils.shallowCopy({}, self.opts); + includeSrc = includeSource(include[1], includeOpts); + includeSrc = ';(function(){' + includeSrc + '})();'; + self.source += includeSrc; + } + else { + self.scanLine(line); + } + }); + } + + }; + + this.parseTemplateText = function () { + var str = this.templateText + , pat = this.regex + , result = pat.exec(str) + , arr = [] + , firstPos + , lastPos; + + while (result) { + firstPos = result.index; + lastPos = pat.lastIndex; + + if (firstPos !== 0) { + arr.push(str.substring(0, firstPos)); + str = str.slice(firstPos); + } + + arr.push(result[0]); + str = str.slice(result[0].length); + result = pat.exec(str); + } + + if (str) { + arr.push(str); + } + + return arr; + }; + + this.scanLine = function (line) { + var self = this + , d = this.opts.delimiter + , newLineCount = 0; + + function _addOutput() { + if (self.truncate) { + line = line.replace('\n', ''); + } + + // Preserve literal slashes + line = line.replace(/\\/g, '\\\\'); + + // Convert linebreaks + line = line.replace(/\n/g, '\\n'); + line = line.replace(/\r/g, '\\r'); + + // Escape double-quotes + // - this will be the delimiter during execution + line = line.replace(/"/g, '\\"'); + self.source += ';__output.push("' + line + '");'; + } + + newLineCount = (line.split('\n').length - 1); + + switch (line) { + case '<' + d: + this.mode = Template.modes.EVAL; + break; + case '<' + d + '=': + this.mode = Template.modes.ESCAPED; + break; + case '<' + d + '-': + this.mode = Template.modes.RAW; + break; + case '<' + d + '#': + this.mode = Template.modes.COMMENT; + break; + case '<' + d + d: + this.mode = Template.modes.LITERAL; + this.source += ';__output.push("' + line.replace('<' + d + d, '<' + d) + '");'; + break; + case d + '>': + case '-' + d + '>': + if (this.mode == Template.modes.LITERAL) { + _addOutput(); + } + + this.mode = null; + this.truncate = line.indexOf('-') === 0; + break; + default: + // In script mode, depends on type of tag + if (this.mode) { + // If '//' is found without a line break, add a line break. + switch (this.mode) { + case Template.modes.EVAL: + case Template.modes.ESCAPED: + case Template.modes.RAW: + if (line.lastIndexOf('//') > line.lastIndexOf('\n')) { + line += '\n'; + } + } + switch (this.mode) { + // Just executing code + case Template.modes.EVAL: + this.source += ';' + line; + break; + // Exec, esc, and output + case Template.modes.ESCAPED: + // Add the exec'd, escaped result to the output + // Have to prevent the string-coercion of `undefined` and `null` + // in the `escape` function -- making a `join` call like below unnecessary + this.source += ';__output.push(escape(' + + line.replace(_TRAILING_SEMCOL, '').trim() + '))'; + break; + // Exec and output + case Template.modes.RAW: + // Add the exec'd result to the output + // Using `join` here prevents string-coercion of `undefined` and `null` + // without filtering out falsey values like zero + this.source += ';__output.push(' + + line.replace(_TRAILING_SEMCOL, '').trim() + ')'; + break; + case Template.modes.COMMENT: + // Do nothing + break; + // Literal <%% mode, append as raw output + case Template.modes.LITERAL: + _addOutput(); + break; + } + } + // In string mode, just add the output + else { + _addOutput(); + } + } + + if (self.opts.compileDebug && newLineCount) { + this.currentLine += newLineCount; + this.source += ';__line = ' + this.currentLine + ';'; + } + }; +}; + +// Express support +exports.__express = exports.renderFile; + +// Add require support +/* istanbul ignore else */ +if (require.extensions) { + require.extensions['.ejs'] = function (module, filename) { + filename = filename || /* istanbul ignore next */ module.filename; + var options = { + filename: filename + , client: true + } + , template = fs.readFileSync(filename).toString().trim() + , fn = compile(template, options); + module._compile('module.exports = ' + fn.toString() + ';', filename); + }; +} + +exports.VERSION = _VERSION_STRING; + +/* istanbul ignore if */ +if (typeof window != 'undefined') { + window.ejs = exports; +} diff --git a/dgbuilder/dgeflows/node_modules/ejs/lib/utils.js b/dgbuilder/dgeflows/node_modules/ejs/lib/utils.js new file mode 100644 index 00000000..fd826025 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/lib/utils.js @@ -0,0 +1,65 @@ +/* + * EJS Embedded JavaScript templates + * Copyright 2112 Matthew Eernisse (mde@fleegix.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +'use strict'; + +var regExpChars = /[|\\{}()[\]^$+*?.]/g; + +exports.escapeRegExpChars = function (string) { + // istanbul ignore if + if (!string) { + return ''; + } + return String(string).replace(regExpChars, '\\$&'); +}; + +var encodeHTMLRules = { + '&': '&' + , '<': '<' + , '>': '>' + , '"': '"' + , "'": ''' + } + , matchHTML = /[&<>\'"]/g; + +exports.escapeFuncStr = + 'var encodeHTMLRules = {' ++ '"&": "&"' ++ ', "<": "<"' ++ ', ">": ">"' ++ ', \'"\': """' ++ ', "\'": "'"' ++ '}' ++ ', matchHTML = /[&<>\'"]/g;'; + +exports.escapeXML = function (markup) { + return markup == undefined + ? '' + : String(markup) + .replace(matchHTML, function(m) { + return encodeHTMLRules[m] || m; + }); +}; + +exports.shallowCopy = function (to, from) { + for (var p in from) { + to[p] = from[p]; + } + return to; +}; + diff --git a/dgbuilder/dgeflows/node_modules/ejs/package.json b/dgbuilder/dgeflows/node_modules/ejs/package.json new file mode 100644 index 00000000..726a2ebb --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/package.json @@ -0,0 +1,72 @@ +{ + "name": "ejs", + "description": "Embedded JavaScript templates", + "keywords": [ + "template", + "engine", + "ejs" + ], + "version": "2.2.4", + "author": { + "name": "Matthew Eernisse", + "email": "mde@fleegix.org", + "url": "http://fleegix.org" + }, + "contributors": [ + { + "name": "Timothy Gu", + "email": "timothygu99@gmail.com", + "url": "https://timothygu.github.io" + } + ], + "license": "Apache-2.0", + "main": "./lib/ejs.js", + "repository": { + "type": "git", + "url": "git://github.com/mde/ejs.git" + }, + "bugs": { + "url": "https://github.com/mde/ejs/issues" + }, + "homepage": "https://github.com/mde/ejs", + "dependencies": {}, + "devDependencies": { + "browserify": "^8.0.3", + "uglify-js": "^2.4.16", + "mocha": "^2.1.0", + "jake": "^8.0.0", + "istanbul": "~0.3.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "coverage": "istanbul cover node_modules/mocha/bin/_mocha" + }, + "_id": "ejs@2.2.4", + "_shasum": "f0af7e366c13149dd7ae30106c0c0e1cad11903c", + "_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.2.4.tgz", + "_from": "ejs@~2.2.3", + "_npmVersion": "2.1.18", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "mde", + "email": "mde@fleegix.org" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "mde", + "email": "mde@fleegix.org" + } + ], + "dist": { + "shasum": "f0af7e366c13149dd7ae30106c0c0e1cad11903c", + "tarball": "http://registry.npmjs.org/ejs/-/ejs-2.2.4.tgz" + }, + "directories": {} +} diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/ejs.js b/dgbuilder/dgeflows/node_modules/ejs/test/ejs.js new file mode 100644 index 00000000..327e94ef --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/ejs.js @@ -0,0 +1,761 @@ +/* jshint mocha: true */ + +/** + * Module dependencies. + */ + +var ejs = require('..') + , fs = require('fs') + , read = fs.readFileSync + , assert = require('assert') + , path = require('path'); + +try { + fs.mkdirSync(__dirname + '/tmp'); +} catch (ex) { + if (ex.code !== 'EEXIST') { + throw ex; + } +} + +// From https://gist.github.com/pguillory/729616 +function hook_stdio(stream, callback) { + var old_write = stream.write; + + stream.write = (function() { + return function(string, encoding, fd) { + callback(string, encoding, fd); + }; + })(stream.write); + + return function() { + stream.write = old_write; + }; +} + +/** + * Load fixture `name`. + */ + +function fixture(name) { + return read('test/fixtures/' + name, 'utf8').replace(/\r/g, '').trim(); +} + +/** + * User fixtures. + */ + +var users = []; +users.push({name: 'geddy'}); +users.push({name: 'neil'}); +users.push({name: 'alex'}); + +suite('ejs.compile(str, options)', function () { + test('compile to a function', function () { + var fn = ejs.compile('<p>yay</p>'); + assert.equal(fn(), '<p>yay</p>'); + }); + + test('empty input works', function () { + var fn = ejs.compile(''); + assert.equal(fn(), ''); + }); + + test('throw if there are syntax errors', function () { + try { + ejs.compile(fixture('fail.ejs')); + } + catch (err) { + assert.ok(err.message.indexOf('compiling ejs') > -1); + + try { + ejs.compile(fixture('fail.ejs'), {filename: 'fail.ejs'}); + } + catch (err) { + assert.ok(err.message.indexOf('fail.ejs') > -1); + return; + } + } + throw new Error('no error reported when there should be'); + }); + + test('allow customizing delimiter local var', function () { + var fn; + fn = ejs.compile('<p><?= name ?></p>', {delimiter: '?'}); + assert.equal(fn({name: 'geddy'}), '<p>geddy</p>'); + + fn = ejs.compile('<p><:= name :></p>', {delimiter: ':'}); + assert.equal(fn({name: 'geddy'}), '<p>geddy</p>'); + + fn = ejs.compile('<p><$= name $></p>', {delimiter: '$'}); + assert.equal(fn({name: 'geddy'}), '<p>geddy</p>'); + }); + + test('default to using ejs.delimiter', function () { + var fn; + ejs.delimiter = '&'; + fn = ejs.compile('<p><&= name &></p>'); + assert.equal(fn({name: 'geddy'}), '<p>geddy</p>'); + + fn = ejs.compile('<p><|= name |></p>', {delimiter: '|'}); + assert.equal(fn({name: 'geddy'}), '<p>geddy</p>'); + delete ejs.delimiter; + }); + + test('have a working client option', function () { + var fn + , str + , preFn; + fn = ejs.compile('<p><%= foo %></p>', {client: true}); + str = fn.toString(); + if (!process.env.running_under_istanbul) { + eval('var preFn = ' + str); + assert.equal(preFn({foo: 'bar'}), '<p>bar</p>'); + } + }); + + test('support client mode without locals', function () { + var fn + , str + , preFn; + fn = ejs.compile('<p><%= "foo" %></p>', {client: true}); + str = fn.toString(); + if (!process.env.running_under_istanbul) { + eval('var preFn = ' + str); + assert.equal(preFn(), '<p>foo</p>'); + } + }); +}); + +suite('ejs.render(str, data)', function () { + test('render the template', function () { + assert.equal(ejs.render('<p>yay</p>'), '<p>yay</p>'); + }); + + test('empty input works', function () { + assert.equal(ejs.render(''), ''); + }); + + test('undefined renders nothing escaped', function () { + assert.equal(ejs.render('<%= undefined %>'), ''); + }); + + test('undefined renders nothing raw', function () { + assert.equal(ejs.render('<%- undefined %>'), ''); + }); + + test('null renders nothing escaped', function () { + assert.equal(ejs.render('<%= null %>'), ''); + }); + + test('null renders nothing raw', function () { + assert.equal(ejs.render('<%- null %>'), ''); + }); + + test('zero-value data item renders something escaped', function () { + assert.equal(ejs.render('<%= 0 %>'), '0'); + }); + + test('zero-value data object renders something raw', function () { + assert.equal(ejs.render('<%- 0 %>'), '0'); + }); + + test('accept locals', function () { + assert.equal(ejs.render('<p><%= name %></p>', {name: 'geddy'}), + '<p>geddy</p>'); + }); + + test('accept locals without using with() {}', function () { + assert.equal(ejs.render('<p><%= locals.name %></p>', {name: 'geddy'}, + {_with: false}), + '<p>geddy</p>'); + assert.throws(function() { + ejs.render('<p><%= name %></p>', {name: 'geddy'}, + {_with: false}); + }, /name is not defined/); + }); + + test('accept custom name for locals', function () { + ejs.localsName = 'it'; + assert.equal(ejs.render('<p><%= it.name %></p>', {name: 'geddy'}, + {_with: false}), + '<p>geddy</p>'); + assert.throws(function() { + ejs.render('<p><%= name %></p>', {name: 'geddy'}, + {_with: false}); + }, /name is not defined/); + ejs.localsName = 'locals'; + }); + + test('support caching (pass 1)', function () { + var file = __dirname + '/tmp/render.ejs' + , options = {cache: true, filename: file} + , out = ejs.render('<p>Old</p>', {}, options) + , expected = '<p>Old</p>'; + assert.equal(out, expected); + }); + + test('support caching (pass 2)', function () { + var file = __dirname + '/tmp/render.ejs' + , options = {cache: true, filename: file} + , out = ejs.render('<p>New</p>', {}, options) + , expected = '<p>Old</p>'; + assert.equal(out, expected); + }); +}); + +suite('ejs.renderFile(path, [data], [options], fn)', function () { + test('render a file', function(done) { + ejs.renderFile('test/fixtures/para.ejs', function(err, html) { + if (err) { + return done(err); + } + assert.equal(html, '<p>hey</p>'); + done(); + }); + }); + + test('callback is async', function(done) { + var async = false; + ejs.renderFile('test/fixtures/para.ejs', function(err, html) { + if (async) { + return done(); + } + throw new Error('not async'); + }); + async = true; + }); + + test('accept locals', function(done) { + var data = {name: 'fonebone'} + , options = {delimiter: '$'}; + ejs.renderFile('test/fixtures/user.ejs', data, options, function(err, html) { + if (err) { + return done(err); + } + assert.equal(html, '<h1>fonebone</h1>'); + done(); + }); + }); + + test('accept locals without using with() {}', function(done) { + var data = {name: 'fonebone'} + , options = {delimiter: '$', _with: false} + , doneCount = 0; + ejs.renderFile('test/fixtures/user-no-with.ejs', data, options, + function(err, html) { + if (err) { + if (doneCount === 2) { + return; + } + doneCount = 2; + return done(err); + } + assert.equal(html, '<h1>fonebone</h1>'); + doneCount++; + if (doneCount === 2) { + done(); + } + }); + ejs.renderFile('test/fixtures/user.ejs', data, options, function(err) { + if (!err) { + if (doneCount === 2) { + return; + } + doneCount = 2; + return done(new Error('error not thrown')); + } + doneCount++; + if (doneCount === 2) { + done(); + } + }); + }); + + test('not catch err thrown by callback', function(done) { + var data = {name: 'fonebone'} + , options = {delimiter: '$'} + , counter = 0; + + var d = require('domain').create(); + d.on('error', function (err) { + assert.equal(counter, 1); + assert.equal(err.message, 'Exception in callback'); + done(); + }); + d.run(function () { + // process.nextTick() needed to work around mochajs/mocha#513 + // + // tl;dr: mocha doesn't support synchronous exception throwing in + // domains. Have to make it async. Ticket closed because: "domains are + // deprecated :D" + process.nextTick(function () { + ejs.renderFile('test/fixtures/user.ejs', data, options, + function(err) { + counter++; + if (err) { + assert.notEqual(err.message, 'Exception in callback'); + return done(err); + } + throw new Error('Exception in callback'); + }); + }); + }); + }); + + test('support caching (pass 1)', function (done) { + var expected = '<p>Old</p>' + , file = __dirname + '/tmp/renderFile.ejs' + , options = {cache: true}; + fs.writeFileSync(file, '<p>Old</p>'); + + ejs.renderFile(file, {}, options, function (err, out) { + if (err) { + done(err); + } + assert.equal(out, expected); + done(); + }); + }); + + test('support caching (pass 2)', function (done) { + var expected = '<p>Old</p>' + , file = __dirname + '/tmp/renderFile.ejs' + , options = {cache: true}; + fs.writeFileSync(file, '<p>New</p>'); + + ejs.renderFile(file, {}, options, function (err, out) { + if (err) { + done(err); + } + assert.equal(out, expected); + done(); + }); + }); +}); + +suite('ejs.clearCache()', function () { + test('work properly', function () { + var expected = '<p>Old</p>' + , file = __dirname + '/tmp/clearCache.ejs' + , options = {cache: true, filename: file} + , out = ejs.render('<p>Old</p>', {}, options); + assert.equal(out, expected); + + ejs.clearCache(); + + expected = '<p>New</p>'; + out = ejs.render('<p>New</p>', {}, options); + assert.equal(out, expected); + }); +}); + +suite('<%', function () { + test('without semicolons', function () { + assert.equal(ejs.render(fixture('no.semicolons.ejs')), + fixture('no.semicolons.html')); + }); +}); + +suite('<%=', function () { + test('escape &<script>', function () { + assert.equal(ejs.render('<%= name %>', {name: ' <script>'}), + '&nbsp;<script>'); + }); + + test('should escape \'', function () { + assert.equal(ejs.render('<%= name %>', {name: 'The Jones\'s'}), + 'The Jones's'); + }); + + test('should escape &foo_bar;', function () { + assert.equal(ejs.render('<%= name %>', {name: '&foo_bar;'}), + '&foo_bar;'); + }); +}); + +suite('<%-', function () { + test('not escape', function () { + assert.equal(ejs.render('<%- name %>', {name: '<script>'}), + '<script>'); + }); + + test('terminate gracefully if no close tag is found', function () { + try { + ejs.compile('<h1>oops</h1><%- name ->'); + throw new Error('Expected parse failure'); + } + catch (err) { + assert.ok(err.message.indexOf('Could not find matching close tag for') > -1); + } + }); +}); + +suite('%>', function () { + test('produce newlines', function () { + assert.equal(ejs.render(fixture('newlines.ejs'), {users: users}), + fixture('newlines.html')); + }); + test('works with `-%>` interspersed', function () { + assert.equal(ejs.render(fixture('newlines.mixed.ejs'), {users: users}), + fixture('newlines.mixed.html')); + }); + test('consecutive tags work', function () { + assert.equal(ejs.render(fixture('consecutive-tags.ejs')), + fixture('consecutive-tags.html')); + }); +}); + +suite('-%>', function () { + test('not produce newlines', function () { + assert.equal(ejs.render(fixture('no.newlines.ejs'), {users: users}), + fixture('no.newlines.html')); + }); + test('stack traces work', function () { + try { + ejs.render(fixture('no.newlines.error.ejs')); + } + catch (e) { + if (e.message.indexOf('>> 4| <%= qdata %>') > -1) { + return; + } + throw e; + } + throw new Error('Expected ReferenceError'); + }); +}); + +suite('<%%', function () { + test('produce literals', function () { + assert.equal(ejs.render('<%%- "foo" %>'), + '<%- "foo" %>'); + }); + test('work without an end tag', function () { + assert.equal(ejs.render('<%%'), '<%'); + assert.equal(ejs.render(fixture('literal.ejs'), {}, {delimiter: ' '}), + fixture('literal.html')); + }); +}); + +suite('single quotes', function () { + test('not mess up the constructed function', function () { + assert.equal(ejs.render(fixture('single-quote.ejs')), + fixture('single-quote.html')); + }); +}); + +suite('double quotes', function () { + test('not mess up the constructed function', function () { + assert.equal(ejs.render(fixture('double-quote.ejs')), + fixture('double-quote.html')); + }); +}); + +suite('backslashes', function () { + test('escape', function () { + assert.equal(ejs.render(fixture('backslash.ejs')), + fixture('backslash.html')); + }); +}); + +suite('messed up whitespace', function () { + test('work', function () { + assert.equal(ejs.render(fixture('messed.ejs'), {users: users}), + fixture('messed.html')); + }); +}); + +suite('exceptions', function () { + test('produce useful stack traces', function () { + try { + ejs.render(fixture('error.ejs'), {}, {filename: 'error.ejs'}); + } + catch (err) { + assert.equal(err.path, 'error.ejs'); + assert.equal(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out')); + return; + } + throw new Error('no error reported when there should be'); + }); + + test('not include fancy stack info if compileDebug is false', function () { + try { + ejs.render(fixture('error.ejs'), {}, { + filename: 'error.ejs', + compileDebug: false + }); + } + catch (err) { + assert.ok(!err.path); + assert.notEqual(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out')); + return; + } + throw new Error('no error reported when there should be'); + }); + + var unhook = null; + test('log JS source when debug is set', function (done) { + var out = '' + , needToExit = false; + unhook = hook_stdio(process.stdout, function (str) { + out += str; + if (needToExit) { + return; + } + if (out.indexOf('__output')) { + needToExit = true; + unhook(); + unhook = null; + return done(); + } + }); + ejs.render(fixture('hello-world.ejs'), {}, {debug: true}); + }); + teardown(function() { + if (!unhook) { + return; + } + unhook(); + unhook = null; + }); +}); + +suite('include()', function () { + test('include ejs', function () { + var file = 'test/fixtures/include-simple.ejs'; + assert.equal(ejs.render(fixture('include-simple.ejs'), {}, {filename: file}), + fixture('include-simple.html')); + }); + + test('include ejs fails without `filename`', function () { + try { + ejs.render(fixture('include-simple.ejs')); + } + catch (err) { + assert.ok(err.message.indexOf('requires the \'filename\' option') > -1); + return; + } + throw new Error('expected inclusion error'); + }); + + test('strips BOM', function () { + assert.equal( + ejs.render('<%- include("fixtures/includes/bom.ejs") %>', + {}, {filename: path.join(__dirname, 'f.ejs')}), + '<p>This is a file with BOM.</p>'); + }); + + test('include ejs with locals', function () { + var file = 'test/fixtures/include.ejs'; + assert.equal(ejs.render(fixture('include.ejs'), {pets: users}, {filename: file, delimiter: '@'}), + fixture('include.html')); + }); + + test('include ejs with absolute path and locals', function () { + var file = 'test/fixtures/include-abspath.ejs'; + assert.equal(ejs.render(fixture('include-abspath.ejs'), + {dir: path.join(__dirname, 'fixtures'), pets: users, path: path}, + {filename: file, delimiter: '@'}), + fixture('include.html')); + }); + + test('work when nested', function () { + var file = 'test/fixtures/menu.ejs'; + assert.equal(ejs.render(fixture('menu.ejs'), {pets: users}, {filename: file}), + fixture('menu.html')); + }); + + test('work with a variable path', function () { + var file = 'test/fixtures/menu_var.ejs', + includePath = 'includes/menu-item'; + assert.equal(ejs.render(fixture('menu.ejs'), {pets: users, varPath: includePath}, {filename: file}), + fixture('menu.html')); + }); + + test('include arbitrary files as-is', function () { + var file = 'test/fixtures/include.css.ejs'; + assert.equal(ejs.render(fixture('include.css.ejs'), {pets: users}, {filename: file}), + fixture('include.css.html')); + }); + + test('pass compileDebug to include', function () { + var file = 'test/fixtures/include.ejs' + , fn; + fn = ejs.compile(fixture('include.ejs'), { + filename: file + , delimiter: '@' + , compileDebug: false + }); + try { + // Render without a required variable reference + fn({foo: 'asdf'}); + } + catch(e) { + assert.equal(e.message, 'pets is not defined'); + assert.ok(!e.path); + return; + } + throw new Error('no error reported when there should be'); + }); + + test('is dynamic', function () { + fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>'); + var file = 'test/fixtures/include_cache.ejs' + , options = {filename: file} + , out = ejs.compile(fixture('include_cache.ejs'), options); + assert.equal(out(), '<p>Old</p>'); + + fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>'); + assert.equal(out(), '<p>New</p>'); + }); + + test('support caching (pass 1)', function () { + fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>'); + var file = 'test/fixtures/include_cache.ejs' + , options = {cache: true, filename: file} + , out = ejs.render(fixture('include_cache.ejs'), {}, options) + , expected = fixture('include_cache.html'); + assert.equal(out, expected); + }); + + test('support caching (pass 2)', function () { + fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>'); + var file = 'test/fixtures/include_cache.ejs' + , options = {cache: true, filename: file} + , out = ejs.render(fixture('include_cache.ejs'), {}, options) + , expected = fixture('include_cache.html'); + assert.equal(out, expected); + }); +}); + +suite('preprocessor include', function () { + test('work', function () { + var file = 'test/fixtures/include_preprocessor.ejs'; + assert.equal(ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {filename: file, delimiter: '@'}), + fixture('include_preprocessor.html')); + }); + + test('fails without `filename`', function () { + try { + ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {delimiter: '@'}); + } + catch (err) { + assert.ok(err.message.indexOf('requires the \'filename\' option') > -1); + return; + } + throw new Error('expected inclusion error'); + }); + + test('strips BOM', function () { + assert.equal( + ejs.render('<% include fixtures/includes/bom.ejs %>', + {}, {filename: path.join(__dirname, 'f.ejs')}), + '<p>This is a file with BOM.</p>'); + }); + + test('work when nested', function () { + var file = 'test/fixtures/menu_preprocessor.ejs'; + assert.equal(ejs.render(fixture('menu_preprocessor.ejs'), {pets: users}, {filename: file}), + fixture('menu_preprocessor.html')); + }); + + test('include arbitrary files as-is', function () { + var file = 'test/fixtures/include_preprocessor.css.ejs'; + assert.equal(ejs.render(fixture('include_preprocessor.css.ejs'), {pets: users}, {filename: file}), + fixture('include_preprocessor.css.html')); + }); + + test('pass compileDebug to include', function () { + var file = 'test/fixtures/include_preprocessor.ejs' + , fn; + fn = ejs.compile(fixture('include_preprocessor.ejs'), { + filename: file + , delimiter: '@' + , compileDebug: false + }); + try { + // Render without a required variable reference + fn({foo: 'asdf'}); + } + catch(e) { + assert.equal(e.message, 'pets is not defined'); + assert.ok(!e.path); + return; + } + throw new Error('no error reported when there should be'); + }); + + test('is static', function () { + fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>'); + var file = 'test/fixtures/include_preprocessor_cache.ejs' + , options = {filename: file} + , out = ejs.compile(fixture('include_preprocessor_cache.ejs'), options); + assert.equal(out(), '<p>Old</p>'); + + fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>'); + assert.equal(out(), '<p>Old</p>'); + }); + + test('support caching (pass 1)', function () { + fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>'); + var file = 'test/fixtures/include_preprocessor_cache.ejs' + , options = {cache: true, filename: file} + , out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options) + , expected = fixture('include_preprocessor_cache.html'); + assert.equal(out, expected); + }); + + test('support caching (pass 2)', function () { + fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>'); + var file = 'test/fixtures/include_preprocessor_cache.ejs' + , options = {cache: true, filename: file} + , out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options) + , expected = fixture('include_preprocessor_cache.html'); + assert.equal(out, expected); + }); +}); + +suite('comments', function () { + test('fully render with comments removed', function () { + assert.equal(ejs.render(fixture('comments.ejs')), + fixture('comments.html')); + }); +}); + +suite('require', function () { + + // Only works with inline/preprocessor includes + test('allow ejs templates to be required as node modules', function () { + var file = 'test/fixtures/include_preprocessor.ejs' + , template = require(__dirname + '/fixtures/menu_preprocessor.ejs'); + if (!process.env.running_under_istanbul) { + assert.equal(template({filename: file, pets: users}), + fixture('menu_preprocessor.html')); + } + }); +}); + +suite('examples', function () { + function noop () {} + fs.readdirSync('examples').forEach(function (f) { + if (!/\.js$/.test(f)) { + return; + } + suite(f, function () { + test('doesn\'t throw any errors', function () { + var stderr = hook_stdio(process.stderr, noop) + , stdout = hook_stdio(process.stdout, noop); + try { + require('../examples/' + f); + } + catch (ex) { + stdout(); + stderr(); + throw ex; + } + stdout(); + stderr(); + }); + }); + }); +}); diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.ejs new file mode 100644 index 00000000..eeb4a482 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.ejs @@ -0,0 +1 @@ +\foo
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.html new file mode 100644 index 00000000..eeb4a482 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/backslash.html @@ -0,0 +1 @@ +\foo
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.ejs new file mode 100644 index 00000000..48ece707 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.ejs @@ -0,0 +1,7 @@ +<li><a href="foo"><% // double-slash comment %>foo</li> +<li><a href="bar"><% /* C-style comment */ %>bar</li> +<li><a href="baz"><% // double-slash comment with newline + %>baz</li> +<li><a href="qux"><% var x = 'qux'; // double-slash comment @ end of line %><%= x %></li> +<li><a href="fee"><%# ERB style comment %>fee</li> +<li><a href="bah"><%= 'not a ' + '//' + ' comment' %></a></li> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.html new file mode 100644 index 00000000..5a986829 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/comments.html @@ -0,0 +1,6 @@ +<li><a href="foo">foo</li> +<li><a href="bar">bar</li> +<li><a href="baz">baz</li> +<li><a href="qux">qux</li> +<li><a href="fee">fee</li> +<li><a href="bah">not a // comment</a></li>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.ejs new file mode 100644 index 00000000..175f5c3a --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.ejs @@ -0,0 +1 @@ +<% var a = 'foo' %><% var b = 'bar' %><%= a %> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.html new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/consecutive-tags.html @@ -0,0 +1 @@ +foo diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.ejs new file mode 100644 index 00000000..3bccdcfd --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.ejs @@ -0,0 +1 @@ +<p><%= "lo" + 'ki' %>'s "wheelchair"</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.html new file mode 100644 index 00000000..64739798 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/double-quote.html @@ -0,0 +1 @@ +<p>loki's "wheelchair"</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.ejs new file mode 100644 index 00000000..f032730b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.ejs @@ -0,0 +1,5 @@ +<ul> + <% if (users) { %> + <p>Has users</p> + <% } %> +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.out b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.out new file mode 100644 index 00000000..a2c91082 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/error.out @@ -0,0 +1,8 @@ +ReferenceError: error.ejs:2 + 1| <ul> + >> 2| <% if (users) { %> + 3| <p>Has users</p> + 4| <% } %> + 5| </ul> + +users is not defined
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/fail.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/fail.ejs new file mode 100644 index 00000000..1a7a0f7d --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/fail.ejs @@ -0,0 +1 @@ +<% function foo() return 'foo'; %>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/hello-world.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/hello-world.ejs new file mode 100644 index 00000000..e2e353ea --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/hello-world.ejs @@ -0,0 +1 @@ +<p>Hello world!</p> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-abspath.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-abspath.ejs new file mode 100644 index 00000000..26b0522d --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-abspath.ejs @@ -0,0 +1,5 @@ +<ul> + <@ pets.forEach(function(pet){ @> + <@- include(path.join(dir, 'pet'), {pet: pet}); @> + <@ }); @> +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.ejs new file mode 100644 index 00000000..a874878d --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.ejs @@ -0,0 +1,3 @@ +<ul> + <%- include('hello-world'); %> +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.html new file mode 100644 index 00000000..3b729efb --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include-simple.html @@ -0,0 +1,3 @@ +<ul> + <p>Hello world!</p> +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.ejs new file mode 100644 index 00000000..cd184b41 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.ejs @@ -0,0 +1 @@ +<style><%- include('style.css', {value: 'bar'}); %></style> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.html new file mode 100644 index 00000000..43343fef --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.css.html @@ -0,0 +1,3 @@ +<style>body { + foo: 'bar'; +}</style>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.ejs new file mode 100644 index 00000000..f2295ee1 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.ejs @@ -0,0 +1,5 @@ +<ul> + <@ pets.forEach(function(pet){ @> + <@- include('pet', {pet: pet}); @> + <@ }); @> +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.html new file mode 100644 index 00000000..4557edb6 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include.html @@ -0,0 +1,9 @@ +<ul> + + <li>geddy</li> + + <li>neil</li> + + <li>alex</li> + +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.ejs new file mode 100644 index 00000000..439193cb --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.ejs @@ -0,0 +1 @@ +<%- include('../tmp/include') %> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.html new file mode 100644 index 00000000..be20e58b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_cache.html @@ -0,0 +1 @@ +<p>Old</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.ejs new file mode 100644 index 00000000..f47358bd --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.ejs @@ -0,0 +1 @@ +<style><% var value = 'bar' %><% include style.css %></style>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.html new file mode 100644 index 00000000..43343fef --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.css.html @@ -0,0 +1,3 @@ +<style>body { + foo: 'bar'; +}</style>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.ejs new file mode 100644 index 00000000..f2728c52 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.ejs @@ -0,0 +1,5 @@ +<ul> + <@ pets.forEach(function(pet){ @> + <@ include pet @> + <@ }) @> +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.html new file mode 100644 index 00000000..4557edb6 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor.html @@ -0,0 +1,9 @@ +<ul> + + <li>geddy</li> + + <li>neil</li> + + <li>alex</li> + +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs new file mode 100644 index 00000000..ae609231 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs @@ -0,0 +1 @@ +<%- include ../tmp/include_preprocessor %> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.html new file mode 100644 index 00000000..be20e58b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/include_preprocessor_cache.html @@ -0,0 +1 @@ +<p>Old</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/bom.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/bom.ejs new file mode 100644 index 00000000..cc198baa --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/bom.ejs @@ -0,0 +1 @@ +<p>This is a file with BOM.</p> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu-item.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu-item.ejs new file mode 100644 index 00000000..37cca5f9 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu-item.ejs @@ -0,0 +1 @@ +<li><% include menu/item %></li>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu/item.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu/item.ejs new file mode 100644 index 00000000..8abc3fe4 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/includes/menu/item.ejs @@ -0,0 +1 @@ +<a href="/<%= url %>"><%= title %></a>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.ejs new file mode 100644 index 00000000..9f6bf81e --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.ejs @@ -0,0 +1,3 @@ +<pre>There should be a space followed by a less-than sign and then two more +spaces in the next line: + < .</pre> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.html new file mode 100644 index 00000000..d9922500 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/literal.html @@ -0,0 +1,3 @@ +<pre>There should be a space followed by a less-than sign and then two more +spaces in the next line: + < .</pre>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.ejs new file mode 100644 index 00000000..03099901 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.ejs @@ -0,0 +1,15 @@ +<%- include('includes/menu-item', { + url: '/foo' +, title: 'Foo' +}); -%> + +<%- include('includes/menu-item', { + url: '/bar' +, title: 'Bar' +}); -%> + +<%- include('includes/menu-item', { + url: '/baz' +, title: 'Baz' +}); -%> + diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.html new file mode 100644 index 00000000..1f9e45fd --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu.html @@ -0,0 +1,3 @@ +<li><a href="//foo">Foo</a></li> +<li><a href="//bar">Bar</a></li> +<li><a href="//baz">Baz</a></li>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.ejs new file mode 100644 index 00000000..61fad418 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.ejs @@ -0,0 +1,11 @@ +<% var url = '/foo' -%> +<% var title = 'Foo' -%> +<% include includes/menu-item -%> + +<% var url = '/bar' -%> +<% var title = 'Bar' -%> +<% include includes/menu-item -%> + +<% var url = '/baz' -%> +<% var title = 'Baz' -%> +<% include includes/menu-item -%>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.html new file mode 100644 index 00000000..1f9e45fd --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_preprocessor.html @@ -0,0 +1,3 @@ +<li><a href="//foo">Foo</a></li> +<li><a href="//bar">Bar</a></li> +<li><a href="//baz">Baz</a></li>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_var.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_var.ejs new file mode 100644 index 00000000..a421dcb8 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/menu_var.ejs @@ -0,0 +1,15 @@ +<%- include(varPath, { + url: '/foo' +, title: 'Foo' +}); -%> + +<%- include(varPath, { + url: '/bar' +, title: 'Bar' +}); -%> + +<%- include(varPath, { + url: '/baz' +, title: 'Baz' +}); -%> + diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.ejs new file mode 100644 index 00000000..7d690331 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.ejs @@ -0,0 +1 @@ +<ul><%users.forEach(function(user){%><li><%=user.name%></li><%})%></ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.html new file mode 100644 index 00000000..52d35629 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/messed.html @@ -0,0 +1 @@ +<ul><li>geddy</li><li>neil</li><li>alex</li></ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.ejs new file mode 100644 index 00000000..47401b26 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.ejs @@ -0,0 +1,5 @@ +<ul> + <% users.forEach(function(user){ %> + <li><%= user.name %></li> + <% }) %> +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.html new file mode 100644 index 00000000..4557edb6 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.html @@ -0,0 +1,9 @@ +<ul> + + <li>geddy</li> + + <li>neil</li> + + <li>alex</li> + +</ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.ejs new file mode 100644 index 00000000..bdf21333 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.ejs @@ -0,0 +1,6 @@ +<ul> + <% var unused1 = 'blah' -%> + <% var unused2 = 'bleh' %> + <% var unused3 = 'bloh' -%> + <% var unused4 = 'bluh' %> +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.html new file mode 100644 index 00000000..6d8a2f58 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/newlines.mixed.html @@ -0,0 +1,4 @@ +<ul> + + +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.ejs new file mode 100644 index 00000000..029b4618 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.ejs @@ -0,0 +1,5 @@ +<ul> + <% users.forEach(function(user){ -%> + <li><%= user.name %></li> + <% }) -%> +</ul>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.error.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.error.ejs new file mode 100644 index 00000000..5749686b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.error.ejs @@ -0,0 +1,5 @@ +AAA +<% data = "test"; -%> +BBB +<%= qdata %> +CCC
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.html new file mode 100644 index 00000000..22857002 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.newlines.html @@ -0,0 +1,5 @@ +<ul> + <li>geddy</li> + <li>neil</li> + <li>alex</li> + </ul> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.ejs new file mode 100644 index 00000000..d5831347 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.ejs @@ -0,0 +1,8 @@ +This document does not use semicolons in scriptlets. +<% + var a = 'b' + var b = 'c' + var c + c = b +%> +The value of c is: <%= c %> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.html new file mode 100644 index 00000000..25392983 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/no.semicolons.html @@ -0,0 +1,3 @@ +This document does not use semicolons in scriptlets. + +The value of c is: c
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/para.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/para.ejs new file mode 100644 index 00000000..89da779f --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/para.ejs @@ -0,0 +1 @@ +<p>hey</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/pet.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/pet.ejs new file mode 100644 index 00000000..09dd230b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/pet.ejs @@ -0,0 +1 @@ +<li><@= pet.name @></li> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.ejs new file mode 100644 index 00000000..1e35a95b --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.ejs @@ -0,0 +1 @@ +<p><%= 'loki' %>'s wheelchair</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.html b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.html new file mode 100644 index 00000000..3125173d --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/single-quote.html @@ -0,0 +1 @@ +<p>loki's wheelchair</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/style.css b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/style.css new file mode 100644 index 00000000..f9c16e68 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/style.css @@ -0,0 +1,3 @@ +body { + foo: '<%= value %>'; +} diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user-no-with.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user-no-with.ejs new file mode 100644 index 00000000..1822e24a --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user-no-with.ejs @@ -0,0 +1 @@ +<h1><$= locals.name $></h1> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user.ejs new file mode 100644 index 00000000..66f9adcb --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/fixtures/user.ejs @@ -0,0 +1 @@ +<h1><$= name $></h1> diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/mocha.opts b/dgbuilder/dgeflows/node_modules/ejs/test/mocha.opts new file mode 100644 index 00000000..68d4dd74 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/mocha.opts @@ -0,0 +1,2 @@ +--ui tdd +--reporter spec diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include.ejs new file mode 100644 index 00000000..595b6c05 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include.ejs @@ -0,0 +1 @@ +<p>New</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include_preprocessor.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include_preprocessor.ejs new file mode 100644 index 00000000..595b6c05 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/include_preprocessor.ejs @@ -0,0 +1 @@ +<p>New</p>
\ No newline at end of file diff --git a/dgbuilder/dgeflows/node_modules/ejs/test/tmp/renderFile.ejs b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/renderFile.ejs new file mode 100644 index 00000000..595b6c05 --- /dev/null +++ b/dgbuilder/dgeflows/node_modules/ejs/test/tmp/renderFile.ejs @@ -0,0 +1 @@ +<p>New</p>
\ No newline at end of file |