Update ecstatic to 0.5 (resolve #800)

This commit is contained in:
Joshua Granick
2017-06-05 14:49:52 -07:00
parent fca12e66cf
commit dab605d892
14 changed files with 1162 additions and 125 deletions

View File

@@ -0,0 +1,20 @@
Copyright Mathias Bynens <https://mathiasbynens.be/>
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.

143
templates/bin/node/http-server/node_modules/he/bin/he generated vendored Executable file
View File

@@ -0,0 +1,143 @@
#!/usr/bin/env node
(function() {
var fs = require('fs');
var he = require('../he.js');
var strings = process.argv.splice(2);
var stdin = process.stdin;
var data;
var timeout;
var action;
var options = {};
var log = console.log;
var main = function() {
var option = strings[0];
var count = 0;
if (/^(?:-h|--help|undefined)$/.test(option)) {
log(
'he v%s - http://mths.be/he',
he.version
);
log([
'\nUsage:\n',
'\the [--escape] string',
'\the [--encode] [--use-named-refs] [--everything] [--allow-unsafe] string',
'\the [--decode] [--attribute] [--strict] string',
'\the [-v | --version]',
'\the [-h | --help]',
'\nExamples:\n',
'\the --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>',
'\techo \'&copy; &#x1D306;\' | he --decode'
].join('\n'));
return process.exit(1);
}
if (/^(?:-v|--version)$/.test(option)) {
log('v%s', he.version);
return process.exit(1);
}
strings.forEach(function(string) {
// Process options
if (string == '--escape') {
action = 'escape';
return;
}
if (string == '--encode') {
action = 'encode';
return;
}
if (string == '--use-named-refs') {
action = 'encode';
options.useNamedReferences = true;
return;
}
if (string == '--everything') {
action = 'encode';
options.encodeEverything = true;
return;
}
if (string == '--allow-unsafe') {
action = 'encode';
options.allowUnsafeSymbols = true;
return;
}
if (string == '--decode') {
action = 'decode';
return;
}
if (string == '--attribute') {
action = 'decode';
options.isAttributeValue = true;
return;
}
if (string == '--strict') {
action = 'decode';
options.strict = true;
return;
}
// Process string(s)
var result;
if (!action) {
log('Error: he requires at least one option and a string argument.');
log('Try `he --help` for more information.');
return process.exit(1);
}
try {
result = he[action](string, options);
log(result);
count++;
} catch(error) {
log(error.message + '\n');
log('Error: failed to %s.', action);
log('If you think this is a bug in he, please report it:');
log('https://github.com/mathiasbynens/he/issues/new');
log(
'\nStack trace using he@%s:\n',
he.version
);
log(error.stack);
return process.exit(1);
}
});
if (!count) {
log('Error: he requires a string argument.');
log('Try `he --help` for more information.');
return process.exit(1);
}
// Return with exit status 0 outside of the `forEach` loop, in case
// multiple strings were passed in.
return process.exit(0);
};
if (stdin.isTTY) {
// handle shell arguments
main();
} else {
// Either the script is called from within a non-TTY context, or `stdin`
// content is being piped in.
if (!process.stdout.isTTY) {
// The script was called from a non-TTY context. This is a rather uncommon
// use case we dont actively support. However, we dont want the script
// to wait forever in such cases, so…
timeout = setTimeout(function() {
// …if no piped data arrived after a whole minute, handle shell
// arguments instead.
main();
}, 60000);
}
data = '';
stdin.on('data', function(chunk) {
clearTimeout(timeout);
data += chunk;
});
stdin.on('end', function() {
strings.push(data.trim());
main();
});
stdin.resume();
}
}());

329
templates/bin/node/http-server/node_modules/he/he.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,108 @@
{
"_args": [
[
"he@^0.5.0",
"/home/joshua/Development/Haxe/test/node_modules/ecstatic"
]
],
"_from": "he@>=0.5.0 <0.6.0",
"_id": "he@0.5.0",
"_inCache": true,
"_installable": true,
"_location": "/he",
"_npmUser": {
"email": "mathias@qiwi.be",
"name": "mathias"
},
"_npmVersion": "1.4.9",
"_phantomChildren": {},
"_requested": {
"name": "he",
"raw": "he@^0.5.0",
"rawSpec": "^0.5.0",
"scope": null,
"spec": ">=0.5.0 <0.6.0",
"type": "range"
},
"_requiredBy": [
"/ecstatic"
],
"_resolved": "https://registry.npmjs.org/he/-/he-0.5.0.tgz",
"_shasum": "2c05ffaef90b68e860f3fd2b54ef580989277ee2",
"_shrinkwrap": null,
"_spec": "he@^0.5.0",
"_where": "/home/joshua/Development/Haxe/test/node_modules/ecstatic",
"author": {
"name": "Mathias Bynens",
"url": "https://mathiasbynens.be/"
},
"bin": {
"he": "bin/he"
},
"bugs": {
"url": "https://github.com/mathiasbynens/he/issues"
},
"dependencies": {},
"description": "A robust HTML entities encoder/decoder with full Unicode support.",
"devDependencies": {
"coveralls": "^2.11.1",
"grunt": "^0.4.5",
"grunt-shell": "^1.0.1",
"grunt-template": "^0.2.3",
"istanbul": "^0.3.0",
"jsesc": "^0.5.0",
"lodash": "^2.4.1",
"qunit-extras": "^1.1.0",
"qunitjs": "~1.11.0",
"regenerate": "^0.6.2",
"requirejs": "^2.1.14",
"string.fromcodepoint": "^0.2.1"
},
"directories": {
"bin": "bin",
"man": "man",
"test": "tests"
},
"dist": {
"shasum": "2c05ffaef90b68e860f3fd2b54ef580989277ee2",
"tarball": "https://registry.npmjs.org/he/-/he-0.5.0.tgz"
},
"files": [
"LICENSE-MIT.txt",
"bin/",
"he.js",
"man/"
],
"homepage": "http://mths.be/he",
"keywords": [
"decode",
"encode",
"entities",
"entity",
"html",
"string",
"unicode"
],
"license": "MIT",
"main": "he.js",
"maintainers": [
{
"name": "mathias",
"email": "mathias@qiwi.be"
}
],
"man": [
"/Users/mathias/.npm/he/0.5.0/package/man/he.1"
],
"name": "he",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/mathiasbynens/he.git"
},
"scripts": {
"test": "node tests/tests.js"
},
"version": "0.5.0"
}