progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
parent d43daafdb7
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions

33
assets_old/node_modules/regjsparser/CHANGELOG generated vendored Normal file
View file

@ -0,0 +1,33 @@
2018-01-03: Version 0.3.0
* Add support for [named capturing groups](https://github.com/tc39/proposal-regexp-named-groups) (issue #83)
* Add polyfill for `fromCodePoint` for Nodejs < 4 (issue #86)
2017-02-23: Version 0.2.1
* Correctly specify license in `package.json`
2016-05-24: Version 0.2.0
* Introduce a third argument to the `parse` function for toggling (experimental) features
* Add experimental support for parsing "\p{…} and \P{…} in Unicode mode" (issue #78)
* Add `-v`/`--version` and `-f`/`--flags` arguments to the cli command `regjsparser` (issue #79)
2015-08-16: Version 0.1.5
* Add better error message on parser errors (issues #74 and #76)
2015-02-28: Version 0.1.4
* Fix parsing of backreferences, which are sometimes parsed as octal escapes (issue #70)
2014-11-25: Version 0.1.3
* Remove the upper limit of hex digits in Unicode code point escapes (issue #69)
2014-08-31: Version 0.1.2
* Change the field ref to matchIndex on the type=reference node (issue #67)
2014-08-30: Version 0.1.1
* Only handle unicode code point escapes if 'u' flag is set (issue #56)
* Remove `matchIdx` from the AST
* Fix references like /\1/ (issue #57)
* Rename type `ref` to `reference` in the AST
* Update regex to match identifier and include script to generate regex
2014-06-29: Version 0.1.0
* first tagged release

21
assets_old/node_modules/regjsparser/LICENSE.BSD generated vendored Normal file
View file

@ -0,0 +1,21 @@
Copyright (c) Julian Viereck and Contributors, All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

47
assets_old/node_modules/regjsparser/README.md generated vendored Normal file
View file

@ -0,0 +1,47 @@
# RegJSParser
Parsing the JavaScript's RegExp in JavaScript.
## Installation
```bash
npm install regjsparser
```
## Usage
```js
var parse = require('regjsparser').parse;
var parseTree = parse('^a'); // /^a/
console.log(parseTree);
// Toggle on/off additional features:
var parseTree = parse('^a', '', {
// SEE: https://github.com/jviereck/regjsparser/pull/78
unicodePropertyEscape: true,
// SEE: https://github.com/jviereck/regjsparser/pull/83
namedGroups: true,
// SEE: https://github.com/jviereck/regjsparser/pull/89
lookbehind: true
});
console.log(parseTree);
```
## Testing
To run the tests, run the following command:
```bash
npm test
```
To create a new reference file, execute…
```bash
node test/update-fixtures.js
```
…from the repo top directory.

63
assets_old/node_modules/regjsparser/bin/parser generated vendored Executable file
View file

@ -0,0 +1,63 @@
#!/usr/bin/env node
(function() {
var fs = require('fs');
var path = require('path');
var parse = require('../parser').parse;
var jsesc = require('jsesc');
var regexes = process.argv.splice(2);
var first = regexes[0];
var data;
var log = console.log;
var flags = '';
var main = function() {
if (/^(?:-h|--help|undefined)$/.test(first)) {
log([
'\nUsage:\n',
'\tregjsparser [regex ...]',
'\tregjsparser [-f | --flags] u [regex ...]',
'\tregjsparser [-v | --version]',
'\tregjsparser [-h | --help]',
'\nExamples:\n',
'\tregjsparser \'^foo.bar$\'',
'\tregjsparser \'[a-zA-Z0-9]\''
].join('\n'));
return process.exit(1);
}
if (/^(?:-v|--version)$/.test(first)) {
log('v%s', require(path.resolve(__dirname, '../package.json')).version);
return process.exit(1);
}
if (/^(?:-f|--flags)$/.test(first)) {
flags = regexes[1];
regexes = regexes.slice(2);
}
regexes.forEach(function(snippet) {
try {
result = parse(snippet, flags);
log(jsesc(result, {
'json': true,
'compact': false,
'indent': '\t'
}));
} catch(error) {
log(error.message + '\n');
log('Error: failed to parse. Make sure the regular expression is valid.');
log('If you think this is a bug in regjsparser, please report it:');
log('\thttps://github.com/jviereck/regjsparser/issues/new');
log('\nStack trace:\n');
log(error.stack);
return process.exit(1);
}
});
// Return with exit status 0 outside of the `forEach` loop, in case
// multiple regular expressions were passed in.
return process.exit(0);
};
main();
}());

View file

@ -0,0 +1 @@
../jsesc/bin/jsesc

View file

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

View file

@ -0,0 +1,375 @@
# jsesc [![Build status](https://travis-ci.org/mathiasbynens/jsesc.svg?branch=master)](https://travis-ci.org/mathiasbynens/jsesc) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/jsesc/master.svg)](https://coveralls.io/r/mathiasbynens/jsesc) [![Dependency status](https://gemnasium.com/mathiasbynens/jsesc.svg)](https://gemnasium.com/mathiasbynens/jsesc)
This is a JavaScript library for [escaping JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes) while generating the shortest possible valid ASCII-only output. [Heres an online demo.](http://mothereff.in/js-escapes)
This can be used to avoid [mojibake](http://en.wikipedia.org/wiki/Mojibake) and other encoding issues, or even to [avoid errors](https://twitter.com/annevk/status/380000829643571200) when passing JSON-formatted data (which may contain U+2028 LINE SEPARATOR, U+2029 PARAGRAPH SEPARATOR, or [lone surrogates](http://esdiscuss.org/topic/code-points-vs-unicode-scalar-values#content-14)) to a JavaScript parser or an UTF-8 encoder, respectively.
Feel free to fork if you see possible improvements!
## Installation
Via [Bower](http://bower.io/):
```bash
bower install jsesc
```
Via [Component](https://github.com/component/component):
```bash
component install mathiasbynens/jsesc
```
Via [npm](http://npmjs.org/):
```bash
npm install jsesc
```
In a browser:
```html
<script src="jsesc.js"></script>
```
In [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/):
```js
var jsesc = require('jsesc');
```
In [Narwhal](http://narwhaljs.org/):
```js
var jsesc = require('jsesc').jsesc;
```
In [Rhino](http://www.mozilla.org/rhino/):
```js
load('jsesc.js');
```
Using an AMD loader like [RequireJS](http://requirejs.org/):
```js
require(
{
'paths': {
'jsesc': 'path/to/jsesc'
}
},
['jsesc'],
function(jsesc) {
console.log(jsesc);
}
);
```
## API
### `jsesc(value, options)`
This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in JavaScript strings](http://mathiasbynens.be/notes/javascript-escapes). The first supported value type is strings:
```js
jsesc('Ich ♥ Bücher');
// → 'Ich \\u2665 B\\xFCcher'
jsesc('foo 𝌆 bar');
// → 'foo \\uD834\\uDF06 bar'
```
Instead of a string, the `value` can also be an array, or an object. In such cases, `jsesc` will return a stringified version of the value where any characters that are not printable ASCII symbols are escaped in the same way.
```js
// Escaping an array
jsesc([
'Ich ♥ Bücher', 'foo 𝌆 bar'
]);
// → '[\'Ich \\u2665 B\\xFCcher\',\'foo \\uD834\\uDF06 bar\']'
// Escaping an object
jsesc({
'Ich ♥ Bücher': 'foo 𝌆 bar'
});
// → '{\'Ich \\u2665 B\\xFCcher\':\'foo \\uD834\\uDF06 bar\'}'
```
The optional `options` argument accepts an object with the following options:
#### `quotes`
The default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input string will be escaped as `\'`, so that the output can be used in a string literal wrapped in single quotes.
```js
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.');
// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.'
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'single'
});
// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.'
// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc."
```
If you want to use the output as part of a string literal wrapped in double quotes, set the `quotes` option to `'double'`.
```js
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'double'
});
// → 'Lorem ipsum \\"dolor\\" sit \'amet\' etc.'
// → "Lorem ipsum \\\"dolor\\\" sit 'amet' etc."
```
This setting also affects the output for arrays and objects:
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'quotes': 'double'
});
// → '{"Ich \\u2665 B\\xFCcher":"foo \\uD834\\uDF06 bar"}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'quotes': 'double'
});
// → '["Ich \\u2665 B\\xFCcher","foo \\uD834\\uDF06 bar"]'
```
#### `wrap`
The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting.
```js
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'single',
'wrap': true
});
// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\''
// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'"
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'double',
'wrap': true
});
// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."'
// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\""
```
#### `es6`
The `es6` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any astral Unicode symbols in the input will be escaped using [ECMAScript 6 Unicode code point escape sequences](http://mathiasbynens.be/notes/javascript-escapes#unicode-code-point) instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 environments is a concern, dont enable this setting. If the `json` setting is enabled, the value for the `es6` setting is ignored (as if it was `false`).
```js
// By default, the `es6` option is disabled:
jsesc('foo 𝌆 bar 💩 baz');
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
// To explicitly disable it:
jsesc('foo 𝌆 bar 💩 baz', {
'es6': false
});
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
// To enable it:
jsesc('foo 𝌆 bar 💩 baz', {
'es6': true
});
// → 'foo \\u{1D306} bar \\u{1F4A9} baz'
```
#### `escapeEverything`
The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols.
```js
jsesc('lolwat"foo\'bar', {
'escapeEverything': true
});
// → '\\x6C\\x6F\\x6C\\x77\\x61\\x74\\"\\x66\\x6F\\x6F\\\'\\x62\\x61\\x72'
// → "\\x6C\\x6F\\x6C\\x77\\x61\\x74\\\"\\x66\\x6F\\x6F\\'\\x62\\x61\\x72"
```
This setting also affects the output for arrays and objects:
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'escapeEverything': true
});
// → '{\'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72\':\'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72\'}'
// → "{'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72':'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72'}"
jsesc([ 'Ich ♥ Bücher': 'foo 𝌆 bar' ], {
'escapeEverything': true
});
// → '[\'\x49\x63\x68\x20\u2665\x20\x42\xFC\x63\x68\x65\x72\',\'\x66\x6F\x6F\x20\uD834\uDF06\x20\x62\x61\x72\']'
```
#### `compact`
The `compact` option takes a boolean value (`true` or `false`), and defaults to `true` (enabled). When enabled, the output for arrays and objects will be as compact as possible; it wont be formatted nicely.
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': true // this is the default
});
// → '{\'Ich \u2665 B\xFCcher\':\'foo \uD834\uDF06 bar\'}'
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false
});
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'compact': false
});
// → '[\n\t\'Ich \u2665 B\xFCcher\',\n\t\'foo \uD834\uDF06 bar\'\n]'
```
This setting has no effect on the output for strings.
#### `indent`
The `indent` option takes a string value, and defaults to `'\t'`. When the `compact` setting is enabled (`true`), the value of the `indent` option is used to format the output for arrays and objects.
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false,
'indent': '\t' // this is the default
});
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false,
'indent': ' '
});
// → '{\n \'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'compact': false,
'indent': ' '
});
// → '[\n \'Ich \u2665 B\xFCcher\',\n\ t\'foo \uD834\uDF06 bar\'\n]'
```
This setting has no effect on the output for strings.
#### `json`
The `json` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is valid JSON. [Hexadecimal character escape sequences](http://mathiasbynens.be/notes/javascript-escapes#hexadecimal) and [the `\v` or `\0` escape sequences](http://mathiasbynens.be/notes/javascript-escapes#single) will not be used. Setting `json: true` implies `quotes: 'double', wrap: true, es6: false`, although these values can still be overridden if needed — but in such cases, the output wont be valid JSON anymore.
```js
jsesc('foo\x00bar\xFF\uFFFDbaz', {
'json': true
});
// → '"foo\\u0000bar\\u00FF\\uFFFDbaz"'
jsesc({ 'foo\x00bar\xFF\uFFFDbaz': 'foo\x00bar\xFF\uFFFDbaz' }, {
'json': true
});
// → '{"foo\\u0000bar\\u00FF\\uFFFDbaz":"foo\\u0000bar\\u00FF\\uFFFDbaz"}'
jsesc([ 'foo\x00bar\xFF\uFFFDbaz', 'foo\x00bar\xFF\uFFFDbaz' ], {
'json': true
});
// → '["foo\\u0000bar\\u00FF\\uFFFDbaz","foo\\u0000bar\\u00FF\\uFFFDbaz"]'
// Values that are acceptable in JSON but arent strings, arrays, or object
// literals cant be escaped, so theyll just be preserved:
jsesc([ 'foo\x00bar', [1, '©', { 'foo': true, 'qux': null }], 42 ], {
'json': true
});
// → '["foo\\u0000bar",[1,"\\u00A9",{"foo":true,"qux":null}],42]'
// Values that arent allowed in JSON are run through `JSON.stringify()`:
jsesc([ undefined, -Infinity ], {
'json': true
});
// → '[null,null]'
```
**Note:** Using this option on objects or arrays that contain non-string values relies on `JSON.stringify()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](http://bestiejs.github.io/json3/).
### `jsesc.version`
A string representing the semantic version number.
### Using the `jsesc` binary
To use the `jsesc` binary in your shell, simply install jsesc globally using npm:
```bash
npm install -g jsesc
```
After that you will be able to escape strings from the command line:
```bash
$ jsesc 'föo ♥ bår 𝌆 baz'
f\xF6o \u2665 b\xE5r \uD834\uDF06 baz
```
To escape arrays or objects containing string values, use the `-o`/`--object` option:
```bash
$ jsesc --object '{ "föo": "♥", "bår": "𝌆 baz" }'
{'f\xF6o':'\u2665','b\xE5r':'\uD834\uDF06 baz'}
```
To prettify the output in such cases, use the `-p`/`--pretty` option:
```bash
$ jsesc --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
{
'f\xF6o': '\u2665',
'b\xE5r': '\uD834\uDF06 baz'
}
```
For valid JSON output, use the `-j`/`--json` option:
```bash
$ jsesc --json --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
{
"f\u00F6o": "\u2665",
"b\u00E5r": "\uD834\uDF06 baz"
}
```
Read a local JSON file, escape any non-ASCII symbols, and save the result to a new file:
```bash
$ jsesc --json --object < data-raw.json > data-escaped.json
```
Or do the same with an online JSON file:
```bash
$ curl -sL "http://git.io/aorKgQ" | jsesc --json --object > data-escaped.json
```
See `jsesc --help` for the full list of options.
## Support
This library has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.
**Note:** Using the `json` option on objects or arrays that contain non-string values relies on `JSON.parse()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](http://bestiejs.github.io/json3/).
## Unit tests & code coverage
After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
Once thats done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.
To generate the code coverage report, use `grunt cover`.
## Author
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|
| [Mathias Bynens](http://mathiasbynens.be/) |
## License
This library is available under the [MIT](http://mths.be/mit) license.

View file

@ -0,0 +1,138 @@
#!/usr/bin/env node
(function() {
var fs = require('fs');
var stringEscape = require('../jsesc.js');
var strings = process.argv.splice(2);
var stdin = process.stdin;
var data;
var timeout;
var isObject = false;
var options = {};
var log = console.log;
var main = function() {
var option = strings[0];
if (/^(?:-h|--help|undefined)$/.test(option)) {
log(
'jsesc v%s - http://mths.be/jsesc',
stringEscape.version
);
log([
'\nUsage:\n',
'\tjsesc [string]',
'\tjsesc [-s | --single-quotes] [string]',
'\tjsesc [-d | --double-quotes] [string]',
'\tjsesc [-w | --wrap] [string]',
'\tjsesc [-e | --escape-everything] [string]',
'\tjsesc [-6 | --es6] [string]',
'\tjsesc [-j | --json] [string]',
'\tjsesc [-o | --object] [stringified_object]', // `JSON.parse()` the argument
'\tjsesc [-p | --pretty] [string]', // `compact: false`
'\tjsesc [-v | --version]',
'\tjsesc [-h | --help]',
'\nExamples:\n',
'\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
].join('\n'));
return process.exit(1);
}
if (/^(?:-v|--version)$/.test(option)) {
log('v%s', stringEscape.version);
return process.exit(1);
}
strings.forEach(function(string) {
// Process options
if (/^(?:-s|--single-quotes)$/.test(string)) {
options.quotes = 'single';
return;
}
if (/^(?:-d|--double-quotes)$/.test(string)) {
options.quotes = 'double';
return;
}
if (/^(?:-w|--wrap)$/.test(string)) {
options.wrap = true;
return;
}
if (/^(?:-6|--es6)$/.test(string)) {
options.es6 = true;
return;
}
if (/^(?:-e|--escape-everything)$/.test(string)) {
options.escapeEverything = true;
return;
}
if (/^(?:-j|--json)$/.test(string)) {
options.json = true;
return;
}
if (/^(?:-o|--object)$/.test(string)) {
isObject = true;
return;
}
if (/^(?:-p|--pretty)$/.test(string)) {
isObject = true;
options.compact = false;
return;
}
// Process string(s)
var result;
try {
if (isObject) {
string = JSON.parse(string);
}
result = stringEscape(string, options);
log(result);
} catch(error) {
log(error.message + '\n');
log('Error: failed to escape.');
log('If you think this is a bug in jsesc, please report it:');
log('https://github.com/mathiasbynens/jsesc/issues/new');
log(
'\nStack trace using jsesc@%s:\n',
stringEscape.version
);
log(error.stack);
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) { // called from a non-TTY context
timeout = setTimeout(function() {
// if no piped data arrived after a while, handle shell arguments
main();
}, 250);
}
data = '';
stdin.on('data', function(chunk) {
clearTimeout(timeout);
data += chunk;
});
stdin.on('end', function() {
strings.push(data.trim());
main();
});
stdin.resume();
}
}());

View file

@ -0,0 +1,265 @@
/*! http://mths.be/jsesc v0.5.0 by @mathias */
;(function(root) {
// Detect free variables `exports`
var freeExports = typeof exports == 'object' && exports;
// Detect free variable `module`
var freeModule = typeof module == 'object' && module &&
module.exports == freeExports && module;
// Detect free variable `global`, from Node.js or Browserified code,
// and use it as `root`
var freeGlobal = typeof global == 'object' && global;
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
root = freeGlobal;
}
/*--------------------------------------------------------------------------*/
var object = {};
var hasOwnProperty = object.hasOwnProperty;
var forOwn = function(object, callback) {
var key;
for (key in object) {
if (hasOwnProperty.call(object, key)) {
callback(key, object[key]);
}
}
};
var extend = function(destination, source) {
if (!source) {
return destination;
}
forOwn(source, function(key, value) {
destination[key] = value;
});
return destination;
};
var forEach = function(array, callback) {
var length = array.length;
var index = -1;
while (++index < length) {
callback(array[index]);
}
};
var toString = object.toString;
var isArray = function(value) {
return toString.call(value) == '[object Array]';
};
var isObject = function(value) {
// This is a very simple check, but its good enough for what we need.
return toString.call(value) == '[object Object]';
};
var isString = function(value) {
return typeof value == 'string' ||
toString.call(value) == '[object String]';
};
var isFunction = function(value) {
// In a perfect world, the `typeof` check would be sufficient. However,
// in Chrome 112, `typeof /x/ == 'object'`, and in IE 68
// `typeof alert == 'object'` and similar for other host objects.
return typeof value == 'function' ||
toString.call(value) == '[object Function]';
};
/*--------------------------------------------------------------------------*/
// http://mathiasbynens.be/notes/javascript-escapes#single
var singleEscapes = {
'"': '\\"',
'\'': '\\\'',
'\\': '\\\\',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t'
// `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'.
// '\v': '\\x0B'
};
var regexSingleEscape = /["'\\\b\f\n\r\t]/;
var regexDigit = /[0-9]/;
var regexWhitelist = /[ !#-&\(-\[\]-~]/;
var jsesc = function(argument, options) {
// Handle options
var defaults = {
'escapeEverything': false,
'quotes': 'single',
'wrap': false,
'es6': false,
'json': false,
'compact': true,
'indent': '\t',
'__indent__': ''
};
var json = options && options.json;
if (json) {
defaults.quotes = 'double';
defaults.wrap = true;
}
options = extend(defaults, options);
if (options.quotes != 'single' && options.quotes != 'double') {
options.quotes = 'single';
}
var quote = options.quotes == 'double' ? '"' : '\'';
var compact = options.compact;
var indent = options.indent;
var oldIndent;
var newLine = compact ? '' : '\n';
var result;
var isEmpty = true;
if (json && argument && isFunction(argument.toJSON)) {
argument = argument.toJSON();
}
if (!isString(argument)) {
if (isArray(argument)) {
result = [];
options.wrap = true;
oldIndent = options.__indent__;
indent += oldIndent;
options.__indent__ = indent;
forEach(argument, function(value) {
isEmpty = false;
result.push(
(compact ? '' : indent) +
jsesc(value, options)
);
});
if (isEmpty) {
return '[]';
}
return '[' + newLine + result.join(',' + newLine) + newLine +
(compact ? '' : oldIndent) + ']';
} else if (!isObject(argument)) {
if (json) {
// For some values (e.g. `undefined`, `function` objects),
// `JSON.stringify(value)` returns `undefined` (which isnt valid
// JSON) instead of `'null'`.
return JSON.stringify(argument) || 'null';
}
return String(argument);
} else { // its an object
result = [];
options.wrap = true;
oldIndent = options.__indent__;
indent += oldIndent;
options.__indent__ = indent;
forOwn(argument, function(key, value) {
isEmpty = false;
result.push(
(compact ? '' : indent) +
jsesc(key, options) + ':' +
(compact ? '' : ' ') +
jsesc(value, options)
);
});
if (isEmpty) {
return '{}';
}
return '{' + newLine + result.join(',' + newLine) + newLine +
(compact ? '' : oldIndent) + '}';
}
}
var string = argument;
// Loop over each code unit in the string and escape it
var index = -1;
var length = string.length;
var first;
var second;
var codePoint;
result = '';
while (++index < length) {
var character = string.charAt(index);
if (options.es6) {
first = string.charCodeAt(index);
if ( // check if its the start of a surrogate pair
first >= 0xD800 && first <= 0xDBFF && // high surrogate
length > index + 1 // there is a next code unit
) {
second = string.charCodeAt(index + 1);
if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
result += '\\u{' + codePoint.toString(16).toUpperCase() + '}';
index++;
continue;
}
}
}
if (!options.escapeEverything) {
if (regexWhitelist.test(character)) {
// Its a printable ASCII character that is not `"`, `'` or `\`,
// so dont escape it.
result += character;
continue;
}
if (character == '"') {
result += quote == character ? '\\"' : character;
continue;
}
if (character == '\'') {
result += quote == character ? '\\\'' : character;
continue;
}
}
if (
character == '\0' &&
!json &&
!regexDigit.test(string.charAt(index + 1))
) {
result += '\\0';
continue;
}
if (regexSingleEscape.test(character)) {
// no need for a `hasOwnProperty` check here
result += singleEscapes[character];
continue;
}
var charCode = character.charCodeAt(0);
var hexadecimal = charCode.toString(16).toUpperCase();
var longhand = hexadecimal.length > 2 || json;
var escaped = '\\' + (longhand ? 'u' : 'x') +
('0000' + hexadecimal).slice(longhand ? -4 : -2);
result += escaped;
continue;
}
if (options.wrap) {
result = quote + result + quote;
}
return result;
};
jsesc.version = '0.5.0';
/*--------------------------------------------------------------------------*/
// Some AMD build optimizers, like r.js, check for specific condition patterns
// like the following:
if (
typeof define == 'function' &&
typeof define.amd == 'object' &&
define.amd
) {
define(function() {
return jsesc;
});
} else if (freeExports && !freeExports.nodeType) {
if (freeModule) { // in Node.js or RingoJS v0.8.0+
freeModule.exports = jsesc;
} else { // in Narwhal or RingoJS v0.7.0-
freeExports.jsesc = jsesc;
}
} else { // in Rhino or a web browser
root.jsesc = jsesc;
}
}(this));

View file

@ -0,0 +1,90 @@
.Dd October 25, 2013
.Dt jsesc 1
.Sh NAME
.Nm jsesc
.Nd escape strings for use in JavaScript string literals
.Sh SYNOPSIS
.Nm
.Op Fl s | -single-quotes Ar string
.br
.Op Fl d | -double-quotes Ar string
.br
.Op Fl w | -wrap Ar string
.br
.Op Fl 6 | -es6 Ar string
.br
.Op Fl e | -escape-everything Ar string
.br
.Op Fl j | -json Ar string
.br
.Op Fl p | -object Ar string
.br
.Op Fl p | -pretty Ar string
.br
.Op Fl v | -version
.br
.Op Fl h | -help
.Sh DESCRIPTION
.Nm
escapes strings for use in JavaScript string literals while generating the shortest possible valid ASCII-only output.
.Sh OPTIONS
.Bl -ohang -offset
.It Sy "-s, --single-quotes"
Escape any occurences of ' in the input string as \\', so that the output can be used in a JavaScript string literal wrapped in single quotes.
.It Sy "-d, --double-quotes"
Escape any occurences of " in the input string as \\", so that the output can be used in a JavaScript string literal wrapped in double quotes.
.It Sy "-w, --wrap"
Make sure the output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified using the
.Ar -s | --single-quotes
or
.Ar -d | --double-quotes
settings.
.It Sy "-6, --es6"
Escape any astral Unicode symbols using ECMAScript 6 Unicode code point escape sequences.
.It Sy "-e, --escape-everything"
Escape all the symbols in the output, even printable ASCII symbols.
.It Sy "-j, --json"
Make sure the output is valid JSON. Hexadecimal character escape sequences and the \\v or \\0 escape sequences will not be used. Setting this flag enables the
.Ar -d | --double-quotes
and
.Ar -w | --wrap
settings.
.It Sy "-o, --object"
Treat the input as a JavaScript object rather than a string. Accepted values are flat arrays containing only string values, and flat objects containing only string values.
.It Sy "-p, --pretty"
Pretty-print the output for objects, using whitespace to make it more readable. Setting this flag enables the
.Ar -o | --object
setting.
.It Sy "-v, --version"
Print jsesc's version.
.It Sy "-h, --help"
Show the help screen.
.El
.Sh EXIT STATUS
The
.Nm jsesc
utility exits with one of the following values:
.Pp
.Bl -tag -width flag -compact
.It Li 0
.Nm
successfully escaped the given string and printed the result.
.It Li 1
.Nm
wasn't instructed to escape anything (for example, the
.Ar --help
flag was set); or, an error occurred.
.El
.Sh EXAMPLES
.Bl -ohang -offset
.It Sy "jsesc 'foo bar baz'"
Print an escaped version of the given string.
.It Sy echo\ 'foo bar baz'\ |\ jsesc
Print an escaped version of the string that gets piped in.
.El
.Sh BUGS
jsesc's bug tracker is located at <https://github.com/mathiasbynens/jsesc/issues>.
.Sh AUTHOR
Mathias Bynens <http://mathiasbynens.be/>
.Sh WWW
<http://mths.be/jsesc>

View file

@ -0,0 +1,55 @@
{
"name": "jsesc",
"version": "0.5.0",
"description": "A JavaScript library for escaping JavaScript strings while generating the shortest possible valid output.",
"homepage": "http://mths.be/jsesc",
"main": "jsesc.js",
"bin": "bin/jsesc",
"man": "man/jsesc.1",
"keywords": [
"string",
"escape",
"javascript",
"tool"
],
"licenses": [
{
"type": "MIT",
"url": "http://mths.be/mit"
}
],
"author": {
"name": "Mathias Bynens",
"url": "http://mathiasbynens.be/"
},
"repository": {
"type": "git",
"url": "https://github.com/mathiasbynens/jsesc.git"
},
"bugs": {
"url": "https://github.com/mathiasbynens/jsesc/issues"
},
"files": [
"LICENSE-MIT.txt",
"jsesc.js",
"bin/",
"man/"
],
"directories": {
"test": "tests"
},
"scripts": {
"test": "node tests/tests.js"
},
"devDependencies": {
"coveralls": "^2.10.0",
"grunt": "^0.4.5",
"grunt-shell": "^0.7.0",
"grunt-template": "^0.2.3",
"istanbul": "^0.3.0",
"qunit-extras": "^1.2.0",
"qunitjs": "~1.11.0",
"regenerate": "^0.6.2",
"requirejs": "^2.1.14"
}
}

29
assets_old/node_modules/regjsparser/package.json generated vendored Normal file
View file

@ -0,0 +1,29 @@
{
"name": "regjsparser",
"version": "0.6.9",
"author": "'Julian Viereck' <julian.viereck@gmail.com>",
"license": "BSD-2-Clause",
"main": "./parser",
"bin": "bin/parser",
"homepage": "https://github.com/jviereck/regjsparser",
"repository": {
"type": "git",
"url": "git@github.com:jviereck/regjsparser.git"
},
"scripts": {
"test": "node test/index.js"
},
"files": [
"bin/",
"LICENSE.BSD",
"parser.js",
"README.md"
],
"dependencies": {
"jsesc": "~0.5.0"
},
"devDependencies": {
"regenerate": "~1.0.1",
"unicode-11.0.0": "^0.7.8"
}
}

1230
assets_old/node_modules/regjsparser/parser.js generated vendored Normal file

File diff suppressed because one or more lines are too long