This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

45
node_modules/pug-runtime/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,45 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.0.2
### Changed
- `require('fs')` calls will now be ignored by browser bundlers, through using
`browser` field in `package.json`. Fallbacks for cases where `fs` module is
not available were already in place prior to this release.
## 2.0.1
### Changed
- This package has been renamed to pug-runtime.
- `attrs()` has been optimized.
## 2.0.0
### Changed
- `classes()` has been optimized, making it more than 9x faster.
- `style()` has been optimized, making it 3-9x faster in average cases.
- `escape()` has been optimized again, now with another 1-4x boost from the
last release.
- `attrs()`, `attr()`, and `merge()` also got some minor improvements.
Although not benchmarked, we expect the new versions to perform better than
last release.
### Deprecated
- Internal variables, or variables or functions that were not exported but
visible through `require('pug-runtime/build')`, will not be visible through
`require('pug-runtime/build')` anymore.
- `pug_encode_html_rules` and `pug_encode_char`, two internal variables, have
now been removed. Please note that any further changes to these internal
variables will not come with a major bump.
### Added
- A new module `require('pug-runtime/wrap')` is added to ease testing
client-side templates.
## 1.1.0 - 2015-07-09
### Changed
- `escape()` has been optimized, making it about 20-30% faster. The new
implementation is inspired by the one from EJS.
## 1.0.0 - 2014-12-28
### Added
- Initial release

19
node_modules/pug-runtime/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2014 Forbes Lindesay
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.

68
node_modules/pug-runtime/README.md generated vendored Normal file
View File

@ -0,0 +1,68 @@
# pug-runtime
The runtime components for the pug templating language
[![Build Status](https://img.shields.io/travis/pugjs/pug-runtime/master.svg)](https://travis-ci.org/pugjs/pug-runtime)
[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-runtime)](https://david-dm.org/pugjs/pug?path=packages/pug-runtime)
[![DevDependencies Status](https://david-dm.org/pugjs/pug/dev-status.svg?path=packages/pug-runtime)](https://david-dm.org/pugjs/pug?path=packages/pug-runtime&type=dev)
[![NPM version](https://img.shields.io/npm/v/pug-runtime.svg)](https://www.npmjs.org/package/pug-runtime)
## Installation
npm install pug-runtime
## Usage
You can call runtime methods directly using `runtime.method`. This is particularly useful when compiling to deal with things that are already known at compile time.
```js
var runtime = require('pug-runtime');
assert(runtime.attr('foo', 'bar', true, true) === ' foo="bar"');
```
You can also build a string with a given list of functions available as `pug_method` by calling `build(arrayOfMethods)`. This is useful for inlining runtime functions within the compiled templates.
```js
var build = require('pug-runtime/build');
var src = build(['attr']);
var attr = Function('', src + ';return pug_attr;')();
assert(attr('foo', 'bar', true, true) === ' foo="bar"');
```
When testing code compiled for the browser in Node.js, it is necessary to make the runtime available. To do so, one can use `require('pug-runtime/wrap')`:
```js
var pug = require('pug');
var wrap = require('pug-runtime/wrap');
var pugSrc = 'p= content';
// By default compileClient automatically embeds the needed runtime functions,
// rendering this module useless.
var compiledCode = pug.compileClient(pugSrc, {
externalRuntime: true
});
//=> 'function template (locals) { ... pug.escape() ... }'
var templateFunc = wrap(compiledCode);
templateFunc({content: 'Hey!'});
//=> '<p>Hey!</p>'
// Change template function name to 'heyTemplate'
compiledCode = pug.compileClient(pugSrc, {
externalRuntime: true,
name: 'heyTemplate'
});
//=> 'function heyTemplate (locals) { ... }'
templateFunc = wrap(compiledCode, 'heyTemplate');
templateFunc({content: 'Hey!'});
//=> '<p>Hey!</p>'
```
## License
MIT

24
node_modules/pug-runtime/build.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
'use strict';
var fs = require('fs');
var dependencies = require('./lib/dependencies.js');
var internals = require('./lib/internals.js');
var sources = require('./lib/sources.js');
module.exports = build;
function build(functions) {
var fns = [];
functions = functions.filter(function (fn) {
return !internals[fn];
});
for (var i = 0; i < functions.length; i++) {
if (fns.indexOf(functions[i]) === -1) {
fns.push(functions[i]);
functions.push.apply(functions, dependencies[functions[i]]);
}
}
return fns.sort().map(function (name) {
return sources[name];
}).join('\n');
}

254
node_modules/pug-runtime/index.js generated vendored Normal file
View File

@ -0,0 +1,254 @@
'use strict';
var pug_has_own_property = Object.prototype.hasOwnProperty;
/**
* Merge two attribute objects giving precedence
* to values in object `b`. Classes are special-cased
* allowing for arrays and merging/joining appropriately
* resulting in a string.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api private
*/
exports.merge = pug_merge;
function pug_merge(a, b) {
if (arguments.length === 1) {
var attrs = a[0];
for (var i = 1; i < a.length; i++) {
attrs = pug_merge(attrs, a[i]);
}
return attrs;
}
for (var key in b) {
if (key === 'class') {
var valA = a[key] || [];
a[key] = (Array.isArray(valA) ? valA : [valA]).concat(b[key] || []);
} else if (key === 'style') {
var valA = pug_style(a[key]);
valA = valA && valA[valA.length - 1] !== ';' ? valA + ';' : valA;
var valB = pug_style(b[key]);
valB = valB && valB[valB.length - 1] !== ';' ? valB + ';' : valB;
a[key] = valA + valB;
} else {
a[key] = b[key];
}
}
return a;
};
/**
* Process array, object, or string as a string of classes delimited by a space.
*
* If `val` is an array, all members of it and its subarrays are counted as
* classes. If `escaping` is an array, then whether or not the item in `val` is
* escaped depends on the corresponding item in `escaping`. If `escaping` is
* not an array, no escaping is done.
*
* If `val` is an object, all the keys whose value is truthy are counted as
* classes. No escaping is done.
*
* If `val` is a string, it is counted as a class. No escaping is done.
*
* @param {(Array.<string>|Object.<string, boolean>|string)} val
* @param {?Array.<string>} escaping
* @return {String}
*/
exports.classes = pug_classes;
function pug_classes_array(val, escaping) {
var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping);
for (var i = 0; i < val.length; i++) {
className = pug_classes(val[i]);
if (!className) continue;
escapeEnabled && escaping[i] && (className = pug_escape(className));
classString = classString + padding + className;
padding = ' ';
}
return classString;
}
function pug_classes_object(val) {
var classString = '', padding = '';
for (var key in val) {
if (key && val[key] && pug_has_own_property.call(val, key)) {
classString = classString + padding + key;
padding = ' ';
}
}
return classString;
}
function pug_classes(val, escaping) {
if (Array.isArray(val)) {
return pug_classes_array(val, escaping);
} else if (val && typeof val === 'object') {
return pug_classes_object(val);
} else {
return val || '';
}
}
/**
* Convert object or string to a string of CSS styles delimited by a semicolon.
*
* @param {(Object.<string, string>|string)} val
* @return {String}
*/
exports.style = pug_style;
function pug_style(val) {
if (!val) return '';
if (typeof val === 'object') {
var out = '';
for (var style in val) {
/* istanbul ignore else */
if (pug_has_own_property.call(val, style)) {
out = out + style + ':' + val[style] + ';';
}
}
return out;
} else {
return val + '';
}
};
/**
* Render the given attribute.
*
* @param {String} key
* @param {String} val
* @param {Boolean} escaped
* @param {Boolean} terse
* @return {String}
*/
exports.attr = pug_attr;
function pug_attr(key, val, escaped, terse) {
if (val === false || val == null || !val && (key === 'class' || key === 'style')) {
return '';
}
if (val === true) {
return ' ' + (terse ? key : key + '="' + key + '"');
}
var type = typeof val;
if ((type === 'object' || type === 'function') && typeof val.toJSON === 'function') {
val = val.toJSON();
}
if (typeof val !== 'string') {
val = JSON.stringify(val);
if (!escaped && val.indexOf('"') !== -1) {
return ' ' + key + '=\'' + val.replace(/'/g, '&#39;') + '\'';
}
}
if (escaped) val = pug_escape(val);
return ' ' + key + '="' + val + '"';
};
/**
* Render the given attributes object.
*
* @param {Object} obj
* @param {Object} terse whether to use HTML5 terse boolean attributes
* @return {String}
*/
exports.attrs = pug_attrs;
function pug_attrs(obj, terse){
var attrs = '';
for (var key in obj) {
if (pug_has_own_property.call(obj, key)) {
var val = obj[key];
if ('class' === key) {
val = pug_classes(val);
attrs = pug_attr(key, val, false, terse) + attrs;
continue;
}
if ('style' === key) {
val = pug_style(val);
}
attrs += pug_attr(key, val, false, terse);
}
}
return attrs;
};
/**
* Escape the given string of `html`.
*
* @param {String} html
* @return {String}
* @api private
*/
var pug_match_html = /["&<>]/;
exports.escape = pug_escape;
function pug_escape(_html){
var html = '' + _html;
var regexResult = pug_match_html.exec(html);
if (!regexResult) return _html;
var result = '';
var i, lastIndex, escape;
for (i = regexResult.index, lastIndex = 0; i < html.length; i++) {
switch (html.charCodeAt(i)) {
case 34: escape = '&quot;'; break;
case 38: escape = '&amp;'; break;
case 60: escape = '&lt;'; break;
case 62: escape = '&gt;'; break;
default: continue;
}
if (lastIndex !== i) result += html.substring(lastIndex, i);
lastIndex = i + 1;
result += escape;
}
if (lastIndex !== i) return result + html.substring(lastIndex, i);
else return result;
};
/**
* Re-throw the given `err` in context to the
* the pug in `filename` at the given `lineno`.
*
* @param {Error} err
* @param {String} filename
* @param {String} lineno
* @param {String} str original source
* @api private
*/
exports.rethrow = pug_rethrow;
function pug_rethrow(err, filename, lineno, str){
if (!(err instanceof Error)) throw err;
if ((typeof window != 'undefined' || !filename) && !str) {
err.message += ' on line ' + lineno;
throw err;
}
try {
str = str || require('fs').readFileSync(filename, 'utf8')
} catch (ex) {
pug_rethrow(err, null, lineno)
}
var context = 3
, lines = str.split('\n')
, start = Math.max(lineno - context, 0)
, end = Math.min(lines.length, lineno + context);
// 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 || 'Pug') + ':' + lineno
+ '\n' + context + '\n\n' + err.message;
throw err;
};

34
node_modules/pug-runtime/lib/dependencies.js generated vendored Normal file
View File

@ -0,0 +1,34 @@
module.exports = {
"has_own_property": [],
"merge": [
"style"
],
"classes_array": [
"classes",
"escape"
],
"classes_object": [
"has_own_property"
],
"classes": [
"classes_array",
"classes_object"
],
"style": [
"has_own_property"
],
"attr": [
"escape"
],
"attrs": [
"attr",
"classes",
"has_own_property",
"style"
],
"match_html": [],
"escape": [
"match_html"
],
"rethrow": []
}

8
node_modules/pug-runtime/lib/internals.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
"dependencies": true,
"internals": true,
"has_own_property": true,
"classes_array": true,
"classes_object": true,
"match_html": true
}

13
node_modules/pug-runtime/lib/sources.js generated vendored Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
"has_own_property": "var pug_has_own_property=Object.prototype.hasOwnProperty;",
"merge": "function pug_merge(e,r){if(1===arguments.length){for(var t=e[0],g=1;g<e.length;g++)t=pug_merge(t,e[g]);return t}for(var l in r)if(\"class\"===l){var n=e[l]||[];e[l]=(Array.isArray(n)?n:[n]).concat(r[l]||[])}else if(\"style\"===l){var n=pug_style(e[l]);n=n&&\";\"!==n[n.length-1]?n+\";\":n;var a=pug_style(r[l]);a=a&&\";\"!==a[a.length-1]?a+\";\":a,e[l]=n+a}else e[l]=r[l];return e}",
"classes_array": "function pug_classes_array(r,a){for(var s,e=\"\",u=\"\",c=Array.isArray(a),g=0;g<r.length;g++)(s=pug_classes(r[g]))&&(c&&a[g]&&(s=pug_escape(s)),e=e+u+s,u=\" \");return e}",
"classes_object": "function pug_classes_object(r){var a=\"\",n=\"\";for(var o in r)o&&r[o]&&pug_has_own_property.call(r,o)&&(a=a+n+o,n=\" \");return a}",
"classes": "function pug_classes(s,r){return Array.isArray(s)?pug_classes_array(s,r):s&&\"object\"==typeof s?pug_classes_object(s):s||\"\"}",
"style": "function pug_style(r){if(!r)return\"\";if(\"object\"==typeof r){var t=\"\";for(var e in r)pug_has_own_property.call(r,e)&&(t=t+e+\":\"+r[e]+\";\");return t}return r+\"\"}",
"attr": "function pug_attr(t,e,n,r){if(!1===e||null==e||!e&&(\"class\"===t||\"style\"===t))return\"\";if(!0===e)return\" \"+(r?t:t+'=\"'+t+'\"');var f=typeof e;return\"object\"!==f&&\"function\"!==f||\"function\"!=typeof e.toJSON||(e=e.toJSON()),\"string\"==typeof e||(e=JSON.stringify(e),n||-1===e.indexOf('\"'))?(n&&(e=pug_escape(e)),\" \"+t+'=\"'+e+'\"'):\" \"+t+\"='\"+e.replace(/'/g,\"&#39;\")+\"'\"}",
"attrs": "function pug_attrs(t,r){var a=\"\";for(var s in t)if(pug_has_own_property.call(t,s)){var u=t[s];if(\"class\"===s){u=pug_classes(u),a=pug_attr(s,u,!1,r)+a;continue}\"style\"===s&&(u=pug_style(u)),a+=pug_attr(s,u,!1,r)}return a}",
"match_html": "var pug_match_html=/[\"&<>]/;",
"escape": "function pug_escape(e){var a=\"\"+e,t=pug_match_html.exec(a);if(!t)return e;var r,c,n,s=\"\";for(r=t.index,c=0;r<a.length;r++){switch(a.charCodeAt(r)){case 34:n=\"&quot;\";break;case 38:n=\"&amp;\";break;case 60:n=\"&lt;\";break;case 62:n=\"&gt;\";break;default:continue}c!==r&&(s+=a.substring(c,r)),c=r+1,s+=n}return c!==r?s+a.substring(c,r):s}",
"rethrow": "function pug_rethrow(n,e,r,t){if(!(n instanceof Error))throw n;if(!(\"undefined\"==typeof window&&e||t))throw n.message+=\" on line \"+r,n;try{t=t||require(\"fs\").readFileSync(e,\"utf8\")}catch(e){pug_rethrow(n,null,r)}var i=3,a=t.split(\"\\n\"),o=Math.max(r-i,0),h=Math.min(a.length,r+i),i=a.slice(o,h).map(function(n,e){var t=e+o+1;return(t==r?\" > \":\" \")+t+\"| \"+n}).join(\"\\n\");throw n.path=e,n.message=(e||\"Pug\")+\":\"+r+\"\\n\"+i+\"\\n\\n\"+n.message,n}"
}

65
node_modules/pug-runtime/package.json generated vendored Normal file
View File

@ -0,0 +1,65 @@
{
"_args": [
[
"pug-runtime@2.0.5",
"/Users/tatiana/selfdefined"
]
],
"_from": "pug-runtime@2.0.5",
"_id": "pug-runtime@2.0.5",
"_inBundle": false,
"_integrity": "sha512-P+rXKn9un4fQY77wtpcuFyvFaBww7/91f3jHa154qU26qFAnOe6SW1CbIDcxiG5lLK9HazYrMCCuDvNgDQNptw==",
"_location": "/pug-runtime",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "pug-runtime@2.0.5",
"name": "pug-runtime",
"escapedName": "pug-runtime",
"rawSpec": "2.0.5",
"saveSpec": null,
"fetchSpec": "2.0.5"
},
"_requiredBy": [
"/pug",
"/pug-attrs",
"/pug-code-gen"
],
"_resolved": "https://registry.npmjs.org/pug-runtime/-/pug-runtime-2.0.5.tgz",
"_spec": "2.0.5",
"_where": "/Users/tatiana/selfdefined",
"author": {
"name": "ForbesLindesay"
},
"browser": {
"fs": false
},
"description": "The runtime components for the pug templating language",
"devDependencies": {
"uglify-js": "^2.6.1"
},
"files": [
"build.js",
"index.js",
"lib/dependencies.js",
"lib/internals.js",
"lib/sources.js",
"wrap.js"
],
"gitHead": "1bdf628a70fda7a0d840c52f3abce54b1c6b0130",
"keywords": [
"pug"
],
"license": "MIT",
"name": "pug-runtime",
"repository": {
"type": "git",
"url": "https://github.com/pugjs/pug/tree/master/packages/pug-runtime"
},
"scripts": {
"prepublish": "node prepublish",
"pretest": "npm run prepublish"
},
"version": "2.0.5"
}

10
node_modules/pug-runtime/wrap.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
var runtime = require('./');
module.exports = wrap;
function wrap(template, templateName) {
templateName = templateName || 'template';
return Function('pug',
template + '\n' +
'return ' + templateName + ';'
)(runtime);
}