summaryrefslogtreecommitdiffstats
path: root/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules')
l---------node_modules/.bin/xss1
-rw-r--r--node_modules/commander/CHANGELOG.md419
-rw-r--r--node_modules/commander/LICENSE22
-rw-r--r--node_modules/commander/Readme.md428
-rw-r--r--node_modules/commander/index.js1224
-rw-r--r--node_modules/commander/package.json70
-rw-r--r--node_modules/commander/typings/index.d.ts310
-rw-r--r--node_modules/cssfilter/LICENSE22
-rw-r--r--node_modules/cssfilter/README.md86
-rw-r--r--node_modules/cssfilter/lib/css.js110
-rw-r--r--node_modules/cssfilter/lib/default.js398
-rw-r--r--node_modules/cssfilter/lib/index.js32
-rw-r--r--node_modules/cssfilter/lib/parser.js74
-rw-r--r--node_modules/cssfilter/lib/util.js35
-rw-r--r--node_modules/cssfilter/package.json77
-rw-r--r--node_modules/xss/LICENSE23
-rw-r--r--node_modules/xss/README.md499
-rw-r--r--node_modules/xss/README.zh.md485
-rwxr-xr-xnode_modules/xss/bin/xss67
-rw-r--r--node_modules/xss/dist/test.html15
-rw-r--r--node_modules/xss/dist/xss.js1609
-rw-r--r--node_modules/xss/dist/xss.min.js1
-rw-r--r--node_modules/xss/lib/cli.js45
-rw-r--r--node_modules/xss/lib/default.js415
-rw-r--r--node_modules/xss/lib/index.js40
-rw-r--r--node_modules/xss/lib/parser.js239
-rw-r--r--node_modules/xss/lib/util.js34
-rw-r--r--node_modules/xss/lib/xss.js211
-rw-r--r--node_modules/xss/package.json92
-rw-r--r--node_modules/xss/typings/xss.d.ts189
30 files changed, 0 insertions, 7272 deletions
diff --git a/node_modules/.bin/xss b/node_modules/.bin/xss
deleted file mode 120000
index e9e309f..0000000
--- a/node_modules/.bin/xss
+++ /dev/null
@@ -1 +0,0 @@
-../xss/bin/xss \ No newline at end of file
diff --git a/node_modules/commander/CHANGELOG.md b/node_modules/commander/CHANGELOG.md
deleted file mode 100644
index 7dce779..0000000
--- a/node_modules/commander/CHANGELOG.md
+++ /dev/null
@@ -1,419 +0,0 @@
-2.20.3 / 2019-10-11
-==================
-
- * Support Node.js 0.10 (Revert #1059)
- * Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
-
-2.20.1 / 2019-09-29
-==================
-
- * Improve executable subcommand tracking
- * Update dev dependencies
-
-2.20.0 / 2019-04-02
-==================
-
- * fix: resolve symbolic links completely when hunting for subcommands (#935)
- * Update index.d.ts (#930)
- * Update Readme.md (#924)
- * Remove --save option as it isn't required anymore (#918)
- * Add link to the license file (#900)
- * Added example of receiving args from options (#858)
- * Added missing semicolon (#882)
- * Add extension to .eslintrc (#876)
-
-2.19.0 / 2018-10-02
-==================
-
- * Removed newline after Options and Commands headers (#864)
- * Bugfix - Error output (#862)
- * Fix to change default value to string (#856)
-
-2.18.0 / 2018-09-07
-==================
-
- * Standardize help output (#853)
- * chmod 644 travis.yml (#851)
- * add support for execute typescript subcommand via ts-node (#849)
-
-2.17.1 / 2018-08-07
-==================
-
- * Fix bug in command emit (#844)
-
-2.17.0 / 2018-08-03
-==================
-
- * fixed newline output after help information (#833)
- * Fix to emit the action even without command (#778)
- * npm update (#823)
-
-2.16.0 / 2018-06-29
-==================
-
- * Remove Makefile and `test/run` (#821)
- * Make 'npm test' run on Windows (#820)
- * Add badge to display install size (#807)
- * chore: cache node_modules (#814)
- * chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
- * fixed typo in readme (#812)
- * Fix types (#804)
- * Update eslint to resolve vulnerabilities in lodash (#799)
- * updated readme with custom event listeners. (#791)
- * fix tests (#794)
-
-2.15.0 / 2018-03-07
-==================
-
- * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
- * Arguments description
-
-2.14.1 / 2018-02-07
-==================
-
- * Fix typing of help function
-
-2.14.0 / 2018-02-05
-==================
-
- * only register the option:version event once
- * Fixes issue #727: Passing empty string for option on command is set to undefined
- * enable eqeqeq rule
- * resolves #754 add linter configuration to project
- * resolves #560 respect custom name for version option
- * document how to override the version flag
- * document using options per command
-
-2.13.0 / 2018-01-09
-==================
-
- * Do not print default for --no-
- * remove trailing spaces in command help
- * Update CI's Node.js to LTS and latest version
- * typedefs: Command and Option types added to commander namespace
-
-2.12.2 / 2017-11-28
-==================
-
- * fix: typings are not shipped
-
-2.12.1 / 2017-11-23
-==================
-
- * Move @types/node to dev dependency
-
-2.12.0 / 2017-11-22
-==================
-
- * add attributeName() method to Option objects
- * Documentation updated for options with --no prefix
- * typings: `outputHelp` takes a string as the first parameter
- * typings: use overloads
- * feat(typings): update to match js api
- * Print default value in option help
- * Fix translation error
- * Fail when using same command and alias (#491)
- * feat(typings): add help callback
- * fix bug when description is add after command with options (#662)
- * Format js code
- * Rename History.md to CHANGELOG.md (#668)
- * feat(typings): add typings to support TypeScript (#646)
- * use current node
-
-2.11.0 / 2017-07-03
-==================
-
- * Fix help section order and padding (#652)
- * feature: support for signals to subcommands (#632)
- * Fixed #37, --help should not display first (#447)
- * Fix translation errors. (#570)
- * Add package-lock.json
- * Remove engines
- * Upgrade package version
- * Prefix events to prevent conflicts between commands and options (#494)
- * Removing dependency on graceful-readlink
- * Support setting name in #name function and make it chainable
- * Add .vscode directory to .gitignore (Visual Studio Code metadata)
- * Updated link to ruby commander in readme files
-
-2.10.0 / 2017-06-19
-==================
-
- * Update .travis.yml. drop support for older node.js versions.
- * Fix require arguments in README.md
- * On SemVer you do not start from 0.0.1
- * Add missing semi colon in readme
- * Add save param to npm install
- * node v6 travis test
- * Update Readme_zh-CN.md
- * Allow literal '--' to be passed-through as an argument
- * Test subcommand alias help
- * link build badge to master branch
- * Support the alias of Git style sub-command
- * added keyword commander for better search result on npm
- * Fix Sub-Subcommands
- * test node.js stable
- * Fixes TypeError when a command has an option called `--description`
- * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
- * Add chinese Readme file
-
-2.9.0 / 2015-10-13
-==================
-
- * Add option `isDefault` to set default subcommand #415 @Qix-
- * Add callback to allow filtering or post-processing of help text #434 @djulien
- * Fix `undefined` text in help information close #414 #416 @zhiyelee
-
-2.8.1 / 2015-04-22
-==================
-
- * Back out `support multiline description` Close #396 #397
-
-2.8.0 / 2015-04-07
-==================
-
- * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
- * Fix bug in Git-style sub-commands #372 @zhiyelee
- * Allow commands to be hidden from help #383 @tonylukasavage
- * When git-style sub-commands are in use, yet none are called, display help #382 @claylo
- * Add ability to specify arguments syntax for top-level command #258 @rrthomas
- * Support multiline descriptions #208 @zxqfox
-
-2.7.1 / 2015-03-11
-==================
-
- * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
-
-2.7.0 / 2015-03-09
-==================
-
- * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
- * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
- * Add support for camelCase on `opts()`. Close #353 @nkzawa
- * Add node.js 0.12 and io.js to travis.yml
- * Allow RegEx options. #337 @palanik
- * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
- * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
-
-2.6.0 / 2014-12-30
-==================
-
- * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
- * Add application description to the help msg. Close #112 @dalssoft
-
-2.5.1 / 2014-12-15
-==================
-
- * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
-
-2.5.0 / 2014-10-24
-==================
-
- * add support for variadic arguments. Closes #277 @whitlockjc
-
-2.4.0 / 2014-10-17
-==================
-
- * fixed a bug on executing the coercion function of subcommands option. Closes #270
- * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
- * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
- * fixed a bug on subcommand name. Closes #248 @jonathandelgado
- * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
-
-2.3.0 / 2014-07-16
-==================
-
- * add command alias'. Closes PR #210
- * fix: Typos. Closes #99
- * fix: Unused fs module. Closes #217
-
-2.2.0 / 2014-03-29
-==================
-
- * add passing of previous option value
- * fix: support subcommands on windows. Closes #142
- * Now the defaultValue passed as the second argument of the coercion function.
-
-2.1.0 / 2013-11-21
-==================
-
- * add: allow cflag style option params, unit test, fixes #174
-
-2.0.0 / 2013-07-18
-==================
-
- * remove input methods (.prompt, .confirm, etc)
-
-1.3.2 / 2013-07-18
-==================
-
- * add support for sub-commands to co-exist with the original command
-
-1.3.1 / 2013-07-18
-==================
-
- * add quick .runningCommand hack so you can opt-out of other logic when running a sub command
-
-1.3.0 / 2013-07-09
-==================
-
- * add EACCES error handling
- * fix sub-command --help
-
-1.2.0 / 2013-06-13
-==================
-
- * allow "-" hyphen as an option argument
- * support for RegExp coercion
-
-1.1.1 / 2012-11-20
-==================
-
- * add more sub-command padding
- * fix .usage() when args are present. Closes #106
-
-1.1.0 / 2012-11-16
-==================
-
- * add git-style executable subcommand support. Closes #94
-
-1.0.5 / 2012-10-09
-==================
-
- * fix `--name` clobbering. Closes #92
- * fix examples/help. Closes #89
-
-1.0.4 / 2012-09-03
-==================
-
- * add `outputHelp()` method.
-
-1.0.3 / 2012-08-30
-==================
-
- * remove invalid .version() defaulting
-
-1.0.2 / 2012-08-24
-==================
-
- * add `--foo=bar` support [arv]
- * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
-
-1.0.1 / 2012-08-03
-==================
-
- * fix issue #56
- * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
-
-1.0.0 / 2012-07-05
-==================
-
- * add support for optional option descriptions
- * add defaulting of `.version()` to package.json's version
-
-0.6.1 / 2012-06-01
-==================
-
- * Added: append (yes or no) on confirmation
- * Added: allow node.js v0.7.x
-
-0.6.0 / 2012-04-10
-==================
-
- * Added `.prompt(obj, callback)` support. Closes #49
- * Added default support to .choose(). Closes #41
- * Fixed the choice example
-
-0.5.1 / 2011-12-20
-==================
-
- * Fixed `password()` for recent nodes. Closes #36
-
-0.5.0 / 2011-12-04
-==================
-
- * Added sub-command option support [itay]
-
-0.4.3 / 2011-12-04
-==================
-
- * Fixed custom help ordering. Closes #32
-
-0.4.2 / 2011-11-24
-==================
-
- * Added travis support
- * Fixed: line-buffered input automatically trimmed. Closes #31
-
-0.4.1 / 2011-11-18
-==================
-
- * Removed listening for "close" on --help
-
-0.4.0 / 2011-11-15
-==================
-
- * Added support for `--`. Closes #24
-
-0.3.3 / 2011-11-14
-==================
-
- * Fixed: wait for close event when writing help info [Jerry Hamlet]
-
-0.3.2 / 2011-11-01
-==================
-
- * Fixed long flag definitions with values [felixge]
-
-0.3.1 / 2011-10-31
-==================
-
- * Changed `--version` short flag to `-V` from `-v`
- * Changed `.version()` so it's configurable [felixge]
-
-0.3.0 / 2011-10-31
-==================
-
- * Added support for long flags only. Closes #18
-
-0.2.1 / 2011-10-24
-==================
-
- * "node": ">= 0.4.x < 0.7.0". Closes #20
-
-0.2.0 / 2011-09-26
-==================
-
- * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
-
-0.1.0 / 2011-08-24
-==================
-
- * Added support for custom `--help` output
-
-0.0.5 / 2011-08-18
-==================
-
- * Changed: when the user enters nothing prompt for password again
- * Fixed issue with passwords beginning with numbers [NuckChorris]
-
-0.0.4 / 2011-08-15
-==================
-
- * Fixed `Commander#args`
-
-0.0.3 / 2011-08-15
-==================
-
- * Added default option value support
-
-0.0.2 / 2011-08-15
-==================
-
- * Added mask support to `Command#password(str[, mask], fn)`
- * Added `Command#password(str, fn)`
-
-0.0.1 / 2010-01-03
-==================
-
- * Initial release
diff --git a/node_modules/commander/LICENSE b/node_modules/commander/LICENSE
deleted file mode 100644
index 10f997a..0000000
--- a/node_modules/commander/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
-
-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.
diff --git a/node_modules/commander/Readme.md b/node_modules/commander/Readme.md
deleted file mode 100644
index c846e7a..0000000
--- a/node_modules/commander/Readme.md
+++ /dev/null
@@ -1,428 +0,0 @@
-# Commander.js
-
-
-[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js)
-[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
-[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
-[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
-[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
- The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
- [API documentation](http://tj.github.com/commander.js/)
-
-
-## Installation
-
- $ npm install commander
-
-## Option parsing
-
-Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
-
-```js
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('commander');
-
-program
- .version('0.1.0')
- .option('-p, --peppers', 'Add peppers')
- .option('-P, --pineapple', 'Add pineapple')
- .option('-b, --bbq-sauce', 'Add bbq sauce')
- .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
- .parse(process.argv);
-
-console.log('you ordered a pizza with:');
-if (program.peppers) console.log(' - peppers');
-if (program.pineapple) console.log(' - pineapple');
-if (program.bbqSauce) console.log(' - bbq');
-console.log(' - %s cheese', program.cheese);
-```
-
-Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
-
-Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
-
-```js
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('commander');
-
-program
- .option('--no-sauce', 'Remove sauce')
- .parse(process.argv);
-
-console.log('you ordered a pizza');
-if (program.sauce) console.log(' with sauce');
-else console.log(' without sauce');
-```
-
-To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
-
-e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
-
-Then to access the input if it was passed in.
-
-e.g. ```var myInput = program.myarg```
-
-**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
-
-
-## Version option
-
-Calling the `version` implicitly adds the `-V` and `--version` options to the command.
-When either of these options is present, the command prints the version number and exits.
-
- $ ./examples/pizza -V
- 0.0.1
-
-If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
-
-```js
-program
- .version('0.0.1', '-v, --version')
-```
-
-The version flags can be named anything, but the long option is required.
-
-## Command-specific options
-
-You can attach options to a command.
-
-```js
-#!/usr/bin/env node
-
-var program = require('commander');
-
-program
- .command('rm <dir>')
- .option('-r, --recursive', 'Remove recursively')
- .action(function (dir, cmd) {
- console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
- })
-
-program.parse(process.argv)
-```
-
-A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
-
-## Coercion
-
-```js
-function range(val) {
- return val.split('..').map(Number);
-}
-
-function list(val) {
- return val.split(',');
-}
-
-function collect(val, memo) {
- memo.push(val);
- return memo;
-}
-
-function increaseVerbosity(v, total) {
- return total + 1;
-}
-
-program
- .version('0.1.0')
- .usage('[options] <file ...>')
- .option('-i, --integer <n>', 'An integer argument', parseInt)
- .option('-f, --float <n>', 'A float argument', parseFloat)
- .option('-r, --range <a>..<b>', 'A range', range)
- .option('-l, --list <items>', 'A list', list)
- .option('-o, --optional [value]', 'An optional value')
- .option('-c, --collect [value]', 'A repeatable value', collect, [])
- .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
- .parse(process.argv);
-
-console.log(' int: %j', program.integer);
-console.log(' float: %j', program.float);
-console.log(' optional: %j', program.optional);
-program.range = program.range || [];
-console.log(' range: %j..%j', program.range[0], program.range[1]);
-console.log(' list: %j', program.list);
-console.log(' collect: %j', program.collect);
-console.log(' verbosity: %j', program.verbose);
-console.log(' args: %j', program.args);
-```
-
-## Regular Expression
-```js
-program
- .version('0.1.0')
- .option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
- .option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
- .parse(process.argv);
-
-console.log(' size: %j', program.size);
-console.log(' drink: %j', program.drink);
-```
-
-## Variadic arguments
-
- The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
- append `...` to the argument name. Here is an example:
-
-```js
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('commander');
-
-program
- .version('0.1.0')
- .command('rmdir <dir> [otherDirs...]')
- .action(function (dir, otherDirs) {
- console.log('rmdir %s', dir);
- if (otherDirs) {
- otherDirs.forEach(function (oDir) {
- console.log('rmdir %s', oDir);
- });
- }
- });
-
-program.parse(process.argv);
-```
-
- An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
- to your action as demonstrated above.
-
-## Specify the argument syntax
-
-```js
-#!/usr/bin/env node
-
-var program = require('commander');
-
-program
- .version('0.1.0')
- .arguments('<cmd> [env]')
- .action(function (cmd, env) {
- cmdValue = cmd;
- envValue = env;
- });
-
-program.parse(process.argv);
-
-if (typeof cmdValue === 'undefined') {
- console.error('no command given!');
- process.exit(1);
-}
-console.log('command:', cmdValue);
-console.log('environment:', envValue || "no environment given");
-```
-Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
-
-## Git-style sub-commands
-
-```js
-// file: ./examples/pm
-var program = require('commander');
-
-program
- .version('0.1.0')
- .command('install [name]', 'install one or more packages')
- .command('search [query]', 'search with optional query')
- .command('list', 'list packages installed', {isDefault: true})
- .parse(process.argv);
-```
-
-When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
-The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
-
-Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
-
-If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
-
-### `--harmony`
-
-You can enable `--harmony` option in two ways:
-* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
-* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
-
-## Automated --help
-
- The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
-
-```
-$ ./examples/pizza --help
-Usage: pizza [options]
-
-An application for pizzas ordering
-
-Options:
- -h, --help output usage information
- -V, --version output the version number
- -p, --peppers Add peppers
- -P, --pineapple Add pineapple
- -b, --bbq Add bbq sauce
- -c, --cheese <type> Add the specified type of cheese [marble]
- -C, --no-cheese You do not want any cheese
-```
-
-## Custom help
-
- You can display arbitrary `-h, --help` information
- by listening for "--help". Commander will automatically
- exit once you are done so that the remainder of your program
- does not execute causing undesired behaviors, for example
- in the following executable "stuff" will not output when
- `--help` is used.
-
-```js
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('commander');
-
-program
- .version('0.1.0')
- .option('-f, --foo', 'enable some foo')
- .option('-b, --bar', 'enable some bar')
- .option('-B, --baz', 'enable some baz');
-
-// must be before .parse() since
-// node's emit() is immediate
-
-program.on('--help', function(){
- console.log('')
- console.log('Examples:');
- console.log(' $ custom-help --help');
- console.log(' $ custom-help -h');
-});
-
-program.parse(process.argv);
-
-console.log('stuff');
-```
-
-Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
-
-```
-Usage: custom-help [options]
-
-Options:
- -h, --help output usage information
- -V, --version output the version number
- -f, --foo enable some foo
- -b, --bar enable some bar
- -B, --baz enable some baz
-
-Examples:
- $ custom-help --help
- $ custom-help -h
-```
-
-## .outputHelp(cb)
-
-Output help information without exiting.
-Optional callback cb allows post-processing of help text before it is displayed.
-
-If you want to display help by default (e.g. if no command was provided), you can use something like:
-
-```js
-var program = require('commander');
-var colors = require('colors');
-
-program
- .version('0.1.0')
- .command('getstream [url]', 'get stream URL')
- .parse(process.argv);
-
-if (!process.argv.slice(2).length) {
- program.outputHelp(make_red);
-}
-
-function make_red(txt) {
- return colors.red(txt); //display the help text in red on the console
-}
-```
-
-## .help(cb)
-
- Output help information and exit immediately.
- Optional callback cb allows post-processing of help text before it is displayed.
-
-
-## Custom event listeners
- You can execute custom actions by listening to command and option events.
-
-```js
-program.on('option:verbose', function () {
- process.env.VERBOSE = this.verbose;
-});
-
-// error on unknown commands
-program.on('command:*', function () {
- console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
- process.exit(1);
-});
-```
-
-## Examples
-
-```js
-var program = require('commander');
-
-program
- .version('0.1.0')
- .option('-C, --chdir <path>', 'change the working directory')
- .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
- .option('-T, --no-tests', 'ignore test hook');
-
-program
- .command('setup [env]')
- .description('run setup commands for all envs')
- .option("-s, --setup_mode [mode]", "Which setup mode to use")
- .action(function(env, options){
- var mode = options.setup_mode || "normal";
- env = env || 'all';
- console.log('setup for %s env(s) with %s mode', env, mode);
- });
-
-program
- .command('exec <cmd>')
- .alias('ex')
- .description('execute the given remote cmd')
- .option("-e, --exec_mode <mode>", "Which exec mode to use")
- .action(function(cmd, options){
- console.log('exec "%s" using %s mode', cmd, options.exec_mode);
- }).on('--help', function() {
- console.log('');
- console.log('Examples:');
- console.log('');
- console.log(' $ deploy exec sequential');
- console.log(' $ deploy exec async');
- });
-
-program
- .command('*')
- .action(function(env){
- console.log('deploying "%s"', env);
- });
-
-program.parse(process.argv);
-```
-
-More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
-
-## License
-
-[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
diff --git a/node_modules/commander/index.js b/node_modules/commander/index.js
deleted file mode 100644
index ec1d61d..0000000
--- a/node_modules/commander/index.js
+++ /dev/null
@@ -1,1224 +0,0 @@
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('events').EventEmitter;
-var spawn = require('child_process').spawn;
-var path = require('path');
-var dirname = path.dirname;
-var basename = path.basename;
-var fs = require('fs');
-
-/**
- * Inherit `Command` from `EventEmitter.prototype`.
- */
-
-require('util').inherits(Command, EventEmitter);
-
-/**
- * Expose the root command.
- */
-
-exports = module.exports = new Command();
-
-/**
- * Expose `Command`.
- */
-
-exports.Command = Command;
-
-/**
- * Expose `Option`.
- */
-
-exports.Option = Option;
-
-/**
- * Initialize a new `Option` with the given `flags` and `description`.
- *
- * @param {String} flags
- * @param {String} description
- * @api public
- */
-
-function Option(flags, description) {
- this.flags = flags;
- this.required = flags.indexOf('<') >= 0;
- this.optional = flags.indexOf('[') >= 0;
- this.bool = flags.indexOf('-no-') === -1;
- flags = flags.split(/[ ,|]+/);
- if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
- this.long = flags.shift();
- this.description = description || '';
-}
-
-/**
- * Return option name.
- *
- * @return {String}
- * @api private
- */
-
-Option.prototype.name = function() {
- return this.long
- .replace('--', '')
- .replace('no-', '');
-};
-
-/**
- * Return option name, in a camelcase format that can be used
- * as a object attribute key.
- *
- * @return {String}
- * @api private
- */
-
-Option.prototype.attributeName = function() {
- return camelcase(this.name());
-};
-
-/**
- * Check if `arg` matches the short or long flag.
- *
- * @param {String} arg
- * @return {Boolean}
- * @api private
- */
-
-Option.prototype.is = function(arg) {
- return this.short === arg || this.long === arg;
-};
-
-/**
- * Initialize a new `Command`.
- *
- * @param {String} name
- * @api public
- */
-
-function Command(name) {
- this.commands = [];
- this.options = [];
- this._execs = {};
- this._allowUnknownOption = false;
- this._args = [];
- this._name = name || '';
-}
-
-/**
- * Add command `name`.
- *
- * The `.action()` callback is invoked when the
- * command `name` is specified via __ARGV__,
- * and the remaining arguments are applied to the
- * function for access.
- *
- * When the `name` is "*" an un-matched command
- * will be passed as the first arg, followed by
- * the rest of __ARGV__ remaining.
- *
- * Examples:
- *
- * program
- * .version('0.0.1')
- * .option('-C, --chdir <path>', 'change the working directory')
- * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
- * .option('-T, --no-tests', 'ignore test hook')
- *
- * program
- * .command('setup')
- * .description('run remote setup commands')
- * .action(function() {
- * console.log('setup');
- * });
- *
- * program
- * .command('exec <cmd>')
- * .description('run the given remote command')
- * .action(function(cmd) {
- * console.log('exec "%s"', cmd);
- * });
- *
- * program
- * .command('teardown <dir> [otherDirs...]')
- * .description('run teardown commands')
- * .action(function(dir, otherDirs) {
- * console.log('dir "%s"', dir);
- * if (otherDirs) {
- * otherDirs.forEach(function (oDir) {
- * console.log('dir "%s"', oDir);
- * });
- * }
- * });
- *
- * program
- * .command('*')
- * .description('deploy the given env')
- * .action(function(env) {
- * console.log('deploying "%s"', env);
- * });
- *
- * program.parse(process.argv);
- *
- * @param {String} name
- * @param {String} [desc] for git-style sub-commands
- * @return {Command} the new command
- * @api public
- */
-
-Command.prototype.command = function(name, desc, opts) {
- if (typeof desc === 'object' && desc !== null) {
- opts = desc;
- desc = null;
- }
- opts = opts || {};
- var args = name.split(/ +/);
- var cmd = new Command(args.shift());
-
- if (desc) {
- cmd.description(desc);
- this.executables = true;
- this._execs[cmd._name] = true;
- if (opts.isDefault) this.defaultExecutable = cmd._name;
- }
- cmd._noHelp = !!opts.noHelp;
- this.commands.push(cmd);
- cmd.parseExpectedArgs(args);
- cmd.parent = this;
-
- if (desc) return this;
- return cmd;
-};
-
-/**
- * Define argument syntax for the top-level command.
- *
- * @api public
- */
-
-Command.prototype.arguments = function(desc) {
- return this.parseExpectedArgs(desc.split(/ +/));
-};
-
-/**
- * Add an implicit `help [cmd]` subcommand
- * which invokes `--help` for the given command.
- *
- * @api private
- */
-
-Command.prototype.addImplicitHelpCommand = function() {
- this.command('help [cmd]', 'display help for [cmd]');
-};
-
-/**
- * Parse expected `args`.
- *
- * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
- *
- * @param {Array} args
- * @return {Command} for chaining
- * @api public
- */
-
-Command.prototype.parseExpectedArgs = function(args) {
- if (!args.length) return;
- var self = this;
- args.forEach(function(arg) {
- var argDetails = {
- required: false,
- name: '',
- variadic: false
- };
-
- switch (arg[0]) {
- case '<':
- argDetails.required = true;
- argDetails.name = arg.slice(1, -1);
- break;
- case '[':
- argDetails.name = arg.slice(1, -1);
- break;
- }
-
- if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') {
- argDetails.variadic = true;
- argDetails.name = argDetails.name.slice(0, -3);
- }
- if (argDetails.name) {
- self._args.push(argDetails);
- }
- });
- return this;
-};
-
-/**
- * Register callback `fn` for the command.
- *
- * Examples:
- *
- * program
- * .command('help')
- * .description('display verbose help')
- * .action(function() {
- * // output help here
- * });
- *
- * @param {Function} fn
- * @return {Command} for chaining
- * @api public
- */
-
-Command.prototype.action = function(fn) {
- var self = this;
- var listener = function(args, unknown) {
- // Parse any so-far unknown options
- args = args || [];
- unknown = unknown || [];
-
- var parsed = self.parseOptions(unknown);
-
- // Output help if necessary
- outputHelpIfNecessary(self, parsed.unknown);
-
- // If there are still any unknown options, then we simply
- // die, unless someone asked for help, in which case we give it
- // to them, and then we die.
- if (parsed.unknown.length > 0) {
- self.unknownOption(parsed.unknown[0]);
- }
-
- // Leftover arguments need to be pushed back. Fixes issue #56
- if (parsed.args.length) args = parsed.args.concat(args);
-
- self._args.forEach(function(arg, i) {
- if (arg.required && args[i] == null) {
- self.missingArgument(arg.name);
- } else if (arg.variadic) {
- if (i !== self._args.length - 1) {
- self.variadicArgNotLast(arg.name);
- }
-
- args[i] = args.splice(i);
- }
- });
-
- // Always append ourselves to the end of the arguments,
- // to make sure we match the number of arguments the user
- // expects
- if (self._args.length) {
- args[self._args.length] = self;
- } else {
- args.push(self);
- }
-
- fn.apply(self, args);
- };
- var parent = this.parent || this;
- var name = parent === this ? '*' : this._name;
- parent.on('command:' + name, listener);
- if (this._alias) parent.on('command:' + this._alias, listener);
- return this;
-};
-
-/**
- * Define option with `flags`, `description` and optional
- * coercion `fn`.
- *
- * The `flags` string should contain both the short and long flags,
- * separated by comma, a pipe or space. The following are all valid
- * all will output this way when `--help` is used.
- *
- * "-p, --pepper"
- * "-p|--pepper"
- * "-p --pepper"
- *
- * Examples:
- *
- * // simple boolean defaulting to false
- * program.option('-p, --pepper', 'add pepper');
- *
- * --pepper
- * program.pepper
- * // => Boolean
- *
- * // simple boolean defaulting to true
- * program.option('-C, --no-cheese', 'remove cheese');
- *
- * program.cheese
- * // => true
- *
- * --no-cheese
- * program.cheese
- * // => false
- *
- * // required argument
- * program.option('-C, --chdir <path>', 'change the working directory');
- *
- * --chdir /tmp
- * program.chdir
- * // => "/tmp"
- *
- * // optional argument
- * program.option('-c, --cheese [type]', 'add cheese [marble]');
- *
- * @param {String} flags
- * @param {String} description
- * @param {Function|*} [fn] or default
- * @param {*} [defaultValue]
- * @return {Command} for chaining
- * @api public
- */
-
-Command.prototype.option = function(flags, description, fn, defaultValue) {
- var self = this,
- option = new Option(flags, description),
- oname = option.name(),
- name = option.attributeName();
-
- // default as 3rd arg
- if (typeof fn !== 'function') {
- if (fn instanceof RegExp) {
- var regex = fn;
- fn = function(val, def) {
- var m = regex.exec(val);
- return m ? m[0] : def;
- };
- } else {
- defaultValue = fn;
- fn = null;
- }
- }
-
- // preassign default value only for --no-*, [optional], or <required>
- if (!option.bool || option.optional || option.required) {
- // when --no-* we make sure default is true
- if (!option.bool) defaultValue = true;
- // preassign only if we have a default
- if (defaultValue !== undefined) {
- self[name] = defaultValue;
- option.defaultValue = defaultValue;
- }
- }
-
- // register the option
- this.options.push(option);
-
- // when it's passed assign the value
- // and conditionally invoke the callback
- this.on('option:' + oname, function(val) {
- // coercion
- if (val !== null && fn) {
- val = fn(val, self[name] === undefined ? defaultValue : self[name]);
- }
-
- // unassigned or bool
- if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {
- // if no value, bool true, and we have a default, then use it!
- if (val == null) {
- self[name] = option.bool
- ? defaultValue || true
- : false;
- } else {
- self[name] = val;
- }
- } else if (val !== null) {
- // reassign
- self[name] = val;
- }
- });
-
- return this;
-};
-
-/**
- * Allow unknown options on the command line.
- *
- * @param {Boolean} arg if `true` or omitted, no error will be thrown
- * for unknown options.
- * @api public
- */
-Command.prototype.allowUnknownOption = function(arg) {
- this._allowUnknownOption = arguments.length === 0 || arg;
- return this;
-};
-
-/**
- * Parse `argv`, settings options and invoking commands when defined.
- *
- * @param {Array} argv
- * @return {Command} for chaining
- * @api public
- */
-
-Command.prototype.parse = function(argv) {
- // implicit help
- if (this.executables) this.addImplicitHelpCommand();
-
- // store raw args
- this.rawArgs = argv;
-
- // guess name
- this._name = this._name || basename(argv[1], '.js');
-
- // github-style sub-commands with no sub-command
- if (this.executables && argv.length < 3 && !this.defaultExecutable) {
- // this user needs help
- argv.push('--help');
- }
-
- // process argv
- var parsed = this.parseOptions(this.normalize(argv.slice(2)));
- var args = this.args = parsed.args;
-
- var result = this.parseArgs(this.args, parsed.unknown);
-
- // executable sub-commands
- var name = result.args[0];
-
- var aliasCommand = null;
- // check alias of sub commands
- if (name) {
- aliasCommand = this.commands.filter(function(command) {
- return command.alias() === name;
- })[0];
- }
-
- if (this._execs[name] === true) {
- return this.executeSubCommand(argv, args, parsed.unknown);
- } else if (aliasCommand) {
- // is alias of a subCommand
- args[0] = aliasCommand._name;
- return this.executeSubCommand(argv, args, parsed.unknown);
- } else if (this.defaultExecutable) {
- // use the default subcommand
- args.unshift(this.defaultExecutable);
- return this.executeSubCommand(argv, args, parsed.unknown);
- }
-
- return result;
-};
-
-/**
- * Execute a sub-command executable.
- *
- * @param {Array} argv
- * @param {Array} args
- * @param {Array} unknown
- * @api private
- */
-
-Command.prototype.executeSubCommand = function(argv, args, unknown) {
- args = args.concat(unknown);
-
- if (!args.length) this.help();
- if (args[0] === 'help' && args.length === 1) this.help();
-
- // <cmd> --help
- if (args[0] === 'help') {
- args[0] = args[1];
- args[1] = '--help';
- }
-
- // executable
- var f = argv[1];
- // name of the subcommand, link `pm-install`
- var bin = basename(f, path.extname(f)) + '-' + args[0];
-
- // In case of globally installed, get the base dir where executable
- // subcommand file should be located at
- var baseDir;
-
- var resolvedLink = fs.realpathSync(f);
-
- baseDir = dirname(resolvedLink);
-
- // prefer local `./<bin>` to bin in the $PATH
- var localBin = path.join(baseDir, bin);
-
- // whether bin file is a js script with explicit `.js` or `.ts` extension
- var isExplicitJS = false;
- if (exists(localBin + '.js')) {
- bin = localBin + '.js';
- isExplicitJS = true;
- } else if (exists(localBin + '.ts')) {
- bin = localBin + '.ts';
- isExplicitJS = true;
- } else if (exists(localBin)) {
- bin = localBin;
- }
-
- args = args.slice(1);
-
- var proc;
- if (process.platform !== 'win32') {
- if (isExplicitJS) {
- args.unshift(bin);
- // add executable arguments to spawn
- args = (process.execArgv || []).concat(args);
-
- proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] });
- } else {
- proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] });
- }
- } else {
- args.unshift(bin);
- proc = spawn(process.execPath, args, { stdio: 'inherit' });
- }
-
- var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];
- signals.forEach(function(signal) {
- process.on(signal, function() {
- if (proc.killed === false && proc.exitCode === null) {
- proc.kill(signal);
- }
- });
- });
- proc.on('close', process.exit.bind(process));
- proc.on('error', function(err) {
- if (err.code === 'ENOENT') {
- console.error('error: %s(1) does not exist, try --help', bin);
- } else if (err.code === 'EACCES') {
- console.error('error: %s(1) not executable. try chmod or run with root', bin);
- }
- process.exit(1);
- });
-
- // Store the reference to the child process
- this.runningCommand = proc;
-};
-
-/**
- * Normalize `args`, splitting joined short flags. For example
- * the arg "-abc" is equivalent to "-a -b -c".
- * This also normalizes equal sign and splits "--abc=def" into "--abc def".
- *
- * @param {Array} args
- * @return {Array}
- * @api private
- */
-
-Command.prototype.normalize = function(args) {
- var ret = [],
- arg,
- lastOpt,
- index;
-
- for (var i = 0, len = args.length; i < len; ++i) {
- arg = args[i];
- if (i > 0) {
- lastOpt = this.optionFor(args[i - 1]);
- }
-
- if (arg === '--') {
- // Honor option terminator
- ret = ret.concat(args.slice(i));
- break;
- } else if (lastOpt && lastOpt.required) {
- ret.push(arg);
- } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') {
- arg.slice(1).split('').forEach(function(c) {
- ret.push('-' + c);
- });
- } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
- ret.push(arg.slice(0, index), arg.slice(index + 1));
- } else {
- ret.push(arg);
- }
- }
-
- return ret;
-};
-
-/**
- * Parse command `args`.
- *
- * When listener(s) are available those
- * callbacks are invoked, otherwise the "*"
- * event is emitted and those actions are invoked.
- *
- * @param {Array} args
- * @return {Command} for chaining
- * @api private
- */
-
-Command.prototype.parseArgs = function(args, unknown) {
- var name;
-
- if (args.length) {
- name = args[0];
- if (this.listeners('command:' + name).length) {
- this.emit('command:' + args.shift(), args, unknown);
- } else {
- this.emit('command:*', args);
- }
- } else {
- outputHelpIfNecessary(this, unknown);
-
- // If there were no args and we have unknown options,
- // then they are extraneous and we need to error.
- if (unknown.length > 0) {
- this.unknownOption(unknown[0]);
- }
- if (this.commands.length === 0 &&
- this._args.filter(function(a) { return a.required; }).length === 0) {
- this.emit('command:*');
- }
- }
-
- return this;
-};
-
-/**
- * Return an option matching `arg` if any.
- *
- * @param {String} arg
- * @return {Option}
- * @api private
- */
-
-Command.prototype.optionFor = function(arg) {
- for (var i = 0, len = this.options.length; i < len; ++i) {
- if (this.options[i].is(arg)) {
- return this.options[i];
- }
- }
-};
-
-/**
- * Parse options from `argv` returning `argv`
- * void of these options.
- *
- * @param {Array} argv
- * @return {Array}
- * @api public
- */
-
-Command.prototype.parseOptions = function(argv) {
- var args = [],
- len = argv.length,
- literal,
- option,
- arg;
-
- var unknownOptions = [];
-
- // parse options
- for (var i = 0; i < len; ++i) {
- arg = argv[i];
-
- // literal args after --
- if (literal) {
- args.push(arg);
- continue;
- }
-
- if (arg === '--') {
- literal = true;
- continue;
- }
-
- // find matching Option
- option = this.optionFor(arg);
-
- // option is defined
- if (option) {
- // requires arg
- if (option.required) {
- arg = argv[++i];
- if (arg == null) return this.optionMissingArgument(option);
- this.emit('option:' + option.name(), arg);
- // optional arg
- } else if (option.optional) {
- arg = argv[i + 1];
- if (arg == null || (arg[0] === '-' && arg !== '-')) {
- arg = null;
- } else {
- ++i;
- }
- this.emit('option:' + option.name(), arg);
- // bool
- } else {
- this.emit('option:' + option.name());
- }
- continue;
- }
-
- // looks like an option
- if (arg.length > 1 && arg[0] === '-') {
- unknownOptions.push(arg);
-
- // If the next argument looks like it might be
- // an argument for this option, we pass it on.
- // If it isn't, then it'll simply be ignored
- if ((i + 1) < argv.length && argv[i + 1][0] !== '-') {
- unknownOptions.push(argv[++i]);
- }
- continue;
- }
-
- // arg
- args.push(arg);
- }
-
- return { args: args, unknown: unknownOptions };
-};
-
-/**
- * Return an object containing options as key-value pairs
- *
- * @return {Object}
- * @api public
- */
-Command.prototype.opts = function() {
- var result = {},
- len = this.options.length;
-
- for (var i = 0; i < len; i++) {
- var key = this.options[i].attributeName();
- result[key] = key === this._versionOptionName ? this._version : this[key];
- }
- return result;
-};
-
-/**
- * Argument `name` is missing.
- *
- * @param {String} name
- * @api private
- */
-
-Command.prototype.missingArgument = function(name) {
- console.error("error: missing required argument `%s'", name);
- process.exit(1);
-};
-
-/**
- * `Option` is missing an argument, but received `flag` or nothing.
- *
- * @param {String} option
- * @param {String} flag
- * @api private
- */
-
-Command.prototype.optionMissingArgument = function(option, flag) {
- if (flag) {
- console.error("error: option `%s' argument missing, got `%s'", option.flags, flag);
- } else {
- console.error("error: option `%s' argument missing", option.flags);
- }
- process.exit(1);
-};
-
-/**
- * Unknown option `flag`.
- *
- * @param {String} flag
- * @api private
- */
-
-Command.prototype.unknownOption = function(flag) {
- if (this._allowUnknownOption) return;
- console.error("error: unknown option `%s'", flag);
- process.exit(1);
-};
-
-/**
- * Variadic argument with `name` is not the last argument as required.
- *
- * @param {String} name
- * @api private
- */
-
-Command.prototype.variadicArgNotLast = function(name) {
- console.error("error: variadic arguments must be last `%s'", name);
- process.exit(1);
-};
-
-/**
- * Set the program version to `str`.
- *
- * This method auto-registers the "-V, --version" flag
- * which will print the version number when passed.
- *
- * @param {String} str
- * @param {String} [flags]
- * @return {Command} for chaining
- * @api public
- */
-
-Command.prototype.version = function(str, flags) {
- if (arguments.length === 0) return this._version;
- this._version = str;
- flags = flags || '-V, --version';
- var versionOption = new Option(flags, 'output the version number');
- this._versionOptionName = versionOption.long.substr(2) || 'version';
- this.options.push(versionOption);
- this.on('option:' + this._versionOptionName, function() {
- process.stdout.write(str + '\n');
- process.exit(0);
- });
- return this;
-};
-
-/**
- * Set the description to `str`.
- *
- * @param {String} str
- * @param {Object} argsDescription
- * @return {String|Command}
- * @api public
- */
-
-Command.prototype.description = function(str, argsDescription) {
- if (arguments.length === 0) return this._description;
- this._description = str;
- this._argsDescription = argsDescription;
- return this;
-};
-
-/**
- * Set an alias for the command
- *
- * @param {String} alias
- * @return {String|Command}
- * @api public
- */
-
-Command.prototype.alias = function(alias) {
- var command = this;
- if (this.commands.length !== 0) {
- command = this.commands[this.commands.length - 1];
- }
-
- if (arguments.length === 0) return command._alias;
-
- if (alias === command._name) throw new Error('Command alias can\'t be the same as its name');
-
- command._alias = alias;
- return this;
-};
-
-/**
- * Set / get the command usage `str`.
- *
- * @param {String} str
- * @return {String|Command}
- * @api public
- */
-
-Command.prototype.usage = function(str) {
- var args = this._args.map(function(arg) {
- return humanReadableArgName(arg);
- });
-
- var usage = '[options]' +
- (this.commands.length ? ' [command]' : '') +
- (this._args.length ? ' ' + args.join(' ') : '');
-
- if (arguments.length === 0) return this._usage || usage;
- this._usage = str;
-
- return this;
-};
-
-/**
- * Get or set the name of the command
- *
- * @param {String} str
- * @return {String|Command}
- * @api public
- */
-
-Command.prototype.name = function(str) {
- if (arguments.length === 0) return this._name;
- this._name = str;
- return this;
-};
-
-/**
- * Return prepared commands.
- *
- * @return {Array}
- * @api private
- */
-
-Command.prototype.prepareCommands = function() {
- return this.commands.filter(function(cmd) {
- return !cmd._noHelp;
- }).map(function(cmd) {
- var args = cmd._args.map(function(arg) {
- return humanReadableArgName(arg);
- }).join(' ');
-
- return [
- cmd._name +
- (cmd._alias ? '|' + cmd._alias : '') +
- (cmd.options.length ? ' [options]' : '') +
- (args ? ' ' + args : ''),
- cmd._description
- ];
- });
-};
-
-/**
- * Return the largest command length.
- *
- * @return {Number}
- * @api private
- */
-
-Command.prototype.largestCommandLength = function() {
- var commands = this.prepareCommands();
- return commands.reduce(function(max, command) {
- return Math.max(max, command[0].length);
- }, 0);
-};
-
-/**
- * Return the largest option length.
- *
- * @return {Number}
- * @api private
- */
-
-Command.prototype.largestOptionLength = function() {
- var options = [].slice.call(this.options);
- options.push({
- flags: '-h, --help'
- });
- return options.reduce(function(max, option) {
- return Math.max(max, option.flags.length);
- }, 0);
-};
-
-/**
- * Return the largest arg length.
- *
- * @return {Number}
- * @api private
- */
-
-Command.prototype.largestArgLength = function() {
- return this._args.reduce(function(max, arg) {
- return Math.max(max, arg.name.length);
- }, 0);
-};
-
-/**
- * Return the pad width.
- *
- * @return {Number}
- * @api private
- */
-
-Command.prototype.padWidth = function() {
- var width = this.largestOptionLength();
- if (this._argsDescription && this._args.length) {
- if (this.largestArgLength() > width) {
- width = this.largestArgLength();
- }
- }
-
- if (this.commands && this.commands.length) {
- if (this.largestCommandLength() > width) {
- width = this.largestCommandLength();
- }
- }
-
- return width;
-};
-
-/**
- * Return help for options.
- *
- * @return {String}
- * @api private
- */
-
-Command.prototype.optionHelp = function() {
- var width = this.padWidth();
-
- // Append the help information
- return this.options.map(function(option) {
- return pad(option.flags, width) + ' ' + option.description +
- ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
- }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])
- .join('\n');
-};
-
-/**
- * Return command help documentation.
- *
- * @return {String}
- * @api private
- */
-
-Command.prototype.commandHelp = function() {
- if (!this.commands.length) return '';
-
- var commands = this.prepareCommands();
- var width = this.padWidth();
-
- return [
- 'Commands:',
- commands.map(function(cmd) {
- var desc = cmd[1] ? ' ' + cmd[1] : '';
- return (desc ? pad(cmd[0], width) : cmd[0]) + desc;
- }).join('\n').replace(/^/gm, ' '),
- ''
- ].join('\n');
-};
-
-/**
- * Return program help documentation.
- *
- * @return {String}
- * @api private
- */
-
-Command.prototype.helpInformation = function() {
- var desc = [];
- if (this._description) {
- desc = [
- this._description,
- ''
- ];
-
- var argsDescription = this._argsDescription;
- if (argsDescription && this._args.length) {
- var width = this.padWidth();
- desc.push('Arguments:');
- desc.push('');
- this._args.forEach(function(arg) {
- desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]);
- });
- desc.push('');
- }
- }
-
- var cmdName = this._name;
- if (this._alias) {
- cmdName = cmdName + '|' + this._alias;
- }
- var usage = [
- 'Usage: ' + cmdName + ' ' + this.usage(),
- ''
- ];
-
- var cmds = [];
- var commandHelp = this.commandHelp();
- if (commandHelp) cmds = [commandHelp];
-
- var options = [
- 'Options:',
- '' + this.optionHelp().replace(/^/gm, ' '),
- ''
- ];
-
- return usage
- .concat(desc)
- .concat(options)
- .concat(cmds)
- .join('\n');
-};
-
-/**
- * Output help information for this command
- *
- * @api public
- */
-
-Command.prototype.outputHelp = function(cb) {
- if (!cb) {
- cb = function(passthru) {
- return passthru;
- };
- }
- process.stdout.write(cb(this.helpInformation()));
- this.emit('--help');
-};
-
-/**
- * Output help information and exit.
- *
- * @api public
- */
-
-Command.prototype.help = function(cb) {
- this.outputHelp(cb);
- process.exit();
-};
-
-/**
- * Camel-case the given `flag`
- *
- * @param {String} flag
- * @return {String}
- * @api private
- */
-
-function camelcase(flag) {
- return flag.split('-').reduce(function(str, word) {
- return str + word[0].toUpperCase() + word.slice(1);
- });
-}
-
-/**
- * Pad `str` to `width`.
- *
- * @param {String} str
- * @param {Number} width
- * @return {String}
- * @api private
- */
-
-function pad(str, width) {
- var len = Math.max(0, width - str.length);
- return str + Array(len + 1).join(' ');
-}
-
-/**
- * Output help information if necessary
- *
- * @param {Command} command to output help for
- * @param {Array} array of options to search for -h or --help
- * @api private
- */
-
-function outputHelpIfNecessary(cmd, options) {
- options = options || [];
- for (var i = 0; i < options.length; i++) {
- if (options[i] === '--help' || options[i] === '-h') {
- cmd.outputHelp();
- process.exit(0);
- }
- }
-}
-
-/**
- * Takes an argument an returns its human readable equivalent for help usage.
- *
- * @param {Object} arg
- * @return {String}
- * @api private
- */
-
-function humanReadableArgName(arg) {
- var nameOutput = arg.name + (arg.variadic === true ? '...' : '');
-
- return arg.required
- ? '<' + nameOutput + '>'
- : '[' + nameOutput + ']';
-}
-
-// for versions before node v0.8 when there weren't `fs.existsSync`
-function exists(file) {
- try {
- if (fs.statSync(file).isFile()) {
- return true;
- }
- } catch (e) {
- return false;
- }
-}
diff --git a/node_modules/commander/package.json b/node_modules/commander/package.json
deleted file mode 100644
index 38b6896..0000000
--- a/node_modules/commander/package.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "_from": "commander@^2.9.0",
- "_id": "commander@2.20.3",
- "_inBundle": false,
- "_integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "_location": "/commander",
- "_phantomChildren": {},
- "_requested": {
- "type": "range",
- "registry": true,
- "raw": "commander@^2.9.0",
- "name": "commander",
- "escapedName": "commander",
- "rawSpec": "^2.9.0",
- "saveSpec": null,
- "fetchSpec": "^2.9.0"
- },
- "_requiredBy": [
- "/xss"
- ],
- "_resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "_shasum": "fd485e84c03eb4881c20722ba48035e8531aeb33",
- "_spec": "commander@^2.9.0",
- "_where": "/home/cargova/projects/beziapp.github.io/node_modules/xss",
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca"
- },
- "bugs": {
- "url": "https://github.com/tj/commander.js/issues"
- },
- "bundleDependencies": false,
- "dependencies": {},
- "deprecated": false,
- "description": "the complete solution for node.js command-line programs",
- "devDependencies": {
- "@types/node": "^12.7.8",
- "eslint": "^6.4.0",
- "should": "^13.2.3",
- "sinon": "^7.5.0",
- "standard": "^14.3.1",
- "ts-node": "^8.4.1",
- "typescript": "^3.6.3"
- },
- "files": [
- "index.js",
- "typings/index.d.ts"
- ],
- "homepage": "https://github.com/tj/commander.js#readme",
- "keywords": [
- "commander",
- "command",
- "option",
- "parser"
- ],
- "license": "MIT",
- "main": "index",
- "name": "commander",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/tj/commander.js.git"
- },
- "scripts": {
- "lint": "eslint index.js",
- "test": "node test/run.js && npm run test-typings",
- "test-typings": "tsc -p tsconfig.json"
- },
- "typings": "typings/index.d.ts",
- "version": "2.20.3"
-}
diff --git a/node_modules/commander/typings/index.d.ts b/node_modules/commander/typings/index.d.ts
deleted file mode 100644
index bcda277..0000000
--- a/node_modules/commander/typings/index.d.ts
+++ /dev/null
@@ -1,310 +0,0 @@
-// Type definitions for commander 2.11
-// Project: https://github.com/visionmedia/commander.js
-// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-declare namespace local {
-
- class Option {
- flags: string;
- required: boolean;
- optional: boolean;
- bool: boolean;
- short?: string;
- long: string;
- description: string;
-
- /**
- * Initialize a new `Option` with the given `flags` and `description`.
- *
- * @param {string} flags
- * @param {string} [description]
- */
- constructor(flags: string, description?: string);
- }
-
- class Command extends NodeJS.EventEmitter {
- [key: string]: any;
-
- args: string[];
-
- /**
- * Initialize a new `Command`.
- *
- * @param {string} [name]
- */
- constructor(name?: string);
-
- /**
- * Set the program version to `str`.
- *
- * This method auto-registers the "-V, --version" flag
- * which will print the version number when passed.
- *
- * @param {string} str
- * @param {string} [flags]
- * @returns {Command} for chaining
- */
- version(str: string, flags?: string): Command;
-
- /**
- * Add command `name`.
- *
- * The `.action()` callback is invoked when the
- * command `name` is specified via __ARGV__,
- * and the remaining arguments are applied to the
- * function for access.
- *
- * When the `name` is "*" an un-matched command
- * will be passed as the first arg, followed by
- * the rest of __ARGV__ remaining.
- *
- * @example
- * program
- * .version('0.0.1')
- * .option('-C, --chdir <path>', 'change the working directory')
- * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
- * .option('-T, --no-tests', 'ignore test hook')
- *
- * program
- * .command('setup')
- * .description('run remote setup commands')
- * .action(function() {
- * console.log('setup');
- * });
- *
- * program
- * .command('exec <cmd>')
- * .description('run the given remote command')
- * .action(function(cmd) {
- * console.log('exec "%s"', cmd);
- * });
- *
- * program
- * .command('teardown <dir> [otherDirs...]')
- * .description('run teardown commands')
- * .action(function(dir, otherDirs) {
- * console.log('dir "%s"', dir);
- * if (otherDirs) {
- * otherDirs.forEach(function (oDir) {
- * console.log('dir "%s"', oDir);
- * });
- * }
- * });
- *
- * program
- * .command('*')
- * .description('deploy the given env')
- * .action(function(env) {
- * console.log('deploying "%s"', env);
- * });
- *
- * program.parse(process.argv);
- *
- * @param {string} name
- * @param {string} [desc] for git-style sub-commands
- * @param {CommandOptions} [opts] command options
- * @returns {Command} the new command
- */
- command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
-
- /**
- * Define argument syntax for the top-level command.
- *
- * @param {string} desc
- * @returns {Command} for chaining
- */
- arguments(desc: string): Command;
-
- /**
- * Parse expected `args`.
- *
- * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
- *
- * @param {string[]} args
- * @returns {Command} for chaining
- */
- parseExpectedArgs(args: string[]): Command;
-
- /**
- * Register callback `fn` for the command.
- *
- * @example
- * program
- * .command('help')
- * .description('display verbose help')
- * .action(function() {
- * // output help here
- * });
- *
- * @param {(...args: any[]) => void} fn
- * @returns {Command} for chaining
- */
- action(fn: (...args: any[]) => void): Command;
-
- /**
- * Define option with `flags`, `description` and optional
- * coercion `fn`.
- *
- * The `flags` string should contain both the short and long flags,
- * separated by comma, a pipe or space. The following are all valid
- * all will output this way when `--help` is used.
- *
- * "-p, --pepper"
- * "-p|--pepper"
- * "-p --pepper"
- *
- * @example
- * // simple boolean defaulting to false
- * program.option('-p, --pepper', 'add pepper');
- *
- * --pepper
- * program.pepper
- * // => Boolean
- *
- * // simple boolean defaulting to true
- * program.option('-C, --no-cheese', 'remove cheese');
- *
- * program.cheese
- * // => true
- *
- * --no-cheese
- * program.cheese
- * // => false
- *
- * // required argument
- * program.option('-C, --chdir <path>', 'change the working directory');
- *
- * --chdir /tmp
- * program.chdir
- * // => "/tmp"
- *
- * // optional argument
- * program.option('-c, --cheese [type]', 'add cheese [marble]');
- *
- * @param {string} flags
- * @param {string} [description]
- * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
- * @param {*} [defaultValue]
- * @returns {Command} for chaining
- */
- option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
- option(flags: string, description?: string, defaultValue?: any): Command;
-
- /**
- * Allow unknown options on the command line.
- *
- * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
- * @returns {Command} for chaining
- */
- allowUnknownOption(arg?: boolean): Command;
-
- /**
- * Parse `argv`, settings options and invoking commands when defined.
- *
- * @param {string[]} argv
- * @returns {Command} for chaining
- */
- parse(argv: string[]): Command;
-
- /**
- * Parse options from `argv` returning `argv` void of these options.
- *
- * @param {string[]} argv
- * @returns {ParseOptionsResult}
- */
- parseOptions(argv: string[]): commander.ParseOptionsResult;
-
- /**
- * Return an object containing options as key-value pairs
- *
- * @returns {{[key: string]: any}}
- */
- opts(): { [key: string]: any };
-
- /**
- * Set the description to `str`.
- *
- * @param {string} str
- * @param {{[argName: string]: string}} argsDescription
- * @return {(Command | string)}
- */
- description(str: string, argsDescription?: {[argName: string]: string}): Command;
- description(): string;
-
- /**
- * Set an alias for the command.
- *
- * @param {string} alias
- * @return {(Command | string)}
- */
- alias(alias: string): Command;
- alias(): string;
-
- /**
- * Set or get the command usage.
- *
- * @param {string} str
- * @return {(Command | string)}
- */
- usage(str: string): Command;
- usage(): string;
-
- /**
- * Set the name of the command.
- *
- * @param {string} str
- * @return {Command}
- */
- name(str: string): Command;
-
- /**
- * Get the name of the command.
- *
- * @return {string}
- */
- name(): string;
-
- /**
- * Output help information for this command.
- *
- * @param {(str: string) => string} [cb]
- */
- outputHelp(cb?: (str: string) => string): void;
-
- /** Output help information and exit.
- *
- * @param {(str: string) => string} [cb]
- */
- help(cb?: (str: string) => string): never;
- }
-
-}
-
-declare namespace commander {
-
- type Command = local.Command
-
- type Option = local.Option
-
- interface CommandOptions {
- noHelp?: boolean;
- isDefault?: boolean;
- }
-
- interface ParseOptionsResult {
- args: string[];
- unknown: string[];
- }
-
- interface CommanderStatic extends Command {
- Command: typeof local.Command;
- Option: typeof local.Option;
- CommandOptions: CommandOptions;
- ParseOptionsResult: ParseOptionsResult;
- }
-
-}
-
-declare const commander: commander.CommanderStatic;
-export = commander;
diff --git a/node_modules/cssfilter/LICENSE b/node_modules/cssfilter/LICENSE
deleted file mode 100644
index 49b61eb..0000000
--- a/node_modules/cssfilter/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 老雷
-
-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.
-
diff --git a/node_modules/cssfilter/README.md b/node_modules/cssfilter/README.md
deleted file mode 100644
index 21cd65d..0000000
--- a/node_modules/cssfilter/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-[![NPM version](https://badge.fury.io/js/cssfilter.png)](http://badge.fury.io/js/xss)
-[![Build Status](https://secure.travis-ci.org/leizongmin/js-css-filter.png?branch=master)](http://travis-ci.org/leizongmin/js-css-filter)
-[![Dependencies Status](https://david-dm.org/leizongmin/js-css-filter.png)](https://david-dm.org/leizongmin/js-css-filter)
-[![coveralls-image](https://img.shields.io/coveralls/leizongmin/js-css-filter.svg?style=flat-square)](https://coveralls.io/r/leizongmin/js-css-filter?branch=master)
-
-# cssfilter
-Sanitize untrusted CSS with a configuration specified by a Whitelist. 根据白名单过滤CSS
-
-
-## 安装
-
-```bash
-$ npm install cssfilter --save
-```
-
-
-## 使用方法
-
-```javascript
-var cssfilter = require('cssfilter');
-var css = cssfilter('position:fixed; /* this is comments */ width:100px; height:100px; background:#aaa;');
-console.log(css);
-// 输出:width:100px; height:100px; background:#aaa;
-// 因为position不在白名单允许范围
-```
-
-或者:
-
-```javascript
-options = {
- // 白名单,可选
- whiteList: {
- a: true, // true表示允许
- b: /^fixed|relative$/, // 正则test()返回true表示允许
- c: function (value) {
- // 返回true表示允许
- },
- d: false // 除以上三个以外,所有值均表示不允许
- },
- // 当匹配到一个在白名单中的属性时
- onAttr: function (name, value, options) {
- // name为属性名
- // value为属性值
- // 返回字符串表示覆盖此段CSS
- // 不返回任何值表示使用默认生成方法,即 name:value
- },
- // 当匹配到一个不在白名单中的属性时
- onIgnoreAttr: function (name, value, options) {
- // name为属性名
- // value为属性值
- // 返回字符串表示覆盖此段CSS
- // 不返回任何值表示使用默认生成方法,即将此段CSS去掉
- }
-};
-mycss = new cssfilter.FilterCSS(options);
-// then apply mycss.process()
-css = mycss.process('position:fixed; width:100px; height:100px; background:#aaa;');
-console.log(css);
-```
-
-
-## License
-
-```
-The MIT License (MIT)
-
-Copyright (c) 2015-2016 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
-
-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.
-```
diff --git a/node_modules/cssfilter/lib/css.js b/node_modules/cssfilter/lib/css.js
deleted file mode 100644
index 49e9707..0000000
--- a/node_modules/cssfilter/lib/css.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var DEFAULT = require('./default');
-var parseStyle = require('./parser');
-var _ = require('./util');
-
-
-/**
- * 返回值是否为空
- *
- * @param {Object} obj
- * @return {Boolean}
- */
-function isNull (obj) {
- return (obj === undefined || obj === null);
-}
-
-/**
- * 浅拷贝对象
- *
- * @param {Object} obj
- * @return {Object}
- */
-function shallowCopyObject (obj) {
- var ret = {};
- for (var i in obj) {
- ret[i] = obj[i];
- }
- return ret;
-}
-
-/**
- * 创建CSS过滤器
- *
- * @param {Object} options
- * - {Object} whiteList
- * - {Function} onAttr
- * - {Function} onIgnoreAttr
- * - {Function} safeAttrValue
- */
-function FilterCSS (options) {
- options = shallowCopyObject(options || {});
- options.whiteList = options.whiteList || DEFAULT.whiteList;
- options.onAttr = options.onAttr || DEFAULT.onAttr;
- options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT.onIgnoreAttr;
- options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;
- this.options = options;
-}
-
-FilterCSS.prototype.process = function (css) {
- // 兼容各种奇葩输入
- css = css || '';
- css = css.toString();
- if (!css) return '';
-
- var me = this;
- var options = me.options;
- var whiteList = options.whiteList;
- var onAttr = options.onAttr;
- var onIgnoreAttr = options.onIgnoreAttr;
- var safeAttrValue = options.safeAttrValue;
-
- var retCSS = parseStyle(css, function (sourcePosition, position, name, value, source) {
-
- var check = whiteList[name];
- var isWhite = false;
- if (check === true) isWhite = check;
- else if (typeof check === 'function') isWhite = check(value);
- else if (check instanceof RegExp) isWhite = check.test(value);
- if (isWhite !== true) isWhite = false;
-
- // 如果过滤后 value 为空则直接忽略
- value = safeAttrValue(name, value);
- if (!value) return;
-
- var opts = {
- position: position,
- sourcePosition: sourcePosition,
- source: source,
- isWhite: isWhite
- };
-
- if (isWhite) {
-
- var ret = onAttr(name, value, opts);
- if (isNull(ret)) {
- return name + ':' + value;
- } else {
- return ret;
- }
-
- } else {
-
- var ret = onIgnoreAttr(name, value, opts);
- if (!isNull(ret)) {
- return ret;
- }
-
- }
- });
-
- return retCSS;
-};
-
-
-module.exports = FilterCSS;
diff --git a/node_modules/cssfilter/lib/default.js b/node_modules/cssfilter/lib/default.js
deleted file mode 100644
index b677225..0000000
--- a/node_modules/cssfilter/lib/default.js
+++ /dev/null
@@ -1,398 +0,0 @@
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-function getDefaultWhiteList () {
- // 白名单值说明:
- // true: 允许该属性
- // Function: function (val) { } 返回true表示允许该属性,其他值均表示不允许
- // RegExp: regexp.test(val) 返回true表示允许该属性,其他值均表示不允许
- // 除上面列出的值外均表示不允许
- var whiteList = {};
-
- whiteList['align-content'] = false; // default: auto
- whiteList['align-items'] = false; // default: auto
- whiteList['align-self'] = false; // default: auto
- whiteList['alignment-adjust'] = false; // default: auto
- whiteList['alignment-baseline'] = false; // default: baseline
- whiteList['all'] = false; // default: depending on individual properties
- whiteList['anchor-point'] = false; // default: none
- whiteList['animation'] = false; // default: depending on individual properties
- whiteList['animation-delay'] = false; // default: 0
- whiteList['animation-direction'] = false; // default: normal
- whiteList['animation-duration'] = false; // default: 0
- whiteList['animation-fill-mode'] = false; // default: none
- whiteList['animation-iteration-count'] = false; // default: 1
- whiteList['animation-name'] = false; // default: none
- whiteList['animation-play-state'] = false; // default: running
- whiteList['animation-timing-function'] = false; // default: ease
- whiteList['azimuth'] = false; // default: center
- whiteList['backface-visibility'] = false; // default: visible
- whiteList['background'] = true; // default: depending on individual properties
- whiteList['background-attachment'] = true; // default: scroll
- whiteList['background-clip'] = true; // default: border-box
- whiteList['background-color'] = true; // default: transparent
- whiteList['background-image'] = true; // default: none
- whiteList['background-origin'] = true; // default: padding-box
- whiteList['background-position'] = true; // default: 0% 0%
- whiteList['background-repeat'] = true; // default: repeat
- whiteList['background-size'] = true; // default: auto
- whiteList['baseline-shift'] = false; // default: baseline
- whiteList['binding'] = false; // default: none
- whiteList['bleed'] = false; // default: 6pt
- whiteList['bookmark-label'] = false; // default: content()
- whiteList['bookmark-level'] = false; // default: none
- whiteList['bookmark-state'] = false; // default: open
- whiteList['border'] = true; // default: depending on individual properties
- whiteList['border-bottom'] = true; // default: depending on individual properties
- whiteList['border-bottom-color'] = true; // default: current color
- whiteList['border-bottom-left-radius'] = true; // default: 0
- whiteList['border-bottom-right-radius'] = true; // default: 0
- whiteList['border-bottom-style'] = true; // default: none
- whiteList['border-bottom-width'] = true; // default: medium
- whiteList['border-collapse'] = true; // default: separate
- whiteList['border-color'] = true; // default: depending on individual properties
- whiteList['border-image'] = true; // default: none
- whiteList['border-image-outset'] = true; // default: 0
- whiteList['border-image-repeat'] = true; // default: stretch
- whiteList['border-image-slice'] = true; // default: 100%
- whiteList['border-image-source'] = true; // default: none
- whiteList['border-image-width'] = true; // default: 1
- whiteList['border-left'] = true; // default: depending on individual properties
- whiteList['border-left-color'] = true; // default: current color
- whiteList['border-left-style'] = true; // default: none
- whiteList['border-left-width'] = true; // default: medium
- whiteList['border-radius'] = true; // default: 0
- whiteList['border-right'] = true; // default: depending on individual properties
- whiteList['border-right-color'] = true; // default: current color
- whiteList['border-right-style'] = true; // default: none
- whiteList['border-right-width'] = true; // default: medium
- whiteList['border-spacing'] = true; // default: 0
- whiteList['border-style'] = true; // default: depending on individual properties
- whiteList['border-top'] = true; // default: depending on individual properties
- whiteList['border-top-color'] = true; // default: current color
- whiteList['border-top-left-radius'] = true; // default: 0
- whiteList['border-top-right-radius'] = true; // default: 0
- whiteList['border-top-style'] = true; // default: none
- whiteList['border-top-width'] = true; // default: medium
- whiteList['border-width'] = true; // default: depending on individual properties
- whiteList['bottom'] = false; // default: auto
- whiteList['box-decoration-break'] = true; // default: slice
- whiteList['box-shadow'] = true; // default: none
- whiteList['box-sizing'] = true; // default: content-box
- whiteList['box-snap'] = true; // default: none
- whiteList['box-suppress'] = true; // default: show
- whiteList['break-after'] = true; // default: auto
- whiteList['break-before'] = true; // default: auto
- whiteList['break-inside'] = true; // default: auto
- whiteList['caption-side'] = false; // default: top
- whiteList['chains'] = false; // default: none
- whiteList['clear'] = true; // default: none
- whiteList['clip'] = false; // default: auto
- whiteList['clip-path'] = false; // default: none
- whiteList['clip-rule'] = false; // default: nonzero
- whiteList['color'] = true; // default: implementation dependent
- whiteList['color-interpolation-filters'] = true; // default: auto
- whiteList['column-count'] = false; // default: auto
- whiteList['column-fill'] = false; // default: balance
- whiteList['column-gap'] = false; // default: normal
- whiteList['column-rule'] = false; // default: depending on individual properties
- whiteList['column-rule-color'] = false; // default: current color
- whiteList['column-rule-style'] = false; // default: medium
- whiteList['column-rule-width'] = false; // default: medium
- whiteList['column-span'] = false; // default: none
- whiteList['column-width'] = false; // default: auto
- whiteList['columns'] = false; // default: depending on individual properties
- whiteList['contain'] = false; // default: none
- whiteList['content'] = false; // default: normal
- whiteList['counter-increment'] = false; // default: none
- whiteList['counter-reset'] = false; // default: none
- whiteList['counter-set'] = false; // default: none
- whiteList['crop'] = false; // default: auto
- whiteList['cue'] = false; // default: depending on individual properties
- whiteList['cue-after'] = false; // default: none
- whiteList['cue-before'] = false; // default: none
- whiteList['cursor'] = false; // default: auto
- whiteList['direction'] = false; // default: ltr
- whiteList['display'] = true; // default: depending on individual properties
- whiteList['display-inside'] = true; // default: auto
- whiteList['display-list'] = true; // default: none
- whiteList['display-outside'] = true; // default: inline-level
- whiteList['dominant-baseline'] = false; // default: auto
- whiteList['elevation'] = false; // default: level
- whiteList['empty-cells'] = false; // default: show
- whiteList['filter'] = false; // default: none
- whiteList['flex'] = false; // default: depending on individual properties
- whiteList['flex-basis'] = false; // default: auto
- whiteList['flex-direction'] = false; // default: row
- whiteList['flex-flow'] = false; // default: depending on individual properties
- whiteList['flex-grow'] = false; // default: 0
- whiteList['flex-shrink'] = false; // default: 1
- whiteList['flex-wrap'] = false; // default: nowrap
- whiteList['float'] = false; // default: none
- whiteList['float-offset'] = false; // default: 0 0
- whiteList['flood-color'] = false; // default: black
- whiteList['flood-opacity'] = false; // default: 1
- whiteList['flow-from'] = false; // default: none
- whiteList['flow-into'] = false; // default: none
- whiteList['font'] = true; // default: depending on individual properties
- whiteList['font-family'] = true; // default: implementation dependent
- whiteList['font-feature-settings'] = true; // default: normal
- whiteList['font-kerning'] = true; // default: auto
- whiteList['font-language-override'] = true; // default: normal
- whiteList['font-size'] = true; // default: medium
- whiteList['font-size-adjust'] = true; // default: none
- whiteList['font-stretch'] = true; // default: normal
- whiteList['font-style'] = true; // default: normal
- whiteList['font-synthesis'] = true; // default: weight style
- whiteList['font-variant'] = true; // default: normal
- whiteList['font-variant-alternates'] = true; // default: normal
- whiteList['font-variant-caps'] = true; // default: normal
- whiteList['font-variant-east-asian'] = true; // default: normal
- whiteList['font-variant-ligatures'] = true; // default: normal
- whiteList['font-variant-numeric'] = true; // default: normal
- whiteList['font-variant-position'] = true; // default: normal
- whiteList['font-weight'] = true; // default: normal
- whiteList['grid'] = false; // default: depending on individual properties
- whiteList['grid-area'] = false; // default: depending on individual properties
- whiteList['grid-auto-columns'] = false; // default: auto
- whiteList['grid-auto-flow'] = false; // default: none
- whiteList['grid-auto-rows'] = false; // default: auto
- whiteList['grid-column'] = false; // default: depending on individual properties
- whiteList['grid-column-end'] = false; // default: auto
- whiteList['grid-column-start'] = false; // default: auto
- whiteList['grid-row'] = false; // default: depending on individual properties
- whiteList['grid-row-end'] = false; // default: auto
- whiteList['grid-row-start'] = false; // default: auto
- whiteList['grid-template'] = false; // default: depending on individual properties
- whiteList['grid-template-areas'] = false; // default: none
- whiteList['grid-template-columns'] = false; // default: none
- whiteList['grid-template-rows'] = false; // default: none
- whiteList['hanging-punctuation'] = false; // default: none
- whiteList['height'] = true; // default: auto
- whiteList['hyphens'] = false; // default: manual
- whiteList['icon'] = false; // default: auto
- whiteList['image-orientation'] = false; // default: auto
- whiteList['image-resolution'] = false; // default: normal
- whiteList['ime-mode'] = false; // default: auto
- whiteList['initial-letters'] = false; // default: normal
- whiteList['inline-box-align'] = false; // default: last
- whiteList['justify-content'] = false; // default: auto
- whiteList['justify-items'] = false; // default: auto
- whiteList['justify-self'] = false; // default: auto
- whiteList['left'] = false; // default: auto
- whiteList['letter-spacing'] = true; // default: normal
- whiteList['lighting-color'] = true; // default: white
- whiteList['line-box-contain'] = false; // default: block inline replaced
- whiteList['line-break'] = false; // default: auto
- whiteList['line-grid'] = false; // default: match-parent
- whiteList['line-height'] = false; // default: normal
- whiteList['line-snap'] = false; // default: none
- whiteList['line-stacking'] = false; // default: depending on individual properties
- whiteList['line-stacking-ruby'] = false; // default: exclude-ruby
- whiteList['line-stacking-shift'] = false; // default: consider-shifts
- whiteList['line-stacking-strategy'] = false; // default: inline-line-height
- whiteList['list-style'] = true; // default: depending on individual properties
- whiteList['list-style-image'] = true; // default: none
- whiteList['list-style-position'] = true; // default: outside
- whiteList['list-style-type'] = true; // default: disc
- whiteList['margin'] = true; // default: depending on individual properties
- whiteList['margin-bottom'] = true; // default: 0
- whiteList['margin-left'] = true; // default: 0
- whiteList['margin-right'] = true; // default: 0
- whiteList['margin-top'] = true; // default: 0
- whiteList['marker-offset'] = false; // default: auto
- whiteList['marker-side'] = false; // default: list-item
- whiteList['marks'] = false; // default: none
- whiteList['mask'] = false; // default: border-box
- whiteList['mask-box'] = false; // default: see individual properties
- whiteList['mask-box-outset'] = false; // default: 0
- whiteList['mask-box-repeat'] = false; // default: stretch
- whiteList['mask-box-slice'] = false; // default: 0 fill
- whiteList['mask-box-source'] = false; // default: none
- whiteList['mask-box-width'] = false; // default: auto
- whiteList['mask-clip'] = false; // default: border-box
- whiteList['mask-image'] = false; // default: none
- whiteList['mask-origin'] = false; // default: border-box
- whiteList['mask-position'] = false; // default: center
- whiteList['mask-repeat'] = false; // default: no-repeat
- whiteList['mask-size'] = false; // default: border-box
- whiteList['mask-source-type'] = false; // default: auto
- whiteList['mask-type'] = false; // default: luminance
- whiteList['max-height'] = true; // default: none
- whiteList['max-lines'] = false; // default: none
- whiteList['max-width'] = true; // default: none
- whiteList['min-height'] = true; // default: 0
- whiteList['min-width'] = true; // default: 0
- whiteList['move-to'] = false; // default: normal
- whiteList['nav-down'] = false; // default: auto
- whiteList['nav-index'] = false; // default: auto
- whiteList['nav-left'] = false; // default: auto
- whiteList['nav-right'] = false; // default: auto
- whiteList['nav-up'] = false; // default: auto
- whiteList['object-fit'] = false; // default: fill
- whiteList['object-position'] = false; // default: 50% 50%
- whiteList['opacity'] = false; // default: 1
- whiteList['order'] = false; // default: 0
- whiteList['orphans'] = false; // default: 2
- whiteList['outline'] = false; // default: depending on individual properties
- whiteList['outline-color'] = false; // default: invert
- whiteList['outline-offset'] = false; // default: 0
- whiteList['outline-style'] = false; // default: none
- whiteList['outline-width'] = false; // default: medium
- whiteList['overflow'] = false; // default: depending on individual properties
- whiteList['overflow-wrap'] = false; // default: normal
- whiteList['overflow-x'] = false; // default: visible
- whiteList['overflow-y'] = false; // default: visible
- whiteList['padding'] = true; // default: depending on individual properties
- whiteList['padding-bottom'] = true; // default: 0
- whiteList['padding-left'] = true; // default: 0
- whiteList['padding-right'] = true; // default: 0
- whiteList['padding-top'] = true; // default: 0
- whiteList['page'] = false; // default: auto
- whiteList['page-break-after'] = false; // default: auto
- whiteList['page-break-before'] = false; // default: auto
- whiteList['page-break-inside'] = false; // default: auto
- whiteList['page-policy'] = false; // default: start
- whiteList['pause'] = false; // default: implementation dependent
- whiteList['pause-after'] = false; // default: implementation dependent
- whiteList['pause-before'] = false; // default: implementation dependent
- whiteList['perspective'] = false; // default: none
- whiteList['perspective-origin'] = false; // default: 50% 50%
- whiteList['pitch'] = false; // default: medium
- whiteList['pitch-range'] = false; // default: 50
- whiteList['play-during'] = false; // default: auto
- whiteList['position'] = false; // default: static
- whiteList['presentation-level'] = false; // default: 0
- whiteList['quotes'] = false; // default: text
- whiteList['region-fragment'] = false; // default: auto
- whiteList['resize'] = false; // default: none
- whiteList['rest'] = false; // default: depending on individual properties
- whiteList['rest-after'] = false; // default: none
- whiteList['rest-before'] = false; // default: none
- whiteList['richness'] = false; // default: 50
- whiteList['right'] = false; // default: auto
- whiteList['rotation'] = false; // default: 0
- whiteList['rotation-point'] = false; // default: 50% 50%
- whiteList['ruby-align'] = false; // default: auto
- whiteList['ruby-merge'] = false; // default: separate
- whiteList['ruby-position'] = false; // default: before
- whiteList['shape-image-threshold'] = false; // default: 0.0
- whiteList['shape-outside'] = false; // default: none
- whiteList['shape-margin'] = false; // default: 0
- whiteList['size'] = false; // default: auto
- whiteList['speak'] = false; // default: auto
- whiteList['speak-as'] = false; // default: normal
- whiteList['speak-header'] = false; // default: once
- whiteList['speak-numeral'] = false; // default: continuous
- whiteList['speak-punctuation'] = false; // default: none
- whiteList['speech-rate'] = false; // default: medium
- whiteList['stress'] = false; // default: 50
- whiteList['string-set'] = false; // default: none
- whiteList['tab-size'] = false; // default: 8
- whiteList['table-layout'] = false; // default: auto
- whiteList['text-align'] = true; // default: start
- whiteList['text-align-last'] = true; // default: auto
- whiteList['text-combine-upright'] = true; // default: none
- whiteList['text-decoration'] = true; // default: none
- whiteList['text-decoration-color'] = true; // default: currentColor
- whiteList['text-decoration-line'] = true; // default: none
- whiteList['text-decoration-skip'] = true; // default: objects
- whiteList['text-decoration-style'] = true; // default: solid
- whiteList['text-emphasis'] = true; // default: depending on individual properties
- whiteList['text-emphasis-color'] = true; // default: currentColor
- whiteList['text-emphasis-position'] = true; // default: over right
- whiteList['text-emphasis-style'] = true; // default: none
- whiteList['text-height'] = true; // default: auto
- whiteList['text-indent'] = true; // default: 0
- whiteList['text-justify'] = true; // default: auto
- whiteList['text-orientation'] = true; // default: mixed
- whiteList['text-overflow'] = true; // default: clip
- whiteList['text-shadow'] = true; // default: none
- whiteList['text-space-collapse'] = true; // default: collapse
- whiteList['text-transform'] = true; // default: none
- whiteList['text-underline-position'] = true; // default: auto
- whiteList['text-wrap'] = true; // default: normal
- whiteList['top'] = false; // default: auto
- whiteList['transform'] = false; // default: none
- whiteList['transform-origin'] = false; // default: 50% 50% 0
- whiteList['transform-style'] = false; // default: flat
- whiteList['transition'] = false; // default: depending on individual properties
- whiteList['transition-delay'] = false; // default: 0s
- whiteList['transition-duration'] = false; // default: 0s
- whiteList['transition-property'] = false; // default: all
- whiteList['transition-timing-function'] = false; // default: ease
- whiteList['unicode-bidi'] = false; // default: normal
- whiteList['vertical-align'] = false; // default: baseline
- whiteList['visibility'] = false; // default: visible
- whiteList['voice-balance'] = false; // default: center
- whiteList['voice-duration'] = false; // default: auto
- whiteList['voice-family'] = false; // default: implementation dependent
- whiteList['voice-pitch'] = false; // default: medium
- whiteList['voice-range'] = false; // default: medium
- whiteList['voice-rate'] = false; // default: normal
- whiteList['voice-stress'] = false; // default: normal
- whiteList['voice-volume'] = false; // default: medium
- whiteList['volume'] = false; // default: medium
- whiteList['white-space'] = false; // default: normal
- whiteList['widows'] = false; // default: 2
- whiteList['width'] = true; // default: auto
- whiteList['will-change'] = false; // default: auto
- whiteList['word-break'] = true; // default: normal
- whiteList['word-spacing'] = true; // default: normal
- whiteList['word-wrap'] = true; // default: normal
- whiteList['wrap-flow'] = false; // default: auto
- whiteList['wrap-through'] = false; // default: wrap
- whiteList['writing-mode'] = false; // default: horizontal-tb
- whiteList['z-index'] = false; // default: auto
-
- return whiteList;
-}
-
-
-/**
- * 匹配到白名单上的一个属性时
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @return {String}
- */
-function onAttr (name, value, options) {
- // do nothing
-}
-
-/**
- * 匹配到不在白名单上的一个属性时
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @return {String}
- */
-function onIgnoreAttr (name, value, options) {
- // do nothing
-}
-
-var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
-
-/**
- * 过滤属性值
- *
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function safeAttrValue(name, value) {
- if (REGEXP_URL_JAVASCRIPT.test(value)) return '';
- return value;
-}
-
-
-exports.whiteList = getDefaultWhiteList();
-exports.getDefaultWhiteList = getDefaultWhiteList;
-exports.onAttr = onAttr;
-exports.onIgnoreAttr = onIgnoreAttr;
-exports.safeAttrValue = safeAttrValue;
diff --git a/node_modules/cssfilter/lib/index.js b/node_modules/cssfilter/lib/index.js
deleted file mode 100644
index 712f55f..0000000
--- a/node_modules/cssfilter/lib/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var DEFAULT = require('./default');
-var FilterCSS = require('./css');
-
-
-/**
- * XSS过滤
- *
- * @param {String} css 要过滤的CSS代码
- * @param {Object} options 选项:whiteList, onAttr, onIgnoreAttr
- * @return {String}
- */
-function filterCSS (html, options) {
- var xss = new FilterCSS(options);
- return xss.process(html);
-}
-
-
-// 输出
-exports = module.exports = filterCSS;
-exports.FilterCSS = FilterCSS;
-for (var i in DEFAULT) exports[i] = DEFAULT[i];
-
-// 在浏览器端使用
-if (typeof window !== 'undefined') {
- window.filterCSS = module.exports;
-}
diff --git a/node_modules/cssfilter/lib/parser.js b/node_modules/cssfilter/lib/parser.js
deleted file mode 100644
index fcb9418..0000000
--- a/node_modules/cssfilter/lib/parser.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var _ = require('./util');
-
-
-/**
- * 解析style
- *
- * @param {String} css
- * @param {Function} onAttr 处理属性的函数
- * 参数格式: function (sourcePosition, position, name, value, source)
- * @return {String}
- */
-function parseStyle (css, onAttr) {
- css = _.trimRight(css);
- if (css[css.length - 1] !== ';') css += ';';
- var cssLength = css.length;
- var isParenthesisOpen = false;
- var lastPos = 0;
- var i = 0;
- var retCSS = '';
-
- function addNewAttr () {
- // 如果没有正常的闭合圆括号,则直接忽略当前属性
- if (!isParenthesisOpen) {
- var source = _.trim(css.slice(lastPos, i));
- var j = source.indexOf(':');
- if (j !== -1) {
- var name = _.trim(source.slice(0, j));
- var value = _.trim(source.slice(j + 1));
- // 必须有属性名称
- if (name) {
- var ret = onAttr(lastPos, retCSS.length, name, value, source);
- if (ret) retCSS += ret + '; ';
- }
- }
- }
- lastPos = i + 1;
- }
-
- for (; i < cssLength; i++) {
- var c = css[i];
- if (c === '/' && css[i + 1] === '*') {
- // 备注开始
- var j = css.indexOf('*/', i + 2);
- // 如果没有正常的备注结束,则后面的部分全部跳过
- if (j === -1) break;
- // 直接将当前位置调到备注结尾,并且初始化状态
- i = j + 1;
- lastPos = i + 1;
- isParenthesisOpen = false;
- } else if (c === '(') {
- isParenthesisOpen = true;
- } else if (c === ')') {
- isParenthesisOpen = false;
- } else if (c === ';') {
- if (isParenthesisOpen) {
- // 在圆括号里面,忽略
- } else {
- addNewAttr();
- }
- } else if (c === '\n') {
- addNewAttr();
- }
- }
-
- return _.trim(retCSS);
-}
-
-module.exports = parseStyle;
diff --git a/node_modules/cssfilter/lib/util.js b/node_modules/cssfilter/lib/util.js
deleted file mode 100644
index c8b4f7b..0000000
--- a/node_modules/cssfilter/lib/util.js
+++ /dev/null
@@ -1,35 +0,0 @@
-module.exports = {
- indexOf: function (arr, item) {
- var i, j;
- if (Array.prototype.indexOf) {
- return arr.indexOf(item);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- },
- forEach: function (arr, fn, scope) {
- var i, j;
- if (Array.prototype.forEach) {
- return arr.forEach(fn, scope);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- fn.call(scope, arr[i], i, arr);
- }
- },
- trim: function (str) {
- if (String.prototype.trim) {
- return str.trim();
- }
- return str.replace(/(^\s*)|(\s*$)/g, '');
- },
- trimRight: function (str) {
- if (String.prototype.trimRight) {
- return str.trimRight();
- }
- return str.replace(/(\s*$)/g, '');
- }
-};
diff --git a/node_modules/cssfilter/package.json b/node_modules/cssfilter/package.json
deleted file mode 100644
index 118566b..0000000
--- a/node_modules/cssfilter/package.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "_from": "cssfilter@0.0.10",
- "_id": "cssfilter@0.0.10",
- "_inBundle": false,
- "_integrity": "sha1-xtJnJjKi5cg+AT5oZKQs6N79IK4=",
- "_location": "/cssfilter",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "cssfilter@0.0.10",
- "name": "cssfilter",
- "escapedName": "cssfilter",
- "rawSpec": "0.0.10",
- "saveSpec": null,
- "fetchSpec": "0.0.10"
- },
- "_requiredBy": [
- "/xss"
- ],
- "_resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
- "_shasum": "c6d2672632a2e5c83e013e6864a42ce8defd20ae",
- "_spec": "cssfilter@0.0.10",
- "_where": "/home/cargova/projects/beziapp.github.io/node_modules/xss",
- "author": {
- "name": "Zongmin Lei",
- "email": "leizongmin@gmail.com"
- },
- "bugs": {
- "url": "https://github.com/leizongmin/js-css-filter/issues"
- },
- "bundleDependencies": false,
- "deprecated": false,
- "description": "Sanitize untrusted CSS with a configuration specified by a Whitelist. 根据白名单过滤CSS",
- "devDependencies": {
- "blanket": "^1.1.6",
- "browserify": "^13.1.1",
- "coveralls": "^2.11.14",
- "istanbul": "^0.4.5",
- "mocha": "^3.1.2",
- "should": "^11.1.1",
- "uglify-js": "^2.7.4"
- },
- "files": [
- "lib"
- ],
- "homepage": "https://github.com/leizongmin/js-css-filter",
- "keywords": [
- "sanitization",
- "xss",
- "sanitize",
- "sanitisation",
- "input",
- "security",
- "escape",
- "encode",
- "filter",
- "validator",
- "html",
- "css",
- "injection",
- "whitelist"
- ],
- "license": "MIT",
- "main": "lib/index.js",
- "name": "cssfilter",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/leizongmin/js-css-filter.git"
- },
- "scripts": {
- "build": "./build",
- "prepublish": "npm run test && npm run build",
- "test": "istanbul cover _mocha --report lcovonly -- -t 5000 -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
- },
- "version": "0.0.10"
-}
diff --git a/node_modules/xss/LICENSE b/node_modules/xss/LICENSE
deleted file mode 100644
index f840eb4..0000000
--- a/node_modules/xss/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2012-2018 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
-http://ucdok.com
-
-The MIT License
-
-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. \ No newline at end of file
diff --git a/node_modules/xss/README.md b/node_modules/xss/README.md
deleted file mode 100644
index 4f202f1..0000000
--- a/node_modules/xss/README.md
+++ /dev/null
@@ -1,499 +0,0 @@
-[![NPM version][npm-image]][npm-url]
-[![build status][travis-image]][travis-url]
-[![Test coverage][coveralls-image]][coveralls-url]
-[![David deps][david-image]][david-url]
-[![node version][node-image]][node-url]
-[![npm download][download-image]][download-url]
-[![npm license][license-image]][download-url]
-
-[npm-image]: https://img.shields.io/npm/v/xss.svg?style=flat-square
-[npm-url]: https://npmjs.org/package/xss
-[travis-image]: https://img.shields.io/travis/leizongmin/js-xss.svg?style=flat-square
-[travis-url]: https://travis-ci.org/leizongmin/js-xss
-[coveralls-image]: https://img.shields.io/coveralls/leizongmin/js-xss.svg?style=flat-square
-[coveralls-url]: https://coveralls.io/r/leizongmin/js-xss?branch=master
-[david-image]: https://img.shields.io/david/leizongmin/js-xss.svg?style=flat-square
-[david-url]: https://david-dm.org/leizongmin/js-xss
-[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
-[node-url]: http://nodejs.org/download/
-[download-image]: https://img.shields.io/npm/dm/xss.svg?style=flat-square
-[download-url]: https://npmjs.org/package/xss
-[license-image]: https://img.shields.io/npm/l/xss.svg
-
-# Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist.
-
-[![Greenkeeper badge](https://badges.greenkeeper.io/leizongmin/js-xss.svg)](https://greenkeeper.io/)
-
-![xss](https://nodei.co/npm/xss.png?downloads=true&stars=true)
-
----
-
-`xss` is a module used to filter input from users to prevent XSS attacks.
-([What is XSS attack?](http://en.wikipedia.org/wiki/Cross-site_scripting))
-
-**Project Homepage:** http://jsxss.com
-
-**Try Online:** http://jsxss.com/en/try.html
-
-**[中文版文档](https://github.com/leizongmin/js-xss/blob/master/README.zh.md)**
-
----
-
-## Features
-
-* Specifies HTML tags and their attributes allowed with whitelist
-* Handle any tags or attributes using custom function.
-
-## Reference
-
-* [XSS Filter Evasion Cheat Sheet](https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet)
-* [Data URI scheme](http://en.wikipedia.org/wiki/Data_URI_scheme)
-* [XSS with Data URI Scheme](http://hi.baidu.com/badzzzz/item/bdbafe83144619c199255f7b)
-
-## Benchmark (for references only)
-
-* the xss module: 8.2 MB/s
-* `xss()` function from module `validator@0.3.7`: 4.4 MB/s
-
-For test code please refer to `benchmark` directory.
-
-## They are using xss module
-
-* **nodeclub** - A Node.js bbs using MongoDB - https://github.com/cnodejs/nodeclub
-* **cnpmjs.org** - Private npm registry and web for Enterprise - https://github.com/cnpm/cnpmjs.org
-
-## Install
-
-### NPM
-
-```bash
-npm install xss
-```
-
-### Bower
-
-```bash
-bower install xss
-```
-
-Or
-
-```bash
-bower install https://github.com/leizongmin/js-xss.git
-```
-
-## Usages
-
-### On Node.js
-
-```javascript
-var xss = require("xss");
-var html = xss('<script>alert("xss");</script>');
-console.log(html);
-```
-
-### On Browser
-
-Shim mode (reference file `test/test.html`):
-
-```html
-<script src="https://rawgit.com/leizongmin/js-xss/master/dist/xss.js"></script>
-<script>
-// apply function filterXSS in the same way
-var html = filterXSS('<script>alert("xss");</scr' + 'ipt>');
-alert(html);
-</script>
-```
-
-AMD mode - shim:
-
-```html
-<script>
-require.config({
- baseUrl: './',
- paths: {
- xss: 'https://rawgit.com/leizongmin/js-xss/master/dist/xss.js'
- },
- shim: {
- xss: {exports: 'filterXSS'}
- }
-})
-require(['xss'], function (xss) {
- var html = xss('<script>alert("xss");</scr' + 'ipt>');
- alert(html);
-});
-</script>
-```
-
-**Notes: please don't use the URL https://rawgit.com/leizongmin/js-xss/master/dist/xss.js in production environment.**
-
-## Command Line Tool
-
-### Process File
-
-You can use the xss command line tool to process a file. Usage:
-
-```bash
-xss -i <input_file> -o <output_file>
-```
-
-Example:
-
-```bash
-xss -i origin.html -o target.html
-```
-
-### Active Test
-
-Run the following command, them you can type HTML
-code in the command-line, and check the filtered output:
-
-```bash
-xss -t
-```
-
-For more details, please run `$ xss -h` to see it.
-
-## Custom filter rules
-
-When using the `xss()` function, the second parameter could be used to specify
-custom rules:
-
-```javascript
-options = {}; // Custom rules
-html = xss('<script>alert("xss");</script>', options);
-```
-
-To avoid passing `options` every time, you can also do it in a faster way by
-creating a `FilterXSS` instance:
-
-```javascript
-options = {}; // Custom rules
-myxss = new xss.FilterXSS(options);
-// then apply myxss.process()
-html = myxss.process('<script>alert("xss");</script>');
-```
-
-Details of parameters in `options` would be described below.
-
-### Whitelist
-
-By specifying a `whiteList`, e.g. `{ 'tagName': [ 'attr-1', 'attr-2' ] }`. Tags
-and attributes not in the whitelist would be filter out. For example:
-
-```javascript
-// only tag a and its attributes href, title, target are allowed
-var options = {
- whiteList: {
- a: ["href", "title", "target"]
- }
-};
-// With the configuration specified above, the following HTML:
-// <a href="#" onclick="hello()"><i>Hello</i></a>
-// would become:
-// <a href="#">Hello</a>
-```
-
-For the default whitelist, please refer `xss.whiteList`.
-
-### Customize the handler function for matched tags
-
-By specifying the handler function with `onTag`:
-
-```javascript
-function onTag(tag, html, options) {
- // tag is the name of current tag, e.g. 'a' for tag <a>
- // html is the HTML of this tag, e.g. '<a>' for tag <a>
- // options is some addition informations:
- // isWhite boolean, whether the tag is in whitelist
- // isClosing boolean, whether the tag is a closing tag, e.g. true for </a>
- // position integer, the position of the tag in output result
- // sourcePosition integer, the position of the tag in input HTML source
- // If a string is returned, the current tag would be replaced with the string
- // If return nothing, the default measure would be taken:
- // If in whitelist: filter attributes using onTagAttr, as described below
- // If not in whitelist: handle by onIgnoreTag, as described below
-}
-```
-
-### Customize the handler function for attributes of matched tags
-
-By specifying the handler function with `onTagAttr`:
-
-```javascript
-function onTagAttr(tag, name, value, isWhiteAttr) {
- // tag is the name of current tag, e.g. 'a' for tag <a>
- // name is the name of current attribute, e.g. 'href' for href="#"
- // isWhiteAttr whether the attribute is in whitelist
- // If a string is returned, the attribute would be replaced with the string
- // If return nothing, the default measure would be taken:
- // If in whitelist: filter the value using safeAttrValue as described below
- // If not in whitelist: handle by onIgnoreTagAttr, as described below
-}
-```
-
-### Customize the handler function for tags not in the whitelist
-
-By specifying the handler function with `onIgnoreTag`:
-
-```javascript
-function onIgnoreTag(tag, html, options) {
- // Parameters are the same with onTag
- // If a string is returned, the tag would be replaced with the string
- // If return nothing, the default measure would be taken (specifies using
- // escape, as described below)
-}
-```
-
-### Customize the handler function for attributes not in the whitelist
-
-By specifying the handler function with `onIgnoreTagAttr`:
-
-```javascript
-function onIgnoreTagAttr(tag, name, value, isWhiteAttr) {
- // Parameters are the same with onTagAttr
- // If a string is returned, the value would be replaced with this string
- // If return nothing, then keep default (remove the attribute)
-}
-```
-
-### Customize escaping function for HTML
-
-By specifying the handler function with `escapeHtml`. Following is the default
-function **(Modification is not recommended)**:
-
-```javascript
-function escapeHtml(html) {
- return html.replace(/</g, "&lt;").replace(/>/g, "&gt;");
-}
-```
-
-### Customize escaping function for value of attributes
-
-By specifying the handler function with `safeAttrValue`:
-
-```javascript
-function safeAttrValue(tag, name, value) {
- // Parameters are the same with onTagAttr (without options)
- // Return the value as a string
-}
-```
-
-### Customize CSS filter
-
-If you allow the attribute `style`, the value will be processed by [cssfilter](https://github.com/leizongmin/js-css-filter) module. The cssfilter module includes a default css whitelist. You can specify the options for cssfilter module like this:
-
-```javascript
-myxss = new xss.FilterXSS({
- css: {
- whiteList: {
- position: /^fixed|relative$/,
- top: true,
- left: true
- }
- }
-});
-html = myxss.process('<script>alert("xss");</script>');
-```
-
-If you don't want to filter out the `style` content, just specify `false` to the `css` option:
-
-```javascript
-myxss = new xss.FilterXSS({
- css: false
-});
-```
-
-For more help, please see https://github.com/leizongmin/js-css-filter
-
-### Quick Start
-
-#### Filter out tags not in the whitelist
-
-By using `stripIgnoreTag` parameter:
-
-* `true` filter out tags not in the whitelist
-* `false`: by default: escape the tag using configured `escape` function
-
-Example:
-
-If `stripIgnoreTag = true` is set, the following code:
-
-```html
-code:<script>alert(/xss/);</script>
-```
-
-would output filtered:
-
-```html
-code:alert(/xss/);
-```
-
-#### Filter out tags and tag bodies not in the whitelist
-
-By using `stripIgnoreTagBody` parameter:
-
-* `false|null|undefined` by default: do nothing
-* `'*'|true`: filter out all tags not in the whitelist
-* `['tag1', 'tag2']`: filter out only specified tags not in the whitelist
-
-Example:
-
-If `stripIgnoreTagBody = ['script']` is set, the following code:
-
-```html
-code:<script>alert(/xss/);</script>
-```
-
-would output filtered:
-
-```html
-code:
-```
-
-#### Filter out HTML comments
-
-By using `allowCommentTag` parameter:
-
-* `true`: do nothing
-* `false` by default: filter out HTML comments
-
-Example:
-
-If `allowCommentTag = false` is set, the following code:
-
-```html
-code:<!-- something --> END
-```
-
-would output filtered:
-
-```html
-code: END
-```
-
-## Examples
-
-### Allow attributes of whitelist tags start with `data-`
-
-```javascript
-var source = '<div a="1" b="2" data-a="3" data-b="4">hello</div>';
-var html = xss(source, {
- onIgnoreTagAttr: function(tag, name, value, isWhiteAttr) {
- if (name.substr(0, 5) === "data-") {
- // escape its value using built-in escapeAttrValue function
- return name + '="' + xss.escapeAttrValue(value) + '"';
- }
- }
-});
-
-console.log("%s\nconvert to:\n%s", source, html);
-```
-
-Result:
-
-```html
-<div a="1" b="2" data-a="3" data-b="4">hello</div>
-convert to:
-<div data-a="3" data-b="4">hello</div>
-```
-
-### Allow tags start with `x-`
-
-```javascript
-var source = "<x><x-1>he<x-2 checked></x-2>wwww</x-1><a>";
-var html = xss(source, {
- onIgnoreTag: function(tag, html, options) {
- if (tag.substr(0, 2) === "x-") {
- // do not filter its attributes
- return html;
- }
- }
-});
-
-console.log("%s\nconvert to:\n%s", source, html);
-```
-
-Result:
-
-```html
-<x><x-1>he<x-2 checked></x-2>wwww</x-1><a>
-convert to:
-&lt;x&gt;<x-1>he<x-2 checked></x-2>wwww</x-1><a>
-```
-
-### Parse images in HTML
-
-```javascript
-var source =
- '<img src="img1">a<img src="img2">b<img src="img3">c<img src="img4">d';
-var list = [];
-var html = xss(source, {
- onTagAttr: function(tag, name, value, isWhiteAttr) {
- if (tag === "img" && name === "src") {
- // Use the built-in friendlyAttrValue function to escape attribute
- // values. It supports converting entity tags such as &lt; to printable
- // characters such as <
- list.push(xss.friendlyAttrValue(value));
- }
- // Return nothing, means keep the default handling measure
- }
-});
-
-console.log("image list:\n%s", list.join(", "));
-```
-
-Result:
-
-```html
-image list:
-img1, img2, img3, img4
-```
-
-### Filter out HTML tags (keeps only plain text)
-
-```javascript
-var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
-var html = xss(source, {
- whiteList: [], // empty, means filter out all tags
- stripIgnoreTag: true, // filter out all HTML not in the whilelist
- stripIgnoreTagBody: ["script"] // the script tag is a special case, we need
- // to filter out its content
-});
-
-console.log("text: %s", html);
-```
-
-Result:
-
-```html
-text: helloend
-```
-
-## License
-
-```text
-Copyright (c) 2012-2018 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
-http://ucdok.com
-
-The MIT License
-
-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.
-```
diff --git a/node_modules/xss/README.zh.md b/node_modules/xss/README.zh.md
deleted file mode 100644
index 2483d4d..0000000
--- a/node_modules/xss/README.zh.md
+++ /dev/null
@@ -1,485 +0,0 @@
-[![NPM version][npm-image]][npm-url]
-[![build status][travis-image]][travis-url]
-[![Test coverage][coveralls-image]][coveralls-url]
-[![David deps][david-image]][david-url]
-[![node version][node-image]][node-url]
-[![npm download][download-image]][download-url]
-[![npm license][license-image]][download-url]
-
-[npm-image]: https://img.shields.io/npm/v/xss.svg?style=flat-square
-[npm-url]: https://npmjs.org/package/xss
-[travis-image]: https://img.shields.io/travis/leizongmin/js-xss.svg?style=flat-square
-[travis-url]: https://travis-ci.org/leizongmin/js-xss
-[coveralls-image]: https://img.shields.io/coveralls/leizongmin/js-xss.svg?style=flat-square
-[coveralls-url]: https://coveralls.io/r/leizongmin/js-xss?branch=master
-[david-image]: https://img.shields.io/david/leizongmin/js-xss.svg?style=flat-square
-[david-url]: https://david-dm.org/leizongmin/js-xss
-[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
-[node-url]: http://nodejs.org/download/
-[download-image]: https://img.shields.io/npm/dm/xss.svg?style=flat-square
-[download-url]: https://npmjs.org/package/xss
-[license-image]: https://img.shields.io/npm/l/xss.svg
-
-# 根据白名单过滤 HTML(防止 XSS 攻击)
-
-![xss](https://nodei.co/npm/xss.png?downloads=true&stars=true)
-
----
-
-`xss`是一个用于对用户输入的内容进行过滤,以避免遭受 XSS 攻击的模块([什么是 XSS 攻击?](http://baike.baidu.com/view/2161269.htm))。主要用于论坛、博客、网上商店等等一些可允许用户录入页面排版、格式控制相关的 HTML 的场景,`xss`模块通过白名单来控制允许的标签及相关的标签属性,另外还提供了一系列的接口以便用户扩展,比其他同类模块更为灵活。
-
-**项目主页:** http://jsxss.com
-
-**在线测试:** http://jsxss.com/zh/try.html
-
----
-
-## 特性
-
-* 白名单控制允许的 HTML 标签及各标签的属性
-* 通过自定义处理函数,可对任意标签及其属性进行处理
-
-## 参考资料
-
-* [XSS 与字符编码的那些事儿 ---科普文](http://drops.wooyun.org/tips/689)
-* [腾讯实例教程:那些年我们一起学 XSS](http://www.wooyun.org/whitehats/%E5%BF%83%E4%BC%A4%E7%9A%84%E7%98%A6%E5%AD%90)
-* [mXSS 攻击的成因及常见种类](http://drops.wooyun.org/tips/956)
-* [XSS Filter Evasion Cheat Sheet](https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet)
-* [Data URI scheme](http://en.wikipedia.org/wiki/Data_URI_scheme)
-* [XSS with Data URI Scheme](http://hi.baidu.com/badzzzz/item/bdbafe83144619c199255f7b)
-
-## 性能(仅作参考)
-
-* xss 模块:8.2 MB/s
-* validator@0.3.7 模块的 xss()函数:4.4 MB/s
-
-测试代码参考 benchmark 目录
-
-## 安装
-
-### NPM
-
-```bash
-npm install xss
-```
-
-### Bower
-
-```bash
-bower install xss
-```
-
-或者
-
-```bash
-bower install https://github.com/leizongmin/js-xss.git
-```
-
-## 使用方法
-
-### 在 Node.js 中使用
-
-```javascript
-var xss = require("xss");
-var html = xss('<script>alert("xss");</script>');
-console.log(html);
-```
-
-### 在浏览器端使用
-
-Shim 模式(参考文件 `test/test.html`):
-
-```html
-<script src="https://rawgit.com/leizongmin/js-xss/master/dist/xss.js"></script>
-<script>
-// 使用函数名 filterXSS,用法一样
-var html = filterXSS('<script>alert("xss");</scr' + 'ipt>');
-alert(html);
-</script>
-```
-
-AMD 模式(参考文件 `test/test_amd.html`):
-
-```html
-<script>
-require.config({
- baseUrl: './',
- paths: {
- xss: 'https://rawgit.com/leizongmin/js-xss/master/dist/xss.js'
- },
- shim: {
- xss: {exports: 'filterXSS'}
- }
-})
-require(['xss'], function (xss) {
- var html = xss('<script>alert("xss");</scr' + 'ipt>');
- alert(html);
-});
-</script>
-```
-
-**说明:请勿将 URL https://rawgit.com/leizongmin/js-xss/master/dist/xss.js 用于生产环境。**
-
-### 使用命令行工具来对文件进行 XSS 处理
-
-### 处理文件
-
-可通过内置的 `xss` 命令来对输入的文件进行 XSS 处理。使用方法:
-
-```bash
-xss -i <源文件> -o <目标文件>
-```
-
-例:
-
-```bash
-xss -i origin.html -o target.html
-```
-
-### 在线测试
-
-执行以下命令,可在命令行中输入 HTML 代码,并看到过滤后的代码:
-
-```bash
-xss -t
-```
-
-详细命令行参数说明,请输入 `$ xss -h` 来查看。
-
-## 自定义过滤规则
-
-在调用 `xss()` 函数进行过滤时,可通过第二个参数来设置自定义规则:
-
-```javascript
-options = {}; // 自定义规则
-html = xss('<script>alert("xss");</script>', options);
-```
-
-如果不想每次都传入一个 `options` 参数,可以创建一个 `FilterXSS` 实例(使用这种方法速度更快):
-
-```
-options = {}; // 自定义规则
-myxss = new xss.FilterXSS(options);
-// 以后直接调用 myxss.process() 来处理即可
-html = myxss.process('<script>alert("xss");</script>');
-```
-
-`options` 参数的详细说明见下文。
-
-### 白名单
-
-通过 `whiteList` 来指定,格式为:`{'标签名': ['属性1', '属性2']}`。不在白名单上的标签将被过滤,不在白名单上的属性也会被过滤。以下是示例:
-
-```javascript
-// 只允许a标签,该标签只允许href, title, target这三个属性
-var options = {
- whiteList: {
- a: ["href", "title", "target"]
- }
-};
-// 使用以上配置后,下面的HTML
-// <a href="#" onclick="hello()"><i>大家好</i></a>
-// 将被过滤为
-// <a href="#">大家好</a>
-```
-
-默认白名单参考 `xss.whiteList`。
-
-### 自定义匹配到标签时的处理方法
-
-通过 `onTag` 来指定相应的处理函数。以下是详细说明:
-
-```javascript
-function onTag(tag, html, options) {
- // tag是当前的标签名称,比如<a>标签,则tag的值是'a'
- // html是该标签的HTML,比如<a>标签,则html的值是'<a>'
- // options是一些附加的信息,具体如下:
- // isWhite boolean类型,表示该标签是否在白名单上
- // isClosing boolean类型,表示该标签是否为闭合标签,比如</a>时为true
- // position integer类型,表示当前标签在输出的结果中的起始位置
- // sourcePosition integer类型,表示当前标签在原HTML中的起始位置
- // 如果返回一个字符串,则当前标签将被替换为该字符串
- // 如果不返回任何值,则使用默认的处理方法:
- // 在白名单上: 通过onTagAttr来过滤属性,详见下文
- // 不在白名单上:通过onIgnoreTag指定,详见下文
-}
-```
-
-### 自定义匹配到标签的属性时的处理方法
-
-通过 `onTagAttr` 来指定相应的处理函数。以下是详细说明:
-
-```javascript
-function onTagAttr(tag, name, value, isWhiteAttr) {
- // tag是当前的标签名称,比如<a>标签,则tag的值是'a'
- // name是当前属性的名称,比如href="#",则name的值是'href'
- // value是当前属性的值,比如href="#",则value的值是'#'
- // isWhiteAttr是否为白名单上的属性
- // 如果返回一个字符串,则当前属性值将被替换为该字符串
- // 如果不返回任何值,则使用默认的处理方法
- // 在白名单上: 调用safeAttrValue来过滤属性值,并输出该属性,详见下文
- // 不在白名单上:通过onIgnoreTagAttr指定,详见下文
-}
-```
-
-### 自定义匹配到不在白名单上的标签时的处理方法
-
-通过 `onIgnoreTag` 来指定相应的处理函数。以下是详细说明:
-
-```javascript
-function onIgnoreTag(tag, html, options) {
- // 参数说明与onTag相同
- // 如果返回一个字符串,则当前标签将被替换为该字符串
- // 如果不返回任何值,则使用默认的处理方法(通过escape指定,详见下文)
-}
-```
-
-### 自定义匹配到不在白名单上的属性时的处理方法
-
-通过 `onIgnoreTagAttr` 来指定相应的处理函数。以下是详细说明:
-
-```javascript
-function onIgnoreTagAttr(tag, name, value, isWhiteAttr) {
- // 参数说明与onTagAttr相同
- // 如果返回一个字符串,则当前属性值将被替换为该字符串
- // 如果不返回任何值,则使用默认的处理方法(删除该属)
-}
-```
-
-### 自定义 HTML 转义函数
-
-通过 `escapeHtml` 来指定相应的处理函数。以下是默认代码 **(不建议修改)** :
-
-```javascript
-function escapeHtml(html) {
- return html.replace(/</g, "&lt;").replace(/>/g, "&gt;");
-}
-```
-
-### 自定义标签属性值的转义函数
-
-通过 `safeAttrValue` 来指定相应的处理函数。以下是详细说明:
-
-```javascript
-function safeAttrValue(tag, name, value) {
- // 参数说明与onTagAttr相同(没有options参数)
- // 返回一个字符串表示该属性值
-}
-```
-
-### 自定义 CSS 过滤器
-
-如果配置中允许了标签的 `style` 属性,则它的值会通过[cssfilter](https://github.com/leizongmin/js-css-filter) 模块处理。
-`cssfilter` 模块包含了一个默认的 CSS 白名单,你可以通过以下的方式配置:
-
-```javascript
-myxss = new xss.FilterXSS({
- css: {
- whiteList: {
- position: /^fixed|relative$/,
- top: true,
- left: true
- }
- }
-});
-html = myxss.process('<script>alert("xss");</script>');
-```
-
-如果不想使用 CSS 过滤器来处理 `style` 属性的内容,可指定 `css` 选项的值为 `false`:
-
-```javascript
-myxss = new xss.FilterXSS({
- css: false
-});
-```
-
-要获取更多的帮助信息可看这里:https://github.com/leizongmin/js-css-filter
-
-### 快捷配置
-
-#### 去掉不在白名单上的标签
-
-通过 `stripIgnoreTag` 来设置:
-
-* `true`:去掉不在白名单上的标签
-* `false`:(默认),使用配置的`escape`函数对该标签进行转义
-
-示例:
-
-当设置 `stripIgnoreTag = true`时,以下代码
-
-```html
-code:<script>alert(/xss/);</script>
-```
-
-过滤后将输出
-
-```html
-code:alert(/xss/);
-```
-
-#### 去掉不在白名单上的标签及标签体
-
-通过 `stripIgnoreTagBody` 来设置:
-
-* `false|null|undefined`:(默认),不特殊处理
-* `'*'|true`:去掉所有不在白名单上的标签
-* `['tag1', 'tag2']`:仅去掉指定的不在白名单上的标签
-
-示例:
-
-当设置 `stripIgnoreTagBody = ['script']`时,以下代码
-
-```html
-code:<script>alert(/xss/);</script>
-```
-
-过滤后将输出
-
-```html
-code:
-```
-
-#### 去掉 HTML 备注
-
-通过 `allowCommentTag` 来设置:
-
-* `true`:不处理
-* `false`:(默认),自动去掉 HTML 中的备注
-
-示例:
-
-当设置 `allowCommentTag = false` 时,以下代码
-
-```html
-code:<!-- something --> END
-```
-
-过滤后将输出
-
-```html
-code: END
-```
-
-## 应用实例
-
-### 允许标签以 data-开头的属性
-
-```javascript
-var source = '<div a="1" b="2" data-a="3" data-b="4">hello</div>';
-var html = xss(source, {
- onIgnoreTagAttr: function(tag, name, value, isWhiteAttr) {
- if (name.substr(0, 5) === "data-") {
- // 通过内置的escapeAttrValue函数来对属性值进行转义
- return name + '="' + xss.escapeAttrValue(value) + '"';
- }
- }
-});
-
-console.log("%s\nconvert to:\n%s", source, html);
-```
-
-运行结果:
-
-```html
-<div a="1" b="2" data-a="3" data-b="4">hello</div>
-convert to:
-<div data-a="3" data-b="4">hello</div>
-```
-
-### 允许名称以 x-开头的标签
-
-```javascript
-var source = "<x><x-1>he<x-2 checked></x-2>wwww</x-1><a>";
-var html = xss(source, {
- onIgnoreTag: function(tag, html, options) {
- if (tag.substr(0, 2) === "x-") {
- // 不对其属性列表进行过滤
- return html;
- }
- }
-});
-
-console.log("%s\nconvert to:\n%s", source, html);
-```
-
-运行结果:
-
-```html
-<x><x-1>he<x-2 checked></x-2>wwww</x-1><a>
-convert to:
-&lt;x&gt;<x-1>he<x-2 checked></x-2>wwww</x-1><a>
-```
-
-### 分析 HTML 代码中的图片列表
-
-```javascript
-var source =
- '<img src="img1">a<img src="img2">b<img src="img3">c<img src="img4">d';
-var list = [];
-var html = xss(source, {
- onTagAttr: function(tag, name, value, isWhiteAttr) {
- if (tag === "img" && name === "src") {
- // 使用内置的friendlyAttrValue函数来对属性值进行转义,可将&lt;这类的实体标记转换成打印字符<
- list.push(xss.friendlyAttrValue(value));
- }
- // 不返回任何值,表示还是按照默认的方法处理
- }
-});
-
-console.log("image list:\n%s", list.join(", "));
-```
-
-运行结果:
-
-```html
-image list:
-img1, img2, img3, img4
-```
-
-### 去除 HTML 标签(只保留文本内容)
-
-```javascript
-var source = "<strong>hello</strong><script>alert(/xss/);</script>end";
-var html = xss(source, {
- whiteList: [], // 白名单为空,表示过滤所有标签
- stripIgnoreTag: true, // 过滤所有非白名单标签的HTML
- stripIgnoreTagBody: ["script"] // script标签较特殊,需要过滤标签中间的内容
-});
-
-console.log("text: %s", html);
-```
-
-运行结果:
-
-```html
-text: helloend
-```
-
-## 授权协议
-
-```text
-Copyright (c) 2012-2018 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
-http://ucdok.com
-
-The MIT License
-
-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.
-```
diff --git a/node_modules/xss/bin/xss b/node_modules/xss/bin/xss
deleted file mode 100755
index 35e902f..0000000
--- a/node_modules/xss/bin/xss
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * 命令行工具
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var fs = require('fs');
-var path = require('path');
-var program = require('commander');
-var xss = require('../');
-var packageInfo = require('../package.json');
-
-program
- .version(packageInfo.version)
- .option('-t, --test', 'active test')
- .option('-i, --input <input_file>', 'input file name')
- .option('-o, --output <output_file>', 'output filename')
- .option('-c, --config <config_file>', 'load custom config')
- .option('-s, --strip-ignore-tag', 'set stripIgnoreTag=true')
- .option('-b, --strip-ignore-tag-body', 'set stripIgnoreTagBody=true');
-
-program.on('--help', function () {
- console.log(' Examples:');
- console.log('');
- console.log(' $ xss -t');
- console.log(' $ xss -i origin.html');
- console.log(' $ xss -i origin.html -o targer.html');
- console.log(' $ xss -i origin.html -c config.js');
- console.log(' $ xss -i origin.html -s');
- console.log(' $ xss -i origin.html -s -b');
- console.log('');
- console.log(' For more details, please see: https://npmjs.org/package/xss')
-});
-
-program.parse(process.argv);
-
-if (program.test) {
- require('../lib/cli');
- return;
-}
-
-var config = {};
-if (program.config) {
- config = require(path.resolve(program.config));
-}
-if (program.input) {
- var input = fs.readFileSync(program.input, 'utf8');
-} else {
- program.help();
-}
-
-if (program['strip-ignore-tag']) {
- config.stripIgnoreTag = true;
-}
-if (program['strip-ignore-tag-body']) {
- config.stripIgnoreTagBody = true;
-}
-
-var output = xss(input, config);
-
-if (program.output) {
- fs.writeFileSync(program.output, output);
-} else {
- console.log(output);
-}
diff --git a/node_modules/xss/dist/test.html b/node_modules/xss/dist/test.html
deleted file mode 100644
index cae361e..0000000
--- a/node_modules/xss/dist/test.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>测试</title>
- <meta charset="utf8">
-</head>
-<body>
- <pre id="result"></pre>
-</body>
-</html>
-<script src="xss.js"></script>
-<script>
-var code = '<script>alert("xss");</' + 'script>';
-document.querySelector('#result').innerText = code + '\n被转换成了\n' + filterXSS(code);
-</script> \ No newline at end of file
diff --git a/node_modules/xss/dist/xss.js b/node_modules/xss/dist/xss.js
deleted file mode 100644
index 9583a6b..0000000
--- a/node_modules/xss/dist/xss.js
+++ /dev/null
@@ -1,1609 +0,0 @@
-(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){
-/**
- * default settings
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var FilterCSS = require("cssfilter").FilterCSS;
-var getDefaultCSSWhiteList = require("cssfilter").getDefaultWhiteList;
-var _ = require("./util");
-
-function getDefaultWhiteList() {
- return {
- a: ["target", "href", "title"],
- abbr: ["title"],
- address: [],
- area: ["shape", "coords", "href", "alt"],
- article: [],
- aside: [],
- audio: ["autoplay", "controls", "loop", "preload", "src"],
- b: [],
- bdi: ["dir"],
- bdo: ["dir"],
- big: [],
- blockquote: ["cite"],
- br: [],
- caption: [],
- center: [],
- cite: [],
- code: [],
- col: ["align", "valign", "span", "width"],
- colgroup: ["align", "valign", "span", "width"],
- dd: [],
- del: ["datetime"],
- details: ["open"],
- div: [],
- dl: [],
- dt: [],
- em: [],
- font: ["color", "size", "face"],
- footer: [],
- h1: [],
- h2: [],
- h3: [],
- h4: [],
- h5: [],
- h6: [],
- header: [],
- hr: [],
- i: [],
- img: ["src", "alt", "title", "width", "height"],
- ins: ["datetime"],
- li: [],
- mark: [],
- nav: [],
- ol: [],
- p: [],
- pre: [],
- s: [],
- section: [],
- small: [],
- span: [],
- sub: [],
- sup: [],
- strong: [],
- table: ["width", "border", "align", "valign"],
- tbody: ["align", "valign"],
- td: ["width", "rowspan", "colspan", "align", "valign"],
- tfoot: ["align", "valign"],
- th: ["width", "rowspan", "colspan", "align", "valign"],
- thead: ["align", "valign"],
- tr: ["rowspan", "align", "valign"],
- tt: [],
- u: [],
- ul: [],
- video: ["autoplay", "controls", "loop", "preload", "src", "height", "width"]
- };
-}
-
-var defaultCSSFilter = new FilterCSS();
-
-/**
- * default onTag function
- *
- * @param {String} tag
- * @param {String} html
- * @param {Object} options
- * @return {String}
- */
-function onTag(tag, html, options) {
- // do nothing
-}
-
-/**
- * default onIgnoreTag function
- *
- * @param {String} tag
- * @param {String} html
- * @param {Object} options
- * @return {String}
- */
-function onIgnoreTag(tag, html, options) {
- // do nothing
-}
-
-/**
- * default onTagAttr function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function onTagAttr(tag, name, value) {
- // do nothing
-}
-
-/**
- * default onIgnoreTagAttr function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function onIgnoreTagAttr(tag, name, value) {
- // do nothing
-}
-
-/**
- * default escapeHtml function
- *
- * @param {String} html
- */
-function escapeHtml(html) {
- return html.replace(REGEXP_LT, "&lt;").replace(REGEXP_GT, "&gt;");
-}
-
-/**
- * default safeAttrValue function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @param {Object} cssFilter
- * @return {String}
- */
-function safeAttrValue(tag, name, value, cssFilter) {
- // unescape attribute value firstly
- value = friendlyAttrValue(value);
-
- if (name === "href" || name === "src") {
- // filter `href` and `src` attribute
- // only allow the value that starts with `http://` | `https://` | `mailto:` | `/` | `#`
- value = _.trim(value);
- if (value === "#") return "#";
- if (
- !(
- value.substr(0, 7) === "http://" ||
- value.substr(0, 8) === "https://" ||
- value.substr(0, 7) === "mailto:" ||
- value.substr(0, 4) === "tel:" ||
- value[0] === "#" ||
- value[0] === "/"
- )
- ) {
- return "";
- }
- } else if (name === "background") {
- // filter `background` attribute (maybe no use)
- // `javascript:`
- REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
- return "";
- }
- } else if (name === "style") {
- // `expression()`
- REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) {
- return "";
- }
- // `url()`
- REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) {
- REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
- return "";
- }
- }
- if (cssFilter !== false) {
- cssFilter = cssFilter || defaultCSSFilter;
- value = cssFilter.process(value);
- }
- }
-
- // escape `<>"` before returns
- value = escapeAttrValue(value);
- return value;
-}
-
-// RegExp list
-var REGEXP_LT = /</g;
-var REGEXP_GT = />/g;
-var REGEXP_QUOTE = /"/g;
-var REGEXP_QUOTE_2 = /&quot;/g;
-var REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/gim;
-var REGEXP_ATTR_VALUE_COLON = /&colon;?/gim;
-var REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/gim;
-var REGEXP_DEFAULT_ON_TAG_ATTR_3 = /\/\*|\*\//gm;
-var REGEXP_DEFAULT_ON_TAG_ATTR_4 = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a)\:/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_5 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_6 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:\s*image\//gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_7 = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\s*r\s*l\s*\(.*/gi;
-
-/**
- * escape doube quote
- *
- * @param {String} str
- * @return {String} str
- */
-function escapeQuote(str) {
- return str.replace(REGEXP_QUOTE, "&quot;");
-}
-
-/**
- * unescape double quote
- *
- * @param {String} str
- * @return {String} str
- */
-function unescapeQuote(str) {
- return str.replace(REGEXP_QUOTE_2, '"');
-}
-
-/**
- * escape html entities
- *
- * @param {String} str
- * @return {String}
- */
-function escapeHtmlEntities(str) {
- return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode(str, code) {
- return code[0] === "x" || code[0] === "X"
- ? String.fromCharCode(parseInt(code.substr(1), 16))
- : String.fromCharCode(parseInt(code, 10));
- });
-}
-
-/**
- * escape html5 new danger entities
- *
- * @param {String} str
- * @return {String}
- */
-function escapeDangerHtml5Entities(str) {
- return str
- .replace(REGEXP_ATTR_VALUE_COLON, ":")
- .replace(REGEXP_ATTR_VALUE_NEWLINE, " ");
-}
-
-/**
- * clear nonprintable characters
- *
- * @param {String} str
- * @return {String}
- */
-function clearNonPrintableCharacter(str) {
- var str2 = "";
- for (var i = 0, len = str.length; i < len; i++) {
- str2 += str.charCodeAt(i) < 32 ? " " : str.charAt(i);
- }
- return _.trim(str2);
-}
-
-/**
- * get friendly attribute value
- *
- * @param {String} str
- * @return {String}
- */
-function friendlyAttrValue(str) {
- str = unescapeQuote(str);
- str = escapeHtmlEntities(str);
- str = escapeDangerHtml5Entities(str);
- str = clearNonPrintableCharacter(str);
- return str;
-}
-
-/**
- * unescape attribute value
- *
- * @param {String} str
- * @return {String}
- */
-function escapeAttrValue(str) {
- str = escapeQuote(str);
- str = escapeHtml(str);
- return str;
-}
-
-/**
- * `onIgnoreTag` function for removing all the tags that are not in whitelist
- */
-function onIgnoreTagStripAll() {
- return "";
-}
-
-/**
- * remove tag body
- * specify a `tags` list, if the tag is not in the `tags` list then process by the specify function (optional)
- *
- * @param {array} tags
- * @param {function} next
- */
-function StripTagBody(tags, next) {
- if (typeof next !== "function") {
- next = function() {};
- }
-
- var isRemoveAllTag = !Array.isArray(tags);
- function isRemoveTag(tag) {
- if (isRemoveAllTag) return true;
- return _.indexOf(tags, tag) !== -1;
- }
-
- var removeList = [];
- var posStart = false;
-
- return {
- onIgnoreTag: function(tag, html, options) {
- if (isRemoveTag(tag)) {
- if (options.isClosing) {
- var ret = "[/removed]";
- var end = options.position + ret.length;
- removeList.push([
- posStart !== false ? posStart : options.position,
- end
- ]);
- posStart = false;
- return ret;
- } else {
- if (!posStart) {
- posStart = options.position;
- }
- return "[removed]";
- }
- } else {
- return next(tag, html, options);
- }
- },
- remove: function(html) {
- var rethtml = "";
- var lastPos = 0;
- _.forEach(removeList, function(pos) {
- rethtml += html.slice(lastPos, pos[0]);
- lastPos = pos[1];
- });
- rethtml += html.slice(lastPos);
- return rethtml;
- }
- };
-}
-
-/**
- * remove html comments
- *
- * @param {String} html
- * @return {String}
- */
-function stripCommentTag(html) {
- return html.replace(STRIP_COMMENT_TAG_REGEXP, "");
-}
-var STRIP_COMMENT_TAG_REGEXP = /<!--[\s\S]*?-->/g;
-
-/**
- * remove invisible characters
- *
- * @param {String} html
- * @return {String}
- */
-function stripBlankChar(html) {
- var chars = html.split("");
- chars = chars.filter(function(char) {
- var c = char.charCodeAt(0);
- if (c === 127) return false;
- if (c <= 31) {
- if (c === 10 || c === 13) return true;
- return false;
- }
- return true;
- });
- return chars.join("");
-}
-
-exports.whiteList = getDefaultWhiteList();
-exports.getDefaultWhiteList = getDefaultWhiteList;
-exports.onTag = onTag;
-exports.onIgnoreTag = onIgnoreTag;
-exports.onTagAttr = onTagAttr;
-exports.onIgnoreTagAttr = onIgnoreTagAttr;
-exports.safeAttrValue = safeAttrValue;
-exports.escapeHtml = escapeHtml;
-exports.escapeQuote = escapeQuote;
-exports.unescapeQuote = unescapeQuote;
-exports.escapeHtmlEntities = escapeHtmlEntities;
-exports.escapeDangerHtml5Entities = escapeDangerHtml5Entities;
-exports.clearNonPrintableCharacter = clearNonPrintableCharacter;
-exports.friendlyAttrValue = friendlyAttrValue;
-exports.escapeAttrValue = escapeAttrValue;
-exports.onIgnoreTagStripAll = onIgnoreTagStripAll;
-exports.StripTagBody = StripTagBody;
-exports.stripCommentTag = stripCommentTag;
-exports.stripBlankChar = stripBlankChar;
-exports.cssFilter = defaultCSSFilter;
-exports.getDefaultCSSWhiteList = getDefaultCSSWhiteList;
-
-},{"./util":4,"cssfilter":8}],2:[function(require,module,exports){
-/**
- * xss
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var DEFAULT = require("./default");
-var parser = require("./parser");
-var FilterXSS = require("./xss");
-
-/**
- * filter xss function
- *
- * @param {String} html
- * @param {Object} options { whiteList, onTag, onTagAttr, onIgnoreTag, onIgnoreTagAttr, safeAttrValue, escapeHtml }
- * @return {String}
- */
-function filterXSS(html, options) {
- var xss = new FilterXSS(options);
- return xss.process(html);
-}
-
-exports = module.exports = filterXSS;
-exports.filterXSS = filterXSS;
-exports.FilterXSS = FilterXSS;
-for (var i in DEFAULT) exports[i] = DEFAULT[i];
-for (var i in parser) exports[i] = parser[i];
-
-// using `xss` on the browser, output `filterXSS` to the globals
-if (typeof window !== "undefined") {
- window.filterXSS = module.exports;
-}
-
-// using `xss` on the WebWorker, output `filterXSS` to the globals
-function isWorkerEnv() {
- return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
-}
-if (isWorkerEnv()) {
- self.filterXSS = module.exports;
-}
-
-},{"./default":1,"./parser":3,"./xss":5}],3:[function(require,module,exports){
-/**
- * Simple HTML Parser
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var _ = require("./util");
-
-/**
- * get tag name
- *
- * @param {String} html e.g. '<a hef="#">'
- * @return {String}
- */
-function getTagName(html) {
- var i = _.spaceIndex(html);
- if (i === -1) {
- var tagName = html.slice(1, -1);
- } else {
- var tagName = html.slice(1, i + 1);
- }
- tagName = _.trim(tagName).toLowerCase();
- if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1);
- if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1);
- return tagName;
-}
-
-/**
- * is close tag?
- *
- * @param {String} html 如:'<a hef="#">'
- * @return {Boolean}
- */
-function isClosing(html) {
- return html.slice(0, 2) === "</";
-}
-
-/**
- * parse input html and returns processed html
- *
- * @param {String} html
- * @param {Function} onTag e.g. function (sourcePosition, position, tag, html, isClosing)
- * @param {Function} escapeHtml
- * @return {String}
- */
-function parseTag(html, onTag, escapeHtml) {
- "user strict";
-
- var rethtml = "";
- var lastPos = 0;
- var tagStart = false;
- var quoteStart = false;
- var currentPos = 0;
- var len = html.length;
- var currentTagName = "";
- var currentHtml = "";
-
- for (currentPos = 0; currentPos < len; currentPos++) {
- var c = html.charAt(currentPos);
- if (tagStart === false) {
- if (c === "<") {
- tagStart = currentPos;
- continue;
- }
- } else {
- if (quoteStart === false) {
- if (c === "<") {
- rethtml += escapeHtml(html.slice(lastPos, currentPos));
- tagStart = currentPos;
- lastPos = currentPos;
- continue;
- }
- if (c === ">") {
- rethtml += escapeHtml(html.slice(lastPos, tagStart));
- currentHtml = html.slice(tagStart, currentPos + 1);
- currentTagName = getTagName(currentHtml);
- rethtml += onTag(
- tagStart,
- rethtml.length,
- currentTagName,
- currentHtml,
- isClosing(currentHtml)
- );
- lastPos = currentPos + 1;
- tagStart = false;
- continue;
- }
- if ((c === '"' || c === "'") && html.charAt(currentPos - 1) === "=") {
- quoteStart = c;
- continue;
- }
- } else {
- if (c === quoteStart) {
- quoteStart = false;
- continue;
- }
- }
- }
- }
- if (lastPos < html.length) {
- rethtml += escapeHtml(html.substr(lastPos));
- }
-
- return rethtml;
-}
-
-var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9_:\.\-]/gim;
-
-/**
- * parse input attributes and returns processed attributes
- *
- * @param {String} html e.g. `href="#" target="_blank"`
- * @param {Function} onAttr e.g. `function (name, value)`
- * @return {String}
- */
-function parseAttr(html, onAttr) {
- "user strict";
-
- var lastPos = 0;
- var retAttrs = [];
- var tmpName = false;
- var len = html.length;
-
- function addAttr(name, value) {
- name = _.trim(name);
- name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
- if (name.length < 1) return;
- var ret = onAttr(name, value || "");
- if (ret) retAttrs.push(ret);
- }
-
- // 逐个分析字符
- for (var i = 0; i < len; i++) {
- var c = html.charAt(i);
- var v, j;
- if (tmpName === false && c === "=") {
- tmpName = html.slice(lastPos, i);
- lastPos = i + 1;
- continue;
- }
- if (tmpName !== false) {
- if (
- i === lastPos &&
- (c === '"' || c === "'") &&
- html.charAt(i - 1) === "="
- ) {
- j = html.indexOf(c, i + 1);
- if (j === -1) {
- break;
- } else {
- v = _.trim(html.slice(lastPos + 1, j));
- addAttr(tmpName, v);
- tmpName = false;
- i = j;
- lastPos = i + 1;
- continue;
- }
- }
- }
- if (/\s|\n|\t/.test(c)) {
- html = html.replace(/\s|\n|\t/g, " ");
- if (tmpName === false) {
- j = findNextEqual(html, i);
- if (j === -1) {
- v = _.trim(html.slice(lastPos, i));
- addAttr(v);
- tmpName = false;
- lastPos = i + 1;
- continue;
- } else {
- i = j - 1;
- continue;
- }
- } else {
- j = findBeforeEqual(html, i - 1);
- if (j === -1) {
- v = _.trim(html.slice(lastPos, i));
- v = stripQuoteWrap(v);
- addAttr(tmpName, v);
- tmpName = false;
- lastPos = i + 1;
- continue;
- } else {
- continue;
- }
- }
- }
- }
-
- if (lastPos < html.length) {
- if (tmpName === false) {
- addAttr(html.slice(lastPos));
- } else {
- addAttr(tmpName, stripQuoteWrap(_.trim(html.slice(lastPos))));
- }
- }
-
- return _.trim(retAttrs.join(" "));
-}
-
-function findNextEqual(str, i) {
- for (; i < str.length; i++) {
- var c = str[i];
- if (c === " ") continue;
- if (c === "=") return i;
- return -1;
- }
-}
-
-function findBeforeEqual(str, i) {
- for (; i > 0; i--) {
- var c = str[i];
- if (c === " ") continue;
- if (c === "=") return i;
- return -1;
- }
-}
-
-function isQuoteWrapString(text) {
- if (
- (text[0] === '"' && text[text.length - 1] === '"') ||
- (text[0] === "'" && text[text.length - 1] === "'")
- ) {
- return true;
- } else {
- return false;
- }
-}
-
-function stripQuoteWrap(text) {
- if (isQuoteWrapString(text)) {
- return text.substr(1, text.length - 2);
- } else {
- return text;
- }
-}
-
-exports.parseTag = parseTag;
-exports.parseAttr = parseAttr;
-
-},{"./util":4}],4:[function(require,module,exports){
-module.exports = {
- indexOf: function(arr, item) {
- var i, j;
- if (Array.prototype.indexOf) {
- return arr.indexOf(item);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- },
- forEach: function(arr, fn, scope) {
- var i, j;
- if (Array.prototype.forEach) {
- return arr.forEach(fn, scope);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- fn.call(scope, arr[i], i, arr);
- }
- },
- trim: function(str) {
- if (String.prototype.trim) {
- return str.trim();
- }
- return str.replace(/(^\s*)|(\s*$)/g, "");
- },
- spaceIndex: function(str) {
- var reg = /\s|\n|\t/;
- var match = reg.exec(str);
- return match ? match.index : -1;
- }
-};
-
-},{}],5:[function(require,module,exports){
-/**
- * filter xss
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var FilterCSS = require("cssfilter").FilterCSS;
-var DEFAULT = require("./default");
-var parser = require("./parser");
-var parseTag = parser.parseTag;
-var parseAttr = parser.parseAttr;
-var _ = require("./util");
-
-/**
- * returns `true` if the input value is `undefined` or `null`
- *
- * @param {Object} obj
- * @return {Boolean}
- */
-function isNull(obj) {
- return obj === undefined || obj === null;
-}
-
-/**
- * get attributes for a tag
- *
- * @param {String} html
- * @return {Object}
- * - {String} html
- * - {Boolean} closing
- */
-function getAttrs(html) {
- var i = _.spaceIndex(html);
- if (i === -1) {
- return {
- html: "",
- closing: html[html.length - 2] === "/"
- };
- }
- html = _.trim(html.slice(i + 1, -1));
- var isClosing = html[html.length - 1] === "/";
- if (isClosing) html = _.trim(html.slice(0, -1));
- return {
- html: html,
- closing: isClosing
- };
-}
-
-/**
- * shallow copy
- *
- * @param {Object} obj
- * @return {Object}
- */
-function shallowCopyObject(obj) {
- var ret = {};
- for (var i in obj) {
- ret[i] = obj[i];
- }
- return ret;
-}
-
-/**
- * FilterXSS class
- *
- * @param {Object} options
- * whiteList, onTag, onTagAttr, onIgnoreTag,
- * onIgnoreTagAttr, safeAttrValue, escapeHtml
- * stripIgnoreTagBody, allowCommentTag, stripBlankChar
- * css{whiteList, onAttr, onIgnoreAttr} `css=false` means don't use `cssfilter`
- */
-function FilterXSS(options) {
- options = shallowCopyObject(options || {});
-
- if (options.stripIgnoreTag) {
- if (options.onIgnoreTag) {
- console.error(
- 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'
- );
- }
- options.onIgnoreTag = DEFAULT.onIgnoreTagStripAll;
- }
-
- options.whiteList = options.whiteList || DEFAULT.whiteList;
- options.onTag = options.onTag || DEFAULT.onTag;
- options.onTagAttr = options.onTagAttr || DEFAULT.onTagAttr;
- options.onIgnoreTag = options.onIgnoreTag || DEFAULT.onIgnoreTag;
- options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT.onIgnoreTagAttr;
- options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;
- options.escapeHtml = options.escapeHtml || DEFAULT.escapeHtml;
- this.options = options;
-
- if (options.css === false) {
- this.cssFilter = false;
- } else {
- options.css = options.css || {};
- this.cssFilter = new FilterCSS(options.css);
- }
-}
-
-/**
- * start process and returns result
- *
- * @param {String} html
- * @return {String}
- */
-FilterXSS.prototype.process = function(html) {
- // compatible with the input
- html = html || "";
- html = html.toString();
- if (!html) return "";
-
- var me = this;
- var options = me.options;
- var whiteList = options.whiteList;
- var onTag = options.onTag;
- var onIgnoreTag = options.onIgnoreTag;
- var onTagAttr = options.onTagAttr;
- var onIgnoreTagAttr = options.onIgnoreTagAttr;
- var safeAttrValue = options.safeAttrValue;
- var escapeHtml = options.escapeHtml;
- var cssFilter = me.cssFilter;
-
- // remove invisible characters
- if (options.stripBlankChar) {
- html = DEFAULT.stripBlankChar(html);
- }
-
- // remove html comments
- if (!options.allowCommentTag) {
- html = DEFAULT.stripCommentTag(html);
- }
-
- // if enable stripIgnoreTagBody
- var stripIgnoreTagBody = false;
- if (options.stripIgnoreTagBody) {
- var stripIgnoreTagBody = DEFAULT.StripTagBody(
- options.stripIgnoreTagBody,
- onIgnoreTag
- );
- onIgnoreTag = stripIgnoreTagBody.onIgnoreTag;
- }
-
- var retHtml = parseTag(
- html,
- function(sourcePosition, position, tag, html, isClosing) {
- var info = {
- sourcePosition: sourcePosition,
- position: position,
- isClosing: isClosing,
- isWhite: whiteList.hasOwnProperty(tag)
- };
-
- // call `onTag()`
- var ret = onTag(tag, html, info);
- if (!isNull(ret)) return ret;
-
- if (info.isWhite) {
- if (info.isClosing) {
- return "</" + tag + ">";
- }
-
- var attrs = getAttrs(html);
- var whiteAttrList = whiteList[tag];
- var attrsHtml = parseAttr(attrs.html, function(name, value) {
- // call `onTagAttr()`
- var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
- var ret = onTagAttr(tag, name, value, isWhiteAttr);
- if (!isNull(ret)) return ret;
-
- if (isWhiteAttr) {
- // call `safeAttrValue()`
- value = safeAttrValue(tag, name, value, cssFilter);
- if (value) {
- return name + '="' + value + '"';
- } else {
- return name;
- }
- } else {
- // call `onIgnoreTagAttr()`
- var ret = onIgnoreTagAttr(tag, name, value, isWhiteAttr);
- if (!isNull(ret)) return ret;
- return;
- }
- });
-
- // build new tag html
- var html = "<" + tag;
- if (attrsHtml) html += " " + attrsHtml;
- if (attrs.closing) html += " /";
- html += ">";
- return html;
- } else {
- // call `onIgnoreTag()`
- var ret = onIgnoreTag(tag, html, info);
- if (!isNull(ret)) return ret;
- return escapeHtml(html);
- }
- },
- escapeHtml
- );
-
- // if enable stripIgnoreTagBody
- if (stripIgnoreTagBody) {
- retHtml = stripIgnoreTagBody.remove(retHtml);
- }
-
- return retHtml;
-};
-
-module.exports = FilterXSS;
-
-},{"./default":1,"./parser":3,"./util":4,"cssfilter":8}],6:[function(require,module,exports){
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var DEFAULT = require('./default');
-var parseStyle = require('./parser');
-var _ = require('./util');
-
-
-/**
- * 返回值是否为空
- *
- * @param {Object} obj
- * @return {Boolean}
- */
-function isNull (obj) {
- return (obj === undefined || obj === null);
-}
-
-/**
- * 浅拷贝对象
- *
- * @param {Object} obj
- * @return {Object}
- */
-function shallowCopyObject (obj) {
- var ret = {};
- for (var i in obj) {
- ret[i] = obj[i];
- }
- return ret;
-}
-
-/**
- * 创建CSS过滤器
- *
- * @param {Object} options
- * - {Object} whiteList
- * - {Function} onAttr
- * - {Function} onIgnoreAttr
- * - {Function} safeAttrValue
- */
-function FilterCSS (options) {
- options = shallowCopyObject(options || {});
- options.whiteList = options.whiteList || DEFAULT.whiteList;
- options.onAttr = options.onAttr || DEFAULT.onAttr;
- options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT.onIgnoreAttr;
- options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;
- this.options = options;
-}
-
-FilterCSS.prototype.process = function (css) {
- // 兼容各种奇葩输入
- css = css || '';
- css = css.toString();
- if (!css) return '';
-
- var me = this;
- var options = me.options;
- var whiteList = options.whiteList;
- var onAttr = options.onAttr;
- var onIgnoreAttr = options.onIgnoreAttr;
- var safeAttrValue = options.safeAttrValue;
-
- var retCSS = parseStyle(css, function (sourcePosition, position, name, value, source) {
-
- var check = whiteList[name];
- var isWhite = false;
- if (check === true) isWhite = check;
- else if (typeof check === 'function') isWhite = check(value);
- else if (check instanceof RegExp) isWhite = check.test(value);
- if (isWhite !== true) isWhite = false;
-
- // 如果过滤后 value 为空则直接忽略
- value = safeAttrValue(name, value);
- if (!value) return;
-
- var opts = {
- position: position,
- sourcePosition: sourcePosition,
- source: source,
- isWhite: isWhite
- };
-
- if (isWhite) {
-
- var ret = onAttr(name, value, opts);
- if (isNull(ret)) {
- return name + ':' + value;
- } else {
- return ret;
- }
-
- } else {
-
- var ret = onIgnoreAttr(name, value, opts);
- if (!isNull(ret)) {
- return ret;
- }
-
- }
- });
-
- return retCSS;
-};
-
-
-module.exports = FilterCSS;
-
-},{"./default":7,"./parser":9,"./util":10}],7:[function(require,module,exports){
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-function getDefaultWhiteList () {
- // 白名单值说明:
- // true: 允许该属性
- // Function: function (val) { } 返回true表示允许该属性,其他值均表示不允许
- // RegExp: regexp.test(val) 返回true表示允许该属性,其他值均表示不允许
- // 除上面列出的值外均表示不允许
- var whiteList = {};
-
- whiteList['align-content'] = false; // default: auto
- whiteList['align-items'] = false; // default: auto
- whiteList['align-self'] = false; // default: auto
- whiteList['alignment-adjust'] = false; // default: auto
- whiteList['alignment-baseline'] = false; // default: baseline
- whiteList['all'] = false; // default: depending on individual properties
- whiteList['anchor-point'] = false; // default: none
- whiteList['animation'] = false; // default: depending on individual properties
- whiteList['animation-delay'] = false; // default: 0
- whiteList['animation-direction'] = false; // default: normal
- whiteList['animation-duration'] = false; // default: 0
- whiteList['animation-fill-mode'] = false; // default: none
- whiteList['animation-iteration-count'] = false; // default: 1
- whiteList['animation-name'] = false; // default: none
- whiteList['animation-play-state'] = false; // default: running
- whiteList['animation-timing-function'] = false; // default: ease
- whiteList['azimuth'] = false; // default: center
- whiteList['backface-visibility'] = false; // default: visible
- whiteList['background'] = true; // default: depending on individual properties
- whiteList['background-attachment'] = true; // default: scroll
- whiteList['background-clip'] = true; // default: border-box
- whiteList['background-color'] = true; // default: transparent
- whiteList['background-image'] = true; // default: none
- whiteList['background-origin'] = true; // default: padding-box
- whiteList['background-position'] = true; // default: 0% 0%
- whiteList['background-repeat'] = true; // default: repeat
- whiteList['background-size'] = true; // default: auto
- whiteList['baseline-shift'] = false; // default: baseline
- whiteList['binding'] = false; // default: none
- whiteList['bleed'] = false; // default: 6pt
- whiteList['bookmark-label'] = false; // default: content()
- whiteList['bookmark-level'] = false; // default: none
- whiteList['bookmark-state'] = false; // default: open
- whiteList['border'] = true; // default: depending on individual properties
- whiteList['border-bottom'] = true; // default: depending on individual properties
- whiteList['border-bottom-color'] = true; // default: current color
- whiteList['border-bottom-left-radius'] = true; // default: 0
- whiteList['border-bottom-right-radius'] = true; // default: 0
- whiteList['border-bottom-style'] = true; // default: none
- whiteList['border-bottom-width'] = true; // default: medium
- whiteList['border-collapse'] = true; // default: separate
- whiteList['border-color'] = true; // default: depending on individual properties
- whiteList['border-image'] = true; // default: none
- whiteList['border-image-outset'] = true; // default: 0
- whiteList['border-image-repeat'] = true; // default: stretch
- whiteList['border-image-slice'] = true; // default: 100%
- whiteList['border-image-source'] = true; // default: none
- whiteList['border-image-width'] = true; // default: 1
- whiteList['border-left'] = true; // default: depending on individual properties
- whiteList['border-left-color'] = true; // default: current color
- whiteList['border-left-style'] = true; // default: none
- whiteList['border-left-width'] = true; // default: medium
- whiteList['border-radius'] = true; // default: 0
- whiteList['border-right'] = true; // default: depending on individual properties
- whiteList['border-right-color'] = true; // default: current color
- whiteList['border-right-style'] = true; // default: none
- whiteList['border-right-width'] = true; // default: medium
- whiteList['border-spacing'] = true; // default: 0
- whiteList['border-style'] = true; // default: depending on individual properties
- whiteList['border-top'] = true; // default: depending on individual properties
- whiteList['border-top-color'] = true; // default: current color
- whiteList['border-top-left-radius'] = true; // default: 0
- whiteList['border-top-right-radius'] = true; // default: 0
- whiteList['border-top-style'] = true; // default: none
- whiteList['border-top-width'] = true; // default: medium
- whiteList['border-width'] = true; // default: depending on individual properties
- whiteList['bottom'] = false; // default: auto
- whiteList['box-decoration-break'] = true; // default: slice
- whiteList['box-shadow'] = true; // default: none
- whiteList['box-sizing'] = true; // default: content-box
- whiteList['box-snap'] = true; // default: none
- whiteList['box-suppress'] = true; // default: show
- whiteList['break-after'] = true; // default: auto
- whiteList['break-before'] = true; // default: auto
- whiteList['break-inside'] = true; // default: auto
- whiteList['caption-side'] = false; // default: top
- whiteList['chains'] = false; // default: none
- whiteList['clear'] = true; // default: none
- whiteList['clip'] = false; // default: auto
- whiteList['clip-path'] = false; // default: none
- whiteList['clip-rule'] = false; // default: nonzero
- whiteList['color'] = true; // default: implementation dependent
- whiteList['color-interpolation-filters'] = true; // default: auto
- whiteList['column-count'] = false; // default: auto
- whiteList['column-fill'] = false; // default: balance
- whiteList['column-gap'] = false; // default: normal
- whiteList['column-rule'] = false; // default: depending on individual properties
- whiteList['column-rule-color'] = false; // default: current color
- whiteList['column-rule-style'] = false; // default: medium
- whiteList['column-rule-width'] = false; // default: medium
- whiteList['column-span'] = false; // default: none
- whiteList['column-width'] = false; // default: auto
- whiteList['columns'] = false; // default: depending on individual properties
- whiteList['contain'] = false; // default: none
- whiteList['content'] = false; // default: normal
- whiteList['counter-increment'] = false; // default: none
- whiteList['counter-reset'] = false; // default: none
- whiteList['counter-set'] = false; // default: none
- whiteList['crop'] = false; // default: auto
- whiteList['cue'] = false; // default: depending on individual properties
- whiteList['cue-after'] = false; // default: none
- whiteList['cue-before'] = false; // default: none
- whiteList['cursor'] = false; // default: auto
- whiteList['direction'] = false; // default: ltr
- whiteList['display'] = true; // default: depending on individual properties
- whiteList['display-inside'] = true; // default: auto
- whiteList['display-list'] = true; // default: none
- whiteList['display-outside'] = true; // default: inline-level
- whiteList['dominant-baseline'] = false; // default: auto
- whiteList['elevation'] = false; // default: level
- whiteList['empty-cells'] = false; // default: show
- whiteList['filter'] = false; // default: none
- whiteList['flex'] = false; // default: depending on individual properties
- whiteList['flex-basis'] = false; // default: auto
- whiteList['flex-direction'] = false; // default: row
- whiteList['flex-flow'] = false; // default: depending on individual properties
- whiteList['flex-grow'] = false; // default: 0
- whiteList['flex-shrink'] = false; // default: 1
- whiteList['flex-wrap'] = false; // default: nowrap
- whiteList['float'] = false; // default: none
- whiteList['float-offset'] = false; // default: 0 0
- whiteList['flood-color'] = false; // default: black
- whiteList['flood-opacity'] = false; // default: 1
- whiteList['flow-from'] = false; // default: none
- whiteList['flow-into'] = false; // default: none
- whiteList['font'] = true; // default: depending on individual properties
- whiteList['font-family'] = true; // default: implementation dependent
- whiteList['font-feature-settings'] = true; // default: normal
- whiteList['font-kerning'] = true; // default: auto
- whiteList['font-language-override'] = true; // default: normal
- whiteList['font-size'] = true; // default: medium
- whiteList['font-size-adjust'] = true; // default: none
- whiteList['font-stretch'] = true; // default: normal
- whiteList['font-style'] = true; // default: normal
- whiteList['font-synthesis'] = true; // default: weight style
- whiteList['font-variant'] = true; // default: normal
- whiteList['font-variant-alternates'] = true; // default: normal
- whiteList['font-variant-caps'] = true; // default: normal
- whiteList['font-variant-east-asian'] = true; // default: normal
- whiteList['font-variant-ligatures'] = true; // default: normal
- whiteList['font-variant-numeric'] = true; // default: normal
- whiteList['font-variant-position'] = true; // default: normal
- whiteList['font-weight'] = true; // default: normal
- whiteList['grid'] = false; // default: depending on individual properties
- whiteList['grid-area'] = false; // default: depending on individual properties
- whiteList['grid-auto-columns'] = false; // default: auto
- whiteList['grid-auto-flow'] = false; // default: none
- whiteList['grid-auto-rows'] = false; // default: auto
- whiteList['grid-column'] = false; // default: depending on individual properties
- whiteList['grid-column-end'] = false; // default: auto
- whiteList['grid-column-start'] = false; // default: auto
- whiteList['grid-row'] = false; // default: depending on individual properties
- whiteList['grid-row-end'] = false; // default: auto
- whiteList['grid-row-start'] = false; // default: auto
- whiteList['grid-template'] = false; // default: depending on individual properties
- whiteList['grid-template-areas'] = false; // default: none
- whiteList['grid-template-columns'] = false; // default: none
- whiteList['grid-template-rows'] = false; // default: none
- whiteList['hanging-punctuation'] = false; // default: none
- whiteList['height'] = true; // default: auto
- whiteList['hyphens'] = false; // default: manual
- whiteList['icon'] = false; // default: auto
- whiteList['image-orientation'] = false; // default: auto
- whiteList['image-resolution'] = false; // default: normal
- whiteList['ime-mode'] = false; // default: auto
- whiteList['initial-letters'] = false; // default: normal
- whiteList['inline-box-align'] = false; // default: last
- whiteList['justify-content'] = false; // default: auto
- whiteList['justify-items'] = false; // default: auto
- whiteList['justify-self'] = false; // default: auto
- whiteList['left'] = false; // default: auto
- whiteList['letter-spacing'] = true; // default: normal
- whiteList['lighting-color'] = true; // default: white
- whiteList['line-box-contain'] = false; // default: block inline replaced
- whiteList['line-break'] = false; // default: auto
- whiteList['line-grid'] = false; // default: match-parent
- whiteList['line-height'] = false; // default: normal
- whiteList['line-snap'] = false; // default: none
- whiteList['line-stacking'] = false; // default: depending on individual properties
- whiteList['line-stacking-ruby'] = false; // default: exclude-ruby
- whiteList['line-stacking-shift'] = false; // default: consider-shifts
- whiteList['line-stacking-strategy'] = false; // default: inline-line-height
- whiteList['list-style'] = true; // default: depending on individual properties
- whiteList['list-style-image'] = true; // default: none
- whiteList['list-style-position'] = true; // default: outside
- whiteList['list-style-type'] = true; // default: disc
- whiteList['margin'] = true; // default: depending on individual properties
- whiteList['margin-bottom'] = true; // default: 0
- whiteList['margin-left'] = true; // default: 0
- whiteList['margin-right'] = true; // default: 0
- whiteList['margin-top'] = true; // default: 0
- whiteList['marker-offset'] = false; // default: auto
- whiteList['marker-side'] = false; // default: list-item
- whiteList['marks'] = false; // default: none
- whiteList['mask'] = false; // default: border-box
- whiteList['mask-box'] = false; // default: see individual properties
- whiteList['mask-box-outset'] = false; // default: 0
- whiteList['mask-box-repeat'] = false; // default: stretch
- whiteList['mask-box-slice'] = false; // default: 0 fill
- whiteList['mask-box-source'] = false; // default: none
- whiteList['mask-box-width'] = false; // default: auto
- whiteList['mask-clip'] = false; // default: border-box
- whiteList['mask-image'] = false; // default: none
- whiteList['mask-origin'] = false; // default: border-box
- whiteList['mask-position'] = false; // default: center
- whiteList['mask-repeat'] = false; // default: no-repeat
- whiteList['mask-size'] = false; // default: border-box
- whiteList['mask-source-type'] = false; // default: auto
- whiteList['mask-type'] = false; // default: luminance
- whiteList['max-height'] = true; // default: none
- whiteList['max-lines'] = false; // default: none
- whiteList['max-width'] = true; // default: none
- whiteList['min-height'] = true; // default: 0
- whiteList['min-width'] = true; // default: 0
- whiteList['move-to'] = false; // default: normal
- whiteList['nav-down'] = false; // default: auto
- whiteList['nav-index'] = false; // default: auto
- whiteList['nav-left'] = false; // default: auto
- whiteList['nav-right'] = false; // default: auto
- whiteList['nav-up'] = false; // default: auto
- whiteList['object-fit'] = false; // default: fill
- whiteList['object-position'] = false; // default: 50% 50%
- whiteList['opacity'] = false; // default: 1
- whiteList['order'] = false; // default: 0
- whiteList['orphans'] = false; // default: 2
- whiteList['outline'] = false; // default: depending on individual properties
- whiteList['outline-color'] = false; // default: invert
- whiteList['outline-offset'] = false; // default: 0
- whiteList['outline-style'] = false; // default: none
- whiteList['outline-width'] = false; // default: medium
- whiteList['overflow'] = false; // default: depending on individual properties
- whiteList['overflow-wrap'] = false; // default: normal
- whiteList['overflow-x'] = false; // default: visible
- whiteList['overflow-y'] = false; // default: visible
- whiteList['padding'] = true; // default: depending on individual properties
- whiteList['padding-bottom'] = true; // default: 0
- whiteList['padding-left'] = true; // default: 0
- whiteList['padding-right'] = true; // default: 0
- whiteList['padding-top'] = true; // default: 0
- whiteList['page'] = false; // default: auto
- whiteList['page-break-after'] = false; // default: auto
- whiteList['page-break-before'] = false; // default: auto
- whiteList['page-break-inside'] = false; // default: auto
- whiteList['page-policy'] = false; // default: start
- whiteList['pause'] = false; // default: implementation dependent
- whiteList['pause-after'] = false; // default: implementation dependent
- whiteList['pause-before'] = false; // default: implementation dependent
- whiteList['perspective'] = false; // default: none
- whiteList['perspective-origin'] = false; // default: 50% 50%
- whiteList['pitch'] = false; // default: medium
- whiteList['pitch-range'] = false; // default: 50
- whiteList['play-during'] = false; // default: auto
- whiteList['position'] = false; // default: static
- whiteList['presentation-level'] = false; // default: 0
- whiteList['quotes'] = false; // default: text
- whiteList['region-fragment'] = false; // default: auto
- whiteList['resize'] = false; // default: none
- whiteList['rest'] = false; // default: depending on individual properties
- whiteList['rest-after'] = false; // default: none
- whiteList['rest-before'] = false; // default: none
- whiteList['richness'] = false; // default: 50
- whiteList['right'] = false; // default: auto
- whiteList['rotation'] = false; // default: 0
- whiteList['rotation-point'] = false; // default: 50% 50%
- whiteList['ruby-align'] = false; // default: auto
- whiteList['ruby-merge'] = false; // default: separate
- whiteList['ruby-position'] = false; // default: before
- whiteList['shape-image-threshold'] = false; // default: 0.0
- whiteList['shape-outside'] = false; // default: none
- whiteList['shape-margin'] = false; // default: 0
- whiteList['size'] = false; // default: auto
- whiteList['speak'] = false; // default: auto
- whiteList['speak-as'] = false; // default: normal
- whiteList['speak-header'] = false; // default: once
- whiteList['speak-numeral'] = false; // default: continuous
- whiteList['speak-punctuation'] = false; // default: none
- whiteList['speech-rate'] = false; // default: medium
- whiteList['stress'] = false; // default: 50
- whiteList['string-set'] = false; // default: none
- whiteList['tab-size'] = false; // default: 8
- whiteList['table-layout'] = false; // default: auto
- whiteList['text-align'] = true; // default: start
- whiteList['text-align-last'] = true; // default: auto
- whiteList['text-combine-upright'] = true; // default: none
- whiteList['text-decoration'] = true; // default: none
- whiteList['text-decoration-color'] = true; // default: currentColor
- whiteList['text-decoration-line'] = true; // default: none
- whiteList['text-decoration-skip'] = true; // default: objects
- whiteList['text-decoration-style'] = true; // default: solid
- whiteList['text-emphasis'] = true; // default: depending on individual properties
- whiteList['text-emphasis-color'] = true; // default: currentColor
- whiteList['text-emphasis-position'] = true; // default: over right
- whiteList['text-emphasis-style'] = true; // default: none
- whiteList['text-height'] = true; // default: auto
- whiteList['text-indent'] = true; // default: 0
- whiteList['text-justify'] = true; // default: auto
- whiteList['text-orientation'] = true; // default: mixed
- whiteList['text-overflow'] = true; // default: clip
- whiteList['text-shadow'] = true; // default: none
- whiteList['text-space-collapse'] = true; // default: collapse
- whiteList['text-transform'] = true; // default: none
- whiteList['text-underline-position'] = true; // default: auto
- whiteList['text-wrap'] = true; // default: normal
- whiteList['top'] = false; // default: auto
- whiteList['transform'] = false; // default: none
- whiteList['transform-origin'] = false; // default: 50% 50% 0
- whiteList['transform-style'] = false; // default: flat
- whiteList['transition'] = false; // default: depending on individual properties
- whiteList['transition-delay'] = false; // default: 0s
- whiteList['transition-duration'] = false; // default: 0s
- whiteList['transition-property'] = false; // default: all
- whiteList['transition-timing-function'] = false; // default: ease
- whiteList['unicode-bidi'] = false; // default: normal
- whiteList['vertical-align'] = false; // default: baseline
- whiteList['visibility'] = false; // default: visible
- whiteList['voice-balance'] = false; // default: center
- whiteList['voice-duration'] = false; // default: auto
- whiteList['voice-family'] = false; // default: implementation dependent
- whiteList['voice-pitch'] = false; // default: medium
- whiteList['voice-range'] = false; // default: medium
- whiteList['voice-rate'] = false; // default: normal
- whiteList['voice-stress'] = false; // default: normal
- whiteList['voice-volume'] = false; // default: medium
- whiteList['volume'] = false; // default: medium
- whiteList['white-space'] = false; // default: normal
- whiteList['widows'] = false; // default: 2
- whiteList['width'] = true; // default: auto
- whiteList['will-change'] = false; // default: auto
- whiteList['word-break'] = true; // default: normal
- whiteList['word-spacing'] = true; // default: normal
- whiteList['word-wrap'] = true; // default: normal
- whiteList['wrap-flow'] = false; // default: auto
- whiteList['wrap-through'] = false; // default: wrap
- whiteList['writing-mode'] = false; // default: horizontal-tb
- whiteList['z-index'] = false; // default: auto
-
- return whiteList;
-}
-
-
-/**
- * 匹配到白名单上的一个属性时
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @return {String}
- */
-function onAttr (name, value, options) {
- // do nothing
-}
-
-/**
- * 匹配到不在白名单上的一个属性时
- *
- * @param {String} name
- * @param {String} value
- * @param {Object} options
- * @return {String}
- */
-function onIgnoreAttr (name, value, options) {
- // do nothing
-}
-
-var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
-
-/**
- * 过滤属性值
- *
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function safeAttrValue(name, value) {
- if (REGEXP_URL_JAVASCRIPT.test(value)) return '';
- return value;
-}
-
-
-exports.whiteList = getDefaultWhiteList();
-exports.getDefaultWhiteList = getDefaultWhiteList;
-exports.onAttr = onAttr;
-exports.onIgnoreAttr = onIgnoreAttr;
-exports.safeAttrValue = safeAttrValue;
-
-},{}],8:[function(require,module,exports){
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var DEFAULT = require('./default');
-var FilterCSS = require('./css');
-
-
-/**
- * XSS过滤
- *
- * @param {String} css 要过滤的CSS代码
- * @param {Object} options 选项:whiteList, onAttr, onIgnoreAttr
- * @return {String}
- */
-function filterCSS (html, options) {
- var xss = new FilterCSS(options);
- return xss.process(html);
-}
-
-
-// 输出
-exports = module.exports = filterCSS;
-exports.FilterCSS = FilterCSS;
-for (var i in DEFAULT) exports[i] = DEFAULT[i];
-
-// 在浏览器端使用
-if (typeof window !== 'undefined') {
- window.filterCSS = module.exports;
-}
-
-},{"./css":6,"./default":7}],9:[function(require,module,exports){
-/**
- * cssfilter
- *
- * @author 老雷<leizongmin@gmail.com>
- */
-
-var _ = require('./util');
-
-
-/**
- * 解析style
- *
- * @param {String} css
- * @param {Function} onAttr 处理属性的函数
- * 参数格式: function (sourcePosition, position, name, value, source)
- * @return {String}
- */
-function parseStyle (css, onAttr) {
- css = _.trimRight(css);
- if (css[css.length - 1] !== ';') css += ';';
- var cssLength = css.length;
- var isParenthesisOpen = false;
- var lastPos = 0;
- var i = 0;
- var retCSS = '';
-
- function addNewAttr () {
- // 如果没有正常的闭合圆括号,则直接忽略当前属性
- if (!isParenthesisOpen) {
- var source = _.trim(css.slice(lastPos, i));
- var j = source.indexOf(':');
- if (j !== -1) {
- var name = _.trim(source.slice(0, j));
- var value = _.trim(source.slice(j + 1));
- // 必须有属性名称
- if (name) {
- var ret = onAttr(lastPos, retCSS.length, name, value, source);
- if (ret) retCSS += ret + '; ';
- }
- }
- }
- lastPos = i + 1;
- }
-
- for (; i < cssLength; i++) {
- var c = css[i];
- if (c === '/' && css[i + 1] === '*') {
- // 备注开始
- var j = css.indexOf('*/', i + 2);
- // 如果没有正常的备注结束,则后面的部分全部跳过
- if (j === -1) break;
- // 直接将当前位置调到备注结尾,并且初始化状态
- i = j + 1;
- lastPos = i + 1;
- isParenthesisOpen = false;
- } else if (c === '(') {
- isParenthesisOpen = true;
- } else if (c === ')') {
- isParenthesisOpen = false;
- } else if (c === ';') {
- if (isParenthesisOpen) {
- // 在圆括号里面,忽略
- } else {
- addNewAttr();
- }
- } else if (c === '\n') {
- addNewAttr();
- }
- }
-
- return _.trim(retCSS);
-}
-
-module.exports = parseStyle;
-
-},{"./util":10}],10:[function(require,module,exports){
-module.exports = {
- indexOf: function (arr, item) {
- var i, j;
- if (Array.prototype.indexOf) {
- return arr.indexOf(item);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- },
- forEach: function (arr, fn, scope) {
- var i, j;
- if (Array.prototype.forEach) {
- return arr.forEach(fn, scope);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- fn.call(scope, arr[i], i, arr);
- }
- },
- trim: function (str) {
- if (String.prototype.trim) {
- return str.trim();
- }
- return str.replace(/(^\s*)|(\s*$)/g, '');
- },
- trimRight: function (str) {
- if (String.prototype.trimRight) {
- return str.trimRight();
- }
- return str.replace(/(\s*$)/g, '');
- }
-};
-
-},{}]},{},[2]);
diff --git a/node_modules/xss/dist/xss.min.js b/node_modules/xss/dist/xss.min.js
deleted file mode 100644
index b2c3878..0000000
--- a/node_modules/xss/dist/xss.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(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){var FilterCSS=require("cssfilter").FilterCSS;var getDefaultCSSWhiteList=require("cssfilter").getDefaultWhiteList;var _=require("./util");function getDefaultWhiteList(){return{a:["target","href","title"],abbr:["title"],address:[],area:["shape","coords","href","alt"],article:[],aside:[],audio:["autoplay","controls","loop","preload","src"],b:[],bdi:["dir"],bdo:["dir"],big:[],blockquote:["cite"],br:[],caption:[],center:[],cite:[],code:[],col:["align","valign","span","width"],colgroup:["align","valign","span","width"],dd:[],del:["datetime"],details:["open"],div:[],dl:[],dt:[],em:[],font:["color","size","face"],footer:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],hr:[],i:[],img:["src","alt","title","width","height"],ins:["datetime"],li:[],mark:[],nav:[],ol:[],p:[],pre:[],s:[],section:[],small:[],span:[],sub:[],sup:[],strong:[],table:["width","border","align","valign"],tbody:["align","valign"],td:["width","rowspan","colspan","align","valign"],tfoot:["align","valign"],th:["width","rowspan","colspan","align","valign"],thead:["align","valign"],tr:["rowspan","align","valign"],tt:[],u:[],ul:[],video:["autoplay","controls","loop","preload","src","height","width"]}}var defaultCSSFilter=new FilterCSS;function onTag(tag,html,options){}function onIgnoreTag(tag,html,options){}function onTagAttr(tag,name,value){}function onIgnoreTagAttr(tag,name,value){}function escapeHtml(html){return html.replace(REGEXP_LT,"&lt;").replace(REGEXP_GT,"&gt;")}function safeAttrValue(tag,name,value,cssFilter){value=friendlyAttrValue(value);if(name==="href"||name==="src"){value=_.trim(value);if(value==="#")return"#";if(!(value.substr(0,7)==="http://"||value.substr(0,8)==="https://"||value.substr(0,7)==="mailto:"||value.substr(0,4)==="tel:"||value[0]==="#"||value[0]==="/")){return""}}else if(name==="background"){REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex=0;if(REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)){return""}}else if(name==="style"){REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex=0;if(REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)){return""}REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex=0;if(REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)){REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex=0;if(REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)){return""}}if(cssFilter!==false){cssFilter=cssFilter||defaultCSSFilter;value=cssFilter.process(value)}}value=escapeAttrValue(value);return value}var REGEXP_LT=/</g;var REGEXP_GT=/>/g;var REGEXP_QUOTE=/"/g;var REGEXP_QUOTE_2=/&quot;/g;var REGEXP_ATTR_VALUE_1=/&#([a-zA-Z0-9]*);?/gim;var REGEXP_ATTR_VALUE_COLON=/&colon;?/gim;var REGEXP_ATTR_VALUE_NEWLINE=/&newline;?/gim;var REGEXP_DEFAULT_ON_TAG_ATTR_3=/\/\*|\*\//gm;var REGEXP_DEFAULT_ON_TAG_ATTR_4=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a)\:/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_5=/^[\s"'`]*(d\s*a\s*t\s*a\s*)\:/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_6=/^[\s"'`]*(d\s*a\s*t\s*a\s*)\:\s*image\//gi;var REGEXP_DEFAULT_ON_TAG_ATTR_7=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi;var REGEXP_DEFAULT_ON_TAG_ATTR_8=/u\s*r\s*l\s*\(.*/gi;function escapeQuote(str){return str.replace(REGEXP_QUOTE,"&quot;")}function unescapeQuote(str){return str.replace(REGEXP_QUOTE_2,'"')}function escapeHtmlEntities(str){return str.replace(REGEXP_ATTR_VALUE_1,function replaceUnicode(str,code){return code[0]==="x"||code[0]==="X"?String.fromCharCode(parseInt(code.substr(1),16)):String.fromCharCode(parseInt(code,10))})}function escapeDangerHtml5Entities(str){return str.replace(REGEXP_ATTR_VALUE_COLON,":").replace(REGEXP_ATTR_VALUE_NEWLINE," ")}function clearNonPrintableCharacter(str){var str2="";for(var i=0,len=str.length;i<len;i++){str2+=str.charCodeAt(i)<32?" ":str.charAt(i)}return _.trim(str2)}function friendlyAttrValue(str){str=unescapeQuote(str);str=escapeHtmlEntities(str);str=escapeDangerHtml5Entities(str);str=clearNonPrintableCharacter(str);return str}function escapeAttrValue(str){str=escapeQuote(str);str=escapeHtml(str);return str}function onIgnoreTagStripAll(){return""}function StripTagBody(tags,next){if(typeof next!=="function"){next=function(){}}var isRemoveAllTag=!Array.isArray(tags);function isRemoveTag(tag){if(isRemoveAllTag)return true;return _.indexOf(tags,tag)!==-1}var removeList=[];var posStart=false;return{onIgnoreTag:function(tag,html,options){if(isRemoveTag(tag)){if(options.isClosing){var ret="[/removed]";var end=options.position+ret.length;removeList.push([posStart!==false?posStart:options.position,end]);posStart=false;return ret}else{if(!posStart){posStart=options.position}return"[removed]"}}else{return next(tag,html,options)}},remove:function(html){var rethtml="";var lastPos=0;_.forEach(removeList,function(pos){rethtml+=html.slice(lastPos,pos[0]);lastPos=pos[1]});rethtml+=html.slice(lastPos);return rethtml}}}function stripCommentTag(html){return html.replace(STRIP_COMMENT_TAG_REGEXP,"")}var STRIP_COMMENT_TAG_REGEXP=/<!--[\s\S]*?-->/g;function stripBlankChar(html){var chars=html.split("");chars=chars.filter(function(char){var c=char.charCodeAt(0);if(c===127)return false;if(c<=31){if(c===10||c===13)return true;return false}return true});return chars.join("")}exports.whiteList=getDefaultWhiteList();exports.getDefaultWhiteList=getDefaultWhiteList;exports.onTag=onTag;exports.onIgnoreTag=onIgnoreTag;exports.onTagAttr=onTagAttr;exports.onIgnoreTagAttr=onIgnoreTagAttr;exports.safeAttrValue=safeAttrValue;exports.escapeHtml=escapeHtml;exports.escapeQuote=escapeQuote;exports.unescapeQuote=unescapeQuote;exports.escapeHtmlEntities=escapeHtmlEntities;exports.escapeDangerHtml5Entities=escapeDangerHtml5Entities;exports.clearNonPrintableCharacter=clearNonPrintableCharacter;exports.friendlyAttrValue=friendlyAttrValue;exports.escapeAttrValue=escapeAttrValue;exports.onIgnoreTagStripAll=onIgnoreTagStripAll;exports.StripTagBody=StripTagBody;exports.stripCommentTag=stripCommentTag;exports.stripBlankChar=stripBlankChar;exports.cssFilter=defaultCSSFilter;exports.getDefaultCSSWhiteList=getDefaultCSSWhiteList},{"./util":4,cssfilter:8}],2:[function(require,module,exports){var DEFAULT=require("./default");var parser=require("./parser");var FilterXSS=require("./xss");function filterXSS(html,options){var xss=new FilterXSS(options);return xss.process(html)}exports=module.exports=filterXSS;exports.filterXSS=filterXSS;exports.FilterXSS=FilterXSS;for(var i in DEFAULT)exports[i]=DEFAULT[i];for(var i in parser)exports[i]=parser[i];if(typeof window!=="undefined"){window.filterXSS=module.exports}function isWorkerEnv(){return typeof self!=="undefined"&&typeof DedicatedWorkerGlobalScope!=="undefined"&&self instanceof DedicatedWorkerGlobalScope}if(isWorkerEnv()){self.filterXSS=module.exports}},{"./default":1,"./parser":3,"./xss":5}],3:[function(require,module,exports){var _=require("./util");function getTagName(html){var i=_.spaceIndex(html);if(i===-1){var tagName=html.slice(1,-1)}else{var tagName=html.slice(1,i+1)}tagName=_.trim(tagName).toLowerCase();if(tagName.slice(0,1)==="/")tagName=tagName.slice(1);if(tagName.slice(-1)==="/")tagName=tagName.slice(0,-1);return tagName}function isClosing(html){return html.slice(0,2)==="</"}function parseTag(html,onTag,escapeHtml){"user strict";var rethtml="";var lastPos=0;var tagStart=false;var quoteStart=false;var currentPos=0;var len=html.length;var currentTagName="";var currentHtml="";for(currentPos=0;currentPos<len;currentPos++){var c=html.charAt(currentPos);if(tagStart===false){if(c==="<"){tagStart=currentPos;continue}}else{if(quoteStart===false){if(c==="<"){rethtml+=escapeHtml(html.slice(lastPos,currentPos));tagStart=currentPos;lastPos=currentPos;continue}if(c===">"){rethtml+=escapeHtml(html.slice(lastPos,tagStart));currentHtml=html.slice(tagStart,currentPos+1);currentTagName=getTagName(currentHtml);rethtml+=onTag(tagStart,rethtml.length,currentTagName,currentHtml,isClosing(currentHtml));lastPos=currentPos+1;tagStart=false;continue}if((c==='"'||c==="'")&&html.charAt(currentPos-1)==="="){quoteStart=c;continue}}else{if(c===quoteStart){quoteStart=false;continue}}}}if(lastPos<html.length){rethtml+=escapeHtml(html.substr(lastPos))}return rethtml}var REGEXP_ILLEGAL_ATTR_NAME=/[^a-zA-Z0-9_:\.\-]/gim;function parseAttr(html,onAttr){"user strict";var lastPos=0;var retAttrs=[];var tmpName=false;var len=html.length;function addAttr(name,value){name=_.trim(name);name=name.replace(REGEXP_ILLEGAL_ATTR_NAME,"").toLowerCase();if(name.length<1)return;var ret=onAttr(name,value||"");if(ret)retAttrs.push(ret)}for(var i=0;i<len;i++){var c=html.charAt(i);var v,j;if(tmpName===false&&c==="="){tmpName=html.slice(lastPos,i);lastPos=i+1;continue}if(tmpName!==false){if(i===lastPos&&(c==='"'||c==="'")&&html.charAt(i-1)==="="){j=html.indexOf(c,i+1);if(j===-1){break}else{v=_.trim(html.slice(lastPos+1,j));addAttr(tmpName,v);tmpName=false;i=j;lastPos=i+1;continue}}}if(/\s|\n|\t/.test(c)){html=html.replace(/\s|\n|\t/g," ");if(tmpName===false){j=findNextEqual(html,i);if(j===-1){v=_.trim(html.slice(lastPos,i));addAttr(v);tmpName=false;lastPos=i+1;continue}else{i=j-1;continue}}else{j=findBeforeEqual(html,i-1);if(j===-1){v=_.trim(html.slice(lastPos,i));v=stripQuoteWrap(v);addAttr(tmpName,v);tmpName=false;lastPos=i+1;continue}else{continue}}}}if(lastPos<html.length){if(tmpName===false){addAttr(html.slice(lastPos))}else{addAttr(tmpName,stripQuoteWrap(_.trim(html.slice(lastPos))))}}return _.trim(retAttrs.join(" "))}function findNextEqual(str,i){for(;i<str.length;i++){var c=str[i];if(c===" ")continue;if(c==="=")return i;return-1}}function findBeforeEqual(str,i){for(;i>0;i--){var c=str[i];if(c===" ")continue;if(c==="=")return i;return-1}}function isQuoteWrapString(text){if(text[0]==='"'&&text[text.length-1]==='"'||text[0]==="'"&&text[text.length-1]==="'"){return true}else{return false}}function stripQuoteWrap(text){if(isQuoteWrapString(text)){return text.substr(1,text.length-2)}else{return text}}exports.parseTag=parseTag;exports.parseAttr=parseAttr},{"./util":4}],4:[function(require,module,exports){module.exports={indexOf:function(arr,item){var i,j;if(Array.prototype.indexOf){return arr.indexOf(item)}for(i=0,j=arr.length;i<j;i++){if(arr[i]===item){return i}}return-1},forEach:function(arr,fn,scope){var i,j;if(Array.prototype.forEach){return arr.forEach(fn,scope)}for(i=0,j=arr.length;i<j;i++){fn.call(scope,arr[i],i,arr)}},trim:function(str){if(String.prototype.trim){return str.trim()}return str.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(str){var reg=/\s|\n|\t/;var match=reg.exec(str);return match?match.index:-1}}},{}],5:[function(require,module,exports){var FilterCSS=require("cssfilter").FilterCSS;var DEFAULT=require("./default");var parser=require("./parser");var parseTag=parser.parseTag;var parseAttr=parser.parseAttr;var _=require("./util");function isNull(obj){return obj===undefined||obj===null}function getAttrs(html){var i=_.spaceIndex(html);if(i===-1){return{html:"",closing:html[html.length-2]==="/"}}html=_.trim(html.slice(i+1,-1));var isClosing=html[html.length-1]==="/";if(isClosing)html=_.trim(html.slice(0,-1));return{html:html,closing:isClosing}}function shallowCopyObject(obj){var ret={};for(var i in obj){ret[i]=obj[i]}return ret}function FilterXSS(options){options=shallowCopyObject(options||{});if(options.stripIgnoreTag){if(options.onIgnoreTag){console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time')}options.onIgnoreTag=DEFAULT.onIgnoreTagStripAll}options.whiteList=options.whiteList||DEFAULT.whiteList;options.onTag=options.onTag||DEFAULT.onTag;options.onTagAttr=options.onTagAttr||DEFAULT.onTagAttr;options.onIgnoreTag=options.onIgnoreTag||DEFAULT.onIgnoreTag;options.onIgnoreTagAttr=options.onIgnoreTagAttr||DEFAULT.onIgnoreTagAttr;options.safeAttrValue=options.safeAttrValue||DEFAULT.safeAttrValue;options.escapeHtml=options.escapeHtml||DEFAULT.escapeHtml;this.options=options;if(options.css===false){this.cssFilter=false}else{options.css=options.css||{};this.cssFilter=new FilterCSS(options.css)}}FilterXSS.prototype.process=function(html){html=html||"";html=html.toString();if(!html)return"";var me=this;var options=me.options;var whiteList=options.whiteList;var onTag=options.onTag;var onIgnoreTag=options.onIgnoreTag;var onTagAttr=options.onTagAttr;var onIgnoreTagAttr=options.onIgnoreTagAttr;var safeAttrValue=options.safeAttrValue;var escapeHtml=options.escapeHtml;var cssFilter=me.cssFilter;if(options.stripBlankChar){html=DEFAULT.stripBlankChar(html)}if(!options.allowCommentTag){html=DEFAULT.stripCommentTag(html)}var stripIgnoreTagBody=false;if(options.stripIgnoreTagBody){var stripIgnoreTagBody=DEFAULT.StripTagBody(options.stripIgnoreTagBody,onIgnoreTag);onIgnoreTag=stripIgnoreTagBody.onIgnoreTag}var retHtml=parseTag(html,function(sourcePosition,position,tag,html,isClosing){var info={sourcePosition:sourcePosition,position:position,isClosing:isClosing,isWhite:whiteList.hasOwnProperty(tag)};var ret=onTag(tag,html,info);if(!isNull(ret))return ret;if(info.isWhite){if(info.isClosing){return"</"+tag+">"}var attrs=getAttrs(html);var whiteAttrList=whiteList[tag];var attrsHtml=parseAttr(attrs.html,function(name,value){var isWhiteAttr=_.indexOf(whiteAttrList,name)!==-1;var ret=onTagAttr(tag,name,value,isWhiteAttr);if(!isNull(ret))return ret;if(isWhiteAttr){value=safeAttrValue(tag,name,value,cssFilter);if(value){return name+'="'+value+'"'}else{return name}}else{var ret=onIgnoreTagAttr(tag,name,value,isWhiteAttr);if(!isNull(ret))return ret;return}});var html="<"+tag;if(attrsHtml)html+=" "+attrsHtml;if(attrs.closing)html+=" /";html+=">";return html}else{var ret=onIgnoreTag(tag,html,info);if(!isNull(ret))return ret;return escapeHtml(html)}},escapeHtml);if(stripIgnoreTagBody){retHtml=stripIgnoreTagBody.remove(retHtml)}return retHtml};module.exports=FilterXSS},{"./default":1,"./parser":3,"./util":4,cssfilter:8}],6:[function(require,module,exports){var DEFAULT=require("./default");var parseStyle=require("./parser");var _=require("./util");function isNull(obj){return obj===undefined||obj===null}function shallowCopyObject(obj){var ret={};for(var i in obj){ret[i]=obj[i]}return ret}function FilterCSS(options){options=shallowCopyObject(options||{});options.whiteList=options.whiteList||DEFAULT.whiteList;options.onAttr=options.onAttr||DEFAULT.onAttr;options.onIgnoreAttr=options.onIgnoreAttr||DEFAULT.onIgnoreAttr;options.safeAttrValue=options.safeAttrValue||DEFAULT.safeAttrValue;this.options=options}FilterCSS.prototype.process=function(css){css=css||"";css=css.toString();if(!css)return"";var me=this;var options=me.options;var whiteList=options.whiteList;var onAttr=options.onAttr;var onIgnoreAttr=options.onIgnoreAttr;var safeAttrValue=options.safeAttrValue;var retCSS=parseStyle(css,function(sourcePosition,position,name,value,source){var check=whiteList[name];var isWhite=false;if(check===true)isWhite=check;else if(typeof check==="function")isWhite=check(value);else if(check instanceof RegExp)isWhite=check.test(value);if(isWhite!==true)isWhite=false;value=safeAttrValue(name,value);if(!value)return;var opts={position:position,sourcePosition:sourcePosition,source:source,isWhite:isWhite};if(isWhite){var ret=onAttr(name,value,opts);if(isNull(ret)){return name+":"+value}else{return ret}}else{var ret=onIgnoreAttr(name,value,opts);if(!isNull(ret)){return ret}}});return retCSS};module.exports=FilterCSS},{"./default":7,"./parser":9,"./util":10}],7:[function(require,module,exports){function getDefaultWhiteList(){var whiteList={};whiteList["align-content"]=false;whiteList["align-items"]=false;whiteList["align-self"]=false;whiteList["alignment-adjust"]=false;whiteList["alignment-baseline"]=false;whiteList["all"]=false;whiteList["anchor-point"]=false;whiteList["animation"]=false;whiteList["animation-delay"]=false;whiteList["animation-direction"]=false;whiteList["animation-duration"]=false;whiteList["animation-fill-mode"]=false;whiteList["animation-iteration-count"]=false;whiteList["animation-name"]=false;whiteList["animation-play-state"]=false;whiteList["animation-timing-function"]=false;whiteList["azimuth"]=false;whiteList["backface-visibility"]=false;whiteList["background"]=true;whiteList["background-attachment"]=true;whiteList["background-clip"]=true;whiteList["background-color"]=true;whiteList["background-image"]=true;whiteList["background-origin"]=true;whiteList["background-position"]=true;whiteList["background-repeat"]=true;whiteList["background-size"]=true;whiteList["baseline-shift"]=false;whiteList["binding"]=false;whiteList["bleed"]=false;whiteList["bookmark-label"]=false;whiteList["bookmark-level"]=false;whiteList["bookmark-state"]=false;whiteList["border"]=true;whiteList["border-bottom"]=true;whiteList["border-bottom-color"]=true;whiteList["border-bottom-left-radius"]=true;whiteList["border-bottom-right-radius"]=true;whiteList["border-bottom-style"]=true;whiteList["border-bottom-width"]=true;whiteList["border-collapse"]=true;whiteList["border-color"]=true;whiteList["border-image"]=true;whiteList["border-image-outset"]=true;whiteList["border-image-repeat"]=true;whiteList["border-image-slice"]=true;whiteList["border-image-source"]=true;whiteList["border-image-width"]=true;whiteList["border-left"]=true;whiteList["border-left-color"]=true;whiteList["border-left-style"]=true;whiteList["border-left-width"]=true;whiteList["border-radius"]=true;whiteList["border-right"]=true;whiteList["border-right-color"]=true;whiteList["border-right-style"]=true;whiteList["border-right-width"]=true;whiteList["border-spacing"]=true;whiteList["border-style"]=true;whiteList["border-top"]=true;whiteList["border-top-color"]=true;whiteList["border-top-left-radius"]=true;whiteList["border-top-right-radius"]=true;whiteList["border-top-style"]=true;whiteList["border-top-width"]=true;whiteList["border-width"]=true;whiteList["bottom"]=false;whiteList["box-decoration-break"]=true;whiteList["box-shadow"]=true;whiteList["box-sizing"]=true;whiteList["box-snap"]=true;whiteList["box-suppress"]=true;whiteList["break-after"]=true;whiteList["break-before"]=true;whiteList["break-inside"]=true;whiteList["caption-side"]=false;whiteList["chains"]=false;whiteList["clear"]=true;whiteList["clip"]=false;whiteList["clip-path"]=false;whiteList["clip-rule"]=false;whiteList["color"]=true;whiteList["color-interpolation-filters"]=true;whiteList["column-count"]=false;whiteList["column-fill"]=false;whiteList["column-gap"]=false;whiteList["column-rule"]=false;whiteList["column-rule-color"]=false;whiteList["column-rule-style"]=false;whiteList["column-rule-width"]=false;whiteList["column-span"]=false;whiteList["column-width"]=false;whiteList["columns"]=false;whiteList["contain"]=false;whiteList["content"]=false;whiteList["counter-increment"]=false;whiteList["counter-reset"]=false;whiteList["counter-set"]=false;whiteList["crop"]=false;whiteList["cue"]=false;whiteList["cue-after"]=false;whiteList["cue-before"]=false;whiteList["cursor"]=false;whiteList["direction"]=false;whiteList["display"]=true;whiteList["display-inside"]=true;whiteList["display-list"]=true;whiteList["display-outside"]=true;whiteList["dominant-baseline"]=false;whiteList["elevation"]=false;whiteList["empty-cells"]=false;whiteList["filter"]=false;whiteList["flex"]=false;whiteList["flex-basis"]=false;whiteList["flex-direction"]=false;whiteList["flex-flow"]=false;whiteList["flex-grow"]=false;whiteList["flex-shrink"]=false;whiteList["flex-wrap"]=false;whiteList["float"]=false;whiteList["float-offset"]=false;whiteList["flood-color"]=false;whiteList["flood-opacity"]=false;whiteList["flow-from"]=false;whiteList["flow-into"]=false;whiteList["font"]=true;whiteList["font-family"]=true;whiteList["font-feature-settings"]=true;whiteList["font-kerning"]=true;whiteList["font-language-override"]=true;whiteList["font-size"]=true;whiteList["font-size-adjust"]=true;whiteList["font-stretch"]=true;whiteList["font-style"]=true;whiteList["font-synthesis"]=true;whiteList["font-variant"]=true;whiteList["font-variant-alternates"]=true;whiteList["font-variant-caps"]=true;whiteList["font-variant-east-asian"]=true;whiteList["font-variant-ligatures"]=true;whiteList["font-variant-numeric"]=true;whiteList["font-variant-position"]=true;whiteList["font-weight"]=true;whiteList["grid"]=false;whiteList["grid-area"]=false;whiteList["grid-auto-columns"]=false;whiteList["grid-auto-flow"]=false;whiteList["grid-auto-rows"]=false;whiteList["grid-column"]=false;whiteList["grid-column-end"]=false;whiteList["grid-column-start"]=false;whiteList["grid-row"]=false;whiteList["grid-row-end"]=false;whiteList["grid-row-start"]=false;whiteList["grid-template"]=false;whiteList["grid-template-areas"]=false;whiteList["grid-template-columns"]=false;whiteList["grid-template-rows"]=false;whiteList["hanging-punctuation"]=false;whiteList["height"]=true;whiteList["hyphens"]=false;whiteList["icon"]=false;whiteList["image-orientation"]=false;whiteList["image-resolution"]=false;whiteList["ime-mode"]=false;whiteList["initial-letters"]=false;whiteList["inline-box-align"]=false;whiteList["justify-content"]=false;whiteList["justify-items"]=false;whiteList["justify-self"]=false;whiteList["left"]=false;whiteList["letter-spacing"]=true;whiteList["lighting-color"]=true;whiteList["line-box-contain"]=false;whiteList["line-break"]=false;whiteList["line-grid"]=false;whiteList["line-height"]=false;whiteList["line-snap"]=false;whiteList["line-stacking"]=false;whiteList["line-stacking-ruby"]=false;whiteList["line-stacking-shift"]=false;whiteList["line-stacking-strategy"]=false;whiteList["list-style"]=true;whiteList["list-style-image"]=true;whiteList["list-style-position"]=true;whiteList["list-style-type"]=true;whiteList["margin"]=true;whiteList["margin-bottom"]=true;whiteList["margin-left"]=true;whiteList["margin-right"]=true;whiteList["margin-top"]=true;whiteList["marker-offset"]=false;whiteList["marker-side"]=false;whiteList["marks"]=false;whiteList["mask"]=false;whiteList["mask-box"]=false;whiteList["mask-box-outset"]=false;whiteList["mask-box-repeat"]=false;whiteList["mask-box-slice"]=false;whiteList["mask-box-source"]=false;whiteList["mask-box-width"]=false;whiteList["mask-clip"]=false;whiteList["mask-image"]=false;whiteList["mask-origin"]=false;whiteList["mask-position"]=false;whiteList["mask-repeat"]=false;whiteList["mask-size"]=false;whiteList["mask-source-type"]=false;whiteList["mask-type"]=false;whiteList["max-height"]=true;whiteList["max-lines"]=false;whiteList["max-width"]=true;whiteList["min-height"]=true;whiteList["min-width"]=true;whiteList["move-to"]=false;whiteList["nav-down"]=false;whiteList["nav-index"]=false;whiteList["nav-left"]=false;whiteList["nav-right"]=false;whiteList["nav-up"]=false;whiteList["object-fit"]=false;whiteList["object-position"]=false;whiteList["opacity"]=false;whiteList["order"]=false;whiteList["orphans"]=false;whiteList["outline"]=false;whiteList["outline-color"]=false;whiteList["outline-offset"]=false;whiteList["outline-style"]=false;whiteList["outline-width"]=false;whiteList["overflow"]=false;whiteList["overflow-wrap"]=false;whiteList["overflow-x"]=false;whiteList["overflow-y"]=false;whiteList["padding"]=true;whiteList["padding-bottom"]=true;whiteList["padding-left"]=true;whiteList["padding-right"]=true;whiteList["padding-top"]=true;whiteList["page"]=false;whiteList["page-break-after"]=false;whiteList["page-break-before"]=false;whiteList["page-break-inside"]=false;whiteList["page-policy"]=false;whiteList["pause"]=false;whiteList["pause-after"]=false;whiteList["pause-before"]=false;whiteList["perspective"]=false;whiteList["perspective-origin"]=false;whiteList["pitch"]=false;whiteList["pitch-range"]=false;whiteList["play-during"]=false;whiteList["position"]=false;whiteList["presentation-level"]=false;whiteList["quotes"]=false;whiteList["region-fragment"]=false;whiteList["resize"]=false;whiteList["rest"]=false;whiteList["rest-after"]=false;whiteList["rest-before"]=false;whiteList["richness"]=false;whiteList["right"]=false;whiteList["rotation"]=false;whiteList["rotation-point"]=false;whiteList["ruby-align"]=false;whiteList["ruby-merge"]=false;whiteList["ruby-position"]=false;whiteList["shape-image-threshold"]=false;whiteList["shape-outside"]=false;whiteList["shape-margin"]=false;whiteList["size"]=false;whiteList["speak"]=false;whiteList["speak-as"]=false;whiteList["speak-header"]=false;whiteList["speak-numeral"]=false;whiteList["speak-punctuation"]=false;whiteList["speech-rate"]=false;whiteList["stress"]=false;whiteList["string-set"]=false;whiteList["tab-size"]=false;whiteList["table-layout"]=false;whiteList["text-align"]=true;whiteList["text-align-last"]=true;whiteList["text-combine-upright"]=true;whiteList["text-decoration"]=true;whiteList["text-decoration-color"]=true;whiteList["text-decoration-line"]=true;whiteList["text-decoration-skip"]=true;whiteList["text-decoration-style"]=true;whiteList["text-emphasis"]=true;whiteList["text-emphasis-color"]=true;whiteList["text-emphasis-position"]=true;whiteList["text-emphasis-style"]=true;whiteList["text-height"]=true;whiteList["text-indent"]=true;whiteList["text-justify"]=true;whiteList["text-orientation"]=true;whiteList["text-overflow"]=true;whiteList["text-shadow"]=true;whiteList["text-space-collapse"]=true;whiteList["text-transform"]=true;whiteList["text-underline-position"]=true;whiteList["text-wrap"]=true;whiteList["top"]=false;whiteList["transform"]=false;whiteList["transform-origin"]=false;whiteList["transform-style"]=false;whiteList["transition"]=false;whiteList["transition-delay"]=false;whiteList["transition-duration"]=false;whiteList["transition-property"]=false;whiteList["transition-timing-function"]=false;whiteList["unicode-bidi"]=false;whiteList["vertical-align"]=false;whiteList["visibility"]=false;whiteList["voice-balance"]=false;whiteList["voice-duration"]=false;whiteList["voice-family"]=false;whiteList["voice-pitch"]=false;whiteList["voice-range"]=false;whiteList["voice-rate"]=false;whiteList["voice-stress"]=false;whiteList["voice-volume"]=false;whiteList["volume"]=false;whiteList["white-space"]=false;whiteList["widows"]=false;whiteList["width"]=true;whiteList["will-change"]=false;whiteList["word-break"]=true;whiteList["word-spacing"]=true;whiteList["word-wrap"]=true;whiteList["wrap-flow"]=false;whiteList["wrap-through"]=false;whiteList["writing-mode"]=false;whiteList["z-index"]=false;return whiteList}function onAttr(name,value,options){}function onIgnoreAttr(name,value,options){}var REGEXP_URL_JAVASCRIPT=/javascript\s*\:/gim;function safeAttrValue(name,value){if(REGEXP_URL_JAVASCRIPT.test(value))return"";return value}exports.whiteList=getDefaultWhiteList();exports.getDefaultWhiteList=getDefaultWhiteList;exports.onAttr=onAttr;exports.onIgnoreAttr=onIgnoreAttr;exports.safeAttrValue=safeAttrValue},{}],8:[function(require,module,exports){var DEFAULT=require("./default");var FilterCSS=require("./css");function filterCSS(html,options){var xss=new FilterCSS(options);return xss.process(html)}exports=module.exports=filterCSS;exports.FilterCSS=FilterCSS;for(var i in DEFAULT)exports[i]=DEFAULT[i];if(typeof window!=="undefined"){window.filterCSS=module.exports}},{"./css":6,"./default":7}],9:[function(require,module,exports){var _=require("./util");function parseStyle(css,onAttr){css=_.trimRight(css);if(css[css.length-1]!==";")css+=";";var cssLength=css.length;var isParenthesisOpen=false;var lastPos=0;var i=0;var retCSS="";function addNewAttr(){if(!isParenthesisOpen){var source=_.trim(css.slice(lastPos,i));var j=source.indexOf(":");if(j!==-1){var name=_.trim(source.slice(0,j));var value=_.trim(source.slice(j+1));if(name){var ret=onAttr(lastPos,retCSS.length,name,value,source);if(ret)retCSS+=ret+"; "}}}lastPos=i+1}for(;i<cssLength;i++){var c=css[i];if(c==="/"&&css[i+1]==="*"){var j=css.indexOf("*/",i+2);if(j===-1)break;i=j+1;lastPos=i+1;isParenthesisOpen=false}else if(c==="("){isParenthesisOpen=true}else if(c===")"){isParenthesisOpen=false}else if(c===";"){if(isParenthesisOpen){}else{addNewAttr()}}else if(c==="\n"){addNewAttr()}}return _.trim(retCSS)}module.exports=parseStyle},{"./util":10}],10:[function(require,module,exports){module.exports={indexOf:function(arr,item){var i,j;if(Array.prototype.indexOf){return arr.indexOf(item)}for(i=0,j=arr.length;i<j;i++){if(arr[i]===item){return i}}return-1},forEach:function(arr,fn,scope){var i,j;if(Array.prototype.forEach){return arr.forEach(fn,scope)}for(i=0,j=arr.length;i<j;i++){fn.call(scope,arr[i],i,arr)}},trim:function(str){if(String.prototype.trim){return str.trim()}return str.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(str){if(String.prototype.trimRight){return str.trimRight()}return str.replace(/(\s*$)/g,"")}}},{}]},{},[2]); \ No newline at end of file
diff --git a/node_modules/xss/lib/cli.js b/node_modules/xss/lib/cli.js
deleted file mode 100644
index 4aa075e..0000000
--- a/node_modules/xss/lib/cli.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * command line tool
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var xss = require("./");
-var readline = require("readline");
-
-var rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout
-});
-
-console.log('Enter a blank line to do xss(), enter "@quit" to exit.\n');
-
-function take(c, n) {
- var ret = "";
- for (var i = 0; i < n; i++) {
- ret += c;
- }
- return ret;
-}
-
-function setPrompt(line) {
- line = line.toString();
- rl.setPrompt("[" + line + "]" + take(" ", 5 - line.length));
- rl.prompt();
-}
-
-setPrompt(1);
-
-var html = [];
-rl.on("line", function(line) {
- if (line === "@quit") return process.exit();
- if (line === "") {
- console.log("");
- console.log(xss(html.join("\r\n")));
- console.log("");
- html = [];
- } else {
- html.push(line);
- }
- setPrompt(html.length + 1);
-});
diff --git a/node_modules/xss/lib/default.js b/node_modules/xss/lib/default.js
deleted file mode 100644
index 1452ed3..0000000
--- a/node_modules/xss/lib/default.js
+++ /dev/null
@@ -1,415 +0,0 @@
-/**
- * default settings
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var FilterCSS = require("cssfilter").FilterCSS;
-var getDefaultCSSWhiteList = require("cssfilter").getDefaultWhiteList;
-var _ = require("./util");
-
-function getDefaultWhiteList() {
- return {
- a: ["target", "href", "title"],
- abbr: ["title"],
- address: [],
- area: ["shape", "coords", "href", "alt"],
- article: [],
- aside: [],
- audio: ["autoplay", "controls", "loop", "preload", "src"],
- b: [],
- bdi: ["dir"],
- bdo: ["dir"],
- big: [],
- blockquote: ["cite"],
- br: [],
- caption: [],
- center: [],
- cite: [],
- code: [],
- col: ["align", "valign", "span", "width"],
- colgroup: ["align", "valign", "span", "width"],
- dd: [],
- del: ["datetime"],
- details: ["open"],
- div: [],
- dl: [],
- dt: [],
- em: [],
- font: ["color", "size", "face"],
- footer: [],
- h1: [],
- h2: [],
- h3: [],
- h4: [],
- h5: [],
- h6: [],
- header: [],
- hr: [],
- i: [],
- img: ["src", "alt", "title", "width", "height"],
- ins: ["datetime"],
- li: [],
- mark: [],
- nav: [],
- ol: [],
- p: [],
- pre: [],
- s: [],
- section: [],
- small: [],
- span: [],
- sub: [],
- sup: [],
- strong: [],
- table: ["width", "border", "align", "valign"],
- tbody: ["align", "valign"],
- td: ["width", "rowspan", "colspan", "align", "valign"],
- tfoot: ["align", "valign"],
- th: ["width", "rowspan", "colspan", "align", "valign"],
- thead: ["align", "valign"],
- tr: ["rowspan", "align", "valign"],
- tt: [],
- u: [],
- ul: [],
- video: ["autoplay", "controls", "loop", "preload", "src", "height", "width"]
- };
-}
-
-var defaultCSSFilter = new FilterCSS();
-
-/**
- * default onTag function
- *
- * @param {String} tag
- * @param {String} html
- * @param {Object} options
- * @return {String}
- */
-function onTag(tag, html, options) {
- // do nothing
-}
-
-/**
- * default onIgnoreTag function
- *
- * @param {String} tag
- * @param {String} html
- * @param {Object} options
- * @return {String}
- */
-function onIgnoreTag(tag, html, options) {
- // do nothing
-}
-
-/**
- * default onTagAttr function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function onTagAttr(tag, name, value) {
- // do nothing
-}
-
-/**
- * default onIgnoreTagAttr function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @return {String}
- */
-function onIgnoreTagAttr(tag, name, value) {
- // do nothing
-}
-
-/**
- * default escapeHtml function
- *
- * @param {String} html
- */
-function escapeHtml(html) {
- return html.replace(REGEXP_LT, "&lt;").replace(REGEXP_GT, "&gt;");
-}
-
-/**
- * default safeAttrValue function
- *
- * @param {String} tag
- * @param {String} name
- * @param {String} value
- * @param {Object} cssFilter
- * @return {String}
- */
-function safeAttrValue(tag, name, value, cssFilter) {
- // unescape attribute value firstly
- value = friendlyAttrValue(value);
-
- if (name === "href" || name === "src") {
- // filter `href` and `src` attribute
- // only allow the value that starts with `http://` | `https://` | `mailto:` | `/` | `#`
- value = _.trim(value);
- if (value === "#") return "#";
- if (
- !(
- value.substr(0, 7) === "http://" ||
- value.substr(0, 8) === "https://" ||
- value.substr(0, 7) === "mailto:" ||
- value.substr(0, 4) === "tel:" ||
- value[0] === "#" ||
- value[0] === "/"
- )
- ) {
- return "";
- }
- } else if (name === "background") {
- // filter `background` attribute (maybe no use)
- // `javascript:`
- REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
- return "";
- }
- } else if (name === "style") {
- // `expression()`
- REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) {
- return "";
- }
- // `url()`
- REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) {
- REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
- if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
- return "";
- }
- }
- if (cssFilter !== false) {
- cssFilter = cssFilter || defaultCSSFilter;
- value = cssFilter.process(value);
- }
- }
-
- // escape `<>"` before returns
- value = escapeAttrValue(value);
- return value;
-}
-
-// RegExp list
-var REGEXP_LT = /</g;
-var REGEXP_GT = />/g;
-var REGEXP_QUOTE = /"/g;
-var REGEXP_QUOTE_2 = /&quot;/g;
-var REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/gim;
-var REGEXP_ATTR_VALUE_COLON = /&colon;?/gim;
-var REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/gim;
-var REGEXP_DEFAULT_ON_TAG_ATTR_3 = /\/\*|\*\//gm;
-var REGEXP_DEFAULT_ON_TAG_ATTR_4 = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a)\:/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_5 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_6 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:\s*image\//gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_7 = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi;
-var REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\s*r\s*l\s*\(.*/gi;
-
-/**
- * escape doube quote
- *
- * @param {String} str
- * @return {String} str
- */
-function escapeQuote(str) {
- return str.replace(REGEXP_QUOTE, "&quot;");
-}
-
-/**
- * unescape double quote
- *
- * @param {String} str
- * @return {String} str
- */
-function unescapeQuote(str) {
- return str.replace(REGEXP_QUOTE_2, '"');
-}
-
-/**
- * escape html entities
- *
- * @param {String} str
- * @return {String}
- */
-function escapeHtmlEntities(str) {
- return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode(str, code) {
- return code[0] === "x" || code[0] === "X"
- ? String.fromCharCode(parseInt(code.substr(1), 16))
- : String.fromCharCode(parseInt(code, 10));
- });
-}
-
-/**
- * escape html5 new danger entities
- *
- * @param {String} str
- * @return {String}
- */
-function escapeDangerHtml5Entities(str) {
- return str
- .replace(REGEXP_ATTR_VALUE_COLON, ":")
- .replace(REGEXP_ATTR_VALUE_NEWLINE, " ");
-}
-
-/**
- * clear nonprintable characters
- *
- * @param {String} str
- * @return {String}
- */
-function clearNonPrintableCharacter(str) {
- var str2 = "";
- for (var i = 0, len = str.length; i < len; i++) {
- str2 += str.charCodeAt(i) < 32 ? " " : str.charAt(i);
- }
- return _.trim(str2);
-}
-
-/**
- * get friendly attribute value
- *
- * @param {String} str
- * @return {String}
- */
-function friendlyAttrValue(str) {
- str = unescapeQuote(str);
- str = escapeHtmlEntities(str);
- str = escapeDangerHtml5Entities(str);
- str = clearNonPrintableCharacter(str);
- return str;
-}
-
-/**
- * unescape attribute value
- *
- * @param {String} str
- * @return {String}
- */
-function escapeAttrValue(str) {
- str = escapeQuote(str);
- str = escapeHtml(str);
- return str;
-}
-
-/**
- * `onIgnoreTag` function for removing all the tags that are not in whitelist
- */
-function onIgnoreTagStripAll() {
- return "";
-}
-
-/**
- * remove tag body
- * specify a `tags` list, if the tag is not in the `tags` list then process by the specify function (optional)
- *
- * @param {array} tags
- * @param {function} next
- */
-function StripTagBody(tags, next) {
- if (typeof next !== "function") {
- next = function() {};
- }
-
- var isRemoveAllTag = !Array.isArray(tags);
- function isRemoveTag(tag) {
- if (isRemoveAllTag) return true;
- return _.indexOf(tags, tag) !== -1;
- }
-
- var removeList = [];
- var posStart = false;
-
- return {
- onIgnoreTag: function(tag, html, options) {
- if (isRemoveTag(tag)) {
- if (options.isClosing) {
- var ret = "[/removed]";
- var end = options.position + ret.length;
- removeList.push([
- posStart !== false ? posStart : options.position,
- end
- ]);
- posStart = false;
- return ret;
- } else {
- if (!posStart) {
- posStart = options.position;
- }
- return "[removed]";
- }
- } else {
- return next(tag, html, options);
- }
- },
- remove: function(html) {
- var rethtml = "";
- var lastPos = 0;
- _.forEach(removeList, function(pos) {
- rethtml += html.slice(lastPos, pos[0]);
- lastPos = pos[1];
- });
- rethtml += html.slice(lastPos);
- return rethtml;
- }
- };
-}
-
-/**
- * remove html comments
- *
- * @param {String} html
- * @return {String}
- */
-function stripCommentTag(html) {
- return html.replace(STRIP_COMMENT_TAG_REGEXP, "");
-}
-var STRIP_COMMENT_TAG_REGEXP = /<!--[\s\S]*?-->/g;
-
-/**
- * remove invisible characters
- *
- * @param {String} html
- * @return {String}
- */
-function stripBlankChar(html) {
- var chars = html.split("");
- chars = chars.filter(function(char) {
- var c = char.charCodeAt(0);
- if (c === 127) return false;
- if (c <= 31) {
- if (c === 10 || c === 13) return true;
- return false;
- }
- return true;
- });
- return chars.join("");
-}
-
-exports.whiteList = getDefaultWhiteList();
-exports.getDefaultWhiteList = getDefaultWhiteList;
-exports.onTag = onTag;
-exports.onIgnoreTag = onIgnoreTag;
-exports.onTagAttr = onTagAttr;
-exports.onIgnoreTagAttr = onIgnoreTagAttr;
-exports.safeAttrValue = safeAttrValue;
-exports.escapeHtml = escapeHtml;
-exports.escapeQuote = escapeQuote;
-exports.unescapeQuote = unescapeQuote;
-exports.escapeHtmlEntities = escapeHtmlEntities;
-exports.escapeDangerHtml5Entities = escapeDangerHtml5Entities;
-exports.clearNonPrintableCharacter = clearNonPrintableCharacter;
-exports.friendlyAttrValue = friendlyAttrValue;
-exports.escapeAttrValue = escapeAttrValue;
-exports.onIgnoreTagStripAll = onIgnoreTagStripAll;
-exports.StripTagBody = StripTagBody;
-exports.stripCommentTag = stripCommentTag;
-exports.stripBlankChar = stripBlankChar;
-exports.cssFilter = defaultCSSFilter;
-exports.getDefaultCSSWhiteList = getDefaultCSSWhiteList;
diff --git a/node_modules/xss/lib/index.js b/node_modules/xss/lib/index.js
deleted file mode 100644
index e0c1a06..0000000
--- a/node_modules/xss/lib/index.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * xss
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var DEFAULT = require("./default");
-var parser = require("./parser");
-var FilterXSS = require("./xss");
-
-/**
- * filter xss function
- *
- * @param {String} html
- * @param {Object} options { whiteList, onTag, onTagAttr, onIgnoreTag, onIgnoreTagAttr, safeAttrValue, escapeHtml }
- * @return {String}
- */
-function filterXSS(html, options) {
- var xss = new FilterXSS(options);
- return xss.process(html);
-}
-
-exports = module.exports = filterXSS;
-exports.filterXSS = filterXSS;
-exports.FilterXSS = FilterXSS;
-for (var i in DEFAULT) exports[i] = DEFAULT[i];
-for (var i in parser) exports[i] = parser[i];
-
-// using `xss` on the browser, output `filterXSS` to the globals
-if (typeof window !== "undefined") {
- window.filterXSS = module.exports;
-}
-
-// using `xss` on the WebWorker, output `filterXSS` to the globals
-function isWorkerEnv() {
- return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
-}
-if (isWorkerEnv()) {
- self.filterXSS = module.exports;
-}
diff --git a/node_modules/xss/lib/parser.js b/node_modules/xss/lib/parser.js
deleted file mode 100644
index 7c15def..0000000
--- a/node_modules/xss/lib/parser.js
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * Simple HTML Parser
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var _ = require("./util");
-
-/**
- * get tag name
- *
- * @param {String} html e.g. '<a hef="#">'
- * @return {String}
- */
-function getTagName(html) {
- var i = _.spaceIndex(html);
- if (i === -1) {
- var tagName = html.slice(1, -1);
- } else {
- var tagName = html.slice(1, i + 1);
- }
- tagName = _.trim(tagName).toLowerCase();
- if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1);
- if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1);
- return tagName;
-}
-
-/**
- * is close tag?
- *
- * @param {String} html 如:'<a hef="#">'
- * @return {Boolean}
- */
-function isClosing(html) {
- return html.slice(0, 2) === "</";
-}
-
-/**
- * parse input html and returns processed html
- *
- * @param {String} html
- * @param {Function} onTag e.g. function (sourcePosition, position, tag, html, isClosing)
- * @param {Function} escapeHtml
- * @return {String}
- */
-function parseTag(html, onTag, escapeHtml) {
- "user strict";
-
- var rethtml = "";
- var lastPos = 0;
- var tagStart = false;
- var quoteStart = false;
- var currentPos = 0;
- var len = html.length;
- var currentTagName = "";
- var currentHtml = "";
-
- for (currentPos = 0; currentPos < len; currentPos++) {
- var c = html.charAt(currentPos);
- if (tagStart === false) {
- if (c === "<") {
- tagStart = currentPos;
- continue;
- }
- } else {
- if (quoteStart === false) {
- if (c === "<") {
- rethtml += escapeHtml(html.slice(lastPos, currentPos));
- tagStart = currentPos;
- lastPos = currentPos;
- continue;
- }
- if (c === ">") {
- rethtml += escapeHtml(html.slice(lastPos, tagStart));
- currentHtml = html.slice(tagStart, currentPos + 1);
- currentTagName = getTagName(currentHtml);
- rethtml += onTag(
- tagStart,
- rethtml.length,
- currentTagName,
- currentHtml,
- isClosing(currentHtml)
- );
- lastPos = currentPos + 1;
- tagStart = false;
- continue;
- }
- if ((c === '"' || c === "'") && html.charAt(currentPos - 1) === "=") {
- quoteStart = c;
- continue;
- }
- } else {
- if (c === quoteStart) {
- quoteStart = false;
- continue;
- }
- }
- }
- }
- if (lastPos < html.length) {
- rethtml += escapeHtml(html.substr(lastPos));
- }
-
- return rethtml;
-}
-
-var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9_:\.\-]/gim;
-
-/**
- * parse input attributes and returns processed attributes
- *
- * @param {String} html e.g. `href="#" target="_blank"`
- * @param {Function} onAttr e.g. `function (name, value)`
- * @return {String}
- */
-function parseAttr(html, onAttr) {
- "user strict";
-
- var lastPos = 0;
- var retAttrs = [];
- var tmpName = false;
- var len = html.length;
-
- function addAttr(name, value) {
- name = _.trim(name);
- name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
- if (name.length < 1) return;
- var ret = onAttr(name, value || "");
- if (ret) retAttrs.push(ret);
- }
-
- // 逐个分析字符
- for (var i = 0; i < len; i++) {
- var c = html.charAt(i);
- var v, j;
- if (tmpName === false && c === "=") {
- tmpName = html.slice(lastPos, i);
- lastPos = i + 1;
- continue;
- }
- if (tmpName !== false) {
- if (
- i === lastPos &&
- (c === '"' || c === "'") &&
- html.charAt(i - 1) === "="
- ) {
- j = html.indexOf(c, i + 1);
- if (j === -1) {
- break;
- } else {
- v = _.trim(html.slice(lastPos + 1, j));
- addAttr(tmpName, v);
- tmpName = false;
- i = j;
- lastPos = i + 1;
- continue;
- }
- }
- }
- if (/\s|\n|\t/.test(c)) {
- html = html.replace(/\s|\n|\t/g, " ");
- if (tmpName === false) {
- j = findNextEqual(html, i);
- if (j === -1) {
- v = _.trim(html.slice(lastPos, i));
- addAttr(v);
- tmpName = false;
- lastPos = i + 1;
- continue;
- } else {
- i = j - 1;
- continue;
- }
- } else {
- j = findBeforeEqual(html, i - 1);
- if (j === -1) {
- v = _.trim(html.slice(lastPos, i));
- v = stripQuoteWrap(v);
- addAttr(tmpName, v);
- tmpName = false;
- lastPos = i + 1;
- continue;
- } else {
- continue;
- }
- }
- }
- }
-
- if (lastPos < html.length) {
- if (tmpName === false) {
- addAttr(html.slice(lastPos));
- } else {
- addAttr(tmpName, stripQuoteWrap(_.trim(html.slice(lastPos))));
- }
- }
-
- return _.trim(retAttrs.join(" "));
-}
-
-function findNextEqual(str, i) {
- for (; i < str.length; i++) {
- var c = str[i];
- if (c === " ") continue;
- if (c === "=") return i;
- return -1;
- }
-}
-
-function findBeforeEqual(str, i) {
- for (; i > 0; i--) {
- var c = str[i];
- if (c === " ") continue;
- if (c === "=") return i;
- return -1;
- }
-}
-
-function isQuoteWrapString(text) {
- if (
- (text[0] === '"' && text[text.length - 1] === '"') ||
- (text[0] === "'" && text[text.length - 1] === "'")
- ) {
- return true;
- } else {
- return false;
- }
-}
-
-function stripQuoteWrap(text) {
- if (isQuoteWrapString(text)) {
- return text.substr(1, text.length - 2);
- } else {
- return text;
- }
-}
-
-exports.parseTag = parseTag;
-exports.parseAttr = parseAttr;
diff --git a/node_modules/xss/lib/util.js b/node_modules/xss/lib/util.js
deleted file mode 100644
index 1dcd7fa..0000000
--- a/node_modules/xss/lib/util.js
+++ /dev/null
@@ -1,34 +0,0 @@
-module.exports = {
- indexOf: function(arr, item) {
- var i, j;
- if (Array.prototype.indexOf) {
- return arr.indexOf(item);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- if (arr[i] === item) {
- return i;
- }
- }
- return -1;
- },
- forEach: function(arr, fn, scope) {
- var i, j;
- if (Array.prototype.forEach) {
- return arr.forEach(fn, scope);
- }
- for (i = 0, j = arr.length; i < j; i++) {
- fn.call(scope, arr[i], i, arr);
- }
- },
- trim: function(str) {
- if (String.prototype.trim) {
- return str.trim();
- }
- return str.replace(/(^\s*)|(\s*$)/g, "");
- },
- spaceIndex: function(str) {
- var reg = /\s|\n|\t/;
- var match = reg.exec(str);
- return match ? match.index : -1;
- }
-};
diff --git a/node_modules/xss/lib/xss.js b/node_modules/xss/lib/xss.js
deleted file mode 100644
index 74d2e42..0000000
--- a/node_modules/xss/lib/xss.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- * filter xss
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-var FilterCSS = require("cssfilter").FilterCSS;
-var DEFAULT = require("./default");
-var parser = require("./parser");
-var parseTag = parser.parseTag;
-var parseAttr = parser.parseAttr;
-var _ = require("./util");
-
-/**
- * returns `true` if the input value is `undefined` or `null`
- *
- * @param {Object} obj
- * @return {Boolean}
- */
-function isNull(obj) {
- return obj === undefined || obj === null;
-}
-
-/**
- * get attributes for a tag
- *
- * @param {String} html
- * @return {Object}
- * - {String} html
- * - {Boolean} closing
- */
-function getAttrs(html) {
- var i = _.spaceIndex(html);
- if (i === -1) {
- return {
- html: "",
- closing: html[html.length - 2] === "/"
- };
- }
- html = _.trim(html.slice(i + 1, -1));
- var isClosing = html[html.length - 1] === "/";
- if (isClosing) html = _.trim(html.slice(0, -1));
- return {
- html: html,
- closing: isClosing
- };
-}
-
-/**
- * shallow copy
- *
- * @param {Object} obj
- * @return {Object}
- */
-function shallowCopyObject(obj) {
- var ret = {};
- for (var i in obj) {
- ret[i] = obj[i];
- }
- return ret;
-}
-
-/**
- * FilterXSS class
- *
- * @param {Object} options
- * whiteList, onTag, onTagAttr, onIgnoreTag,
- * onIgnoreTagAttr, safeAttrValue, escapeHtml
- * stripIgnoreTagBody, allowCommentTag, stripBlankChar
- * css{whiteList, onAttr, onIgnoreAttr} `css=false` means don't use `cssfilter`
- */
-function FilterXSS(options) {
- options = shallowCopyObject(options || {});
-
- if (options.stripIgnoreTag) {
- if (options.onIgnoreTag) {
- console.error(
- 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'
- );
- }
- options.onIgnoreTag = DEFAULT.onIgnoreTagStripAll;
- }
-
- options.whiteList = options.whiteList || DEFAULT.whiteList;
- options.onTag = options.onTag || DEFAULT.onTag;
- options.onTagAttr = options.onTagAttr || DEFAULT.onTagAttr;
- options.onIgnoreTag = options.onIgnoreTag || DEFAULT.onIgnoreTag;
- options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT.onIgnoreTagAttr;
- options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;
- options.escapeHtml = options.escapeHtml || DEFAULT.escapeHtml;
- this.options = options;
-
- if (options.css === false) {
- this.cssFilter = false;
- } else {
- options.css = options.css || {};
- this.cssFilter = new FilterCSS(options.css);
- }
-}
-
-/**
- * start process and returns result
- *
- * @param {String} html
- * @return {String}
- */
-FilterXSS.prototype.process = function(html) {
- // compatible with the input
- html = html || "";
- html = html.toString();
- if (!html) return "";
-
- var me = this;
- var options = me.options;
- var whiteList = options.whiteList;
- var onTag = options.onTag;
- var onIgnoreTag = options.onIgnoreTag;
- var onTagAttr = options.onTagAttr;
- var onIgnoreTagAttr = options.onIgnoreTagAttr;
- var safeAttrValue = options.safeAttrValue;
- var escapeHtml = options.escapeHtml;
- var cssFilter = me.cssFilter;
-
- // remove invisible characters
- if (options.stripBlankChar) {
- html = DEFAULT.stripBlankChar(html);
- }
-
- // remove html comments
- if (!options.allowCommentTag) {
- html = DEFAULT.stripCommentTag(html);
- }
-
- // if enable stripIgnoreTagBody
- var stripIgnoreTagBody = false;
- if (options.stripIgnoreTagBody) {
- var stripIgnoreTagBody = DEFAULT.StripTagBody(
- options.stripIgnoreTagBody,
- onIgnoreTag
- );
- onIgnoreTag = stripIgnoreTagBody.onIgnoreTag;
- }
-
- var retHtml = parseTag(
- html,
- function(sourcePosition, position, tag, html, isClosing) {
- var info = {
- sourcePosition: sourcePosition,
- position: position,
- isClosing: isClosing,
- isWhite: whiteList.hasOwnProperty(tag)
- };
-
- // call `onTag()`
- var ret = onTag(tag, html, info);
- if (!isNull(ret)) return ret;
-
- if (info.isWhite) {
- if (info.isClosing) {
- return "</" + tag + ">";
- }
-
- var attrs = getAttrs(html);
- var whiteAttrList = whiteList[tag];
- var attrsHtml = parseAttr(attrs.html, function(name, value) {
- // call `onTagAttr()`
- var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
- var ret = onTagAttr(tag, name, value, isWhiteAttr);
- if (!isNull(ret)) return ret;
-
- if (isWhiteAttr) {
- // call `safeAttrValue()`
- value = safeAttrValue(tag, name, value, cssFilter);
- if (value) {
- return name + '="' + value + '"';
- } else {
- return name;
- }
- } else {
- // call `onIgnoreTagAttr()`
- var ret = onIgnoreTagAttr(tag, name, value, isWhiteAttr);
- if (!isNull(ret)) return ret;
- return;
- }
- });
-
- // build new tag html
- var html = "<" + tag;
- if (attrsHtml) html += " " + attrsHtml;
- if (attrs.closing) html += " /";
- html += ">";
- return html;
- } else {
- // call `onIgnoreTag()`
- var ret = onIgnoreTag(tag, html, info);
- if (!isNull(ret)) return ret;
- return escapeHtml(html);
- }
- },
- escapeHtml
- );
-
- // if enable stripIgnoreTagBody
- if (stripIgnoreTagBody) {
- retHtml = stripIgnoreTagBody.remove(retHtml);
- }
-
- return retHtml;
-};
-
-module.exports = FilterXSS;
diff --git a/node_modules/xss/package.json b/node_modules/xss/package.json
deleted file mode 100644
index 8caf468..0000000
--- a/node_modules/xss/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "_from": "xss",
- "_id": "xss@1.0.6",
- "_inBundle": false,
- "_integrity": "sha512-6Q9TPBeNyoTRxgZFk5Ggaepk/4vUOYdOsIUYvLehcsIZTFjaavbVnsuAkLA5lIFuug5hw8zxcB9tm01gsjph2A==",
- "_location": "/xss",
- "_phantomChildren": {},
- "_requested": {
- "type": "tag",
- "registry": true,
- "raw": "xss",
- "name": "xss",
- "escapedName": "xss",
- "rawSpec": "",
- "saveSpec": null,
- "fetchSpec": "latest"
- },
- "_requiredBy": [
- "#USER",
- "/"
- ],
- "_resolved": "https://registry.npmjs.org/xss/-/xss-1.0.6.tgz",
- "_shasum": "eaf11e9fc476e3ae289944a1009efddd8a124b51",
- "_spec": "xss",
- "_where": "/home/cargova/projects/beziapp.github.io",
- "author": {
- "name": "Zongmin Lei",
- "email": "leizongmin@gmail.com",
- "url": "http://ucdok.com"
- },
- "bin": {
- "xss": "./bin/xss"
- },
- "bugs": {
- "url": "https://github.com/leizongmin/js-xss/issues"
- },
- "bundleDependencies": false,
- "dependencies": {
- "commander": "^2.9.0",
- "cssfilter": "0.0.10"
- },
- "deprecated": false,
- "description": "Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist",
- "devDependencies": {
- "browserify": "^14.1.0",
- "coveralls": "^3.0.0",
- "debug": "^3.1.0",
- "istanbul": "^0.4.3",
- "mocha": "^4.0.1",
- "uglify-js": "^3.0.14"
- },
- "engines": {
- "node": ">= 0.10.0"
- },
- "files": [
- "lib",
- "bin/xss",
- "dist",
- "typings/*.d.ts"
- ],
- "homepage": "https://github.com/leizongmin/js-xss",
- "keywords": [
- "sanitization",
- "xss",
- "sanitize",
- "sanitisation",
- "input",
- "security",
- "escape",
- "encode",
- "filter",
- "validator",
- "html",
- "injection",
- "whitelist"
- ],
- "license": "MIT",
- "main": "./lib/index.js",
- "name": "xss",
- "repository": {
- "type": "git",
- "url": "git://github.com/leizongmin/js-xss.git"
- },
- "scripts": {
- "build": "./bin/build",
- "prepublish": "npm run test && npm run build",
- "test": "export DEBUG=xss:* && mocha -t 5000",
- "test-cov": "export DEBUG=xss:* && istanbul cover _mocha --report lcovonly -- -t 5000 -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
- },
- "typings": "./typings/xss.d.ts",
- "version": "1.0.6"
-}
diff --git a/node_modules/xss/typings/xss.d.ts b/node_modules/xss/typings/xss.d.ts
deleted file mode 100644
index 1f6f2ca..0000000
--- a/node_modules/xss/typings/xss.d.ts
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * xss
- *
- * @author Zongmin Lei<leizongmin@gmail.com>
- */
-
-declare global {
- function filterXSS(html: string, options?: IFilterXSSOptions): string;
-
- namespace XSS {
- export interface IFilterXSSOptions {
- whiteList?: IWhiteList;
- onTag?: OnTagHandler;
- onTagAttr?: OnTagAttrHandler;
- onIgnoreTag?: OnTagHandler;
- onIgnoreTagAttr?: OnTagAttrHandler;
- safeAttrValue?: SafeAttrValueHandler;
- escapeHtml?: EscapeHandler;
- stripIgnoreTag?: boolean;
- stripIgnoreTagBody?: boolean | string[];
- allowCommentTag?: boolean;
- stripBlankChar?: boolean;
- css?: {} | boolean;
- }
-
- interface IWhiteList {
- a?: string[];
- abbr?: string[];
- address?: string[];
- area?: string[];
- article?: string[];
- aside?: string[];
- audio?: string[];
- b?: string[];
- bdi?: string[];
- bdo?: string[];
- big?: string[];
- blockquote?: string[];
- br?: string[];
- caption?: string[];
- center?: string[];
- cite?: string[];
- code?: string[];
- col?: string[];
- colgroup?: string[];
- dd?: string[];
- del?: string[];
- details?: string[];
- div?: string[];
- dl?: string[];
- dt?: string[];
- em?: string[];
- font?: string[];
- footer?: string[];
- h1?: string[];
- h2?: string[];
- h3?: string[];
- h4?: string[];
- h5?: string[];
- h6?: string[];
- header?: string[];
- hr?: string[];
- i?: string[];
- img?: string[];
- ins?: string[];
- li?: string[];
- mark?: string[];
- nav?: string[];
- ol?: string[];
- p?: string[];
- pre?: string[];
- s?: string[];
- section?: string[];
- small?: string[];
- span?: string[];
- sub?: string[];
- sup?: string[];
- strong?: string[];
- table?: string[];
- tbody?: string[];
- td?: string[];
- tfoot?: string[];
- th?: string[];
- thead?: string[];
- tr?: string[];
- tt?: string[];
- u?: string[];
- ul?: string[];
- video?: string[];
- }
-
- type OnTagHandler = (
- tag: string,
- html: string,
- options: {}
- ) => string | void;
-
- type OnTagAttrHandler = (
- tag: string,
- name: string,
- value: string,
- isWhiteAttr: boolean
- ) => string | void;
-
- type SafeAttrValueHandler = (
- tag: string,
- name: string,
- value: string,
- cssFilter: ICSSFilter
- ) => string;
-
- type EscapeHandler = (str: string) => string;
-
- interface ICSSFilter {
- process(value: string): string;
- }
- }
-}
-
-export interface IFilterXSSOptions extends XSS.IFilterXSSOptions {}
-
-export interface IWhiteList extends XSS.IWhiteList {}
-
-export type OnTagHandler = XSS.OnTagHandler;
-
-export type OnTagAttrHandler = XSS.OnTagAttrHandler;
-
-export type SafeAttrValueHandler = XSS.SafeAttrValueHandler;
-
-export type EscapeHandler = XSS.EscapeHandler;
-
-export interface ICSSFilter extends XSS.ICSSFilter {}
-
-export function StripTagBody(
- tags: string[],
- next: () => void
-): {
- onIgnoreTag(
- tag: string,
- html: string,
- options: {
- position: number;
- isClosing: boolean;
- }
- ): string;
- remove(html: string): string;
-};
-
-export class FilterXSS {
- constructor(options?: IFilterXSSOptions);
- process(html: string): string;
-}
-
-export function filterXSS(html: string, options?: IFilterXSSOptions): string;
-export function parseTag(
- html: string,
- onTag: (
- sourcePosition: number,
- position: number,
- tag: string,
- html: string,
- isClosing: boolean
- ) => string,
- escapeHtml: EscapeHandler
-): string;
-export function parseAttr(
- html: string,
- onAttr: (name: string, value: string) => string
-): string;
-export const whiteList: IWhiteList;
-export function getDefaultWhiteList(): IWhiteList;
-export const onTag: OnTagHandler;
-export const onIgnoreTag: OnTagHandler;
-export const onTagAttr: OnTagAttrHandler;
-export const onIgnoreTagAttr: OnTagAttrHandler;
-export const safeAttrValue: SafeAttrValueHandler;
-export const escapeHtml: EscapeHandler;
-export const escapeQuote: EscapeHandler;
-export const unescapeQuote: EscapeHandler;
-export const escapeHtmlEntities: EscapeHandler;
-export const escapeDangerHtml5Entities: EscapeHandler;
-export const clearNonPrintableCharacter: EscapeHandler;
-export const friendlyAttrValue: EscapeHandler;
-export const escapeAttrValue: EscapeHandler;
-export function onIgnoreTagStripAll(): string;
-export const stripCommentTag: EscapeHandler;
-export const stripBlankChar: EscapeHandler;
-export const cssFilter: ICSSFilter;
-export function getDefaultCSSWhiteList(): ICSSFilter;