diff --git a/.gitignore b/.gitignore index c2658d7..b82f93f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules/ +node_modules +babel_cache diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn deleted file mode 120000 index cf76760..0000000 --- a/node_modules/.bin/acorn +++ /dev/null @@ -1 +0,0 @@ -../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/.bin/babel b/node_modules/.bin/babel deleted file mode 120000 index ab35a98..0000000 --- a/node_modules/.bin/babel +++ /dev/null @@ -1 +0,0 @@ -../babel-cli/bin/babel.js \ No newline at end of file diff --git a/node_modules/.bin/babel-doctor b/node_modules/.bin/babel-doctor deleted file mode 120000 index 9112dd7..0000000 --- a/node_modules/.bin/babel-doctor +++ /dev/null @@ -1 +0,0 @@ -../babel-cli/bin/babel-doctor.js \ No newline at end of file diff --git a/node_modules/.bin/babel-external-helpers b/node_modules/.bin/babel-external-helpers deleted file mode 120000 index 919117c..0000000 --- a/node_modules/.bin/babel-external-helpers +++ /dev/null @@ -1 +0,0 @@ -../babel-cli/bin/babel-external-helpers.js \ No newline at end of file diff --git a/node_modules/.bin/babel-node b/node_modules/.bin/babel-node deleted file mode 120000 index 489c4fc..0000000 --- a/node_modules/.bin/babel-node +++ /dev/null @@ -1 +0,0 @@ -../babel-cli/bin/babel-node.js \ No newline at end of file diff --git a/node_modules/.bin/babylon b/node_modules/.bin/babylon deleted file mode 120000 index c2adc01..0000000 --- a/node_modules/.bin/babylon +++ /dev/null @@ -1 +0,0 @@ -../babylon/bin/babylon.js \ No newline at end of file diff --git a/node_modules/.bin/browserslist b/node_modules/.bin/browserslist deleted file mode 120000 index 3cd991b..0000000 --- a/node_modules/.bin/browserslist +++ /dev/null @@ -1 +0,0 @@ -../browserslist/cli.js \ No newline at end of file diff --git a/node_modules/.bin/cssesc b/node_modules/.bin/cssesc deleted file mode 120000 index 487b689..0000000 --- a/node_modules/.bin/cssesc +++ /dev/null @@ -1 +0,0 @@ -../cssesc/bin/cssesc \ No newline at end of file diff --git a/node_modules/.bin/csso b/node_modules/.bin/csso deleted file mode 120000 index b358524..0000000 --- a/node_modules/.bin/csso +++ /dev/null @@ -1 +0,0 @@ -../csso/bin/csso \ No newline at end of file diff --git a/node_modules/.bin/errno b/node_modules/.bin/errno deleted file mode 120000 index 5a98e53..0000000 --- a/node_modules/.bin/errno +++ /dev/null @@ -1 +0,0 @@ -../errno/cli.js \ No newline at end of file diff --git a/node_modules/.bin/esparse b/node_modules/.bin/esparse deleted file mode 120000 index 7423b18..0000000 --- a/node_modules/.bin/esparse +++ /dev/null @@ -1 +0,0 @@ -../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/.bin/esvalidate b/node_modules/.bin/esvalidate deleted file mode 120000 index 16069ef..0000000 --- a/node_modules/.bin/esvalidate +++ /dev/null @@ -1 +0,0 @@ -../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml deleted file mode 120000 index 9dbd010..0000000 --- a/node_modules/.bin/js-yaml +++ /dev/null @@ -1 +0,0 @@ -../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/jsesc b/node_modules/.bin/jsesc deleted file mode 120000 index 7237604..0000000 --- a/node_modules/.bin/jsesc +++ /dev/null @@ -1 +0,0 @@ -../jsesc/bin/jsesc \ No newline at end of file diff --git a/node_modules/.bin/jshint b/node_modules/.bin/jshint deleted file mode 120000 index 1b5b30c..0000000 --- a/node_modules/.bin/jshint +++ /dev/null @@ -1 +0,0 @@ -../jshint/bin/jshint \ No newline at end of file diff --git a/node_modules/.bin/json5 b/node_modules/.bin/json5 deleted file mode 120000 index 217f379..0000000 --- a/node_modules/.bin/json5 +++ /dev/null @@ -1 +0,0 @@ -../json5/lib/cli.js \ No newline at end of file diff --git a/node_modules/.bin/loose-envify b/node_modules/.bin/loose-envify deleted file mode 120000 index ed9009c..0000000 --- a/node_modules/.bin/loose-envify +++ /dev/null @@ -1 +0,0 @@ -../loose-envify/cli.js \ No newline at end of file diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime deleted file mode 120000 index fbb7ee0..0000000 --- a/node_modules/.bin/mime +++ /dev/null @@ -1 +0,0 @@ -../mime/cli.js \ No newline at end of file diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp deleted file mode 120000 index 017896c..0000000 --- a/node_modules/.bin/mkdirp +++ /dev/null @@ -1 +0,0 @@ -../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/node_modules/.bin/regjsparser b/node_modules/.bin/regjsparser deleted file mode 120000 index 91cec77..0000000 --- a/node_modules/.bin/regjsparser +++ /dev/null @@ -1 +0,0 @@ -../regjsparser/bin/parser \ No newline at end of file diff --git a/node_modules/.bin/sha.js b/node_modules/.bin/sha.js deleted file mode 120000 index 3c76105..0000000 --- a/node_modules/.bin/sha.js +++ /dev/null @@ -1 +0,0 @@ -../sha.js/bin.js \ No newline at end of file diff --git a/node_modules/.bin/shjs b/node_modules/.bin/shjs deleted file mode 120000 index a044997..0000000 --- a/node_modules/.bin/shjs +++ /dev/null @@ -1 +0,0 @@ -../shelljs/bin/shjs \ No newline at end of file diff --git a/node_modules/.bin/strip-json-comments b/node_modules/.bin/strip-json-comments deleted file mode 120000 index 63d549f..0000000 --- a/node_modules/.bin/strip-json-comments +++ /dev/null @@ -1 +0,0 @@ -../strip-json-comments/cli.js \ No newline at end of file diff --git a/node_modules/.bin/svgo b/node_modules/.bin/svgo deleted file mode 120000 index d6a228b..0000000 --- a/node_modules/.bin/svgo +++ /dev/null @@ -1 +0,0 @@ -../svgo/bin/svgo \ No newline at end of file diff --git a/node_modules/.bin/uglifyjs b/node_modules/.bin/uglifyjs deleted file mode 120000 index fef3468..0000000 --- a/node_modules/.bin/uglifyjs +++ /dev/null @@ -1 +0,0 @@ -../uglify-js/bin/uglifyjs \ No newline at end of file diff --git a/node_modules/.bin/user-home b/node_modules/.bin/user-home deleted file mode 120000 index d72d76b..0000000 --- a/node_modules/.bin/user-home +++ /dev/null @@ -1 +0,0 @@ -../user-home/cli.js \ No newline at end of file diff --git a/node_modules/.bin/webpack b/node_modules/.bin/webpack deleted file mode 120000 index d462c1d..0000000 --- a/node_modules/.bin/webpack +++ /dev/null @@ -1 +0,0 @@ -../webpack/bin/webpack.js \ No newline at end of file diff --git a/node_modules/.bin/webpack-dev-server b/node_modules/.bin/webpack-dev-server deleted file mode 120000 index 242fe0a..0000000 --- a/node_modules/.bin/webpack-dev-server +++ /dev/null @@ -1 +0,0 @@ -../webpack-dev-server/bin/webpack-dev-server.js \ No newline at end of file diff --git a/node_modules/accepts/HISTORY.md b/node_modules/accepts/HISTORY.md deleted file mode 100644 index 0477ed7..0000000 --- a/node_modules/accepts/HISTORY.md +++ /dev/null @@ -1,212 +0,0 @@ -1.3.3 / 2016-05-02 -================== - - * deps: mime-types@~2.1.11 - - deps: mime-db@~1.23.0 - * deps: negotiator@0.6.1 - - perf: improve `Accept` parsing speed - - perf: improve `Accept-Charset` parsing speed - - perf: improve `Accept-Encoding` parsing speed - - perf: improve `Accept-Language` parsing speed - -1.3.2 / 2016-03-08 -================== - - * deps: mime-types@~2.1.10 - - Fix extension of `application/dash+xml` - - Update primary extension for `audio/mp4` - - deps: mime-db@~1.22.0 - -1.3.1 / 2016-01-19 -================== - - * deps: mime-types@~2.1.9 - - deps: mime-db@~1.21.0 - -1.3.0 / 2015-09-29 -================== - - * deps: mime-types@~2.1.7 - - deps: mime-db@~1.19.0 - * deps: negotiator@0.6.0 - - Fix including type extensions in parameters in `Accept` parsing - - Fix parsing `Accept` parameters with quoted equals - - Fix parsing `Accept` parameters with quoted semicolons - - Lazy-load modules from main entry point - - perf: delay type concatenation until needed - - perf: enable strict mode - - perf: hoist regular expressions - - perf: remove closures getting spec properties - - perf: remove a closure from media type parsing - - perf: remove property delete from media type parsing - -1.2.13 / 2015-09-06 -=================== - - * deps: mime-types@~2.1.6 - - deps: mime-db@~1.18.0 - -1.2.12 / 2015-07-30 -=================== - - * deps: mime-types@~2.1.4 - - deps: mime-db@~1.16.0 - -1.2.11 / 2015-07-16 -=================== - - * deps: mime-types@~2.1.3 - - deps: mime-db@~1.15.0 - -1.2.10 / 2015-07-01 -=================== - - * deps: mime-types@~2.1.2 - - deps: mime-db@~1.14.0 - -1.2.9 / 2015-06-08 -================== - - * deps: mime-types@~2.1.1 - - perf: fix deopt during mapping - -1.2.8 / 2015-06-07 -================== - - * deps: mime-types@~2.1.0 - - deps: mime-db@~1.13.0 - * perf: avoid argument reassignment & argument slice - * perf: avoid negotiator recursive construction - * perf: enable strict mode - * perf: remove unnecessary bitwise operator - -1.2.7 / 2015-05-10 -================== - - * deps: negotiator@0.5.3 - - Fix media type parameter matching to be case-insensitive - -1.2.6 / 2015-05-07 -================== - - * deps: mime-types@~2.0.11 - - deps: mime-db@~1.9.1 - * deps: negotiator@0.5.2 - - Fix comparing media types with quoted values - - Fix splitting media types with quoted commas - -1.2.5 / 2015-03-13 -================== - - * deps: mime-types@~2.0.10 - - deps: mime-db@~1.8.0 - -1.2.4 / 2015-02-14 -================== - - * Support Node.js 0.6 - * deps: mime-types@~2.0.9 - - deps: mime-db@~1.7.0 - * deps: negotiator@0.5.1 - - Fix preference sorting to be stable for long acceptable lists - -1.2.3 / 2015-01-31 -================== - - * deps: mime-types@~2.0.8 - - deps: mime-db@~1.6.0 - -1.2.2 / 2014-12-30 -================== - - * deps: mime-types@~2.0.7 - - deps: mime-db@~1.5.0 - -1.2.1 / 2014-12-30 -================== - - * deps: mime-types@~2.0.5 - - deps: mime-db@~1.3.1 - -1.2.0 / 2014-12-19 -================== - - * deps: negotiator@0.5.0 - - Fix list return order when large accepted list - - Fix missing identity encoding when q=0 exists - - Remove dynamic building of Negotiator class - -1.1.4 / 2014-12-10 -================== - - * deps: mime-types@~2.0.4 - - deps: mime-db@~1.3.0 - -1.1.3 / 2014-11-09 -================== - - * deps: mime-types@~2.0.3 - - deps: mime-db@~1.2.0 - -1.1.2 / 2014-10-14 -================== - - * deps: negotiator@0.4.9 - - Fix error when media type has invalid parameter - -1.1.1 / 2014-09-28 -================== - - * deps: mime-types@~2.0.2 - - deps: mime-db@~1.1.0 - * deps: negotiator@0.4.8 - - Fix all negotiations to be case-insensitive - - Stable sort preferences of same quality according to client order - -1.1.0 / 2014-09-02 -================== - - * update `mime-types` - -1.0.7 / 2014-07-04 -================== - - * Fix wrong type returned from `type` when match after unknown extension - -1.0.6 / 2014-06-24 -================== - - * deps: negotiator@0.4.7 - -1.0.5 / 2014-06-20 -================== - - * fix crash when unknown extension given - -1.0.4 / 2014-06-19 -================== - - * use `mime-types` - -1.0.3 / 2014-06-11 -================== - - * deps: negotiator@0.4.6 - - Order by specificity when quality is the same - -1.0.2 / 2014-05-29 -================== - - * Fix interpretation when header not in request - * deps: pin negotiator@0.4.5 - -1.0.1 / 2014-01-18 -================== - - * Identity encoding isn't always acceptable - * deps: negotiator@~0.4.0 - -1.0.0 / 2013-12-27 -================== - - * Genesis diff --git a/node_modules/accepts/LICENSE b/node_modules/accepts/LICENSE deleted file mode 100644 index 0616607..0000000 --- a/node_modules/accepts/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2015 Douglas Christopher Wilson - -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/accepts/README.md b/node_modules/accepts/README.md deleted file mode 100644 index ae36676..0000000 --- a/node_modules/accepts/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# accepts - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). Extracted from [koa](https://www.npmjs.com/package/koa) for general use. - -In addition to negotiator, it allows: - -- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` as well as `('text/html', 'application/json')`. -- Allows type shorthands such as `json`. -- Returns `false` when no types match -- Treats non-existent headers as `*` - -## Installation - -```sh -npm install accepts -``` - -## API - -```js -var accepts = require('accepts') -``` - -### accepts(req) - -Create a new `Accepts` object for the given `req`. - -#### .charset(charsets) - -Return the first accepted charset. If nothing in `charsets` is accepted, -then `false` is returned. - -#### .charsets() - -Return the charsets that the request accepts, in the order of the client's -preference (most preferred first). - -#### .encoding(encodings) - -Return the first accepted encoding. If nothing in `encodings` is accepted, -then `false` is returned. - -#### .encodings() - -Return the encodings that the request accepts, in the order of the client's -preference (most preferred first). - -#### .language(languages) - -Return the first accepted language. If nothing in `languages` is accepted, -then `false` is returned. - -#### .languages() - -Return the languages that the request accepts, in the order of the client's -preference (most preferred first). - -#### .type(types) - -Return the first accepted type (and it is returned as the same text as what -appears in the `types` array). If nothing in `types` is accepted, then `false` -is returned. - -The `types` array can contain full MIME types or file extensions. Any value -that is not a full MIME types is passed to `require('mime-types').lookup`. - -#### .types() - -Return the types that the request accepts, in the order of the client's -preference (most preferred first). - -## Examples - -### Simple type negotiation - -This simple example shows how to use `accepts` to return a different typed -respond body based on what the client wants to accept. The server lists it's -preferences in order and will get back the best match between the client and -server. - -```js -var accepts = require('accepts') -var http = require('http') - -function app(req, res) { - var accept = accepts(req) - - // the order of this list is significant; should be server preferred order - switch(accept.type(['json', 'html'])) { - case 'json': - res.setHeader('Content-Type', 'application/json') - res.write('{"hello":"world!"}') - break - case 'html': - res.setHeader('Content-Type', 'text/html') - res.write('hello, world!') - break - default: - // the fallback is text/plain, so no need to specify it above - res.setHeader('Content-Type', 'text/plain') - res.write('hello, world!') - break - } - - res.end() -} - -http.createServer(app).listen(3000) -``` - -You can test this out with the cURL program: -```sh -curl -I -H'Accept: text/html' http://localhost:3000/ -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/accepts.svg -[npm-url]: https://npmjs.org/package/accepts -[node-version-image]: https://img.shields.io/node/v/accepts.svg -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg -[travis-url]: https://travis-ci.org/jshttp/accepts -[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/accepts -[downloads-image]: https://img.shields.io/npm/dm/accepts.svg -[downloads-url]: https://npmjs.org/package/accepts diff --git a/node_modules/accepts/index.js b/node_modules/accepts/index.js deleted file mode 100644 index e80192a..0000000 --- a/node_modules/accepts/index.js +++ /dev/null @@ -1,231 +0,0 @@ -/*! - * accepts - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var Negotiator = require('negotiator') -var mime = require('mime-types') - -/** - * Module exports. - * @public - */ - -module.exports = Accepts - -/** - * Create a new Accepts object for the given req. - * - * @param {object} req - * @public - */ - -function Accepts(req) { - if (!(this instanceof Accepts)) - return new Accepts(req) - - this.headers = req.headers - this.negotiator = new Negotiator(req) -} - -/** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json" or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * this.types('html'); - * // => "html" - * - * // Accept: text/*, application/json - * this.types('html'); - * // => "html" - * this.types('text/html'); - * // => "text/html" - * this.types('json', 'text'); - * // => "json" - * this.types('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * this.types('image/png'); - * this.types('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * this.types(['html', 'json']); - * this.types('html', 'json'); - * // => "json" - * - * @param {String|Array} types... - * @return {String|Array|Boolean} - * @public - */ - -Accepts.prototype.type = -Accepts.prototype.types = function (types_) { - var types = types_ - - // support flattened arguments - if (types && !Array.isArray(types)) { - types = new Array(arguments.length) - for (var i = 0; i < types.length; i++) { - types[i] = arguments[i] - } - } - - // no types, return all requested types - if (!types || types.length === 0) { - return this.negotiator.mediaTypes() - } - - if (!this.headers.accept) return types[0]; - var mimes = types.map(extToMime); - var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)); - var first = accepts[0]; - if (!first) return false; - return types[mimes.indexOf(first)]; -} - -/** - * Return accepted encodings or best fit based on `encodings`. - * - * Given `Accept-Encoding: gzip, deflate` - * an array sorted by quality is returned: - * - * ['gzip', 'deflate'] - * - * @param {String|Array} encodings... - * @return {String|Array} - * @public - */ - -Accepts.prototype.encoding = -Accepts.prototype.encodings = function (encodings_) { - var encodings = encodings_ - - // support flattened arguments - if (encodings && !Array.isArray(encodings)) { - encodings = new Array(arguments.length) - for (var i = 0; i < encodings.length; i++) { - encodings[i] = arguments[i] - } - } - - // no encodings, return all requested encodings - if (!encodings || encodings.length === 0) { - return this.negotiator.encodings() - } - - return this.negotiator.encodings(encodings)[0] || false -} - -/** - * Return accepted charsets or best fit based on `charsets`. - * - * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` - * an array sorted by quality is returned: - * - * ['utf-8', 'utf-7', 'iso-8859-1'] - * - * @param {String|Array} charsets... - * @return {String|Array} - * @public - */ - -Accepts.prototype.charset = -Accepts.prototype.charsets = function (charsets_) { - var charsets = charsets_ - - // support flattened arguments - if (charsets && !Array.isArray(charsets)) { - charsets = new Array(arguments.length) - for (var i = 0; i < charsets.length; i++) { - charsets[i] = arguments[i] - } - } - - // no charsets, return all requested charsets - if (!charsets || charsets.length === 0) { - return this.negotiator.charsets() - } - - return this.negotiator.charsets(charsets)[0] || false -} - -/** - * Return accepted languages or best fit based on `langs`. - * - * Given `Accept-Language: en;q=0.8, es, pt` - * an array sorted by quality is returned: - * - * ['es', 'pt', 'en'] - * - * @param {String|Array} langs... - * @return {Array|String} - * @public - */ - -Accepts.prototype.lang = -Accepts.prototype.langs = -Accepts.prototype.language = -Accepts.prototype.languages = function (languages_) { - var languages = languages_ - - // support flattened arguments - if (languages && !Array.isArray(languages)) { - languages = new Array(arguments.length) - for (var i = 0; i < languages.length; i++) { - languages[i] = arguments[i] - } - } - - // no languages, return all requested languages - if (!languages || languages.length === 0) { - return this.negotiator.languages() - } - - return this.negotiator.languages(languages)[0] || false -} - -/** - * Convert extnames to mime. - * - * @param {String} type - * @return {String} - * @private - */ - -function extToMime(type) { - return type.indexOf('/') === -1 - ? mime.lookup(type) - : type -} - -/** - * Check if mime is valid. - * - * @param {String} type - * @return {String} - * @private - */ - -function validMime(type) { - return typeof type === 'string'; -} diff --git a/node_modules/accepts/package.json b/node_modules/accepts/package.json deleted file mode 100644 index 1fcf412..0000000 --- a/node_modules/accepts/package.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "accepts@~1.3.3", - "scope": null, - "escapedName": "accepts", - "name": "accepts", - "rawSpec": "~1.3.3", - "spec": ">=1.3.3 <1.4.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/compression" - ] - ], - "_from": "accepts@>=1.3.3 <1.4.0", - "_id": "accepts@1.3.3", - "_inCache": true, - "_location": "/accepts", - "_nodeVersion": "4.4.3", - "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/accepts-1.3.3.tgz_1462251932032_0.7092335098423064" - }, - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "_npmVersion": "2.15.1", - "_phantomChildren": {}, - "_requested": { - "raw": "accepts@~1.3.3", - "scope": null, - "escapedName": "accepts", - "name": "accepts", - "rawSpec": "~1.3.3", - "spec": ">=1.3.3 <1.4.0", - "type": "range" - }, - "_requiredBy": [ - "/compression", - "/express", - "/serve-index" - ], - "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", - "_shasum": "c3ca7434938648c3e0d9c1e328dd68b622c284ca", - "_shrinkwrap": null, - "_spec": "accepts@~1.3.3", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/compression", - "bugs": { - "url": "https://github.com/jshttp/accepts/issues" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - } - ], - "dependencies": { - "mime-types": "~2.1.11", - "negotiator": "0.6.1" - }, - "description": "Higher-level content negotiation", - "devDependencies": { - "istanbul": "0.4.3", - "mocha": "~1.21.5" - }, - "directories": {}, - "dist": { - "shasum": "c3ca7434938648c3e0d9c1e328dd68b622c284ca", - "tarball": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz" - }, - "engines": { - "node": ">= 0.6" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "gitHead": "3e925b1e65ed7da2798849683d49814680dfa426", - "homepage": "https://github.com/jshttp/accepts#readme", - "keywords": [ - "content", - "negotiation", - "accept", - "accepts" - ], - "license": "MIT", - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "name": "accepts", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/accepts.git" - }, - "scripts": { - "test": "mocha --reporter spec --check-leaks --bail test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "version": "1.3.3" -} diff --git a/node_modules/acorn/.editorconfig b/node_modules/acorn/.editorconfig deleted file mode 100644 index c14d5c6..0000000 --- a/node_modules/acorn/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true diff --git a/node_modules/acorn/.gitattributes b/node_modules/acorn/.gitattributes deleted file mode 100644 index fcadb2c..0000000 --- a/node_modules/acorn/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text eol=lf diff --git a/node_modules/acorn/.npmignore b/node_modules/acorn/.npmignore deleted file mode 100644 index ecba291..0000000 --- a/node_modules/acorn/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -/.tern-port -/test -/local diff --git a/node_modules/acorn/.tern-project b/node_modules/acorn/.tern-project deleted file mode 100644 index 6718ce0..0000000 --- a/node_modules/acorn/.tern-project +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": { - "node": true, - "es_modules": true - } -} \ No newline at end of file diff --git a/node_modules/acorn/.travis.yml b/node_modules/acorn/.travis.yml deleted file mode 100644 index d9ee88b..0000000 --- a/node_modules/acorn/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -sudo: false -node_js: - - '0.12' - - '4' - - '5' - - '6' diff --git a/node_modules/acorn/AUTHORS b/node_modules/acorn/AUTHORS deleted file mode 100644 index 1b2061c..0000000 --- a/node_modules/acorn/AUTHORS +++ /dev/null @@ -1,59 +0,0 @@ -List of Acorn contributors. Updated before every release. - -Adrian Rakovsky -Alistair Braidwood -Amila Welihinda -Andres Suarez -Angelo -Aparajita Fishman -Arian Stolwijk -Artem Govorov -Brandon Mills -Charles Hughes -Conrad Irwin -Daniel Tschinder -David Bonnet -Domenico Matteo -ForbesLindesay -Forbes Lindesay -Gilad Peleg -impinball -Ingvar Stepanyan -Jackson Ray Hamilton -Jesse McCarthy -Jiaxing Wang -Joel Kemp -Johannes Herr -Jordan Klassen -Jürg Lehni -keeyipchan -Keheliya Gallaba -Kevin Irish -Kevin Kwok -krator -Marijn Haverbeke -Martin Carlberg -Mathias Bynens -Mathieu 'p01' Henri -Matthew Bastien -Max Schaefer -Max Zerzouri -Mihai Bazon -Mike Rennie -Nicholas C. Zakas -Nick Fitzgerald -Olivier Thomann -Oskar Schöldström -Paul Harper -Peter Rust -PlNG -Prayag Verma -ReadmeCritic -r-e-d -Richard Gibson -Rich Harris -Rich-Harris -Sebastian McKenzie -Timothy Gu -Toru Nagashima -zsjforcn diff --git a/node_modules/acorn/CHANGELOG.md b/node_modules/acorn/CHANGELOG.md deleted file mode 100644 index 16b8212..0000000 --- a/node_modules/acorn/CHANGELOG.md +++ /dev/null @@ -1,159 +0,0 @@ -## 3.3.0 (2016-07-25) - -### Bug fixes - -Fix bug in tokenizing of regexp operator after a function declaration. - -Fix parser crash when parsing an array pattern with a hole. - -### New features - -Implement check against complex argument lists in functions that -enable strict mode in ES7. - -## 3.2.0 (2016-06-07) - -### Bug fixes - -Improve handling of lack of unicode regexp support in host -environment. - -Properly reject shorthand properties whose name is a keyword. - -Don't crash when the loose parser is called without options object. - -### New features - -Visitors created with `visit.make` now have their base as _prototype_, -rather than copying properties into a fresh object. - -Make it possible to use `visit.ancestor` with a walk state. - -## 3.1.0 (2016-04-18) - -### Bug fixes - -Fix issue where the loose parser created invalid TemplateElement nodes -for unclosed template literals. - -Properly tokenize the division operator directly after a function -expression. - -Allow trailing comma in destructuring arrays. - -### New features - -The walker now allows defining handlers for `CatchClause` nodes. - -## 3.0.4 (2016-02-25) - -### Fixes - -Allow update expressions as left-hand-side of the ES7 exponential -operator. - -## 3.0.2 (2016-02-10) - -### Fixes - -Fix bug that accidentally made `undefined` a reserved word when -parsing ES7. - -## 3.0.0 (2016-02-10) - -### Breaking changes - -The default value of the `ecmaVersion` option is now 6 (used to be 5). - -Support for comprehension syntax (which was dropped from the draft -spec) has been removed. - -### Fixes - -`let` and `yield` are now “contextual keywords”, meaning you can -mostly use them as identifiers in ES5 non-strict code. - -A parenthesized class or function expression after `export default` is -now parsed correctly. - -### New features - -When `ecmaVersion` is set to 7, Acorn will parse the exponentiation -operator (`**`). - -The identifier character ranges are now based on Unicode 8.0.0. - -Plugins can now override the `raiseRecoverable` method to override the -way non-critical errors are handled. - -## 2.7.0 (2016-01-04) - -### Fixes - -Stop allowing rest parameters in setters. - -Make sure the loose parser always attaches a `local` property to -`ImportNamespaceSpecifier` nodes. - -Disallow `y` rexexp flag in ES5. - -Disallow `\00` and `\000` escapes in strict mode. - -Raise an error when an import name is a reserved word. - -## 2.6.4 (2015-11-12) - -### Fixes - -Fix crash in loose parser when parsing invalid object pattern. - -### New features - -Support plugins in the loose parser. - -## 2.6.2 (2015-11-10) - -### Fixes - -Don't crash when no options object is passed. - -## 2.6.0 (2015-11-09) - -### Fixes - -Add `await` as a reserved word in module sources. - -Disallow `yield` in a parameter default value for a generator. - -Forbid using a comma after a rest pattern in an array destructuring. - -### New features - -Support parsing stdin in command-line tool. - -## 2.5.2 (2015-10-27) - -### Fixes - -Fix bug where the walker walked an exported `let` statement as an -expression. - -## 2.5.0 (2015-10-27) - -### Fixes - -Fix tokenizer support in the command-line tool. - -In the loose parser, don't allow non-string-literals as import -sources. - -Stop allowing `new.target` outside of functions. - -Remove legacy `guard` and `guardedHandler` properties from try nodes. - -Stop allowing multiple `__proto__` properties on an object literal in -strict mode. - -Don't allow rest parameters to be non-identifier patterns. - -Check for duplicate paramter names in arrow functions. diff --git a/node_modules/acorn/LICENSE b/node_modules/acorn/LICENSE deleted file mode 100644 index a35ebf4..0000000 --- a/node_modules/acorn/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2012-2016 by various contributors (see AUTHORS) - -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/acorn/README.md b/node_modules/acorn/README.md deleted file mode 100644 index 0c514d5..0000000 --- a/node_modules/acorn/README.md +++ /dev/null @@ -1,407 +0,0 @@ -# Acorn - -[![Build Status](https://travis-ci.org/ternjs/acorn.svg?branch=master)](https://travis-ci.org/ternjs/acorn) -[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn) -[Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/) - -A tiny, fast JavaScript parser, written completely in JavaScript. - -## Community - -Acorn is open source software released under an -[MIT license](https://github.com/ternjs/acorn/blob/master/LICENSE). - -You are welcome to -[report bugs](https://github.com/ternjs/acorn/issues) or create pull -requests on [github](https://github.com/ternjs/acorn). For questions -and discussion, please use the -[Tern discussion forum](https://discuss.ternjs.net). - -## Installation - -The easiest way to install acorn is with [`npm`][npm]. - -[npm]: https://www.npmjs.com/ - -```sh -npm install acorn -``` - -Alternately, download the source. - -```sh -git clone https://github.com/ternjs/acorn.git -``` - -## Components - -When run in a CommonJS (node.js) or AMD environment, exported values -appear in the interfaces exposed by the individual files, as usual. -When loaded in the browser (Acorn works in any JS-enabled browser more -recent than IE5) without any kind of module management, a single -global object `acorn` will be defined, and all the exported properties -will be added to that. - -### Main parser - -This is implemented in `dist/acorn.js`, and is what you get when you -`require("acorn")` in node.js. - -**parse**`(input, options)` is used to parse a JavaScript program. -The `input` parameter is a string, `options` can be undefined or an -object setting some of the options listed below. The return value will -be an abstract syntax tree object as specified by the -[ESTree spec][estree]. - -When encountering a syntax error, the parser will raise a -`SyntaxError` object with a meaningful message. The error object will -have a `pos` property that indicates the character offset at which the -error occurred, and a `loc` object that contains a `{line, column}` -object referring to that same position. - -[estree]: https://github.com/estree/estree - -- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be - either 3, 5, 6, or 7. This influences support for strict mode, the set - of reserved words, and support for new syntax features. Default is 6. - - **NOTE**: Only 'stage 4' (finalized) ECMAScript 7 features are being - implemented by Acorn. That means that most of the draft standard is - not yet being parsed. - -- **sourceType**: Indicate the mode the code should be parsed in. Can be - either `"script"` or `"module"`. - -- **onInsertedSemicolon**: If given a callback, that callback will be - called whenever a missing semicolon is inserted by the parser. The - callback will be given the character offset of the point where the - semicolon is inserted as argument, and if `locations` is on, also a - `{line, column}` object representing this position. - -- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing - commas. - -- **allowReserved**: If `false`, using a reserved word will generate - an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher - versions. When given the value `"never"`, reserved words and - keywords can also not be used as property names (as in Internet - Explorer's old parser). - -- **allowReturnOutsideFunction**: By default, a return statement at - the top level raises an error. Set this to `true` to accept such - code. - -- **allowImportExportEverywhere**: By default, `import` and `export` - declarations can only appear at a program's top level. Setting this - option to `true` allows them anywhere where a statement is allowed. - -- **allowHashBang**: When this is enabled (off by default), if the - code starts with the characters `#!` (as in a shellscript), the - first line will be treated as a comment. - -- **locations**: When `true`, each node has a `loc` object attached - with `start` and `end` subobjects, each of which contains the - one-based line and zero-based column numbers in `{line, column}` - form. Default is `false`. - -- **onToken**: If a function is passed for this option, each found - token will be passed in same format as tokens returned from - `tokenizer().getToken()`. - - If array is passed, each found token is pushed to it. - - Note that you are not allowed to call the parser from the - callback—that will corrupt its internal state. - -- **onComment**: If a function is passed for this option, whenever a - comment is encountered the function will be called with the - following parameters: - - - `block`: `true` if the comment is a block comment, false if it - is a line comment. - - `text`: The content of the comment. - - `start`: Character offset of the start of the comment. - - `end`: Character offset of the end of the comment. - - When the `locations` options is on, the `{line, column}` locations - of the comment’s start and end are passed as two additional - parameters. - - If array is passed for this option, each found comment is pushed - to it as object in Esprima format: - - ```javascript - { - "type": "Line" | "Block", - "value": "comment text", - "start": Number, - "end": Number, - // If `locations` option is on: - "loc": { - "start": {line: Number, column: Number} - "end": {line: Number, column: Number} - }, - // If `ranges` option is on: - "range": [Number, Number] - } - ``` - - Note that you are not allowed to call the parser from the - callback—that will corrupt its internal state. - -- **ranges**: Nodes have their start and end characters offsets - recorded in `start` and `end` properties (directly on the node, - rather than the `loc` object, which holds line/column data. To also - add a [semi-standardized][range] `range` property holding a - `[start, end]` array with the same numbers, set the `ranges` option - to `true`. - -- **program**: It is possible to parse multiple files into a single - AST by passing the tree produced by parsing the first file as the - `program` option in subsequent parses. This will add the toplevel - forms of the parsed file to the "Program" (top) node of an existing - parse tree. - -- **sourceFile**: When the `locations` option is `true`, you can pass - this option to add a `source` attribute in every node’s `loc` - object. Note that the contents of this option are not examined or - processed in any way; you are free to use whatever format you - choose. - -- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property - will be added (regardless of the `location` option) directly to the - nodes, rather than the `loc` object. - -- **preserveParens**: If this option is `true`, parenthesized expressions - are represented by (non-standard) `ParenthesizedExpression` nodes - that have a single `expression` property containing the expression - inside parentheses. - -[range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - -**parseExpressionAt**`(input, offset, options)` will parse a single -expression in a string, and return its AST. It will not complain if -there is more of the string left after the expression. - -**getLineInfo**`(input, offset)` can be used to get a `{line, -column}` object for a given program string and character offset. - -**tokenizer**`(input, options)` returns an object with a `getToken` -method that can be called repeatedly to get the next token, a `{start, -end, type, value}` object (with added `loc` property when the -`locations` option is enabled and `range` property when the `ranges` -option is enabled). When the token's type is `tokTypes.eof`, you -should stop calling the method, since it will keep returning that same -token forever. - -In ES6 environment, returned result can be used as any other -protocol-compliant iterable: - -```javascript -for (let token of acorn.tokenizer(str)) { - // iterate over the tokens -} - -// transform code to array of tokens: -var tokens = [...acorn.tokenizer(str)]; -``` - -**tokTypes** holds an object mapping names to the token type objects -that end up in the `type` properties of tokens. - -#### Note on using with [Escodegen][escodegen] - -Escodegen supports generating comments from AST, attached in -Esprima-specific format. In order to simulate same format in -Acorn, consider following example: - -```javascript -var comments = [], tokens = []; - -var ast = acorn.parse('var x = 42; // answer', { - // collect ranges for each node - ranges: true, - // collect comments in Esprima's format - onComment: comments, - // collect token ranges - onToken: tokens -}); - -// attach comments using collected information -escodegen.attachComments(ast, comments, tokens); - -// generate code -console.log(escodegen.generate(ast, {comment: true})); -// > 'var x = 42; // answer' -``` - -[escodegen]: https://github.com/estools/escodegen - -### dist/acorn_loose.js ### - -This file implements an error-tolerant parser. It exposes a single -function. The loose parser is accessible in node.js via `require("acorn/dist/acorn_loose")`. - -**parse_dammit**`(input, options)` takes the same arguments and -returns the same syntax tree as the `parse` function in `acorn.js`, -but never raises an error, and will do its best to parse syntactically -invalid code in as meaningful a way as it can. It'll insert identifier -nodes with name `"✖"` as placeholders in places where it can't make -sense of the input. Depends on `acorn.js`, because it uses the same -tokenizer. - -### dist/walk.js ### - -Implements an abstract syntax tree walker. Will store its interface in -`acorn.walk` when loaded without a module system. - -**simple**`(node, visitors, base, state)` does a 'simple' walk over -a tree. `node` should be the AST node to walk, and `visitors` an -object with properties whose names correspond to node types in the -[ESTree spec][estree]. The properties should contain functions -that will be called with the node object and, if applicable the state -at that point. The last two arguments are optional. `base` is a walker -algorithm, and `state` is a start state. The default walker will -simply visit all statements and expressions and not produce a -meaningful state. (An example of a use of state is to track scope at -each point in the tree.) - -**ancestor**`(node, visitors, base, state)` does a 'simple' walk over -a tree, building up an array of ancestor nodes (including the current node) -and passing the array to the callbacks as a third parameter. - -**recursive**`(node, state, functions, base)` does a 'recursive' -walk, where the walker functions are responsible for continuing the -walk on the child nodes of their target node. `state` is the start -state, and `functions` should contain an object that maps node types -to walker functions. Such functions are called with `(node, state, c)` -arguments, and can cause the walk to continue on a sub-node by calling -the `c` argument on it with `(node, state)` arguments. The optional -`base` argument provides the fallback walker functions for node types -that aren't handled in the `functions` object. If not given, the -default walkers will be used. - -**make**`(functions, base)` builds a new walker object by using the -walker functions in `functions` and filling in the missing ones by -taking defaults from `base`. - -**findNodeAt**`(node, start, end, test, base, state)` tries to -locate a node in a tree at the given start and/or end offsets, which -satisfies the predicate `test`. `start` and `end` can be either `null` -(as wildcard) or a number. `test` may be a string (indicating a node -type) or a function that takes `(nodeType, node)` arguments and -returns a boolean indicating whether this node is interesting. `base` -and `state` are optional, and can be used to specify a custom walker. -Nodes are tested from inner to outer, so if two nodes match the -boundaries, the inner one will be preferred. - -**findNodeAround**`(node, pos, test, base, state)` is a lot like -`findNodeAt`, but will match any node that exists 'around' (spanning) -the given position. - -**findNodeAfter**`(node, pos, test, base, state)` is similar to -`findNodeAround`, but will match all nodes *after* the given position -(testing outer nodes before inner nodes). - -## Command line interface - -The `bin/acorn` utility can be used to parse a file from the command -line. It accepts as arguments its input file and the following -options: - -- `--ecma3|--ecma5|--ecma6|--ecma7`: Sets the ECMAScript version to parse. Default is - version 5. - -- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. - -- `--locations`: Attaches a "loc" object to each node with "start" and - "end" subobjects, each of which contains the one-based line and - zero-based column numbers in `{line, column}` form. - -- `--allow-hash-bang`: If the code starts with the characters #! (as in a shellscript), the first line will be treated as a comment. - -- `--compact`: No whitespace is used in the AST output. - -- `--silent`: Do not output the AST, just return the exit status. - -- `--help`: Print the usage information and quit. - -The utility spits out the syntax tree as JSON data. - -## Build system - -Acorn is written in ECMAScript 6, as a set of small modules, in the -project's `src` directory, and compiled down to bigger ECMAScript 3 -files in `dist` using [Browserify](http://browserify.org) and -[Babel](http://babeljs.io/). If you are already using Babel, you can -consider including the modules directly. - -The command-line test runner (`npm test`) uses the ES6 modules. The -browser-based test page (`test/index.html`) uses the compiled modules. -The `bin/build-acorn.js` script builds the latter from the former. - -If you are working on Acorn, you'll probably want to try the code out -directly, without an intermediate build step. In your scripts, you can -register the Babel require shim like this: - - require("babel-core/register") - -That will allow you to directly `require` the ES6 modules. - -## Plugins - -Acorn is designed support allow plugins which, within reasonable -bounds, redefine the way the parser works. Plugins can add new token -types and new tokenizer contexts (if necessary), and extend methods in -the parser object. This is not a clean, elegant API—using it requires -an understanding of Acorn's internals, and plugins are likely to break -whenever those internals are significantly changed. But still, it is -_possible_, in this way, to create parsers for JavaScript dialects -without forking all of Acorn. And in principle it is even possible to -combine such plugins, so that if you have, for example, a plugin for -parsing types and a plugin for parsing JSX-style XML literals, you -could load them both and parse code with both JSX tags and types. - -A plugin should register itself by adding a property to -`acorn.plugins`, which holds a function. Calling `acorn.parse`, a -`plugins` option can be passed, holding an object mapping plugin names -to configuration values (or just `true` for plugins that don't take -options). After the parser object has been created, the initialization -functions for the chosen plugins are called with `(parser, -configValue)` arguments. They are expected to use the `parser.extend` -method to extend parser methods. For example, the `readToken` method -could be extended like this: - -```javascript -parser.extend("readToken", function(nextMethod) { - return function(code) { - console.log("Reading a token!") - return nextMethod.call(this, code) - } -}) -``` - -The `nextMethod` argument passed to `extend`'s second argument is the -previous value of this method, and should usually be called through to -whenever the extended method does not handle the call itself. - -Similarly, the loose parser allows plugins to register themselves via -`acorn.pluginsLoose`. The extension mechanism is the same as for the -normal parser: - -```javascript -looseParser.extend("readToken", function(nextMethod) { - return function() { - console.log("Reading a token in the loose parser!") - return nextMethod.call(this) - } -}) -``` - -### Existing plugins - - - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) - - [`acorn-es7-plugin`](https://github.com/MatAtBread/acorn-es7-plugin/): Parse [async/await syntax proposal](https://github.com/tc39/ecmascript-asyncawait) - - [`acorn-object-spread`](https://github.com/UXtemple/acorn-object-spread): Parse [object spread syntax proposal](https://github.com/sebmarkbage/ecmascript-rest-spread) - - [`acorn-es7`](https://www.npmjs.com/package/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators) - - [`acorn-objj`](https://www.npmjs.com/package/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin diff --git a/node_modules/acorn/bin/acorn b/node_modules/acorn/bin/acorn deleted file mode 100755 index cf4acd5..0000000 --- a/node_modules/acorn/bin/acorn +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var path = require('path'); -var fs = require('fs'); -var acorn = require('../dist/acorn.js'); - -var infile; -var forceFile; -var silent = false; -var compact = false; -var tokenize = false; -var options = {} - -function help(status) { - var print = (status == 0) ? console.log : console.error - print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7]") - print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]") - process.exit(status) -} - -for (var i = 2; i < process.argv.length; ++i) { - var arg = process.argv[i] - if ((arg == "-" || arg[0] != "-") && !infile) infile = arg - else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i] - else if (arg == "--ecma3") options.ecmaVersion = 3 - else if (arg == "--ecma5") options.ecmaVersion = 5 - else if (arg == "--ecma6") options.ecmaVersion = 6 - else if (arg == "--ecma7") options.ecmaVersion = 7 - else if (arg == "--locations") options.locations = true - else if (arg == "--allow-hash-bang") options.allowHashBang = true - else if (arg == "--silent") silent = true - else if (arg == "--compact") compact = true - else if (arg == "--help") help(0) - else if (arg == "--tokenize") tokenize = true - else if (arg == "--module") options.sourceType = 'module' - else help(1) -} - -function run(code) { - var result - if (!tokenize) { - try { result = acorn.parse(code, options) } - catch(e) { console.error(e.message); process.exit(1) } - } else { - result = [] - var tokenizer = acorn.tokenizer(code, options), token - while (true) { - try { token = tokenizer.getToken() } - catch(e) { console.error(e.message); process.exit(1) } - result.push(token) - if (token.type == acorn.tokTypes.eof) break - } - } - if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2)) -} - -if (forceFile || infile && infile != "-") { - run(fs.readFileSync(infile, "utf8")) -} else { - var code = "" - process.stdin.resume() - process.stdin.on("data", function (chunk) { return code += chunk; }) - process.stdin.on("end", function () { return run(code); }) -} \ No newline at end of file diff --git a/node_modules/acorn/bin/generate-identifier-regex.js b/node_modules/acorn/bin/generate-identifier-regex.js deleted file mode 100644 index 100e8cf..0000000 --- a/node_modules/acorn/bin/generate-identifier-regex.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -// Which Unicode version should be used? -var version = '9.0.0'; - -var start = require('unicode-' + version + '/Binary_Property/ID_Start/code-points.js') - .filter(function(ch) { return ch > 0x7f; }); -var last = -1; -var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/Binary_Property/ID_Continue/code-points.js') - .filter(function(ch) { return ch > 0x7f && search(start, ch, last + 1) == -1; })); - -function search(arr, ch, starting) { - for (var i = starting; arr[i] <= ch && i < arr.length; last = i++) - if (arr[i] === ch) - return i; - return -1; -} - -function pad(str, width) { - while (str.length < width) str = "0" + str; - return str; -} - -function esc(code) { - var hex = code.toString(16); - if (hex.length <= 2) return "\\x" + pad(hex, 2); - else return "\\u" + pad(hex, 4); -} - -function generate(chars) { - var astral = [], re = ""; - for (var i = 0, at = 0x10000; i < chars.length; i++) { - var from = chars[i], to = from; - while (i < chars.length - 1 && chars[i + 1] == to + 1) { - i++; - to++; - } - if (to <= 0xffff) { - if (from == to) re += esc(from); - else if (from + 1 == to) re += esc(from) + esc(to); - else re += esc(from) + "-" + esc(to); - } else { - astral.push(from - at, to - from); - at = to; - } - } - return {nonASCII: re, astral: astral}; -} - -var startData = generate(start), contData = generate(cont); - -console.log("let nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\""); -console.log("let nonASCIIidentifierChars = \"" + contData.nonASCII + "\""); -console.log("const astralIdentifierStartCodes = " + JSON.stringify(startData.astral)); -console.log("const astralIdentifierCodes = " + JSON.stringify(contData.astral)); diff --git a/node_modules/acorn/bin/update_authors.sh b/node_modules/acorn/bin/update_authors.sh deleted file mode 100755 index 466c8db..0000000 --- a/node_modules/acorn/bin/update_authors.sh +++ /dev/null @@ -1,6 +0,0 @@ -# Combine existing list of authors with everyone known in git, sort, add header. -tail --lines=+3 AUTHORS > AUTHORS.tmp -git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp -echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS -sort -u AUTHORS.tmp >> AUTHORS -rm -f AUTHORS.tmp diff --git a/node_modules/acorn/dist/.keep b/node_modules/acorn/dist/.keep deleted file mode 100644 index e69de29..0000000 --- a/node_modules/acorn/dist/.keep +++ /dev/null diff --git a/node_modules/acorn/dist/acorn.es.js b/node_modules/acorn/dist/acorn.es.js deleted file mode 100644 index 4460957..0000000 --- a/node_modules/acorn/dist/acorn.es.js +++ /dev/null @@ -1,3112 +0,0 @@ -// Reserved word lists for various dialects of the language - -var reservedWords = { - 3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile", - 5: "class enum extends super const export import", - 6: "enum", - 7: "enum", - strict: "implements interface let package private protected public static yield", - strictBind: "eval arguments" -} - -// And the keywords - -var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this" - -var keywords = { - 5: ecma5AndLessKeywords, - 6: ecma5AndLessKeywords + " const class extends export import super" -} - -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `bin/generate-identifier-regex.js`. - -var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ae\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc" -var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d4-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f" - -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]") -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]") - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null - -// These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by bin/generate-identifier-regex.js -var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541] -var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239] - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code, set) { - var pos = 0x10000 - for (var i = 0; i < set.length; i += 2) { - pos += set[i] - if (pos > code) return false - pos += set[i + 1] - if (pos >= code) return true - } -} - -// Test whether a given character code starts an identifier. - -function isIdentifierStart(code, astral) { - if (code < 65) return code === 36 - if (code < 91) return true - if (code < 97) return code === 95 - if (code < 123) return true - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) - if (astral === false) return false - return isInAstralSet(code, astralIdentifierStartCodes) -} - -// Test whether a given character is part of an identifier. - -function isIdentifierChar(code, astral) { - if (code < 48) return code === 36 - if (code < 58) return true - if (code < 65) return false - if (code < 91) return true - if (code < 97) return code === 95 - if (code < 123) return true - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) - if (astral === false) return false - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes) -} - -// ## Token types - -// The assignment of fine-grained, information-carrying type objects -// allows the tokenizer to store the information it has about a -// token in a way that is very cheap for the parser to look up. - -// All token type variables start with an underscore, to make them -// easy to recognize. - -// The `beforeExpr` property is used to disambiguate between regular -// expressions and divisions. It is set on all token types that can -// be followed by an expression (thus, a slash after them would be a -// regular expression). -// -// The `startsExpr` property is used to check if the token ends a -// `yield` expression. It is set on all token types that either can -// directly start an expression (like a quotation mark) or can -// continue an expression (like the body of a string). -// -// `isLoop` marks a keyword as starting a loop, which is important -// to know when parsing a label, in order to allow or disallow -// continue jumps to that label. - -var TokenType = function TokenType(label, conf) { - if ( conf === void 0 ) conf = {}; - - this.label = label - this.keyword = conf.keyword - this.beforeExpr = !!conf.beforeExpr - this.startsExpr = !!conf.startsExpr - this.isLoop = !!conf.isLoop - this.isAssign = !!conf.isAssign - this.prefix = !!conf.prefix - this.postfix = !!conf.postfix - this.binop = conf.binop || null - this.updateContext = null -}; - -function binop(name, prec) { - return new TokenType(name, {beforeExpr: true, binop: prec}) -} -var beforeExpr = {beforeExpr: true}; -var startsExpr = {startsExpr: true}; -// Map keyword names to token types. - -var keywordTypes = {} - -// Succinct definitions of keyword token types -function kw(name, options) { - if ( options === void 0 ) options = {}; - - options.keyword = name - return keywordTypes[name] = new TokenType(name, options) -} - -var tt = { - num: new TokenType("num", startsExpr), - regexp: new TokenType("regexp", startsExpr), - string: new TokenType("string", startsExpr), - name: new TokenType("name", startsExpr), - eof: new TokenType("eof"), - - // Punctuation token types. - bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}), - bracketR: new TokenType("]"), - braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}), - braceR: new TokenType("}"), - parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}), - parenR: new TokenType(")"), - comma: new TokenType(",", beforeExpr), - semi: new TokenType(";", beforeExpr), - colon: new TokenType(":", beforeExpr), - dot: new TokenType("."), - question: new TokenType("?", beforeExpr), - arrow: new TokenType("=>", beforeExpr), - template: new TokenType("template"), - ellipsis: new TokenType("...", beforeExpr), - backQuote: new TokenType("`", startsExpr), - dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}), - - // Operators. These carry several kinds of properties to help the - // parser use them properly (the presence of these properties is - // what categorizes them as operators). - // - // `binop`, when present, specifies that this operator is a binary - // operator, and will refer to its precedence. - // - // `prefix` and `postfix` mark the operator as a prefix or postfix - // unary operator. - // - // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as - // binary operators with a very low precedence, that should result - // in AssignmentExpression nodes. - - eq: new TokenType("=", {beforeExpr: true, isAssign: true}), - assign: new TokenType("_=", {beforeExpr: true, isAssign: true}), - incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}), - prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}), - logicalOR: binop("||", 1), - logicalAND: binop("&&", 2), - bitwiseOR: binop("|", 3), - bitwiseXOR: binop("^", 4), - bitwiseAND: binop("&", 5), - equality: binop("==/!=", 6), - relational: binop("", 7), - bitShift: binop("<>", 8), - plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}), - modulo: binop("%", 10), - star: binop("*", 10), - slash: binop("/", 10), - starstar: new TokenType("**", {beforeExpr: true}), - - // Keyword token types. - _break: kw("break"), - _case: kw("case", beforeExpr), - _catch: kw("catch"), - _continue: kw("continue"), - _debugger: kw("debugger"), - _default: kw("default", beforeExpr), - _do: kw("do", {isLoop: true, beforeExpr: true}), - _else: kw("else", beforeExpr), - _finally: kw("finally"), - _for: kw("for", {isLoop: true}), - _function: kw("function", startsExpr), - _if: kw("if"), - _return: kw("return", beforeExpr), - _switch: kw("switch"), - _throw: kw("throw", beforeExpr), - _try: kw("try"), - _var: kw("var"), - _const: kw("const"), - _while: kw("while", {isLoop: true}), - _with: kw("with"), - _new: kw("new", {beforeExpr: true, startsExpr: true}), - _this: kw("this", startsExpr), - _super: kw("super", startsExpr), - _class: kw("class"), - _extends: kw("extends", beforeExpr), - _export: kw("export"), - _import: kw("import"), - _null: kw("null", startsExpr), - _true: kw("true", startsExpr), - _false: kw("false", startsExpr), - _in: kw("in", {beforeExpr: true, binop: 7}), - _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}), - _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}), - _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}), - _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true}) -} - -// Matches a whole line break (where CRLF is considered a single -// line break). Used to count lines. - -var lineBreak = /\r\n?|\n|\u2028|\u2029/ -var lineBreakG = new RegExp(lineBreak.source, "g") - -function isNewLine(code) { - return code === 10 || code === 13 || code === 0x2028 || code == 0x2029 -} - -var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/ - -var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g - -function isArray(obj) { - return Object.prototype.toString.call(obj) === "[object Array]" -} - -// Checks if an object has a property. - -function has(obj, propName) { - return Object.prototype.hasOwnProperty.call(obj, propName) -} - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. - -var Position = function Position(line, col) { - this.line = line - this.column = col -}; - -Position.prototype.offset = function offset (n) { - return new Position(this.line, this.column + n) -}; - -var SourceLocation = function SourceLocation(p, start, end) { - this.start = start - this.end = end - if (p.sourceFile !== null) this.source = p.sourceFile -}; - -// The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - lineBreakG.lastIndex = cur - var match = lineBreakG.exec(input) - if (match && match.index < offset) { - ++line - cur = match.index + match[0].length - } else { - return new Position(line, offset - cur) - } - } -} - -// A second optional argument can be given to further configure -// the parser process. These options are recognized: - -var defaultOptions = { - // `ecmaVersion` indicates the ECMAScript version to parse. Must - // be either 3, or 5, or 6. This influences support for strict - // mode, the set of reserved words, support for getters and - // setters and other features. The default is 6. - ecmaVersion: 6, - // Source type ("script" or "module") for different semantics - sourceType: "script", - // `onInsertedSemicolon` can be a callback that will be called - // when a semicolon is automatically inserted. It will be passed - // th position of the comma as an offset, and if `locations` is - // enabled, it is given the location as a `{line, column}` object - // as second argument. - onInsertedSemicolon: null, - // `onTrailingComma` is similar to `onInsertedSemicolon`, but for - // trailing commas. - onTrailingComma: null, - // By default, reserved words are only enforced if ecmaVersion >= 5. - // Set `allowReserved` to a boolean value to explicitly turn this on - // an off. When this option has the value "never", reserved words - // and keywords can also not be used as property names. - allowReserved: null, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // When enabled, hashbang directive in the beginning of file - // is allowed and treated as a line comment. - allowHashBang: false, - // When `locations` is on, `loc` properties holding objects with - // `start` and `end` properties in `{line, column}` form (with - // line being 1-based and column 0-based) will be attached to the - // nodes. - locations: false, - // A function can be passed as `onToken` option, which will - // cause Acorn to call that function with object in the same - // format as tokens returned from `tokenizer().getToken()`. Note - // that you are not allowed to call the parser from the - // callback—that will corrupt its internal state. - onToken: null, - // A function can be passed as `onComment` option, which will - // cause Acorn to call that function with `(block, text, start, - // end)` parameters whenever a comment is skipped. `block` is a - // boolean indicating whether this is a block (`/* */`) comment, - // `text` is the content of the comment, and `start` and `end` are - // character offsets that denote the start and end of the comment. - // When the `locations` option is on, two more parameters are - // passed, the full `{line, column}` locations of the start and - // end of the comments. Note that you are not allowed to call the - // parser from the callback—that will corrupt its internal state. - onComment: null, - // Nodes have their start and end characters offsets recorded in - // `start` and `end` properties (directly on the node, rather than - // the `loc` object, which holds line/column data. To also add a - // [semi-standardized][range] `range` property holding a `[start, - // end]` array with the same numbers, set the `ranges` option to - // `true`. - // - // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678 - ranges: false, - // It is possible to parse multiple files into a single AST by - // passing the tree produced by parsing the first file as - // `program` option in subsequent parses. This will add the - // toplevel forms of the parsed file to the `Program` (top) node - // of an existing parse tree. - program: null, - // When `locations` is on, you can pass this to record the source - // file in every node's `loc` object. - sourceFile: null, - // This value, if given, is stored in every node, whether - // `locations` is on or off. - directSourceFile: null, - // When enabled, parenthesized expressions are represented by - // (non-standard) ParenthesizedExpression nodes - preserveParens: false, - plugins: {} -} - -// Interpret and default an options object - -function getOptions(opts) { - var options = {} - for (var opt in defaultOptions) - options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt] - if (options.allowReserved == null) - options.allowReserved = options.ecmaVersion < 5 - - if (isArray(options.onToken)) { - var tokens = options.onToken - options.onToken = function (token) { return tokens.push(token); } - } - if (isArray(options.onComment)) - options.onComment = pushComment(options, options.onComment) - - return options -} - -function pushComment(options, array) { - return function (block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? 'Block' : 'Line', - value: text, - start: start, - end: end - } - if (options.locations) - comment.loc = new SourceLocation(this, startLoc, endLoc) - if (options.ranges) - comment.range = [start, end] - array.push(comment) - } -} - -// Registered plugins -var plugins = {} - -function keywordRegexp(words) { - return new RegExp("^(" + words.replace(/ /g, "|") + ")$") -} - -var Parser = function Parser(options, input, startPos) { - this.options = options = getOptions(options) - this.sourceFile = options.sourceFile - this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]) - var reserved = options.allowReserved ? "" : - reservedWords[options.ecmaVersion] + (options.sourceType == "module" ? " await" : "") - this.reservedWords = keywordRegexp(reserved) - var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict - this.reservedWordsStrict = keywordRegexp(reservedStrict) - this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind) - this.input = String(input) - - // Used to signal to callers of `readWord1` whether the word - // contained any escape sequences. This is needed because words with - // escape sequences must not be interpreted as keywords. - this.containsEsc = false - - // Load plugins - this.loadPlugins(options.plugins) - - // Set up token state - - // The current position of the tokenizer in the input. - if (startPos) { - this.pos = startPos - this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos)) - this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length - } else { - this.pos = this.lineStart = 0 - this.curLine = 1 - } - - // Properties of the current token: - // Its type - this.type = tt.eof - // For tokens that include more information than their type, the value - this.value = null - // Its start and end offset - this.start = this.end = this.pos - // And, if locations are used, the {line, column} object - // corresponding to those offsets - this.startLoc = this.endLoc = this.curPosition() - - // Position information for the previous token - this.lastTokEndLoc = this.lastTokStartLoc = null - this.lastTokStart = this.lastTokEnd = this.pos - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - this.context = this.initialContext() - this.exprAllowed = true - - // Figure out if it's a module code. - this.strict = this.inModule = options.sourceType === "module" - - // Used to signify the start of a potential arrow function - this.potentialArrowAt = -1 - - // Flags to track whether we are in a function, a generator. - this.inFunction = this.inGenerator = false - // Labels in scope. - this.labels = [] - - // If enabled, skip leading hashbang line. - if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!') - this.skipLineComment(2) -}; - -// DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them -Parser.prototype.isKeyword = function isKeyword (word) { return this.keywords.test(word) }; -Parser.prototype.isReservedWord = function isReservedWord (word) { return this.reservedWords.test(word) }; - -Parser.prototype.extend = function extend (name, f) { - this[name] = f(this[name]) -}; - -Parser.prototype.loadPlugins = function loadPlugins (pluginConfigs) { - var this$1 = this; - - for (var name in pluginConfigs) { - var plugin = plugins[name] - if (!plugin) throw new Error("Plugin '" + name + "' not found") - plugin(this$1, pluginConfigs[name]) - } -}; - -Parser.prototype.parse = function parse () { - var node = this.options.program || this.startNode() - this.nextToken() - return this.parseTopLevel(node) -}; - -var pp = Parser.prototype - -// ## Parser utilities - -// Test whether a statement node is the string literal `"use strict"`. - -pp.isUseStrict = function(stmt) { - return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" && - stmt.expression.type === "Literal" && - stmt.expression.raw.slice(1, -1) === "use strict" -} - -// Predicate that tests whether the next token is of the given -// type, and if yes, consumes it as a side effect. - -pp.eat = function(type) { - if (this.type === type) { - this.next() - return true - } else { - return false - } -} - -// Tests whether parsed token is a contextual keyword. - -pp.isContextual = function(name) { - return this.type === tt.name && this.value === name -} - -// Consumes contextual keyword if possible. - -pp.eatContextual = function(name) { - return this.value === name && this.eat(tt.name) -} - -// Asserts that following token is given contextual keyword. - -pp.expectContextual = function(name) { - if (!this.eatContextual(name)) this.unexpected() -} - -// Test whether a semicolon can be inserted at the current position. - -pp.canInsertSemicolon = function() { - return this.type === tt.eof || - this.type === tt.braceR || - lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) -} - -pp.insertSemicolon = function() { - if (this.canInsertSemicolon()) { - if (this.options.onInsertedSemicolon) - this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc) - return true - } -} - -// Consume a semicolon, or, failing that, see if we are allowed to -// pretend that there is a semicolon at this position. - -pp.semicolon = function() { - if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected() -} - -pp.afterTrailingComma = function(tokType) { - if (this.type == tokType) { - if (this.options.onTrailingComma) - this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc) - this.next() - return true - } -} - -// Expect a token of a given type. If found, consume it, otherwise, -// raise an unexpected token error. - -pp.expect = function(type) { - this.eat(type) || this.unexpected() -} - -// Raise an unexpected token error. - -pp.unexpected = function(pos) { - this.raise(pos != null ? pos : this.start, "Unexpected token") -} - -var DestructuringErrors = function DestructuringErrors() { - this.shorthandAssign = 0 - this.trailingComma = 0 -}; - -pp.checkPatternErrors = function(refDestructuringErrors, andThrow) { - var trailing = refDestructuringErrors && refDestructuringErrors.trailingComma - if (!andThrow) return !!trailing - if (trailing) this.raise(trailing, "Comma is not permitted after the rest element") -} - -pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) { - var pos = refDestructuringErrors && refDestructuringErrors.shorthandAssign - if (!andThrow) return !!pos - if (pos) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns") -} - -var pp$1 = Parser.prototype - -// ### Statement parsing - -// Parse a program. Initializes the parser, reads any number of -// statements, and wraps them in a Program node. Optionally takes a -// `program` argument. If present, the statements will be appended -// to its body instead of creating a new node. - -pp$1.parseTopLevel = function(node) { - var this$1 = this; - - var first = true - if (!node.body) node.body = [] - while (this.type !== tt.eof) { - var stmt = this$1.parseStatement(true, true) - node.body.push(stmt) - if (first) { - if (this$1.isUseStrict(stmt)) this$1.setStrict(true) - first = false - } - } - this.next() - if (this.options.ecmaVersion >= 6) { - node.sourceType = this.options.sourceType - } - return this.finishNode(node, "Program") -} - -var loopLabel = {kind: "loop"}; -var switchLabel = {kind: "switch"}; -pp$1.isLet = function() { - if (this.type !== tt.name || this.options.ecmaVersion < 6 || this.value != "let") return false - skipWhiteSpace.lastIndex = this.pos - var skip = skipWhiteSpace.exec(this.input) - var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next) - if (nextCh === 91 || nextCh == 123) return true // '{' and '[' - if (isIdentifierStart(nextCh, true)) { - for (var pos = next + 1; isIdentifierChar(this.input.charCodeAt(pos), true); ++pos) {} - var ident = this.input.slice(next, pos) - if (!this.isKeyword(ident)) return true - } - return false -} - -// Parse a single statement. -// -// If expecting a statement and finding a slash operator, parse a -// regular expression literal. This is to handle cases like -// `if (foo) /blah/.exec(foo)`, where looking at the previous token -// does not help. - -pp$1.parseStatement = function(declaration, topLevel) { - var starttype = this.type, node = this.startNode(), kind - - if (this.isLet()) { - starttype = tt._var - kind = "let" - } - - // Most types of statements are recognized by the keyword they - // start with. Many are trivial to parse, some require a bit of - // complexity. - - switch (starttype) { - case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword) - case tt._debugger: return this.parseDebuggerStatement(node) - case tt._do: return this.parseDoStatement(node) - case tt._for: return this.parseForStatement(node) - case tt._function: - if (!declaration && this.options.ecmaVersion >= 6) this.unexpected() - return this.parseFunctionStatement(node) - case tt._class: - if (!declaration) this.unexpected() - return this.parseClass(node, true) - case tt._if: return this.parseIfStatement(node) - case tt._return: return this.parseReturnStatement(node) - case tt._switch: return this.parseSwitchStatement(node) - case tt._throw: return this.parseThrowStatement(node) - case tt._try: return this.parseTryStatement(node) - case tt._const: case tt._var: - kind = kind || this.value - if (!declaration && kind != "var") this.unexpected() - return this.parseVarStatement(node, kind) - case tt._while: return this.parseWhileStatement(node) - case tt._with: return this.parseWithStatement(node) - case tt.braceL: return this.parseBlock() - case tt.semi: return this.parseEmptyStatement(node) - case tt._export: - case tt._import: - if (!this.options.allowImportExportEverywhere) { - if (!topLevel) - this.raise(this.start, "'import' and 'export' may only appear at the top level") - if (!this.inModule) - this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'") - } - return starttype === tt._import ? this.parseImport(node) : this.parseExport(node) - - // If the statement does not start with a statement keyword or a - // brace, it's an ExpressionStatement or LabeledStatement. We - // simply start parsing an expression, and afterwards, if the - // next token is a colon and the expression was a simple - // Identifier node, we switch to interpreting it as a label. - default: - var maybeName = this.value, expr = this.parseExpression() - if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) - return this.parseLabeledStatement(node, maybeName, expr) - else return this.parseExpressionStatement(node, expr) - } -} - -pp$1.parseBreakContinueStatement = function(node, keyword) { - var this$1 = this; - - var isBreak = keyword == "break" - this.next() - if (this.eat(tt.semi) || this.insertSemicolon()) node.label = null - else if (this.type !== tt.name) this.unexpected() - else { - node.label = this.parseIdent() - this.semicolon() - } - - // Verify that there is an actual destination to break or - // continue to. - for (var i = 0; i < this.labels.length; ++i) { - var lab = this$1.labels[i] - if (node.label == null || lab.name === node.label.name) { - if (lab.kind != null && (isBreak || lab.kind === "loop")) break - if (node.label && isBreak) break - } - } - if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword) - return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement") -} - -pp$1.parseDebuggerStatement = function(node) { - this.next() - this.semicolon() - return this.finishNode(node, "DebuggerStatement") -} - -pp$1.parseDoStatement = function(node) { - this.next() - this.labels.push(loopLabel) - node.body = this.parseStatement(false) - this.labels.pop() - this.expect(tt._while) - node.test = this.parseParenExpression() - if (this.options.ecmaVersion >= 6) - this.eat(tt.semi) - else - this.semicolon() - return this.finishNode(node, "DoWhileStatement") -} - -// Disambiguating between a `for` and a `for`/`in` or `for`/`of` -// loop is non-trivial. Basically, we have to parse the init `var` -// statement or expression, disallowing the `in` operator (see -// the second parameter to `parseExpression`), and then check -// whether the next token is `in` or `of`. When there is no init -// part (semicolon immediately after the opening parenthesis), it -// is a regular `for` loop. - -pp$1.parseForStatement = function(node) { - this.next() - this.labels.push(loopLabel) - this.expect(tt.parenL) - if (this.type === tt.semi) return this.parseFor(node, null) - var isLet = this.isLet() - if (this.type === tt._var || this.type === tt._const || isLet) { - var init$1 = this.startNode(), kind = isLet ? "let" : this.value - this.next() - this.parseVar(init$1, true, kind) - this.finishNode(init$1, "VariableDeclaration") - if ((this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1 && - !(kind !== "var" && init$1.declarations[0].init)) - return this.parseForIn(node, init$1) - return this.parseFor(node, init$1) - } - var refDestructuringErrors = new DestructuringErrors - var init = this.parseExpression(true, refDestructuringErrors) - if (this.type === tt._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - this.checkPatternErrors(refDestructuringErrors, true) - this.toAssignable(init) - this.checkLVal(init) - return this.parseForIn(node, init) - } else { - this.checkExpressionErrors(refDestructuringErrors, true) - } - return this.parseFor(node, init) -} - -pp$1.parseFunctionStatement = function(node) { - this.next() - return this.parseFunction(node, true) -} - -pp$1.parseIfStatement = function(node) { - this.next() - node.test = this.parseParenExpression() - node.consequent = this.parseStatement(false) - node.alternate = this.eat(tt._else) ? this.parseStatement(false) : null - return this.finishNode(node, "IfStatement") -} - -pp$1.parseReturnStatement = function(node) { - if (!this.inFunction && !this.options.allowReturnOutsideFunction) - this.raise(this.start, "'return' outside of function") - this.next() - - // In `return` (and `break`/`continue`), the keywords with - // optional arguments, we eagerly look for a semicolon or the - // possibility to insert one. - - if (this.eat(tt.semi) || this.insertSemicolon()) node.argument = null - else { node.argument = this.parseExpression(); this.semicolon() } - return this.finishNode(node, "ReturnStatement") -} - -pp$1.parseSwitchStatement = function(node) { - var this$1 = this; - - this.next() - node.discriminant = this.parseParenExpression() - node.cases = [] - this.expect(tt.braceL) - this.labels.push(switchLabel) - - // Statements under must be grouped (by label) in SwitchCase - // nodes. `cur` is used to keep the node that we are currently - // adding statements to. - - for (var cur, sawDefault = false; this.type != tt.braceR;) { - if (this$1.type === tt._case || this$1.type === tt._default) { - var isCase = this$1.type === tt._case - if (cur) this$1.finishNode(cur, "SwitchCase") - node.cases.push(cur = this$1.startNode()) - cur.consequent = [] - this$1.next() - if (isCase) { - cur.test = this$1.parseExpression() - } else { - if (sawDefault) this$1.raiseRecoverable(this$1.lastTokStart, "Multiple default clauses") - sawDefault = true - cur.test = null - } - this$1.expect(tt.colon) - } else { - if (!cur) this$1.unexpected() - cur.consequent.push(this$1.parseStatement(true)) - } - } - if (cur) this.finishNode(cur, "SwitchCase") - this.next() // Closing brace - this.labels.pop() - return this.finishNode(node, "SwitchStatement") -} - -pp$1.parseThrowStatement = function(node) { - this.next() - if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) - this.raise(this.lastTokEnd, "Illegal newline after throw") - node.argument = this.parseExpression() - this.semicolon() - return this.finishNode(node, "ThrowStatement") -} - -// Reused empty array added for node fields that are always empty. - -var empty = [] - -pp$1.parseTryStatement = function(node) { - this.next() - node.block = this.parseBlock() - node.handler = null - if (this.type === tt._catch) { - var clause = this.startNode() - this.next() - this.expect(tt.parenL) - clause.param = this.parseBindingAtom() - this.checkLVal(clause.param, true) - this.expect(tt.parenR) - clause.body = this.parseBlock() - node.handler = this.finishNode(clause, "CatchClause") - } - node.finalizer = this.eat(tt._finally) ? this.parseBlock() : null - if (!node.handler && !node.finalizer) - this.raise(node.start, "Missing catch or finally clause") - return this.finishNode(node, "TryStatement") -} - -pp$1.parseVarStatement = function(node, kind) { - this.next() - this.parseVar(node, false, kind) - this.semicolon() - return this.finishNode(node, "VariableDeclaration") -} - -pp$1.parseWhileStatement = function(node) { - this.next() - node.test = this.parseParenExpression() - this.labels.push(loopLabel) - node.body = this.parseStatement(false) - this.labels.pop() - return this.finishNode(node, "WhileStatement") -} - -pp$1.parseWithStatement = function(node) { - if (this.strict) this.raise(this.start, "'with' in strict mode") - this.next() - node.object = this.parseParenExpression() - node.body = this.parseStatement(false) - return this.finishNode(node, "WithStatement") -} - -pp$1.parseEmptyStatement = function(node) { - this.next() - return this.finishNode(node, "EmptyStatement") -} - -pp$1.parseLabeledStatement = function(node, maybeName, expr) { - var this$1 = this; - - for (var i = 0; i < this.labels.length; ++i) - if (this$1.labels[i].name === maybeName) this$1.raise(expr.start, "Label '" + maybeName + "' is already declared") - var kind = this.type.isLoop ? "loop" : this.type === tt._switch ? "switch" : null - for (var i$1 = this.labels.length - 1; i$1 >= 0; i$1--) { - var label = this$1.labels[i$1] - if (label.statementStart == node.start) { - label.statementStart = this$1.start - label.kind = kind - } else break - } - this.labels.push({name: maybeName, kind: kind, statementStart: this.start}) - node.body = this.parseStatement(true) - this.labels.pop() - node.label = expr - return this.finishNode(node, "LabeledStatement") -} - -pp$1.parseExpressionStatement = function(node, expr) { - node.expression = expr - this.semicolon() - return this.finishNode(node, "ExpressionStatement") -} - -// Parse a semicolon-enclosed block of statements, handling `"use -// strict"` declarations when `allowStrict` is true (used for -// function bodies). - -pp$1.parseBlock = function(allowStrict) { - var this$1 = this; - - var node = this.startNode(), first = true, oldStrict - node.body = [] - this.expect(tt.braceL) - while (!this.eat(tt.braceR)) { - var stmt = this$1.parseStatement(true) - node.body.push(stmt) - if (first && allowStrict && this$1.isUseStrict(stmt)) { - oldStrict = this$1.strict - this$1.setStrict(this$1.strict = true) - } - first = false - } - if (oldStrict === false) this.setStrict(false) - return this.finishNode(node, "BlockStatement") -} - -// Parse a regular `for` loop. The disambiguation code in -// `parseStatement` will already have parsed the init statement or -// expression. - -pp$1.parseFor = function(node, init) { - node.init = init - this.expect(tt.semi) - node.test = this.type === tt.semi ? null : this.parseExpression() - this.expect(tt.semi) - node.update = this.type === tt.parenR ? null : this.parseExpression() - this.expect(tt.parenR) - node.body = this.parseStatement(false) - this.labels.pop() - return this.finishNode(node, "ForStatement") -} - -// Parse a `for`/`in` and `for`/`of` loop, which are almost -// same from parser's perspective. - -pp$1.parseForIn = function(node, init) { - var type = this.type === tt._in ? "ForInStatement" : "ForOfStatement" - this.next() - node.left = init - node.right = this.parseExpression() - this.expect(tt.parenR) - node.body = this.parseStatement(false) - this.labels.pop() - return this.finishNode(node, type) -} - -// Parse a list of variable declarations. - -pp$1.parseVar = function(node, isFor, kind) { - var this$1 = this; - - node.declarations = [] - node.kind = kind - for (;;) { - var decl = this$1.startNode() - this$1.parseVarId(decl) - if (this$1.eat(tt.eq)) { - decl.init = this$1.parseMaybeAssign(isFor) - } else if (kind === "const" && !(this$1.type === tt._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual("of")))) { - this$1.unexpected() - } else if (decl.id.type != "Identifier" && !(isFor && (this$1.type === tt._in || this$1.isContextual("of")))) { - this$1.raise(this$1.lastTokEnd, "Complex binding patterns require an initialization value") - } else { - decl.init = null - } - node.declarations.push(this$1.finishNode(decl, "VariableDeclarator")) - if (!this$1.eat(tt.comma)) break - } - return node -} - -pp$1.parseVarId = function(decl) { - decl.id = this.parseBindingAtom() - this.checkLVal(decl.id, true) -} - -// Parse a function declaration or literal (depending on the -// `isStatement` parameter). - -pp$1.parseFunction = function(node, isStatement, allowExpressionBody) { - this.initFunction(node) - if (this.options.ecmaVersion >= 6) - node.generator = this.eat(tt.star) - var oldInGen = this.inGenerator - this.inGenerator = node.generator - if (isStatement || this.type === tt.name) - node.id = this.parseIdent() - this.parseFunctionParams(node) - this.parseFunctionBody(node, allowExpressionBody) - this.inGenerator = oldInGen - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression") -} - -pp$1.parseFunctionParams = function(node) { - this.expect(tt.parenL) - node.params = this.parseBindingList(tt.parenR, false, false, true) -} - -// Parse a class declaration or literal (depending on the -// `isStatement` parameter). - -pp$1.parseClass = function(node, isStatement) { - var this$1 = this; - - this.next() - this.parseClassId(node, isStatement) - this.parseClassSuper(node) - var classBody = this.startNode() - var hadConstructor = false - classBody.body = [] - this.expect(tt.braceL) - while (!this.eat(tt.braceR)) { - if (this$1.eat(tt.semi)) continue - var method = this$1.startNode() - var isGenerator = this$1.eat(tt.star) - var isMaybeStatic = this$1.type === tt.name && this$1.value === "static" - this$1.parsePropertyName(method) - method.static = isMaybeStatic && this$1.type !== tt.parenL - if (method.static) { - if (isGenerator) this$1.unexpected() - isGenerator = this$1.eat(tt.star) - this$1.parsePropertyName(method) - } - method.kind = "method" - var isGetSet = false - if (!method.computed) { - var key = method.key; - if (!isGenerator && key.type === "Identifier" && this$1.type !== tt.parenL && (key.name === "get" || key.name === "set")) { - isGetSet = true - method.kind = key.name - key = this$1.parsePropertyName(method) - } - if (!method.static && (key.type === "Identifier" && key.name === "constructor" || - key.type === "Literal" && key.value === "constructor")) { - if (hadConstructor) this$1.raise(key.start, "Duplicate constructor in the same class") - if (isGetSet) this$1.raise(key.start, "Constructor can't have get/set modifier") - if (isGenerator) this$1.raise(key.start, "Constructor can't be a generator") - method.kind = "constructor" - hadConstructor = true - } - } - this$1.parseClassMethod(classBody, method, isGenerator) - if (isGetSet) { - var paramCount = method.kind === "get" ? 0 : 1 - if (method.value.params.length !== paramCount) { - var start = method.value.start - if (method.kind === "get") - this$1.raiseRecoverable(start, "getter should have no params") - else - this$1.raiseRecoverable(start, "setter should have exactly one param") - } - if (method.kind === "set" && method.value.params[0].type === "RestElement") - this$1.raise(method.value.params[0].start, "Setter cannot use rest params") - } - } - node.body = this.finishNode(classBody, "ClassBody") - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression") -} - -pp$1.parseClassMethod = function(classBody, method, isGenerator) { - method.value = this.parseMethod(isGenerator) - classBody.body.push(this.finishNode(method, "MethodDefinition")) -} - -pp$1.parseClassId = function(node, isStatement) { - node.id = this.type === tt.name ? this.parseIdent() : isStatement ? this.unexpected() : null -} - -pp$1.parseClassSuper = function(node) { - node.superClass = this.eat(tt._extends) ? this.parseExprSubscripts() : null -} - -// Parses module export declaration. - -pp$1.parseExport = function(node) { - var this$1 = this; - - this.next() - // export * from '...' - if (this.eat(tt.star)) { - this.expectContextual("from") - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected() - this.semicolon() - return this.finishNode(node, "ExportAllDeclaration") - } - if (this.eat(tt._default)) { // export default ... - var parens = this.type == tt.parenL - var expr = this.parseMaybeAssign() - var needsSemi = true - if (!parens && (expr.type == "FunctionExpression" || - expr.type == "ClassExpression")) { - needsSemi = false - if (expr.id) { - expr.type = expr.type == "FunctionExpression" - ? "FunctionDeclaration" - : "ClassDeclaration" - } - } - node.declaration = expr - if (needsSemi) this.semicolon() - return this.finishNode(node, "ExportDefaultDeclaration") - } - // export var|const|let|function|class ... - if (this.shouldParseExportStatement()) { - node.declaration = this.parseStatement(true) - node.specifiers = [] - node.source = null - } else { // export { x, y as z } [from '...'] - node.declaration = null - node.specifiers = this.parseExportSpecifiers() - if (this.eatContextual("from")) { - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected() - } else { - // check for keywords used as local names - for (var i = 0; i < node.specifiers.length; i++) { - if (this$1.keywords.test(node.specifiers[i].local.name) || this$1.reservedWords.test(node.specifiers[i].local.name)) { - this$1.unexpected(node.specifiers[i].local.start) - } - } - - node.source = null - } - this.semicolon() - } - return this.finishNode(node, "ExportNamedDeclaration") -} - -pp$1.shouldParseExportStatement = function() { - return this.type.keyword || this.isLet() -} - -// Parses a comma-separated list of module exports. - -pp$1.parseExportSpecifiers = function() { - var this$1 = this; - - var nodes = [], first = true - // export { x, y as z } [from '...'] - this.expect(tt.braceL) - while (!this.eat(tt.braceR)) { - if (!first) { - this$1.expect(tt.comma) - if (this$1.afterTrailingComma(tt.braceR)) break - } else first = false - - var node = this$1.startNode() - node.local = this$1.parseIdent(this$1.type === tt._default) - node.exported = this$1.eatContextual("as") ? this$1.parseIdent(true) : node.local - nodes.push(this$1.finishNode(node, "ExportSpecifier")) - } - return nodes -} - -// Parses import declaration. - -pp$1.parseImport = function(node) { - this.next() - // import '...' - if (this.type === tt.string) { - node.specifiers = empty - node.source = this.parseExprAtom() - } else { - node.specifiers = this.parseImportSpecifiers() - this.expectContextual("from") - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected() - } - this.semicolon() - return this.finishNode(node, "ImportDeclaration") -} - -// Parses a comma-separated list of module imports. - -pp$1.parseImportSpecifiers = function() { - var this$1 = this; - - var nodes = [], first = true - if (this.type === tt.name) { - // import defaultObj, { x, y as z } from '...' - var node = this.startNode() - node.local = this.parseIdent() - this.checkLVal(node.local, true) - nodes.push(this.finishNode(node, "ImportDefaultSpecifier")) - if (!this.eat(tt.comma)) return nodes - } - if (this.type === tt.star) { - var node$1 = this.startNode() - this.next() - this.expectContextual("as") - node$1.local = this.parseIdent() - this.checkLVal(node$1.local, true) - nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")) - return nodes - } - this.expect(tt.braceL) - while (!this.eat(tt.braceR)) { - if (!first) { - this$1.expect(tt.comma) - if (this$1.afterTrailingComma(tt.braceR)) break - } else first = false - - var node$2 = this$1.startNode() - node$2.imported = this$1.parseIdent(true) - if (this$1.eatContextual("as")) { - node$2.local = this$1.parseIdent() - } else { - node$2.local = node$2.imported - if (this$1.isKeyword(node$2.local.name)) this$1.unexpected(node$2.local.start) - if (this$1.reservedWordsStrict.test(node$2.local.name)) this$1.raise(node$2.local.start, "The keyword '" + node$2.local.name + "' is reserved") - } - this$1.checkLVal(node$2.local, true) - nodes.push(this$1.finishNode(node$2, "ImportSpecifier")) - } - return nodes -} - -var pp$2 = Parser.prototype - -// Convert existing expression atom to assignable pattern -// if possible. - -pp$2.toAssignable = function(node, isBinding) { - var this$1 = this; - - if (this.options.ecmaVersion >= 6 && node) { - switch (node.type) { - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - break - - case "ObjectExpression": - node.type = "ObjectPattern" - for (var i = 0; i < node.properties.length; i++) { - var prop = node.properties[i] - if (prop.kind !== "init") this$1.raise(prop.key.start, "Object pattern can't contain getter or setter") - this$1.toAssignable(prop.value, isBinding) - } - break - - case "ArrayExpression": - node.type = "ArrayPattern" - this.toAssignableList(node.elements, isBinding) - break - - case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern" - delete node.operator - // falls through to AssignmentPattern - } else { - this.raise(node.left.end, "Only '=' operator can be used for specifying default value.") - break - } - - case "AssignmentPattern": - if (node.right.type === "YieldExpression") - this.raise(node.right.start, "Yield expression cannot be a default value") - break - - case "ParenthesizedExpression": - node.expression = this.toAssignable(node.expression, isBinding) - break - - case "MemberExpression": - if (!isBinding) break - - default: - this.raise(node.start, "Assigning to rvalue") - } - } - return node -} - -// Convert list of expression atoms to binding list. - -pp$2.toAssignableList = function(exprList, isBinding) { - var this$1 = this; - - var end = exprList.length - if (end) { - var last = exprList[end - 1] - if (last && last.type == "RestElement") { - --end - } else if (last && last.type == "SpreadElement") { - last.type = "RestElement" - var arg = last.argument - this.toAssignable(arg, isBinding) - if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") - this.unexpected(arg.start) - --end - } - - if (isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") - this.unexpected(last.argument.start) - } - for (var i = 0; i < end; i++) { - var elt = exprList[i] - if (elt) this$1.toAssignable(elt, isBinding) - } - return exprList -} - -// Parses spread element. - -pp$2.parseSpread = function(refDestructuringErrors) { - var node = this.startNode() - this.next() - node.argument = this.parseMaybeAssign(false, refDestructuringErrors) - return this.finishNode(node, "SpreadElement") -} - -pp$2.parseRest = function(allowNonIdent) { - var node = this.startNode() - this.next() - - // RestElement inside of a function parameter must be an identifier - if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected() - else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected() - - return this.finishNode(node, "RestElement") -} - -// Parses lvalue (assignable) atom. - -pp$2.parseBindingAtom = function() { - if (this.options.ecmaVersion < 6) return this.parseIdent() - switch (this.type) { - case tt.name: - return this.parseIdent() - - case tt.bracketL: - var node = this.startNode() - this.next() - node.elements = this.parseBindingList(tt.bracketR, true, true) - return this.finishNode(node, "ArrayPattern") - - case tt.braceL: - return this.parseObj(true) - - default: - this.unexpected() - } -} - -pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) { - var this$1 = this; - - var elts = [], first = true - while (!this.eat(close)) { - if (first) first = false - else this$1.expect(tt.comma) - if (allowEmpty && this$1.type === tt.comma) { - elts.push(null) - } else if (allowTrailingComma && this$1.afterTrailingComma(close)) { - break - } else if (this$1.type === tt.ellipsis) { - var rest = this$1.parseRest(allowNonIdent) - this$1.parseBindingListItem(rest) - elts.push(rest) - if (this$1.type === tt.comma) this$1.raise(this$1.start, "Comma is not permitted after the rest element") - this$1.expect(close) - break - } else { - var elem = this$1.parseMaybeDefault(this$1.start, this$1.startLoc) - this$1.parseBindingListItem(elem) - elts.push(elem) - } - } - return elts -} - -pp$2.parseBindingListItem = function(param) { - return param -} - -// Parses assignment pattern around given atom if possible. - -pp$2.parseMaybeDefault = function(startPos, startLoc, left) { - left = left || this.parseBindingAtom() - if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left - var node = this.startNodeAt(startPos, startLoc) - node.left = left - node.right = this.parseMaybeAssign() - return this.finishNode(node, "AssignmentPattern") -} - -// Verify that a node is an lval — something that can be assigned -// to. - -pp$2.checkLVal = function(expr, isBinding, checkClashes) { - var this$1 = this; - - switch (expr.type) { - case "Identifier": - if (this.strict && this.reservedWordsStrictBind.test(expr.name)) - this.raiseRecoverable(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode") - if (checkClashes) { - if (has(checkClashes, expr.name)) - this.raiseRecoverable(expr.start, "Argument name clash") - checkClashes[expr.name] = true - } - break - - case "MemberExpression": - if (isBinding) this.raiseRecoverable(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression") - break - - case "ObjectPattern": - for (var i = 0; i < expr.properties.length; i++) - this$1.checkLVal(expr.properties[i].value, isBinding, checkClashes) - break - - case "ArrayPattern": - for (var i$1 = 0; i$1 < expr.elements.length; i$1++) { - var elem = expr.elements[i$1] - if (elem) this$1.checkLVal(elem, isBinding, checkClashes) - } - break - - case "AssignmentPattern": - this.checkLVal(expr.left, isBinding, checkClashes) - break - - case "RestElement": - this.checkLVal(expr.argument, isBinding, checkClashes) - break - - case "ParenthesizedExpression": - this.checkLVal(expr.expression, isBinding, checkClashes) - break - - default: - this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue") - } -} - -var pp$3 = Parser.prototype - -// Check if property name clashes with already added. -// Object/class getters and setters are not allowed to clash — -// either with each other or with an init property — and in -// strict mode, init properties are also not allowed to be repeated. - -pp$3.checkPropClash = function(prop, propHash) { - if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) - return - var key = prop.key; - var name - switch (key.type) { - case "Identifier": name = key.name; break - case "Literal": name = String(key.value); break - default: return - } - var kind = prop.kind; - if (this.options.ecmaVersion >= 6) { - if (name === "__proto__" && kind === "init") { - if (propHash.proto) this.raiseRecoverable(key.start, "Redefinition of __proto__ property") - propHash.proto = true - } - return - } - name = "$" + name - var other = propHash[name] - if (other) { - var isGetSet = kind !== "init" - if ((this.strict || isGetSet) && other[kind] || !(isGetSet ^ other.init)) - this.raiseRecoverable(key.start, "Redefinition of property") - } else { - other = propHash[name] = { - init: false, - get: false, - set: false - } - } - other[kind] = true -} - -// ### Expression parsing - -// These nest, from the most general expression type at the top to -// 'atomic', nondivisible expression types at the bottom. Most of -// the functions will simply let the function(s) below them parse, -// and, *if* the syntactic construct they handle is present, wrap -// the AST node that the inner parser gave them in another node. - -// Parse a full expression. The optional arguments are used to -// forbid the `in` operator (in for loops initalization expressions) -// and provide reference for storing '=' operator inside shorthand -// property assignment in contexts where both object expression -// and object pattern might appear (so it's possible to raise -// delayed syntax error at correct position). - -pp$3.parseExpression = function(noIn, refDestructuringErrors) { - var this$1 = this; - - var startPos = this.start, startLoc = this.startLoc - var expr = this.parseMaybeAssign(noIn, refDestructuringErrors) - if (this.type === tt.comma) { - var node = this.startNodeAt(startPos, startLoc) - node.expressions = [expr] - while (this.eat(tt.comma)) node.expressions.push(this$1.parseMaybeAssign(noIn, refDestructuringErrors)) - return this.finishNode(node, "SequenceExpression") - } - return expr -} - -// Parse an assignment expression. This includes applications of -// operators like `+=`. - -pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) { - if (this.inGenerator && this.isContextual("yield")) return this.parseYield() - - var ownDestructuringErrors = false - if (!refDestructuringErrors) { - refDestructuringErrors = new DestructuringErrors - ownDestructuringErrors = true - } - var startPos = this.start, startLoc = this.startLoc - if (this.type == tt.parenL || this.type == tt.name) - this.potentialArrowAt = this.start - var left = this.parseMaybeConditional(noIn, refDestructuringErrors) - if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc) - if (this.type.isAssign) { - this.checkPatternErrors(refDestructuringErrors, true) - if (!ownDestructuringErrors) DestructuringErrors.call(refDestructuringErrors) - var node = this.startNodeAt(startPos, startLoc) - node.operator = this.value - node.left = this.type === tt.eq ? this.toAssignable(left) : left - refDestructuringErrors.shorthandAssign = 0 // reset because shorthand default was used correctly - this.checkLVal(left) - this.next() - node.right = this.parseMaybeAssign(noIn) - return this.finishNode(node, "AssignmentExpression") - } else { - if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true) - } - return left -} - -// Parse a ternary conditional (`?:`) operator. - -pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc - var expr = this.parseExprOps(noIn, refDestructuringErrors) - if (this.checkExpressionErrors(refDestructuringErrors)) return expr - if (this.eat(tt.question)) { - var node = this.startNodeAt(startPos, startLoc) - node.test = expr - node.consequent = this.parseMaybeAssign() - this.expect(tt.colon) - node.alternate = this.parseMaybeAssign(noIn) - return this.finishNode(node, "ConditionalExpression") - } - return expr -} - -// Start the precedence parser. - -pp$3.parseExprOps = function(noIn, refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc - var expr = this.parseMaybeUnary(refDestructuringErrors, false) - if (this.checkExpressionErrors(refDestructuringErrors)) return expr - return this.parseExprOp(expr, startPos, startLoc, -1, noIn) -} - -// Parse binary operators with the operator precedence parsing -// algorithm. `left` is the left-hand side of the operator. -// `minPrec` provides context that allows the function to stop and -// defer further parser to one of its callers when it encounters an -// operator that has a lower precedence than the set it is parsing. - -pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) { - var prec = this.type.binop - if (prec != null && (!noIn || this.type !== tt._in)) { - if (prec > minPrec) { - var logical = this.type === tt.logicalOR || this.type === tt.logicalAND - var op = this.value - this.next() - var startPos = this.start, startLoc = this.startLoc - var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn) - var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical) - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn) - } - } - return left -} - -pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) { - var node = this.startNodeAt(startPos, startLoc) - node.left = left - node.operator = op - node.right = right - return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression") -} - -// Parse unary operators, both prefix and postfix. - -pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) { - var this$1 = this; - - var startPos = this.start, startLoc = this.startLoc, expr - if (this.type.prefix) { - var node = this.startNode(), update = this.type === tt.incDec - node.operator = this.value - node.prefix = true - this.next() - node.argument = this.parseMaybeUnary(null, true) - this.checkExpressionErrors(refDestructuringErrors, true) - if (update) this.checkLVal(node.argument) - else if (this.strict && node.operator === "delete" && - node.argument.type === "Identifier") - this.raiseRecoverable(node.start, "Deleting local variable in strict mode") - else sawUnary = true - expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression") - } else { - expr = this.parseExprSubscripts(refDestructuringErrors) - if (this.checkExpressionErrors(refDestructuringErrors)) return expr - while (this.type.postfix && !this.canInsertSemicolon()) { - var node$1 = this$1.startNodeAt(startPos, startLoc) - node$1.operator = this$1.value - node$1.prefix = false - node$1.argument = expr - this$1.checkLVal(expr) - this$1.next() - expr = this$1.finishNode(node$1, "UpdateExpression") - } - } - - if (!sawUnary && this.eat(tt.starstar)) - return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) - else - return expr -} - -// Parse call, dot, and `[]`-subscript expressions. - -pp$3.parseExprSubscripts = function(refDestructuringErrors) { - var startPos = this.start, startLoc = this.startLoc - var expr = this.parseExprAtom(refDestructuringErrors) - var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")" - if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) return expr - return this.parseSubscripts(expr, startPos, startLoc) -} - -pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) { - var this$1 = this; - - for (;;) { - if (this$1.eat(tt.dot)) { - var node = this$1.startNodeAt(startPos, startLoc) - node.object = base - node.property = this$1.parseIdent(true) - node.computed = false - base = this$1.finishNode(node, "MemberExpression") - } else if (this$1.eat(tt.bracketL)) { - var node$1 = this$1.startNodeAt(startPos, startLoc) - node$1.object = base - node$1.property = this$1.parseExpression() - node$1.computed = true - this$1.expect(tt.bracketR) - base = this$1.finishNode(node$1, "MemberExpression") - } else if (!noCalls && this$1.eat(tt.parenL)) { - var node$2 = this$1.startNodeAt(startPos, startLoc) - node$2.callee = base - node$2.arguments = this$1.parseExprList(tt.parenR, false) - base = this$1.finishNode(node$2, "CallExpression") - } else if (this$1.type === tt.backQuote) { - var node$3 = this$1.startNodeAt(startPos, startLoc) - node$3.tag = base - node$3.quasi = this$1.parseTemplate() - base = this$1.finishNode(node$3, "TaggedTemplateExpression") - } else { - return base - } - } -} - -// Parse an atomic expression — either a single token that is an -// expression, an expression started by a keyword like `function` or -// `new`, or an expression wrapped in punctuation like `()`, `[]`, -// or `{}`. - -pp$3.parseExprAtom = function(refDestructuringErrors) { - var node, canBeArrow = this.potentialArrowAt == this.start - switch (this.type) { - case tt._super: - if (!this.inFunction) - this.raise(this.start, "'super' outside of function or class") - - case tt._this: - var type = this.type === tt._this ? "ThisExpression" : "Super" - node = this.startNode() - this.next() - return this.finishNode(node, type) - - case tt.name: - var startPos = this.start, startLoc = this.startLoc - var id = this.parseIdent(this.type !== tt.name) - if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id]) - return id - - case tt.regexp: - var value = this.value - node = this.parseLiteral(value.value) - node.regex = {pattern: value.pattern, flags: value.flags} - return node - - case tt.num: case tt.string: - return this.parseLiteral(this.value) - - case tt._null: case tt._true: case tt._false: - node = this.startNode() - node.value = this.type === tt._null ? null : this.type === tt._true - node.raw = this.type.keyword - this.next() - return this.finishNode(node, "Literal") - - case tt.parenL: - return this.parseParenAndDistinguishExpression(canBeArrow) - - case tt.bracketL: - node = this.startNode() - this.next() - node.elements = this.parseExprList(tt.bracketR, true, true, refDestructuringErrors) - return this.finishNode(node, "ArrayExpression") - - case tt.braceL: - return this.parseObj(false, refDestructuringErrors) - - case tt._function: - node = this.startNode() - this.next() - return this.parseFunction(node, false) - - case tt._class: - return this.parseClass(this.startNode(), false) - - case tt._new: - return this.parseNew() - - case tt.backQuote: - return this.parseTemplate() - - default: - this.unexpected() - } -} - -pp$3.parseLiteral = function(value) { - var node = this.startNode() - node.value = value - node.raw = this.input.slice(this.start, this.end) - this.next() - return this.finishNode(node, "Literal") -} - -pp$3.parseParenExpression = function() { - this.expect(tt.parenL) - var val = this.parseExpression() - this.expect(tt.parenR) - return val -} - -pp$3.parseParenAndDistinguishExpression = function(canBeArrow) { - var this$1 = this; - - var startPos = this.start, startLoc = this.startLoc, val - if (this.options.ecmaVersion >= 6) { - this.next() - - var innerStartPos = this.start, innerStartLoc = this.startLoc - var exprList = [], first = true - var refDestructuringErrors = new DestructuringErrors, spreadStart, innerParenStart - while (this.type !== tt.parenR) { - first ? first = false : this$1.expect(tt.comma) - if (this$1.type === tt.ellipsis) { - spreadStart = this$1.start - exprList.push(this$1.parseParenItem(this$1.parseRest())) - break - } else { - if (this$1.type === tt.parenL && !innerParenStart) { - innerParenStart = this$1.start - } - exprList.push(this$1.parseMaybeAssign(false, refDestructuringErrors, this$1.parseParenItem)) - } - } - var innerEndPos = this.start, innerEndLoc = this.startLoc - this.expect(tt.parenR) - - if (canBeArrow && !this.canInsertSemicolon() && this.eat(tt.arrow)) { - this.checkPatternErrors(refDestructuringErrors, true) - if (innerParenStart) this.unexpected(innerParenStart) - return this.parseParenArrowList(startPos, startLoc, exprList) - } - - if (!exprList.length) this.unexpected(this.lastTokStart) - if (spreadStart) this.unexpected(spreadStart) - this.checkExpressionErrors(refDestructuringErrors, true) - - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc) - val.expressions = exprList - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc) - } else { - val = exprList[0] - } - } else { - val = this.parseParenExpression() - } - - if (this.options.preserveParens) { - var par = this.startNodeAt(startPos, startLoc) - par.expression = val - return this.finishNode(par, "ParenthesizedExpression") - } else { - return val - } -} - -pp$3.parseParenItem = function(item) { - return item -} - -pp$3.parseParenArrowList = function(startPos, startLoc, exprList) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList) -} - -// New's precedence is slightly tricky. It must allow its argument to -// be a `[]` or dot subscript expression, but not a call — at least, -// not without wrapping it in parentheses. Thus, it uses the noCalls -// argument to parseSubscripts to prevent it from consuming the -// argument list. - -var empty$1 = [] - -pp$3.parseNew = function() { - var node = this.startNode() - var meta = this.parseIdent(true) - if (this.options.ecmaVersion >= 6 && this.eat(tt.dot)) { - node.meta = meta - node.property = this.parseIdent(true) - if (node.property.name !== "target") - this.raiseRecoverable(node.property.start, "The only valid meta property for new is new.target") - if (!this.inFunction) - this.raiseRecoverable(node.start, "new.target can only be used in functions") - return this.finishNode(node, "MetaProperty") - } - var startPos = this.start, startLoc = this.startLoc - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true) - if (this.eat(tt.parenL)) node.arguments = this.parseExprList(tt.parenR, false) - else node.arguments = empty$1 - return this.finishNode(node, "NewExpression") -} - -// Parse template expression. - -pp$3.parseTemplateElement = function() { - var elem = this.startNode() - elem.value = { - raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'), - cooked: this.value - } - this.next() - elem.tail = this.type === tt.backQuote - return this.finishNode(elem, "TemplateElement") -} - -pp$3.parseTemplate = function() { - var this$1 = this; - - var node = this.startNode() - this.next() - node.expressions = [] - var curElt = this.parseTemplateElement() - node.quasis = [curElt] - while (!curElt.tail) { - this$1.expect(tt.dollarBraceL) - node.expressions.push(this$1.parseExpression()) - this$1.expect(tt.braceR) - node.quasis.push(curElt = this$1.parseTemplateElement()) - } - this.next() - return this.finishNode(node, "TemplateLiteral") -} - -// Parse an object literal or binding pattern. - -pp$3.parseObj = function(isPattern, refDestructuringErrors) { - var this$1 = this; - - var node = this.startNode(), first = true, propHash = {} - node.properties = [] - this.next() - while (!this.eat(tt.braceR)) { - if (!first) { - this$1.expect(tt.comma) - if (this$1.afterTrailingComma(tt.braceR)) break - } else first = false - - var prop = this$1.startNode(), isGenerator, startPos, startLoc - if (this$1.options.ecmaVersion >= 6) { - prop.method = false - prop.shorthand = false - if (isPattern || refDestructuringErrors) { - startPos = this$1.start - startLoc = this$1.startLoc - } - if (!isPattern) - isGenerator = this$1.eat(tt.star) - } - this$1.parsePropertyName(prop) - this$1.parsePropertyValue(prop, isPattern, isGenerator, startPos, startLoc, refDestructuringErrors) - this$1.checkPropClash(prop, propHash) - node.properties.push(this$1.finishNode(prop, "Property")) - } - return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression") -} - -pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, startPos, startLoc, refDestructuringErrors) { - if (this.eat(tt.colon)) { - prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors) - prop.kind = "init" - } else if (this.options.ecmaVersion >= 6 && this.type === tt.parenL) { - if (isPattern) this.unexpected() - prop.kind = "init" - prop.method = true - prop.value = this.parseMethod(isGenerator) - } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && - (prop.key.name === "get" || prop.key.name === "set") && - (this.type != tt.comma && this.type != tt.braceR)) { - if (isGenerator || isPattern) this.unexpected() - prop.kind = prop.key.name - this.parsePropertyName(prop) - prop.value = this.parseMethod(false) - var paramCount = prop.kind === "get" ? 0 : 1 - if (prop.value.params.length !== paramCount) { - var start = prop.value.start - if (prop.kind === "get") - this.raiseRecoverable(start, "getter should have no params") - else - this.raiseRecoverable(start, "setter should have exactly one param") - } - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") - this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params") - } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") { - if (this.keywords.test(prop.key.name) || - (this.strict ? this.reservedWordsStrictBind : this.reservedWords).test(prop.key.name) || - (this.inGenerator && prop.key.name == "yield")) - this.raiseRecoverable(prop.key.start, "'" + prop.key.name + "' can not be used as shorthand property") - prop.kind = "init" - if (isPattern) { - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key) - } else if (this.type === tt.eq && refDestructuringErrors) { - if (!refDestructuringErrors.shorthandAssign) - refDestructuringErrors.shorthandAssign = this.start - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key) - } else { - prop.value = prop.key - } - prop.shorthand = true - } else this.unexpected() -} - -pp$3.parsePropertyName = function(prop) { - if (this.options.ecmaVersion >= 6) { - if (this.eat(tt.bracketL)) { - prop.computed = true - prop.key = this.parseMaybeAssign() - this.expect(tt.bracketR) - return prop.key - } else { - prop.computed = false - } - } - return prop.key = this.type === tt.num || this.type === tt.string ? this.parseExprAtom() : this.parseIdent(true) -} - -// Initialize empty function node. - -pp$3.initFunction = function(node) { - node.id = null - if (this.options.ecmaVersion >= 6) { - node.generator = false - node.expression = false - } -} - -// Parse object or class method. - -pp$3.parseMethod = function(isGenerator) { - var node = this.startNode(), oldInGen = this.inGenerator - this.inGenerator = isGenerator - this.initFunction(node) - this.expect(tt.parenL) - node.params = this.parseBindingList(tt.parenR, false, false) - if (this.options.ecmaVersion >= 6) - node.generator = isGenerator - this.parseFunctionBody(node, false) - this.inGenerator = oldInGen - return this.finishNode(node, "FunctionExpression") -} - -// Parse arrow function expression with given parameters. - -pp$3.parseArrowExpression = function(node, params) { - var oldInGen = this.inGenerator - this.inGenerator = false - this.initFunction(node) - node.params = this.toAssignableList(params, true) - this.parseFunctionBody(node, true) - this.inGenerator = oldInGen - return this.finishNode(node, "ArrowFunctionExpression") -} - -// Parse function body and check parameters. - -pp$3.parseFunctionBody = function(node, isArrowFunction) { - var isExpression = isArrowFunction && this.type !== tt.braceL - - if (isExpression) { - node.body = this.parseMaybeAssign() - node.expression = true - } else { - // Start a new scope with regard to labels and the `inFunction` - // flag (restore them to their old value afterwards). - var oldInFunc = this.inFunction, oldLabels = this.labels - this.inFunction = true; this.labels = [] - node.body = this.parseBlock(true) - node.expression = false - this.inFunction = oldInFunc; this.labels = oldLabels - } - - // If this is a strict mode function, verify that argument names - // are not repeated, and it does not try to bind the words `eval` - // or `arguments`. - var useStrict = (!isExpression && node.body.body.length && this.isUseStrict(node.body.body[0])) ? node.body.body[0] : null; - if (this.strict || useStrict) { - var oldStrict = this.strict - this.strict = true - if (node.id) - this.checkLVal(node.id, true) - this.checkParams(node, useStrict) - this.strict = oldStrict - } else if (isArrowFunction) { - this.checkParams(node, useStrict) - } -} - -// Checks function params for various disallowed patterns such as using "eval" -// or "arguments" and duplicate parameters. - -pp$3.checkParams = function(node, useStrict) { - var this$1 = this; - - var nameHash = {} - for (var i = 0; i < node.params.length; i++) { - if (useStrict && this$1.options.ecmaVersion >= 7 && node.params[i].type !== "Identifier") - this$1.raiseRecoverable(useStrict.start, "Illegal 'use strict' directive in function with non-simple parameter list"); - this$1.checkLVal(node.params[i], true, nameHash) - } -} - -// Parses a comma-separated list of expressions, and returns them as -// an array. `close` is the token type that ends the list, and -// `allowEmpty` can be turned on to allow subsequent commas with -// nothing in between them to be parsed as `null` (which is needed -// for array literals). - -pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { - var this$1 = this; - - var elts = [], first = true - while (!this.eat(close)) { - if (!first) { - this$1.expect(tt.comma) - if (allowTrailingComma && this$1.afterTrailingComma(close)) break - } else first = false - - var elt - if (allowEmpty && this$1.type === tt.comma) - elt = null - else if (this$1.type === tt.ellipsis) { - elt = this$1.parseSpread(refDestructuringErrors) - if (this$1.type === tt.comma && refDestructuringErrors && !refDestructuringErrors.trailingComma) { - refDestructuringErrors.trailingComma = this$1.lastTokStart - } - } else - elt = this$1.parseMaybeAssign(false, refDestructuringErrors) - elts.push(elt) - } - return elts -} - -// Parse the next token as an identifier. If `liberal` is true (used -// when parsing properties), it will also convert keywords into -// identifiers. - -pp$3.parseIdent = function(liberal) { - var node = this.startNode() - if (liberal && this.options.allowReserved == "never") liberal = false - if (this.type === tt.name) { - if (!liberal && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(this.value) && - (this.options.ecmaVersion >= 6 || - this.input.slice(this.start, this.end).indexOf("\\") == -1)) - this.raiseRecoverable(this.start, "The keyword '" + this.value + "' is reserved") - if (!liberal && this.inGenerator && this.value === "yield") - this.raiseRecoverable(this.start, "Can not use 'yield' as identifier inside a generator") - node.name = this.value - } else if (liberal && this.type.keyword) { - node.name = this.type.keyword - } else { - this.unexpected() - } - this.next() - return this.finishNode(node, "Identifier") -} - -// Parses yield expression inside generator. - -pp$3.parseYield = function() { - var node = this.startNode() - this.next() - if (this.type == tt.semi || this.canInsertSemicolon() || (this.type != tt.star && !this.type.startsExpr)) { - node.delegate = false - node.argument = null - } else { - node.delegate = this.eat(tt.star) - node.argument = this.parseMaybeAssign() - } - return this.finishNode(node, "YieldExpression") -} - -var pp$4 = Parser.prototype - -// This function is used to raise exceptions on parse errors. It -// takes an offset integer (into the current `input`) to indicate -// the location of the error, attaches the position to the end -// of the error message, and then raises a `SyntaxError` with that -// message. - -pp$4.raise = function(pos, message) { - var loc = getLineInfo(this.input, pos) - message += " (" + loc.line + ":" + loc.column + ")" - var err = new SyntaxError(message) - err.pos = pos; err.loc = loc; err.raisedAt = this.pos - throw err -} - -pp$4.raiseRecoverable = pp$4.raise - -pp$4.curPosition = function() { - if (this.options.locations) { - return new Position(this.curLine, this.pos - this.lineStart) - } -} - -var Node = function Node(parser, pos, loc) { - this.type = "" - this.start = pos - this.end = 0 - if (parser.options.locations) - this.loc = new SourceLocation(parser, loc) - if (parser.options.directSourceFile) - this.sourceFile = parser.options.directSourceFile - if (parser.options.ranges) - this.range = [pos, 0] -}; - -// Start an AST node, attaching a start offset. - -var pp$5 = Parser.prototype - -pp$5.startNode = function() { - return new Node(this, this.start, this.startLoc) -} - -pp$5.startNodeAt = function(pos, loc) { - return new Node(this, pos, loc) -} - -// Finish an AST node, adding `type` and `end` properties. - -function finishNodeAt(node, type, pos, loc) { - node.type = type - node.end = pos - if (this.options.locations) - node.loc.end = loc - if (this.options.ranges) - node.range[1] = pos - return node -} - -pp$5.finishNode = function(node, type) { - return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc) -} - -// Finish node at given position - -pp$5.finishNodeAt = function(node, type, pos, loc) { - return finishNodeAt.call(this, node, type, pos, loc) -} - -var TokContext = function TokContext(token, isExpr, preserveSpace, override) { - this.token = token - this.isExpr = !!isExpr - this.preserveSpace = !!preserveSpace - this.override = override -}; - -var types = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", true), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function (p) { return p.readTmplToken(); }), - f_expr: new TokContext("function", true) -} - -var pp$6 = Parser.prototype - -pp$6.initialContext = function() { - return [types.b_stat] -} - -pp$6.braceIsBlock = function(prevType) { - if (prevType === tt.colon) { - var parent = this.curContext() - if (parent === types.b_stat || parent === types.b_expr) - return !parent.isExpr - } - if (prevType === tt._return) - return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) - if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR) - return true - if (prevType == tt.braceL) - return this.curContext() === types.b_stat - return !this.exprAllowed -} - -pp$6.updateContext = function(prevType) { - var update, type = this.type - if (type.keyword && prevType == tt.dot) - this.exprAllowed = false - else if (update = type.updateContext) - update.call(this, prevType) - else - this.exprAllowed = type.beforeExpr -} - -// Token-specific context update code - -tt.parenR.updateContext = tt.braceR.updateContext = function() { - if (this.context.length == 1) { - this.exprAllowed = true - return - } - var out = this.context.pop() - if (out === types.b_stat && this.curContext() === types.f_expr) { - this.context.pop() - this.exprAllowed = false - } else if (out === types.b_tmpl) { - this.exprAllowed = true - } else { - this.exprAllowed = !out.isExpr - } -} - -tt.braceL.updateContext = function(prevType) { - this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr) - this.exprAllowed = true -} - -tt.dollarBraceL.updateContext = function() { - this.context.push(types.b_tmpl) - this.exprAllowed = true -} - -tt.parenL.updateContext = function(prevType) { - var statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while - this.context.push(statementParens ? types.p_stat : types.p_expr) - this.exprAllowed = true -} - -tt.incDec.updateContext = function() { - // tokExprAllowed stays unchanged -} - -tt._function.updateContext = function(prevType) { - if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else && - !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat)) - this.context.push(types.f_expr) - this.exprAllowed = false -} - -tt.backQuote.updateContext = function() { - if (this.curContext() === types.q_tmpl) - this.context.pop() - else - this.context.push(types.q_tmpl) - this.exprAllowed = false -} - -// Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = function Token(p) { - this.type = p.type - this.value = p.value - this.start = p.start - this.end = p.end - if (p.options.locations) - this.loc = new SourceLocation(p, p.startLoc, p.endLoc) - if (p.options.ranges) - this.range = [p.start, p.end] -}; - -// ## Tokenizer - -var pp$7 = Parser.prototype - -// Are we running under Rhino? -var isRhino = typeof Packages == "object" && Object.prototype.toString.call(Packages) == "[object JavaPackage]" - -// Move to the next token - -pp$7.next = function() { - if (this.options.onToken) - this.options.onToken(new Token(this)) - - this.lastTokEnd = this.end - this.lastTokStart = this.start - this.lastTokEndLoc = this.endLoc - this.lastTokStartLoc = this.startLoc - this.nextToken() -} - -pp$7.getToken = function() { - this.next() - return new Token(this) -} - -// If we're in an ES6 environment, make parsers iterable -if (typeof Symbol !== "undefined") - pp$7[Symbol.iterator] = function () { - var self = this - return {next: function () { - var token = self.getToken() - return { - done: token.type === tt.eof, - value: token - } - }} - } - -// Toggle strict mode. Re-reads the next number or string to please -// pedantic tests (`"use strict"; 010;` should fail). - -pp$7.setStrict = function(strict) { - var this$1 = this; - - this.strict = strict - if (this.type !== tt.num && this.type !== tt.string) return - this.pos = this.start - if (this.options.locations) { - while (this.pos < this.lineStart) { - this$1.lineStart = this$1.input.lastIndexOf("\n", this$1.lineStart - 2) + 1 - --this$1.curLine - } - } - this.nextToken() -} - -pp$7.curContext = function() { - return this.context[this.context.length - 1] -} - -// Read a single token, updating the parser object's token-related -// properties. - -pp$7.nextToken = function() { - var curContext = this.curContext() - if (!curContext || !curContext.preserveSpace) this.skipSpace() - - this.start = this.pos - if (this.options.locations) this.startLoc = this.curPosition() - if (this.pos >= this.input.length) return this.finishToken(tt.eof) - - if (curContext.override) return curContext.override(this) - else this.readToken(this.fullCharCodeAtPos()) -} - -pp$7.readToken = function(code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\' */) - return this.readWord() - - return this.getTokenFromCode(code) -} - -pp$7.fullCharCodeAtPos = function() { - var code = this.input.charCodeAt(this.pos) - if (code <= 0xd7ff || code >= 0xe000) return code - var next = this.input.charCodeAt(this.pos + 1) - return (code << 10) + next - 0x35fdc00 -} - -pp$7.skipBlockComment = function() { - var this$1 = this; - - var startLoc = this.options.onComment && this.curPosition() - var start = this.pos, end = this.input.indexOf("*/", this.pos += 2) - if (end === -1) this.raise(this.pos - 2, "Unterminated comment") - this.pos = end + 2 - if (this.options.locations) { - lineBreakG.lastIndex = start - var match - while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) { - ++this$1.curLine - this$1.lineStart = match.index + match[0].length - } - } - if (this.options.onComment) - this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos, - startLoc, this.curPosition()) -} - -pp$7.skipLineComment = function(startSkip) { - var this$1 = this; - - var start = this.pos - var startLoc = this.options.onComment && this.curPosition() - var ch = this.input.charCodeAt(this.pos+=startSkip) - while (this.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this$1.pos - ch = this$1.input.charCodeAt(this$1.pos) - } - if (this.options.onComment) - this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos, - startLoc, this.curPosition()) -} - -// Called at the start of the parse and after every token. Skips -// whitespace and comments, and. - -pp$7.skipSpace = function() { - var this$1 = this; - - loop: while (this.pos < this.input.length) { - var ch = this$1.input.charCodeAt(this$1.pos) - switch (ch) { - case 32: case 160: // ' ' - ++this$1.pos - break - case 13: - if (this$1.input.charCodeAt(this$1.pos + 1) === 10) { - ++this$1.pos - } - case 10: case 8232: case 8233: - ++this$1.pos - if (this$1.options.locations) { - ++this$1.curLine - this$1.lineStart = this$1.pos - } - break - case 47: // '/' - switch (this$1.input.charCodeAt(this$1.pos + 1)) { - case 42: // '*' - this$1.skipBlockComment() - break - case 47: - this$1.skipLineComment(2) - break - default: - break loop - } - break - default: - if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this$1.pos - } else { - break loop - } - } - } -} - -// Called at the end of every token. Sets `end`, `val`, and -// maintains `context` and `exprAllowed`, and skips the space after -// the token, so that the next one's `start` will point at the -// right position. - -pp$7.finishToken = function(type, val) { - this.end = this.pos - if (this.options.locations) this.endLoc = this.curPosition() - var prevType = this.type - this.type = type - this.value = val - - this.updateContext(prevType) -} - -// ### Token reading - -// This is the function that is called to fetch the next token. It -// is somewhat obscure, because it works in character codes rather -// than characters, and because operator parsing has been inlined -// into it. -// -// All in the name of speed. -// -pp$7.readToken_dot = function() { - var next = this.input.charCodeAt(this.pos + 1) - if (next >= 48 && next <= 57) return this.readNumber(true) - var next2 = this.input.charCodeAt(this.pos + 2) - if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.' - this.pos += 3 - return this.finishToken(tt.ellipsis) - } else { - ++this.pos - return this.finishToken(tt.dot) - } -} - -pp$7.readToken_slash = function() { // '/' - var next = this.input.charCodeAt(this.pos + 1) - if (this.exprAllowed) {++this.pos; return this.readRegexp()} - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.slash, 1) -} - -pp$7.readToken_mult_modulo_exp = function(code) { // '%*' - var next = this.input.charCodeAt(this.pos + 1) - var size = 1 - var tokentype = code === 42 ? tt.star : tt.modulo - - // exponentiation operator ** and **= - if (this.options.ecmaVersion >= 7 && next === 42) { - ++size - tokentype = tt.starstar - next = this.input.charCodeAt(this.pos + 2) - } - - if (next === 61) return this.finishOp(tt.assign, size + 1) - return this.finishOp(tokentype, size) -} - -pp$7.readToken_pipe_amp = function(code) { // '|&' - var next = this.input.charCodeAt(this.pos + 1) - if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2) - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1) -} - -pp$7.readToken_caret = function() { // '^' - var next = this.input.charCodeAt(this.pos + 1) - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.bitwiseXOR, 1) -} - -pp$7.readToken_plus_min = function(code) { // '+-' - var next = this.input.charCodeAt(this.pos + 1) - if (next === code) { - if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && - lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) { - // A `-->` line comment - this.skipLineComment(3) - this.skipSpace() - return this.nextToken() - } - return this.finishOp(tt.incDec, 2) - } - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.plusMin, 1) -} - -pp$7.readToken_lt_gt = function(code) { // '<>' - var next = this.input.charCodeAt(this.pos + 1) - var size = 1 - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2 - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1) - return this.finishOp(tt.bitShift, size) - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && - this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected() - // `` line comment - this.skipLineComment(3) - this.skipSpace() - return this.nextToken() - } - return this.finishOp(tt.incDec, 2) - } - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.plusMin, 1) - } - - pp$7.readToken_lt_gt = function(code) { // '<>' - var next = this.input.charCodeAt(this.pos + 1) - var size = 1 - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2 - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1) - return this.finishOp(tt.bitShift, size) - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && - this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected() - // `` line comment - this.skipLineComment(3) - this.skipSpace() - return this.nextToken() - } - return this.finishOp(tt.incDec, 2) - } - if (next === 61) return this.finishOp(tt.assign, 2) - return this.finishOp(tt.plusMin, 1) -} - -pp.readToken_lt_gt = function(code) { // '<>' - let next = this.input.charCodeAt(this.pos + 1) - let size = 1 - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2 - if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1) - return this.finishOp(tt.bitShift, size) - } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && - this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) this.unexpected() - // ` - -### anyTypeAnnotation -```javascript -t.anyTypeAnnotation() -``` - -See also `t.isAnyTypeAnnotation(node, opts)` and `t.assertAnyTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### arrayExpression -```javascript -t.arrayExpression(elements) -``` - -See also `t.isArrayExpression(node, opts)` and `t.assertArrayExpression(node, opts)`. - -Aliases: `Expression` - - - `elements`: `Array` (default: `[]`) - ---- - -### arrayPattern -```javascript -t.arrayPattern(elements, typeAnnotation) -``` - -See also `t.isArrayPattern(node, opts)` and `t.assertArrayPattern(node, opts)`. - -Aliases: `Pattern`, `LVal` - - - `elements`: `Array` (required) - - `typeAnnotation` (required) - - `decorators`: `Array` (default: `null`) - ---- - -### arrayTypeAnnotation -```javascript -t.arrayTypeAnnotation(elementType) -``` - -See also `t.isArrayTypeAnnotation(node, opts)` and `t.assertArrayTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `elementType` (required) - ---- - -### arrowFunctionExpression -```javascript -t.arrowFunctionExpression(params, body, async) -``` - -See also `t.isArrowFunctionExpression(node, opts)` and `t.assertArrowFunctionExpression(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` - - - `params`: `Array` (required) - - `body`: `BlockStatement | Expression` (required) - - `async`: `boolean` (default: `false`) - - `returnType` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### assignmentExpression -```javascript -t.assignmentExpression(operator, left, right) -``` - -See also `t.isAssignmentExpression(node, opts)` and `t.assertAssignmentExpression(node, opts)`. - -Aliases: `Expression` - - - `operator`: `string` (required) - - `left`: `LVal` (required) - - `right`: `Expression` (required) - ---- - -### assignmentPattern -```javascript -t.assignmentPattern(left, right) -``` - -See also `t.isAssignmentPattern(node, opts)` and `t.assertAssignmentPattern(node, opts)`. - -Aliases: `Pattern`, `LVal` - - - `left`: `Identifier` (required) - - `right`: `Expression` (required) - - `decorators`: `Array` (default: `null`) - ---- - -### awaitExpression -```javascript -t.awaitExpression(argument) -``` - -See also `t.isAwaitExpression(node, opts)` and `t.assertAwaitExpression(node, opts)`. - -Aliases: `Expression`, `Terminatorless` - - - `argument`: `Expression` (required) - ---- - -### binaryExpression -```javascript -t.binaryExpression(operator, left, right) -``` - -See also `t.isBinaryExpression(node, opts)` and `t.assertBinaryExpression(node, opts)`. - -Aliases: `Binary`, `Expression` - - - `operator`: `'+' | '-' | '/' | '%' | '*' | '**' | '&' | '|' | '>>' | '>>>' | '<<' | '^' | '==' | '===' | '!=' | '!==' | 'in' | 'instanceof' | '>' | '<' | '>=' | '<='` (required) - - `left`: `Expression` (required) - - `right`: `Expression` (required) - ---- - -### bindExpression -```javascript -t.bindExpression(object, callee) -``` - -See also `t.isBindExpression(node, opts)` and `t.assertBindExpression(node, opts)`. - -Aliases: `Expression` - - - `object` (required) - - `callee` (required) - ---- - -### blockStatement -```javascript -t.blockStatement(body, directives) -``` - -See also `t.isBlockStatement(node, opts)` and `t.assertBlockStatement(node, opts)`. - -Aliases: `Scopable`, `BlockParent`, `Block`, `Statement` - - - `body`: `Array` (required) - - `directives`: `Array` (default: `[]`) - ---- - -### booleanLiteral -```javascript -t.booleanLiteral(value) -``` - -See also `t.isBooleanLiteral(node, opts)` and `t.assertBooleanLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `boolean` (required) - ---- - -### booleanLiteralTypeAnnotation -```javascript -t.booleanLiteralTypeAnnotation() -``` - -See also `t.isBooleanLiteralTypeAnnotation(node, opts)` and `t.assertBooleanLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### booleanTypeAnnotation -```javascript -t.booleanTypeAnnotation() -``` - -See also `t.isBooleanTypeAnnotation(node, opts)` and `t.assertBooleanTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### breakStatement -```javascript -t.breakStatement(label) -``` - -See also `t.isBreakStatement(node, opts)` and `t.assertBreakStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `label`: `Identifier` (default: `null`) - ---- - -### callExpression -```javascript -t.callExpression(callee, arguments) -``` - -See also `t.isCallExpression(node, opts)` and `t.assertCallExpression(node, opts)`. - -Aliases: `Expression` - - - `callee`: `Expression` (required) - - `arguments`: `Array` (required) - ---- - -### catchClause -```javascript -t.catchClause(param, body) -``` - -See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`. - -Aliases: `Scopable` - - - `param`: `Identifier` (required) - - `body`: `BlockStatement` (required) - ---- - -### classBody -```javascript -t.classBody(body) -``` - -See also `t.isClassBody(node, opts)` and `t.assertClassBody(node, opts)`. - - - `body`: `Array` (required) - ---- - -### classDeclaration -```javascript -t.classDeclaration(id, superClass, body, decorators) -``` - -See also `t.isClassDeclaration(node, opts)` and `t.assertClassDeclaration(node, opts)`. - -Aliases: `Scopable`, `Class`, `Statement`, `Declaration`, `Pureish` - - - `id`: `Identifier` (required) - - `superClass`: `Expression` (default: `null`) - - `body`: `ClassBody` (required) - - `decorators`: `Array` (required) - - `implements` (default: `null`) - - `mixins` (default: `null`) - - `superTypeParameters` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### classExpression -```javascript -t.classExpression(id, superClass, body, decorators) -``` - -See also `t.isClassExpression(node, opts)` and `t.assertClassExpression(node, opts)`. - -Aliases: `Scopable`, `Class`, `Expression`, `Pureish` - - - `id`: `Identifier` (default: `null`) - - `superClass`: `Expression` (default: `null`) - - `body`: `ClassBody` (required) - - `decorators`: `Array` (required) - - `implements` (default: `null`) - - `mixins` (default: `null`) - - `superTypeParameters` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### classImplements -```javascript -t.classImplements(id, typeParameters) -``` - -See also `t.isClassImplements(node, opts)` and `t.assertClassImplements(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### classMethod -```javascript -t.classMethod(kind, key, params, body, computed, static) -``` - -See also `t.isClassMethod(node, opts)` and `t.assertClassMethod(node, opts)`. - -Aliases: `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method` - - - `kind`: `"get" | "set" | "method" | "constructor"` (default: `'method'`) - - `key`if computed then `Expression` else `Identifier | Literal` (required) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `computed`: `boolean` (default: `false`) - - `static`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `decorators` (default: `null`) - - `generator`: `boolean` (default: `false`) - - `returnType` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### classProperty -```javascript -t.classProperty(key, value, typeAnnotation, decorators, computed) -``` - -See also `t.isClassProperty(node, opts)` and `t.assertClassProperty(node, opts)`. - -Aliases: `Property` - - - `key` (required) - - `value` (required) - - `typeAnnotation` (required) - - `decorators` (required) - - `computed`: `boolean` (default: `false`) - ---- - -### conditionalExpression -```javascript -t.conditionalExpression(test, consequent, alternate) -``` - -See also `t.isConditionalExpression(node, opts)` and `t.assertConditionalExpression(node, opts)`. - -Aliases: `Expression`, `Conditional` - - - `test`: `Expression` (required) - - `consequent`: `Expression` (required) - - `alternate`: `Expression` (required) - ---- - -### continueStatement -```javascript -t.continueStatement(label) -``` - -See also `t.isContinueStatement(node, opts)` and `t.assertContinueStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `label`: `Identifier` (default: `null`) - ---- - -### debuggerStatement -```javascript -t.debuggerStatement() -``` - -See also `t.isDebuggerStatement(node, opts)` and `t.assertDebuggerStatement(node, opts)`. - -Aliases: `Statement` - - ---- - -### declareClass -```javascript -t.declareClass(id, typeParameters, extends, body) -``` - -See also `t.isDeclareClass(node, opts)` and `t.assertDeclareClass(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### declareFunction -```javascript -t.declareFunction(id) -``` - -See also `t.isDeclareFunction(node, opts)` and `t.assertDeclareFunction(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - ---- - -### declareInterface -```javascript -t.declareInterface(id, typeParameters, extends, body) -``` - -See also `t.isDeclareInterface(node, opts)` and `t.assertDeclareInterface(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### declareModule -```javascript -t.declareModule(id, body) -``` - -See also `t.isDeclareModule(node, opts)` and `t.assertDeclareModule(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `body` (required) - ---- - -### declareModuleExports -```javascript -t.declareModuleExports(typeAnnotation) -``` - -See also `t.isDeclareModuleExports(node, opts)` and `t.assertDeclareModuleExports(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `typeAnnotation` (required) - ---- - -### declareTypeAlias -```javascript -t.declareTypeAlias(id, typeParameters, right) -``` - -See also `t.isDeclareTypeAlias(node, opts)` and `t.assertDeclareTypeAlias(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `right` (required) - ---- - -### declareVariable -```javascript -t.declareVariable(id) -``` - -See also `t.isDeclareVariable(node, opts)` and `t.assertDeclareVariable(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - ---- - -### decorator -```javascript -t.decorator(expression) -``` - -See also `t.isDecorator(node, opts)` and `t.assertDecorator(node, opts)`. - - - `expression`: `Expression` (required) - ---- - -### directive -```javascript -t.directive(value) -``` - -See also `t.isDirective(node, opts)` and `t.assertDirective(node, opts)`. - - - `value`: `DirectiveLiteral` (required) - ---- - -### directiveLiteral -```javascript -t.directiveLiteral(value) -``` - -See also `t.isDirectiveLiteral(node, opts)` and `t.assertDirectiveLiteral(node, opts)`. - - - `value`: `string` (required) - ---- - -### doExpression -```javascript -t.doExpression(body) -``` - -See also `t.isDoExpression(node, opts)` and `t.assertDoExpression(node, opts)`. - -Aliases: `Expression` - - - `body`: `BlockStatement` (required) - ---- - -### doWhileStatement -```javascript -t.doWhileStatement(test, body) -``` - -See also `t.isDoWhileStatement(node, opts)` and `t.assertDoWhileStatement(node, opts)`. - -Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` - - - `test`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### emptyStatement -```javascript -t.emptyStatement() -``` - -See also `t.isEmptyStatement(node, opts)` and `t.assertEmptyStatement(node, opts)`. - -Aliases: `Statement` - - ---- - -### emptyTypeAnnotation -```javascript -t.emptyTypeAnnotation() -``` - -See also `t.isEmptyTypeAnnotation(node, opts)` and `t.assertEmptyTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### existentialTypeParam -```javascript -t.existentialTypeParam() -``` - -See also `t.isExistentialTypeParam(node, opts)` and `t.assertExistentialTypeParam(node, opts)`. - -Aliases: `Flow` - - ---- - -### exportAllDeclaration -```javascript -t.exportAllDeclaration(source) -``` - -See also `t.isExportAllDeclaration(node, opts)` and `t.assertExportAllDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `source`: `StringLiteral` (required) - ---- - -### exportDefaultDeclaration -```javascript -t.exportDefaultDeclaration(declaration) -``` - -See also `t.isExportDefaultDeclaration(node, opts)` and `t.assertExportDefaultDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `declaration`: `FunctionDeclaration | ClassDeclaration | Expression` (required) - ---- - -### exportDefaultSpecifier -```javascript -t.exportDefaultSpecifier(exported) -``` - -See also `t.isExportDefaultSpecifier(node, opts)` and `t.assertExportDefaultSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `exported`: `Identifier` (required) - ---- - -### exportNamedDeclaration -```javascript -t.exportNamedDeclaration(declaration, specifiers, source) -``` - -See also `t.isExportNamedDeclaration(node, opts)` and `t.assertExportNamedDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration`, `ExportDeclaration` - - - `declaration`: `Declaration` (default: `null`) - - `specifiers`: `Array` (required) - - `source`: `StringLiteral` (default: `null`) - ---- - -### exportNamespaceSpecifier -```javascript -t.exportNamespaceSpecifier(exported) -``` - -See also `t.isExportNamespaceSpecifier(node, opts)` and `t.assertExportNamespaceSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `exported`: `Identifier` (required) - ---- - -### exportSpecifier -```javascript -t.exportSpecifier(local, exported) -``` - -See also `t.isExportSpecifier(node, opts)` and `t.assertExportSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - - `exported`: `Identifier` (required) - ---- - -### expressionStatement -```javascript -t.expressionStatement(expression) -``` - -See also `t.isExpressionStatement(node, opts)` and `t.assertExpressionStatement(node, opts)`. - -Aliases: `Statement`, `ExpressionWrapper` - - - `expression`: `Expression` (required) - ---- - -### file -```javascript -t.file(program, comments, tokens) -``` - -See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`. - - - `program`: `Program` (required) - - `comments` (required) - - `tokens` (required) - ---- - -### forAwaitStatement -```javascript -t.forAwaitStatement(left, right, body) -``` - -See also `t.isForAwaitStatement(node, opts)` and `t.assertForAwaitStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### forInStatement -```javascript -t.forInStatement(left, right, body) -``` - -See also `t.isForInStatement(node, opts)` and `t.assertForInStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### forOfStatement -```javascript -t.forOfStatement(left, right, body) -``` - -See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - ---- - -### forStatement -```javascript -t.forStatement(init, test, update, body) -``` - -See also `t.isForStatement(node, opts)` and `t.assertForStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop` - - - `init`: `VariableDeclaration | Expression` (default: `null`) - - `test`: `Expression` (default: `null`) - - `update`: `Expression` (default: `null`) - - `body`: `Statement` (required) - ---- - -### functionDeclaration -```javascript -t.functionDeclaration(id, params, body, generator, async) -``` - -See also `t.isFunctionDeclaration(node, opts)` and `t.assertFunctionDeclaration(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Statement`, `Pureish`, `Declaration` - - - `id`: `Identifier` (required) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `generator`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `returnType` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### functionExpression -```javascript -t.functionExpression(id, params, body, generator, async) -``` - -See also `t.isFunctionExpression(node, opts)` and `t.assertFunctionExpression(node, opts)`. - -Aliases: `Scopable`, `Function`, `BlockParent`, `FunctionParent`, `Expression`, `Pureish` - - - `id`: `Identifier` (default: `null`) - - `params`: `Array` (required) - - `body`: `BlockStatement` (required) - - `generator`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `returnType` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### functionTypeAnnotation -```javascript -t.functionTypeAnnotation(typeParameters, params, rest, returnType) -``` - -See also `t.isFunctionTypeAnnotation(node, opts)` and `t.assertFunctionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeParameters` (required) - - `params` (required) - - `rest` (required) - - `returnType` (required) - ---- - -### functionTypeParam -```javascript -t.functionTypeParam(name, typeAnnotation) -``` - -See also `t.isFunctionTypeParam(node, opts)` and `t.assertFunctionTypeParam(node, opts)`. - -Aliases: `Flow` - - - `name` (required) - - `typeAnnotation` (required) - ---- - -### genericTypeAnnotation -```javascript -t.genericTypeAnnotation(id, typeParameters) -``` - -See also `t.isGenericTypeAnnotation(node, opts)` and `t.assertGenericTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### identifier -```javascript -t.identifier(name) -``` - -See also `t.isIdentifier(node, opts)` and `t.assertIdentifier(node, opts)`. - -Aliases: `Expression`, `LVal` - - - `name``string` (required) - - `decorators`: `Array` (default: `null`) - - `typeAnnotation` (default: `null`) - ---- - -### ifStatement -```javascript -t.ifStatement(test, consequent, alternate) -``` - -See also `t.isIfStatement(node, opts)` and `t.assertIfStatement(node, opts)`. - -Aliases: `Statement`, `Conditional` - - - `test`: `Expression` (required) - - `consequent`: `Statement` (required) - - `alternate`: `Statement` (default: `null`) - ---- - -### import -```javascript -t.import() -``` - -See also `t.isImport(node, opts)` and `t.assertImport(node, opts)`. - -Aliases: `Expression` - - ---- - -### importDeclaration -```javascript -t.importDeclaration(specifiers, source) -``` - -See also `t.isImportDeclaration(node, opts)` and `t.assertImportDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration`, `ModuleDeclaration` - - - `specifiers`: `Array` (required) - - `source`: `StringLiteral` (required) - ---- - -### importDefaultSpecifier -```javascript -t.importDefaultSpecifier(local) -``` - -See also `t.isImportDefaultSpecifier(node, opts)` and `t.assertImportDefaultSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - ---- - -### importNamespaceSpecifier -```javascript -t.importNamespaceSpecifier(local) -``` - -See also `t.isImportNamespaceSpecifier(node, opts)` and `t.assertImportNamespaceSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - ---- - -### importSpecifier -```javascript -t.importSpecifier(local, imported) -``` - -See also `t.isImportSpecifier(node, opts)` and `t.assertImportSpecifier(node, opts)`. - -Aliases: `ModuleSpecifier` - - - `local`: `Identifier` (required) - - `imported`: `Identifier` (required) - ---- - -### interfaceDeclaration -```javascript -t.interfaceDeclaration(id, typeParameters, extends, body) -``` - -See also `t.isInterfaceDeclaration(node, opts)` and `t.assertInterfaceDeclaration(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `extends` (required) - - `body` (required) - ---- - -### interfaceExtends -```javascript -t.interfaceExtends(id, typeParameters) -``` - -See also `t.isInterfaceExtends(node, opts)` and `t.assertInterfaceExtends(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `typeParameters` (required) - ---- - -### intersectionTypeAnnotation -```javascript -t.intersectionTypeAnnotation(types) -``` - -See also `t.isIntersectionTypeAnnotation(node, opts)` and `t.assertIntersectionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### jSXAttribute -```javascript -t.jSXAttribute(name, value) -``` - -See also `t.isJSXAttribute(node, opts)` and `t.assertJSXAttribute(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXNamespacedName` (required) - - `value`: `JSXElement | StringLiteral | JSXExpressionContainer` (default: `null`) - ---- - -### jSXClosingElement -```javascript -t.jSXClosingElement(name) -``` - -See also `t.isJSXClosingElement(node, opts)` and `t.assertJSXClosingElement(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXMemberExpression` (required) - ---- - -### jSXElement -```javascript -t.jSXElement(openingElement, closingElement, children, selfClosing) -``` - -See also `t.isJSXElement(node, opts)` and `t.assertJSXElement(node, opts)`. - -Aliases: `JSX`, `Immutable`, `Expression` - - - `openingElement`: `JSXOpeningElement` (required) - - `closingElement`: `JSXClosingElement` (default: `null`) - - `children`: `Array` (required) - - `selfClosing` (required) - ---- - -### jSXEmptyExpression -```javascript -t.jSXEmptyExpression() -``` - -See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`. - -Aliases: `JSX`, `Expression` - - ---- - -### jSXExpressionContainer -```javascript -t.jSXExpressionContainer(expression) -``` - -See also `t.isJSXExpressionContainer(node, opts)` and `t.assertJSXExpressionContainer(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `expression`: `Expression` (required) - ---- - -### jSXIdentifier -```javascript -t.jSXIdentifier(name) -``` - -See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`. - -Aliases: `JSX`, `Expression` - - - `name`: `string` (required) - ---- - -### jSXMemberExpression -```javascript -t.jSXMemberExpression(object, property) -``` - -See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`. - -Aliases: `JSX`, `Expression` - - - `object`: `JSXMemberExpression | JSXIdentifier` (required) - - `property`: `JSXIdentifier` (required) - ---- - -### jSXNamespacedName -```javascript -t.jSXNamespacedName(namespace, name) -``` - -See also `t.isJSXNamespacedName(node, opts)` and `t.assertJSXNamespacedName(node, opts)`. - -Aliases: `JSX` - - - `namespace`: `JSXIdentifier` (required) - - `name`: `JSXIdentifier` (required) - ---- - -### jSXOpeningElement -```javascript -t.jSXOpeningElement(name, attributes, selfClosing) -``` - -See also `t.isJSXOpeningElement(node, opts)` and `t.assertJSXOpeningElement(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `name`: `JSXIdentifier | JSXMemberExpression` (required) - - `attributes`: `Array` (required) - - `selfClosing`: `boolean` (default: `false`) - ---- - -### jSXSpreadAttribute -```javascript -t.jSXSpreadAttribute(argument) -``` - -See also `t.isJSXSpreadAttribute(node, opts)` and `t.assertJSXSpreadAttribute(node, opts)`. - -Aliases: `JSX` - - - `argument`: `Expression` (required) - ---- - -### jSXSpreadChild -```javascript -t.jSXSpreadChild(expression) -``` - -See also `t.isJSXSpreadChild(node, opts)` and `t.assertJSXSpreadChild(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `expression`: `Expression` (required) - ---- - -### jSXText -```javascript -t.jSXText(value) -``` - -See also `t.isJSXText(node, opts)` and `t.assertJSXText(node, opts)`. - -Aliases: `JSX`, `Immutable` - - - `value`: `string` (required) - ---- - -### labeledStatement -```javascript -t.labeledStatement(label, body) -``` - -See also `t.isLabeledStatement(node, opts)` and `t.assertLabeledStatement(node, opts)`. - -Aliases: `Statement` - - - `label`: `Identifier` (required) - - `body`: `Statement` (required) - ---- - -### logicalExpression -```javascript -t.logicalExpression(operator, left, right) -``` - -See also `t.isLogicalExpression(node, opts)` and `t.assertLogicalExpression(node, opts)`. - -Aliases: `Binary`, `Expression` - - - `operator`: `'||' | '&&'` (required) - - `left`: `Expression` (required) - - `right`: `Expression` (required) - ---- - -### memberExpression -```javascript -t.memberExpression(object, property, computed) -``` - -See also `t.isMemberExpression(node, opts)` and `t.assertMemberExpression(node, opts)`. - -Aliases: `Expression`, `LVal` - - - `object`: `Expression` (required) - - `property`if computed then `Expression` else `Identifier` (required) - - `computed`: `boolean` (default: `false`) - ---- - -### metaProperty -```javascript -t.metaProperty(meta, property) -``` - -See also `t.isMetaProperty(node, opts)` and `t.assertMetaProperty(node, opts)`. - -Aliases: `Expression` - - - `meta`: `string` (required) - - `property`: `string` (required) - ---- - -### mixedTypeAnnotation -```javascript -t.mixedTypeAnnotation() -``` - -See also `t.isMixedTypeAnnotation(node, opts)` and `t.assertMixedTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### newExpression -```javascript -t.newExpression(callee, arguments) -``` - -See also `t.isNewExpression(node, opts)` and `t.assertNewExpression(node, opts)`. - -Aliases: `Expression` - - - `callee`: `Expression` (required) - - `arguments`: `Array` (required) - ---- - -### noop -```javascript -t.noop() -``` - -See also `t.isNoop(node, opts)` and `t.assertNoop(node, opts)`. - - ---- - -### nullLiteral -```javascript -t.nullLiteral() -``` - -See also `t.isNullLiteral(node, opts)` and `t.assertNullLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - ---- - -### nullLiteralTypeAnnotation -```javascript -t.nullLiteralTypeAnnotation() -``` - -See also `t.isNullLiteralTypeAnnotation(node, opts)` and `t.assertNullLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### nullableTypeAnnotation -```javascript -t.nullableTypeAnnotation(typeAnnotation) -``` - -See also `t.isNullableTypeAnnotation(node, opts)` and `t.assertNullableTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeAnnotation` (required) - ---- - -### numberTypeAnnotation -```javascript -t.numberTypeAnnotation() -``` - -See also `t.isNumberTypeAnnotation(node, opts)` and `t.assertNumberTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### numericLiteral -```javascript -t.numericLiteral(value) -``` - -See also `t.isNumericLiteral(node, opts)` and `t.assertNumericLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `number` (required) - ---- - -### numericLiteralTypeAnnotation -```javascript -t.numericLiteralTypeAnnotation() -``` - -See also `t.isNumericLiteralTypeAnnotation(node, opts)` and `t.assertNumericLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### objectExpression -```javascript -t.objectExpression(properties) -``` - -See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, opts)`. - -Aliases: `Expression` - - - `properties`: `Array` (required) - ---- - -### objectMethod -```javascript -t.objectMethod(kind, key, params, body, computed) -``` - -See also `t.isObjectMethod(node, opts)` and `t.assertObjectMethod(node, opts)`. - -Aliases: `UserWhitespacable`, `Function`, `Scopable`, `BlockParent`, `FunctionParent`, `Method`, `ObjectMember` - - - `kind`: `"method" | "get" | "set"` (default: `'method'`) - - `key`if computed then `Expression` else `Identifier | Literal` (required) - - `params` (required) - - `body`: `BlockStatement` (required) - - `computed`: `boolean` (default: `false`) - - `async`: `boolean` (default: `false`) - - `decorators`: `Array` (default: `null`) - - `generator`: `boolean` (default: `false`) - - `returnType` (default: `null`) - - `typeParameters` (default: `null`) - ---- - -### objectPattern -```javascript -t.objectPattern(properties, typeAnnotation) -``` - -See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)`. - -Aliases: `Pattern`, `LVal` - - - `properties`: `Array` (required) - - `typeAnnotation` (required) - - `decorators`: `Array` (default: `null`) - ---- - -### objectProperty -```javascript -t.objectProperty(key, value, computed, shorthand, decorators) -``` - -See also `t.isObjectProperty(node, opts)` and `t.assertObjectProperty(node, opts)`. - -Aliases: `UserWhitespacable`, `Property`, `ObjectMember` - - - `key`if computed then `Expression` else `Identifier | Literal` (required) - - `value`: `Expression` (required) - - `computed`: `boolean` (default: `false`) - - `shorthand`: `boolean` (default: `false`) - - `decorators`: `Array` (default: `null`) - ---- - -### objectTypeAnnotation -```javascript -t.objectTypeAnnotation(properties, indexers, callProperties) -``` - -See also `t.isObjectTypeAnnotation(node, opts)` and `t.assertObjectTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `properties` (required) - - `indexers` (required) - - `callProperties` (required) - ---- - -### objectTypeCallProperty -```javascript -t.objectTypeCallProperty(value) -``` - -See also `t.isObjectTypeCallProperty(node, opts)` and `t.assertObjectTypeCallProperty(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `value` (required) - ---- - -### objectTypeIndexer -```javascript -t.objectTypeIndexer(id, key, value) -``` - -See also `t.isObjectTypeIndexer(node, opts)` and `t.assertObjectTypeIndexer(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `id` (required) - - `key` (required) - - `value` (required) - ---- - -### objectTypeProperty -```javascript -t.objectTypeProperty(key, value) -``` - -See also `t.isObjectTypeProperty(node, opts)` and `t.assertObjectTypeProperty(node, opts)`. - -Aliases: `Flow`, `UserWhitespacable` - - - `key` (required) - - `value` (required) - ---- - -### parenthesizedExpression -```javascript -t.parenthesizedExpression(expression) -``` - -See also `t.isParenthesizedExpression(node, opts)` and `t.assertParenthesizedExpression(node, opts)`. - -Aliases: `Expression`, `ExpressionWrapper` - - - `expression`: `Expression` (required) - ---- - -### program -```javascript -t.program(body, directives) -``` - -See also `t.isProgram(node, opts)` and `t.assertProgram(node, opts)`. - -Aliases: `Scopable`, `BlockParent`, `Block`, `FunctionParent` - - - `body`: `Array` (required) - - `directives`: `Array` (default: `[]`) - ---- - -### qualifiedTypeIdentifier -```javascript -t.qualifiedTypeIdentifier(id, qualification) -``` - -See also `t.isQualifiedTypeIdentifier(node, opts)` and `t.assertQualifiedTypeIdentifier(node, opts)`. - -Aliases: `Flow` - - - `id` (required) - - `qualification` (required) - ---- - -### regExpLiteral -```javascript -t.regExpLiteral(pattern, flags) -``` - -See also `t.isRegExpLiteral(node, opts)` and `t.assertRegExpLiteral(node, opts)`. - -Aliases: `Expression`, `Literal` - - - `pattern`: `string` (required) - - `flags`: `string` (default: `''`) - ---- - -### restElement -```javascript -t.restElement(argument, typeAnnotation) -``` - -See also `t.isRestElement(node, opts)` and `t.assertRestElement(node, opts)`. - -Aliases: `LVal` - - - `argument`: `LVal` (required) - - `typeAnnotation` (required) - - `decorators`: `Array` (default: `null`) - ---- - -### restProperty -```javascript -t.restProperty(argument) -``` - -See also `t.isRestProperty(node, opts)` and `t.assertRestProperty(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `LVal` (required) - ---- - -### returnStatement -```javascript -t.returnStatement(argument) -``` - -See also `t.isReturnStatement(node, opts)` and `t.assertReturnStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `argument`: `Expression` (default: `null`) - ---- - -### sequenceExpression -```javascript -t.sequenceExpression(expressions) -``` - -See also `t.isSequenceExpression(node, opts)` and `t.assertSequenceExpression(node, opts)`. - -Aliases: `Expression` - - - `expressions`: `Array` (required) - ---- - -### spreadElement -```javascript -t.spreadElement(argument) -``` - -See also `t.isSpreadElement(node, opts)` and `t.assertSpreadElement(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `Expression` (required) - ---- - -### spreadProperty -```javascript -t.spreadProperty(argument) -``` - -See also `t.isSpreadProperty(node, opts)` and `t.assertSpreadProperty(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `Expression` (required) - ---- - -### stringLiteral -```javascript -t.stringLiteral(value) -``` - -See also `t.isStringLiteral(node, opts)` and `t.assertStringLiteral(node, opts)`. - -Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - - - `value`: `string` (required) - ---- - -### stringLiteralTypeAnnotation -```javascript -t.stringLiteralTypeAnnotation() -``` - -See also `t.isStringLiteralTypeAnnotation(node, opts)` and `t.assertStringLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - ---- - -### stringTypeAnnotation -```javascript -t.stringTypeAnnotation() -``` - -See also `t.isStringTypeAnnotation(node, opts)` and `t.assertStringTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### super -```javascript -t.super() -``` - -See also `t.isSuper(node, opts)` and `t.assertSuper(node, opts)`. - -Aliases: `Expression` - - ---- - -### switchCase -```javascript -t.switchCase(test, consequent) -``` - -See also `t.isSwitchCase(node, opts)` and `t.assertSwitchCase(node, opts)`. - - - `test`: `Expression` (default: `null`) - - `consequent`: `Array` (required) - ---- - -### switchStatement -```javascript -t.switchStatement(discriminant, cases) -``` - -See also `t.isSwitchStatement(node, opts)` and `t.assertSwitchStatement(node, opts)`. - -Aliases: `Statement`, `BlockParent`, `Scopable` - - - `discriminant`: `Expression` (required) - - `cases`: `Array` (required) - ---- - -### taggedTemplateExpression -```javascript -t.taggedTemplateExpression(tag, quasi) -``` - -See also `t.isTaggedTemplateExpression(node, opts)` and `t.assertTaggedTemplateExpression(node, opts)`. - -Aliases: `Expression` - - - `tag`: `Expression` (required) - - `quasi`: `TemplateLiteral` (required) - ---- - -### templateElement -```javascript -t.templateElement(value, tail) -``` - -See also `t.isTemplateElement(node, opts)` and `t.assertTemplateElement(node, opts)`. - - - `value` (required) - - `tail`: `boolean` (default: `false`) - ---- - -### templateLiteral -```javascript -t.templateLiteral(quasis, expressions) -``` - -See also `t.isTemplateLiteral(node, opts)` and `t.assertTemplateLiteral(node, opts)`. - -Aliases: `Expression`, `Literal` - - - `quasis`: `Array` (required) - - `expressions`: `Array` (required) - ---- - -### thisExpression -```javascript -t.thisExpression() -``` - -See also `t.isThisExpression(node, opts)` and `t.assertThisExpression(node, opts)`. - -Aliases: `Expression` - - ---- - -### thisTypeAnnotation -```javascript -t.thisTypeAnnotation() -``` - -See also `t.isThisTypeAnnotation(node, opts)` and `t.assertThisTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### throwStatement -```javascript -t.throwStatement(argument) -``` - -See also `t.isThrowStatement(node, opts)` and `t.assertThrowStatement(node, opts)`. - -Aliases: `Statement`, `Terminatorless`, `CompletionStatement` - - - `argument`: `Expression` (required) - ---- - -### tryStatement -```javascript -t.tryStatement(block, handler, finalizer) -``` - -See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`. - -Aliases: `Statement` - - - `block` (required) - - `handler` (default: `null`) - - `finalizer`: `BlockStatement` (default: `null`) - - `body`: `BlockStatement` (default: `null`) - ---- - -### tupleTypeAnnotation -```javascript -t.tupleTypeAnnotation(types) -``` - -See also `t.isTupleTypeAnnotation(node, opts)` and `t.assertTupleTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### typeAlias -```javascript -t.typeAlias(id, typeParameters, right) -``` - -See also `t.isTypeAlias(node, opts)` and `t.assertTypeAlias(node, opts)`. - -Aliases: `Flow`, `FlowDeclaration`, `Statement`, `Declaration` - - - `id` (required) - - `typeParameters` (required) - - `right` (required) - ---- - -### typeAnnotation -```javascript -t.typeAnnotation(typeAnnotation) -``` - -See also `t.isTypeAnnotation(node, opts)` and `t.assertTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `typeAnnotation` (required) - ---- - -### typeCastExpression -```javascript -t.typeCastExpression(expression, typeAnnotation) -``` - -See also `t.isTypeCastExpression(node, opts)` and `t.assertTypeCastExpression(node, opts)`. - -Aliases: `Flow`, `ExpressionWrapper`, `Expression` - - - `expression` (required) - - `typeAnnotation` (required) - ---- - -### typeParameter -```javascript -t.typeParameter(bound) -``` - -See also `t.isTypeParameter(node, opts)` and `t.assertTypeParameter(node, opts)`. - -Aliases: `Flow` - - - `bound` (required) - ---- - -### typeParameterDeclaration -```javascript -t.typeParameterDeclaration(params) -``` - -See also `t.isTypeParameterDeclaration(node, opts)` and `t.assertTypeParameterDeclaration(node, opts)`. - -Aliases: `Flow` - - - `params` (required) - ---- - -### typeParameterInstantiation -```javascript -t.typeParameterInstantiation(params) -``` - -See also `t.isTypeParameterInstantiation(node, opts)` and `t.assertTypeParameterInstantiation(node, opts)`. - -Aliases: `Flow` - - - `params` (required) - ---- - -### typeofTypeAnnotation -```javascript -t.typeofTypeAnnotation(argument) -``` - -See also `t.isTypeofTypeAnnotation(node, opts)` and `t.assertTypeofTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `argument` (required) - ---- - -### unaryExpression -```javascript -t.unaryExpression(operator, argument, prefix) -``` - -See also `t.isUnaryExpression(node, opts)` and `t.assertUnaryExpression(node, opts)`. - -Aliases: `UnaryLike`, `Expression` - - - `operator`: `'void' | 'delete' | '!' | '+' | '-' | '++' | '--' | '~' | 'typeof'` (required) - - `argument`: `Expression` (required) - - `prefix`: `boolean` (default: `true`) - ---- - -### unionTypeAnnotation -```javascript -t.unionTypeAnnotation(types) -``` - -See also `t.isUnionTypeAnnotation(node, opts)` and `t.assertUnionTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - - `types` (required) - ---- - -### updateExpression -```javascript -t.updateExpression(operator, argument, prefix) -``` - -See also `t.isUpdateExpression(node, opts)` and `t.assertUpdateExpression(node, opts)`. - -Aliases: `Expression` - - - `operator`: `'++' | '--'` (required) - - `argument`: `Expression` (required) - - `prefix`: `boolean` (default: `false`) - ---- - -### variableDeclaration -```javascript -t.variableDeclaration(kind, declarations) -``` - -See also `t.isVariableDeclaration(node, opts)` and `t.assertVariableDeclaration(node, opts)`. - -Aliases: `Statement`, `Declaration` - - - `kind`: `"var" | "let" | "const"` (required) - - `declarations`: `Array` (required) - ---- - -### variableDeclarator -```javascript -t.variableDeclarator(id, init) -``` - -See also `t.isVariableDeclarator(node, opts)` and `t.assertVariableDeclarator(node, opts)`. - - - `id`: `LVal` (required) - - `init`: `Expression` (default: `null`) - ---- - -### voidTypeAnnotation -```javascript -t.voidTypeAnnotation() -``` - -See also `t.isVoidTypeAnnotation(node, opts)` and `t.assertVoidTypeAnnotation(node, opts)`. - -Aliases: `Flow`, `FlowBaseAnnotation` - - ---- - -### whileStatement -```javascript -t.whileStatement(test, body) -``` - -See also `t.isWhileStatement(node, opts)` and `t.assertWhileStatement(node, opts)`. - -Aliases: `Statement`, `BlockParent`, `Loop`, `While`, `Scopable` - - - `test`: `Expression` (required) - - `body`: `BlockStatement | Statement` (required) - ---- - -### withStatement -```javascript -t.withStatement(object, body) -``` - -See also `t.isWithStatement(node, opts)` and `t.assertWithStatement(node, opts)`. - -Aliases: `Statement` - - - `object` (required) - - `body`: `BlockStatement | Statement` (required) - ---- - -### yieldExpression -```javascript -t.yieldExpression(argument, delegate) -``` - -See also `t.isYieldExpression(node, opts)` and `t.assertYieldExpression(node, opts)`. - -Aliases: `Expression`, `Terminatorless` - - - `argument`: `Expression` (default: `null`) - - `delegate`: `boolean` (default: `false`) - ---- - - - - diff --git a/node_modules/babel-types/lib/constants.js b/node_modules/babel-types/lib/constants.js deleted file mode 100644 index ba15090..0000000 --- a/node_modules/babel-types/lib/constants.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; - -var _for = require("babel-runtime/core-js/symbol/for"); - -var _for2 = _interopRequireDefault(_for); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; -var FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"]; -var FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"]; -var COMMENT_KEYS = exports.COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; - -var LOGICAL_OPERATORS = exports.LOGICAL_OPERATORS = ["||", "&&"]; -var UPDATE_OPERATORS = exports.UPDATE_OPERATORS = ["++", "--"]; - -var BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; -var EQUALITY_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; -var COMPARISON_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]); -var BOOLEAN_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS); -var NUMBER_BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; -var BINARY_OPERATORS = exports.BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS); - -var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; -var NUMBER_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; -var STRING_UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = ["typeof"]; -var UNARY_OPERATORS = exports.UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS); - -var INHERIT_KEYS = exports.INHERIT_KEYS = { - optional: ["typeAnnotation", "typeParameters", "returnType"], - force: ["start", "loc", "end"] -}; - -var BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = (0, _for2.default)("var used to be block scoped"); -var NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = (0, _for2.default)("should not be considered a local binding"); \ No newline at end of file diff --git a/node_modules/babel-types/lib/converters.js b/node_modules/babel-types/lib/converters.js deleted file mode 100644 index bcf3942..0000000 --- a/node_modules/babel-types/lib/converters.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; - -exports.__esModule = true; - -var _maxSafeInteger = require("babel-runtime/core-js/number/max-safe-integer"); - -var _maxSafeInteger2 = _interopRequireDefault(_maxSafeInteger); - -var _stringify = require("babel-runtime/core-js/json/stringify"); - -var _stringify2 = _interopRequireDefault(_stringify); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -exports.toComputedKey = toComputedKey; -exports.toSequenceExpression = toSequenceExpression; -exports.toKeyAlias = toKeyAlias; -exports.toIdentifier = toIdentifier; -exports.toBindingIdentifierName = toBindingIdentifierName; -exports.toStatement = toStatement; -exports.toExpression = toExpression; -exports.toBlock = toBlock; -exports.valueToNode = valueToNode; - -var _isPlainObject = require("lodash/isPlainObject"); - -var _isPlainObject2 = _interopRequireDefault(_isPlainObject); - -var _isNumber = require("lodash/isNumber"); - -var _isNumber2 = _interopRequireDefault(_isNumber); - -var _isRegExp = require("lodash/isRegExp"); - -var _isRegExp2 = _interopRequireDefault(_isRegExp); - -var _isString = require("lodash/isString"); - -var _isString2 = _interopRequireDefault(_isString); - -var _index = require("./index"); - -var t = _interopRequireWildcard(_index); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function toComputedKey(node) { - var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key || node.property; - - if (!node.computed) { - if (t.isIdentifier(key)) key = t.stringLiteral(key.name); - } - return key; -} - -function toSequenceExpression(nodes, scope) { - if (!nodes || !nodes.length) return; - - var declars = []; - var bailed = false; - - var result = convert(nodes); - if (bailed) return; - - for (var i = 0; i < declars.length; i++) { - scope.push(declars[i]); - } - - return result; - - function convert(nodes) { - var ensureLastUndefined = false; - var exprs = []; - - for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var node = _ref; - - if (t.isExpression(node)) { - exprs.push(node); - } else if (t.isExpressionStatement(node)) { - exprs.push(node.expression); - } else if (t.isVariableDeclaration(node)) { - if (node.kind !== "var") return bailed = true; - - for (var _iterator2 = node.declarations, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var declar = _ref2; - - var bindings = t.getBindingIdentifiers(declar); - for (var key in bindings) { - declars.push({ - kind: node.kind, - id: bindings[key] - }); - } - - if (declar.init) { - exprs.push(t.assignmentExpression("=", declar.id, declar.init)); - } - } - - ensureLastUndefined = true; - continue; - } else if (t.isIfStatement(node)) { - var consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode(); - var alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode(); - if (!consequent || !alternate) return bailed = true; - - exprs.push(t.conditionalExpression(node.test, consequent, alternate)); - } else if (t.isBlockStatement(node)) { - exprs.push(convert(node.body)); - } else if (t.isEmptyStatement(node)) { - ensureLastUndefined = true; - continue; - } else { - return bailed = true; - } - - ensureLastUndefined = false; - } - - if (ensureLastUndefined || exprs.length === 0) { - exprs.push(scope.buildUndefinedNode()); - } - - if (exprs.length === 1) { - return exprs[0]; - } else { - return t.sequenceExpression(exprs); - } - } -} - -function toKeyAlias(node) { - var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key; - - var alias = void 0; - - if (node.kind === "method") { - return toKeyAlias.increment() + ""; - } else if (t.isIdentifier(key)) { - alias = key.name; - } else if (t.isStringLiteral(key)) { - alias = (0, _stringify2.default)(key.value); - } else { - alias = (0, _stringify2.default)(t.removePropertiesDeep(t.cloneDeep(key))); - } - - if (node.computed) { - alias = "[" + alias + "]"; - } - - if (node.static) { - alias = "static:" + alias; - } - - return alias; -} - -toKeyAlias.uid = 0; - -toKeyAlias.increment = function () { - if (toKeyAlias.uid >= _maxSafeInteger2.default) { - return toKeyAlias.uid = 0; - } else { - return toKeyAlias.uid++; - } -}; - -function toIdentifier(name) { - name = name + ""; - - name = name.replace(/[^a-zA-Z0-9$_]/g, "-"); - - name = name.replace(/^[-0-9]+/, ""); - - name = name.replace(/[-\s]+(.)?/g, function (match, c) { - return c ? c.toUpperCase() : ""; - }); - - if (!t.isValidIdentifier(name)) { - name = "_" + name; - } - - return name || "_"; -} - -function toBindingIdentifierName(name) { - name = toIdentifier(name); - if (name === "eval" || name === "arguments") name = "_" + name; - return name; -} - -function toStatement(node, ignore) { - if (t.isStatement(node)) { - return node; - } - - var mustHaveId = false; - var newType = void 0; - - if (t.isClass(node)) { - mustHaveId = true; - newType = "ClassDeclaration"; - } else if (t.isFunction(node)) { - mustHaveId = true; - newType = "FunctionDeclaration"; - } else if (t.isAssignmentExpression(node)) { - return t.expressionStatement(node); - } - - if (mustHaveId && !node.id) { - newType = false; - } - - if (!newType) { - if (ignore) { - return false; - } else { - throw new Error("cannot turn " + node.type + " to a statement"); - } - } - - node.type = newType; - - return node; -} - -function toExpression(node) { - if (t.isExpressionStatement(node)) { - node = node.expression; - } - - if (t.isExpression(node)) { - return node; - } - - if (t.isClass(node)) { - node.type = "ClassExpression"; - } else if (t.isFunction(node)) { - node.type = "FunctionExpression"; - } - - if (!t.isExpression(node)) { - throw new Error("cannot turn " + node.type + " to an expression"); - } - - return node; -} - -function toBlock(node, parent) { - if (t.isBlockStatement(node)) { - return node; - } - - if (t.isEmptyStatement(node)) { - node = []; - } - - if (!Array.isArray(node)) { - if (!t.isStatement(node)) { - if (t.isFunction(parent)) { - node = t.returnStatement(node); - } else { - node = t.expressionStatement(node); - } - } - - node = [node]; - } - - return t.blockStatement(node); -} - -function valueToNode(value) { - if (value === undefined) { - return t.identifier("undefined"); - } - - if (value === true || value === false) { - return t.booleanLiteral(value); - } - - if (value === null) { - return t.nullLiteral(); - } - - if ((0, _isString2.default)(value)) { - return t.stringLiteral(value); - } - - if ((0, _isNumber2.default)(value)) { - return t.numericLiteral(value); - } - - if ((0, _isRegExp2.default)(value)) { - var pattern = value.source; - var flags = value.toString().match(/\/([a-z]+|)$/)[1]; - return t.regExpLiteral(pattern, flags); - } - - if (Array.isArray(value)) { - return t.arrayExpression(value.map(t.valueToNode)); - } - - if ((0, _isPlainObject2.default)(value)) { - var props = []; - for (var key in value) { - var nodeKey = void 0; - if (t.isValidIdentifier(key)) { - nodeKey = t.identifier(key); - } else { - nodeKey = t.stringLiteral(key); - } - props.push(t.objectProperty(nodeKey, t.valueToNode(value[key]))); - } - return t.objectExpression(props); - } - - throw new Error("don't know how to turn this value into a node"); -} \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/core.js b/node_modules/babel-types/lib/definitions/core.js deleted file mode 100644 index 3b03262..0000000 --- a/node_modules/babel-types/lib/definitions/core.js +++ /dev/null @@ -1,701 +0,0 @@ -"use strict"; - -var _index = require("../index"); - -var t = _interopRequireWildcard(_index); - -var _constants = require("../constants"); - -var _index2 = require("./index"); - -var _index3 = _interopRequireDefault(_index2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -(0, _index3.default)("ArrayExpression", { - fields: { - elements: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeOrValueType)("null", "Expression", "SpreadElement"))), - default: [] - } - }, - visitor: ["elements"], - aliases: ["Expression"] -}); - -(0, _index3.default)("AssignmentExpression", { - fields: { - operator: { - validate: (0, _index2.assertValueType)("string") - }, - left: { - validate: (0, _index2.assertNodeType)("LVal") - }, - right: { - validate: (0, _index2.assertNodeType)("Expression") - } - }, - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Expression"] -}); - -(0, _index3.default)("BinaryExpression", { - builder: ["operator", "left", "right"], - fields: { - operator: { - validate: _index2.assertOneOf.apply(undefined, _constants.BINARY_OPERATORS) - }, - left: { - validate: (0, _index2.assertNodeType)("Expression") - }, - right: { - validate: (0, _index2.assertNodeType)("Expression") - } - }, - visitor: ["left", "right"], - aliases: ["Binary", "Expression"] -}); - -(0, _index3.default)("Directive", { - visitor: ["value"], - fields: { - value: { - validate: (0, _index2.assertNodeType)("DirectiveLiteral") - } - } -}); - -(0, _index3.default)("DirectiveLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _index2.assertValueType)("string") - } - } -}); - -(0, _index3.default)("BlockStatement", { - builder: ["body", "directives"], - visitor: ["directives", "body"], - fields: { - directives: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), - default: [] - }, - body: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) - } - }, - aliases: ["Scopable", "BlockParent", "Block", "Statement"] -}); - -(0, _index3.default)("BreakStatement", { - visitor: ["label"], - fields: { - label: { - validate: (0, _index2.assertNodeType)("Identifier"), - optional: true - } - }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -(0, _index3.default)("CallExpression", { - visitor: ["callee", "arguments"], - fields: { - callee: { - validate: (0, _index2.assertNodeType)("Expression") - }, - arguments: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) - } - }, - aliases: ["Expression"] -}); - -(0, _index3.default)("CatchClause", { - visitor: ["param", "body"], - fields: { - param: { - validate: (0, _index2.assertNodeType)("Identifier") - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement") - } - }, - aliases: ["Scopable"] -}); - -(0, _index3.default)("ConditionalExpression", { - visitor: ["test", "consequent", "alternate"], - fields: { - test: { - validate: (0, _index2.assertNodeType)("Expression") - }, - consequent: { - validate: (0, _index2.assertNodeType)("Expression") - }, - alternate: { - validate: (0, _index2.assertNodeType)("Expression") - } - }, - aliases: ["Expression", "Conditional"] -}); - -(0, _index3.default)("ContinueStatement", { - visitor: ["label"], - fields: { - label: { - validate: (0, _index2.assertNodeType)("Identifier"), - optional: true - } - }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] -}); - -(0, _index3.default)("DebuggerStatement", { - aliases: ["Statement"] -}); - -(0, _index3.default)("DoWhileStatement", { - visitor: ["test", "body"], - fields: { - test: { - validate: (0, _index2.assertNodeType)("Expression") - }, - body: { - validate: (0, _index2.assertNodeType)("Statement") - } - }, - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] -}); - -(0, _index3.default)("EmptyStatement", { - aliases: ["Statement"] -}); - -(0, _index3.default)("ExpressionStatement", { - visitor: ["expression"], - fields: { - expression: { - validate: (0, _index2.assertNodeType)("Expression") - } - }, - aliases: ["Statement", "ExpressionWrapper"] -}); - -(0, _index3.default)("File", { - builder: ["program", "comments", "tokens"], - visitor: ["program"], - fields: { - program: { - validate: (0, _index2.assertNodeType)("Program") - } - } -}); - -(0, _index3.default)("ForInStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: (0, _index2.assertNodeType)("VariableDeclaration", "LVal") - }, - right: { - validate: (0, _index2.assertNodeType)("Expression") - }, - body: { - validate: (0, _index2.assertNodeType)("Statement") - } - } -}); - -(0, _index3.default)("ForStatement", { - visitor: ["init", "test", "update", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], - fields: { - init: { - validate: (0, _index2.assertNodeType)("VariableDeclaration", "Expression"), - optional: true - }, - test: { - validate: (0, _index2.assertNodeType)("Expression"), - optional: true - }, - update: { - validate: (0, _index2.assertNodeType)("Expression"), - optional: true - }, - body: { - validate: (0, _index2.assertNodeType)("Statement") - } - } -}); - -(0, _index3.default)("FunctionDeclaration", { - builder: ["id", "params", "body", "generator", "async"], - visitor: ["id", "params", "body", "returnType", "typeParameters"], - fields: { - id: { - validate: (0, _index2.assertNodeType)("Identifier") - }, - params: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement") - }, - generator: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - }, - async: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - } - }, - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"] -}); - -(0, _index3.default)("FunctionExpression", { - inherits: "FunctionDeclaration", - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], - fields: { - id: { - validate: (0, _index2.assertNodeType)("Identifier"), - optional: true - }, - params: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal"))) - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement") - }, - generator: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - }, - async: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - } - } -}); - -(0, _index3.default)("Identifier", { - builder: ["name"], - visitor: ["typeAnnotation"], - aliases: ["Expression", "LVal"], - fields: { - name: { - validate: function validate(node, key, val) { - if (!t.isValidIdentifier(val)) {} - } - }, - decorators: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index3.default)("IfStatement", { - visitor: ["test", "consequent", "alternate"], - aliases: ["Statement", "Conditional"], - fields: { - test: { - validate: (0, _index2.assertNodeType)("Expression") - }, - consequent: { - validate: (0, _index2.assertNodeType)("Statement") - }, - alternate: { - optional: true, - validate: (0, _index2.assertNodeType)("Statement") - } - } -}); - -(0, _index3.default)("LabeledStatement", { - visitor: ["label", "body"], - aliases: ["Statement"], - fields: { - label: { - validate: (0, _index2.assertNodeType)("Identifier") - }, - body: { - validate: (0, _index2.assertNodeType)("Statement") - } - } -}); - -(0, _index3.default)("StringLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _index2.assertValueType)("string") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); - -(0, _index3.default)("NumericLiteral", { - builder: ["value"], - deprecatedAlias: "NumberLiteral", - fields: { - value: { - validate: (0, _index2.assertValueType)("number") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); - -(0, _index3.default)("NullLiteral", { - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); - -(0, _index3.default)("BooleanLiteral", { - builder: ["value"], - fields: { - value: { - validate: (0, _index2.assertValueType)("boolean") - } - }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] -}); - -(0, _index3.default)("RegExpLiteral", { - builder: ["pattern", "flags"], - deprecatedAlias: "RegexLiteral", - aliases: ["Expression", "Literal"], - fields: { - pattern: { - validate: (0, _index2.assertValueType)("string") - }, - flags: { - validate: (0, _index2.assertValueType)("string"), - default: "" - } - } -}); - -(0, _index3.default)("LogicalExpression", { - builder: ["operator", "left", "right"], - visitor: ["left", "right"], - aliases: ["Binary", "Expression"], - fields: { - operator: { - validate: _index2.assertOneOf.apply(undefined, _constants.LOGICAL_OPERATORS) - }, - left: { - validate: (0, _index2.assertNodeType)("Expression") - }, - right: { - validate: (0, _index2.assertNodeType)("Expression") - } - } -}); - -(0, _index3.default)("MemberExpression", { - builder: ["object", "property", "computed"], - visitor: ["object", "property"], - aliases: ["Expression", "LVal"], - fields: { - object: { - validate: (0, _index2.assertNodeType)("Expression") - }, - property: { - validate: function validate(node, key, val) { - var expectedType = node.computed ? "Expression" : "Identifier"; - (0, _index2.assertNodeType)(expectedType)(node, key, val); - } - }, - computed: { - default: false - } - } -}); - -(0, _index3.default)("NewExpression", { - visitor: ["callee", "arguments"], - aliases: ["Expression"], - fields: { - callee: { - validate: (0, _index2.assertNodeType)("Expression") - }, - arguments: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement"))) - } - } -}); - -(0, _index3.default)("Program", { - visitor: ["directives", "body"], - builder: ["body", "directives"], - fields: { - directives: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))), - default: [] - }, - body: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) - } - }, - aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"] -}); - -(0, _index3.default)("ObjectExpression", { - visitor: ["properties"], - aliases: ["Expression"], - fields: { - properties: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadProperty"))) - } - } -}); - -(0, _index3.default)("ObjectMethod", { - builder: ["kind", "key", "params", "body", "computed"], - fields: { - kind: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")), - default: "method" - }, - computed: { - validate: (0, _index2.assertValueType)("boolean"), - default: false - }, - key: { - validate: function validate(node, key, val) { - var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; - _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); - } - }, - decorators: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement") - }, - generator: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - }, - async: { - default: false, - validate: (0, _index2.assertValueType)("boolean") - } - }, - visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], - aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] -}); - -(0, _index3.default)("ObjectProperty", { - builder: ["key", "value", "computed", "shorthand", "decorators"], - fields: { - computed: { - validate: (0, _index2.assertValueType)("boolean"), - default: false - }, - key: { - validate: function validate(node, key, val) { - var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; - _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val); - } - }, - value: { - validate: (0, _index2.assertNodeType)("Expression") - }, - shorthand: { - validate: (0, _index2.assertValueType)("boolean"), - default: false - }, - decorators: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))), - optional: true - } - }, - visitor: ["key", "value", "decorators"], - aliases: ["UserWhitespacable", "Property", "ObjectMember"] -}); - -(0, _index3.default)("RestElement", { - visitor: ["argument", "typeAnnotation"], - aliases: ["LVal"], - fields: { - argument: { - validate: (0, _index2.assertNodeType)("LVal") - }, - decorators: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index3.default)("ReturnStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"], - fields: { - argument: { - validate: (0, _index2.assertNodeType)("Expression"), - optional: true - } - } -}); - -(0, _index3.default)("SequenceExpression", { - visitor: ["expressions"], - fields: { - expressions: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression"))) - } - }, - aliases: ["Expression"] -}); - -(0, _index3.default)("SwitchCase", { - visitor: ["test", "consequent"], - fields: { - test: { - validate: (0, _index2.assertNodeType)("Expression"), - optional: true - }, - consequent: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement"))) - } - } -}); - -(0, _index3.default)("SwitchStatement", { - visitor: ["discriminant", "cases"], - aliases: ["Statement", "BlockParent", "Scopable"], - fields: { - discriminant: { - validate: (0, _index2.assertNodeType)("Expression") - }, - cases: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("SwitchCase"))) - } - } -}); - -(0, _index3.default)("ThisExpression", { - aliases: ["Expression"] -}); - -(0, _index3.default)("ThrowStatement", { - visitor: ["argument"], - aliases: ["Statement", "Terminatorless", "CompletionStatement"], - fields: { - argument: { - validate: (0, _index2.assertNodeType)("Expression") - } - } -}); - -(0, _index3.default)("TryStatement", { - visitor: ["block", "handler", "finalizer"], - aliases: ["Statement"], - fields: { - body: { - validate: (0, _index2.assertNodeType)("BlockStatement") - }, - handler: { - optional: true, - handler: (0, _index2.assertNodeType)("BlockStatement") - }, - finalizer: { - optional: true, - validate: (0, _index2.assertNodeType)("BlockStatement") - } - } -}); - -(0, _index3.default)("UnaryExpression", { - builder: ["operator", "argument", "prefix"], - fields: { - prefix: { - default: true - }, - argument: { - validate: (0, _index2.assertNodeType)("Expression") - }, - operator: { - validate: _index2.assertOneOf.apply(undefined, _constants.UNARY_OPERATORS) - } - }, - visitor: ["argument"], - aliases: ["UnaryLike", "Expression"] -}); - -(0, _index3.default)("UpdateExpression", { - builder: ["operator", "argument", "prefix"], - fields: { - prefix: { - default: false - }, - argument: { - validate: (0, _index2.assertNodeType)("Expression") - }, - operator: { - validate: _index2.assertOneOf.apply(undefined, _constants.UPDATE_OPERATORS) - } - }, - visitor: ["argument"], - aliases: ["Expression"] -}); - -(0, _index3.default)("VariableDeclaration", { - builder: ["kind", "declarations"], - visitor: ["declarations"], - aliases: ["Statement", "Declaration"], - fields: { - kind: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("var", "let", "const")) - }, - declarations: { - validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("VariableDeclarator"))) - } - } -}); - -(0, _index3.default)("VariableDeclarator", { - visitor: ["id", "init"], - fields: { - id: { - validate: (0, _index2.assertNodeType)("LVal") - }, - init: { - optional: true, - validate: (0, _index2.assertNodeType)("Expression") - } - } -}); - -(0, _index3.default)("WhileStatement", { - visitor: ["test", "body"], - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], - fields: { - test: { - validate: (0, _index2.assertNodeType)("Expression") - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") - } - } -}); - -(0, _index3.default)("WithStatement", { - visitor: ["object", "body"], - aliases: ["Statement"], - fields: { - object: { - object: (0, _index2.assertNodeType)("Expression") - }, - body: { - validate: (0, _index2.assertNodeType)("BlockStatement", "Statement") - } - } -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/es2015.js b/node_modules/babel-types/lib/definitions/es2015.js deleted file mode 100644 index cbce553..0000000 --- a/node_modules/babel-types/lib/definitions/es2015.js +++ /dev/null @@ -1,351 +0,0 @@ -"use strict"; - -var _index = require("./index"); - -var _index2 = _interopRequireDefault(_index); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _index2.default)("AssignmentPattern", { - visitor: ["left", "right"], - aliases: ["Pattern", "LVal"], - fields: { - left: { - validate: (0, _index.assertNodeType)("Identifier") - }, - right: { - validate: (0, _index.assertNodeType)("Expression") - }, - decorators: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index2.default)("ArrayPattern", { - visitor: ["elements", "typeAnnotation"], - aliases: ["Pattern", "LVal"], - fields: { - elements: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression"))) - }, - decorators: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index2.default)("ArrowFunctionExpression", { - builder: ["params", "body", "async"], - visitor: ["params", "body", "returnType", "typeParameters"], - aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], - fields: { - params: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) - }, - body: { - validate: (0, _index.assertNodeType)("BlockStatement", "Expression") - }, - async: { - validate: (0, _index.assertValueType)("boolean"), - default: false - } - } -}); - -(0, _index2.default)("ClassBody", { - visitor: ["body"], - fields: { - body: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty"))) - } - } -}); - -(0, _index2.default)("ClassDeclaration", { - builder: ["id", "superClass", "body", "decorators"], - visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"], - aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], - fields: { - id: { - validate: (0, _index.assertNodeType)("Identifier") - }, - body: { - validate: (0, _index.assertNodeType)("ClassBody") - }, - superClass: { - optional: true, - validate: (0, _index.assertNodeType)("Expression") - }, - decorators: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index2.default)("ClassExpression", { - inherits: "ClassDeclaration", - aliases: ["Scopable", "Class", "Expression", "Pureish"], - fields: { - id: { - optional: true, - validate: (0, _index.assertNodeType)("Identifier") - }, - body: { - validate: (0, _index.assertNodeType)("ClassBody") - }, - superClass: { - optional: true, - validate: (0, _index.assertNodeType)("Expression") - }, - decorators: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index2.default)("ExportAllDeclaration", { - visitor: ["source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - source: { - validate: (0, _index.assertNodeType)("StringLiteral") - } - } -}); - -(0, _index2.default)("ExportDefaultDeclaration", { - visitor: ["declaration"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - declaration: { - validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression") - } - } -}); - -(0, _index2.default)("ExportNamedDeclaration", { - visitor: ["declaration", "specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], - fields: { - declaration: { - validate: (0, _index.assertNodeType)("Declaration"), - optional: true - }, - specifiers: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier"))) - }, - source: { - validate: (0, _index.assertNodeType)("StringLiteral"), - optional: true - } - } -}); - -(0, _index2.default)("ExportSpecifier", { - visitor: ["local", "exported"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _index.assertNodeType)("Identifier") - }, - exported: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("ForOfStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") - }, - right: { - validate: (0, _index.assertNodeType)("Expression") - }, - body: { - validate: (0, _index.assertNodeType)("Statement") - } - } -}); - -(0, _index2.default)("ImportDeclaration", { - visitor: ["specifiers", "source"], - aliases: ["Statement", "Declaration", "ModuleDeclaration"], - fields: { - specifiers: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier"))) - }, - source: { - validate: (0, _index.assertNodeType)("StringLiteral") - } - } -}); - -(0, _index2.default)("ImportDefaultSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("ImportNamespaceSpecifier", { - visitor: ["local"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("ImportSpecifier", { - visitor: ["local", "imported"], - aliases: ["ModuleSpecifier"], - fields: { - local: { - validate: (0, _index.assertNodeType)("Identifier") - }, - imported: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("MetaProperty", { - visitor: ["meta", "property"], - aliases: ["Expression"], - fields: { - meta: { - validate: (0, _index.assertValueType)("string") - }, - property: { - validate: (0, _index.assertValueType)("string") - } - } -}); - -(0, _index2.default)("ClassMethod", { - aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], - builder: ["kind", "key", "params", "body", "computed", "static"], - visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], - fields: { - kind: { - validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")), - default: "method" - }, - computed: { - default: false, - validate: (0, _index.assertValueType)("boolean") - }, - static: { - default: false, - validate: (0, _index.assertValueType)("boolean") - }, - key: { - validate: function validate(node, key, val) { - var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; - _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val); - } - }, - params: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal"))) - }, - body: { - validate: (0, _index.assertNodeType)("BlockStatement") - }, - generator: { - default: false, - validate: (0, _index.assertValueType)("boolean") - }, - async: { - default: false, - validate: (0, _index.assertValueType)("boolean") - } - } -}); - -(0, _index2.default)("ObjectPattern", { - visitor: ["properties", "typeAnnotation"], - aliases: ["Pattern", "LVal"], - fields: { - properties: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property"))) - }, - decorators: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))) - } - } -}); - -(0, _index2.default)("SpreadElement", { - visitor: ["argument"], - aliases: ["UnaryLike"], - fields: { - argument: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("Super", { - aliases: ["Expression"] -}); - -(0, _index2.default)("TaggedTemplateExpression", { - visitor: ["tag", "quasi"], - aliases: ["Expression"], - fields: { - tag: { - validate: (0, _index.assertNodeType)("Expression") - }, - quasi: { - validate: (0, _index.assertNodeType)("TemplateLiteral") - } - } -}); - -(0, _index2.default)("TemplateElement", { - builder: ["value", "tail"], - fields: { - value: {}, - tail: { - validate: (0, _index.assertValueType)("boolean"), - default: false - } - } -}); - -(0, _index2.default)("TemplateLiteral", { - visitor: ["quasis", "expressions"], - aliases: ["Expression", "Literal"], - fields: { - quasis: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement"))) - }, - expressions: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression"))) - } - } -}); - -(0, _index2.default)("YieldExpression", { - builder: ["argument", "delegate"], - visitor: ["argument"], - aliases: ["Expression", "Terminatorless"], - fields: { - delegate: { - validate: (0, _index.assertValueType)("boolean"), - default: false - }, - argument: { - optional: true, - validate: (0, _index.assertNodeType)("Expression") - } - } -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/experimental.js b/node_modules/babel-types/lib/definitions/experimental.js deleted file mode 100644 index d65d609..0000000 --- a/node_modules/babel-types/lib/definitions/experimental.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; - -var _index = require("./index"); - -var _index2 = _interopRequireDefault(_index); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _index2.default)("AwaitExpression", { - builder: ["argument"], - visitor: ["argument"], - aliases: ["Expression", "Terminatorless"], - fields: { - argument: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("ForAwaitStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal") - }, - right: { - validate: (0, _index.assertNodeType)("Expression") - }, - body: { - validate: (0, _index.assertNodeType)("Statement") - } - } -}); - -(0, _index2.default)("BindExpression", { - visitor: ["object", "callee"], - aliases: ["Expression"], - fields: {} -}); - -(0, _index2.default)("Import", { - aliases: ["Expression"] -}); - -(0, _index2.default)("Decorator", { - visitor: ["expression"], - fields: { - expression: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("DoExpression", { - visitor: ["body"], - aliases: ["Expression"], - fields: { - body: { - validate: (0, _index.assertNodeType)("BlockStatement") - } - } -}); - -(0, _index2.default)("ExportDefaultSpecifier", { - visitor: ["exported"], - aliases: ["ModuleSpecifier"], - fields: { - exported: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("ExportNamespaceSpecifier", { - visitor: ["exported"], - aliases: ["ModuleSpecifier"], - fields: { - exported: { - validate: (0, _index.assertNodeType)("Identifier") - } - } -}); - -(0, _index2.default)("RestProperty", { - visitor: ["argument"], - aliases: ["UnaryLike"], - fields: { - argument: { - validate: (0, _index.assertNodeType)("LVal") - } - } -}); - -(0, _index2.default)("SpreadProperty", { - visitor: ["argument"], - aliases: ["UnaryLike"], - fields: { - argument: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/flow.js b/node_modules/babel-types/lib/definitions/flow.js deleted file mode 100644 index dca21ec..0000000 --- a/node_modules/babel-types/lib/definitions/flow.js +++ /dev/null @@ -1,261 +0,0 @@ -"use strict"; - -var _index = require("./index"); - -var _index2 = _interopRequireDefault(_index); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _index2.default)("AnyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("ArrayTypeAnnotation", { - visitor: ["elementType"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("BooleanTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("BooleanLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("NullLiteralTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("ClassImplements", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("ClassProperty", { - visitor: ["key", "value", "typeAnnotation", "decorators"], - builder: ["key", "value", "typeAnnotation", "decorators", "computed"], - aliases: ["Property"], - fields: { - computed: { - validate: (0, _index.assertValueType)("boolean"), - default: false - } - } -}); - -(0, _index2.default)("DeclareClass", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareFunction", { - visitor: ["id"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareInterface", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareModule", { - visitor: ["id", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareModuleExports", { - visitor: ["typeAnnotation"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareTypeAlias", { - visitor: ["id", "typeParameters", "right"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("DeclareVariable", { - visitor: ["id"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("ExistentialTypeParam", { - aliases: ["Flow"] -}); - -(0, _index2.default)("FunctionTypeAnnotation", { - visitor: ["typeParameters", "params", "rest", "returnType"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("FunctionTypeParam", { - visitor: ["name", "typeAnnotation"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("GenericTypeAnnotation", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("InterfaceExtends", { - visitor: ["id", "typeParameters"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("InterfaceDeclaration", { - visitor: ["id", "typeParameters", "extends", "body"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("IntersectionTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("MixedTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -(0, _index2.default)("EmptyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] -}); - -(0, _index2.default)("NullableTypeAnnotation", { - visitor: ["typeAnnotation"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("NumericLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("NumberTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("StringLiteralTypeAnnotation", { - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("StringTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("ThisTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); - -(0, _index2.default)("TupleTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("TypeofTypeAnnotation", { - visitor: ["argument"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("TypeAlias", { - visitor: ["id", "typeParameters", "right"], - aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], - fields: {} -}); - -(0, _index2.default)("TypeAnnotation", { - visitor: ["typeAnnotation"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("TypeCastExpression", { - visitor: ["expression", "typeAnnotation"], - aliases: ["Flow", "ExpressionWrapper", "Expression"], - fields: {} -}); - -(0, _index2.default)("TypeParameter", { - visitor: ["bound"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("TypeParameterDeclaration", { - visitor: ["params"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("TypeParameterInstantiation", { - visitor: ["params"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("ObjectTypeAnnotation", { - visitor: ["properties", "indexers", "callProperties"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("ObjectTypeCallProperty", { - visitor: ["value"], - aliases: ["Flow", "UserWhitespacable"], - fields: {} -}); - -(0, _index2.default)("ObjectTypeIndexer", { - visitor: ["id", "key", "value"], - aliases: ["Flow", "UserWhitespacable"], - fields: {} -}); - -(0, _index2.default)("ObjectTypeProperty", { - visitor: ["key", "value"], - aliases: ["Flow", "UserWhitespacable"], - fields: {} -}); - -(0, _index2.default)("QualifiedTypeIdentifier", { - visitor: ["id", "qualification"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("UnionTypeAnnotation", { - visitor: ["types"], - aliases: ["Flow"], - fields: {} -}); - -(0, _index2.default)("VoidTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/index.js b/node_modules/babel-types/lib/definitions/index.js deleted file mode 100644 index d512114..0000000 --- a/node_modules/babel-types/lib/definitions/index.js +++ /dev/null @@ -1,249 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = undefined; - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -var _stringify = require("babel-runtime/core-js/json/stringify"); - -var _stringify2 = _interopRequireDefault(_stringify); - -var _typeof2 = require("babel-runtime/helpers/typeof"); - -var _typeof3 = _interopRequireDefault(_typeof2); - -exports.assertEach = assertEach; -exports.assertOneOf = assertOneOf; -exports.assertNodeType = assertNodeType; -exports.assertNodeOrValueType = assertNodeOrValueType; -exports.assertValueType = assertValueType; -exports.chain = chain; -exports.default = defineType; - -var _index = require("../index"); - -var t = _interopRequireWildcard(_index); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var VISITOR_KEYS = exports.VISITOR_KEYS = {}; -var ALIAS_KEYS = exports.ALIAS_KEYS = {}; -var NODE_FIELDS = exports.NODE_FIELDS = {}; -var BUILDER_KEYS = exports.BUILDER_KEYS = {}; -var DEPRECATED_KEYS = exports.DEPRECATED_KEYS = {}; - -function getType(val) { - if (Array.isArray(val)) { - return "array"; - } else if (val === null) { - return "null"; - } else if (val === undefined) { - return "undefined"; - } else { - return typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val); - } -} - -function assertEach(callback) { - function validator(node, key, val) { - if (!Array.isArray(val)) return; - - for (var i = 0; i < val.length; i++) { - callback(node, key + "[" + i + "]", val[i]); - } - } - validator.each = callback; - return validator; -} - -function assertOneOf() { - for (var _len = arguments.length, vals = Array(_len), _key = 0; _key < _len; _key++) { - vals[_key] = arguments[_key]; - } - - function validate(node, key, val) { - if (vals.indexOf(val) < 0) { - throw new TypeError("Property " + key + " expected value to be one of " + (0, _stringify2.default)(vals) + " but got " + (0, _stringify2.default)(val)); - } - } - - validate.oneOf = vals; - - return validate; -} - -function assertNodeType() { - for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - types[_key2] = arguments[_key2]; - } - - function validate(node, key, val) { - var valid = false; - - for (var _iterator = types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var type = _ref; - - if (t.is(type, val)) { - valid = true; - break; - } - } - - if (!valid) { - throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); - } - } - - validate.oneOfNodeTypes = types; - - return validate; -} - -function assertNodeOrValueType() { - for (var _len3 = arguments.length, types = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - types[_key3] = arguments[_key3]; - } - - function validate(node, key, val) { - var valid = false; - - for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var type = _ref2; - - if (getType(val) === type || t.is(type, val)) { - valid = true; - break; - } - } - - if (!valid) { - throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type))); - } - } - - validate.oneOfNodeOrValueTypes = types; - - return validate; -} - -function assertValueType(type) { - function validate(node, key, val) { - var valid = getType(val) === type; - - if (!valid) { - throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val)); - } - } - - validate.type = type; - - return validate; -} - -function chain() { - for (var _len4 = arguments.length, fns = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - fns[_key4] = arguments[_key4]; - } - - function validate() { - for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { - var _ref3; - - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref3 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref3 = _i3.value; - } - - var fn = _ref3; - - fn.apply(undefined, arguments); - } - } - validate.chainOf = fns; - return validate; -} - -function defineType(type) { - var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var inherits = opts.inherits && store[opts.inherits] || {}; - - opts.fields = opts.fields || inherits.fields || {}; - opts.visitor = opts.visitor || inherits.visitor || []; - opts.aliases = opts.aliases || inherits.aliases || []; - opts.builder = opts.builder || inherits.builder || opts.visitor || []; - - if (opts.deprecatedAlias) { - DEPRECATED_KEYS[opts.deprecatedAlias] = type; - } - - for (var _iterator4 = opts.visitor.concat(opts.builder), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { - var _ref4; - - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref4 = _iterator4[_i4++]; - } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref4 = _i4.value; - } - - var _key5 = _ref4; - - opts.fields[_key5] = opts.fields[_key5] || {}; - } - - for (var key in opts.fields) { - var field = opts.fields[key]; - - if (opts.builder.indexOf(key) === -1) { - field.optional = true; - } - if (field.default === undefined) { - field.default = null; - } else if (!field.validate) { - field.validate = assertValueType(getType(field.default)); - } - } - - VISITOR_KEYS[type] = opts.visitor; - BUILDER_KEYS[type] = opts.builder; - NODE_FIELDS[type] = opts.fields; - ALIAS_KEYS[type] = opts.aliases; - - store[type] = opts; -} - -var store = {}; \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/init.js b/node_modules/babel-types/lib/definitions/init.js deleted file mode 100644 index a3334fe..0000000 --- a/node_modules/babel-types/lib/definitions/init.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -require("./index"); - -require("./core"); - -require("./es2015"); - -require("./flow"); - -require("./jsx"); - -require("./misc"); - -require("./experimental"); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/jsx.js b/node_modules/babel-types/lib/definitions/jsx.js deleted file mode 100644 index 1c0c066..0000000 --- a/node_modules/babel-types/lib/definitions/jsx.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; - -var _index = require("./index"); - -var _index2 = _interopRequireDefault(_index); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _index2.default)("JSXAttribute", { - visitor: ["name", "value"], - aliases: ["JSX", "Immutable"], - fields: { - name: { - validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXNamespacedName") - }, - value: { - optional: true, - validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer") - } - } -}); - -(0, _index2.default)("JSXClosingElement", { - visitor: ["name"], - aliases: ["JSX", "Immutable"], - fields: { - name: { - validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") - } - } -}); - -(0, _index2.default)("JSXElement", { - builder: ["openingElement", "closingElement", "children", "selfClosing"], - visitor: ["openingElement", "children", "closingElement"], - aliases: ["JSX", "Immutable", "Expression"], - fields: { - openingElement: { - validate: (0, _index.assertNodeType)("JSXOpeningElement") - }, - closingElement: { - optional: true, - validate: (0, _index.assertNodeType)("JSXClosingElement") - }, - children: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement"))) - } - } -}); - -(0, _index2.default)("JSXEmptyExpression", { - aliases: ["JSX", "Expression"] -}); - -(0, _index2.default)("JSXExpressionContainer", { - visitor: ["expression"], - aliases: ["JSX", "Immutable"], - fields: { - expression: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("JSXSpreadChild", { - visitor: ["expression"], - aliases: ["JSX", "Immutable"], - fields: { - expression: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("JSXIdentifier", { - builder: ["name"], - aliases: ["JSX", "Expression"], - fields: { - name: { - validate: (0, _index.assertValueType)("string") - } - } -}); - -(0, _index2.default)("JSXMemberExpression", { - visitor: ["object", "property"], - aliases: ["JSX", "Expression"], - fields: { - object: { - validate: (0, _index.assertNodeType)("JSXMemberExpression", "JSXIdentifier") - }, - property: { - validate: (0, _index.assertNodeType)("JSXIdentifier") - } - } -}); - -(0, _index2.default)("JSXNamespacedName", { - visitor: ["namespace", "name"], - aliases: ["JSX"], - fields: { - namespace: { - validate: (0, _index.assertNodeType)("JSXIdentifier") - }, - name: { - validate: (0, _index.assertNodeType)("JSXIdentifier") - } - } -}); - -(0, _index2.default)("JSXOpeningElement", { - builder: ["name", "attributes", "selfClosing"], - visitor: ["name", "attributes"], - aliases: ["JSX", "Immutable"], - fields: { - name: { - validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression") - }, - selfClosing: { - default: false, - validate: (0, _index.assertValueType)("boolean") - }, - attributes: { - validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXAttribute", "JSXSpreadAttribute"))) - } - } -}); - -(0, _index2.default)("JSXSpreadAttribute", { - visitor: ["argument"], - aliases: ["JSX"], - fields: { - argument: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); - -(0, _index2.default)("JSXText", { - aliases: ["JSX", "Immutable"], - builder: ["value"], - fields: { - value: { - validate: (0, _index.assertValueType)("string") - } - } -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/definitions/misc.js b/node_modules/babel-types/lib/definitions/misc.js deleted file mode 100644 index f982b9a..0000000 --- a/node_modules/babel-types/lib/definitions/misc.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -var _index = require("./index"); - -var _index2 = _interopRequireDefault(_index); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -(0, _index2.default)("Noop", { - visitor: [] -}); - -(0, _index2.default)("ParenthesizedExpression", { - visitor: ["expression"], - aliases: ["Expression", "ExpressionWrapper"], - fields: { - expression: { - validate: (0, _index.assertNodeType)("Expression") - } - } -}); \ No newline at end of file diff --git a/node_modules/babel-types/lib/flow.js b/node_modules/babel-types/lib/flow.js deleted file mode 100644 index 2857915..0000000 --- a/node_modules/babel-types/lib/flow.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.createUnionTypeAnnotation = createUnionTypeAnnotation; -exports.removeTypeDuplicates = removeTypeDuplicates; -exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof; - -var _index = require("./index"); - -var t = _interopRequireWildcard(_index); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function createUnionTypeAnnotation(types) { - var flattened = removeTypeDuplicates(types); - - if (flattened.length === 1) { - return flattened[0]; - } else { - return t.unionTypeAnnotation(flattened); - } -} - -function removeTypeDuplicates(nodes) { - var generics = {}; - var bases = {}; - - var typeGroups = []; - - var types = []; - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (!node) continue; - - if (types.indexOf(node) >= 0) { - continue; - } - - if (t.isAnyTypeAnnotation(node)) { - return [node]; - } - - if (t.isFlowBaseAnnotation(node)) { - bases[node.type] = node; - continue; - } - - if (t.isUnionTypeAnnotation(node)) { - if (typeGroups.indexOf(node.types) < 0) { - nodes = nodes.concat(node.types); - typeGroups.push(node.types); - } - continue; - } - - if (t.isGenericTypeAnnotation(node)) { - var name = node.id.name; - - if (generics[name]) { - var existing = generics[name]; - if (existing.typeParameters) { - if (node.typeParameters) { - existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params)); - } - } else { - existing = node.typeParameters; - } - } else { - generics[name] = node; - } - - continue; - } - - types.push(node); - } - - for (var type in bases) { - types.push(bases[type]); - } - - for (var _name in generics) { - types.push(generics[_name]); - } - - return types; -} - -function createTypeAnnotationBasedOnTypeof(type) { - if (type === "string") { - return t.stringTypeAnnotation(); - } else if (type === "number") { - return t.numberTypeAnnotation(); - } else if (type === "undefined") { - return t.voidTypeAnnotation(); - } else if (type === "boolean") { - return t.booleanTypeAnnotation(); - } else if (type === "function") { - return t.genericTypeAnnotation(t.identifier("Function")); - } else if (type === "object") { - return t.genericTypeAnnotation(t.identifier("Object")); - } else if (type === "symbol") { - return t.genericTypeAnnotation(t.identifier("Symbol")); - } else { - throw new Error("Invalid typeof value"); - } -} \ No newline at end of file diff --git a/node_modules/babel-types/lib/index.js b/node_modules/babel-types/lib/index.js deleted file mode 100644 index 2cfb231..0000000 --- a/node_modules/babel-types/lib/index.js +++ /dev/null @@ -1,841 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.createTypeAnnotationBasedOnTypeof = exports.removeTypeDuplicates = exports.createUnionTypeAnnotation = exports.valueToNode = exports.toBlock = exports.toExpression = exports.toStatement = exports.toBindingIdentifierName = exports.toIdentifier = exports.toKeyAlias = exports.toSequenceExpression = exports.toComputedKey = exports.isNodesEquivalent = exports.isImmutable = exports.isScope = exports.isSpecifierDefault = exports.isVar = exports.isBlockScoped = exports.isLet = exports.isValidIdentifier = exports.isReferenced = exports.isBinding = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.TYPES = exports.react = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined; - -var _getOwnPropertySymbols = require("babel-runtime/core-js/object/get-own-property-symbols"); - -var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -var _keys = require("babel-runtime/core-js/object/keys"); - -var _keys2 = _interopRequireDefault(_keys); - -var _stringify = require("babel-runtime/core-js/json/stringify"); - -var _stringify2 = _interopRequireDefault(_stringify); - -var _constants = require("./constants"); - -Object.defineProperty(exports, "STATEMENT_OR_BLOCK_KEYS", { - enumerable: true, - get: function get() { - return _constants.STATEMENT_OR_BLOCK_KEYS; - } -}); -Object.defineProperty(exports, "FLATTENABLE_KEYS", { - enumerable: true, - get: function get() { - return _constants.FLATTENABLE_KEYS; - } -}); -Object.defineProperty(exports, "FOR_INIT_KEYS", { - enumerable: true, - get: function get() { - return _constants.FOR_INIT_KEYS; - } -}); -Object.defineProperty(exports, "COMMENT_KEYS", { - enumerable: true, - get: function get() { - return _constants.COMMENT_KEYS; - } -}); -Object.defineProperty(exports, "LOGICAL_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.LOGICAL_OPERATORS; - } -}); -Object.defineProperty(exports, "UPDATE_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.UPDATE_OPERATORS; - } -}); -Object.defineProperty(exports, "BOOLEAN_NUMBER_BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.BOOLEAN_NUMBER_BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "EQUALITY_BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.EQUALITY_BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "COMPARISON_BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.COMPARISON_BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "BOOLEAN_BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.BOOLEAN_BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "NUMBER_BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.NUMBER_BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "BINARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.BINARY_OPERATORS; - } -}); -Object.defineProperty(exports, "BOOLEAN_UNARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.BOOLEAN_UNARY_OPERATORS; - } -}); -Object.defineProperty(exports, "NUMBER_UNARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.NUMBER_UNARY_OPERATORS; - } -}); -Object.defineProperty(exports, "STRING_UNARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.STRING_UNARY_OPERATORS; - } -}); -Object.defineProperty(exports, "UNARY_OPERATORS", { - enumerable: true, - get: function get() { - return _constants.UNARY_OPERATORS; - } -}); -Object.defineProperty(exports, "INHERIT_KEYS", { - enumerable: true, - get: function get() { - return _constants.INHERIT_KEYS; - } -}); -Object.defineProperty(exports, "BLOCK_SCOPED_SYMBOL", { - enumerable: true, - get: function get() { - return _constants.BLOCK_SCOPED_SYMBOL; - } -}); -Object.defineProperty(exports, "NOT_LOCAL_BINDING", { - enumerable: true, - get: function get() { - return _constants.NOT_LOCAL_BINDING; - } -}); -exports.is = is; -exports.isType = isType; -exports.validate = validate; -exports.shallowEqual = shallowEqual; -exports.appendToMemberExpression = appendToMemberExpression; -exports.prependToMemberExpression = prependToMemberExpression; -exports.ensureBlock = ensureBlock; -exports.clone = clone; -exports.cloneWithoutLoc = cloneWithoutLoc; -exports.cloneDeep = cloneDeep; -exports.buildMatchMemberExpression = buildMatchMemberExpression; -exports.removeComments = removeComments; -exports.inheritsComments = inheritsComments; -exports.inheritTrailingComments = inheritTrailingComments; -exports.inheritLeadingComments = inheritLeadingComments; -exports.inheritInnerComments = inheritInnerComments; -exports.inherits = inherits; -exports.assertNode = assertNode; -exports.isNode = isNode; -exports.traverseFast = traverseFast; -exports.removeProperties = removeProperties; -exports.removePropertiesDeep = removePropertiesDeep; - -var _retrievers = require("./retrievers"); - -Object.defineProperty(exports, "getBindingIdentifiers", { - enumerable: true, - get: function get() { - return _retrievers.getBindingIdentifiers; - } -}); -Object.defineProperty(exports, "getOuterBindingIdentifiers", { - enumerable: true, - get: function get() { - return _retrievers.getOuterBindingIdentifiers; - } -}); - -var _validators = require("./validators"); - -Object.defineProperty(exports, "isBinding", { - enumerable: true, - get: function get() { - return _validators.isBinding; - } -}); -Object.defineProperty(exports, "isReferenced", { - enumerable: true, - get: function get() { - return _validators.isReferenced; - } -}); -Object.defineProperty(exports, "isValidIdentifier", { - enumerable: true, - get: function get() { - return _validators.isValidIdentifier; - } -}); -Object.defineProperty(exports, "isLet", { - enumerable: true, - get: function get() { - return _validators.isLet; - } -}); -Object.defineProperty(exports, "isBlockScoped", { - enumerable: true, - get: function get() { - return _validators.isBlockScoped; - } -}); -Object.defineProperty(exports, "isVar", { - enumerable: true, - get: function get() { - return _validators.isVar; - } -}); -Object.defineProperty(exports, "isSpecifierDefault", { - enumerable: true, - get: function get() { - return _validators.isSpecifierDefault; - } -}); -Object.defineProperty(exports, "isScope", { - enumerable: true, - get: function get() { - return _validators.isScope; - } -}); -Object.defineProperty(exports, "isImmutable", { - enumerable: true, - get: function get() { - return _validators.isImmutable; - } -}); -Object.defineProperty(exports, "isNodesEquivalent", { - enumerable: true, - get: function get() { - return _validators.isNodesEquivalent; - } -}); - -var _converters = require("./converters"); - -Object.defineProperty(exports, "toComputedKey", { - enumerable: true, - get: function get() { - return _converters.toComputedKey; - } -}); -Object.defineProperty(exports, "toSequenceExpression", { - enumerable: true, - get: function get() { - return _converters.toSequenceExpression; - } -}); -Object.defineProperty(exports, "toKeyAlias", { - enumerable: true, - get: function get() { - return _converters.toKeyAlias; - } -}); -Object.defineProperty(exports, "toIdentifier", { - enumerable: true, - get: function get() { - return _converters.toIdentifier; - } -}); -Object.defineProperty(exports, "toBindingIdentifierName", { - enumerable: true, - get: function get() { - return _converters.toBindingIdentifierName; - } -}); -Object.defineProperty(exports, "toStatement", { - enumerable: true, - get: function get() { - return _converters.toStatement; - } -}); -Object.defineProperty(exports, "toExpression", { - enumerable: true, - get: function get() { - return _converters.toExpression; - } -}); -Object.defineProperty(exports, "toBlock", { - enumerable: true, - get: function get() { - return _converters.toBlock; - } -}); -Object.defineProperty(exports, "valueToNode", { - enumerable: true, - get: function get() { - return _converters.valueToNode; - } -}); - -var _flow = require("./flow"); - -Object.defineProperty(exports, "createUnionTypeAnnotation", { - enumerable: true, - get: function get() { - return _flow.createUnionTypeAnnotation; - } -}); -Object.defineProperty(exports, "removeTypeDuplicates", { - enumerable: true, - get: function get() { - return _flow.removeTypeDuplicates; - } -}); -Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", { - enumerable: true, - get: function get() { - return _flow.createTypeAnnotationBasedOnTypeof; - } -}); - -var _toFastProperties = require("to-fast-properties"); - -var _toFastProperties2 = _interopRequireDefault(_toFastProperties); - -var _compact = require("lodash/compact"); - -var _compact2 = _interopRequireDefault(_compact); - -var _clone = require("lodash/clone"); - -var _clone2 = _interopRequireDefault(_clone); - -var _each = require("lodash/each"); - -var _each2 = _interopRequireDefault(_each); - -var _uniq = require("lodash/uniq"); - -var _uniq2 = _interopRequireDefault(_uniq); - -require("./definitions/init"); - -var _definitions = require("./definitions"); - -var _react2 = require("./react"); - -var _react = _interopRequireWildcard(_react2); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var t = exports; - -function registerType(type) { - var is = t["is" + type]; - if (!is) { - is = t["is" + type] = function (node, opts) { - return t.is(type, node, opts); - }; - } - - t["assert" + type] = function (node, opts) { - opts = opts || {}; - if (!is(node, opts)) { - throw new Error("Expected type " + (0, _stringify2.default)(type) + " with option " + (0, _stringify2.default)(opts)); - } - }; -} - -exports.VISITOR_KEYS = _definitions.VISITOR_KEYS; -exports.ALIAS_KEYS = _definitions.ALIAS_KEYS; -exports.NODE_FIELDS = _definitions.NODE_FIELDS; -exports.BUILDER_KEYS = _definitions.BUILDER_KEYS; -exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS; -exports.react = _react; - - -for (var type in t.VISITOR_KEYS) { - registerType(type); -} - -t.FLIPPED_ALIAS_KEYS = {}; - -(0, _each2.default)(t.ALIAS_KEYS, function (aliases, type) { - (0, _each2.default)(aliases, function (alias) { - var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; - types.push(type); - }); -}); - -(0, _each2.default)(t.FLIPPED_ALIAS_KEYS, function (types, type) { - t[type.toUpperCase() + "_TYPES"] = types; - registerType(type); -}); - -var TYPES = exports.TYPES = (0, _keys2.default)(t.VISITOR_KEYS).concat((0, _keys2.default)(t.FLIPPED_ALIAS_KEYS)).concat((0, _keys2.default)(t.DEPRECATED_KEYS)); - -function is(type, node, opts) { - if (!node) return false; - - var matches = isType(node.type, type); - if (!matches) return false; - - if (typeof opts === "undefined") { - return true; - } else { - return t.shallowEqual(node, opts); - } -} - -function isType(nodeType, targetType) { - if (nodeType === targetType) return true; - - if (t.ALIAS_KEYS[targetType]) return false; - - var aliases = t.FLIPPED_ALIAS_KEYS[targetType]; - if (aliases) { - if (aliases[0] === nodeType) return true; - - for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var alias = _ref; - - if (nodeType === alias) return true; - } - } - - return false; -} - -(0, _each2.default)(t.BUILDER_KEYS, function (keys, type) { - function builder() { - if (arguments.length > keys.length) { - throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length)); - } - - var node = {}; - node.type = type; - - var i = 0; - - for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var _key = _ref2; - - var field = t.NODE_FIELDS[type][_key]; - - var arg = arguments[i++]; - if (arg === undefined) arg = (0, _clone2.default)(field.default); - - node[_key] = arg; - } - - for (var key in node) { - validate(node, key, node[key]); - } - - return node; - } - - t[type] = builder; - t[type[0].toLowerCase() + type.slice(1)] = builder; -}); - -var _loop = function _loop(_type) { - var newType = t.DEPRECATED_KEYS[_type]; - - function proxy(fn) { - return function () { - console.trace("The node type " + _type + " has been renamed to " + newType); - return fn.apply(this, arguments); - }; - } - - t[_type] = t[_type[0].toLowerCase() + _type.slice(1)] = proxy(t[newType]); - t["is" + _type] = proxy(t["is" + newType]); - t["assert" + _type] = proxy(t["assert" + newType]); -}; - -for (var _type in t.DEPRECATED_KEYS) { - _loop(_type); -} - -function validate(node, key, val) { - if (!node) return; - - var fields = t.NODE_FIELDS[node.type]; - if (!fields) return; - - var field = fields[key]; - if (!field || !field.validate) return; - if (field.optional && val == null) return; - - field.validate(node, key, val); -} - -function shallowEqual(actual, expected) { - var keys = (0, _keys2.default)(expected); - - for (var _iterator3 = keys, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { - var _ref3; - - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref3 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref3 = _i3.value; - } - - var key = _ref3; - - if (actual[key] !== expected[key]) { - return false; - } - } - - return true; -} - -function appendToMemberExpression(member, append, computed) { - member.object = t.memberExpression(member.object, member.property, member.computed); - member.property = append; - member.computed = !!computed; - return member; -} - -function prependToMemberExpression(member, prepend) { - member.object = t.memberExpression(prepend, member.object); - return member; -} - -function ensureBlock(node) { - var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body"; - - return node[key] = t.toBlock(node[key], node); -} - -function clone(node) { - if (!node) return node; - var newNode = {}; - for (var key in node) { - if (key[0] === "_") continue; - newNode[key] = node[key]; - } - return newNode; -} - -function cloneWithoutLoc(node) { - var newNode = clone(node); - delete newNode.loc; - return newNode; -} - -function cloneDeep(node) { - if (!node) return node; - var newNode = {}; - - for (var key in node) { - if (key[0] === "_") continue; - - var val = node[key]; - - if (val) { - if (val.type) { - val = t.cloneDeep(val); - } else if (Array.isArray(val)) { - val = val.map(t.cloneDeep); - } - } - - newNode[key] = val; - } - - return newNode; -} - -function buildMatchMemberExpression(match, allowPartial) { - var parts = match.split("."); - - return function (member) { - if (!t.isMemberExpression(member)) return false; - - var search = [member]; - var i = 0; - - while (search.length) { - var node = search.shift(); - - if (allowPartial && i === parts.length) { - return true; - } - - if (t.isIdentifier(node)) { - if (parts[i] !== node.name) return false; - } else if (t.isStringLiteral(node)) { - if (parts[i] !== node.value) return false; - } else if (t.isMemberExpression(node)) { - if (node.computed && !t.isStringLiteral(node.property)) { - return false; - } else { - search.push(node.object); - search.push(node.property); - continue; - } - } else { - return false; - } - - if (++i > parts.length) { - return false; - } - } - - return true; - }; -} - -function removeComments(node) { - for (var _iterator4 = t.COMMENT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { - var _ref4; - - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref4 = _iterator4[_i4++]; - } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref4 = _i4.value; - } - - var key = _ref4; - - delete node[key]; - } - return node; -} - -function inheritsComments(child, parent) { - inheritTrailingComments(child, parent); - inheritLeadingComments(child, parent); - inheritInnerComments(child, parent); - return child; -} - -function inheritTrailingComments(child, parent) { - _inheritComments("trailingComments", child, parent); -} - -function inheritLeadingComments(child, parent) { - _inheritComments("leadingComments", child, parent); -} - -function inheritInnerComments(child, parent) { - _inheritComments("innerComments", child, parent); -} - -function _inheritComments(key, child, parent) { - if (child && parent) { - child[key] = (0, _uniq2.default)((0, _compact2.default)([].concat(child[key], parent[key]))); - } -} - -function inherits(child, parent) { - if (!child || !parent) return child; - - for (var _iterator5 = t.INHERIT_KEYS.optional, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { - var _ref5; - - if (_isArray5) { - if (_i5 >= _iterator5.length) break; - _ref5 = _iterator5[_i5++]; - } else { - _i5 = _iterator5.next(); - if (_i5.done) break; - _ref5 = _i5.value; - } - - var _key2 = _ref5; - - if (child[_key2] == null) { - child[_key2] = parent[_key2]; - } - } - - for (var key in parent) { - if (key[0] === "_") child[key] = parent[key]; - } - - for (var _iterator6 = t.INHERIT_KEYS.force, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) { - var _ref6; - - if (_isArray6) { - if (_i6 >= _iterator6.length) break; - _ref6 = _iterator6[_i6++]; - } else { - _i6 = _iterator6.next(); - if (_i6.done) break; - _ref6 = _i6.value; - } - - var _key3 = _ref6; - - child[_key3] = parent[_key3]; - } - - t.inheritsComments(child, parent); - - return child; -} - -function assertNode(node) { - if (!isNode(node)) { - throw new TypeError("Not a valid node " + (node && node.type)); - } -} - -function isNode(node) { - return !!(node && _definitions.VISITOR_KEYS[node.type]); -} - -(0, _toFastProperties2.default)(t); -(0, _toFastProperties2.default)(t.VISITOR_KEYS); - -function traverseFast(node, enter, opts) { - if (!node) return; - - var keys = t.VISITOR_KEYS[node.type]; - if (!keys) return; - - opts = opts || {}; - enter(node, opts); - - for (var _iterator7 = keys, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) { - var _ref7; - - if (_isArray7) { - if (_i7 >= _iterator7.length) break; - _ref7 = _iterator7[_i7++]; - } else { - _i7 = _iterator7.next(); - if (_i7.done) break; - _ref7 = _i7.value; - } - - var key = _ref7; - - var subNode = node[key]; - - if (Array.isArray(subNode)) { - for (var _iterator8 = subNode, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) { - var _ref8; - - if (_isArray8) { - if (_i8 >= _iterator8.length) break; - _ref8 = _iterator8[_i8++]; - } else { - _i8 = _iterator8.next(); - if (_i8.done) break; - _ref8 = _i8.value; - } - - var _node = _ref8; - - traverseFast(_node, enter, opts); - } - } else { - traverseFast(subNode, enter, opts); - } - } -} - -var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; - -var CLEAR_KEYS_PLUS_COMMENTS = t.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS); - -function removeProperties(node, opts) { - opts = opts || {}; - var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; - for (var _iterator9 = map, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) { - var _ref9; - - if (_isArray9) { - if (_i9 >= _iterator9.length) break; - _ref9 = _iterator9[_i9++]; - } else { - _i9 = _iterator9.next(); - if (_i9.done) break; - _ref9 = _i9.value; - } - - var _key4 = _ref9; - - if (node[_key4] != null) node[_key4] = undefined; - } - - for (var key in node) { - if (key[0] === "_" && node[key] != null) node[key] = undefined; - } - - var syms = (0, _getOwnPropertySymbols2.default)(node); - for (var _iterator10 = syms, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) { - var _ref10; - - if (_isArray10) { - if (_i10 >= _iterator10.length) break; - _ref10 = _iterator10[_i10++]; - } else { - _i10 = _iterator10.next(); - if (_i10.done) break; - _ref10 = _i10.value; - } - - var sym = _ref10; - - node[sym] = null; - } -} - -function removePropertiesDeep(tree, opts) { - traverseFast(tree, removeProperties, opts); - return tree; -} \ No newline at end of file diff --git a/node_modules/babel-types/lib/react.js b/node_modules/babel-types/lib/react.js deleted file mode 100644 index 923ee12..0000000 --- a/node_modules/babel-types/lib/react.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.isReactComponent = undefined; -exports.isCompatTag = isCompatTag; -exports.buildChildren = buildChildren; - -var _index = require("./index"); - -var t = _interopRequireWildcard(_index); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component"); - -function isCompatTag(tagName) { - return !!tagName && /^[a-z]|\-/.test(tagName); -} - -function cleanJSXElementLiteralChild(child, args) { - var lines = child.value.split(/\r\n|\n|\r/); - - var lastNonEmptyLine = 0; - - for (var i = 0; i < lines.length; i++) { - if (lines[i].match(/[^ \t]/)) { - lastNonEmptyLine = i; - } - } - - var str = ""; - - for (var _i = 0; _i < lines.length; _i++) { - var line = lines[_i]; - - var isFirstLine = _i === 0; - var isLastLine = _i === lines.length - 1; - var isLastNonEmptyLine = _i === lastNonEmptyLine; - - var trimmedLine = line.replace(/\t/g, " "); - - if (!isFirstLine) { - trimmedLine = trimmedLine.replace(/^[ ]+/, ""); - } - - if (!isLastLine) { - trimmedLine = trimmedLine.replace(/[ ]+$/, ""); - } - - if (trimmedLine) { - if (!isLastNonEmptyLine) { - trimmedLine += " "; - } - - str += trimmedLine; - } - } - - if (str) args.push(t.stringLiteral(str)); -} - -function buildChildren(node) { - var elems = []; - - for (var i = 0; i < node.children.length; i++) { - var child = node.children[i]; - - if (t.isJSXText(child)) { - cleanJSXElementLiteralChild(child, elems); - continue; - } - - if (t.isJSXExpressionContainer(child)) child = child.expression; - if (t.isJSXEmptyExpression(child)) continue; - - elems.push(child); - } - - return elems; -} \ No newline at end of file diff --git a/node_modules/babel-types/lib/retrievers.js b/node_modules/babel-types/lib/retrievers.js deleted file mode 100644 index e141aad..0000000 --- a/node_modules/babel-types/lib/retrievers.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; - -exports.__esModule = true; - -var _create = require("babel-runtime/core-js/object/create"); - -var _create2 = _interopRequireDefault(_create); - -exports.getBindingIdentifiers = getBindingIdentifiers; -exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers; - -var _index = require("./index"); - -var t = _interopRequireWildcard(_index); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function getBindingIdentifiers(node, duplicates, outerOnly) { - var search = [].concat(node); - var ids = (0, _create2.default)(null); - - while (search.length) { - var id = search.shift(); - if (!id) continue; - - var keys = t.getBindingIdentifiers.keys[id.type]; - - if (t.isIdentifier(id)) { - if (duplicates) { - var _ids = ids[id.name] = ids[id.name] || []; - _ids.push(id); - } else { - ids[id.name] = id; - } - continue; - } - - if (t.isExportDeclaration(id)) { - if (t.isDeclaration(node.declaration)) { - search.push(node.declaration); - } - continue; - } - - if (outerOnly) { - if (t.isFunctionDeclaration(id)) { - search.push(id.id); - continue; - } - - if (t.isFunctionExpression(id)) { - continue; - } - } - - if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (id[key]) { - search = search.concat(id[key]); - } - } - } - } - - return ids; -} - -getBindingIdentifiers.keys = { - DeclareClass: ["id"], - DeclareFunction: ["id"], - DeclareModule: ["id"], - DeclareVariable: ["id"], - InterfaceDeclaration: ["id"], - TypeAlias: ["id"], - - CatchClause: ["param"], - LabeledStatement: ["label"], - UnaryExpression: ["argument"], - AssignmentExpression: ["left"], - - ImportSpecifier: ["local"], - ImportNamespaceSpecifier: ["local"], - ImportDefaultSpecifier: ["local"], - ImportDeclaration: ["specifiers"], - - ExportSpecifier: ["exported"], - ExportNamespaceSpecifier: ["exported"], - ExportDefaultSpecifier: ["exported"], - - FunctionDeclaration: ["id", "params"], - FunctionExpression: ["id", "params"], - - ClassDeclaration: ["id"], - ClassExpression: ["id"], - - RestElement: ["argument"], - UpdateExpression: ["argument"], - - RestProperty: ["argument"], - ObjectProperty: ["value"], - - AssignmentPattern: ["left"], - ArrayPattern: ["elements"], - ObjectPattern: ["properties"], - - VariableDeclaration: ["declarations"], - VariableDeclarator: ["id"] -}; - -function getOuterBindingIdentifiers(node, duplicates) { - return getBindingIdentifiers(node, duplicates, true); -} \ No newline at end of file diff --git a/node_modules/babel-types/lib/validators.js b/node_modules/babel-types/lib/validators.js deleted file mode 100644 index 23578a1..0000000 --- a/node_modules/babel-types/lib/validators.js +++ /dev/null @@ -1,263 +0,0 @@ -"use strict"; - -exports.__esModule = true; - -var _keys = require("babel-runtime/core-js/object/keys"); - -var _keys2 = _interopRequireDefault(_keys); - -var _typeof2 = require("babel-runtime/helpers/typeof"); - -var _typeof3 = _interopRequireDefault(_typeof2); - -var _getIterator2 = require("babel-runtime/core-js/get-iterator"); - -var _getIterator3 = _interopRequireDefault(_getIterator2); - -exports.isBinding = isBinding; -exports.isReferenced = isReferenced; -exports.isValidIdentifier = isValidIdentifier; -exports.isLet = isLet; -exports.isBlockScoped = isBlockScoped; -exports.isVar = isVar; -exports.isSpecifierDefault = isSpecifierDefault; -exports.isScope = isScope; -exports.isImmutable = isImmutable; -exports.isNodesEquivalent = isNodesEquivalent; - -var _retrievers = require("./retrievers"); - -var _esutils = require("esutils"); - -var _esutils2 = _interopRequireDefault(_esutils); - -var _index = require("./index"); - -var t = _interopRequireWildcard(_index); - -var _constants = require("./constants"); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function isBinding(node, parent) { - var keys = _retrievers.getBindingIdentifiers.keys[parent.type]; - if (keys) { - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var val = parent[key]; - if (Array.isArray(val)) { - if (val.indexOf(node) >= 0) return true; - } else { - if (val === node) return true; - } - } - } - - return false; -} - -function isReferenced(node, parent) { - switch (parent.type) { - case "BindExpression": - return parent.object === node || parent.callee === node; - - case "MemberExpression": - case "JSXMemberExpression": - if (parent.property === node && parent.computed) { - return true; - } else if (parent.object === node) { - return true; - } else { - return false; - } - - case "MetaProperty": - return false; - - case "ObjectProperty": - if (parent.key === node) { - return parent.computed; - } - - case "VariableDeclarator": - return parent.id !== node; - - case "ArrowFunctionExpression": - case "FunctionDeclaration": - case "FunctionExpression": - for (var _iterator = parent.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var param = _ref; - - if (param === node) return false; - } - - return parent.id !== node; - - case "ExportSpecifier": - if (parent.source) { - return false; - } else { - return parent.local === node; - } - - case "ExportNamespaceSpecifier": - case "ExportDefaultSpecifier": - return false; - - case "JSXAttribute": - return parent.name !== node; - - case "ClassProperty": - if (parent.key === node) { - return parent.computed; - } else { - return parent.value === node; - } - - case "ImportDefaultSpecifier": - case "ImportNamespaceSpecifier": - case "ImportSpecifier": - return false; - - case "ClassDeclaration": - case "ClassExpression": - return parent.id !== node; - - case "ClassMethod": - case "ObjectMethod": - return parent.key === node && parent.computed; - - case "LabeledStatement": - return false; - - case "CatchClause": - return parent.param !== node; - - case "RestElement": - return false; - - case "AssignmentExpression": - return parent.right === node; - - case "AssignmentPattern": - return parent.right === node; - - case "ObjectPattern": - case "ArrayPattern": - return false; - } - - return true; -} - -function isValidIdentifier(name) { - if (typeof name !== "string" || _esutils2.default.keyword.isReservedWordES6(name, true)) { - return false; - } else { - return _esutils2.default.keyword.isIdentifierNameES6(name); - } -} - -function isLet(node) { - return t.isVariableDeclaration(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]); -} - -function isBlockScoped(node) { - return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node); -} - -function isVar(node) { - return t.isVariableDeclaration(node, { kind: "var" }) && !node[_constants.BLOCK_SCOPED_SYMBOL]; -} - -function isSpecifierDefault(specifier) { - return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" }); -} - -function isScope(node, parent) { - if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) { - return false; - } - - return t.isScopable(node); -} - -function isImmutable(node) { - if (t.isType(node.type, "Immutable")) return true; - - if (t.isIdentifier(node)) { - if (node.name === "undefined") { - return true; - } else { - return false; - } - } - - return false; -} - -function isNodesEquivalent(a, b) { - if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || a == null || b == null) { - return a === b; - } - - if (a.type !== b.type) { - return false; - } - - var fields = (0, _keys2.default)(t.NODE_FIELDS[a.type] || a.type); - - for (var _iterator2 = fields, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { - var _ref2; - - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref2 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref2 = _i2.value; - } - - var field = _ref2; - - if ((0, _typeof3.default)(a[field]) !== (0, _typeof3.default)(b[field])) { - return false; - } - - if (Array.isArray(a[field])) { - if (!Array.isArray(b[field])) { - return false; - } - if (a[field].length !== b[field].length) { - return false; - } - - for (var i = 0; i < a[field].length; i++) { - if (!isNodesEquivalent(a[field][i], b[field][i])) { - return false; - } - } - continue; - } - - if (!isNodesEquivalent(a[field], b[field])) { - return false; - } - } - - return true; -} \ No newline at end of file diff --git a/node_modules/babel-types/package.json b/node_modules/babel-types/package.json deleted file mode 100644 index eea4862..0000000 --- a/node_modules/babel-types/package.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "babel-types@^6.21.0", - "scope": null, - "escapedName": "babel-types", - "name": "babel-types", - "rawSpec": "^6.21.0", - "spec": ">=6.21.0 <7.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/babel-core" - ] - ], - "_from": "babel-types@>=6.21.0 <7.0.0", - "_id": "babel-types@6.21.0", - "_inCache": true, - "_location": "/babel-types", - "_nodeVersion": "6.9.0", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/babel-types-6.21.0.tgz_1481925360825_0.9180078322533518" - }, - "_npmUser": { - "name": "hzoo", - "email": "hi@henryzoo.com" - }, - "_npmVersion": "3.10.8", - "_phantomChildren": {}, - "_requested": { - "raw": "babel-types@^6.21.0", - "scope": null, - "escapedName": "babel-types", - "name": "babel-types", - "rawSpec": "^6.21.0", - "spec": ">=6.21.0 <7.0.0", - "type": "range" - }, - "_requiredBy": [ - "/babel-core", - "/babel-generator", - "/babel-helper-builder-binary-assignment-operator-visitor", - "/babel-helper-call-delegate", - "/babel-helper-define-map", - "/babel-helper-explode-assignable-expression", - "/babel-helper-function-name", - "/babel-helper-get-function-arity", - "/babel-helper-hoist-variables", - "/babel-helper-optimise-call-expression", - "/babel-helper-regex", - "/babel-helper-remap-async-to-generator", - "/babel-helper-replace-supers", - "/babel-plugin-transform-es2015-block-scoping", - "/babel-plugin-transform-es2015-classes", - "/babel-plugin-transform-es2015-duplicate-keys", - "/babel-plugin-transform-es2015-function-name", - "/babel-plugin-transform-es2015-modules-commonjs", - "/babel-plugin-transform-es2015-parameters", - "/babel-plugin-transform-es2015-shorthand-properties", - "/babel-plugin-transform-es2015-sticky-regex", - "/babel-plugin-transform-strict-mode", - "/babel-template", - "/babel-traverse", - "/regenerator-transform" - ], - "_resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.21.0.tgz", - "_shasum": "314b92168891ef6d3806b7f7a917fdf87c11a4b2", - "_shrinkwrap": null, - "_spec": "babel-types@^6.21.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/babel-core", - "author": { - "name": "Sebastian McKenzie", - "email": "sebmck@gmail.com" - }, - "dependencies": { - "babel-runtime": "^6.20.0", - "esutils": "^2.0.2", - "lodash": "^4.2.0", - "to-fast-properties": "^1.0.1" - }, - "description": "Babel Types is a Lodash-esque utility library for AST nodes", - "devDependencies": { - "babylon": "^6.8.2" - }, - "directories": {}, - "dist": { - "shasum": "314b92168891ef6d3806b7f7a917fdf87c11a4b2", - "tarball": "https://registry.npmjs.org/babel-types/-/babel-types-6.21.0.tgz" - }, - "homepage": "https://babeljs.io/", - "license": "MIT", - "main": "lib/index.js", - "maintainers": [ - { - "name": "amasad", - "email": "amjad.masad@gmail.com" - }, - { - "name": "hzoo", - "email": "hi@henryzoo.com" - }, - { - "name": "jmm", - "email": "npm-public@jessemccarthy.net" - }, - { - "name": "loganfsmyth", - "email": "loganfsmyth@gmail.com" - }, - { - "name": "sebmck", - "email": "sebmck@gmail.com" - }, - { - "name": "thejameskyle", - "email": "me@thejameskyle.com" - } - ], - "name": "babel-types", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/babel-types" - }, - "scripts": {}, - "version": "6.21.0" -} diff --git a/node_modules/babylon/CHANGELOG.md b/node_modules/babylon/CHANGELOG.md deleted file mode 100644 index 393b054..0000000 --- a/node_modules/babylon/CHANGELOG.md +++ /dev/null @@ -1,693 +0,0 @@ -# Changelog - -> **Tags:** -> - :boom: [Breaking Change] -> - :eyeglasses: [Spec Compliancy] -> - :rocket: [New Feature] -> - :bug: [Bug Fix] -> - :memo: [Documentation] -> - :house: [Internal] -> - :nail_care: [Polish] - -> Semver Policy: https://github.com/babel/babylon#semver - -_Note: Gaps between patch versions are faulty, broken or test releases._ - -See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.md) for the pre-6.8.0 version Changelog. - -## 6.14.1 (2016-11-17) - -### :bug: Bug Fix - -Allow `"plugins": ["*"]` ([#229](https://github.com/babel/babylon/pull/229)) (Daniel Tschinder) - -```js -{ - "plugins": ["*"] -} -``` - -Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer. - -## 6.14.0 (2016-11-16) - -### :eyeglasses: Spec Compliancy - -Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) - -[11.6.2.2 Future Reserved Words](http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words) - -Babylon will throw for more reserved words such as `enum` or `await` (in strict mode). - -``` -class enum {} // throws -class await {} // throws in strict mode (module) -``` - -Optional names for function types and object type indexers ([#197](https://github.com/babel/babylon/pull/197)) (Gabe Levi) - -So where you used to have to write - -```js -type A = (x: string, y: boolean) => number; -type B = (z: string) => number; -type C = { [key: string]: number }; -``` - -you can now write (with flow 0.34.0) - -```js -type A = (string, boolean) => number; -type B = string => number; -type C = { [string]: number }; -``` - -Parse flow nested array type annotations like `number[][]` ([#219](https://github.com/babel/babylon/pull/219)) (Bernhard Häussner) - -Supports these form now of specifying array types: - -```js -var a: number[][][][]; -var b: string[][]; -``` - -### :bug: Bug Fix - -Correctly eat semicolon at the end of `DelcareModuleExports` ([#223](https://github.com/babel/babylon/pull/223)) (Daniel Tschinder) - -``` -declare module "foo" { declare module.exports: number } -declare module "foo" { declare module.exports: number; } // also allowed now -``` - -### :house: Internal - - * Count Babel tests towards Babylon code coverage ([#182](https://github.com/babel/babylon/pull/182)) (Moti Zilberman) - * Fix strange line endings ([#214](https://github.com/babel/babylon/pull/214)) (Thomas Grainger) - * Add node 7 (Daniel Tschinder) - * chore(package): update flow-bin to version 0.34.0 ([#204](https://github.com/babel/babylon/pull/204)) (Greenkeeper) - -## v6.13.1 (2016-10-26) - -### :nail_care: Polish - -- Use rollup for bundling to speed up startup time ([#190](https://github.com/babel/babylon/pull/190)) ([@drewml](https://github.com/DrewML)) - -```js -const babylon = require('babylon'); -const ast = babylon.parse('var foo = "lol";'); -``` - -With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph. - -**Without bundling** -![image](https://cloud.githubusercontent.com/assets/5233399/19420264/3133497e-93ad-11e6-9a6a-2da59c4f5c13.png) - -**With bundling** -![image](https://cloud.githubusercontent.com/assets/5233399/19420267/388f556e-93ad-11e6-813e-7c5c396be322.png) - -- add clean command [skip ci] ([#201](https://github.com/babel/babylon/pull/201)) (Henry Zhu) -- add ForAwaitStatement (async generator already added) [skip ci] ([#196](https://github.com/babel/babylon/pull/196)) (Henry Zhu) - -## v6.13.0 (2016-10-21) - -### :eyeglasses: Spec Compliancy - -Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) - -> See https://flowtype.org/docs/variance.html for more information - -```js -type T = { +p: T }; -interface T { -p: T }; -declare class T { +[k:K]: V }; -class T { -[k:K]: V }; -class C2 { +p: T = e }; -``` - -Raise error on duplicate definition of __proto__ ([#183](https://github.com/babel/babylon/pull/183)) (Moti Zilberman) - -```js -({ __proto__: 1, __proto__: 2 }) // Throws an error now -``` - -### :bug: Bug Fix - -Flow: Allow class properties to be named `static` ([#184](https://github.com/babel/babylon/pull/184)) (Moti Zilberman) - -```js -declare class A { - static: T; -} -``` - -Allow "async" as identifier for object literal property shorthand ([#187](https://github.com/babel/babylon/pull/187)) (Andrew Levine) - -```js -var foo = { async, bar }; -``` - -### :nail_care: Polish - -Fix flowtype and add inType to state ([#189](https://github.com/babel/babylon/pull/189)) (Daniel Tschinder) - -> This improves the performance slightly (because of hidden classes) - -### :house: Internal - -Fix .gitattributes line ending setting ([#191](https://github.com/babel/babylon/pull/191)) (Moti Zilberman) - -Increase test coverage ([#175](https://github.com/babel/babylon/pull/175) (Moti Zilberman) - -Readd missin .eslinignore for IDEs (Daniel Tschinder) - -Error on missing expected.json fixture in CI ([#188](https://github.com/babel/babylon/pull/188)) (Moti Zilberman) - -Add .gitattributes and .editorconfig for LF line endings ([#179](https://github.com/babel/babylon/pull/179)) (Moti Zilberman) - -Fixes two tests that are failing after the merge of #172 ([#177](https://github.com/babel/babylon/pull/177)) (Moti Zilberman) - -## v6.12.0 (2016-10-14) - -### :eyeglasses: Spec Compliancy - -Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) - -#### Dynamic Import - -- Proposal Repo: https://github.com/domenic/proposal-dynamic-import -- Championed by [@domenic](https://github.com/domenic) -- stage-2 -- [sept-28 tc39 notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2016-09/sept-28.md#113a-import) - -> This repository contains a proposal for adding a "function-like" import() module loading syntactic form to JavaScript - -```js -import(`./section-modules/${link.dataset.entryModule}.js`) -.then(module => { - module.loadPageInto(main); -}) -``` - -Add EmptyTypeAnnotation ([#171](https://github.com/babel/babylon/pull/171)) (Sam Goldman) - -#### EmptyTypeAnnotation - -Just wasn't covered before. - -```js -type T = empty; -``` - -### :bug: Bug Fix - -Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) - -```js -// was failing due to sparse array -export const { foo: [ ,, qux7 ] } = bar; -``` - -Allow keyword in Flow object declaration property names with type parameters ([#146](https://github.com/babel/babylon/pull/146)) (Dan Harper) - -```js -declare class X { - foobar(): void; - static foobar(): void; -} -``` - -Allow keyword in object/class property names with Flow type parameters ([#145](https://github.com/babel/babylon/pull/145)) (Dan Harper) - -```js -class Foo { - delete(item: T): T { - return item; - } -} -``` - -Allow typeAnnotations for yield expressions ([#174](https://github.com/babel/babylon/pull/174))) (Daniel Tschinder) - -```js -function *foo() { - const x = (yield 5: any); -} -``` - -### :nail_care: Polish - -Annotate more errors with expected token ([#172](https://github.com/babel/babylon/pull/172))) (Moti Zilberman) - -```js -// Unexpected token, expected ; (1:6) -{ set 1 } -``` - -### :house: Internal - -Remove kcheck ([#173](https://github.com/babel/babylon/pull/173))) (Daniel Tschinder) - -Also run flow, linting, babel tests on seperate instances (add back node 0.10) - -## v6.11.6 (2016-10-12) - -### :bug: Bug Fix/Regression - -Fix crash when exporting with destructuring and sparse array ([#170](https://github.com/babel/babylon/pull/170)) (Jeroen Engels) - -```js -// was failing with `Cannot read property 'type' of null` because of null identifiers -export const { foo: [ ,, qux7 ] } = bar; -``` - -## v6.11.5 (2016-10-12) - -### :eyeglasses: Spec Compliancy - -Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) - -```js -// `foo` has already been exported. Exported identifiers must be unique. (2:20) -export function foo() {}; -export const { a: [{foo}] } = bar; -``` - -Fix: Check for duplicate named exports in exported rest elements/properties ([#164](https://github.com/babel/babylon/pull/164)) (Kai Cataldo) - -```js -// `foo` has already been exported. Exported identifiers must be unique. (2:22) -export const foo = 1; -export const [bar, ...foo] = baz; -``` - -### :bug: Bug Fix - -Fix: Allow identifier `async` for default param in arrow expression ([#165](https://github.com/babel/babylon/pull/165)) (Kai Cataldo) - -```js -// this is ok now -const test = ({async = true}) => {}; -``` - -### :nail_care: Polish - -Babylon will now print out the token it's expecting if there's a `SyntaxError` ([#150](https://github.com/babel/babylon/pull/150)) (Daniel Tschinder) - -```bash -# So in the case of a missing ending curly (`}`) -Module build failed: SyntaxError: Unexpected token, expected } (30:0) - 28 | } - 29 | -> 30 | - | ^ -``` - -## v6.11.4 (2016-10-03) - -Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) - -## v6.11.3 (2016-10-01) - -### :eyeglasses: Spec Compliancy - -Add static errors for object rest (#149) ([@danez](https://github.com/danez)) - -> https://github.com/sebmarkbage/ecmascript-rest-spread - -Object rest copies the *rest* of properties from the right hand side `obj` starting from the left to right. - -```js -let { x, y, ...z } = { x: 1, y: 2, z: 3 }; -// x = 1 -// y = 2 -// z = { z: 3 } -``` - -#### New Syntax Errors: - -**SyntaxError**: The rest element has to be the last element when destructuring (1:10) -```bash -> 1 | let { ...x, y, z } = { x: 1, y: 2, z: 3}; - | ^ -# Previous behavior: -# x = { x: 1, y: 2, z: 3 } -# y = 2 -# z = 3 -``` - -Before, this was just a more verbose way of shallow copying `obj` since it doesn't actually do what you think. - -**SyntaxError**: Cannot have multiple rest elements when destructuring (1:13) - -```bash -> 1 | let { x, ...y, ...z } = { x: 1, y: 2, z: 3}; - | ^ -# Previous behavior: -# x = 1 -# y = { y: 2, z: 3 } -# z = { y: 2, z: 3 } -``` - -Before y and z would just be the same value anyway so there is no reason to need to have both. - -**SyntaxError**: A trailing comma is not permitted after the rest element (1:16) - -```js -let { x, y, ...z, } = obj; -``` - -The rationale for this is that the use case for trailing comma is that you can add something at the end without affecting the line above. Since a RestProperty always has to be the last property it doesn't make sense. - ---- - -get / set are valid property names in default assignment (#142) ([@jezell](https://github.com/jezell)) - -```js -// valid -function something({ set = null, get = null }) {} -``` - -## v6.11.2 (2016-09-23) - -### Bug Fix - -- [#139](https://github.com/babel/babylon/issues/139) Don't do the duplicate check if not an identifier (#140) @hzoo - -```js -// regression with duplicate export check -SyntaxError: ./typography.js: `undefined` has already been exported. Exported identifiers must be unique. (22:13) - 20 | - 21 | export const { rhythm } = typography; -> 22 | export const { TypographyStyle } = typography -``` - -Bail out for now, and make a change to account for destructuring in the next release. - -## 6.11.1 (2016-09-22) - -### Bug Fix -- [#137](https://github.com/babel/babylon/pull/137) - Fix a regression with duplicate exports - it was erroring on all keys in `Object.prototype`. @danez - -```javascript -export toString from './toString'; -``` - -```bash -`toString` has already been exported. Exported identifiers must be unique. (1:7) -> 1 | export toString from './toString'; - | ^ - 2 | -``` - -## 6.11.0 (2016-09-22) - -### Spec Compliancy (will break CI) - -- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo - -```js -// Only one default export allowed per module. (2:9) -export default function() {}; -export { foo as default }; - -// Only one default export allowed per module. (2:0) -export default {}; -export default function() {}; - -// `Foo` has already been exported. Exported identifiers must be unique. (2:0) -export { Foo }; -export class Foo {}; -``` - -### New Feature (Syntax) - -- Add support for computed class property names ([#121](https://github.com/babel/babylon/pull/121)) @motiz88 - -```js -// AST -interface ClassProperty <: Node { - type: "ClassProperty"; - key: Identifier; - value: Expression; - computed: boolean; // added -} -``` - -```js -// with "plugins": ["classProperties"] -class Foo { - [x] - ['y'] -} - -class Bar { - [p] - [m] () {} -} - ``` - -### Bug Fix - -- Fix `static` property falling through in the declare class Flow AST ([#135](https://github.com/babel/babylon/pull/135)) @danharper - -```js -declare class X { - a: number; - static b: number; // static - c: number; // this was being marked as static in the AST as well -} -``` - -### Polish - -- Rephrase "assigning/binding to rvalue" errors to include context ([#119](https://github.com/babel/babylon/pull/119)) @motiz88 - -```js -// Used to error with: -// SyntaxError: Assigning to rvalue (1:0) - -// Now: -// Invalid left-hand side in assignment expression (1:0) -3 = 4 - -// Invalid left-hand side in for-in statement (1:5) -for (+i in {}); -``` - -### Internal - -- Fix call to `this.parseMaybeAssign` with correct arguments ([#133](https://github.com/babel/babylon/pull/133)) @danez -- Add semver note to changelog ([#131](https://github.com/babel/babylon/pull/131)) @hzoo - -## 6.10.0 (2016-09-19) - -> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue. - -### Spec Compliancy - -* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) - -> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors - -More Context: [tc39-notes](https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-07/july-29.md#611-the-scope-of-use-strict-with-respect-to-destructuring-in-parameter-lists) - -For example: - -```js -// this errors because it uses destructuring and default parameters -// in a function with a "use strict" directive -function a([ option1, option2 ] = []) { - "use strict"; -} - ``` - -The solution would be to use a top level "use strict" or to remove the destructuring or default parameters when using a function + "use strict" or to. - -### New Feature - -* Exact object type annotations for Flow plugin ([#104](https://github.com/babel/babylon/pull/104)) (Basil Hosmer) - -Added to flow in https://github.com/facebook/flow/commit/c710c40aa2a115435098d6c0dfeaadb023cd39b8 - -Looks like: - -```js -var a : {| x: number, y: string |} = { x: 0, y: 'foo' }; -``` - -### Bug Fixes - -* Include `typeParameter` location in `ArrowFunctionExpression` ([#126](https://github.com/babel/babylon/pull/126)) (Daniel Tschinder) -* Error on invalid flow type annotation with default assignment ([#122](https://github.com/babel/babylon/pull/122)) (Dan Harper) -* Fix Flow return types on arrow functions ([#124](https://github.com/babel/babylon/pull/124)) (Dan Harper) - -### Misc - -* Add tests for export extensions ([#127](https://github.com/babel/babylon/pull/127)) (Daniel Tschinder) -* Fix Contributing guidelines [skip ci] (Daniel Tschinder) - -## 6.9.2 (2016-09-09) - -The only change is to remove the `babel-runtime` dependency by compiling with Babel's ES2015 loose mode. So using babylon standalone should be smaller. - -## 6.9.1 (2016-08-23) - -This release contains mainly small bugfixes but also updates babylons default mode to es2017. The features for `exponentiationOperator`, `asyncFunctions` and `trailingFunctionCommas` which previously needed to be activated via plugin are now enabled by default and the plugins are now no-ops. - -### Bug Fixes - -- Fix issues with default object params in async functions ([#96](https://github.com/babel/babylon/pull/96)) @danez -- Fix issues with flow-types and async function ([#95](https://github.com/babel/babylon/pull/95)) @danez -- Fix arrow functions with destructuring, types & default value ([#94](https://github.com/babel/babylon/pull/94)) @danharper -- Fix declare class with qualified type identifier ([#97](https://github.com/babel/babylon/pull/97)) @danez -- Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas plugins and enable them by default ([#98](https://github.com/babel/babylon/pull/98)) @danez - -## 6.9.0 (2016-08-16) - -### New syntax support - -- Add JSX spread children ([#42](https://github.com/babel/babylon/pull/42)) @calebmer - -(Be aware that React is not going to support this syntax) - -```js -
- {...todos.map(todo => )} -
-``` - -- Add support for declare module.exports ([#72](https://github.com/babel/babylon/pull/72)) @danez - -```js -declare module "foo" { - declare module.exports: {} -} -``` - -### New Features - -- If supplied, attach filename property to comment node loc. ([#80](https://github.com/babel/babylon/pull/80)) @divmain -- Add identifier name to node loc field ([#90](https://github.com/babel/babylon/pull/90)) @kittens - -### Bug Fixes - -- Fix exponential operator to behave according to spec ([#75](https://github.com/babel/babylon/pull/75)) @danez -- Fix lookahead to not add comments to arrays which are not cloned ([#76](https://github.com/babel/babylon/pull/76)) @danez -- Fix accidental fall-through in Flow type parsing. ([#82](https://github.com/babel/babylon/pull/82)) @xiemaisi -- Only allow declares inside declare module ([#73](https://github.com/babel/babylon/pull/73)) @danez -- Small fix for parsing type parameter declarations ([#83](https://github.com/babel/babylon/pull/83)) @gabelevi -- Fix arrow param locations with flow types ([#57](https://github.com/babel/babylon/pull/57)) @danez -- Fixes SyntaxError position with flow optional type ([#65](https://github.com/babel/babylon/pull/65)) @danez - -### Internal - -- Add codecoverage to tests @danez -- Fix tests to not save expected output if we expect the test to fail @danez -- Make a shallow clone of babel for testing @danez -- chore(package): update cross-env to version 2.0.0 ([#77](https://github.com/babel/babylon/pull/77)) @greenkeeperio-bot -- chore(package): update ava to version 0.16.0 ([#86](https://github.com/babel/babylon/pull/86)) @greenkeeperio-bot -- chore(package): update babel-plugin-istanbul to version 2.0.0 ([#89](https://github.com/babel/babylon/pull/89)) @greenkeeperio-bot -- chore(package): update nyc to version 8.0.0 ([#88](https://github.com/babel/babylon/pull/88)) @greenkeeperio-bot - -## 6.8.4 (2016-07-06) - -### Bug Fixes - -- Fix the location of params, when flow and default value used ([#68](https://github.com/babel/babylon/pull/68)) @danez - -## 6.8.3 (2016-07-02) - -### Bug Fixes - -- Fix performance regression introduced in 6.8.2 with conditionals ([#63](https://github.com/babel/babylon/pull/63)) @danez - -## 6.8.2 (2016-06-24) - -### Bug Fixes - -- Fix parse error with yielding jsx elements in generators `function* it() { yield ; }` ([#31](https://github.com/babel/babylon/pull/31)) @eldereal -- When cloning nodes do not clone its comments ([#24](https://github.com/babel/babylon/pull/24)) @danez -- Fix parse errors when using arrow functions with an spread element and return type `(...props): void => {}` ([#10](https://github.com/babel/babylon/pull/10)) @danez -- Fix leading comments added from previous node ([#23](https://github.com/babel/babylon/pull/23)) @danez -- Fix parse errors with flow's optional arguments `(arg?) => {}` ([#19](https://github.com/babel/babylon/pull/19)) @danez -- Support negative numeric type literals @kittens -- Remove line terminator restriction after await keyword @kittens -- Remove grouped type arrow restriction as it seems flow no longer has it @kittens -- Fix parse error with generic methods that have the name `get` or `set` `class foo { get() {} }` ([#55](https://github.com/babel/babylon/pull/55)) @vkurchatkin -- Fix parse error with arrow functions that have flow type parameter declarations `(x: T): T => x;` ([#54](https://github.com/babel/babylon/pull/54)) @gabelevi - -### Documentation - -- Document AST differences from ESTree ([#41](https://github.com/babel/babylon/pull/41)) @nene -- Move ast spec from babel/babel ([#46](https://github.com/babel/babylon/pull/46)) @hzoo - -### Internal - -- Enable skipped tests ([#16](https://github.com/babel/babylon/pull/16)) @danez -- Add script to test latest version of babylon with babel ([#21](https://github.com/babel/babylon/pull/21)) @danez -- Upgrade test runner ava @kittens -- Add missing generate-identifier-regex script @kittens -- Rename parser context types @kittens -- Add node v6 to travis testing @hzoo -- Update to Unicode v9 ([#45](https://github.com/babel/babylon/pull/45)) @mathiasbynens - -## 6.8.1 (2016-06-06) - -### New Feature - -- Parse type parameter declarations with defaults like `type Foo = T` - -### Bug Fixes -- Type parameter declarations need 1 or more type parameters. -- The existential type `*` is not a valid type parameter. -- The existential type `*` is a primary type - -### Spec Compliancy -- The param list for type parameter declarations now consists of `TypeParameter` nodes -- New `TypeParameter` AST Node (replaces using the `Identifier` node before) - -``` -interface TypeParameter <: Node { - bound: TypeAnnotation; - default: TypeAnnotation; - name: string; - variance: "plus" | "minus"; -} -``` - -## 6.8.0 (2016-05-02) - -#### New Feature - -##### Parse Method Parameter Decorators ([#12](https://github.com/babel/babylon/pull/12)) - -> [Method Parameter Decorators](https://goo.gl/8MmCMG) is now a TC39 [stage 0 proposal](https://github.com/tc39/ecma262/blob/master/stage0.md). - -Examples: - -```js -class Foo { - constructor(@foo() x, @bar({ a: 123 }) @baz() y) {} -} - -export default function func(@foo() x, @bar({ a: 123 }) @baz() y) {} - -var obj = { - method(@foo() x, @bar({ a: 123 }) @baz() y) {} -}; -``` - -##### Parse for-await statements (w/ `asyncGenerators` plugin) ([#17](https://github.com/babel/babylon/pull/17)) - -There is also a new node type, `ForAwaitStatement`. - -> [Async generators and for-await](https://github.com/tc39/proposal-async-iteration) are now a [stage 2 proposal](https://github.com/tc39/ecma262#current-proposals). - -Example: - -```js -async function f() { - for await (let x of y); -} -``` diff --git a/node_modules/babylon/LICENSE b/node_modules/babylon/LICENSE deleted file mode 100644 index d4c7fc5..0000000 --- a/node_modules/babylon/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2012-2014 by various contributors (see AUTHORS) - -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/babylon/README.md b/node_modules/babylon/README.md deleted file mode 100644 index f358020..0000000 --- a/node_modules/babylon/README.md +++ /dev/null @@ -1,122 +0,0 @@ -

- babylon -

- -

- Babylon is a JavaScript parser used in Babel. -

- -

- Travis Status - Codecov Status -

- - - The latest ECMAScript version enabled by default (ES2017). - - Comment attachment. - - Support for JSX and Flow. - - Support for experimental language proposals (accepting PRs for anything at least [stage-0](https://github.com/tc39/proposals/blob/master/stage-0-proposals.md)). - -## Credits - -Heavily based on [acorn](https://github.com/marijnh/acorn) and [acorn-jsx](https://github.com/RReverser/acorn-jsx), -thanks to the awesome work of [@RReverser](https://github.com/RReverser) and [@marijnh](https://github.com/marijnh). - -Significant diversions are expected to occur in the future such as streaming, EBNF definitions, sweet.js integration, interspatial parsing and more. - -## API - -### `babylon.parse(code, [options])` - -### Options - -- **allowImportExportEverywhere**: By default, `import` and `export` - declarations can only appear at a program's top level. Setting this - option to `true` allows them anywhere where a statement is allowed. - -- **allowReturnOutsideFunction**: By default, a return statement at - the top level raises an error. Set this to `true` to accept such - code. - -- **allowSuperOutsideMethod** TODO - -- **sourceType**: Indicate the mode the code should be parsed in. Can be - either `"script"` or `"module"`. - -- **sourceFilename**: Correlate output AST nodes with their source filename. Useful when generating code and source maps from the ASTs of multiple input files. - -- **plugins**: Array containing the plugins that you want to enable. - -### Output - -Babylon generates AST according to [Babel AST format][]. -It is based on [ESTree spec][] with the following deviations: - -- [Literal][] token is replaced with [StringLiteral][], [NumericLiteral][], [BooleanLiteral][], [NullLiteral][], [RegExpLiteral][] -- [Property][] token is replaced with [ObjectProperty][] and [ObjectMethod][] -- [MethodDefinition][] is replaced with [ClassMethod][] -- [Program][] and [BlockStatement][] contain additional `directives` field with [Directive][] and [DirectiveLiteral][] -- [ClassMethod][], [ObjectProperty][], and [ObjectMethod][] value property's properties in [FunctionExpression][] is coerced/brought into the main method node. - -AST for JSX code is based on [Facebook JSX AST][] with the addition of one node type: - -- `JSXText` - -[Babel AST format]: https://github.com/babel/babylon/blob/master/ast/spec.md -[ESTree spec]: https://github.com/estree/estree - -[Literal]: https://github.com/estree/estree/blob/master/es5.md#literal -[Property]: https://github.com/estree/estree/blob/master/es5.md#property -[MethodDefinition]: https://github.com/estree/estree/blob/master/es2015.md#methoddefinition - -[StringLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#stringliteral -[NumericLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#numericliteral -[BooleanLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#booleanliteral -[NullLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#nullliteral -[RegExpLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#regexpliteral -[ObjectProperty]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectproperty -[ObjectMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#objectmethod -[ClassMethod]: https://github.com/babel/babylon/blob/master/ast/spec.md#classmethod -[Program]: https://github.com/babel/babylon/blob/master/ast/spec.md#programs -[BlockStatement]: https://github.com/babel/babylon/blob/master/ast/spec.md#blockstatement -[Directive]: https://github.com/babel/babylon/blob/master/ast/spec.md#directive -[DirectiveLiteral]: https://github.com/babel/babylon/blob/master/ast/spec.md#directiveliteral -[FunctionExpression]: https://github.com/babel/babylon/blob/master/ast/spec.md#functionexpression - -[Facebook JSX AST]: https://github.com/facebook/jsx/blob/master/AST.md - -### Semver - -Babylon follows semver in most situations. The only thing to note is that some spec-compliancy bug fixes may be released under patch versions. - -For example: We push a fix to early error on something like [#107](https://github.com/babel/babylon/pull/107) - multiple default exports per file. That would be considered a bug fix even though it would cause a build to fail. - -### Example - -```javascript -require("babylon").parse("code", { - // parse in strict mode and allow module declarations - sourceType: "module", - - plugins: [ - // enable jsx and flow syntax - "jsx", - "flow" - ] -}); -``` - -### Plugins - -> You can use `"*"` to include everything (may be useful in certain cases) - - - `jsx` - - `flow` - - `doExpressions` - - `objectRestSpread` - - `decorators` - - `classProperties` - - `exportExtensions` - - `asyncGenerators` - - `functionBind` - - `functionSent` - - `dynamicImport` diff --git a/node_modules/babylon/bin/babylon.js b/node_modules/babylon/bin/babylon.js deleted file mode 100755 index 449ddfe..0000000 --- a/node_modules/babylon/bin/babylon.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node -/* eslint no-var: 0 */ - -var babylon = require(".."); -var fs = require("fs"); - -var filename = process.argv[2]; -if (!filename) { - console.error("no filename specified"); - process.exit(0); -} - -var file = fs.readFileSync(filename, "utf8"); -var ast = babylon.parse(file); - -console.log(JSON.stringify(ast, null, " ")); diff --git a/node_modules/babylon/bin/generate-identifier-regex.js b/node_modules/babylon/bin/generate-identifier-regex.js deleted file mode 100644 index 76cc7f3..0000000 --- a/node_modules/babylon/bin/generate-identifier-regex.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -// Which Unicode version should be used? -const version = "9.0.0"; - -const start = require("unicode-" + version + "/Binary_Property/ID_Start/code-points.js") - .filter(function(ch) { return ch > 0x7f; }); -let last = -1; -const cont = [0x200c, 0x200d].concat( - require("unicode-" + version + "/Binary_Property/ID_Continue/code-points.js") - .filter(function(ch) { - return ch > 0x7f && search(start, ch, last + 1) == -1; - }) - ); - -function search(arr, ch, starting) { - for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) - if (arr[i] === ch) - return i; - return -1; -} - -function pad(str, width) { - while (str.length < width) str = "0" + str; - return str; -} - -function esc(code) { - const hex = code.toString(16); - if (hex.length <= 2) return "\\x" + pad(hex, 2); - else return "\\u" + pad(hex, 4); -} - -function generate(chars) { - const astral = []; - let re = ""; - for (let i = 0, at = 0x10000; i < chars.length; i++) { - const from = chars[i]; - let to = from; - while (i < chars.length - 1 && chars[i + 1] == to + 1) { - i++; - to++; - } - if (to <= 0xffff) { - if (from == to) re += esc(from); - else if (from + 1 == to) re += esc(from) + esc(to); - else re += esc(from) + "-" + esc(to); - } else { - astral.push(from - at, to - from); - at = to; - } - } - return {nonASCII: re, astral: astral}; -} - -const startData = generate(start); -const contData = generate(cont); - -console.log("let nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\";"); -console.log("let nonASCIIidentifierChars = \"" + contData.nonASCII + "\";"); -console.log("const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"); -console.log("const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"); diff --git a/node_modules/babylon/lib/index.js b/node_modules/babylon/lib/index.js deleted file mode 100644 index 29f9d8e..0000000 --- a/node_modules/babylon/lib/index.js +++ /dev/null @@ -1,6470 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/* eslint max-len: 0 */ - -// This is a trick taken from Esprima. It turns out that, on -// non-Chrome browsers, to check whether a string is in a set, a -// predicate containing a big ugly `switch` statement is faster than -// a regular expression, and on Chrome the two are about on par. -// This function uses `eval` (non-lexical) to produce such a -// predicate from a space-separated string of words. -// -// It starts by sorting the words by length. - -function makePredicate(words) { - words = words.split(" "); - return function (str) { - return words.indexOf(str) >= 0; - }; -} - -// Reserved word lists for various dialects of the language - -var reservedWords = { - 6: makePredicate("enum await"), - strict: makePredicate("implements interface let package private protected public static yield"), - strictBind: makePredicate("eval arguments") -}; - -// And the keywords - -var isKeyword$1 = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); - -// ## Character categories - -// Big ugly regular expressions that match characters in the -// whitespace, identifier, and identifier-start categories. These -// are only applied when a character is found to actually have a -// code point above 128. -// Generated by `bin/generate-identifier-regex.js`. - -var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"; -var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; - -var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); -var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); - -nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; - -// These are a run-length and offset encoded representation of the -// >0xffff code points that are a valid part of identifiers. The -// offset starts at 0x10000, and each pair of numbers represents an -// offset to the next range, and then a size of the range. They were -// generated by `bin/generate-identifier-regex.js`. -var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541]; -var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; - -// This has a complexity linear to the value of the code. The -// assumption is that looking up astral identifier characters is -// rare. -function isInAstralSet(code, set) { - var pos = 0x10000; - for (var i = 0; i < set.length; i += 2) { - pos += set[i]; - if (pos > code) return false; - - pos += set[i + 1]; - if (pos >= code) return true; - } -} - -// Test whether a given character code starts an identifier. - -function isIdentifierStart(code) { - if (code < 65) return code === 36; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes); -} - -// Test whether a given character is part of an identifier. - -function isIdentifierChar(code) { - if (code < 48) return code === 36; - if (code < 58) return true; - if (code < 65) return false; - if (code < 91) return true; - if (code < 97) return code === 95; - if (code < 123) return true; - if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); - return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); -} - -// A second optional argument can be given to further configure -var defaultOptions = { - // Source type ("script" or "module") for different semantics - sourceType: "script", - // Source filename. - sourceFilename: undefined, - // When enabled, a return at the top level is not considered an - // error. - allowReturnOutsideFunction: false, - // When enabled, import/export statements are not constrained to - // appearing at the top of the program. - allowImportExportEverywhere: false, - // TODO - allowSuperOutsideMethod: false, - // An array of plugins to enable - plugins: [], - // TODO - strictMode: null -}; - -// Interpret and default an options object - -function getOptions(opts) { - var options = {}; - for (var key in defaultOptions) { - options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; - } - return options; -} - -function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// ## Token types - -// The assignment of fine-grained, information-carrying type objects -// allows the tokenizer to store the information it has about a -// token in a way that is very cheap for the parser to look up. - -// All token type variables start with an underscore, to make them -// easy to recognize. - -// The `beforeExpr` property is used to disambiguate between regular -// expressions and divisions. It is set on all token types that can -// be followed by an expression (thus, a slash after them would be a -// regular expression). -// -// `isLoop` marks a keyword as starting a loop, which is important -// to know when parsing a label, in order to allow or disallow -// continue jumps to that label. - -var TokenType = function TokenType(label) { - var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck$2(this, TokenType); - - this.label = label; - this.keyword = conf.keyword; - this.beforeExpr = !!conf.beforeExpr; - this.startsExpr = !!conf.startsExpr; - this.rightAssociative = !!conf.rightAssociative; - this.isLoop = !!conf.isLoop; - this.isAssign = !!conf.isAssign; - this.prefix = !!conf.prefix; - this.postfix = !!conf.postfix; - this.binop = conf.binop || null; - this.updateContext = null; -}; - -function binop(name, prec) { - return new TokenType(name, { beforeExpr: true, binop: prec }); -} -var beforeExpr = { beforeExpr: true }; -var startsExpr = { startsExpr: true }; - -var types = { - num: new TokenType("num", startsExpr), - regexp: new TokenType("regexp", startsExpr), - string: new TokenType("string", startsExpr), - name: new TokenType("name", startsExpr), - eof: new TokenType("eof"), - - // Punctuation token types. - bracketL: new TokenType("[", { beforeExpr: true, startsExpr: true }), - bracketR: new TokenType("]"), - braceL: new TokenType("{", { beforeExpr: true, startsExpr: true }), - braceBarL: new TokenType("{|", { beforeExpr: true, startsExpr: true }), - braceR: new TokenType("}"), - braceBarR: new TokenType("|}"), - parenL: new TokenType("(", { beforeExpr: true, startsExpr: true }), - parenR: new TokenType(")"), - comma: new TokenType(",", beforeExpr), - semi: new TokenType(";", beforeExpr), - colon: new TokenType(":", beforeExpr), - doubleColon: new TokenType("::", beforeExpr), - dot: new TokenType("."), - question: new TokenType("?", beforeExpr), - arrow: new TokenType("=>", beforeExpr), - template: new TokenType("template"), - ellipsis: new TokenType("...", beforeExpr), - backQuote: new TokenType("`", startsExpr), - dollarBraceL: new TokenType("${", { beforeExpr: true, startsExpr: true }), - at: new TokenType("@"), - - // Operators. These carry several kinds of properties to help the - // parser use them properly (the presence of these properties is - // what categorizes them as operators). - // - // `binop`, when present, specifies that this operator is a binary - // operator, and will refer to its precedence. - // - // `prefix` and `postfix` mark the operator as a prefix or postfix - // unary operator. - // - // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as - // binary operators with a very low precedence, that should result - // in AssignmentExpression nodes. - - eq: new TokenType("=", { beforeExpr: true, isAssign: true }), - assign: new TokenType("_=", { beforeExpr: true, isAssign: true }), - incDec: new TokenType("++/--", { prefix: true, postfix: true, startsExpr: true }), - prefix: new TokenType("prefix", { beforeExpr: true, prefix: true, startsExpr: true }), - logicalOR: binop("||", 1), - logicalAND: binop("&&", 2), - bitwiseOR: binop("|", 3), - bitwiseXOR: binop("^", 4), - bitwiseAND: binop("&", 5), - equality: binop("==/!=", 6), - relational: binop("", 7), - bitShift: binop("<>", 8), - plusMin: new TokenType("+/-", { beforeExpr: true, binop: 9, prefix: true, startsExpr: true }), - modulo: binop("%", 10), - star: binop("*", 10), - slash: binop("/", 10), - exponent: new TokenType("**", { beforeExpr: true, binop: 11, rightAssociative: true }) -}; - -// Map keyword names to token types. - -var keywords = {}; - -// Succinct definitions of keyword token types -function kw(name) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - options.keyword = name; - keywords[name] = types["_" + name] = new TokenType(name, options); -} - -kw("break"); -kw("case", beforeExpr); -kw("catch"); -kw("continue"); -kw("debugger"); -kw("default", beforeExpr); -kw("do", { isLoop: true, beforeExpr: true }); -kw("else", beforeExpr); -kw("finally"); -kw("for", { isLoop: true }); -kw("function", startsExpr); -kw("if"); -kw("return", beforeExpr); -kw("switch"); -kw("throw", beforeExpr); -kw("try"); -kw("var"); -kw("let"); -kw("const"); -kw("while", { isLoop: true }); -kw("with"); -kw("new", { beforeExpr: true, startsExpr: true }); -kw("this", startsExpr); -kw("super", startsExpr); -kw("class"); -kw("extends", beforeExpr); -kw("export"); -kw("import"); -kw("yield", { beforeExpr: true, startsExpr: true }); -kw("null", startsExpr); -kw("true", startsExpr); -kw("false", startsExpr); -kw("in", { beforeExpr: true, binop: 7 }); -kw("instanceof", { beforeExpr: true, binop: 7 }); -kw("typeof", { beforeExpr: true, prefix: true, startsExpr: true }); -kw("void", { beforeExpr: true, prefix: true, startsExpr: true }); -kw("delete", { beforeExpr: true, prefix: true, startsExpr: true }); - -// Matches a whole line break (where CRLF is considered a single -// line break). Used to count lines. - -var lineBreak = /\r\n?|\n|\u2028|\u2029/; -var lineBreakG = new RegExp(lineBreak.source, "g"); - -function isNewLine(code) { - return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; -} - -var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; - -function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// The algorithm used to determine whether a regexp can appear at a -// given point in the program is loosely based on sweet.js' approach. -// See https://github.com/mozilla/sweet.js/wiki/design - -var TokContext = function TokContext(token, isExpr, preserveSpace, override) { - _classCallCheck$3(this, TokContext); - - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; -}; - -var types$1 = { - braceStatement: new TokContext("{", false), - braceExpression: new TokContext("{", true), - templateQuasi: new TokContext("${", true), - parenStatement: new TokContext("(", false), - parenExpression: new TokContext("(", true), - template: new TokContext("`", true, true, function (p) { - return p.readTmplToken(); - }), - functionExpression: new TokContext("function", true) -}; - -// Token-specific context update code - -types.parenR.updateContext = types.braceR.updateContext = function () { - if (this.state.context.length === 1) { - this.state.exprAllowed = true; - return; - } - - var out = this.state.context.pop(); - if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { - this.state.context.pop(); - this.state.exprAllowed = false; - } else if (out === types$1.templateQuasi) { - this.state.exprAllowed = true; - } else { - this.state.exprAllowed = !out.isExpr; - } -}; - -types.name.updateContext = function (prevType) { - this.state.exprAllowed = false; - - if (prevType === types._let || prevType === types._const || prevType === types._var) { - if (lineBreak.test(this.input.slice(this.state.end))) { - this.state.exprAllowed = true; - } - } -}; - -types.braceL.updateContext = function (prevType) { - this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); - this.state.exprAllowed = true; -}; - -types.dollarBraceL.updateContext = function () { - this.state.context.push(types$1.templateQuasi); - this.state.exprAllowed = true; -}; - -types.parenL.updateContext = function (prevType) { - var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; - this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); - this.state.exprAllowed = true; -}; - -types.incDec.updateContext = function () { - // tokExprAllowed stays unchanged -}; - -types._function.updateContext = function () { - if (this.curContext() !== types$1.braceStatement) { - this.state.context.push(types$1.functionExpression); - } - - this.state.exprAllowed = false; -}; - -types.backQuote.updateContext = function () { - if (this.curContext() === types$1.template) { - this.state.context.pop(); - } else { - this.state.context.push(types$1.template); - } - this.state.exprAllowed = false; -}; - -function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// These are used when `options.locations` is on, for the -// `startLoc` and `endLoc` properties. - -var Position = function Position(line, col) { - _classCallCheck$4(this, Position); - - this.line = line; - this.column = col; -}; - -var SourceLocation = function SourceLocation(start, end) { - _classCallCheck$4(this, SourceLocation); - - this.start = start; - this.end = end; -}; - -// The `getLineInfo` function is mostly useful when the -// `locations` option is off (for performance reasons) and you -// want to find the line/column position for a given character -// offset. `input` should be the code string that the offset refers -// into. - -function getLineInfo(input, offset) { - for (var line = 1, cur = 0;;) { - lineBreakG.lastIndex = cur; - var match = lineBreakG.exec(input); - if (match && match.index < offset) { - ++line; - cur = match.index + match[0].length; - } else { - return new Position(line, offset - cur); - } - } -} - -function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var State = function () { - function State() { - _classCallCheck$5(this, State); - } - - State.prototype.init = function init(options, input) { - this.strict = options.strictMode === false ? false : options.sourceType === "module"; - - this.input = input; - - this.potentialArrowAt = -1; - - this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inType = this.noAnonFunctionType = false; - - this.labels = []; - - this.decorators = []; - - this.tokens = []; - - this.comments = []; - - this.trailingComments = []; - this.leadingComments = []; - this.commentStack = []; - - this.pos = this.lineStart = 0; - this.curLine = 1; - - this.type = types.eof; - this.value = null; - this.start = this.end = this.pos; - this.startLoc = this.endLoc = this.curPosition(); - - this.lastTokEndLoc = this.lastTokStartLoc = null; - this.lastTokStart = this.lastTokEnd = this.pos; - - this.context = [types$1.braceStatement]; - this.exprAllowed = true; - - this.containsEsc = this.containsOctal = false; - this.octalPosition = null; - - this.exportedIdentifiers = []; - - return this; - }; - - // TODO - - - // TODO - - - // Used to signify the start of a potential arrow function - - - // Flags to track whether we are in a function, a generator. - - - // Labels in scope. - - - // Leading decorators. - - - // Token store. - - - // Comment store. - - - // Comment attachment store - - - // The current position of the tokenizer in the input. - - - // Properties of the current token: - // Its type - - - // For tokens that include more information than their type, the value - - - // Its start and end offset - - - // And, if locations are used, the {line, column} object - // corresponding to those offsets - - - // Position information for the previous token - - - // The context stack is used to superficially track syntactic - // context to predict whether a regular expression is allowed in a - // given position. - - - // Used to signal to callers of `readWord1` whether the word - // contained any escape sequences. This is needed because words with - // escape sequences must not be interpreted as keywords. - - - // TODO - - - // Names of exports store. `default` is stored as a name for both - // `export default foo;` and `export { foo as default };`. - - - State.prototype.curPosition = function curPosition() { - return new Position(this.curLine, this.pos - this.lineStart); - }; - - State.prototype.clone = function clone(skipArrays) { - var state = new State(); - for (var key in this) { - var val = this[key]; - - if ((!skipArrays || key === "context") && Array.isArray(val)) { - val = val.slice(); - } - - state[key] = val; - } - return state; - }; - - return State; -}(); - -function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/* eslint indent: 0 */ - -// Object type used to represent tokens. Note that normally, tokens -// simply exist as properties on the parser object. This is only -// used for the onToken callback and the external tokenizer. - -var Token = function Token(state) { - _classCallCheck$1(this, Token); - - this.type = state.type; - this.value = state.value; - this.start = state.start; - this.end = state.end; - this.loc = new SourceLocation(state.startLoc, state.endLoc); -}; - -// ## Tokenizer - -function codePointToString(code) { - // UTF-16 Decoding - if (code <= 0xFFFF) { - return String.fromCharCode(code); - } else { - return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); - } -} - -var Tokenizer = function () { - function Tokenizer(options, input) { - _classCallCheck$1(this, Tokenizer); - - this.state = new State(); - this.state.init(options, input); - } - - // Move to the next token - - Tokenizer.prototype.next = function next() { - if (!this.isLookahead) { - this.state.tokens.push(new Token(this.state)); - } - - this.state.lastTokEnd = this.state.end; - this.state.lastTokStart = this.state.start; - this.state.lastTokEndLoc = this.state.endLoc; - this.state.lastTokStartLoc = this.state.startLoc; - this.nextToken(); - }; - - // TODO - - Tokenizer.prototype.eat = function eat(type) { - if (this.match(type)) { - this.next(); - return true; - } else { - return false; - } - }; - - // TODO - - Tokenizer.prototype.match = function match(type) { - return this.state.type === type; - }; - - // TODO - - Tokenizer.prototype.isKeyword = function isKeyword(word) { - return isKeyword$1(word); - }; - - // TODO - - Tokenizer.prototype.lookahead = function lookahead() { - var old = this.state; - this.state = old.clone(true); - - this.isLookahead = true; - this.next(); - this.isLookahead = false; - - var curr = this.state.clone(true); - this.state = old; - return curr; - }; - - // Toggle strict mode. Re-reads the next number or string to please - // pedantic tests (`"use strict"; 010;` should fail). - - Tokenizer.prototype.setStrict = function setStrict(strict) { - this.state.strict = strict; - if (!this.match(types.num) && !this.match(types.string)) return; - this.state.pos = this.state.start; - while (this.state.pos < this.state.lineStart) { - this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; - --this.state.curLine; - } - this.nextToken(); - }; - - Tokenizer.prototype.curContext = function curContext() { - return this.state.context[this.state.context.length - 1]; - }; - - // Read a single token, updating the parser object's token-related - // properties. - - Tokenizer.prototype.nextToken = function nextToken() { - var curContext = this.curContext(); - if (!curContext || !curContext.preserveSpace) this.skipSpace(); - - this.state.containsOctal = false; - this.state.octalPosition = null; - this.state.start = this.state.pos; - this.state.startLoc = this.state.curPosition(); - if (this.state.pos >= this.input.length) return this.finishToken(types.eof); - - if (curContext.override) { - return curContext.override(this); - } else { - return this.readToken(this.fullCharCodeAtPos()); - } - }; - - Tokenizer.prototype.readToken = function readToken(code) { - // Identifier or keyword. '\uXXXX' sequences are allowed in - // identifiers, so '\' also dispatches to that. - if (isIdentifierStart(code) || code === 92 /* '\' */) { - return this.readWord(); - } else { - return this.getTokenFromCode(code); - } - }; - - Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { - var code = this.input.charCodeAt(this.state.pos); - if (code <= 0xd7ff || code >= 0xe000) return code; - - var next = this.input.charCodeAt(this.state.pos + 1); - return (code << 10) + next - 0x35fdc00; - }; - - Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { - var comment = { - type: block ? "CommentBlock" : "CommentLine", - value: text, - start: start, - end: end, - loc: new SourceLocation(startLoc, endLoc) - }; - - if (!this.isLookahead) { - this.state.tokens.push(comment); - this.state.comments.push(comment); - this.addComment(comment); - } - }; - - Tokenizer.prototype.skipBlockComment = function skipBlockComment() { - var startLoc = this.state.curPosition(); - var start = this.state.pos, - end = this.input.indexOf("*/", this.state.pos += 2); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); - - this.state.pos = end + 2; - lineBreakG.lastIndex = start; - var match = void 0; - while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { - ++this.state.curLine; - this.state.lineStart = match.index + match[0].length; - } - - this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { - var start = this.state.pos; - var startLoc = this.state.curPosition(); - var ch = this.input.charCodeAt(this.state.pos += startSkip); - while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { - ++this.state.pos; - ch = this.input.charCodeAt(this.state.pos); - } - - this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); - }; - - // Called at the start of the parse and after every token. Skips - // whitespace and comments, and. - - Tokenizer.prototype.skipSpace = function skipSpace() { - loop: while (this.state.pos < this.input.length) { - var ch = this.input.charCodeAt(this.state.pos); - switch (ch) { - case 32:case 160: - // ' ' - ++this.state.pos; - break; - - case 13: - if (this.input.charCodeAt(this.state.pos + 1) === 10) { - ++this.state.pos; - } - - case 10:case 8232:case 8233: - ++this.state.pos; - ++this.state.curLine; - this.state.lineStart = this.state.pos; - break; - - case 47: - // '/' - switch (this.input.charCodeAt(this.state.pos + 1)) { - case 42: - // '*' - this.skipBlockComment(); - break; - - case 47: - this.skipLineComment(2); - break; - - default: - break loop; - } - break; - - default: - if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { - ++this.state.pos; - } else { - break loop; - } - } - } - }; - - // Called at the end of every token. Sets `end`, `val`, and - // maintains `context` and `exprAllowed`, and skips the space after - // the token, so that the next one's `start` will point at the - // right position. - - Tokenizer.prototype.finishToken = function finishToken(type, val) { - this.state.end = this.state.pos; - this.state.endLoc = this.state.curPosition(); - var prevType = this.state.type; - this.state.type = type; - this.state.value = val; - - this.updateContext(prevType); - }; - - // ### Token reading - - // This is the function that is called to fetch the next token. It - // is somewhat obscure, because it works in character codes rather - // than characters, and because operator parsing has been inlined - // into it. - // - // All in the name of speed. - // - - - Tokenizer.prototype.readToken_dot = function readToken_dot() { - var next = this.input.charCodeAt(this.state.pos + 1); - if (next >= 48 && next <= 57) { - return this.readNumber(true); - } - - var next2 = this.input.charCodeAt(this.state.pos + 2); - if (next === 46 && next2 === 46) { - // 46 = dot '.' - this.state.pos += 3; - return this.finishToken(types.ellipsis); - } else { - ++this.state.pos; - return this.finishToken(types.dot); - } - }; - - Tokenizer.prototype.readToken_slash = function readToken_slash() { - // '/' - if (this.state.exprAllowed) { - ++this.state.pos; - return this.readRegexp(); - } - - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.slash, 1); - } - }; - - Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { - // '%*' - var type = code === 42 ? types.star : types.modulo; - var width = 1; - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === 42) { - // '*' - width++; - next = this.input.charCodeAt(this.state.pos + 2); - type = types.exponent; - } - - if (next === 61) { - width++; - type = types.assign; - } - - return this.finishOp(type, width); - }; - - Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { - // '|&' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); - if (next === 61) return this.finishOp(types.assign, 2); - if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); - return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); - }; - - Tokenizer.prototype.readToken_caret = function readToken_caret() { - // '^' - var next = this.input.charCodeAt(this.state.pos + 1); - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.bitwiseXOR, 1); - } - }; - - Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { - // '+-' - var next = this.input.charCodeAt(this.state.pos + 1); - - if (next === code) { - if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { - // A `-->` line comment - this.skipLineComment(3); - this.skipSpace(); - return this.nextToken(); - } - return this.finishOp(types.incDec, 2); - } - - if (next === 61) { - return this.finishOp(types.assign, 2); - } else { - return this.finishOp(types.plusMin, 1); - } - }; - - Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { - // '<>' - var next = this.input.charCodeAt(this.state.pos + 1); - var size = 1; - - if (next === code) { - size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; - if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); - return this.finishOp(types.bitShift, size); - } - - if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { - if (this.inModule) this.unexpected(); - // ` - -**Do you want to request a *feature* or report a *bug*?** - - -**What is the current behavior?** - -**If the current behavior is a bug, please provide the steps to reproduce.** - - -**What is the expected behavior?** - -**If this is a feature request, what is motivation or use case for changing the behavior?** - -**Please mention other relevant information such as your webpack version, Node.js version and Operating System.** diff --git a/node_modules/css-loader/.github/PULL_REQUEST_TEMPLATE.md b/node_modules/css-loader/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 7c75fb3..0000000 --- a/node_modules/css-loader/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,18 +0,0 @@ - - -**What kind of change does this PR introduce?** - - -**Did you add tests for your changes?** - -**If relevant, did you update the README?** - -**Summary** - - - - -**Does this PR introduce a breaking change?** - - -**Other information** diff --git a/node_modules/css-loader/.npmignore b/node_modules/css-loader/.npmignore deleted file mode 100644 index b790333..0000000 --- a/node_modules/css-loader/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -coverage -test \ No newline at end of file diff --git a/node_modules/css-loader/.travis.yml b/node_modules/css-loader/.travis.yml deleted file mode 100644 index 1dcff74..0000000 --- a/node_modules/css-loader/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -sudo: false -language: node_js -node_js: - - "0.12" - - "node" - - "iojs" -script: npm run travis - -after_success: - - cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose - - cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js - - rm -rf ./coverage diff --git a/node_modules/css-loader/README.md b/node_modules/css-loader/README.md deleted file mode 100644 index 55674fc..0000000 --- a/node_modules/css-loader/README.md +++ /dev/null @@ -1,280 +0,0 @@ -# css loader for webpack - -## installation - -`npm install css-loader --save-dev` - -## Usage - -[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) - -``` javascript -var css = require("css-loader!./file.css"); -// => returns css code from file.css, resolves imports and url(...) -``` - -`@import` and `url(...)` are interpreted like `require()` and will be resolved by the css-loader. -Good loaders for requiring your assets are the [file-loader](https://github.com/webpack/file-loader) -and the [url-loader](https://github.com/webpack/url-loader) which you should specify in your config (see below). - -To be compatible with existing css files (if not in CSS Module mode): -* `url(image.png)` => `require("./image.png")` -* `url(~module/image.png)` => `require("module/image.png")` - -### Example config - -This webpack config can load css files, embed small png images as Data Urls and jpg images as files. - -``` javascript -module.exports = { - module: { - loaders: [ - { test: /\.css$/, loader: "style-loader!css-loader" }, - { test: /\.png$/, loader: "url-loader?limit=100000" }, - { test: /\.jpg$/, loader: "file-loader" } - ] - } -}; -``` - -### 'Root-relative' urls - -For urls that start with a `/`, the default behavior is to not translate them: -* `url(/image.png)` => `url(/image.png)` - -If a `root` query parameter is set, however, it will be prepended to the url -and then translated: - -With a config like: - -``` javascript - loaders: [ - { test: /\.css$/, loader: "style-loader!css-loader?root=." }, - ... - ] -``` - -The result is: - -* `url(/image.png)` => `require("./image.png")` - -Using 'Root-relative' urls is not recommended. You should only use it for legacy CSS files. - -### Local scope - -By default CSS exports all class names into a global selector scope. Styles can be locally scoped to avoid globally scoping styles. - -The syntax `:local(.className)` can be used to declare `className` in the local scope. The local identifiers are exported by the module. - -With `:local` (without brackets) local mode can be switched on for this selector. `:global(.className)` can be used to declare an explicit global selector. With `:global` (without brackets) global mode can be switched on for this selector. - -The loader replaces local selectors with unique identifiers. The choosen unique identifiers are exported by the module. - -Example: - -``` css -:local(.className) { background: red; } -:local .className { color: green; } -:local(.className .subClass) { color: green; } -:local .className .subClass :global(.global-class-name) { color: blue; } -``` - -is transformed to - -``` css -._23_aKvs-b8bW2Vg3fwHozO { background: red; } -._23_aKvs-b8bW2Vg3fwHozO { color: green; } -._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 { color: green; } -._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 .global-class-name { color: blue; } -``` - -and the identifiers are exported: - -``` js -exports.locals = { - className: "_23_aKvs-b8bW2Vg3fwHozO", - subClass: "_13LGdX8RMStbBE9w-t0gZ1" -} -``` - -Camelcasing is recommended for local selectors. They are easier to use in the importing javascript module. - -`url(...)` URLs in block scoped (`:local .abc`) rules behave like requests in modules: - * `./file.png` instead of `file.png` - * `module/file.png` instead of `~module/file.png` - - -You can use `:local(#someId)`, but this is not recommended. Use classes instead of ids. - -You can configure the generated ident with the `localIdentName` query parameter (default `[hash:base64]`). Example: `css-loader?localIdentName=[path][name]---[local]---[hash:base64:5]` for easier debugging. - -You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema. Note that this requires `webpack@2` since to be able to pass function in. For example: - -```js -{ - test: /\.css$/, - loaders: [ - { - loader: 'css-loader', - query: { - modules: true, - importLoaders: 1, - getLocalIdent: function (loaderContext, localIdentName, localName, options) { - return 'whatever_random_class_name' - } - } - } - ] -}, -``` - - -Note: For prerendering with extract-text-webpack-plugin you should use `css-loader/locals` instead of `style-loader!css-loader` **in the prerendering bundle**. It doesn't embed CSS but only exports the identifier mappings. - -### CSS Modules - -See [CSS Modules](https://github.com/css-modules/css-modules). - -The query parameter `modules` enables the **CSS Modules** spec. (`css-loader?modules`) - -This enables Local scoped CSS by default. (You can switch it off with `:global(...)` or `:global` for selectors and/or rules.) - -### Composing CSS classes - -When declaring a local class name you can compose a local class from another local class name. - -``` css -:local(.className) { - background: red; - color: yellow; -} - -:local(.subClass) { - composes: className; - background: blue; -} -``` - -This doesn't result in any change to the CSS itself but exports multiple class names: - -``` js -exports.locals = { - className: "_23_aKvs-b8bW2Vg3fwHozO", - subClass: "_13LGdX8RMStbBE9w-t0gZ1 _23_aKvs-b8bW2Vg3fwHozO" -} -``` - -and CSS is transformed to: - -``` css -._23_aKvs-b8bW2Vg3fwHozO { - background: red; - color: yellow; -} - -._13LGdX8RMStbBE9w-t0gZ1 { - background: blue; -} -``` - -### Importing local class names - -To import a local class name from another module: - -``` css -:local(.continueButton) { - composes: button from "library/button.css"; - background: red; -} -``` - -``` css -:local(.nameEdit) { - composes: edit highlight from "./edit.css"; - background: red; -} -``` - -To import from multiple modules use multiple `composes:` rules. - -``` css -:local(.className) { - composes: edit hightlight from "./edit.css"; - composes: button from "module/button.css"; - composes: classFromThisModule; - background: red; -} -``` - -### SourceMaps - -To include SourceMaps set the `sourceMap` query param. - -`require("css-loader?sourceMap!./file.css")` - -I. e. the extract-text-webpack-plugin can handle them. - -They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS SourceMap do not). In addition to that relative paths are buggy and you need to use an absolute public path which include the server url. - -### importing and chained loaders - -The query parameter `importLoaders` allow to configure which loaders should be applied to `@import`ed resources. - -`importLoaders` (int): That many loaders after the css-loader are used to import resources. - -Examples: - -``` js -require("style-loader!css-loader?importLoaders=1!postcss-loader!...") -// => imported resources are handled this way: -require("css-loader?importLoaders=1!postcss-loader!...") - -require("style-loader!css-loader!stylus-loader!...") -// => imported resources are handled this way: -require("css-loader!...") -``` - -This may change in the future, when the module system (i. e. webpack) supports loader matching by origin. - -### Minification - -By default the css-loader minimizes the css if specified by the module system. - -In some cases the minification is destructive to the css, so you can provide some options to it. cssnano is used for minification and you find a [list of options here](http://cssnano.co/options/). Just provide them as query parameter: i. e. `require("css-loader?-colormin")` to disable making color values as small as possible. - -You can also disable or enforce minification with the `minimize` query parameter. - -`require("css-loader?minimize!./file.css")` (enforced) - -`require("css-loader?-minimize!./file.css")` (disabled) - -### Disable behavior - -`css-loader?-url` disables `url(...)` handling. - -`css-loader?-import` disables `@import` handling. - -### Camel case - -By default, the exported JSON keys mirror the class names. If you want to camelize class names (useful in Javascript), pass the query parameter `camelCase` to the loader. - -Example: - -`css-loader?camelCase` - -Usage: -```css -/* file.css */ - -.class-name { /* ... */ } -``` - -```js -// javascript - -require('file.css').className -``` - -## License - -MIT (http://www.opensource.org/licenses/mit-license.php) diff --git a/node_modules/css-loader/index.js b/node_modules/css-loader/index.js deleted file mode 100644 index 90c233f..0000000 --- a/node_modules/css-loader/index.js +++ /dev/null @@ -1,5 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -module.exports = require("./lib/loader"); diff --git a/node_modules/css-loader/lib/compile-exports.js b/node_modules/css-loader/lib/compile-exports.js deleted file mode 100644 index 6c75ba9..0000000 --- a/node_modules/css-loader/lib/compile-exports.js +++ /dev/null @@ -1,29 +0,0 @@ -var camelCase = require("lodash.camelcase"); - -function dashesCamelCase(str) { - return str.replace(/-(\w)/g, function(match, firstLetter) { - return firstLetter.toUpperCase(); - }); -} - -module.exports = function compileExports(result, importItemMatcher, camelCaseKeys) { - if (!Object.keys(result.exports).length) { - return ""; - } - - var exportJs = Object.keys(result.exports).reduce(function(res, key) { - var valueAsString = JSON.stringify(result.exports[key]); - valueAsString = valueAsString.replace(result.importItemRegExpG, importItemMatcher); - res.push("\t" + JSON.stringify(key) + ": " + valueAsString); - - if (camelCaseKeys === true) { - res.push("\t" + JSON.stringify(camelCase(key)) + ": " + valueAsString); - } else if (camelCaseKeys === 'dashes') { - res.push("\t" + JSON.stringify(dashesCamelCase(key)) + ": " + valueAsString); - } - - return res; - }, []).join(",\n"); - - return "{\n" + exportJs + "\n}"; -}; diff --git a/node_modules/css-loader/lib/css-base.js b/node_modules/css-loader/lib/css-base.js deleted file mode 100644 index fae3c3b..0000000 --- a/node_modules/css-loader/lib/css-base.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -// css base code, injected by the css-loader -module.exports = function() { - var list = []; - - // return the list of modules as css string - list.toString = function toString() { - var result = []; - for(var i = 0; i < this.length; i++) { - var item = this[i]; - if(item[2]) { - result.push("@media " + item[2] + "{" + item[1] + "}"); - } else { - result.push(item[1]); - } - } - return result.join(""); - }; - - // import a list of modules into the list - list.i = function(modules, mediaQuery) { - if(typeof modules === "string") - modules = [[null, modules, ""]]; - var alreadyImportedModules = {}; - for(var i = 0; i < this.length; i++) { - var id = this[i][0]; - if(typeof id === "number") - alreadyImportedModules[id] = true; - } - for(i = 0; i < modules.length; i++) { - var item = modules[i]; - // skip already imported module - // this implementation is not 100% perfect for weird media query combinations - // when a module is imported multiple times with different media queries. - // I hope this will never occur (Hey this way we have smaller bundles) - if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { - if(mediaQuery && !item[2]) { - item[2] = mediaQuery; - } else if(mediaQuery) { - item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; - } - list.push(item); - } - } - }; - return list; -}; diff --git a/node_modules/css-loader/lib/getImportPrefix.js b/node_modules/css-loader/lib/getImportPrefix.js deleted file mode 100644 index 31fb23f..0000000 --- a/node_modules/css-loader/lib/getImportPrefix.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -module.exports = function getImportPrefix(loaderContext, query) { - if(query.importLoaders === false) - return ""; - var importLoaders = parseInt(query.importLoaders, 10) || 0; - var loadersRequest = loaderContext.loaders.slice( - loaderContext.loaderIndex, - loaderContext.loaderIndex + 1 + importLoaders - ).map(function(x) { return x.request; }).join("!"); - return "-!" + loadersRequest + "!"; -}; diff --git a/node_modules/css-loader/lib/getLocalIdent.js b/node_modules/css-loader/lib/getLocalIdent.js deleted file mode 100644 index 98de58b..0000000 --- a/node_modules/css-loader/lib/getLocalIdent.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var loaderUtils = require("loader-utils"); -var path = require("path"); - -module.exports = function getLocalIdent(loaderContext, localIdentName, localName, options) { - if(!options.context) - options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context; - var request = path.relative(options.context, loaderContext.resourcePath); - options.content = options.hashPrefix + request + "+" + localName; - localIdentName = localIdentName.replace(/\[local\]/gi, localName); - var hash = loaderUtils.interpolateName(loaderContext, localIdentName, options); - return hash.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-").replace(/^((-?[0-9])|--)/, "_$1"); -}; diff --git a/node_modules/css-loader/lib/loader.js b/node_modules/css-loader/lib/loader.js deleted file mode 100644 index 9731dad..0000000 --- a/node_modules/css-loader/lib/loader.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var path = require("path"); -var loaderUtils = require("loader-utils"); -var processCss = require("./processCss"); -var getImportPrefix = require("./getImportPrefix"); -var compileExports = require("./compile-exports"); - - -module.exports = function(content, map) { - if(this.cacheable) this.cacheable(); - var callback = this.async(); - var query = loaderUtils.parseQuery(this.query); - var root = query.root; - var moduleMode = query.modules || query.module; - var camelCaseKeys = query.camelCase || query.camelcase; - - if(map !== null && typeof map !== "string") { - map = JSON.stringify(map); - } - - processCss(content, map, { - mode: moduleMode ? "local" : "global", - from: loaderUtils.getRemainingRequest(this), - to: loaderUtils.getCurrentRequest(this), - query: query, - minimize: this.minimize, - loaderContext: this - }, function(err, result) { - if(err) return callback(err); - - var cssAsString = JSON.stringify(result.source); - - // for importing CSS - var importUrlPrefix = getImportPrefix(this, query); - - var alreadyImported = {}; - var importJs = result.importItems.filter(function(imp) { - if(!imp.mediaQuery) { - if(alreadyImported[imp.url]) - return false; - alreadyImported[imp.url] = true; - } - return true; - }).map(function(imp) { - if(!loaderUtils.isUrlRequest(imp.url, root)) { - return "exports.push([module.id, " + - JSON.stringify("@import url(" + imp.url + ");") + ", " + - JSON.stringify(imp.mediaQuery) + "]);"; - } else { - var importUrl = importUrlPrefix + imp.url; - return "exports.i(require(" + loaderUtils.stringifyRequest(this, importUrl) + "), " + JSON.stringify(imp.mediaQuery) + ");"; - } - }, this).join("\n"); - - function importItemMatcher(item) { - var match = result.importItemRegExp.exec(item); - var idx = +match[1]; - var importItem = result.importItems[idx]; - var importUrl = importUrlPrefix + importItem.url; - return "\" + require(" + loaderUtils.stringifyRequest(this, importUrl) + ").locals" + - "[" + JSON.stringify(importItem.export) + "] + \""; - } - - cssAsString = cssAsString.replace(result.importItemRegExpG, importItemMatcher.bind(this)); - if(query.url !== false) { - cssAsString = cssAsString.replace(result.urlItemRegExpG, function(item) { - var match = result.urlItemRegExp.exec(item); - var idx = +match[1]; - var urlItem = result.urlItems[idx]; - var url = urlItem.url; - idx = url.indexOf("?#"); - if(idx < 0) idx = url.indexOf("#"); - var urlRequest; - if(idx > 0) { // idx === 0 is catched by isUrlRequest - // in cases like url('webfont.eot?#iefix') - urlRequest = url.substr(0, idx); - return "\" + require(" + loaderUtils.stringifyRequest(this, urlRequest) + ") + \"" + - url.substr(idx); - } - urlRequest = url; - return "\" + require(" + loaderUtils.stringifyRequest(this, urlRequest) + ") + \""; - }.bind(this)); - } - - - var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys); - if (exportJs) { - exportJs = "exports.locals = " + exportJs + ";"; - } - - var moduleJs; - if(query.sourceMap && result.map) { - // add a SourceMap - map = result.map; - if(map.sources) { - map.sources = map.sources.map(function(source) { - source = source.split("!").pop(); - var p = path.relative(query.context || this.options.context, source).replace(/\\/g, "/"); - if(p.indexOf("../") !== 0) - p = "./" + p; - return "/" + p; - }, this); - map.sourceRoot = "webpack://"; - } - map.file = map.file.split("!").pop(); - map = JSON.stringify(map); - moduleJs = "exports.push([module.id, " + cssAsString + ", \"\", " + map + "]);"; - } else { - moduleJs = "exports.push([module.id, " + cssAsString + ", \"\"]);"; - } - - // embed runtime - callback(null, "exports = module.exports = require(" + loaderUtils.stringifyRequest(this, require.resolve("./css-base.js")) + ")();\n" + - "// imports\n" + - importJs + "\n\n" + - "// module\n" + - moduleJs + "\n\n" + - "// exports\n" + - exportJs); - }.bind(this)); -}; diff --git a/node_modules/css-loader/lib/localsLoader.js b/node_modules/css-loader/lib/localsLoader.js deleted file mode 100644 index d9ccfd6..0000000 --- a/node_modules/css-loader/lib/localsLoader.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var loaderUtils = require("loader-utils"); -var processCss = require("./processCss"); -var getImportPrefix = require("./getImportPrefix"); -var compileExports = require("./compile-exports"); - - -module.exports = function(content) { - if(this.cacheable) this.cacheable(); - var callback = this.async(); - var query = loaderUtils.parseQuery(this.query); - var moduleMode = query.modules || query.module; - var camelCaseKeys = query.camelCase || query.camelcase; - - processCss(content, null, { - mode: moduleMode ? "local" : "global", - query: query, - minimize: this.minimize, - loaderContext: this - }, function(err, result) { - if(err) return callback(err); - - // for importing CSS - var importUrlPrefix = getImportPrefix(this, query); - - function importItemMatcher(item) { - var match = result.importItemRegExp.exec(item); - var idx = +match[1]; - var importItem = result.importItems[idx]; - var importUrl = importUrlPrefix + importItem.url; - return "\" + require(" + loaderUtils.stringifyRequest(this, importUrl) + ")" + - "[" + JSON.stringify(importItem.export) + "] + \""; - } - - var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys); - if (exportJs) { - exportJs = "module.exports = " + exportJs + ";"; - } - - - callback(null, exportJs); - }.bind(this)); -}; diff --git a/node_modules/css-loader/lib/processCss.js b/node_modules/css-loader/lib/processCss.js deleted file mode 100644 index 2e0eac4..0000000 --- a/node_modules/css-loader/lib/processCss.js +++ /dev/null @@ -1,252 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var formatCodeFrame = require("babel-code-frame"); -var Tokenizer = require("css-selector-tokenizer"); -var postcss = require("postcss"); -var loaderUtils = require("loader-utils"); -var assign = require("object-assign"); -var getLocalIdent = require("./getLocalIdent"); - -var localByDefault = require("postcss-modules-local-by-default"); -var extractImports = require("postcss-modules-extract-imports"); -var modulesScope = require("postcss-modules-scope"); -var modulesValues = require("postcss-modules-values"); -var cssnano = require("cssnano"); - -var parserPlugin = postcss.plugin("css-loader-parser", function(options) { - return function(css) { - var imports = {}; - var exports = {}; - var importItems = []; - var urlItems = []; - - function replaceImportsInString(str) { - if(options.import) { - var tokens = str.split(/(\S+)/); - tokens = tokens.map(function (token) { - var importIndex = imports["$" + token]; - if(typeof importIndex === "number") { - return "___CSS_LOADER_IMPORT___" + importIndex + "___"; - } - return token; - }); - return tokens.join(""); - } - return str; - } - - if(options.import) { - css.walkAtRules("import", function(rule) { - var values = Tokenizer.parseValues(rule.params); - var url = values.nodes[0].nodes[0]; - if(url.type === "url") { - url = url.url; - } else if(url.type === "string") { - url = url.value; - } else throw rule.error("Unexpected format" + rule.params); - values.nodes[0].nodes.shift(); - var mediaQuery = Tokenizer.stringifyValues(values); - if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") { - url = loaderUtils.urlToRequest(url, options.root); - } - importItems.push({ - url: url, - mediaQuery: mediaQuery - }); - rule.remove(); - }); - } - - css.walkRules(function(rule) { - if(rule.selector === ":export") { - rule.walkDecls(function(decl) { - exports[decl.prop] = decl.value; - }); - rule.remove(); - } else if(/^:import\(.+\)$/.test(rule.selector)) { - var match = /^:import\((.+)\)$/.exec(rule.selector); - var url = loaderUtils.parseString(match[1]); - rule.walkDecls(function(decl) { - imports["$" + decl.prop] = importItems.length; - importItems.push({ - url: url, - export: decl.value - }); - }); - rule.remove(); - } - }); - - Object.keys(exports).forEach(function(exportName) { - exports[exportName] = replaceImportsInString(exports[exportName]); - }); - - function processNode(item) { - switch (item.type) { - case "value": - item.nodes.forEach(processNode); - break; - case "nested-item": - item.nodes.forEach(processNode); - break; - case "item": - var importIndex = imports["$" + item.name]; - if (typeof importIndex === "number") { - item.name = "___CSS_LOADER_IMPORT___" + importIndex + "___"; - } - break; - case "url": - if (options.url && !/^#/.test(item.url) && loaderUtils.isUrlRequest(item.url, options.root)) { - item.stringType = ""; - delete item.innerSpacingBefore; - delete item.innerSpacingAfter; - var url = item.url; - item.url = "___CSS_LOADER_URL___" + urlItems.length + "___"; - urlItems.push({ - url: url - }); - } - break; - } - } - - css.walkDecls(function(decl) { - var values = Tokenizer.parseValues(decl.value); - values.nodes.forEach(function(value) { - value.nodes.forEach(processNode); - }); - decl.value = Tokenizer.stringifyValues(values); - }); - css.walkAtRules(function(atrule) { - if(typeof atrule.params === "string") { - atrule.params = replaceImportsInString(atrule.params); - } - }); - - options.importItems = importItems; - options.urlItems = urlItems; - options.exports = exports; - }; -}); - -module.exports = function processCss(inputSource, inputMap, options, callback) { - var query = options.query; - var root = query.root; - var context = query.context; - var localIdentName = query.localIdentName || "[hash:base64]"; - var localIdentRegExp = query.localIdentRegExp; - var forceMinimize = query.minimize; - var minimize = typeof forceMinimize !== "undefined" ? !!forceMinimize : options.minimize; - - var customGetLocalIdent = query.getLocalIdent || getLocalIdent; - - var parserOptions = { - root: root, - mode: options.mode, - url: query.url !== false, - import: query.import !== false - }; - - var pipeline = postcss([ - localByDefault({ - mode: options.mode, - rewriteUrl: function(global, url) { - if(parserOptions.url){ - if(!loaderUtils.isUrlRequest(url, root)) { - return url; - } - if(global) { - return loaderUtils.urlToRequest(url, root); - } - } - return url; - } - }), - extractImports(), - modulesValues, - modulesScope({ - generateScopedName: function generateScopedName (exportName) { - return customGetLocalIdent(options.loaderContext, localIdentName, exportName, { - regExp: localIdentRegExp, - hashPrefix: query.hashPrefix || "", - context: context - }); - } - }), - parserPlugin(parserOptions) - ]); - - if(minimize) { - var minimizeOptions = assign({}, query); - ["zindex", "normalizeUrl", "discardUnused", "mergeIdents", "reduceIdents", "autoprefixer"].forEach(function(name) { - if(typeof minimizeOptions[name] === "undefined") - minimizeOptions[name] = false; - }); - pipeline.use(cssnano(minimizeOptions)); - } - - pipeline.process(inputSource, { - // we need a prefix to avoid path rewriting of PostCSS - from: "/css-loader!" + options.from, - to: options.to, - map: { - prev: inputMap, - sourcesContent: true, - inline: false, - annotation: false - } - }).then(function(result) { - callback(null, { - source: result.css, - map: result.map && result.map.toJSON(), - exports: parserOptions.exports, - importItems: parserOptions.importItems, - importItemRegExpG: /___CSS_LOADER_IMPORT___([0-9]+)___/g, - importItemRegExp: /___CSS_LOADER_IMPORT___([0-9]+)___/, - urlItems: parserOptions.urlItems, - urlItemRegExpG: /___CSS_LOADER_URL___([0-9]+)___/g, - urlItemRegExp: /___CSS_LOADER_URL___([0-9]+)___/ - }); - }).catch(function(err) { - if (err.name === 'CssSyntaxError') { - var wrappedError = new CSSLoaderError( - 'Syntax Error', - err.reason, - err.line != null && err.column != null - ? {line: err.line, column: err.column} - : null, - err.input.source - ); - callback(wrappedError); - } else { - callback(err); - } - }); -}; - -function formatMessage(message, loc, source) { - var formatted = message; - if (loc) { - formatted = formatted - + ' (' + loc.line + ':' + loc.column + ')'; - } - if (loc && source) { - formatted = formatted - + '\n\n' + formatCodeFrame(source, loc.line, loc.column) + '\n'; - } - return formatted; -} - -function CSSLoaderError(name, message, loc, source, error) { - Error.call(this); - Error.captureStackTrace(this, CSSLoaderError); - this.name = name; - this.error = error; - this.message = formatMessage(message, loc, source); - this.hideStack = true; -} - -CSSLoaderError.prototype = Object.create(Error.prototype); -CSSLoaderError.prototype.constructor = CSSLoaderError; diff --git a/node_modules/css-loader/locals.js b/node_modules/css-loader/locals.js deleted file mode 100644 index 8314b98..0000000 --- a/node_modules/css-loader/locals.js +++ /dev/null @@ -1,5 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -module.exports = require("./lib/localsLoader"); diff --git a/node_modules/css-loader/package.json b/node_modules/css-loader/package.json deleted file mode 100644 index 9309c2c..0000000 --- a/node_modules/css-loader/package.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "css-loader", - "scope": null, - "escapedName": "css-loader", - "name": "css-loader", - "rawSpec": "", - "spec": "latest", - "type": "tag" - }, - "/home/nanosat/web/boilerplate-static-html" - ] - ], - "_from": "css-loader@latest", - "_id": "css-loader@0.26.1", - "_inCache": true, - "_location": "/css-loader", - "_nodeVersion": "6.9.1", - "_npmOperationalInternal": { - "host": "packages-18-east.internal.npmjs.com", - "tmp": "tmp/css-loader-0.26.1.tgz_1480687506283_0.7062110011465847" - }, - "_npmUser": { - "name": "sokra", - "email": "tobias.koppers@googlemail.com" - }, - "_npmVersion": "3.10.8", - "_phantomChildren": {}, - "_requested": { - "raw": "css-loader", - "scope": null, - "escapedName": "css-loader", - "name": "css-loader", - "rawSpec": "", - "spec": "latest", - "type": "tag" - }, - "_requiredBy": [ - "#DEV:/", - "#USER" - ], - "_resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.26.1.tgz", - "_shasum": "2ba7f20131b93597496b3e9bb500785a49cd29ea", - "_shrinkwrap": null, - "_spec": "css-loader", - "_where": "/home/nanosat/web/boilerplate-static-html", - "author": { - "name": "Tobias Koppers @sokra" - }, - "bugs": { - "url": "https://github.com/webpack/css-loader/issues" - }, - "dependencies": { - "babel-code-frame": "^6.11.0", - "css-selector-tokenizer": "^0.7.0", - "cssnano": ">=2.6.1 <4", - "loader-utils": "~0.2.2", - "lodash.camelcase": "^4.3.0", - "object-assign": "^4.0.1", - "postcss": "^5.0.6", - "postcss-modules-extract-imports": "^1.0.0", - "postcss-modules-local-by-default": "^1.0.1", - "postcss-modules-scope": "^1.0.0", - "postcss-modules-values": "^1.1.0", - "source-list-map": "^0.1.4" - }, - "description": "css loader module for webpack", - "devDependencies": { - "codecov.io": "^0.1.2", - "coveralls": "^2.11.2", - "istanbul": "^0.4.5", - "mocha": "^3.1.2", - "should": "^11.1.1" - }, - "directories": {}, - "dist": { - "shasum": "2ba7f20131b93597496b3e9bb500785a49cd29ea", - "tarball": "https://registry.npmjs.org/css-loader/-/css-loader-0.26.1.tgz" - }, - "engines": { - "node": ">=0.12.0" - }, - "gitHead": "5b856b2c923cad34763486e43254db4c49d25f4e", - "homepage": "https://github.com/webpack/css-loader#readme", - "license": "MIT", - "maintainers": [ - { - "name": "markdalgleish", - "email": "mark.john.dalgleish@gmail.com" - }, - { - "name": "sokra", - "email": "tobias.koppers@googlemail.com" - }, - { - "name": "spacek33z", - "email": "kees@webduck.nl" - } - ], - "name": "css-loader", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/webpack/css-loader.git" - }, - "scripts": { - "cover": "istanbul cover node_modules/mocha/bin/_mocha", - "publish-patch": "mocha && npm version patch && git push && git push --tags && npm publish", - "test": "mocha", - "travis": "npm run cover -- --report lcovonly" - }, - "version": "0.26.1" -} diff --git a/node_modules/css-selector-tokenizer/README.md b/node_modules/css-selector-tokenizer/README.md deleted file mode 100644 index 5d80690..0000000 --- a/node_modules/css-selector-tokenizer/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# CSS Modules: CSS selector Tokenizer - -Parses and stringifies CSS selectors. - -``` js -import Tokenizer from "css-selector-tokenizer"; - -let input = "a#content.active > div::first-line [data-content], a:not(:visited)"; - -Tokenizer.parse(input); // === expected -let expected = { - type: "selectors", - nodes: [ - { - type: "selector", - nodes: [ - { type: "element", name: "a" }, - { type: "id", name: "content" }, - { type: "class", name: "active" }, - { type: "operator", operator: ">", before: " ", after: " " }, - { type: "element", name: "div" }, - { type: "pseudo-element", name: "first-line" }, - { type: "spacing", value: " " }, - { type: "attribute", content: "data-content" }, - ] - }, - { - type: "selector", - nodes: [ - { type: "element", name: "a" }, - { type: "nested-pseudo-class", name: "not", nodes: [ - { - type: "selector", - nodes: [ - { type: "pseudo-class", name: "visited" } - ] - } - ] } - ], - before: " " - } - ] -} - -Tokenizer.stringify(expected) // === input - -// * => { type: "universal" } -// foo|element = { type: "element", name: "element", namespace: "foo" } -// *|* = { type: "universal", namespace: "*" } -// :has(h1, h2) => { type: "nested-pseudo-class", name: "has", nodes: [ -// { -// type: "selector", -// nodes: [ -// { type: "element", name: "h1" } -// ] -// }, -// { -// type: "selector", -// nodes: [ -// { type: "element", name: "h2" } -// ], -// before: " " -// } -// ] } -``` - -## Building - -``` -npm install -npm test -``` - -[![Build Status](https://travis-ci.org/css-modules/css-selector-tokenizer.svg?branch=master)](https://travis-ci.org/css-modules/css-selector-tokenizer) - -* Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/css-selector-tokenizer/badge.svg?branch=master)](https://coveralls.io/r/css-modules/css-selector-tokenizer?branch=master) -* Statements: [![codecov.io](http://codecov.io/github/css-modules/css-selector-tokenizer/coverage.svg?branch=master)](http://codecov.io/github/css-modules/css-selector-tokenizer?branch=master) - -## Development - -- `npm autotest` will watch `lib` and `test` for changes and retest - -## License - -MIT - -## With thanks - -- Mark Dalgleish -- Glen Maddern -- Guy Bedford - ---- -Tobias Koppers, 2015. diff --git a/node_modules/css-selector-tokenizer/lib/index.js b/node_modules/css-selector-tokenizer/lib/index.js deleted file mode 100644 index c1caeb8..0000000 --- a/node_modules/css-selector-tokenizer/lib/index.js +++ /dev/null @@ -1,4 +0,0 @@ -exports.parse = require("./parse"); -exports.stringify = require("./stringify"); -exports.parseValues = require("./parseValues"); -exports.stringifyValues = require("./stringifyValues"); diff --git a/node_modules/css-selector-tokenizer/lib/parse.js b/node_modules/css-selector-tokenizer/lib/parse.js deleted file mode 100644 index 692373b..0000000 --- a/node_modules/css-selector-tokenizer/lib/parse.js +++ /dev/null @@ -1,239 +0,0 @@ -"use strict"; - -var Parser = require("fastparse"); -var regexpu = require("regexpu-core"); - -function unescape(str) { - return str.replace(/\\(.)/g, "$1"); -} - -function commentMatch(match, content) { - this.selector.nodes.push({ - type: "comment", - content: content - }); -} - -function typeMatch(type) { - return function(match, name) { - this.selector.nodes.push({ - type: type, - name: unescape(name) - }); - }; -} - -function pseudoClassStartMatch(match, name) { - var newToken = { - type: "pseudo-class", - name: unescape(name), - content: "" - }; - this.selector.nodes.push(newToken); - this.token = newToken; - this.brackets = 1; - return "inBrackets"; -} - -function nestedPseudoClassStartMatch(match, name, after) { - var newSelector = { - type: "selector", - nodes: [] - }; - var newToken = { - type: "nested-pseudo-class", - name: unescape(name), - nodes: [newSelector] - }; - if(after) { - newSelector.before = after; - } - this.selector.nodes.push(newToken); - this.stack.push(this.root); - this.root = newToken; - this.selector = newSelector; -} - -function nestedEnd(match, before) { - if(this.stack.length > 0) { - if(before) { - this.selector.after = before; - } - this.root = this.stack.pop(); - this.selector = this.root.nodes[this.root.nodes.length - 1]; - } else { - this.selector.nodes.push({ - type: "invalid", - value: match - }); - } -} - -function operatorMatch(match, before, operator, after) { - var token = { - type: "operator", - operator: operator - }; - if(before) { - token.before = before; - } - if(after) { - token.after = after; - } - this.selector.nodes.push(token); -} - -function spacingMatch(match) { - this.selector.nodes.push({ - type: "spacing", - value: match - }); -} - -function elementMatch(match, namespace, name) { - var newToken = { - type: "element", - name: unescape(name) - }; - - if(namespace) { - newToken.namespace = unescape(namespace.substr(0, namespace.length - 1)); - } - this.selector.nodes.push(newToken); -} - -function universalMatch(match, namespace) { - var newToken = { - type: "universal" - }; - if(namespace) { - newToken.namespace = unescape(namespace.substr(0, namespace.length - 1)); - } - this.selector.nodes.push(newToken); -} - -function attributeMatch(match, content) { - this.selector.nodes.push({ - type: "attribute", - content: content - }); -} - -function invalidMatch(match) { - this.selector.nodes.push({ - type: "invalid", - value: match - }); -} - -function irrelevantSpacingStartMatch(match) { - this.selector.before = match; -} - -function irrelevantSpacingEndMatch(match) { - this.selector.after = match; -} - -function nextSelectorMatch(match, before, after) { - var newSelector = { - type: "selector", - nodes: [] - }; - if(before) { - this.selector.after = before; - } - if(after) { - newSelector.before = after; - } - this.root.nodes.push(newSelector); - this.selector = newSelector; -} - -function addToCurrent(match) { - this.token.content += match; -} - -function bracketStart(match) { - this.token.content += match; - this.brackets++; -} - -function bracketEnd(match) { - if(--this.brackets === 0) { - return "selector"; - } - this.token.content += match; -} - -function getSelectors() { - // The assignment here is split to preserve the property enumeration order. - var selectors = { - "/\\*([\\s\\S]*?)\\*/": commentMatch - }; - // https://www.w3.org/TR/CSS21/syndata.html#characters - // 4.1.3: identifiers (...) can contain only the characters [a-zA-Z0-9] and - // ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_) - // - // 10ffff is the maximum allowed in current Unicode - selectors[regexpu("\\.((?:\\\\.|[A-Za-z_\\-\\u{00a0}-\\u{10ffff}])(?:\\\\.|[A-Za-z_\\-0-9\\u{00a0}-\\u{10ffff}])*)", "u")] = typeMatch("class"); - selectors[regexpu("#((?:\\\\.|[A-Za-z_\\-\\u{00a0}-\\u{10ffff}])(?:\\\\.|[A-Za-z_\\-0-9\\u{00a0}-\\u{10ffff}])*)", "u")] = typeMatch("id"); - var selectorsSecondHalf = { - ":(not|matches|has|local|global)\\((\\s*)": nestedPseudoClassStartMatch, - ":((?:\\\\.|[A-Za-z_\\-0-9])+)\\(": pseudoClassStartMatch, - ":((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-class"), - "::((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-element"), - "(\\*\\|)((?:\\\\.|[A-Za-z_\\-0-9])+)": elementMatch, - "(\\*\\|)\\*": universalMatch, - "((?:\\\\.|[A-Za-z_\\-0-9])*\\|)?\\*": universalMatch, - "((?:\\\\.|[A-Za-z_\\-0-9])*\\|)?((?:\\\\.|[A-Za-z_\\-])(?:\\\\.|[A-Za-z_\\-0-9])*)": elementMatch, - "\\[([^\\]]+)\\]": attributeMatch, - "(\\s*)\\)": nestedEnd, - "(\\s*)((?:\\|\\|)|(?:>>)|[>+~])(\\s*)": operatorMatch, - "(\\s*),(\\s*)": nextSelectorMatch, - "\\s+$": irrelevantSpacingEndMatch, - "^\\s+": irrelevantSpacingStartMatch, - "\\s+": spacingMatch, - ".": invalidMatch - }; - var selector; - for (selector in selectorsSecondHalf) { - if (Object.prototype.hasOwnProperty.call(selectorsSecondHalf, selector)) { - selectors[selector] = selectorsSecondHalf[selector]; - } - } - return selectors; -} - -var parser = new Parser({ - selector: getSelectors(), - inBrackets: { - "/\\*[\\s\\S]*?\\*/": addToCurrent, - "\"([^\\\\\"]|\\\\.)*\"": addToCurrent, - "'([^\\\\']|\\\\.)*'": addToCurrent, - "[^()'\"/]+": addToCurrent, - "\\(": bracketStart, - "\\)": bracketEnd, - ".": addToCurrent - } -}); - -function parse(str) { - var selectorNode = { - type: "selector", - nodes: [] - }; - var rootNode = { - type: "selectors", - nodes: [ - selectorNode - ] - }; - parser.parse("selector", str, { - stack: [], - root: rootNode, - selector: selectorNode - }); - return rootNode; -} - -module.exports = parse; diff --git a/node_modules/css-selector-tokenizer/lib/parseValues.js b/node_modules/css-selector-tokenizer/lib/parseValues.js deleted file mode 100644 index 97be01b..0000000 --- a/node_modules/css-selector-tokenizer/lib/parseValues.js +++ /dev/null @@ -1,167 +0,0 @@ -"use strict"; - -var Parser = require("fastparse"); - -function commentMatch(match, content) { - this.value.nodes.push({ - type: "comment", - content: content - }); -} - -function spacingMatch(match) { - var item = this.value.nodes[this.value.nodes.length - 1]; - item.after = (item.after || "") + match; -} - -function initialSpacingMatch(match) { - this.value.before = match; -} - -function endSpacingMatch(match) { - this.value.after = match; -} - -function unescapeString(content) { - return content.replace(/\\(?:([a-fA-F0-9]{1,6})|(.))/g, function(all, unicode, otherCharacter) { - if (otherCharacter) { - return otherCharacter; - } - - var C = parseInt(unicode, 16); - if(C < 0x10000) { - return String.fromCharCode(C); - } else { - return String.fromCharCode(Math.floor((C - 0x10000) / 0x400) + 0xD800) + - String.fromCharCode((C - 0x10000) % 0x400 + 0xDC00); - } - }); -} - -function stringMatch(match, content) { - var value = unescapeString(content); - this.value.nodes.push({ - type: "string", - value: value, - stringType: match[0] - }); -} - -function commaMatch(match, spacing) { - var newValue = { - type: "value", - nodes: [] - }; - if(spacing) { - newValue.before = spacing; - } - this.root.nodes.push(newValue); - this.value = newValue; -} - -function itemMatch(match) { - this.value.nodes.push({ - type: "item", - name: match - }); -} - -function nestedItemMatch(match, name, spacing) { - this.stack.push(this.root); - this.root = { - type: "nested-item", - name: name, - nodes: [ - { type: "value", nodes: [] } - ] - }; - if(spacing) { - this.root.nodes[0].before = spacing; - } - this.value.nodes.push(this.root); - this.value = this.root.nodes[0]; -} - -function nestedItemEndMatch(match, spacing, remaining) { - if(this.stack.length === 0) { - if(spacing) { - var item = this.value.nodes[this.value.nodes.length - 1]; - item.after = (item.after || "") + spacing; - } - this.value.nodes.push({ - type: "invalid", - value: remaining - }); - } else { - if(spacing) { - this.value.after = spacing; - } - this.root = this.stack.pop(); - this.value = this.root.nodes[this.root.nodes.length - 1]; - } -} - -function urlMatch(match, innerSpacingBefore, content, innerSpacingAfter) { - var item = { - type: "url" - }; - if(innerSpacingBefore) { - item.innerSpacingBefore = innerSpacingBefore; - } - if(innerSpacingAfter) { - item.innerSpacingAfter = innerSpacingAfter; - } - switch(content[0]) { - case "\"": - item.stringType = "\""; - item.url = unescapeString(content.substr(1, content.length - 2)); - break; - case "'": - item.stringType = "'"; - item.url = unescapeString(content.substr(1, content.length - 2)); - break; - default: - item.url = unescapeString(content); - break; - } - this.value.nodes.push(item); -} - -var parser = new Parser({ - decl: { - "^\\s+": initialSpacingMatch, - "/\\*([\\s\\S]*?)\\*/": commentMatch, - "\"((?:[^\\\\\"]|\\\\.)*)\"": stringMatch, - "'((?:[^\\\\']|\\\\.)*)'": stringMatch, - "url\\((\\s*)(\"(?:[^\\\\\"]|\\\\.)*\")(\\s*)\\)": urlMatch, - "url\\((\\s*)('(?:[^\\\\']|\\\\.)*')(\\s*)\\)": urlMatch, - "url\\((\\s*)((?:[^\\\\)'\"]|\\\\.)*)(\\s*)\\)": urlMatch, - "([\\w\-]+)\\((\\s*)": nestedItemMatch, - "(\\s*)(\\))": nestedItemEndMatch, - ",(\\s*)": commaMatch, - "\\s+$": endSpacingMatch, - "\\s+": spacingMatch, - "[^\\s,\)]+": itemMatch - } -}); - -function parseValues(str) { - var valueNode = { - type: "value", - nodes: [] - }; - var rootNode = { - type: "values", - nodes: [ - valueNode - ] - }; - parser.parse("decl", str, { - stack: [], - root: rootNode, - value: valueNode - }); - return rootNode; -} - -module.exports = parseValues; diff --git a/node_modules/css-selector-tokenizer/lib/stringify.js b/node_modules/css-selector-tokenizer/lib/stringify.js deleted file mode 100644 index 1c9d6aa..0000000 --- a/node_modules/css-selector-tokenizer/lib/stringify.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -var stringify; - -var regexpu = require("regexpu-core"); -var identifierEscapeRegexp = new RegExp( - regexpu("(^[^A-Za-z_\\-\\u{00a0}-\\u{10ffff}]|^\\-\\-|[^A-Za-z_0-9\\-\\u{00a0}-\\u{10ffff}])", "ug"), - "g" -); - -function escape(str, identifier) { - if(str === "*") { - return "*"; - } - if (identifier) { - return str.replace(identifierEscapeRegexp, "\\$1"); - } else { - return str.replace(/(^[^A-Za-z_\\-]|^\-\-|[^A-Za-z_0-9\\-])/g, "\\$1"); - } -} - -function stringifyWithoutBeforeAfter(tree) { - switch(tree.type) { - case "selectors": - return tree.nodes.map(stringify).join(","); - case "selector": - return tree.nodes.map(stringify).join(""); - case "element": - return (typeof tree.namespace === "string" ? escape(tree.namespace) + "|" : "") + escape(tree.name); - case "class": - return "." + escape(tree.name, true); - case "id": - return "#" + escape(tree.name, true); - case "attribute": - return "[" + tree.content + "]"; - case "spacing": - return tree.value; - case "pseudo-class": - return ":" + escape(tree.name) + (typeof tree.content === "string" ? "(" + tree.content + ")" : ""); - case "nested-pseudo-class": - return ":" + escape(tree.name) + "(" + tree.nodes.map(stringify).join(",") + ")"; - case "pseudo-element": - return "::" + escape(tree.name); - case "universal": - return (typeof tree.namespace === "string" ? escape(tree.namespace) + "|" : "") + "*"; - case "operator": - return tree.operator; - case "comment": - return "/*" + tree.content + "*/"; - case "invalid": - return tree.value; - } -} - - -stringify = function stringify(tree) { - var str = stringifyWithoutBeforeAfter(tree); - if(tree.before) { - str = tree.before + str; - } - if(tree.after) { - str = str + tree.after; - } - return str; -}; - -module.exports = stringify; diff --git a/node_modules/css-selector-tokenizer/lib/stringifyValues.js b/node_modules/css-selector-tokenizer/lib/stringifyValues.js deleted file mode 100644 index a61d8d5..0000000 --- a/node_modules/css-selector-tokenizer/lib/stringifyValues.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; - -var cssesc = require("cssesc"); - -var stringify; - -function escape(str, stringType) { - return cssesc(str, { - quotes: stringType === "\"" ? "double" : "single" - }); -} - -function stringifyWithoutBeforeAfter(tree) { - switch(tree.type) { - case "values": - return tree.nodes.map(stringify).join(","); - case "value": - return tree.nodes.map(stringify).join(""); - case "item": - return tree.name; - case "nested-item": - return tree.name + "(" + tree.nodes.map(stringify).join(",") + ")"; - case "invalid": - return tree.value; - case "comment": - return "/*" + tree.content + "*/"; - case "string": - switch(tree.stringType) { - case "'": - return "'" + escape(tree.value, "'") + "'"; - case "\"": - return "\"" + escape(tree.value, "\"") + "\""; - } - /* istanbul ignore next */ - throw new Error("Invalid stringType"); - case "url": - var start = "url(" + (tree.innerSpacingBefore || ""); - var end = (tree.innerSpacingAfter || "") + ")"; - switch(tree.stringType) { - case "'": - return start + "'" + tree.url.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'") + "'" + end; - case "\"": - return start + "\"" + tree.url.replace(/(\\)/g, "\\$1").replace(/"/g, "\\\"") + "\"" + end; - default: - return start + tree.url.replace(/("|'|\)|\\)/g, "\\$1") + end; - } - } -} - - -stringify = function stringify(tree) { - var str = stringifyWithoutBeforeAfter(tree); - if(tree.before) { - str = tree.before + str; - } - if(tree.after) { - str = str + tree.after; - } - return str; -}; - -module.exports = stringify; diff --git a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/LICENSE-MIT.txt b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/LICENSE-MIT.txt deleted file mode 100644 index a41e0a7..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/LICENSE-MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Mathias Bynens - -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/css-selector-tokenizer/node_modules/regexpu-core/README.md b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/README.md deleted file mode 100644 index 1f80cd8..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# regexpu-core [![Build status](https://travis-ci.org/mathiasbynens/regexpu-core.svg?branch=master)](https://travis-ci.org/mathiasbynens/regexpu-core) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/regexpu-core/master.svg)](https://coveralls.io/r/mathiasbynens/regexpu-core) [![Dependency status](https://gemnasium.com/mathiasbynens/regexpu-core.svg)](https://gemnasium.com/mathiasbynens/regexpu-core) - -_regexpu_ is a source code transpiler that enables the use of ES6 Unicode regular expressions in JavaScript-of-today (ES5). - -_regexpu-core_ contains _regexpu_’s core functionality, i.e. `rewritePattern(pattern, flag)`, which enables rewriting regular expressions that make use of [the ES6 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expression patterns. - -## Installation - -To use _regexpu-core_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/): - -```bash -npm install regexpu-core --save-dev -``` - -Then, `require` it: - -```js -const rewritePattern = require('regexpu-core'); -``` - -## API - -This module exports a single function named `rewritePattern`. - -### `rewritePattern(pattern, flags)` - -This function takes a string that represents a regular expression pattern as well as a string representing its flags, and returns an ES5-compatible version of the pattern. - -```js -rewritePattern('foo.bar', 'u'); -// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar' - -rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u'); -// → '(?:[a-z]|\\uD834[\\uDF06-\\uDF08])' - -rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui'); -// → '(?:[a-z\\u017F\\u212A]|\\uD834[\\uDF06-\\uDF08])' -``` - -_regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to demonstrate how their behavior changes once the `u` and `i` flags are added: - -```js -// In ES5, the dot operator only matches BMP symbols: -rewritePattern('foo.bar'); -// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])bar' - -// But with the ES6 `u` flag, it matches astral symbols too: -rewritePattern('foo.bar', 'u'); -// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar' -``` - -`rewritePattern` uses [regjsgen](https://github.com/d10/regjsgen), [regjsparser](https://github.com/jviereck/regjsparser), and [regenerate](https://github.com/mathiasbynens/regenerate) as internal dependencies. - -## Author - -| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](https://mathiasbynens.be/) | - -## License - -_regexpu-core_ is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/character-class-escape-sets.js b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/character-class-escape-sets.js deleted file mode 100644 index f99c83e..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/character-class-escape-sets.js +++ /dev/null @@ -1,104 +0,0 @@ -// Generated by `/scripts/character-class-escape-sets.js`. Do not edit. -var regenerate = require('regenerate'); - -exports.REGULAR = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0xFFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0xFFFF), - 'w': regenerate(0x5F) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0xFFFF) -}; - -exports.UNICODE = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x10FFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0x10FFFF), - 'w': regenerate(0x5F) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0x10FFFF) -}; - -exports.UNICODE_IGNORE_CASE = { - 'd': regenerate() - .addRange(0x30, 0x39), - 'D': regenerate() - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x10FFFF), - 's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) - .addRange(0x9, 0xD) - .addRange(0x2000, 0x200A) - .addRange(0x2028, 0x2029), - 'S': regenerate() - .addRange(0x0, 0x8) - .addRange(0xE, 0x1F) - .addRange(0x21, 0x9F) - .addRange(0xA1, 0x167F) - .addRange(0x1681, 0x180D) - .addRange(0x180F, 0x1FFF) - .addRange(0x200B, 0x2027) - .addRange(0x202A, 0x202E) - .addRange(0x2030, 0x205E) - .addRange(0x2060, 0x2FFF) - .addRange(0x3001, 0xFEFE) - .addRange(0xFF00, 0x10FFFF), - 'w': regenerate(0x5F, 0x17F, 0x212A) - .addRange(0x30, 0x39) - .addRange(0x41, 0x5A) - .addRange(0x61, 0x7A), - 'W': regenerate(0x4B, 0x53, 0x60) - .addRange(0x0, 0x2F) - .addRange(0x3A, 0x40) - .addRange(0x5B, 0x5E) - .addRange(0x7B, 0x10FFFF) -}; diff --git a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/iu-mappings.json b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/iu-mappings.json deleted file mode 100644 index dbf36a2..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/data/iu-mappings.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "75": 8490, - "83": 383, - "107": 8490, - "115": 383, - "181": 924, - "197": 8491, - "383": 83, - "452": 453, - "453": 452, - "455": 456, - "456": 455, - "458": 459, - "459": 458, - "497": 498, - "498": 497, - "837": 8126, - "914": 976, - "917": 1013, - "920": 1012, - "921": 8126, - "922": 1008, - "924": 181, - "928": 982, - "929": 1009, - "931": 962, - "934": 981, - "937": 8486, - "962": 931, - "976": 914, - "977": 1012, - "981": 934, - "982": 928, - "1008": 922, - "1009": 929, - "1012": [ - 920, - 977 - ], - "1013": 917, - "7776": 7835, - "7835": 7776, - "8126": [ - 837, - 921 - ], - "8486": 937, - "8490": 75, - "8491": 197, - "66560": 66600, - "66561": 66601, - "66562": 66602, - "66563": 66603, - "66564": 66604, - "66565": 66605, - "66566": 66606, - "66567": 66607, - "66568": 66608, - "66569": 66609, - "66570": 66610, - "66571": 66611, - "66572": 66612, - "66573": 66613, - "66574": 66614, - "66575": 66615, - "66576": 66616, - "66577": 66617, - "66578": 66618, - "66579": 66619, - "66580": 66620, - "66581": 66621, - "66582": 66622, - "66583": 66623, - "66584": 66624, - "66585": 66625, - "66586": 66626, - "66587": 66627, - "66588": 66628, - "66589": 66629, - "66590": 66630, - "66591": 66631, - "66592": 66632, - "66593": 66633, - "66594": 66634, - "66595": 66635, - "66596": 66636, - "66597": 66637, - "66598": 66638, - "66599": 66639, - "66600": 66560, - "66601": 66561, - "66602": 66562, - "66603": 66563, - "66604": 66564, - "66605": 66565, - "66606": 66566, - "66607": 66567, - "66608": 66568, - "66609": 66569, - "66610": 66570, - "66611": 66571, - "66612": 66572, - "66613": 66573, - "66614": 66574, - "66615": 66575, - "66616": 66576, - "66617": 66577, - "66618": 66578, - "66619": 66579, - "66620": 66580, - "66621": 66581, - "66622": 66582, - "66623": 66583, - "66624": 66584, - "66625": 66585, - "66626": 66586, - "66627": 66587, - "66628": 66588, - "66629": 66589, - "66630": 66590, - "66631": 66591, - "66632": 66592, - "66633": 66593, - "66634": 66594, - "66635": 66595, - "66636": 66596, - "66637": 66597, - "66638": 66598, - "66639": 66599, - "68736": 68800, - "68737": 68801, - "68738": 68802, - "68739": 68803, - "68740": 68804, - "68741": 68805, - "68742": 68806, - "68743": 68807, - "68744": 68808, - "68745": 68809, - "68746": 68810, - "68747": 68811, - "68748": 68812, - "68749": 68813, - "68750": 68814, - "68751": 68815, - "68752": 68816, - "68753": 68817, - "68754": 68818, - "68755": 68819, - "68756": 68820, - "68757": 68821, - "68758": 68822, - "68759": 68823, - "68760": 68824, - "68761": 68825, - "68762": 68826, - "68763": 68827, - "68764": 68828, - "68765": 68829, - "68766": 68830, - "68767": 68831, - "68768": 68832, - "68769": 68833, - "68770": 68834, - "68771": 68835, - "68772": 68836, - "68773": 68837, - "68774": 68838, - "68775": 68839, - "68776": 68840, - "68777": 68841, - "68778": 68842, - "68779": 68843, - "68780": 68844, - "68781": 68845, - "68782": 68846, - "68783": 68847, - "68784": 68848, - "68785": 68849, - "68786": 68850, - "68800": 68736, - "68801": 68737, - "68802": 68738, - "68803": 68739, - "68804": 68740, - "68805": 68741, - "68806": 68742, - "68807": 68743, - "68808": 68744, - "68809": 68745, - "68810": 68746, - "68811": 68747, - "68812": 68748, - "68813": 68749, - "68814": 68750, - "68815": 68751, - "68816": 68752, - "68817": 68753, - "68818": 68754, - "68819": 68755, - "68820": 68756, - "68821": 68757, - "68822": 68758, - "68823": 68759, - "68824": 68760, - "68825": 68761, - "68826": 68762, - "68827": 68763, - "68828": 68764, - "68829": 68765, - "68830": 68766, - "68831": 68767, - "68832": 68768, - "68833": 68769, - "68834": 68770, - "68835": 68771, - "68836": 68772, - "68837": 68773, - "68838": 68774, - "68839": 68775, - "68840": 68776, - "68841": 68777, - "68842": 68778, - "68843": 68779, - "68844": 68780, - "68845": 68781, - "68846": 68782, - "68847": 68783, - "68848": 68784, - "68849": 68785, - "68850": 68786, - "71840": 71872, - "71841": 71873, - "71842": 71874, - "71843": 71875, - "71844": 71876, - "71845": 71877, - "71846": 71878, - "71847": 71879, - "71848": 71880, - "71849": 71881, - "71850": 71882, - "71851": 71883, - "71852": 71884, - "71853": 71885, - "71854": 71886, - "71855": 71887, - "71856": 71888, - "71857": 71889, - "71858": 71890, - "71859": 71891, - "71860": 71892, - "71861": 71893, - "71862": 71894, - "71863": 71895, - "71864": 71896, - "71865": 71897, - "71866": 71898, - "71867": 71899, - "71868": 71900, - "71869": 71901, - "71870": 71902, - "71871": 71903, - "71872": 71840, - "71873": 71841, - "71874": 71842, - "71875": 71843, - "71876": 71844, - "71877": 71845, - "71878": 71846, - "71879": 71847, - "71880": 71848, - "71881": 71849, - "71882": 71850, - "71883": 71851, - "71884": 71852, - "71885": 71853, - "71886": 71854, - "71887": 71855, - "71888": 71856, - "71889": 71857, - "71890": 71858, - "71891": 71859, - "71892": 71860, - "71893": 71861, - "71894": 71862, - "71895": 71863, - "71896": 71864, - "71897": 71865, - "71898": 71866, - "71899": 71867, - "71900": 71868, - "71901": 71869, - "71902": 71870, - "71903": 71871 -} diff --git a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/package.json b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/package.json deleted file mode 100644 index 4086c9d..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "regexpu-core@^1.0.0", - "scope": null, - "escapedName": "regexpu-core", - "name": "regexpu-core", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/css-selector-tokenizer" - ] - ], - "_from": "regexpu-core@>=1.0.0 <2.0.0", - "_id": "regexpu-core@1.0.0", - "_inCache": true, - "_location": "/css-selector-tokenizer/regexpu-core", - "_nodeVersion": "5.2.0", - "_npmUser": { - "name": "mathias", - "email": "mathias@qiwi.be" - }, - "_npmVersion": "3.3.12", - "_phantomChildren": {}, - "_requested": { - "raw": "regexpu-core@^1.0.0", - "scope": null, - "escapedName": "regexpu-core", - "name": "regexpu-core", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "_requiredBy": [ - "/css-selector-tokenizer" - ], - "_resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", - "_shasum": "86a763f58ee4d7c2f6b102e4764050de7ed90c6b", - "_shrinkwrap": null, - "_spec": "regexpu-core@^1.0.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/css-selector-tokenizer", - "author": { - "name": "Mathias Bynens", - "url": "https://mathiasbynens.be/" - }, - "bugs": { - "url": "https://github.com/mathiasbynens/regexpu-core/issues" - }, - "dependencies": { - "regenerate": "^1.2.1", - "regjsgen": "^0.2.0", - "regjsparser": "^0.1.4" - }, - "description": "regexpu’s core functionality (i.e. `rewritePattern(pattern, flag)`), capable of translating ES6 Unicode regular expressions to ES5.", - "devDependencies": { - "coveralls": "^2.11.2", - "istanbul": "^0.4.0", - "jsesc": "^0.5.0", - "lodash": "^3.6.0", - "mocha": "^2.2.1", - "regexpu-fixtures": "^1.0.0", - "unicode-5.1.0": "^0.1.5", - "unicode-8.0.0": "^0.1.5" - }, - "directories": {}, - "dist": { - "shasum": "86a763f58ee4d7c2f6b102e4764050de7ed90c6b", - "tarball": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz" - }, - "files": [ - "LICENSE-MIT.txt", - "rewrite-pattern.js", - "data/character-class-escape-sets.js", - "data/iu-mappings.json" - ], - "gitHead": "724e31ca40aa88a451d3ba9388a0993192dd428a", - "homepage": "https://mths.be/regexpu", - "keywords": [ - "codegen", - "desugaring", - "ecmascript", - "es5", - "es6", - "harmony", - "javascript", - "refactoring", - "regex", - "regexp", - "regular expressions", - "rewriting", - "syntax", - "transformation", - "transpile", - "transpiler", - "unicode" - ], - "license": "MIT", - "main": "rewrite-pattern.js", - "maintainers": [ - { - "name": "mathias", - "email": "mathias@qiwi.be" - } - ], - "name": "regexpu-core", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/mathiasbynens/regexpu-core.git" - }, - "scripts": { - "build": "node scripts/iu-mappings.js && node scripts/character-class-escape-sets.js", - "coverage": "istanbul cover --report html node_modules/.bin/_mocha tests/tests.js -- -u exports -R spec", - "test": "mocha tests" - }, - "version": "1.0.0" -} diff --git a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/rewrite-pattern.js b/node_modules/css-selector-tokenizer/node_modules/regexpu-core/rewrite-pattern.js deleted file mode 100644 index 47a7854..0000000 --- a/node_modules/css-selector-tokenizer/node_modules/regexpu-core/rewrite-pattern.js +++ /dev/null @@ -1,193 +0,0 @@ -var generate = require('regjsgen').generate; -var parse = require('regjsparser').parse; -var regenerate = require('regenerate'); -var iuMappings = require('./data/iu-mappings.json'); -var ESCAPE_SETS = require('./data/character-class-escape-sets.js'); - -function getCharacterClassEscapeSet(character) { - if (unicode) { - if (ignoreCase) { - return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]; - } - return ESCAPE_SETS.UNICODE[character]; - } - return ESCAPE_SETS.REGULAR[character]; -} - -var object = {}; -var hasOwnProperty = object.hasOwnProperty; -function has(object, property) { - return hasOwnProperty.call(object, property); -} - -// Prepare a Regenerate set containing all code points, used for negative -// character classes (if any). -var UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF); -// Without the `u` flag, the range stops at 0xFFFF. -// https://mths.be/es6#sec-pattern-semantics -var BMP_SET = regenerate().addRange(0x0, 0xFFFF); - -// Prepare a Regenerate set containing all code points that are supposed to be -// matched by `/./u`. https://mths.be/es6#sec-atom -var DOT_SET_UNICODE = UNICODE_SET.clone() // all Unicode code points - .remove( - // minus `LineTerminator`s (https://mths.be/es6#sec-line-terminators): - 0x000A, // Line Feed - 0x000D, // Carriage Return - 0x2028, // Line Separator - 0x2029 // Paragraph Separator - ); -// Prepare a Regenerate set containing all code points that are supposed to be -// matched by `/./` (only BMP code points). -var DOT_SET = DOT_SET_UNICODE.clone() - .intersection(BMP_SET); - -// Add a range of code points + any case-folded code points in that range to a -// set. -regenerate.prototype.iuAddRange = function(min, max) { - var $this = this; - do { - var folded = caseFold(min); - if (folded) { - $this.add(folded); - } - } while (++min <= max); - return $this; -}; - -function assign(target, source) { - for (var key in source) { - // Note: `hasOwnProperty` is not needed here. - target[key] = source[key]; - } -} - -function update(item, pattern) { - // TODO: Test if memoizing `pattern` here is worth the effort. - if (!pattern) { - return; - } - var tree = parse(pattern, ''); - switch (tree.type) { - case 'characterClass': - case 'group': - case 'value': - // No wrapping needed. - break; - default: - // Wrap the pattern in a non-capturing group. - tree = wrap(tree, pattern); - } - assign(item, tree); -} - -function wrap(tree, pattern) { - // Wrap the pattern in a non-capturing group. - return { - 'type': 'group', - 'behavior': 'ignore', - 'body': [tree], - 'raw': '(?:' + pattern + ')' - }; -} - -function caseFold(codePoint) { - return has(iuMappings, codePoint) ? iuMappings[codePoint] : false; -} - -var ignoreCase = false; -var unicode = false; -function processCharacterClass(characterClassItem) { - var set = regenerate(); - var body = characterClassItem.body.forEach(function(item) { - switch (item.type) { - case 'value': - set.add(item.codePoint); - if (ignoreCase && unicode) { - var folded = caseFold(item.codePoint); - if (folded) { - set.add(folded); - } - } - break; - case 'characterClassRange': - var min = item.min.codePoint; - var max = item.max.codePoint; - set.addRange(min, max); - if (ignoreCase && unicode) { - set.iuAddRange(min, max); - } - break; - case 'characterClassEscape': - set.add(getCharacterClassEscapeSet(item.value)); - break; - // The `default` clause is only here as a safeguard; it should never be - // reached. Code coverage tools should ignore it. - /* istanbul ignore next */ - default: - throw Error('Unknown term type: ' + item.type); - } - }); - if (characterClassItem.negative) { - set = (unicode ? UNICODE_SET : BMP_SET).clone().remove(set); - } - update(characterClassItem, set.toString()); - return characterClassItem; -} - -function processTerm(item) { - switch (item.type) { - case 'dot': - update( - item, - (unicode ? DOT_SET_UNICODE : DOT_SET).toString() - ); - break; - case 'characterClass': - item = processCharacterClass(item); - break; - case 'characterClassEscape': - update( - item, - getCharacterClassEscapeSet(item.value).toString() - ); - break; - case 'alternative': - case 'disjunction': - case 'group': - case 'quantifier': - item.body = item.body.map(processTerm); - break; - case 'value': - var codePoint = item.codePoint; - var set = regenerate(codePoint); - if (ignoreCase && unicode) { - var folded = caseFold(codePoint); - if (folded) { - set.add(folded); - } - } - update(item, set.toString()); - break; - case 'anchor': - case 'empty': - case 'group': - case 'reference': - // Nothing to do here. - break; - // The `default` clause is only here as a safeguard; it should never be - // reached. Code coverage tools should ignore it. - /* istanbul ignore next */ - default: - throw Error('Unknown term type: ' + item.type); - } - return item; -}; - -module.exports = function(pattern, flags) { - var tree = parse(pattern, flags); - ignoreCase = flags ? flags.indexOf('i') > -1 : false; - unicode = flags ? flags.indexOf('u') > -1 : false; - assign(tree, processTerm(tree)); - return generate(tree); -}; diff --git a/node_modules/css-selector-tokenizer/package.json b/node_modules/css-selector-tokenizer/package.json deleted file mode 100644 index 42411fa..0000000 --- a/node_modules/css-selector-tokenizer/package.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "css-selector-tokenizer@^0.7.0", - "scope": null, - "escapedName": "css-selector-tokenizer", - "name": "css-selector-tokenizer", - "rawSpec": "^0.7.0", - "spec": ">=0.7.0 <0.8.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/css-loader" - ] - ], - "_from": "css-selector-tokenizer@>=0.7.0 <0.8.0", - "_id": "css-selector-tokenizer@0.7.0", - "_inCache": true, - "_location": "/css-selector-tokenizer", - "_nodeVersion": "5.3.0", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/css-selector-tokenizer-0.7.0.tgz_1473115669749_0.3243146750610322" - }, - "_npmUser": { - "name": "geelen", - "email": "hi@glenmaddern.com" - }, - "_npmVersion": "3.10.5", - "_phantomChildren": { - "regenerate": "1.3.2", - "regjsgen": "0.2.0", - "regjsparser": "0.1.5" - }, - "_requested": { - "raw": "css-selector-tokenizer@^0.7.0", - "scope": null, - "escapedName": "css-selector-tokenizer", - "name": "css-selector-tokenizer", - "rawSpec": "^0.7.0", - "spec": ">=0.7.0 <0.8.0", - "type": "range" - }, - "_requiredBy": [ - "/css-loader" - ], - "_resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", - "_shasum": "e6988474ae8c953477bf5e7efecfceccd9cf4c86", - "_shrinkwrap": null, - "_spec": "css-selector-tokenizer@^0.7.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/css-loader", - "author": { - "name": "Tobias Koppers @sokra" - }, - "bugs": { - "url": "https://github.com/css-modules/css-selector-tokenizer/issues" - }, - "dependencies": { - "cssesc": "^0.1.0", - "fastparse": "^1.1.1", - "regexpu-core": "^1.0.0" - }, - "description": "Parses and stringifies CSS selectors", - "devDependencies": { - "chokidar-cli": "^0.2.1", - "codecov.io": "^0.1.2", - "coveralls": "^2.11.2", - "eslint": "^0.21.2", - "istanbul": "^0.3.14", - "mocha": "^2.2.5" - }, - "directories": { - "test": "test" - }, - "dist": { - "shasum": "e6988474ae8c953477bf5e7efecfceccd9cf4c86", - "tarball": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz" - }, - "files": [ - "lib" - ], - "gitHead": "d315d8d2a77cab97d90dcac5ee9f36c1d7688245", - "homepage": "https://github.com/css-modules/css-selector-tokenizer", - "keywords": [ - "css-modules", - "selectors" - ], - "license": "MIT", - "main": "lib/index.js", - "maintainers": [ - { - "name": "sokra", - "email": "tobias.koppers@googlemail.com" - }, - { - "name": "geelen", - "email": "hi@glenmaddern.com" - }, - { - "name": "markdalgleish", - "email": "mark.john.dalgleish@gmail.com" - } - ], - "name": "css-selector-tokenizer", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/css-modules/css-selector-tokenizer.git" - }, - "scripts": { - "autotest": "chokidar lib test -c 'npm test'", - "cover": "istanbul cover node_modules/mocha/bin/_mocha", - "lint": "eslint lib", - "precover": "npm run lint", - "pretest": "npm run lint", - "publish-patch": "npm test && npm version patch && git push && git push --tags && npm publish", - "test": "mocha", - "travis": "npm run cover -- --report lcovonly" - }, - "version": "0.7.0" -} diff --git a/node_modules/cssesc/LICENSE-MIT.txt b/node_modules/cssesc/LICENSE-MIT.txt deleted file mode 100644 index 97067e5..0000000 --- a/node_modules/cssesc/LICENSE-MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Mathias Bynens - -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/cssesc/README.md b/node_modules/cssesc/README.md deleted file mode 100644 index 8c63084..0000000 --- a/node_modules/cssesc/README.md +++ /dev/null @@ -1,207 +0,0 @@ -# cssesc [![Build status](https://travis-ci.org/mathiasbynens/cssesc.png?branch=master)](https://travis-ci.org/mathiasbynens/cssesc) [![Dependency status](https://gemnasium.com/mathiasbynens/cssesc.png)](https://gemnasium.com/mathiasbynens/cssesc) - -A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output. - -This is a JavaScript library for [escaping text for use in CSS strings or identifiers](http://mathiasbynens.be/notes/css-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](http://mothereff.in/css-escapes) - -Feel free to fork if you see possible improvements! - -## Installation - -Via [Bower](http://bower.io/): - -```bash -bower install cssesc -``` - -Via [Component](https://github.com/component/component): - -```bash -component install mathiasbynens/cssesc -``` - -Via [npm](http://npmjs.org/): - -```bash -npm install cssesc -``` - -In a browser: - -```html - -``` - -In [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/): - -```js -var cssesc = require('cssesc'); -``` - -In [Narwhal](http://narwhaljs.org/): - -```js -var cssesc = require('cssesc').cssesc; -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('cssesc.js'); -``` - -Using an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require( - { - 'paths': { - 'cssesc': 'path/to/cssesc' - } - }, - ['cssesc'], - function(cssesc) { - console.log(cssesc); - } -); -``` - -## API - -### `cssesc(value, options)` - -This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in CSS strings or identifiers](http://mathiasbynens.be/notes/css-escapes). - -```js -cssesc('Ich ♥ Bücher'); -// → 'Ich \\2665 B\\FC cher' - -cssesc('foo 𝌆 bar'); -// → 'foo \\1D306 bar' -``` - -By default, `cssesc` returns a string that can be used as part of a CSS string. If the target is a CSS identifier rather than a CSS string, use the `isIdentifier: true` setting (see below). - -The optional `options` argument accepts an object with the following options: - -#### `isIdentifier` - -The default value for the `isIdentifier` option is `false`. This means that the input text will be escaped for use in a CSS string literal. If you want to use the result as a CSS identifier instead (in a selector, for example), set this option to `true`. - -```js -cssesc('123a2b'); -// → '123a2b' - -cssesc('123a2b', { - 'isIdentifier': true -}); -// → '\\31 23a2b' -``` - -#### `quotes` - -The default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input text will be escaped as `\'`, so that the output can be used in a CSS string literal wrapped in single quotes. - -```js -cssesc('Lorem ipsum "dolor" sit \'amet\' etc.'); -// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' -// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." - -cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { - 'quotes': 'single' -}); -// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' -// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." -``` - -If you want to use the output as part of a CSS string literal wrapped in double quotes, set the `quotes` option to `'double'`. - -```js -cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { - 'quotes': 'double' -}); -// → 'Lorem ipsum \\"dolor\\" sit \'amet\' etc.' -// → "Lorem ipsum \\\"dolor\\\" sit 'amet' etc." -``` - -#### `wrap` - -The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid CSS string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting. - -```js -cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { - 'quotes': 'single', - 'wrap': true -}); -// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\'' -// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'" - -cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { - 'quotes': 'double', - 'wrap': true -}); -// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."' -// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\"" -``` - -#### `escapeEverything` - -The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols. - -```js -cssesc('lolwat"foo\'bar', { - 'escapeEverything': true -}); -// → '\\6C\\6F\\6C\\77\\61\\74\\"\\66\\6F\\6F\\\'\\62\\61\\72' -// → "\\6C\\6F\\6C\\77\\61\\74\\\"\\66\\6F\\6F\\'\\62\\61\\72" -``` - -### `cssesc.version` - -A string representing the semantic version number. - -### Using the `cssesc` binary - -To use the `cssesc` binary in your shell, simply install cssesc globally using npm: - -```bash -npm install -g cssesc -``` - -After that you will be able to escape text for use in CSS strings or identifiers from the command line: - -```bash -$ cssesc 'föo ♥ bår 𝌆 baz' -f\F6o \2665 b\E5r \1D306 baz -``` - -If the output needs to be a CSS identifier rather than part of a string literal, use the `-i`/`--identifier` option: - -```bash -$ cssesc --identifier 'föo ♥ bår 𝌆 baz' -f\F6o\ \2665\ b\E5r\ \1D306\ baz -``` - -See `cssesc --help` for the full list of options. - -## Support - -This library has been tested in at least Chrome 28-30, Firefox 3-23, Safari 4-6, Opera 10-15, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4. - -## Unit tests & code coverage - -After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. - -Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`. - -To generate [the code coverage report](http://rawgithub.com/mathiasbynens/cssesc/master/coverage/cssesc/cssesc.js.html), use `grunt cover`. - -## Author - -| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](http://mathiasbynens.be/) | - -## License - -This library is available under the [MIT](http://mths.be/mit) license. diff --git a/node_modules/cssesc/bin/cssesc b/node_modules/cssesc/bin/cssesc deleted file mode 100755 index 8fb0b65..0000000 --- a/node_modules/cssesc/bin/cssesc +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env node -(function() { - - var fs = require('fs'); - var cssesc = require('../cssesc.js'); - var strings = process.argv.splice(2); - var stdin = process.stdin; - var data; - var timeout; - var isObject = false; - var options = {}; - var log = console.log; - - var main = function() { - var option = strings[0]; - - if (/^(?:-h|--help|undefined)$/.test(option)) { - log( - 'cssesc v%s - http://mths.be/cssesc', - cssesc.version - ); - log([ - '\nUsage:\n', - '\tcssesc [string]', - '\tcssesc [-i | --identifier] [string]', - '\tcssesc [-s | --single-quotes] [string]', - '\tcssesc [-d | --double-quotes] [string]', - '\tcssesc [-w | --wrap] [string]', - '\tcssesc [-e | --escape-everything] [string]', - '\tcssesc [-v | --version]', - '\tcssesc [-h | --help]', - '\nExamples:\n', - '\tcssesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', - '\tcssesc --identifier \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', - '\tcssesc --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', - '\tcssesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', - '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | cssesc' - ].join('\n')); - return process.exit(1); - } - - if (/^(?:-v|--version)$/.test(option)) { - log('v%s', cssesc.version); - return process.exit(1); - } - - strings.forEach(function(string) { - // Process options - if (/^(?:-i|--identifier)$/.test(string)) { - options.isIdentifier = true; - return; - } - if (/^(?:-s|--single-quotes)$/.test(string)) { - options.quotes = 'single'; - return; - } - if (/^(?:-d|--double-quotes)$/.test(string)) { - options.quotes = 'double'; - return; - } - if (/^(?:-w|--wrap)$/.test(string)) { - options.wrap = true; - return; - } - if (/^(?:-e|--escape-everything)$/.test(string)) { - options.escapeEverything = true; - return; - } - - // Process string(s) - var result; - try { - result = cssesc(string, options); - log(result); - } catch(error) { - log(error.message + '\n'); - log('Error: failed to escape.'); - log('If you think this is a bug in cssesc, please report it:'); - log('https://github.com/mathiasbynens/cssesc/issues/new'); - log( - '\nStack trace using cssesc@%s:\n', - cssesc.version - ); - log(error.stack); - return process.exit(1); - } - }); - // Return with exit status 0 outside of the `forEach` loop, in case - // multiple strings were passed in. - return process.exit(0); - - }; - - if (stdin.isTTY) { - // handle shell arguments - main(); - } else { - // Either the script is called from within a non-TTY context, or `stdin` - // content is being piped in. - if (!process.stdout.isTTY) { - // The script was called from a non-TTY context. This is a rather uncommon - // use case we don’t actively support. However, we don’t want the script - // to wait forever in such cases, so… - timeout = setTimeout(function() { - // …if no piped data arrived after a whole minute, handle shell - // arguments instead. - main(); - }, 60000); - } - data = ''; - stdin.on('data', function(chunk) { - clearTimeout(timeout); - data += chunk; - }); - stdin.on('end', function() { - strings.push(data.trim()); - main(); - }); - stdin.resume(); - } - -}()); diff --git a/node_modules/cssesc/cssesc.js b/node_modules/cssesc/cssesc.js deleted file mode 100644 index 57d7497..0000000 --- a/node_modules/cssesc/cssesc.js +++ /dev/null @@ -1,177 +0,0 @@ -/*! http://mths.be/cssesc v0.1.0 by @mathias */ -;(function(root) { - - // Detect free variables `exports` - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module` - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root` - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - var merge = function(options, defaults) { - if (!options) { - return defaults; - } - var key; - var result = {}; - for (key in defaults) { - // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since - // only recognized option names are used - result[key] = hasOwnProperty.call(options, key) - ? options[key] - : defaults[key]; - } - return result; - }; - - /*--------------------------------------------------------------------------*/ - - var regexAnySingleEscape = /[\x20-\x2C\x2E\x2F\x3B-\x40\x5B-\x5E\x60\x7B-\x7E]/; - var regexSingleEscape = /[\x20\x21\x23-\x26\x28-\x2C\x2E\x2F\x3B-\x40\x5B\x5D\x5E\x60\x7B-\x7E]/; - var regexAlwaysEscape = /['"\\]/; - var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g; - - // http://mathiasbynens.be/notes/css-escapes#css - var cssesc = function(string, options) { - - // Handle options - options = merge(options, cssesc.options); - if (options.quotes != 'single' && options.quotes != 'double') { - options.quotes = 'single'; - } - var quote = options.quotes == 'double' ? '"' : '\''; - var isIdentifier = options.isIdentifier; - - var firstChar = string.charAt(0); - var output = ''; - var counter = 0; - var length = string.length; - var value; - var character; - var codePoint; - var extra; // used for potential low surrogates - - while (counter < length) { - character = string.charAt(counter++); - codePoint = character.charCodeAt(); - // if it’s not a printable ASCII character - if (codePoint < 0x20 || codePoint > 0x7E) { - if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // next character is low surrogate - codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000; - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - counter--; - } - } - value = '\\' + codePoint.toString(16).toUpperCase() + ' '; - } else { - if (options.escapeEverything) { - if (regexAnySingleEscape.test(character)) { - value = '\\' + character; - } else { - value = '\\' + codePoint.toString(16).toUpperCase() + ' '; - } - // `:` can be escaped as `\:`, but that fails in IE < 8 - } else if (/[\t\n\f\r\x0B:]/.test(character)) { - if (!isIdentifier && character == ':') { - value = character; - } else { - value = '\\' + codePoint.toString(16).toUpperCase() + ' '; - } - } else if ( - character == '\\' || - ( - !isIdentifier && - ( - (character == '"' && quote == character) || - (character == '\'' && quote == character) - ) - ) || - (isIdentifier && regexSingleEscape.test(character)) - ) { - value = '\\' + character; - } else { - value = character; - } - } - output += value; - } - - if (isIdentifier) { - if (/^_/.test(output)) { - // Prevent IE6 from ignoring the rule altogether (in case this is for an - // identifier used as a selector) - output = '\\_' + output.slice(1); - } else if (/^-[-\d]/.test(output)) { - output = '\\-' + output.slice(1); - } else if (/\d/.test(firstChar)) { - output = '\\3' + firstChar + ' ' + output.slice(1); - } - } - - // Remove spaces after `\HEX` escapes that are not followed by a hex digit, - // since they’re redundant. Note that this is only possible if the escape - // sequence isn’t preceded by an odd number of backslashes. - output = output.replace(regexExcessiveSpaces, function($0, $1, $2) { - if ($1 && $1.length % 2) { - // it’s not safe to remove the space, so don’t - return $0; - } - // strip the space - return ($1 || '') + $2; - }); - - if (!isIdentifier && options.wrap) { - return quote + output + quote; - } - return output; - }; - - // Expose default options (so they can be overridden globally) - cssesc.options = { - 'escapeEverything': false, - 'isIdentifier': false, - 'quotes': 'single', - 'wrap': false - }; - - cssesc.version = '0.1.0'; - - /*--------------------------------------------------------------------------*/ - - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define(function() { - return cssesc; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = cssesc; - } else { // in Narwhal or RingoJS v0.7.0- - freeExports.cssesc = cssesc; - } - } else { // in Rhino or a web browser - root.cssesc = cssesc; - } - -}(this)); diff --git a/node_modules/cssesc/man/cssesc.1 b/node_modules/cssesc/man/cssesc.1 deleted file mode 100644 index 7c099e3..0000000 --- a/node_modules/cssesc/man/cssesc.1 +++ /dev/null @@ -1,70 +0,0 @@ -.Dd August 9, 2013 -.Dt cssesc 1 -.Sh NAME -.Nm cssesc -.Nd escape text for use in CSS string literals or identifiers -.Sh SYNOPSIS -.Nm -.Op Fl i | -identifier Ar string -.br -.Op Fl s | -single-quotes Ar string -.br -.Op Fl d | -double-quotes Ar string -.br -.Op Fl w | -wrap Ar string -.br -.Op Fl e | -escape-everything Ar string -.br -.Op Fl v | -version -.br -.Op Fl h | -help -.Sh DESCRIPTION -.Nm -escapes strings for use in CSS string literals or identifiers while generating the shortest possible valid ASCII-only output. -.Sh OPTIONS -.Bl -ohang -offset -.It Sy "-s, --single-quotes" -Escape any occurences of ' in the input string as \\', so that the output can be used in a CSS string literal wrapped in single quotes. -.It Sy "-d, --double-quotes" -Escape any occurences of " in the input string as \\", so that the output can be used in a CSS string literal wrapped in double quotes. -.It Sy "-w, --wrap" -Make sure the output is a valid CSS string literal wrapped in quotes. The type of quotes can be specified using the -.Ar -s | --single-quotes -or -.Ar -d | --double-quotes -settings. -.It Sy "-e, --escape-everything" -Escape all the symbols in the output, even printable ASCII symbols. -.It Sy "-v, --version" -Print cssesc's version. -.It Sy "-h, --help" -Show the help screen. -.El -.Sh EXIT STATUS -The -.Nm cssesc -utility exits with one of the following values: -.Pp -.Bl -tag -width flag -compact -.It Li 0 -.Nm -successfully escaped the given text and printed the result. -.It Li 1 -.Nm -wasn't instructed to escape anything (for example, the -.Ar --help -flag was set); or, an error occurred. -.El -.Sh EXAMPLES -.Bl -ohang -offset -.It Sy "cssesc 'foo bar baz'" -Print an escaped version of the given text. -.It Sy echo\ 'foo bar baz'\ |\ cssesc -Print an escaped version of the text that gets piped in. -.El -.Sh BUGS -cssesc's bug tracker is located at . -.Sh AUTHOR -Mathias Bynens -.Sh WWW - diff --git a/node_modules/cssesc/package.json b/node_modules/cssesc/package.json deleted file mode 100644 index da10cae..0000000 --- a/node_modules/cssesc/package.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "cssesc@^0.1.0", - "scope": null, - "escapedName": "cssesc", - "name": "cssesc", - "rawSpec": "^0.1.0", - "spec": ">=0.1.0 <0.2.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/css-selector-tokenizer" - ] - ], - "_from": "cssesc@>=0.1.0 <0.2.0", - "_id": "cssesc@0.1.0", - "_inCache": true, - "_location": "/cssesc", - "_npmUser": { - "name": "mathias", - "email": "mathias@qiwi.be" - }, - "_npmVersion": "1.2.32", - "_phantomChildren": {}, - "_requested": { - "raw": "cssesc@^0.1.0", - "scope": null, - "escapedName": "cssesc", - "name": "cssesc", - "rawSpec": "^0.1.0", - "spec": ">=0.1.0 <0.2.0", - "type": "range" - }, - "_requiredBy": [ - "/css-selector-tokenizer", - "/postcss-modules-local-by-default/css-selector-tokenizer", - "/postcss-modules-scope/css-selector-tokenizer" - ], - "_resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", - "_shasum": "c814903e45623371a0477b40109aaafbeeaddbb4", - "_shrinkwrap": null, - "_spec": "cssesc@^0.1.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/css-selector-tokenizer", - "author": { - "name": "Mathias Bynens", - "url": "http://mathiasbynens.be/" - }, - "bin": { - "cssesc": "bin/cssesc" - }, - "bugs": { - "url": "https://github.com/mathiasbynens/cssesc/issues" - }, - "dependencies": {}, - "description": "A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.", - "devDependencies": { - "grunt": "~0.4.1", - "grunt-shell": "~0.3.1", - "grunt-template": "~0.2.0", - "istanbul": "~0.1.42", - "qunit-clib": "~1.3.0", - "qunitjs": "~1.11.0", - "regenerate": "~0.5.2", - "requirejs": "~2.1.8" - }, - "directories": { - "test": "tests" - }, - "dist": { - "shasum": "c814903e45623371a0477b40109aaafbeeaddbb4", - "tarball": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz" - }, - "files": [ - "LICENSE-MIT.txt", - "cssesc.js", - "bin/", - "man/" - ], - "homepage": "http://mths.be/cssesc", - "keywords": [ - "css", - "escape", - "identifier", - "string", - "tool" - ], - "licenses": [ - { - "type": "MIT", - "url": "http://mths.be/mit" - } - ], - "main": "cssesc.js", - "maintainers": [ - { - "name": "mathias", - "email": "mathias@qiwi.be" - } - ], - "man": [ - "man/cssesc.1" - ], - "name": "cssesc", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/mathiasbynens/cssesc.git" - }, - "scripts": { - "test": "node tests/tests.js" - }, - "version": "0.1.0" -} diff --git a/node_modules/cssnano/CHANGELOG.md b/node_modules/cssnano/CHANGELOG.md deleted file mode 100644 index 2a67313..0000000 --- a/node_modules/cssnano/CHANGELOG.md +++ /dev/null @@ -1,354 +0,0 @@ -# 3.10.0 - -* cssnano will no longer `console.warn` any messages when using deprecated - options; these are now sent to PostCSS. You will be able to see them if you - use a PostCSS runner with built-in messages support, or alternately by - loading `postcss-reporter` or `postcss-browser-reporter` in your plugins list. -* Prepares support for `grid` identifier reduction by adding it to the list - of optimisations turned off when `options.safe` is set to `true`. -* Adds support for normalizing `unicode-range` descriptors. Values will - be converted when the code matches `0` & `f` in the same place on both sides - of the range. So, `u+2000-2fff` can be converted to `u+2???`, but - `u+2100-2fff` will be left as it is. - -# 3.9.1 - -* Resolves an integration issue with `v3.9.0`, where `undefined` values - would attempt to be parsed. - -# 3.9.0 - -* Adds a new option to normalize wrapping quotes for strings & joining - multiple-line strings into a single line. This optimisation can potentially - reduce the final gzipped size of your CSS file. - -# 3.8.2 - -* Resolves an issue where `display: list-item inline flow` would be normalized - to `inline list-item` rather than `inline-list-item` (thanks to @mattbasta). - -# 3.8.1 - -* Adds a quick start file for easy integration with Runkit. Try cssnano online - at https://runkit.com/npm/cssnano. - -# 3.8.0 - -* Adds support for normalizing multiple values for the `display` property. For - example `block flow` can be simplified to `block`. - -# 3.7.7 - -* Further improves CSS mixin handling; semicolons will no longer be stripped - from *rules* as well as declarations. - -# 3.7.6 - -* Resolves an issue where the semicolon was being incorrectly stripped - from CSS mixins. - -# 3.7.5 - -* Resolves an issue where the `safe` flag was not being persisted across - multiple files (thanks to @techmatt101). - -# 3.7.4 - -* Improves performance of the reducePositions transform by testing - against `hasOwnProperty` instead of using an array of object keys. -* Removes the redundant `indexes-of` dependency. - -# 3.7.3 - -* Unpins postcss-filter-plugins from `2.0.0` as a fix has landed in the new - version of uniqid. - -# 3.7.2 - -* Temporarily pins postcss-filter-plugins to version `2.0.0` in order to - mitigate an issue with uniqid `3.0.0`. - -# 3.7.1 - -* Enabling safe mode now turns off both postcss-merge-idents & - postcss-normalize-url's `stripWWW` option. - -# 3.7.0 - -* Added: Reduce `background-repeat` definitions; works with both this property - & the `background` shorthand, and aims to compress the extended two value - syntax into the single value syntax. -* Added: Reduce `initial` values for properties when the *actual* initial value - is shorter; for example, `min-width: initial` becomes `min-width: 0`. - -# 3.6.2 - -* Fixed an issue where cssnano would crash on `steps(1)`. - -# 3.6.1 - -* Fixed an issue where cssnano would crash on `steps` functions with a - single argument. - -# 3.6.0 - -* Added `postcss-discard-overridden` to safely discard overridden rules with - the same identifier (thanks to @Justineo). -* Added: Reduce animation/transition timing functions. Detects `cubic-bezier` - functions that are equivalent to the timing keywords and compresses, as well - as normalizing the `steps` timing function. -* Added the `perspective-origin` property to the list of supported properties - transformed by the `reduce-positions` transform. - -# 3.5.2 - -* Resolves an issue where the 3 or 4 value syntax for `background-position` - were being incorrectly converted. - -# 3.5.1 - -* Improves checking for `background-position` values in the `background` - shorthand property. - -# 3.5.0 - -* Adds a new optimisation path which can minimise keyword values for - `background-position` and the `background` shorthand. -* Tweaks to performance in the `core` module, now performs less AST passes. -* Now compiled with Babel 6. - -# 3.4.0 - -* Adds a new optimisation path which can minimise gradient parameters - automatically. - -# 3.3.2 - -* Fixes an issue where using `options.safe` threw an error when cssnano was - not used as part of a PostCSS instance, but standalone (such as in modules - like gulp-cssnano). cssnano now renames `safe` internally to `isSafe`. - -# 3.3.1 - -* Unpins postcss-colormin from `2.1.2`, as the `2.1.3` & `2.1.4` patches had - optimization regressions that are now resolved in `2.1.5`. - -# 3.3.0 - -* Updated modules to use postcss-value-parser version 3 (thanks to @TrySound). -* Now converts between transform functions with postcss-reduce-transforms. - e.g. `translate3d(0, 0, 0)` becomes `translateZ(0)`. - -# 3.2.0 - -* cssnano no longer converts `outline: none` to `outline: 0`, as there are - some cases where the values are not equivalent (thanks to @TrySound). -* cssnano no longer converts for example `16px` to `1pc` *by default*. Length - optimisations can be turned on via `{convertValues: {length: true}}`. -* Improved minimization of css functions (thanks to @TrySound). - -# 3.1.0 - -* This release swaps postcss-single-charset for postcss-normalize-charset, - which can detect encoding to determine whether a charset is necessary. - Optionally, you can set the `add` option to `true` to prepend a UTF-8 - charset to the output automatically (thanks to @TrySound). -* A `safe` option was added, which disables more aggressive optimisations, as - a convenient preset configuration (thanks to @TrySound). -* Added an option to convert from `deg` to `turn` & vice versa, & improved - minification performance in functions (thanks to @TrySound). - -# 3.0.3 - -* Fixes an issue where cssnano was removing spaces around forward slashes in - string literals (thanks to @TrySound). - -# 3.0.2 - -* Fixes an issue where cssnano was removing spaces around forward slashes in - calc functions. - -# 3.0.1 - -* Replaced css-list & balanced-match with postcss-value-parser, reducing the - module's overall size (thanks to @TrySound). - -# 3.0.0 - -* All cssnano plugins and cssnano itself have migrated to PostCSS 5.x. Please - make sure that when using the 3.x releases that you use a 5.x compatible - PostCSS runner. -* cssnano will now compress inline SVG through SVGO. Because of this change, - interfacing with cssnano must now be done through an asynchronous API. The - main `process` method has the same signature as a PostCSS processor instance. -* The old options such as `merge` & `fonts` that were deprecated in - release `2.5.0` were removed. The new architecture allows you to specify any - module name to disable it. -* postcss-minify-selectors' at-rule compression was extracted out into - postcss-minify-params (thanks to @TrySound). -* Overall performance of the module has improved dramatically, thanks to work - by @TrySound and input from the community. -* Improved selector merging/deduplication in certain use cases. -* cssnano no longer compresses hex colours in filter properties, to better - support old versions of Internet Explorer (thanks to @faddee). -* cssnano will not merge properties together that have an `inherit` keyword. -* postcss-minify-font-weight & postcss-font-family were consolidated into - postcss-minify-font-values. Using the old options will print deprecation - warnings (thanks to @TrySound). -* The cssnano CLI was extracted into a separate module, so that dependent - modules such as gulp-cssnano don't download unnecessary extras. - -# 2.6.1 - -* Improved performance of the core module `functionOptimiser`. - -# 2.6.0 - -* Adds a new optimisation which re-orders properties that accept values in - an arbitrary order. This can lead to improved merging behaviour in certain - cases. - -# 2.5.0 - -* Adds support for disabling modules of the user's choosing, with new option - names. The old options (such as `merge` & `fonts`) will be removed in `3.0`. - -# 2.4.0 - -* postcss-minify-selectors was extended to add support for conversion of - `::before` to `:before`; this release removes the dedicated - postcss-pseudoelements module. - -# 2.3.0 - -* Consolidated postcss-minify-trbl & two integrated modules into - postcss-merge-longhand. - -# 2.2.0 - -* Replaced integrated plugin filter with postcss-filter-plugins. -* Improved rule merging logic. -* Improved performance across the board by reducing AST iterations where it - was possible to do so. -* cssnano will now perform better whitespace compression when used with other - PostCSS plugins. - -# 2.1.1 - -* Fixes an issue where options were not passed to normalize-url. - -# 2.1.0 - -* Allow `postcss-font-family` to be disabled. - -# 2.0.3 - -* cssnano can now be consumed with the parentheses-less method in PostCSS; e.g. - `postcss([ cssnano ])`. -* Fixes an issue where 'Din' was being picked up by the logic as a numeric - value, causing the full font name to be incorrectly rearranged. - -# 2.0.2 - -* Extract trbl value reducing into a separate module. -* Refactor core longhand optimiser to not rely on trbl cache. -* Adds support for `ch` units; previously they were removed. -* Fixes parsing of some selector hacks. -* Fixes an issue where embedded base 64 data was being converted as if it were - a URL. - -# 2.0.1 - -* Add `postcss-plugin` keyword to package.json. -* Wraps all core processors with the PostCSS 4.1 plugin API. - -# 2.0.0 - -* Adds removal of outdated vendor prefixes based on browser support. -* Addresses an issue where relative path separators were converted to - backslashes on Windows. -* cssnano will now detect previous plugins and silently disable them when the - functionality overlaps. This is to enable faster interoperation with cssnext. -* cssnano now exports as a PostCSS plugin. The simple interface is exposed - at `cssnano.process(css, opts)` instead of `cssnano(css, opts)`. -* Improved URL detection when using two or more in the same declaration. -* node 0.10 is no longer officially supported. - -# 1.4.3 - -* Fixes incorrect minification of `background:none` to `background:0 0`. - -# 1.4.2 - -* Fixes an issue with nested URLs inside `url()` functions. - -# 1.4.1 - -* Addresses an issue where whitespace removal after a CSS function would cause - rendering issues in Internet Explorer. - -# 1.4.0 - -* Adds support for removal of unused `@keyframes` and `@counter-style` at-rules. -* comments: adds support for user-directed removal of comments, with the - `remove` option (thanks to @dmitrykiselyov). -* comments: `removeAllButFirst` now operates on each CSS tree, rather than the - first one passed to cssnano. - -# 1.3.3 - -* Fixes incorrect minification of `border:none` to `border:0 0`. - -# 1.3.2 - -* Improved selector minifying logic, leading to better compression of attribute - selectors. -* Improved comment discarding logic. - -# 1.3.1 - -* Fixes crash on undefined `decl.before` from prior AST. - -# 1.3.0 - -* Added support for bundling cssnano using webpack (thanks to @MoOx). - -# 1.2.1 - -* Fixed a bug where a CSS function keyword inside its value would throw - an error. - -# 1.2.0 - -* Better support for merging properties without the existance of a shorthand - override. -* Can now 'merge forward' adjacent rules as well as the previous 'merge behind' - behaviour, leading to better compression. -* Selector re-ordering now happens last in the chain of plugins, to help clean - up merged selectors. - -# 1.1.0 - -* Now can merge identifiers such as `@keyframes` and `@counter-style` if they - have duplicated properties but are named differently. -* Fixes an issue where duplicated keyframes with the same name would cause - an infinite loop. - -# 1.0.2 - -* Improve module loading logic (thanks to @tunnckoCore). -* Improve minification of numeric values, with better support for `rem`, - trailing zeroes and slash/comma separated values - (thanks to @TrySound & @tunnckoCore). -* Fixed an issue where `-webkit-tap-highlight-color` values were being - incorrectly transformed to `transparent`. This is not supported in Safari. -* Added support for viewport units (thanks to @TrySound). -* Add MIT license file. - -# 1.0.1 - -* Add repository/author links to package.json. - -# 1.0.0 - -* Initial release. diff --git a/node_modules/cssnano/LICENSE-MIT b/node_modules/cssnano/LICENSE-MIT deleted file mode 100644 index fd0e863..0000000 --- a/node_modules/cssnano/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) Ben Briggs (http://beneb.info) - -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/cssnano/README.md b/node_modules/cssnano/README.md deleted file mode 100644 index f96fef7..0000000 --- a/node_modules/cssnano/README.md +++ /dev/null @@ -1,56 +0,0 @@ -

-
- cssnano -
-
-
-

- -> A modular minifier, built on top of the [PostCSS] ecosystem. - -[![Build Status](https://travis-ci.org/ben-eb/cssnano.svg?branch=master)][ci] [![Build status](https://ci.appveyor.com/api/projects/status/t1chyvhobtju7jy8/branch/master?svg=true)](https://ci.appveyor.com/project/ben-eb/cssnano/branch/master) [![Coverage Status](https://coveralls.io/repos/github/ben-eb/cssnano/badge.svg?branch=master)](https://coveralls.io/github/ben-eb/cssnano?branch=master) [![NPM version](https://badge.fury.io/js/cssnano.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/cssnano.svg)][deps] [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/ben-eb/cssnano?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -cssnano is a modular minifier that aims to utilise small modules from the -PostCSS ecosystem, rather than being an all-encompassing module that may be -difficult to contribute to. Because it is written on top of PostCSS, it is able -to do more than simple whitespace transforms - including advanced optimisations -such as custom identifier reduction, `z-index` rebasing, and adjacent selector -merging. - -Note that cssnano enables aggressive optimisations by default, which might not -always be what you want. Set `options.safe` to `true` if you want to disable -this. In future versions, only safe options will be enabled by default, starting -from [version 4][v4]. - -For further details check out the [website](http://cssnano.co/): - -* [Installation guide for your build process](http://cssnano.co/usage/). -* [Full list of optimisations](http://cssnano.co/optimisations/). -* [Customise the output (options documentation)](http://cssnano.co/options/). - -You can now [try cssnano online](https://runkit.com/npm/cssnano) via Runkit! - - -## Contributing - -See [CONTRIBUTING.md](CONTRIBUTING.md). - - -## Links - -Please help to support this project by [purchasing a cssnano sticker][sticker]. - -[sticker]: https://www.stickermule.com/uk/marketplace/11086-cssnano - - -## License - -MIT © [Ben Briggs](http://beneb.info) - - -[PostCSS]: https://github.com/postcss/postcss - -[ci]: https://travis-ci.org/ben-eb/cssnano -[deps]: https://gemnasium.com/ben-eb/cssnano -[npm]: http://badge.fury.io/js/cssnano -[v4]: https://github.com/ben-eb/cssnano/issues/88 diff --git a/node_modules/cssnano/dist/index.js b/node_modules/cssnano/dist/index.js deleted file mode 100644 index 7f3b09b..0000000 --- a/node_modules/cssnano/dist/index.js +++ /dev/null @@ -1,310 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _decamelize = require('decamelize'); - -var _decamelize2 = _interopRequireDefault(_decamelize); - -var _defined = require('defined'); - -var _defined2 = _interopRequireDefault(_defined); - -var _objectAssign = require('object-assign'); - -var _objectAssign2 = _interopRequireDefault(_objectAssign); - -var _postcss = require('postcss'); - -var _postcss2 = _interopRequireDefault(_postcss); - -var _postcssFilterPlugins2 = require('postcss-filter-plugins'); - -var _postcssFilterPlugins3 = _interopRequireDefault(_postcssFilterPlugins2); - -var _postcssDiscardComments = require('postcss-discard-comments'); - -var _postcssDiscardComments2 = _interopRequireDefault(_postcssDiscardComments); - -var _postcssReduceInitial = require('postcss-reduce-initial'); - -var _postcssReduceInitial2 = _interopRequireDefault(_postcssReduceInitial); - -var _postcssMinifyGradients = require('postcss-minify-gradients'); - -var _postcssMinifyGradients2 = _interopRequireDefault(_postcssMinifyGradients); - -var _postcssSvgo = require('postcss-svgo'); - -var _postcssSvgo2 = _interopRequireDefault(_postcssSvgo); - -var _postcssReduceTransforms = require('postcss-reduce-transforms'); - -var _postcssReduceTransforms2 = _interopRequireDefault(_postcssReduceTransforms); - -var _autoprefixer = require('autoprefixer'); - -var _autoprefixer2 = _interopRequireDefault(_autoprefixer); - -var _postcssZindex = require('postcss-zindex'); - -var _postcssZindex2 = _interopRequireDefault(_postcssZindex); - -var _postcssConvertValues = require('postcss-convert-values'); - -var _postcssConvertValues2 = _interopRequireDefault(_postcssConvertValues); - -var _postcssCalc = require('postcss-calc'); - -var _postcssCalc2 = _interopRequireDefault(_postcssCalc); - -var _postcssColormin = require('postcss-colormin'); - -var _postcssColormin2 = _interopRequireDefault(_postcssColormin); - -var _postcssOrderedValues = require('postcss-ordered-values'); - -var _postcssOrderedValues2 = _interopRequireDefault(_postcssOrderedValues); - -var _postcssMinifySelectors = require('postcss-minify-selectors'); - -var _postcssMinifySelectors2 = _interopRequireDefault(_postcssMinifySelectors); - -var _postcssMinifyParams = require('postcss-minify-params'); - -var _postcssMinifyParams2 = _interopRequireDefault(_postcssMinifyParams); - -var _postcssNormalizeCharset = require('postcss-normalize-charset'); - -var _postcssNormalizeCharset2 = _interopRequireDefault(_postcssNormalizeCharset); - -var _postcssMinifyFontValues = require('postcss-minify-font-values'); - -var _postcssMinifyFontValues2 = _interopRequireDefault(_postcssMinifyFontValues); - -var _postcssDiscardUnused = require('postcss-discard-unused'); - -var _postcssDiscardUnused2 = _interopRequireDefault(_postcssDiscardUnused); - -var _postcssNormalizeUrl = require('postcss-normalize-url'); - -var _postcssNormalizeUrl2 = _interopRequireDefault(_postcssNormalizeUrl); - -var _postcssMergeIdents = require('postcss-merge-idents'); - -var _postcssMergeIdents2 = _interopRequireDefault(_postcssMergeIdents); - -var _postcssReduceIdents = require('postcss-reduce-idents'); - -var _postcssReduceIdents2 = _interopRequireDefault(_postcssReduceIdents); - -var _postcssMergeLonghand = require('postcss-merge-longhand'); - -var _postcssMergeLonghand2 = _interopRequireDefault(_postcssMergeLonghand); - -var _postcssDiscardDuplicates = require('postcss-discard-duplicates'); - -var _postcssDiscardDuplicates2 = _interopRequireDefault(_postcssDiscardDuplicates); - -var _postcssDiscardOverridden = require('postcss-discard-overridden'); - -var _postcssDiscardOverridden2 = _interopRequireDefault(_postcssDiscardOverridden); - -var _postcssMergeRules = require('postcss-merge-rules'); - -var _postcssMergeRules2 = _interopRequireDefault(_postcssMergeRules); - -var _postcssDiscardEmpty = require('postcss-discard-empty'); - -var _postcssDiscardEmpty2 = _interopRequireDefault(_postcssDiscardEmpty); - -var _postcssUniqueSelectors = require('postcss-unique-selectors'); - -var _postcssUniqueSelectors2 = _interopRequireDefault(_postcssUniqueSelectors); - -var _functionOptimiser = require('./lib/functionOptimiser'); - -var _functionOptimiser2 = _interopRequireDefault(_functionOptimiser); - -var _filterOptimiser = require('./lib/filterOptimiser'); - -var _filterOptimiser2 = _interopRequireDefault(_filterOptimiser); - -var _normalizeString = require('./lib/normalizeString'); - -var _normalizeString2 = _interopRequireDefault(_normalizeString); - -var _normalizeUnicode = require('./lib/normalizeUnicode'); - -var _normalizeUnicode2 = _interopRequireDefault(_normalizeUnicode); - -var _reduceDisplayValues = require('./lib/reduceDisplayValues'); - -var _reduceDisplayValues2 = _interopRequireDefault(_reduceDisplayValues); - -var _reduceBackgroundRepeat = require('./lib/reduceBackgroundRepeat'); - -var _reduceBackgroundRepeat2 = _interopRequireDefault(_reduceBackgroundRepeat); - -var _reducePositions = require('./lib/reducePositions'); - -var _reducePositions2 = _interopRequireDefault(_reducePositions); - -var _core = require('./lib/core'); - -var _core2 = _interopRequireDefault(_core); - -var _reduceTimingFunctions = require('./lib/reduceTimingFunctions'); - -var _reduceTimingFunctions2 = _interopRequireDefault(_reduceTimingFunctions); - -var _styleCache = require('./lib/styleCache'); - -var _styleCache2 = _interopRequireDefault(_styleCache); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Processors -var processors = { - postcssFilterPlugins: function postcssFilterPlugins() { - return (0, _postcssFilterPlugins3.default)({ silent: true }); - }, - postcssDiscardComments: _postcssDiscardComments2.default, - postcssMinifyGradients: _postcssMinifyGradients2.default, - postcssReduceInitial: _postcssReduceInitial2.default, - postcssSvgo: _postcssSvgo2.default, - reduceDisplayValues: _reduceDisplayValues2.default, - postcssReduceTransforms: _postcssReduceTransforms2.default, - autoprefixer: _autoprefixer2.default, - postcssZindex: _postcssZindex2.default, - postcssConvertValues: _postcssConvertValues2.default, - reduceTimingFunctions: _reduceTimingFunctions2.default, - postcssCalc: _postcssCalc2.default, - postcssColormin: _postcssColormin2.default, - postcssOrderedValues: _postcssOrderedValues2.default, - postcssMinifySelectors: _postcssMinifySelectors2.default, - postcssMinifyParams: _postcssMinifyParams2.default, - postcssNormalizeCharset: _postcssNormalizeCharset2.default, - postcssDiscardOverridden: _postcssDiscardOverridden2.default, - normalizeString: _normalizeString2.default, - normalizeUnicode: _normalizeUnicode2.default, - // minify-font-values should be run before discard-unused - postcssMinifyFontValues: _postcssMinifyFontValues2.default, - postcssDiscardUnused: _postcssDiscardUnused2.default, - postcssNormalizeUrl: _postcssNormalizeUrl2.default, - functionOptimiser: _functionOptimiser2.default, - filterOptimiser: _filterOptimiser2.default, - reduceBackgroundRepeat: _reduceBackgroundRepeat2.default, - reducePositions: _reducePositions2.default, - core: _core2.default, - // Optimisations after this are sensitive to previous optimisations in - // the pipe, such as whitespace normalising/selector re-ordering - postcssMergeIdents: _postcssMergeIdents2.default, - postcssReduceIdents: _postcssReduceIdents2.default, - postcssMergeLonghand: _postcssMergeLonghand2.default, - postcssDiscardDuplicates: _postcssDiscardDuplicates2.default, - postcssMergeRules: _postcssMergeRules2.default, - postcssDiscardEmpty: _postcssDiscardEmpty2.default, - postcssUniqueSelectors: _postcssUniqueSelectors2.default, - styleCache: _styleCache2.default -}; - -var defaultOptions = { - autoprefixer: { - add: false - }, - postcssConvertValues: { - length: false - }, - postcssNormalizeCharset: { - add: false - } -}; - -var safeOptions = { - postcssConvertValues: { - length: false - }, - postcssDiscardUnused: { - disable: true - }, - postcssMergeIdents: { - disable: true - }, - postcssReduceIdents: { - counterStyle: false, - gridTemplate: false, - keyframes: false - }, - postcssNormalizeUrl: { - stripWWW: false - }, - postcssZindex: { - disable: true - } -}; - -var cssnano = _postcss2.default.plugin('cssnano', function () { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - // Prevent PostCSS from throwing when safe is defined - if (options.safe === true) { - options.isSafe = true; - options.safe = null; - } - - var safe = options.isSafe; - var proc = (0, _postcss2.default)(); - var warnings = []; - - if (typeof options.fontFamily !== 'undefined' || typeof options.minifyFontWeight !== 'undefined') { - warnings.push('The fontFamily & minifyFontWeight options have been ' + 'consolidated into minifyFontValues, and are now deprecated.'); - if (!options.minifyFontValues) { - options.minifyFontValues = options.fontFamily; - } - } - - if (typeof options.singleCharset !== 'undefined') { - warnings.push('The singleCharset option has been renamed to ' + 'normalizeCharset, and is now deprecated.'); - options.normalizeCharset = options.singleCharset; - } - - if (warnings.length) { - proc.use(_postcss2.default.plugin('cssnano', function () { - return function (css, result) { - return warnings.forEach(function (w) { - return result.warn(w); - }); - }; - })); - } - - Object.keys(processors).forEach(function (plugin) { - var shortName = plugin.replace('postcss', ''); - shortName = shortName.slice(0, 1).toLowerCase() + shortName.slice(1); - - var opts = (0, _defined2.default)(options[shortName], options[plugin], options[(0, _decamelize2.default)(plugin, '-')]); - - if (opts === false) { - opts = { disable: true }; - } - - opts = (0, _objectAssign2.default)({}, defaultOptions[plugin], safe ? safeOptions[plugin] : null, opts); - - if (!opts.disable) { - proc.use(processors[plugin](opts)); - } - }); - - return proc; -}); - -cssnano.process = function (css) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - options.map = options.map || (options.sourcemap ? true : null); - return (0, _postcss2.default)([cssnano(options)]).process(css, options); -}; - -exports.default = cssnano; -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/core.js b/node_modules/cssnano/dist/lib/core.js deleted file mode 100644 index bbf393d..0000000 --- a/node_modules/cssnano/dist/lib/core.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var atrule = 'atrule'; -var decl = 'decl'; -var rule = 'rule'; - -function minimiseWhitespace(node) { - var type = node.type; - - if (~[decl, rule, atrule].indexOf(type) && node.raws.before) { - node.raws.before = node.raws.before.replace(/\s/g, ''); - } - if (type === decl) { - // Ensure that !important values do not have any excess whitespace - if (node.important) { - node.raws.important = '!important'; - } - // Remove whitespaces around ie 9 hack - node.value = node.value.replace(/\s*(\\9)\s*/, '$1'); - // Remove extra semicolons and whitespace before the declaration - if (node.raws.before) { - var prev = node.prev(); - if (prev && prev.type !== rule) { - node.raws.before = node.raws.before.replace(/;/g, ''); - } - } - node.raws.between = ':'; - node.raws.semicolon = false; - } else if (type === rule || type === atrule) { - node.raws.between = node.raws.after = ''; - node.raws.semicolon = false; - } -} - -exports.default = (0, _postcss.plugin)('cssnano-core', function () { - return function (css) { - css.walk(minimiseWhitespace); - // Remove final newline - css.raws.after = ''; - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/evenValues.js b/node_modules/cssnano/dist/lib/evenValues.js deleted file mode 100644 index 4340aa5..0000000 --- a/node_modules/cssnano/dist/lib/evenValues.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.default = getEvenValues; -function getEvenValues(list, index) { - return index % 2 === 0; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/filterOptimiser.js b/node_modules/cssnano/dist/lib/filterOptimiser.js deleted file mode 100644 index 2cb9793..0000000 --- a/node_modules/cssnano/dist/lib/filterOptimiser.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function filterOptimiser(decl) { - decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) { - if (node.type === 'function' || node.type === 'div' && node.value === ',') { - node.before = node.after = ''; - } - }).toString(); -} - -exports.default = (0, _postcss.plugin)('cssnano-filter-optimiser', function () { - return function (css) { - return css.walkDecls(/filter/, filterOptimiser); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/functionOptimiser.js b/node_modules/cssnano/dist/lib/functionOptimiser.js deleted file mode 100644 index 29ca07c..0000000 --- a/node_modules/cssnano/dist/lib/functionOptimiser.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function reduceCalcWhitespaces(node) { - if (node.type === 'space') { - node.value = ' '; - } else if (node.type === 'function') { - node.before = node.after = ''; - } -} - -function reduceWhitespaces(node) { - if (node.type === 'space') { - node.value = ' '; - } else if (node.type === 'div') { - node.before = node.after = ''; - } else if (node.type === 'function') { - node.before = node.after = ''; - if (node.value === 'calc') { - _postcssValueParser2.default.walk(node.nodes, reduceCalcWhitespaces); - return false; - } - } -} - -function transformDecls(decl) { - if (!/filter/.test(decl.prop)) { - decl.value = (0, _postcssValueParser2.default)(decl.value).walk(reduceWhitespaces).toString(); - } -} - -exports.default = (0, _postcss.plugin)('cssnano-function-optimiser', function () { - return function (css) { - return css.walkDecls(transformDecls); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/getArguments.js b/node_modules/cssnano/dist/lib/getArguments.js deleted file mode 100644 index bcb5a42..0000000 --- a/node_modules/cssnano/dist/lib/getArguments.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -exports.__esModule = true; -exports.default = getArguments; -function getArguments(node) { - return node.nodes.reduce(function (list, child) { - if (child.type !== 'div') { - list[list.length - 1].push(child); - } else { - list.push([]); - } - return list; - }, [[]]); -} -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/getMatch.js b/node_modules/cssnano/dist/lib/getMatch.js deleted file mode 100644 index 99cc023..0000000 --- a/node_modules/cssnano/dist/lib/getMatch.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.default = getMatchFactory; -function getMatchFactory(mappings) { - return function getMatch(args) { - return args.reduce(function (list, arg, i) { - return list.filter(function (keyword) { - return keyword[1][i] === arg; - }); - }, mappings); - }; -} -module.exports = exports["default"]; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/normalizeString.js b/node_modules/cssnano/dist/lib/normalizeString.js deleted file mode 100644 index 67ce44a..0000000 --- a/node_modules/cssnano/dist/lib/normalizeString.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var postcss = require('postcss'); -var valueParser = require('postcss-value-parser'); - -/* - * Constants (parser usage) - */ - -var SINGLE_QUOTE = 39; -var DOUBLE_QUOTE = 34; -var BACKSLASH = 92; -var NEWLINE = 10; -var SPACE = 32; -var FEED = 12; -var TAB = 9; -var CR = 13; - -var WORD_END = /[ \n\t\r\f'"\\]/g; - -/* - * Constants (node type strings) - */ - -var C_STRING = 'string'; -var C_ESCAPED_SINGLE_QUOTE = 'escapedSingleQuote'; -var C_ESCAPED_DOUBLE_QUOTE = 'escapedDoubleQuote'; -var C_SINGLE_QUOTE = 'singleQuote'; -var C_DOUBLE_QUOTE = 'doubleQuote'; -var C_NEWLINE = 'newline'; -var C_SINGLE = 'single'; - -/* - * Literals - */ - -var L_SINGLE_QUOTE = '\''; -var L_DOUBLE_QUOTE = '"'; -var L_NEWLINE = '\\\n'; - -/* - * Parser nodes - */ - -var T_ESCAPED_SINGLE_QUOTE = { type: C_ESCAPED_SINGLE_QUOTE, value: '\\\'' }; -var T_ESCAPED_DOUBLE_QUOTE = { type: C_ESCAPED_DOUBLE_QUOTE, value: '\\"' }; -var T_SINGLE_QUOTE = { type: C_SINGLE_QUOTE, value: L_SINGLE_QUOTE }; -var T_DOUBLE_QUOTE = { type: C_DOUBLE_QUOTE, value: L_DOUBLE_QUOTE }; -var T_NEWLINE = { type: C_NEWLINE, value: L_NEWLINE }; - -function stringify(ast) { - return ast.nodes.reduce(function (str, _ref) { - var value = _ref.value; - - // Collapse multiple line strings automatically - if (value === L_NEWLINE) { - return str; - } - return str + value; - }, ''); -} - -function parse(str) { - var code = void 0, - next = void 0, - value = void 0; - var pos = 0; - var len = str.length; - - var ast = { - nodes: [], - types: { - escapedSingleQuote: 0, - escapedDoubleQuote: 0, - singleQuote: 0, - doubleQuote: 0 - }, - quotes: false - }; - - while (pos < len) { - code = str.charCodeAt(pos); - switch (code) { - case SPACE: - case TAB: - case CR: - case FEED: - next = pos; - do { - next += 1; - code = str.charCodeAt(next); - } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED); - - ast.nodes.push({ - type: 'space', - value: str.slice(pos, next) - }); - pos = next - 1; - break; - case SINGLE_QUOTE: - ast.nodes.push(T_SINGLE_QUOTE); - ast.types[C_SINGLE_QUOTE]++; - ast.quotes = true; - break; - case DOUBLE_QUOTE: - ast.nodes.push(T_DOUBLE_QUOTE); - ast.types[C_DOUBLE_QUOTE]++; - ast.quotes = true; - break; - case BACKSLASH: - next = pos + 1; - if (str.charCodeAt(next) === SINGLE_QUOTE) { - ast.nodes.push(T_ESCAPED_SINGLE_QUOTE); - ast.types[C_ESCAPED_SINGLE_QUOTE]++; - ast.quotes = true; - pos = next; - break; - } else if (str.charCodeAt(next) === DOUBLE_QUOTE) { - ast.nodes.push(T_ESCAPED_DOUBLE_QUOTE); - ast.types[C_ESCAPED_DOUBLE_QUOTE]++; - ast.quotes = true; - pos = next; - break; - } else if (str.charCodeAt(next) === NEWLINE) { - ast.nodes.push(T_NEWLINE); - pos = next; - break; - } - /* - * We need to fall through here to handle the token as - * a whole word. The missing 'break' is intentional. - */ - default: - WORD_END.lastIndex = pos + 1; - WORD_END.test(str); - - if (WORD_END.lastIndex === 0) { - next = len - 1; - } else { - next = WORD_END.lastIndex - 2; - } - - value = str.slice(pos, next + 1); - - ast.nodes.push({ - type: C_STRING, - value: value - }); - - pos = next; - } - pos++; - } - - return ast; -} - -function changeWrappingQuotes(node, ast) { - var types = ast.types; - - if (types[C_SINGLE_QUOTE] || types[C_DOUBLE_QUOTE]) { - return; - } - - if (node.quote === L_SINGLE_QUOTE && types[C_ESCAPED_SINGLE_QUOTE] > 0 && !types[C_ESCAPED_DOUBLE_QUOTE]) { - node.quote = L_DOUBLE_QUOTE; - } - - if (node.quote === L_DOUBLE_QUOTE && types[C_ESCAPED_DOUBLE_QUOTE] > 0 && !types[C_ESCAPED_SINGLE_QUOTE]) { - node.quote = L_SINGLE_QUOTE; - } - - ast.nodes = ast.nodes.reduce(function (newAst, child) { - if (child.type === C_ESCAPED_DOUBLE_QUOTE && node.quote === L_SINGLE_QUOTE) { - return [].concat(newAst, [T_DOUBLE_QUOTE]); - } - if (child.type === C_ESCAPED_SINGLE_QUOTE && node.quote === L_DOUBLE_QUOTE) { - return [].concat(newAst, [T_SINGLE_QUOTE]); - } - return [].concat(newAst, [child]); - }, []); -} - -function normalize(value, preferredQuote) { - if (!value || !value.length) { - return value; - } - return valueParser(value).walk(function (child) { - if (child.type !== C_STRING) { - return; - } - var ast = parse(child.value); - if (ast.quotes) { - changeWrappingQuotes(child, ast); - } else if (preferredQuote === C_SINGLE) { - child.quote = L_SINGLE_QUOTE; - } else { - child.quote = L_DOUBLE_QUOTE; - } - child.value = stringify(ast); - }).toString(); -} - -exports.default = postcss.plugin('cssnano-normalize-string', function (opts) { - var _preferredQuote$opts = _extends({ - preferredQuote: 'double' - }, opts), - preferredQuote = _preferredQuote$opts.preferredQuote; - - return function (css) { - css.walk(function (node) { - if (node.type === 'rule') { - node.selector = normalize(node.selector, preferredQuote); - } - if (node.type === 'decl') { - node.value = normalize(node.value, preferredQuote); - } - if (node.type === 'atrule') { - node.params = normalize(node.params, preferredQuote); - } - }); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/normalizeUnicode.js b/node_modules/cssnano/dist/lib/normalizeUnicode.js deleted file mode 100644 index 622afb7..0000000 --- a/node_modules/cssnano/dist/lib/normalizeUnicode.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcss2 = _interopRequireDefault(_postcss); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function unicode(range) { - var values = range.slice(2).split('-'); - if (values.length < 2) { - return range; - } - var left = values[0].split(''); - var right = values[1].split(''); - - if (left.length !== right.length) { - return range; - } - - var questionCounter = 0; - - var merged = left.reduce(function (group, value, index) { - if (group === false) { - return false; - } - if (value === right[index] && !questionCounter) { - return group + value; - } - if (value === '0' && right[index] === 'f') { - questionCounter++; - return group + '?'; - } - return false; - }, 'u+'); - - /* - * The maximum number of wildcard characters (?) for ranges is 5. - */ - - if (merged && questionCounter < 6) { - return merged; - } - - return range; -} - -exports.default = _postcss2.default.plugin('cssnano-normalize-unicode', function () { - return function (css) { - css.walkDecls(/^unicode-range$/i, function (node) { - node.prop = 'unicode-range'; - node.value = (0, _postcssValueParser2.default)(node.value).walk(function (child) { - if (child.type === 'word') { - child.value = unicode(child.value.toLowerCase()); - } - return false; - }).toString(); - }); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/reduceBackgroundRepeat.js b/node_modules/cssnano/dist/lib/reduceBackgroundRepeat.js deleted file mode 100644 index 50709c5..0000000 --- a/node_modules/cssnano/dist/lib/reduceBackgroundRepeat.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcss2 = _interopRequireDefault(_postcss); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -var _evenValues = require('./evenValues'); - -var _evenValues2 = _interopRequireDefault(_evenValues); - -var _getArguments = require('./getArguments'); - -var _getArguments2 = _interopRequireDefault(_getArguments); - -var _getMatch = require('./getMatch'); - -var _getMatch2 = _interopRequireDefault(_getMatch); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var mappings = [['repeat-x', ['repeat', 'no-repeat']], ['repeat-y', ['no-repeat', 'repeat']], ['repeat', ['repeat', 'repeat']], ['space', ['space', 'space']], ['round', ['round', 'round']], ['no-repeat', ['no-repeat', 'no-repeat']]]; - -var repeat = [mappings[0][0], mappings[1][0], mappings[2][0], mappings[3][0], mappings[4][0], mappings[5][0]]; - -var getMatch = (0, _getMatch2.default)(mappings); - -function transform(decl) { - var values = (0, _postcssValueParser2.default)(decl.value); - if (values.nodes.length === 1) { - return; - } - var args = (0, _getArguments2.default)(values); - var relevant = []; - args.forEach(function (arg) { - relevant.push({ - start: null, - end: null - }); - arg.forEach(function (part, index) { - var isRepeat = ~repeat.indexOf(part.value); - var len = relevant.length - 1; - if (relevant[len].start === null && isRepeat) { - relevant[len].start = index; - relevant[len].end = index; - return; - } - if (relevant[len].start !== null) { - if (part.type === 'space') { - return; - } else if (isRepeat) { - relevant[len].end = index; - return; - } - return; - } - }); - }); - relevant.forEach(function (range, index) { - if (range.start === null) { - return; - } - var val = args[index].slice(range.start, range.end + 1); - if (val.length !== 3) { - return; - } - var match = getMatch(val.filter(_evenValues2.default).map(function (n) { - return n.value; - })); - if (match.length) { - args[index][range.start].value = match[0][0]; - args[index][range.start + 1].value = ''; - args[index][range.end].value = ''; - } - }); - decl.value = values.toString(); -} - -var plugin = _postcss2.default.plugin('cssnano-reduce-background-repeat', function () { - return function (css) { - return css.walkDecls(/background(-repeat|$)/, transform); - }; -}); - -plugin.mappings = mappings; - -exports.default = plugin; -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/reduceDisplayValues.js b/node_modules/cssnano/dist/lib/reduceDisplayValues.js deleted file mode 100644 index aba6c43..0000000 --- a/node_modules/cssnano/dist/lib/reduceDisplayValues.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcss2 = _interopRequireDefault(_postcss); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -var _evenValues = require('./evenValues'); - -var _evenValues2 = _interopRequireDefault(_evenValues); - -var _getMatch = require('./getMatch'); - -var _getMatch2 = _interopRequireDefault(_getMatch); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Specification: https://drafts.csswg.org/css-display/#the-display-properties - */ - -var mappings = [['block', ['block', 'flow']], ['flow-root', ['block', 'flow-root']], ['inline', ['inline', 'flow']], ['inline-block', ['inline', 'flow-root']], ['run-in', ['run-in', 'flow']], ['list-item', ['list-item', 'block', 'flow']], ['inline-list-item', ['list-item', 'inline', 'flow']], ['flex', ['block', 'flex']], ['inline-flex', ['inline', 'flex']], ['grid', ['block', 'grid']], ['inline-grid', ['inline', 'grid']], ['ruby', ['inline', 'ruby']], ['table', ['block', 'table']], ['inline-table', ['inline', 'table']], ['table-cell', ['table-cell', 'flow']], ['table-caption', ['table-caption', 'flow']], ['ruby-base', ['ruby-base', 'flow']], ['ruby-text', ['ruby-text', 'flow']]]; - -var getMatch = (0, _getMatch2.default)(mappings); - -function transform(node) { - var _valueParser = (0, _postcssValueParser2.default)(node.value), - nodes = _valueParser.nodes; - - if (nodes.length === 1) { - return; - } - var match = getMatch(nodes.filter(_evenValues2.default).map(function (n) { - return n.value; - })); - if (match.length) { - node.value = match[0][0]; - } -} - -var plugin = _postcss2.default.plugin('cssnano-reduce-display-values', function () { - return function (css) { - return css.walkDecls('display', transform); - }; -}); - -plugin.mappings = mappings; - -exports.default = plugin; -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/reducePositions.js b/node_modules/cssnano/dist/lib/reducePositions.js deleted file mode 100644 index 800857e..0000000 --- a/node_modules/cssnano/dist/lib/reducePositions.js +++ /dev/null @@ -1,119 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _postcss = require('postcss'); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -var _has = require('has'); - -var _has2 = _interopRequireDefault(_has); - -var _getArguments = require('./getArguments'); - -var _getArguments2 = _interopRequireDefault(_getArguments); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var directions = ['top', 'right', 'bottom', 'left', 'center']; -var properties = ['background', 'background-position', '-webkit-perspective-origin', 'perspective-origin']; - -var center = '50%'; - -var horizontal = { - right: '100%', - left: '0' -}; - -var vertical = { - bottom: '100%', - top: '0' -}; - -function transform(decl) { - if (!~properties.indexOf(decl.prop)) { - return; - } - var values = (0, _postcssValueParser2.default)(decl.value); - var args = (0, _getArguments2.default)(values); - var relevant = []; - args.forEach(function (arg) { - relevant.push({ - start: null, - end: null - }); - arg.forEach(function (part, index) { - var isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value); - var len = relevant.length - 1; - if (relevant[len].start === null && isPosition) { - relevant[len].start = index; - relevant[len].end = index; - return; - } - if (relevant[len].start !== null) { - if (part.type === 'space') { - return; - } else if (isPosition) { - relevant[len].end = index; - return; - } - return; - } - }); - }); - relevant.forEach(function (range, index) { - if (range.start === null) { - return; - } - var position = args[index].slice(range.start, range.end + 1); - if (position.length > 3) { - return; - } - if (position.length === 1 || position[2].value === 'center') { - if (position[2]) { - position[2].value = position[1].value = ''; - } - var value = position[0].value; - - var map = _extends({}, horizontal, { - center: center - }); - if ((0, _has2.default)(map, value)) { - position[0].value = map[value]; - } - return; - } - if (position[0].value === 'center' && ~directions.indexOf(position[2].value)) { - position[0].value = position[1].value = ''; - var _value = position[2].value; - - if ((0, _has2.default)(horizontal, _value)) { - position[2].value = horizontal[_value]; - } - return; - } - if ((0, _has2.default)(horizontal, position[0].value) && (0, _has2.default)(vertical, position[2].value)) { - position[0].value = horizontal[position[0].value]; - position[2].value = vertical[position[2].value]; - return; - } else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) { - var first = position[0].value; - position[0].value = horizontal[position[2].value]; - position[2].value = vertical[first]; - return; - } - }); - decl.value = values.toString(); -} - -exports.default = (0, _postcss.plugin)('cssnano-reduce-positions', function () { - return function (css) { - return css.walkDecls(transform); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/reduceTimingFunctions.js b/node_modules/cssnano/dist/lib/reduceTimingFunctions.js deleted file mode 100644 index 77c09be..0000000 --- a/node_modules/cssnano/dist/lib/reduceTimingFunctions.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -var _postcssValueParser = require('postcss-value-parser'); - -var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); - -var _evenValues = require('./evenValues'); - -var _evenValues2 = _interopRequireDefault(_evenValues); - -var _getMatch = require('./getMatch'); - -var _getMatch2 = _interopRequireDefault(_getMatch); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var keywords = [['ease', [0.25, 0.1, 0.25, 1]], ['linear', [0, 0, 1, 1]], ['ease-in', [0.42, 0, 1, 1]], ['ease-out', [0, 0, 0.58, 1]], ['ease-in-out', [0.42, 0, 0.58, 1]]]; - -var getValue = function getValue(node) { - return parseFloat(node.value); -}; -var getMatch = (0, _getMatch2.default)(keywords); - -function reduce(node) { - if (node.type !== 'function') { - return false; - } - if (node.value === 'steps') { - // Don't bother checking the step-end case as it has the same length - // as steps(1) - if (getValue(node.nodes[0]) === 1 && node.nodes[2] && node.nodes[2].value === 'start') { - node.type = 'word'; - node.value = 'step-start'; - delete node.nodes; - return; - } - // The end case is actually the browser default, so it isn't required. - if (node.nodes[2] && node.nodes[2].value === 'end') { - node.nodes = [node.nodes[0]]; - return; - } - return false; - } - if (node.value === 'cubic-bezier') { - var match = getMatch(node.nodes.filter(_evenValues2.default).map(getValue)); - - if (match.length) { - node.type = 'word'; - node.value = match[0][0]; - delete node.nodes; - return; - } - } -} - -exports.default = (0, _postcss.plugin)('cssnano-reduce-timing-functions', function () { - return function (css) { - css.walkDecls(/(animation|transition)(-timing-function|$)/, function (decl) { - decl.value = (0, _postcssValueParser2.default)(decl.value).walk(reduce).toString(); - }); - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/dist/lib/styleCache.js b/node_modules/cssnano/dist/lib/styleCache.js deleted file mode 100644 index 75a7757..0000000 --- a/node_modules/cssnano/dist/lib/styleCache.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -exports.__esModule = true; - -var _postcss = require('postcss'); - -exports.default = (0, _postcss.plugin)('cssnano-reset-stylecache', function () { - return function (css, result) { - result.root.rawCache = { - colon: ':', - indent: '', - beforeDecl: '', - beforeRule: '', - beforeOpen: '', - beforeClose: '', - beforeComment: '', - after: '', - emptyBody: '', - commentLeft: '', - commentRight: '' - }; - }; -}); -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/cssnano/package.json b/node_modules/cssnano/package.json deleted file mode 100644 index 5fde2fc..0000000 --- a/node_modules/cssnano/package.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "cssnano@>=2.6.1 <4", - "scope": null, - "escapedName": "cssnano", - "name": "cssnano", - "rawSpec": ">=2.6.1 <4", - "spec": ">=2.6.1 <4.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/css-loader" - ] - ], - "_from": "cssnano@>=2.6.1 <4.0.0", - "_id": "cssnano@3.10.0", - "_inCache": true, - "_location": "/cssnano", - "_nodeVersion": "6.9.1", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/cssnano-3.10.0.tgz_1483482352373_0.926899996586144" - }, - "_npmUser": { - "name": "beneb", - "email": "beneb.info@gmail.com" - }, - "_npmVersion": "3.10.8", - "_phantomChildren": {}, - "_requested": { - "raw": "cssnano@>=2.6.1 <4", - "scope": null, - "escapedName": "cssnano", - "name": "cssnano", - "rawSpec": ">=2.6.1 <4", - "spec": ">=2.6.1 <4.0.0", - "type": "range" - }, - "_requiredBy": [ - "/css-loader" - ], - "_resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz", - "_shasum": "4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38", - "_shrinkwrap": null, - "_spec": "cssnano@>=2.6.1 <4", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/css-loader", - "author": { - "name": "Ben Briggs", - "email": "beneb.info@gmail.com", - "url": "http://beneb.info" - }, - "ava": { - "require": "babel-core/register" - }, - "bugs": { - "url": "https://github.com/ben-eb/cssnano/issues" - }, - "dependencies": { - "autoprefixer": "^6.3.1", - "decamelize": "^1.1.2", - "defined": "^1.0.0", - "has": "^1.0.1", - "object-assign": "^4.0.1", - "postcss": "^5.0.14", - "postcss-calc": "^5.2.0", - "postcss-colormin": "^2.1.8", - "postcss-convert-values": "^2.3.4", - "postcss-discard-comments": "^2.0.4", - "postcss-discard-duplicates": "^2.0.1", - "postcss-discard-empty": "^2.0.1", - "postcss-discard-overridden": "^0.1.1", - "postcss-discard-unused": "^2.2.1", - "postcss-filter-plugins": "^2.0.0", - "postcss-merge-idents": "^2.1.5", - "postcss-merge-longhand": "^2.0.1", - "postcss-merge-rules": "^2.0.3", - "postcss-minify-font-values": "^1.0.2", - "postcss-minify-gradients": "^1.0.1", - "postcss-minify-params": "^1.0.4", - "postcss-minify-selectors": "^2.0.4", - "postcss-normalize-charset": "^1.1.0", - "postcss-normalize-url": "^3.0.7", - "postcss-ordered-values": "^2.1.0", - "postcss-reduce-idents": "^2.2.2", - "postcss-reduce-initial": "^1.0.0", - "postcss-reduce-transforms": "^1.0.3", - "postcss-svgo": "^2.1.1", - "postcss-unique-selectors": "^2.0.2", - "postcss-value-parser": "^3.2.3", - "postcss-zindex": "^2.0.1" - }, - "description": "A modular minifier, built on top of the PostCSS ecosystem.", - "devDependencies": { - "array-to-sentence": "^1.1.0", - "ava": "^0.17.0", - "babel-cli": "^6.5.1", - "babel-core": "^6.5.1", - "babel-loader": "^6.2.4", - "babel-plugin-add-module-exports": "^0.2.0", - "babel-plugin-precompile-charcodes": "^1.0.0", - "babel-preset-es2015-loose": "^7.0.0", - "babel-preset-stage-0": "^6.5.0", - "coveralls": "^2.11.6", - "cross-env": "^2.0.0", - "css-frameworks": "git+https://git@github.com/ben-eb/css-frameworks.git", - "css-minifier-tests": "git+https://git@github.com/ben-eb/css-minifier-tests.git", - "del-cli": "^0.2.0", - "eslint": "^3.0.0", - "eslint-config-cssnano": "^3.0.0", - "eslint-plugin-babel": "^3.3.0", - "eslint-plugin-import": "^2.0.1", - "gh-pages": "^0.11.0", - "json-loader": "^0.5.4", - "ncp": "^2.0.0", - "nyc": "^10.0.0", - "postcss-font-magician": "^1.5.0", - "webpack": "^1.12.13", - "webpack-bundle-size-analyzer": "^2.0.2" - }, - "directories": {}, - "dist": { - "shasum": "4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38", - "tarball": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz" - }, - "eslintConfig": { - "extends": "cssnano" - }, - "files": [ - "dist", - "LICENSE-MIT", - "quickstart.js" - ], - "gitHead": "355c6ec30fe77a505f4b3c8d4c37db421e5109c8", - "homepage": "https://github.com/ben-eb/cssnano", - "keywords": [ - "css", - "compress", - "minify", - "optimise", - "optimisation", - "postcss", - "postcss-plugin" - ], - "license": "MIT", - "main": "dist/index.js", - "maintainers": [ - { - "name": "beneb", - "email": "beneb.info@gmail.com" - }, - { - "name": "trysound", - "email": "trysound@yandex.ru" - } - ], - "name": "cssnano", - "nyc": { - "exclude": [ - "node_modules", - "**/__tests__" - ] - }, - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/ben-eb/cssnano.git" - }, - "scripts": { - "bundle-size": "webpack --json --config src/__tests__/_webpack.config.js | webpack-bundle-size-analyzer", - "docs": "cd docs && npm run build && cd .. && gh-pages -d docs/dist", - "prepublish": "del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/", - "pretest": "eslint --ignore-path .gitignore src", - "report": "nyc report --reporter=html", - "test": "nyc ava src/__tests__/*.js", - "test-012": "nyc ava src/__tests__/*.js" - }, - "tonicExampleFilename": "quickstart.js", - "version": "3.10.0" -} diff --git a/node_modules/cssnano/quickstart.js b/node_modules/cssnano/quickstart.js deleted file mode 100644 index 0b6cb3f..0000000 --- a/node_modules/cssnano/quickstart.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This example targets Node 4 and up. - */ - -const cssnano = require('cssnano'); - -/* - * Add your CSS code here. - */ - -const css = ` -h1 { - color: #ff0000; - font-weight: bold; -} -`; - -/* - * Add your configuration here; see http://cssnano.co/options/ and - * http://cssnano.co/optimisations/ for more details. - * - * For example you can turn off z-index rebasing by setting `zindex: false` - * in your config, or you can use `safe: true` which will turn off unsafe - * optimisations. - */ - -const opts = { - -}; - -/* - * Compress the CSS asynchronously and log it to the console. - */ - -cssnano.process(css, opts).then(result => { - console.log(result.css); -}); diff --git a/node_modules/csso/HISTORY.md b/node_modules/csso/HISTORY.md deleted file mode 100644 index 6d46967..0000000 --- a/node_modules/csso/HISTORY.md +++ /dev/null @@ -1,312 +0,0 @@ -## 2.2.1 (July 25, 2016) - -- Fixed shorthand optimisation issue when value has a color value or something unknown (#311) -- Fixed `cursor` broken fallback (#306) - -## 2.2.0 (June 23, 2016) - -- Implement AST cloning by adding `clone()` [function](https://github.com/css/csso#cloneast) and `clone` [option](https://github.com/css/csso#compressast-options) for `compress()` function (#296) -- Fix parse and translate attribute selector with flags but w/o operator (i.e. `[attrName i]`) -- Don't merge rules with flagged attribute selectors with others (#291) -- Take in account functions when merge TRBL-properties (#297, thanks to @ArturAralin) -- Improve partial merge (#304) -- Tweak scanner, reduce code deoptimizations and other small improvements - -## 2.1.1 (May 11, 2016) - -- Fix wrong declaration with `\9` hack merge (#295) - -## 2.1.0 (May 8, 2016) - -- New option `comments` to specify what comments to left: `exclamation`, `first-exclamation` and `none` -- Add `offset` to CSS parse error details -- Fix token `offset` computation - -## 2.0.0 (April 5, 2016) - -- No more `gonzales` AST format and related code -- `minify()` and `minifyBlock()` is always return an object as result now (i.e. `{ css: String, map: SourceMapGenerator or null }`) -- `parse()` - - Returns AST in new format (so called `internal`) - - Dynamic scanner implemented - - New AST format + dynamic scanner = performance boost and less memory consumption - - No more `context` argument, context should be specified via `options` - - Supported contexts now: `stylesheet`, `atrule`, `atruleExpression`, `ruleset`, `selector`, `simpleSelector`, `block`, `declaration` and `value` - - Drop `needPositions` option, `positions` option should be used instead - - Drop `needInfo` option, `info` object is attaching to nodes when some information is requested by `options` - - `options` should be an object, otherwise it treats as empty object -- `compress()` - - No more AST converting (performance boost and less memory consumption) - - Drop `outputAst` option - - Returns an object as result instead of AST (i.e. `{ ast: Object }`) -- Drop methods: `justDoIt()`, `stringify()`, `cleanInfo()` - -## 1.8.1 (March 30, 2016) - -- Don't remove spaces after function/braces/urls since unsafe (#289) - -## 1.8.0 (March 24, 2016) - -- Usage data support: - - Filter rulesets by tag names, class names and ids white lists. - - More aggressive ruleset moving using class name scopes information. - - New CLI option `--usage` to pass usage data file. -- Improve initial ruleset merge - - Change order of ruleset processing, now it's left to right. Previously unmerged rulesets may prevent lookup and other rulesets merge. - - Difference in pseudo signature just prevents ruleset merging, but don't stop lookup. - - Simplify block comparison (performance). -- New method `csso.minifyBlock()` for css block compression (e.g. `style` attribute content). -- Ruleset merge improvement: at-rules with block (like `@media` or `@supports`) now can be skipped during ruleset merge lookup if doesn't contain something prevents it. -- FIX: Add negation (`:not()`) to pseudo signature to avoid unsafe merge (old browsers doesn't support it). -- FIX: Check nested parts of value when compute compatibility. It fixes unsafe property merging. - -## 1.7.1 (March 16, 2016) - -- pass block mode to tokenizer for correct parsing of declarations properties with `//` hack -- fix wrongly `@import` and `@charset` removal on double exclamation comment - -## 1.7.0 (March 10, 2016) - -- support for [CSS Custom Properties](https://www.w3.org/TR/css-variables/) (#279) -- rework RTBL properties merge – better merge for values with special units and don't merge values with CSS-wide keywords (#255) -- remove redundant universal selectors (#178) -- take in account `!important` when check for property overriding (#280) -- don't merge `text-align` declarations with some values (#281) -- add spaces around `/deep/` combinator on translate, since it together with universal selector can produce a comment -- better keyword and property name resolving (tolerant to hacks and so on) -- integration improvements - - compression log function could be customized by `logger` option for `compress()` and `minify()` - - make possible to set initial line and column for parser - -## 1.6.4 (March 1, 2016) - -- `npm` publish issue (#276) - -## 1.6.3 (February 29, 2016) - -- add `file` to generated source map since other tools can relay on it in source map transform chain - -## 1.6.2 (February 29, 2016) - -- tweak some parse error messages and their positions -- fix `:not()` parsing and selector groups in `:not()` is supported now (#215) -- `needPosition` parser option is deprecated, `positions` option should be used instead (`needPosition` is used still if `positions` option omitted) -- expose internal AST API as `csso.internal.*` -- `minify()` adds `sourcesContent` by default when source map is generated -- bring back support for node.js `0.10` until major release (#275) - -## 1.6.1 (February 28, 2016) - -- fix exception on zero length dimension compress outside declaration (#273) - -## 1.6.0 (February 27, 2016) - -- **source maps support** -- parser remake: - - various parsing issues fixed - - fix unicode sequence processing in ident (#191) - - support for flags in attribute selector (#270) - - position (line and column) of parse error (#109) - - 4x performance boost, less memory consumption -- compressor refactoring - - internal AST is using doubly linked lists (with safe transformation support during iteration) instead of arrays - - rename `restructuring` to `restructure` option for `minify()`/`compress()` (`restructuring` is alias for `restructure` now, with lower priority) - - unquote urls when possible (#141, #60) -- setup code coverage and a number of related fixes -- add eslint to check unused things - -## 1.5.4 (January 27, 2016) - -- one more fix (in `restructRuleset` this time) with merge of rulesets when a ruleset with same specificity places between them (#264) -- disable partial merge of rulesets in `@keyframes` rulesets (until sure it's correct) - -## 1.5.3 (January 25, 2016) - -- don't override display values with different browser support (#259) -- fix publish issue (one of modules leak in development state) - -## 1.5.2 (January 24, 2016) - -- don't merge rulesets if between them a ruleset with same specificity (#264) - -## 1.5.1 (January 14, 2016) - -- ensure `-` is not used as an identifier in attribute selectors (thanks to @mathiasbynens) -- fix broken `justDoIt()` function -- various small fixes - -## 1.5.0 (January 14, 2016) - -### Parser - -- attach minus to number - -### Compressor - -- split code base into small modules and related refactoring -- introduce internal AST format for compressor (`gonzales`→`internal` and `internal`→`gonzales` convertors, walkers, translator) -- various optimizations: no snapshots, using caches and indexes -- sort selectors, merge selectors in alphabet order -- compute selector's specificity -- better ruleset restructuring, improve compression of partially equal blocks -- better ruleset merge – not only closest but also disjoined by other rulesets when safe -- join `@media` with same query -- `outputAst` – new option to specify output AST format (`gonzales` by default for backward compatibility) -- remove quotes surrounding attribute values in attribute selectors when possible (#73) -- replace `from`→`0%` and `100%`→`to` at `@keyframes` (#205) -- prevent partial merge of rulesets at `@keyframes` (#80, #197) - -### API - -- walker for `gonzales` AST was implemented - -### CLI - -- new option `--stat` (output stat in `stderr`) -- new optional parameter `level` for `--debug` option - -## 1.4.4 (December 10, 2015) - -- prevent removal of spaces after braces that before identifier that breaking at-rules expressions (#258) - -## 1.4.3 (December 4, 2015) - -- fix unicode-range parsing that cause to wrong function detection (#250) - -## 1.4.2 (November 9, 2015) - -- allow spaces between `progid:` and rest part of value for IE's `filter` property as `autoprefixer` generates this kind of code (#249) -- fixes for Windows: - - correct processing new lines - - normalize file content in test suite -- fixes to work in strict mode (#252) -- init compressor dictionaries for every css block (#248, #251) -- bump uglify-js version - -## 1.4.1 (October 20, 2015) - -- allow merge for `display` property (#167, #244) -- more accurate `rect` (`clip` property value) merge -- fix typo when specifying options in cli (thanks to @Taritsyn) -- fix safe unit values merge with keyword values (#244) -- fix wrong descendant combinator removal (#246) -- build browser version on `prepublish` (thanks to @silentroach) -- parser: store whitespaces as single token (performance and reduce memory consumption) -- rearrange compress tests layout - -## 1.4 (October 16, 2015) - -Bringing project back to life. Changed files structure, cleaned up and refactored most of sources. - -### Common - -- single code base (no more `src` folder) -- build browser version with `browserify` (no more `make`, and `web` folder), browser version is available at `dist/csso-browser.js` -- main file is `lib/index.js` now -- minimal `node.js` version is `0.12` now -- restrict file list to publish on npm (no more useless folders and files in package) -- add `jscs` to control code style -- automate `gh-pages` update -- util functions reworked -- translator reworked -- test suite reworked -- compressor refactored -- initial parser refactoring - -### API - -- new method `minify(src, options)`, options: - - `restructuring` – if set to `false`, disable structure optimisations (`true` by default) - - `debug` - outputs intermediate state of CSS during compression (`false` by default) -- deprecate `justDoIt()` method (use `minify` instead) -- rename `treeToString()` method to `stringify()` -- drop `printTree()` method -- AST node info - - `column` and `offset` added - - `ln` renamed to `line` - - fix line counting across multiple files and input with CR LF (#147) - -### CLI - -- completely reworked, use [clap](https://github.com/lahmatiy/clap) to parse argv -- add support for input from stdin (#128) -- drop undocumented and obsoleted options `--rule` and `--parser` (suppose nobody use it) -- drop `-off` alias for `--restructure-off` as incorrect (only one letter options should starts with single `-`) -- new option `--debug` that reflecting to `options.debug` for `minify` - -### Parsing and optimizations - -- keep all exclamation comments (#194) -- add `/deep/` combinator support (#209) -- attribute selector - - allow colon in attribute name (#237) - - support for namespaces (#233) -- color - - support all css/html colors - - convert `hsla` to `rgba` and `hls` to `rgb` - - convert `rgba` with 1 as alpha value to `rgb` (#122) - - interpolate `rgb` and `rgba` percentage values to absolute values - - replace percentage values in `rgba` for normalized/interpolated values - - lowercase hex colors and color names (#169) - - fix color minification when hex value replaced for color name (#176) - - fit rgb values to 0..255 range (#181) -- calc - - remove spaces for multiple operator in calc - - don't remove units inside calc (#222) - - fix wrong white space removal around `+` and `-` (#228) -- don't remove units in `flex` property as it could change value meaning (#200) -- don't merge `\9` hack values (#231) -- merge property values only if they have the same functions (#150, #227) -- don't merge property values with some sort of units (#140, #161) -- fix `!important` issue for `top-right-bottom-left` properties (#189) -- fix `top-right-bottom-left` properties merge (#139, #175) -- support for unicode-range (#148) -- don't crash on ruleset with no selector (#135) -- tolerant to class names that starts with digit (#99, #105) -- fix background compressing (#170) - -## 1.3.12 (October 8, 2015) - -- Case insensitive check for `!important` (#187) -- Fix problems with using `csso` as cli command on Windows (#83, #136, #142 and others) -- Remove byte order marker (the UTF-8 BOM) from input -- Don't strip space between funktion-funktion and funktion-vhash (#134) -- Don't merge TRBL values having \9 (hack for IE8 in bootstrap) (#159, #214, #230, #231 and others) -- Don't strip units off dimensions of non-length (#226, #229 and others) - -## 1.3.7 (February 11, 2013) - -- Gonzales 1.0.7. - -## 1.3.6 (November 26, 2012) - -- Gonzales 1.0.6. - -## 1.3.5 (October 28, 2012) - -- Gonzales 1.0.5. -- Protecting copyright notices in CSS: https://github.com/css/csso/issues/92 -- Zero CSS throws an error: https://github.com/css/csso/issues/96 -- Don't minify the second `0s` in Firefox for animations: https://github.com/css/csso/issues/100 -- Japan manual -- BEM ready documentation - -## 1.3.4 (October 10, 2012) - -- @page inside @media Causes Error: https://github.com/css/csso/issues/90 - -## 1.3.3 (October 9, 2012) - -- CSSO 1.3.2 compresses ".t-1" and ".t-01" as identical classes: https://github.com/css/csso/issues/88 - -## 1.3.2 (October 8, 2012) - -- filter + important breaks CSSO v1.3.1: https://github.com/css/csso/issues/87 - -## 1.3.1 (October 8, 2012) - -- "filter" IE property breaks CSSO v1.3.0: https://github.com/css/csso/issues/86 - -## 1.3.0 (October 4, 2012) - -- PeCode CSS parser replaced by Gonzales CSS parser diff --git a/node_modules/csso/LICENSE b/node_modules/csso/LICENSE deleted file mode 100644 index 972f137..0000000 --- a/node_modules/csso/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2011-2015 by Sergey Kryzhanovsky - -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/csso/README.md b/node_modules/csso/README.md deleted file mode 100644 index b78e82d..0000000 --- a/node_modules/csso/README.md +++ /dev/null @@ -1,405 +0,0 @@ -[![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso) -[![Build Status](https://travis-ci.org/css/csso.svg?branch=master)](https://travis-ci.org/css/csso) -[![Coverage Status](https://coveralls.io/repos/github/css/csso/badge.svg?branch=master)](https://coveralls.io/github/css/csso?branch=master) -[![NPM Downloads](https://img.shields.io/npm/dm/csso.svg)](https://www.npmjs.com/package/csso) -[![Twitter](https://img.shields.io/badge/Twitter-@cssoptimizer-blue.svg)](https://twitter.com/cssoptimizer) - -CSSO (CSS Optimizer) is a CSS minifier. It performs three sort of transformations: cleaning (removing redundant), compression (replacement for shorter form) and restructuring (merge of declarations, rulesets and so on). As a result your CSS becomes much smaller. - -[![Originated by Yandex](https://cdn.rawgit.com/css/csso/8d1b89211ac425909f735e7d5df87ee16c2feec6/docs/yandex.svg)](https://www.yandex.com/) -[![Sponsored by Avito](https://cdn.rawgit.com/css/csso/8d1b89211ac425909f735e7d5df87ee16c2feec6/docs/avito.svg)](https://www.avito.ru/) - -## Usage - -``` -npm install -g csso -``` - -Or try out CSSO [right in your browser](http://css.github.io/csso/csso.html) (web interface). - -### Runners - -- Gulp: [gulp-csso](https://github.com/ben-eb/gulp-csso) -- Grunt: [grunt-csso](https://github.com/t32k/grunt-csso) -- Broccoli: [broccoli-csso](https://github.com/sindresorhus/broccoli-csso) -- PostCSS: [postcss-csso](https://github.com/lahmatiy/postcss-csso) -- Webpack: [csso-loader](https://github.com/sandark7/csso-loader) - -### Command line - -``` -csso [input] [output] [options] - -Options: - - --comments Comments to keep: exclamation (default), first-exclamation or none - --debug [level] Output intermediate state of CSS during compression - -h, --help Output usage information - -i, --input Input file - --input-map Input source map: none, auto (default) or - -m, --map Generate source map: none (default), inline, file or - -o, --output Output file (result outputs to stdout if not set) - --restructure-off Turns structure minimization off - --stat Output statistics in stderr - -u, --usage Usage data file - -v, --version Output version -``` - -Some examples: - -``` -> csso in.css -...output result in stdout... - -> csso in.css --output out.css - -> echo '.test { color: #ff0000; }' | csso -.test{color:red} - -> cat source1.css source2.css | csso | gzip -9 -c > production.css.gz -``` - -### Source maps - -Source map doesn't generate by default. To generate map use `--map` CLI option, that can be: - -- `none` (default) – don't generate source map -- `inline` – add source map into result CSS (via `/*# sourceMappingURL=application/json;base64,... */`) -- `file` – write source map into file with same name as output file, but with `.map` extension (in this case `--output` option is required) -- any other values treat as filename for generated source map - -Examples: - -``` -> csso my.css --map inline -> csso my.css --output my.min.css --map file -> csso my.css --output my.min.css --map maps/my.min.map -``` - -Use `--input-map` option to specify input source map if needed. Possible values for option: - -- `auto` (default) - attempt to fetch input source map by follow steps: - - try to fetch inline map from input - - try to fetch source map filename from input and read its content - - (when `--input` is specified) check file with same name as input file but with `.map` extension exists and read its content -- `none` - don't use input source map; actually it's using to disable `auto`-fetching -- any other values treat as filename for input source map - -Generally you shouldn't care about input source map since defaults behaviour (`auto`) covers most use cases. - -> NOTE: Input source map is using only if output source map is generating. - -### Usage data - -`CSSO` can use data about how `CSS` is using for better compression. File with this data (`JSON` format) can be set using `--usage` option. Usage data may contain follow sections: - -- `tags` – white list of tags -- `ids` – white list of ids -- `classes` – white list of classes -- `scopes` – groups of classes which never used with classes from other groups on single element - -All sections are optional. Value of `tags`, `ids` and `classes` should be array of strings, value of `scopes` should be an array of arrays of strings. Other values are ignoring. - -#### Selector filtering - -`tags`, `ids` and `classes` are using on clean stage to filter selectors that contains something that not in list. Selectors are filtering only by those kind of simple selector which white list is specified. For example, if only `tags` list is specified then type selectors are checking, and if selector hasn't any type selector (or even any type selector) it isn't filter. - -> `ids` and `classes` names are case sensitive, `tags` – is not. - -Input CSS: - -```css -* { color: green; } -ul, ol, li { color: blue; } -UL.foo, span.bar { color: red; } -``` - -Usage data: - -```json -{ - "tags": ["ul", "LI"] -} -``` - -Result CSS: - -```css -*{color:green}ul,li{color:blue}ul.foo{color:red} -``` - -#### Scopes - -Scopes is designed for CSS scope isolation solutions such as [css-modules](https://github.com/css-modules/css-modules). Scopes are similar to namespaces and defines lists of class names that exclusively used on some markup. This information allows the optimizer to move rulesets more agressive. Since it assumes selectors from different scopes can't to be matched on the same element. That leads to better ruleset merging. - -Suppose we have a file: - -```css -.module1-foo { color: red; } -.module1-bar { font-size: 1.5em; background: yellow; } - -.module2-baz { color: red; } -.module2-qux { font-size: 1.5em; background: yellow; width: 50px; } -``` - -It can be assumed that first two rules never used with second two on the same markup. But we can't know that for sure without markup. The optimizer doesn't know it eather and will perform safe transformations only. The result will be the same as input but with no spaces and some semicolons: - -```css -.module1-foo{color:red}.module1-bar{font-size:1.5em;background:#ff0}.module2-baz{color:red}.module2-qux{font-size:1.5em;background:#ff0;width:50px} -``` - -But with usage data `CSSO` can get better output. If follow usage data is provided: - -```json -{ - "scopes": [ - ["module1-foo", "module1-bar"], - ["module2-baz", "module2-qux"] - ] -} -``` - -New result (29 bytes extra saving): - -```css -.module1-foo,.module2-baz{color:red}.module1-bar,.module2-qux{font-size:1.5em;background:#ff0}.module2-qux{width:50px} -``` - -If class name doesn't specified in `scopes` it belongs to default "scope". `scopes` doesn't affect `classes`. If class name presents in `scopes` but missed in `classes` (both sections specified) it will be filtered. - -Note that class name can't be specified in several scopes. Also selector can't has classes from different scopes. In both cases an exception throws. - -Currently the optimizer doesn't care about out-of-bounds selectors order changing safety (i.e. selectors that may be matched to elements with no class name of scope, e.g. `.scope div` or `.scope ~ :last-child`) since assumes scoped CSS modules doesn't relay on it's order. It may be fix in future if to be an issue. - -### API - -```js -var csso = require('csso'); - -var compressedCss = csso.minify('.test { color: #ff0000; }').css; - -console.log(compressedCss); -// .test{color:red} -``` - -You may minify CSS by yourself step by step: - -```js -var ast = csso.parse('.test { color: #ff0000; }'); -var compressResult = csso.compress(ast); -var compressedCss = csso.translate(compressResult.ast); - -console.log(compressedCss); -// .test{color:red} -``` - -Working with source maps: - -```js -var css = fs.readFileSync('path/to/my.css', 'utf8'); -var result = csso.minify(css, { - filename: 'path/to/my.css', // will be added to source map as reference to source file - sourceMap: true // generate source map -}); - -console.log(result); -// { css: '...minified...', map: SourceMapGenerator {} } - -console.log(result.map.toString()); -// '{ .. source map content .. }' -``` - -#### minify(source[, options]) - -Minify `source` CSS passed as `String`. - -Options: - -- sourceMap `Boolean` - generate source map if `true` -- filename `String` - filename of input, uses for source map -- debug `Boolean` - output debug information to `stderr` -- other options are the same as for `compress()` - -Returns an object with properties: - -- css `String` – resulting CSS -- map `Object` – instance of `SourceMapGenerator` or `null` - -```js -var result = csso.minify('.test { color: #ff0000; }', { - restructure: false, // don't change CSS structure, i.e. don't merge declarations, rulesets etc - debug: true // show additional debug information: - // true or number from 1 to 3 (greater number - more details) -}); - -console.log(result.css); -// > .test{color:red} -``` - -#### minifyBlock(source[, options]) - -The same as `minify()` but for style block. Usualy it's a `style` attribute content. - -```js -var result = csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').css; - -console.log(result.css); -// > color:red -``` - -#### parse(source[, options]) - -Parse CSS to AST. - -> NOTE: Currenly parser omit redundant separators, spaces and comments (except exclamation comments, i.e. `/*! comment */`) on AST build, since those things are removing by compressor anyway. - -Options: - -- context `String` – parsing context, useful when some part of CSS is parsing (see below) -- positions `Boolean` – should AST contains node position or not, store data in `info` property of nodes (`false` by default) -- filename `String` – filename of source that adds to info when `positions` is true, uses for source map generation (`` by default) -- line `Number` – initial line number, useful when parse fragment of CSS to compute correct positions -- column `Number` – initial column number, useful when parse fragment of CSS to compute correct positions - -Contexts: - -- `stylesheet` (default) – regular stylesheet, should be suitable in most cases -- `atrule` – at-rule (e.g. `@media screen, print { ... }`) -- `atruleExpression` – at-rule expression (`screen, print` for example above) -- `ruleset` – rule (e.g. `.foo, .bar:hover { color: red; border: 1px solid black; }`) -- `selector` – selector group (`.foo, .bar:hover` for ruleset example) -- `simpleSelector` – selector (`.foo` or `.bar:hover` for ruleset example) -- `block` – block content w/o curly braces (`color: red; border: 1px solid black;` for ruleset example) -- `declaration` – declaration (`color: red` or `border: 1px solid black` for ruleset example) -- `value` – declaration value (`red` or `1px solid black` for ruleset example) - -```js -// simple parsing with no options -var ast = csso.parse('.example { color: red }'); - -// parse with options -var ast = csso.parse('.foo.bar', { - context: 'simpleSelector', - positions: true -}); -``` - -#### compress(ast[, options]) - -Does the main task – compress AST. - -> NOTE: `compress` performs AST compression by transforming input AST by default (since AST cloning is expensive and needed in rare cases). Use `clone` option with truthy value in case you want to keep input AST untouched. - -Options: - -- restructure `Boolean` – do the structure optimisations or not (`true` by default) -- clone `Boolean` - transform a copy of input AST if `true`, useful in case of AST reuse (`false` by default) -- comments `String` or `Boolean` – specify what comments to left - - `'exclamation'` or `true` (default) – left all exclamation comments (i.e. `/*! .. */`) - - `'first-exclamation'` – remove every comments except first one - - `false` – remove every comments -- usage `Object` - usage data for advanced optimisations (see [Usage data](#usage-data) for details) -- logger `Function` - function to track every step of transformations - -#### clone(ast) - -Make an AST node deep copy. - -```js -var orig = csso.parse('.test { color: red }'); -var copy = csso.clone(orig); - -csso.walk(copy, function(node) { - if (node.type === 'Class') { - node.name = 'replaced'; - } -}); - -console.log(csso.translate(orig)); -// .test{color:red} -console.log(csso.translate(copy)); -// .replaced{color:red} -``` - -#### translate(ast) - -Converts AST to string. - -```js -var ast = csso.parse('.test { color: red }'); -console.log(csso.translate(ast)); -// > .test{color:red} -``` - -#### translateWithSourceMap(ast) - -The same as `translate()` but also generates source map (nodes should contain positions in `info` property). - -```js -var ast = csso.parse('.test { color: red }', { - filename: 'my.css', - positions: true -}); -console.log(csso.translateWithSourceMap(ast)); -// { css: '.test{color:red}', map: SourceMapGenerator {} } -``` - -#### walk(ast, handler) - -Visit all nodes of AST and call handler for each one. `handler` receives three arguments: - -- node – current AST node -- item – node wrapper when node is a list member; this wrapper contains references to `prev` and `next` nodes in list -- list – reference to list when node is a list member; it's useful for operations on list like `remove()` or `insert()` - -Context for handler an object, that contains references to some parent nodes: - -- root – refers to `ast` or root node -- stylesheet – refers to closest `StyleSheet` node, it may be a top-level or at-rule block stylesheet -- atruleExpression – refers to `AtruleExpression` node if current node inside at-rule expression -- ruleset – refers to `Ruleset` node if current node inside a ruleset -- selector – refers to `Selector` node if current node inside a selector -- declaration – refers to `Declaration` node if current node inside a declaration -- function – refers to closest `Function` or `FunctionalPseudo` node if current node inside one of them - -```js -// collect all urls in declarations -var csso = require('./lib/index.js'); -var urls = []; -var ast = csso.parse(` - @import url(import.css); - .foo { background: url('foo.jpg'); } - .bar { background-image: url(bar.png); } -`); - -csso.walk(ast, function(node) { - if (this.declaration !== null && node.type === 'Url') { - var value = node.value; - - if (value.type === 'Raw') { - urls.push(value.value); - } else { - urls.push(value.value.substr(1, value.value.length - 2)); - } - } -}); - -console.log(urls); -// [ 'foo.jpg', 'bar.png' ] -``` - -#### walkRules(ast, handler) - -Same as `walk()` but visits `Ruleset` and `Atrule` nodes only. - -#### walkRulesRight(ast, handler) - -Same as `walkRules()` but visits nodes in reverse order (from last to first). - -## More reading - -- [Debugging](docs/debugging.md) - -## License - -MIT diff --git a/node_modules/csso/bin/csso b/node_modules/csso/bin/csso deleted file mode 100755 index 79fe384..0000000 --- a/node_modules/csso/bin/csso +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node - -var cli = require('../lib/cli.js'); - -try { - cli.run(); -} catch (e) { - // output user frendly message if cli error - if (cli.isCliError(e)) { - console.error(e.message || e); - process.exit(2); - } - - // otherwise re-throw exception - throw e; -} diff --git a/node_modules/csso/dist/csso-browser.js b/node_modules/csso/dist/csso-browser.js deleted file mode 100644 index d902ff4..0000000 --- a/node_modules/csso/dist/csso-browser.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.csso=e()}}(function(){return function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return o(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;ar&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+(t-e)*(2/3-r)*6:e}function o(e,t,r,o){var i,a,s;if(0==t)i=a=s=r;else{var l=.5>r?r*(1+t):r+t-r*t,u=2*r-l;i=n(u,l,e+1/3),a=n(u,l,e),s=n(u,l,e-1/3)}return[Math.round(255*i),Math.round(255*a),Math.round(255*s),o]}function i(e){return e=e.toString(16),1===e.length?"0"+e:e}function a(e,t,r){for(var n=e.head,o=[];null!==n;){for(var i=n.data.sequence.head,a=!1;null!==i;){var s=i.data,l=s.type;switch(l){case"Number":case"Percentage":if(a)return;a=!0,o.push({type:l,value:Number(s.value)});break;case"Operator":if(a||"+"!==s.value)return;break;default:return}i=i.next}n=n.next}if(o.length===t){if(4===o.length){if("Number"!==o[3].type)return;o[3].type="Alpha"}if(r){if(o[0].type!==o[1].type||o[0].type!==o[2].type)return}else{if("Number"!==o[0].type||"Percentage"!==o[1].type||"Percentage"!==o[2].type)return;o[0].type="Angle"}return o.map(function(e){var t=Math.max(0,e.value);switch(e.type){case"Number":t=Math.min(t,255);break;case"Percentage":if(t=Math.min(t,100)/100,!r)return t;t=255*t;break;case"Angle":return(t%360+360)%360/360;case"Alpha":return Math.min(t,1)}return Math.round(t)})}}function s(e,t,r){var n,s=e.name;if("rgba"===s||"hsla"===s){if(n=a(e.arguments,4,"rgba"===s),!n)return;if("hsla"===s&&(n=o.apply(null,n),e.name="rgba"),1!==n[3])return void e.arguments.each(function(e){var t=e.sequence.head;"Operator"===t.data.type&&(t=t.next),e.sequence=new c([{type:"Number",info:t.data.info,value:p(n.shift())}])});s="rgb"}if("hsl"===s){if(n=n||a(e.arguments,3,!1),!n)return;n=o.apply(null,n),s="rgb"}if("rgb"===s){if(n=n||a(e.arguments,3,!0),!n)return;var l=t.next;l&&"Space"!==l.data.type&&r.insert(r.createItem({type:"Space"}),l),t.data={type:"Hash",info:e.info,value:i(n[0])+i(n[1])+i(n[2])},u(t.data,t)}}function l(e,t){if(null!==this.declaration){var r=e.name.toLowerCase();if(f.hasOwnProperty(r)){var n=f[r];n.length+1<=r.length?t.data={type:"Hash",info:e.info,value:n}:("grey"===r&&(r="gray"),e.name=r)}}}function u(e,t){var r=e.value.toLowerCase();6===r.length&&r[0]===r[1]&&r[2]===r[3]&&r[4]===r[5]&&(r=r[0]+r[2]+r[4]),h[r]?t.data={type:"Identifier",info:e.info,name:h[r]}:e.value=r}var c=e("../../utils/list.js"),p=e("./Number.js").pack,f={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},h={800000:"maroon",800080:"purple",808000:"olive",808080:"gray","00ffff":"cyan",f0ffff:"azure",f5f5dc:"beige",ffe4c4:"bisque","000000":"black","0000ff":"blue",a52a2a:"brown",ff7f50:"coral",ffd700:"gold","008000":"green","4b0082":"indigo",fffff0:"ivory",f0e68c:"khaki","00ff00":"lime",faf0e6:"linen","000080":"navy",ffa500:"orange",da70d6:"orchid",cd853f:"peru",ffc0cb:"pink",dda0dd:"plum",f00:"red",ff0000:"red",fa8072:"salmon",a0522d:"sienna",c0c0c0:"silver",fffafa:"snow",d2b48c:"tan","008080":"teal",ff6347:"tomato",ee82ee:"violet",f5deb3:"wheat",ffffff:"white",ffff00:"yellow"};t.exports={compressFunction:s,compressIdent:l,compressHex:u}},{"../../utils/list.js":41,"./Number.js":11}],17:[function(e,t,r){var n=e("../../utils/walk.js").all,o={Atrule:e("./Atrule.js"),Attribute:e("./Attribute.js"),Value:e("./Value.js"),Dimension:e("./Dimension.js"),Percentage:e("./Number.js"),Number:e("./Number.js"),String:e("./String.js"),Url:e("./Url.js"),Hash:e("./color.js").compressHex,Identifier:e("./color.js").compressIdent,Function:e("./color.js").compressFunction};t.exports=function(e){n(e,function(e,t,r){o.hasOwnProperty(e.type)&&o[e.type].call(this,e,t,r)})}},{"../../utils/walk.js":45,"./Atrule.js":8,"./Attribute.js":9,"./Dimension.js":10,"./Number.js":11,"./String.js":12,"./Url.js":13,"./Value.js":14,"./color.js":16}],18:[function(e,t,r){var n=e("../../../utils/list.js");t.exports=function(e){function t(){return i.length?i[i.length-1].type:void 0}function r(){"Space"===t()&&i.pop(),i.length||i.unshift({type:"Number",value:"0"},{type:"Space"},{type:"Number",value:"0"}),o.push.apply(o,i),i=[]}var o=[],i=[];e.sequence.each(function(e){return"Operator"===e.type&&","===e.value?(r(),void o.push(e)):void(("Identifier"!==e.type||"transparent"!==e.name&&"none"!==e.name&&"repeat"!==e.name&&"scroll"!==e.name)&&("Space"!==e.type||i.length&&"Space"!==t())&&i.push(e))}),r(),e.sequence=new n(o)}},{"../../../utils/list.js":41}],19:[function(e,t,r){t.exports=function(e){var t=e.sequence.head.data;if("Identifier"===t.type)switch(t.name){case"normal":e.sequence.head.data={type:"Number",info:t.info,value:"400"};break;case"bold":e.sequence.head.data={type:"Number",info:t.info,value:"700"}}}},{}],20:[function(e,t,r){t.exports=function(e){var t=e.sequence;t.eachRight(function(e,t){if("Identifier"===e.type)if("bold"===e.name)t.data={type:"Number",info:e.info,value:"700"};else if("normal"===e.name){var r=t.prev;r&&"Operator"===r.data.type&&"/"===r.data.value&&this.remove(r),this.remove(t)}else if("medium"===e.name){var n=t.next;n&&"Operator"===n.data.type||this.remove(t)}}),t.each(function(e,t){"Space"===e.type&&(t.prev&&t.next&&"Space"!==t.next.data.type||this.remove(t))}),t.isEmpty()&&t.insert(t.createItem({type:"Identifier",name:"normal"}))}},{}],21:[function(e,t,r){function n(e,t){var r,n=new l,o=!1;return e.nextUntil(e.head,function(e,i,a){return"Comment"===e.type?t&&"!"===e.value.charAt(0)?o||r?!0:(a.remove(i),void(r=e)):void a.remove(i):("Space"!==e.type&&(o=!0),void n.insert(a.remove(i)))}),{comment:r,stylesheet:{type:"StyleSheet",info:null,rules:n}}}function o(e,t,r,n,o){o("Compress block #"+n,null,!0);var i=1;return d(e,function(){"id"in this.stylesheet==!1&&(this.stylesheet.firstAtrulesAllowed=t,this.stylesheet.id=i++)}),o("init",e),p(e,r),o("clean",e),f(e,r),o("compress",e),e}function i(e){var t="comments"in e?e.comments:"exclamation";return"boolean"==typeof t?t=t?"exclamation":!1:"exclamation"!==t&&"first-exclamation"!==t&&(t=!1),t}function a(e){return"restructure"in e?e.restructure:"restructuring"in e?e.restructuring:!0}function s(e){return new l([{type:"Ruleset",selector:{type:"Selector",selectors:new l([{type:"SimpleSelector",sequence:new l([{type:"Identifier",name:"x"}])}])},block:e}])}var l=e("../utils/list"),u=e("../utils/clone"),c=e("./usage"),p=e("./clean"),f=e("./compress"),h=e("./restructure"),d=e("../utils/walk").rules;t.exports=function(e,t){e=e||{type:"StyleSheet",info:null,rules:new l},t=t||{};var r,p,f,d="function"==typeof t.logger?t.logger:Function(),m=i(t),g=a(t),v=!0,y=!1,b=new l,k=1;t.clone&&(e=u(e)),"StyleSheet"===e.type?(r=e.rules,e.rules=b):r=s(e),t.usage&&(y=c.buildIndex(t.usage));do{if(p=n(r,Boolean(m)),o(p.stylesheet,v,y,k++,d),g&&h(p.stylesheet,y,d),f=p.stylesheet.rules,p.comment&&(b.isEmpty()||b.insert(l.createItem({type:"Raw",value:"\n"})),b.insert(l.createItem(p.comment)),f.isEmpty()||b.insert(l.createItem({type:"Raw",value:"\n"}))),v&&!f.isEmpty()){var w=f.last();("Atrule"!==w.type||"import"!==w.name&&"charset"!==w.name)&&(v=!1)}"exclamation"!==m&&(m=!1),b.appendList(f)}while(!r.isEmpty());return{ast:e}}},{"../utils/clone":40,"../utils/list":41,"../utils/walk":45,"./clean":7,"./compress":17,"./restructure":29,"./usage":35}],22:[function(e,t,r){function n(e,t,r){var n=e.selector.selectors,i=e.block.declarations;r.prevUntil(t.prev,function(a){if("Ruleset"!==a.type)return o.unsafeToSkipNode.call(n,a);var s=a.selector.selectors,l=a.block.declarations;if(e.pseudoSignature===a.pseudoSignature){if(o.isEqualLists(s,n))return l.appendList(i),r.remove(t),!0;if(o.isEqualDeclarations(i,l))return o.addSelectors(s,n),r.remove(t),!0}return o.hasSimilarSelectors(n,s)})}var o=e("./utils.js"),i=e("../../utils/walk.js").rules;t.exports=function(e){i(e,function(e,t,r){"Ruleset"===e.type&&n(e,t,r)})}},{"../../utils/walk.js":45,"./utils.js":34}],23:[function(e,t,r){function n(e){return"Atrule"===e.type&&"media"===e.name}function o(e,t,r){if(n(e)){var o=t.prev&&t.prev.data;o&&n(o)&&e.expression.id===o.expression.id&&(o.block.rules.appendList(e.block.rules),o.info={primary:o.info,merged:e.info},r.remove(t))}}var i=e("../../utils/walk.js").rulesRight;t.exports=function(e){i(e,function(e,t,r){"Atrule"===e.type&&o(e,t,r)})}},{"../../utils/walk.js":45}],24:[function(e,t,r){function n(e,t,r){for(var n=e.selector.selectors;n.head!==n.tail;){var i=new o;i.insert(n.remove(n.head)),r.insert(r.createItem({type:"Ruleset",info:e.info,pseudoSignature:e.pseudoSignature,selector:{type:"Selector",info:e.selector.info,selectors:i},block:{type:"Block",info:e.block.info,declarations:e.block.declarations.copy()}}),t)}}var o=e("../../utils/list.js"),i=e("../../utils/walk.js").rulesRight;t.exports=function(e){i(e,function(e,t,r){"Ruleset"===e.type&&n(e,t,r)})}},{"../../utils/list.js":41,"../../utils/walk.js":45}],25:[function(e,t,r){function n(e){this.name=e,this.info=null,this.iehack=void 0,this.sides={top:null,right:null,bottom:null,left:null}}function o(e,t,r,o){var i=e.block.declarations,a=e.selector.selectors.first().id;return e.block.declarations.eachRight(function(e,s){var l=e.property.name;if(v.hasOwnProperty(l)){var p,f,h=v[l];if(o&&a!==o||h in t&&(f=c,p=t[h]),!(p&&p.add(l,e.value,e.info)||(f=u,p=new n(h),p.add(l,e.value,e.info))))return void(o=null);t[h]=p,r.push({operation:f,block:i,item:s,shorthand:p}),o=a}}),o}function i(e,t){e.forEach(function(e){var r=e.shorthand;r.isOkToMinimize()&&(e.operation===u?e.item.data=t({type:"Declaration",info:r.info,property:r.getProperty(),value:r.getValue(),id:0,length:0,fingerprint:null}):e.block.remove(e.item))})}var a=e("../../utils/list.js"),s=e("../../utils/translate.js"),l=e("../../utils/walk.js").rulesRight,u=1,c=2,p=0,f=1,h=2,d=3,m=["top","right","bottom","left"],g={"margin-top":"top","margin-right":"right","margin-bottom":"bottom","margin-left":"left","padding-top":"top","padding-right":"right","padding-bottom":"bottom","padding-left":"left","border-top-color":"top","border-right-color":"right","border-bottom-color":"bottom","border-left-color":"left","border-top-width":"top","border-right-width":"right","border-bottom-width":"bottom","border-left-width":"left","border-top-style":"top","border-right-style":"right","border-bottom-style":"bottom","border-left-style":"left"},v={margin:"margin","margin-top":"margin","margin-right":"margin","margin-bottom":"margin","margin-left":"margin",padding:"padding","padding-top":"padding","padding-right":"padding","padding-bottom":"padding","padding-left":"padding","border-color":"border-color","border-top-color":"border-color","border-right-color":"border-color","border-bottom-color":"border-color","border-left-color":"border-color","border-width":"border-width","border-top-width":"border-width","border-right-width":"border-width","border-bottom-width":"border-width","border-left-width":"border-width","border-style":"border-style","border-top-style":"border-style","border-right-style":"border-style","border-bottom-style":"border-style","border-left-style":"border-style"};n.prototype.getValueSequence=function(e,t){var r=[],n=!1,o=e.sequence.some(function(t){var o=!1;switch(t.type){case"Identifier":switch(t.name){case"\\9":return void(n=!0);case"inherit":case"initial":case"unset":case"revert":o=t.name}break;case"Dimension":switch(t.unit){case"rem":case"vw":case"vh":case"vmin":case"vmax":case"vm":o=t.unit}break;case"Hash":case"Number":case"Percentage":break;case"Function":o=t.name;break;case"Space":return!1;default:return!0}r.push({node:t,special:o,important:e.important})});return o||r.length>t?!1:"boolean"==typeof this.iehack&&this.iehack!==n?!1:(this.iehack=n,r)},n.prototype.canOverride=function(e,t){var r=this.sides[e];return!r||t.important&&!r.important},n.prototype.add=function(e,t,r){function n(){var r=this.sides,n=g[e];if(n){if(n in r==!1)return!1;var o=this.getValueSequence(t,1);if(!o||!o.length)return!1;for(var i in r)if(null!==r[i]&&r[i].special!==o[0].special)return!1;return this.canOverride(n,o[0])?(r[n]=o[0],!0):!0}if(e===this.name){var o=this.getValueSequence(t,4);if(!o||!o.length)return!1;switch(o.length){case 1:o[f]=o[p],o[h]=o[p],o[d]=o[p];break;case 2:o[h]=o[p],o[d]=o[f];break;case 3:o[d]=o[f]}for(var a=0;4>a;a++)for(var i in r)if(null!==r[i]&&r[i].special!==o[a].special)return!1;for(var a=0;4>a;a++)this.canOverride(m[a],o[a])&&(r[m[a]]=o[a]);return!0}}return n.call(this)?(this.info?this.info={primary:this.info,merged:r}:this.info=r,!0):!1},n.prototype.isOkToMinimize=function(){var e=this.sides.top,t=this.sides.right,r=this.sides.bottom,n=this.sides.left;if(e&&t&&r&&n){var o=e.important+t.important+r.important+n.important;return 0===o||4===o}return!1},n.prototype.getValue=function(){var e=[],t=this.sides,r=[t.top,t.right,t.bottom,t.left],n=[s(t.top.node),s(t.right.node),s(t.bottom.node),s(t.left.node)];n[d]===n[f]&&(r.pop(),n[h]===n[p]&&(r.pop(),n[f]===n[p]&&r.pop()));for(var o=0;of?(n.insert(u,t),!0):t.next?void 0:(n.insert(u),!0)}),void r.remove(l)}return p===a?!0:void(s[p]=!0)})}var o=e("./utils.js"),i=e("../../utils/walk.js").rules;t.exports=function(e){i(e,function(e,t,r){"Ruleset"===e.type&&n(e,t,r)})}},{"../../utils/walk.js":45,"./utils.js":34}],28:[function(e,t,r){function n(e){var t=0;return e.each(function(e){t+=e.id.length+1}),t-1}function o(e){for(var t=0,r=0;ry&&(s.addSelectors(m,l),u.declarations=new a(v.ne1))}else if(!v.ne1.length&&v.ne2.length){var y=n(m),b=o(v.eq);f&&b>y&&(s.addSelectors(l,m),g.declarations=new a(v.ne2))}else{var k={type:"Selector",info:{},selectors:s.addSelectors(m.copy(),l)},w=n(k.selectors)+2,b=o(v.eq);if(f&&b>=w){var S={type:"Ruleset",info:{},pseudoSignature:e.pseudoSignature,selector:k,block:{type:"Block",info:{},declarations:new a(v.eq)}};return u.declarations=new a(v.ne1),g.declarations=new a(v.ne2.concat(v.ne2overrided)),r.insert(r.createItem(S),d),!0}}}p&&(p=!m.some(function(e){return l.some(function(t){return t.compareMarker===e.compareMarker})})),m.each(function(e){c[e.compareMarker]=!0})})}var a=e("../../utils/list.js"),s=e("./utils.js"),l=e("../../utils/walk.js").rulesRight;t.exports=function(e){l(e,function(e,t,r){"Ruleset"===e.type&&i.call(this,e,t,r)})}},{"../../utils/list.js":41,"../../utils/walk.js":45,"./utils.js":34}],29:[function(e,t,r){var n=e("./prepare/index.js"),o=e("./1-initialMergeRuleset.js"),i=e("./2-mergeAtrule.js"),a=e("./3-disjoinRuleset.js"),s=e("./4-restructShorthand.js"),l=e("./6-restructBlock.js"),u=e("./7-mergeRuleset.js"),c=e("./8-restructRuleset.js");t.exports=function(e,t,r){var p=n(e,t);r("prepare",e),o(e),r("initialMergeRuleset",e),i(e),r("mergeAtrule",e),a(e),r("disjoinRuleset",e),s(e,p),r("restructShorthand",e),l(e),r("restructBlock",e),u(e),r("mergeRuleset",e),c(e),r("restructRuleset",e)}},{"./1-initialMergeRuleset.js":22,"./2-mergeAtrule.js":23,"./3-disjoinRuleset.js":24,"./4-restructShorthand.js":25,"./6-restructBlock.js":26,"./7-mergeRuleset.js":27,"./8-restructRuleset.js":28,"./prepare/index.js":31}],30:[function(e,t,r){function n(){this.seed=0,this.map=Object.create(null)}var o=e("../../../utils/translate.js");n.prototype.resolve=function(e){var t=this.map[e];return t||(t=++this.seed,this.map[e]=t),t},t.exports=function(){var e=new n,t=new n;return function(r){var n=r.property.name,i=o(r.value);return r.id=e.resolve(n)+(t.resolve(i)<<12),r.length=n.length+1+i.length,r}}},{"../../../utils/translate.js":43}],31:[function(e,t,r){function n(e,t,r){switch(e.type){case"Ruleset":e.block.declarations.each(t),l(e,r);break;case"Atrule":e.expression&&(e.expression.id=a(e.expression)),"keyframes"===o(e.name).name&&(e.block.avoidRulesMerge=!0,e.block.rules.each(function(e){e.selector.selectors.each(function(e){e.compareMarker=e.id})}))}}var o=e("../../../utils/names.js").keyword,i=e("../../../utils/walk.js").rules,a=e("../../../utils/translate.js"),s=e("./createDeclarationIndexer.js"),l=e("./processSelector.js");t.exports=function(e,t){var r=s();return i(e,function(e){n(e,r,t)}),{declaration:r}}},{"../../../utils/names.js":42,"../../../utils/translate.js":43,"../../../utils/walk.js":45,"./createDeclarationIndexer.js":30,"./processSelector.js":32}],32:[function(e,t,r){var n=e("../../../utils/translate.js"),o=e("./specificity.js"),i={"first-letter":!0,"first-line":!0,after:!0,before:!0},a={link:!0,visited:!0,hover:!0,active:!0,"first-letter":!0,"first-line":!0,after:!0,before:!0};t.exports=function(e,t){var r=Object.create(null),s=!1;e.selector.selectors.each(function(e){var l="*",u=0;e.sequence.some(function(o){switch(o.type){case"Class":if(t&&t.scopes){var c=t.scopes[o.name]||0;if(0!==u&&c!==u)throw new Error("Selector can't has classes from different scopes: "+n(e));u=c}break;case"PseudoClass":a.hasOwnProperty(o.name)||(r[o.name]=!0,s=!0);break;case"PseudoElement":i.hasOwnProperty(o.name)||(r[o.name]=!0,s=!0);break;case"FunctionalPseudo":r[o.name]=!0,s=!0;break;case"Negation":r.not=!0,s=!0;break;case"Identifier":l=o.name;break;case"Attribute":o.flags&&(r["["+o.flags+"]"]=!0,s=!0);break;case"Combinator":l="*"}}),e.id=n(e),e.compareMarker=o(e).toString(),u&&(e.compareMarker+=":"+u),"*"!==l&&(e.compareMarker+=","+l)}),s&&(e.pseudoSignature=Object.keys(r).sort().join(","))}},{"../../../utils/translate.js":43,"./specificity.js":33}],33:[function(e,t,r){t.exports=function(e){var t=0,r=0,n=0;return e.sequence.each(function o(e){switch(e.type){case"SimpleSelector":case"Negation":e.sequence.each(o);break;case"Id":t++;break;case"Class":case"Attribute":case"FunctionalPseudo":r++;break;case"Identifier":"*"!==e.name&&n++;break;case"PseudoElement":n++;break;case"PseudoClass":var i=e.name.toLowerCase();"before"===i||"after"===i||"first-line"===i||"first-letter"===i?n++:r++}}),[t,r,n]}},{}],34:[function(e,t,r){function n(e,t){for(var r=e.head,n=t.head;null!==r&&null!==n&&r.data.id===n.data.id;)r=r.next,n=n.next;return null===r&&null===n}function o(e,t){for(var r=e.head,n=t.head;null!==r&&null!==n&&r.data.id===n.data.id;)r=r.next,n=n.next;return null===r&&null===n}function i(e,t){for(var r={eq:[],ne1:[],ne2:[],ne2overrided:[]},n=Object.create(null),o=Object.create(null),i=t.head;i;i=i.next)o[i.data.id]=!0;for(var i=e.head;i;i=i.next){var a=i.data;a.fingerprint&&(n[a.fingerprint]=a.value.important),o[a.id]?(o[a.id]=!1,r.eq.push(a)):r.ne1.push(a)}for(var i=t.head;i;i=i.next){var a=i.data;o[a.id]&&(u.call(n,a.fingerprint)&&Number(n[a.fingerprint])>=Number(a.value.important)?r.ne2overrided.push(a):r.ne2.push(a))}return r}function a(e,t){return t.each(function(t){ -for(var r=t.id,n=e.head;n;){var o=n.data.id;if(o===r)return;if(o>r)break;n=n.next}e.insert(e.createItem(t),n)}),e}function s(e,t){return e.some(function(e){return t.some(function(t){return e.compareMarker===t.compareMarker})})}function l(e){switch(e.type){case"Ruleset":return s(e.selector.selectors,this);case"Atrule":if(e.block)return"StyleSheet"!==e.block.type?!1:e.block.rules.some(l,this)}return!0}var u=Object.prototype.hasOwnProperty;t.exports={isEqualLists:n,isEqualDeclarations:o,compareDeclarations:i,addSelectors:a,hasSimilarSelectors:s,unsafeToSkipNode:l}},{}],35:[function(e,t,r){function n(e,t){var r=Object.create(null);if(!Array.isArray(e))return!1;for(var n=0;n1&&n){var i=f(n,!0);2===e&&i.length>256&&(i=i.substr(0,256)+"..."),o+="\n "+i+"\n"}console.error(o),t=Date.now()}}function i(e){var t={};for(var r in e)t[r]=e[r];return t}function a(e){return e=i(e),"function"!=typeof e.logger&&e.debug&&(e.logger=o(e.debug)),e}function s(e,t,r){r=r||{};var o,i=r.filename||"",s=n("parsing",r,Date.now(),c(t,{context:e,filename:i,positions:Boolean(r.sourceMap)})),l=n("compress",r,Date.now(),p(s,a(r)));return o=r.sourceMap?n("translateWithSourceMap",r,Date.now(),function(){var e=h(l.ast);return e.map._file=i,e.map.setSourceContent(i,t),e}()):n("translate",r,Date.now(),{css:f(l.ast),map:null})}function l(e,t){return s("stylesheet",e,t)}function u(e,t){return s("block",e,t)}var c=e("./parser"),p=e("./compressor"),f=e("./utils/translate"),h=e("./utils/translateWithSourceMap"),d=e("./utils/walk"),m=e("./utils/clone"),g=e("./utils/list");t.exports={version:e("../package.json").version,List:g,minify:l,minifyBlock:u,parse:c,compress:p,translate:f,translateWithSourceMap:h,walk:d.all,walkRules:d.rules,walkRulesRight:d.rulesRight,clone:m}},{"../package.json":57,"./compressor":21,"./parser":38,"./utils/clone":40,"./utils/list":41,"./utils/translate":43,"./utils/translateWithSourceMap":44,"./utils/walk":45}],37:[function(e,t,r){r.TokenType={String:"String",Comment:"Comment",Unknown:"Unknown",Newline:"Newline",Space:"Space",Tab:"Tab",ExclamationMark:"ExclamationMark",QuotationMark:"QuotationMark",NumberSign:"NumberSign",DollarSign:"DollarSign",PercentSign:"PercentSign",Ampersand:"Ampersand",Apostrophe:"Apostrophe",LeftParenthesis:"LeftParenthesis",RightParenthesis:"RightParenthesis",Asterisk:"Asterisk",PlusSign:"PlusSign",Comma:"Comma",HyphenMinus:"HyphenMinus",FullStop:"FullStop",Solidus:"Solidus",Colon:"Colon",Semicolon:"Semicolon",LessThanSign:"LessThanSign",EqualsSign:"EqualsSign",GreaterThanSign:"GreaterThanSign",QuestionMark:"QuestionMark",CommercialAt:"CommercialAt",LeftSquareBracket:"LeftSquareBracket",ReverseSolidus:"ReverseSolidus",RightSquareBracket:"RightSquareBracket",CircumflexAccent:"CircumflexAccent",LowLine:"LowLine",LeftCurlyBracket:"LeftCurlyBracket",VerticalLine:"VerticalLine",RightCurlyBracket:"RightCurlyBracket",Tilde:"Tilde",Identifier:"Identifier",DecimalNumber:"DecimalNumber"}},{}],38:[function(e,t,r){"use strict";function n(e){var t,r=new Error(e),n=0,o=1,i=1;throw null!==fe.token?(n=fe.token.offset,o=fe.token.line,i=fe.token.column):null!==fe.prevToken&&(t=fe.prevToken.value.trimRight(),n=fe.prevToken.offset+t.length,t=t.split(/\n|\r\n?|\f/),o=fe.prevToken.line+t.length-1,i=t.length>1?t[t.length-1].length+1:fe.prevToken.column+t[t.length-1].length),r.name="CssSyntaxError",r.parseError={offset:n,line:o,column:i},r}function o(e){return null!==fe.token&&fe.token.type===e?(fe.next(),!0):void n(e+" is expected")}function i(e,t){return null!==fe.token&&fe.token.type===he.Identifier&&fe.token.value.toLowerCase()===e?(t&&fe.next(),!0):void n("Identifier `"+e+"` is expected")}function a(e){if(null!==fe.token)for(var t=1,r=fe.token.type;t, ~, /deep/) is expected")}return{type:"Combinator",info:t,name:e}}function R(){var e=s(),t=fe.token.value,r=t.length;return r>4&&"*"===t.charAt(r-2)&&"/"===t.charAt(r-1)&&(r-=2),fe.next(),{type:"Comment",info:e,value:t.substring(2,r)}}function P(){if(null!==fe.token&&fe.token.type===he.Identifier){var e=fe.token.value,t=e.indexOf("\\");return-1===t?(fe.next(),e):(fe.token.value=e.substr(t),fe.token.offset+=t,fe.token.column+=t,e.substr(0,t))}n("Identifier is expected")}function O(e){return{type:"Dimension",info:s(),value:e||Y(),unit:P()}}function E(){var e=Z();return e&&null!==fe.token&&fe.token.type===he.PercentSign?q(e):null}function q(e){var t;return e?(t=e.info,e=e.value):(t=s(),e=Y()),o(he.PercentSign),{type:"Percentage",info:t,value:e}}function N(e,t){var r=B;t||(t=W(!1));var n=t.name.toLowerCase();return be.hasOwnProperty(e)&&be[e].hasOwnProperty(n)?be[e][n](e,t):I(r,e,t)}function I(e,t,r){var n;return o(he.LeftParenthesis),n=e(t),o(he.RightParenthesis),{type:t===ve?"FunctionalPseudo":"Function",info:r.info,name:r.name,arguments:n}}function B(e){var t=new me,r=null,n=null;se();e:for(;null!==fe.token;){switch(fe.token.type){case he.RightParenthesis:break e;case he.Space:n=ae();break;case he.Comment:fe.next(),n=null;break;case he.NumberSign:n=ue();break;case he.LeftParenthesis:case he.LeftSquareBracket:n=A(e);break;case he.Comma:l(r.sequence),fe.next(),se(),r=null,n=null;break;case he.Solidus:case he.Asterisk:case he.Colon:case he.EqualsSign:n=X();break;default:n=x(e)}null===r&&(r={type:"Argument",sequence:new me},t.insert(me.createItem(r))),null!==n&&r.sequence.insert(me.createItem(n))}return null!==r&&l(r.sequence),t}function D(e,t){return I(F,e,t)}function T(){var e=new me,t=!1;e:for(;null!==fe.token;)switch(fe.token.type){case he.RightParenthesis:t||n("Simple selector is expected");break e;case he.Comma:t||n("Simple selector is expected"),t=!1,fe.next();break;default:t=!0,e.insert(me.createItem(g(!0)))}return e}function U(e,t){var r;return o(he.LeftParenthesis),r=T(e),o(he.RightParenthesis),{type:"Negation",info:t.info,sequence:r}}function F(){var e=new me;return se(),e.insert(me.createItem({type:"Argument",sequence:new me([W(!0)])})),se(),null!==fe.token&&fe.token.type===he.Comma&&(o(he.Comma),se(),e.insert(me.createItem({type:"Argument",sequence:new me([S(!0)])})),se()),e}function G(e,t){var r={type:"Url",info:t.info,value:null};if(o(he.LeftParenthesis),se(),fe.token.type===he.String)r.value=le(),se();else{for(var n=s(),i="";null!==fe.token;fe.next()){var a=fe.token.type;if(a===he.Space||a===he.LeftParenthesis||a===he.RightParenthesis)break;i+=fe.token.value}r.value={type:"Raw",info:n,value:i},se()}return o(he.RightParenthesis),r}function z(e,t){var r=0,n="";for(o(he.LeftParenthesis);null!==fe.token;fe.next()){if(fe.token.type===he.RightParenthesis){if(0===r)break;r--}else fe.token.type===he.LeftParenthesis&&r++;n+=fe.token.value}return o(he.RightParenthesis),{type:"Function",info:t.info,name:t.name,arguments:new me([{type:"Argument",sequence:new me([{type:"Raw",value:n}])}])}}function H(e){for(var t="";null!==fe.token&&(fe.token.type===he.DecimalNumber||fe.token.type===he.Identifier);fe.next())t+=fe.token.value;if(/^[0-9a-f]{1,6}$/i.test(t)||n("Unexpected input"),e)for(;t.length<6&&null!==fe.token&&fe.token.type===he.QuestionMark;fe.next())t+=fe.token.value,e=!1;if(e&&null!==fe.token&&fe.token.type===he.HyphenMinus){fe.next();var r=H(!1);r||n("Unexpected input"),t+="-"+r}return t}function V(e){var t="";if(null!==fe.token&&fe.token.type===he.HyphenMinus&&(t="-",fe.next(),e&&null!==fe.token&&fe.token.type===he.HyphenMinus&&(t="--",fe.next())),a("Identifier",he.LowLine,he.Identifier),null!==fe.token)for(t+=fe.token.value,fe.next();null!==fe.token;fe.next()){var r=fe.token.type;if(r!==he.LowLine&&r!==he.Identifier&&r!==he.DecimalNumber&&r!==he.HyphenMinus)break;t+=fe.token.value}return t}function $(e){null===fe.token&&n("Unexpected end of input");var t,r=s();return fe.token.type===he.Asterisk?(e=!1,t="*",fe.next()):t=V(!1),null!==fe.token&&fe.token.type===he.VerticalLine&&fe.lookupType(1,he.EqualsSign)===!1&&(t+="|",null!==fe.next()&&(fe.token.type===he.HyphenMinus||fe.token.type===he.Identifier||fe.token.type===he.LowLine?t+=V(!1):fe.token.type===he.Asterisk&&(e=!1,t+="*",fe.next()))),e&&null!==fe.token&&fe.token.type===he.Colon&&(fe.next(),t+=":"+V(!1)),{type:"Identifier",info:r,name:t}}function W(e){return{type:"Identifier",info:s(),name:V(e)}}function J(){return o(he.ExclamationMark),se(),i("important"),V(!1),!0}function Q(){a("Number, odd or even",he.Identifier,he.DecimalNumber);var e,t=s(),r=fe.token.value;if(fe.token.type===he.DecimalNumber){var o=fe.lookup(1);null!==o&&o.type===he.Identifier&&"n"===o.value.toLowerCase()&&(r+=o.value,fe.next())}else{var e=r.toLowerCase();"odd"!==e&&"even"!==e&&"n"!==e&&n("Unexpected identifier")}return fe.next(),{type:"Nth",info:t,value:r}}function K(){var e,t=s(),r=new me,n=null;o(he.Colon),i("nth",!1),e={type:"FunctionalPseudo",info:t,name:V(!1),arguments:new me([{type:"Argument",sequence:r}])},o(he.LeftParenthesis);e:for(;null!==fe.token;){switch(fe.token.type){case he.RightParenthesis:break e;case he.Space:case he.Comment:fe.next(),n=null;break;case he.HyphenMinus:case he.PlusSign:n=X();break;default:n=Q()}null!==n&&r.insert(me.createItem(n))}return o(he.RightParenthesis),e}function Y(){var e=!1,t="",r=0;if(fe.lookupType(r,he.HyphenMinus)&&(t="-",r++),fe.lookupType(r,he.DecimalNumber)&&(e=!0,t+=fe.lookup(r).value,r++),fe.lookupType(r,he.FullStop)&&(t+=".",r++),fe.lookupType(r,he.DecimalNumber)&&(e=!0,t+=fe.lookup(r).value,r++),e){for(;r--;)fe.next();return t}return null}function Z(){var e=s(),t=Y();return null!==t?{type:"Number",info:e,value:t}:null}function X(){var e={type:"Operator",info:s(),value:fe.token.value};return fe.next(),e}function ee(){for(var e,t={type:"Value",info:s(),important:!1,sequence:new me};e=te();)t.sequence.insert(me.createItem(re(e)));return se(t),null!==fe.token&&fe.token.type===he.ExclamationMark&&(t.important=J()),t}function te(){function e(e){for(var t;(t=fe.lookup(e))&&(t.type===he.Space||t.type===he.Comment);e++);return e}var t=e(0);if(null===fe.lookup(t+1)||"progid"!==fe.lookup(t+0).value.toLowerCase()||fe.lookup(t+1).type!==he.Colon)return!1;if(t+=2,t=e(t),null===fe.lookup(t+5)||"dximagetransform"!==fe.lookup(t+0).value.toLowerCase()||fe.lookup(t+1).type!==he.FullStop||"microsoft"!==fe.lookup(t+2).value.toLowerCase()||fe.lookup(t+3).type!==he.FullStop||fe.lookup(t+4).type!==he.Identifier)return!1;if(t+=5,t=e(t),fe.lookupType(t,he.LeftParenthesis)===!1)return!1;for(var r;r=fe.lookup(t);t++)if(r.type===he.RightParenthesis)return r;return!1}function re(e){var t="",r={type:"Progid",info:s(),value:null};e||(e=te()),e||n("progid is expected"),se(r);for(var i=s();fe.token&&fe.token!==e;fe.next())t+=fe.token.value;return o(he.RightParenthesis),t+=")",r.value={type:"Raw",info:i,value:t},se(r),r}function ne(){var e=fe.lookup(1);return null===e&&(fe.next(),n("Colon or identifier is expected")),e.type===he.Colon?oe():e.type===he.Identifier&&"nth"===e.value.toLowerCase()?K():ie()}function oe(){var e=s();return o(he.Colon),o(he.Colon),{type:"PseudoElement",info:e,name:V(!1)}}function ie(){var e=s(),t=o(he.Colon)&&W(!1);return null!==fe.token&&fe.token.type===he.LeftParenthesis?N(ve,t):{type:"PseudoClass",info:e,name:t.name}}function ae(){var e={type:"Space"};return fe.next(),e}function se(){e:for(;null!==fe.token;)switch(fe.token.type){case he.Space:fe.next();break;case he.Comment:fe.next();break;default:break e}return null}function le(){var e={type:"String",info:s(),value:fe.token.value};return fe.next(),e}function ue(){var e,t=s();return o(he.NumberSign),a("Number or identifier",he.DecimalNumber,he.Identifier),e=fe.token.value,fe.token.type===he.DecimalNumber&&fe.lookupType(1,he.Identifier)&&(fe.next(),e+=fe.token.value),fe.next(),{type:"Hash",info:t,value:e}}var ce,pe,fe,he=e("./const").TokenType,de=e("./scanner"),me=e("../utils/list"),ge=1,ve=2,ye=3,be={};be[ge]={url:G},be[ve]={url:G,not:U},be[ye]={url:G,expression:z,"var":D};var ke={stylesheet:u,atrule:h,atruleExpression:f,ruleset:d,selector:m,simpleSelector:g,block:b,declaration:k,value:S},we={declaration:!0,property:!0};t.exports=function(e,t){var r;t&&"object"==typeof t||(t={});var n=t.context||"stylesheet";if(ce=Boolean(t.positions),pe=t.filename||"",!ke.hasOwnProperty(n))throw new Error("Unknown context `"+n+"`");return fe=new de(e,we.hasOwnProperty(n),t.line,t.column),fe.next(),r=ke[n](),fe=null,r}},{"../utils/list":41,"./const":37,"./scanner":39}],39:[function(e,t,r){"use strict";var n=e("./const.js").TokenType,o=9,i=10,a=12,s=13,l=32,u=34,c=39,p=41,f=42,h=47,d=92,m=95,g=123,v=125,y=1,b=2,k=3,w=4,S={9:n.Tab,10:n.Newline,13:n.Newline,32:n.Space,33:n.ExclamationMark,34:n.QuotationMark,35:n.NumberSign,36:n.DollarSign,37:n.PercentSign,38:n.Ampersand,39:n.Apostrophe,40:n.LeftParenthesis,41:n.RightParenthesis,42:n.Asterisk,43:n.PlusSign,44:n.Comma,45:n.HyphenMinus,46:n.FullStop,47:n.Solidus,58:n.Colon,59:n.Semicolon,60:n.LessThanSign,61:n.EqualsSign,62:n.GreaterThanSign,63:n.QuestionMark,64:n.CommercialAt,91:n.LeftSquareBracket,93:n.RightSquareBracket,94:n.CircumflexAccent,95:n.LowLine,123:n.LeftCurlyBracket,124:n.VerticalLine,125:n.RightCurlyBracket,126:n.Tilde},x=Math.max.apply(null,Object.keys(S))+1,C=new Uint32Array(x),_=new Uint32Array(x);Object.keys(S).forEach(function(e){C[Number(e)]=b,_[Number(e)]=b},C),_[m]=0;for(var A=48;57>=A;A++)C[A]=k;C[l]=y,C[o]=y,C[i]=y,C[s]=y,C[a]=y,C[c]=w,C[u]=w;var j=function(e,t,r,n){this.source=e,this.pos=65279===e.charCodeAt(0)?1:0,this.eof=this.pos===this.source.length,this.line="undefined"==typeof r?1:r,this.lineStartPos="undefined"==typeof n?-1:-n,this.minBlockMode=t?1:0,this.blockMode=this.minBlockMode,this.urlMode=!1,this.prevToken=null,this.token=null,this.buffer=[]};j.prototype={lookup:function(e){if(0===e)return this.token;for(var t=this.buffer.length;!this.eof&&e>t;t++)this.buffer.push(this.getToken());return e<=this.buffer.length?this.buffer[e-1]:null},lookupType:function(e,t){var r=this.lookup(e);return null!==r&&r.type===t},next:function(){var e=null;return 0!==this.buffer.length?e=this.buffer.shift():this.eof||(e=this.getToken()),this.prevToken=this.token,this.token=e,e},tokenize:function(){for(var e=[];this.poso?C[o]:0){case k:t=n.DecimalNumber,r=this.readDecimalNumber();break;case w:t=n.String,r=this.readString(o);break;case y:t=n.Space,r=this.readSpaces();break;case b:if(o===h){if(e=this.pos+10){for(var l=2;this.source.charCodeAt(this.pos+2)===h;)l++;t=n.Identifier,r=this.readIdentifier(l),this.urlMode=this.urlMode||"url"===r}else t=n.Unknown,r=this.readUnknown();break}}t=S[o],r=String.fromCharCode(o),this.pos++,o===p?this.urlMode=!1:o===g?this.blockMode++:o===v&&this.blockMode>this.minBlockMode&&this.blockMode--;break;default:t=n.Identifier,r=this.readIdentifier(0),this.urlMode=this.urlMode||"url"===r}return this.eof=this.pos===this.source.length,{type:t,value:r,offset:s,line:i,column:a}},isNewline:function(e){return e===i||e===a||e===s?(e===s&&this.pos+1e||e>57));this.pos++);return this.source.substring(t,this.pos)},readIdentifier:function(e){var t=this.pos;for(this.pos+=e;this.posn&&this.pos+n=48&&57>=r||r>=65&&70>=r||r>=97&&102>=r)){n>0&&(this.pos+=n-1,(r===l||r===o||this.isNewline(r))&&this.pos++);break}}else if(x>r&&_[r]===b)break}return this.source.substring(t,this.pos)}},new j("\n\r\r\n\f//\"\"''/**/1a;.{url(a)}").lookup(1e3),t.exports=j},{"./const.js":37}],40:[function(e,t,r){var n=e("./list");t.exports=function o(e){var t={};for(var r in e){var i=e[r];i&&(Array.isArray(i)?i=i.slice(0):i instanceof n?i=new n(i.map(o)):i.constructor===Object&&(i=o(i))),t[r]=i}return t}},{"./list":41}],41:[function(e,t,r){function n(e){return{data:e,next:null,prev:null}}var o=function(e){if(this.cursor=null,this.head=null,this.tail=null,Array.isArray(e)){for(var t=null,r=0;ro;o++)r.add(e[o],t);return r},n.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},n.prototype.add=function(e,t){var r=o.toSetString(e),n=this._set.hasOwnProperty(r),i=this._array.length;n&&!t||this._array.push(e),n||(this._set[r]=i)},n.prototype.has=function(e){var t=o.toSetString(e);return this._set.hasOwnProperty(t)},n.prototype.indexOf=function(e){var t=o.toSetString(e);if(this._set.hasOwnProperty(t))return this._set[t];throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&ee?(-e<<1)+1:(e<<1)+0}function o(e){var t=1===(1&e),r=e>>1;return t?-r:r}var i=e("./base64"),a=5,s=1<>>=a,o>0&&(t|=u),r+=i.encode(t);while(o>0);return r},r.decode=function(e,t,r){var n,s,c=e.length,p=0,f=0;do{if(t>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(s=i.decode(e.charCodeAt(t++)),-1===s)throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(s&u),s&=l,p+=s<=0&&e=t&&r>=e?e-t:e>=n&&o>=e?e-n+u:e>=i&&a>=e?e-i+c:e==s?62:e==l?63:-1}},{}],49:[function(e,t,r){function n(e,t,o,i,a,s){var l=Math.floor((t-e)/2)+e,u=a(o,i[l],!0);return 0===u?l:u>0?t-l>1?n(l,t,o,i,a,s):s==r.LEAST_UPPER_BOUND?t1?n(e,l,o,i,a,s):s==r.LEAST_UPPER_BOUND?l:0>e?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,o,i){if(0===t.length)return-1;var a=n(-1,t.length,e,t,o,i||r.GREATEST_LOWER_BOUND);if(0>a)return-1;for(;a-1>=0&&0===o(t[a],t[a-1],!0);)--a;return a}},{}],50:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,o=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=o||i.compareByGeneratedPositionsInflated(e,t)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=e("./util");o.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},o.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=o},{"./util":55}],51:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function o(e,t){return Math.round(e+Math.random()*(t-e))}function i(e,t,r,a){if(a>r){var s=o(r,a),l=r-1;n(e,s,a);for(var u=e[a],c=r;a>c;c++)t(e[c],u)<=0&&(l+=1,n(e,l,c));n(e,l+1,c);var p=l+1;i(e,t,r,p-1),i(e,t,p+1,a)}}r.quickSort=function(e,t){i(e,t,0,e.length-1)}},{}],52:[function(e,t,r){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new a(t):new o(t)}function o(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=s.getArg(t,"version"),n=s.getArg(t,"sources"),o=s.getArg(t,"names",[]),i=s.getArg(t,"sourceRoot",null),a=s.getArg(t,"sourcesContent",null),l=s.getArg(t,"mappings"),c=s.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(s.normalize).map(function(e){return i&&s.isAbsolute(i)&&s.isAbsolute(e)?s.relative(i,e):e}),this._names=u.fromArray(o,!0),this._sources=u.fromArray(n,!0),this.sourceRoot=i,this.sourcesContent=a,this._mappings=l,this.file=c}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function a(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=s.getArg(t,"version"),o=s.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new u,this._names=new u;var i={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=s.getArg(e,"offset"),r=s.getArg(t,"line"),o=s.getArg(t,"column");if(r=0){var i=this._originalMappings[o];if(void 0===e.column)for(var a=i.originalLine;i&&i.originalLine===a;)n.push({line:s.getArg(i,"generatedLine",null),column:s.getArg(i,"generatedColumn",null),lastColumn:s.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var u=i.originalColumn;i&&i.originalLine===t&&i.originalColumn==u;)n.push({line:s.getArg(i,"generatedLine",null),column:s.getArg(i,"generatedColumn",null),lastColumn:s.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return n},r.SourceMapConsumer=n,o.prototype=Object.create(n.prototype),o.prototype.consumer=n,o.fromSourceMap=function(e){var t=Object.create(o.prototype),r=t._names=u.fromArray(e._names.toArray(),!0),n=t._sources=u.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var a=e._mappings.toArray().slice(),l=t.__generatedMappings=[],c=t.__originalMappings=[],f=0,h=a.length;h>f;f++){var d=a[f],m=new i;m.generatedLine=d.generatedLine,m.generatedColumn=d.generatedColumn,d.source&&(m.source=n.indexOf(d.source),m.originalLine=d.originalLine,m.originalColumn=d.originalColumn,d.name&&(m.name=r.indexOf(d.name)),c.push(m)),l.push(m)}return p(t.__originalMappings,s.compareByOriginalPositions),t},o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?s.join(this.sourceRoot,e):e},this)}}),o.prototype._parseMappings=function(e,t){for(var r,n,o,a,l,u=1,f=0,h=0,d=0,m=0,g=0,v=e.length,y=0,b={},k={},w=[],S=[];v>y;)if(";"===e.charAt(y))u++,y++,f=0;else if(","===e.charAt(y))y++;else{for(r=new i,r.generatedLine=u,a=y;v>a&&!this._charIsMappingSeparator(e,a);a++);if(n=e.slice(y,a),o=b[n])y+=n.length;else{for(o=[];a>y;)c.decode(e,y,k),l=k.value,y=k.rest,o.push(l);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");b[n]=o}r.generatedColumn=f+o[0],f=r.generatedColumn,o.length>1&&(r.source=m+o[1],m+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=d+o[3],d=r.originalColumn,o.length>4&&(r.name=g+o[4],g+=o[4])),S.push(r),"number"==typeof r.originalLine&&w.push(r)}p(S,s.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,p(w,s.compareByOriginalPositions),this.__originalMappings=w},o.prototype._findMapping=function(e,t,r,n,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return l.search(e,t,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===t.generatedLine){var i=s.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=s.join(this.sourceRoot,i)));var a=s.getArg(o,"name",null);return null!==a&&(a=this._names.at(a)),{source:i,line:s.getArg(o,"originalLine",null),column:s.getArg(o,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}):!1},o.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=s.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=s.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var t=s.getArg(e,"source");if(null!=this.sourceRoot&&(t=s.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var r={source:t,originalLine:s.getArg(e,"line"),originalColumn:s.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",s.compareByOriginalPositions,s.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:s.getArg(i,"generatedLine",null),column:s.getArg(i,"generatedColumn",null),lastColumn:s.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=o,a.prototype=Object.create(n.prototype),a.prototype.constructor=n,a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n=0,a=1,s=0,l=0,u=0,c=0,p="",f=this._mappings.toArray(),h=0,d=f.length;d>h;h++){if(e=f[h],e.generatedLine!==a)for(n=0;e.generatedLine!==a;)p+=";",a++;else if(h>0){if(!i.compareByGeneratedPositionsInflated(e,f[h-1]))continue;p+=","}p+=o.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(r=this._sources.indexOf(e.source),p+=o.encode(r-c),c=r,p+=o.encode(e.originalLine-1-l),l=e.originalLine-1,p+=o.encode(e.originalColumn-s),s=e.originalColumn,null!=e.name&&(t=this._names.indexOf(e.name),p+=o.encode(t-u),u=t))}return p},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=i.relative(t,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{"./array-set":46,"./base64-vlq":47,"./mapping-list":50,"./util":55}],54:[function(e,t,r){function n(e,t,r,n,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==o?null:o,this[l]=!0,null!=n&&this.add(n)}var o=e("./source-map-generator").SourceMapGenerator,i=e("./util"),a=/(\r?\n)/,s=10,l="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function o(e,t){if(null===e||void 0===e.source)s.add(t);else{var o=r?i.join(r,e.source):e.source;s.add(new n(e.originalLine,e.originalColumn,o,t,e.name))}}var s=new n,l=e.split(a),u=function(){var e=l.shift(),t=l.shift()||"";return e+t},c=1,p=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(c0&&(f&&o(f,u()),s.add(l.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=i.join(r,e)),s.setSourceContent(e,n))}),s},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[l]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[l]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;n>r;r++)t=this.children[r],t[l]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;n-1>r;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[l]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[i.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;r>t;t++)this.children[t][l]&&this.children[t].walkSourceContents(e);for(var n=Object.keys(this.sourceContents),t=0,r=n.length;r>t;t++)e(i.fromSetString(n[t]),this.sourceContents[n[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new o(e),n=!1,i=null,a=null,l=null,u=null;return this.walk(function(e,o){t.code+=e,null!==o.source&&null!==o.line&&null!==o.column?(i===o.source&&a===o.line&&l===o.column&&u===o.name||r.addMapping({source:o.source,original:{line:o.line,column:o.column},generated:{line:t.line,column:t.column},name:o.name}),i=o.source,a=o.line,l=o.column,u=o.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),i=null,n=!1);for(var c=0,p=e.length;p>c;c++)e.charCodeAt(c)===s?(t.line++,t.column=0,c+1===p?(i=null,n=!1):n&&r.addMapping({source:o.source,original:{line:o.line,column:o.column},generated:{line:t.line,column:t.column},name:o.name})):t.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:t.code,map:r}},r.SourceNode=n},{"./source-map-generator":53,"./util":55}],55:[function(e,t,r){function n(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}function o(e){var t=e.match(m);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function a(e){var t=e,n=o(e);if(n){if(!n.path)return e;t=n.path}for(var a,s=r.isAbsolute(t),l=t.split(/\/+/),u=0,c=l.length-1;c>=0;c--)a=l[c],"."===a?l.splice(c,1):".."===a?u++:u>0&&(""===a?(l.splice(c+1,u),u=0):(l.splice(c,2),u--));return t=l.join("/"),""===t&&(t=s?"/":"."),n?(n.path=t,i(n)):t}function s(e,t){""===e&&(e="."),""===t&&(t=".");var r=o(t),n=o(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),i(r);if(r||t.match(g))return t;if(n&&!n.host&&!n.path)return n.host=t,i(n);var s="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=s,i(n)):s}function l(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(0>n)return t;if(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}function u(e){return"$"+e}function c(e){return e.substr(1)}function p(e,t,r){var n=e.source-t.source;return 0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n||r?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=e.generatedLine-t.generatedLine,0!==n?n:e.name-t.name))))}function f(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n||r?n:(n=e.source-t.source,0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:e.name-t.name))))}function h(e,t){return e===t?0:e>t?1:-1}function d(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=h(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:h(e.name,t.name)))))}r.getArg=n;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,g=/^data:.+\,.+$/;r.urlParse=o,r.urlGenerate=i,r.normalize=a,r.join=s,r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},r.relative=l,r.toSetString=u,r.fromSetString=c,r.compareByOriginalPositions=p,r.compareByGeneratedPositionsDeflated=f,r.compareByGeneratedPositionsInflated=d},{}],56:[function(e,t,r){r.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,r.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,r.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":52,"./lib/source-map-generator":53,"./lib/source-node":54}],57:[function(e,t,r){t.exports={name:"csso",version:"2.2.1",description:"CSSO (CSS Optimizer) is a CSS minifier with structural optimisations",keywords:["css","minifier","minify","compress","optimisation"],homepage:"https://github.com/css/csso",author:"Sergey Kryzhanovsky (https://github.com/afelix)",maintainers:[{name:"Roman Dvornov",email:"rdvornov@gmail.com","github-username":"lahmatiy"}],license:"MIT",repository:"css/csso",bugs:{url:"https://github.com/css/csso/issues"},bin:{csso:"./bin/csso"},main:"./lib/index",eslintConfig:{env:{node:!0,mocha:!0,es6:!0},rules:{"no-duplicate-case":2,"no-undef":2,"no-unused-vars":[2,{vars:"all",args:"after-used"}]}},scripts:{test:"mocha --reporter dot",codestyle:"jscs lib && eslint lib test","codestyle-and-test":"npm run codestyle && npm test",hydrogen:"node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/csso --stat -o /dev/null",coverage:"istanbul cover _mocha -- -R dot",coveralls:"istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | coveralls",travis:"npm run codestyle-and-test && npm run coveralls",browserify:"browserify --standalone csso lib/index.js | uglifyjs --compress --mangle -o dist/csso-browser.js","gh-pages":'git clone -b gh-pages https://github.com/css/csso.git .gh-pages && npm run browserify && cp dist/csso-browser.js .gh-pages/ && cd .gh-pages && git commit -am "update" && git push && cd .. && rm -rf .gh-pages',prepublish:"npm run browserify"},dependencies:{clap:"^1.0.9","source-map":"^0.5.3"},devDependencies:{browserify:"^13.0.0",coveralls:"^2.11.6",eslint:"^2.2.0",istanbul:"^0.4.2",jscs:"~2.10.0",mocha:"~2.4.2","uglify-js":"^2.6.1"},engines:{node:">=0.10.0"},files:["bin","dist/csso-browser.js","lib","HISTORY.md","LICENSE","README.md"]}},{}]},{},[36])(36)}); \ No newline at end of file diff --git a/node_modules/csso/lib/cli.js b/node_modules/csso/lib/cli.js deleted file mode 100644 index 8384687..0000000 --- a/node_modules/csso/lib/cli.js +++ /dev/null @@ -1,338 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var cli = require('clap'); -var SourceMapConsumer = require('source-map').SourceMapConsumer; -var csso = require('./index.js'); - -function readFromStream(stream, minify) { - var buffer = []; - - // FIXME: don't chain until node.js 0.10 drop, since setEncoding isn't chainable in 0.10 - stream.setEncoding('utf8'); - stream - .on('data', function(chunk) { - buffer.push(chunk); - }) - .on('end', function() { - minify(buffer.join('')); - }); -} - -function showStat(filename, source, result, inputMap, map, time, mem) { - function fmt(size) { - return String(size).split('').reverse().reduce(function(size, digit, idx) { - if (idx && idx % 3 === 0) { - size = ' ' + size; - } - return digit + size; - }, ''); - } - - map = map || 0; - result -= map; - - console.error('Source: ', filename === '' ? filename : path.relative(process.cwd(), filename)); - if (inputMap) { - console.error('Map source:', inputMap); - } - console.error('Original: ', fmt(source), 'bytes'); - console.error('Compressed:', fmt(result), 'bytes', '(' + (100 * result / source).toFixed(2) + '%)'); - console.error('Saving: ', fmt(source - result), 'bytes', '(' + (100 * (source - result) / source).toFixed(2) + '%)'); - if (map) { - console.error('Source map:', fmt(map), 'bytes', '(' + (100 * map / (result + map)).toFixed(2) + '% of total)'); - console.error('Total: ', fmt(map + result), 'bytes'); - } - console.error('Time: ', time, 'ms'); - console.error('Memory: ', (mem / (1024 * 1024)).toFixed(3), 'MB'); -} - -function showParseError(source, filename, details, message) { - function processLines(start, end) { - return lines.slice(start, end).map(function(line, idx) { - var num = String(start + idx + 1); - - while (num.length < maxNumLength) { - num = ' ' + num; - } - - return num + ' |' + line; - }).join('\n'); - } - - var lines = source.split(/\n|\r\n?|\f/); - var column = details.column; - var line = details.line; - var startLine = Math.max(1, line - 2); - var endLine = Math.min(line + 2, lines.length + 1); - var maxNumLength = Math.max(4, String(endLine).length) + 1; - - console.error('\nParse error ' + filename + ': ' + message); - console.error(processLines(startLine - 1, line)); - console.error(new Array(column + maxNumLength + 2).join('-') + '^'); - console.error(processLines(line, endLine)); - console.error(); -} - -function debugLevel(level) { - // level is undefined when no param -> 1 - return isNaN(level) ? 1 : Math.max(Number(level), 0); -} - -function resolveSourceMap(source, inputMap, map, inputFile, outputFile) { - var inputMapContent = null; - var inputMapFile = null; - var outputMapFile = null; - - switch (map) { - case 'none': - // don't generate source map - map = false; - inputMap = 'none'; - break; - - case 'inline': - // nothing to do - break; - - case 'file': - if (!outputFile) { - console.error('Output filename should be specified when `--map file` is used'); - process.exit(2); - } - - outputMapFile = outputFile + '.map'; - break; - - default: - // process filename - if (map) { - // check path is reachable - if (!fs.existsSync(path.dirname(map))) { - console.error('Directory for map file should exists:', path.dirname(path.resolve(map))); - process.exit(2); - } - - // resolve to absolute path - outputMapFile = path.resolve(process.cwd(), map); - } - } - - switch (inputMap) { - case 'none': - // nothing to do - break; - - case 'auto': - if (map) { - // try fetch source map from source - var inputMapComment = source.match(/\/\*# sourceMappingURL=(\S+)\s*\*\/\s*$/); - - if (inputFile === '') { - inputFile = false; - } - - if (inputMapComment) { - // if comment found – value is filename or base64-encoded source map - inputMapComment = inputMapComment[1]; - - if (inputMapComment.substr(0, 5) === 'data:') { - // decode source map content from comment - inputMapContent = new Buffer(inputMapComment.substr(inputMapComment.indexOf('base64,') + 7), 'base64').toString(); - } else { - // value is filename – resolve it as absolute path - if (inputFile) { - inputMapFile = path.resolve(path.dirname(inputFile), inputMapComment); - } - } - } else { - // comment doesn't found - look up file with `.map` extension nearby input file - if (inputFile && fs.existsSync(inputFile + '.map')) { - inputMapFile = inputFile + '.map'; - } - } - - } - break; - - default: - if (inputMap) { - inputMapFile = inputMap; - } - } - - // source map placed in external file - if (inputMapFile) { - inputMapContent = fs.readFileSync(inputMapFile, 'utf8'); - } - - return { - input: inputMapContent, - inputFile: inputMapFile || (inputMapContent ? '' : false), - output: map, - outputFile: outputMapFile - }; -} - -function processCommentsOption(value) { - switch (value) { - case 'exclamation': - case 'first-exclamation': - case 'none': - return value; - } - - console.error('Wrong value for `comments` option: %s', value); - process.exit(2); -} - -var command = cli.create('csso', '[input] [output]') - .version(require('../package.json').version) - .option('-i, --input ', 'Input file') - .option('-o, --output ', 'Output file (result outputs to stdout if not set)') - .option('-m, --map ', 'Generate source map: none (default), inline, file or ', 'none') - .option('-u, --usage ', 'Usage data file') - .option('--input-map ', 'Input source map: none, auto (default) or ', 'auto') - .option('--restructure-off', 'Turns structure minimization off') - .option('--comments ', 'Comments to keep: exclamation (default), first-exclamation or none', 'exclamation') - .option('--stat', 'Output statistics in stderr') - .option('--debug [level]', 'Output intermediate state of CSS during compression', debugLevel, 0) - .action(function(args) { - var options = this.values; - var inputFile = options.input || args[0]; - var outputFile = options.output || args[1]; - var usageFile = options.usage; - var usageData = false; - var map = options.map; - var inputMap = options.inputMap; - var structureOptimisationOff = options.restructureOff; - var comments = processCommentsOption(options.comments); - var debug = options.debug; - var statistics = options.stat; - var inputStream; - - if (process.stdin.isTTY && !inputFile && !outputFile) { - this.showHelp(); - return; - } - - if (!inputFile) { - inputFile = ''; - inputStream = process.stdin; - } else { - inputFile = path.resolve(process.cwd(), inputFile); - inputStream = fs.createReadStream(inputFile); - } - - if (outputFile) { - outputFile = path.resolve(process.cwd(), outputFile); - } - - if (usageFile) { - if (!fs.existsSync(usageFile)) { - console.error('Usage data file doesn\'t found (%s)', usageFile); - process.exit(2); - } - - usageData = fs.readFileSync(usageFile, 'utf-8'); - - try { - usageData = JSON.parse(usageData); - } catch (e) { - console.error('Usage data parse error (%s)', usageFile); - process.exit(2); - } - } - - readFromStream(inputStream, function(source) { - var time = process.hrtime(); - var mem = process.memoryUsage().heapUsed; - var sourceMap = resolveSourceMap(source, inputMap, map, inputFile, outputFile); - var sourceMapAnnotation = ''; - var result; - - // main action - try { - result = csso.minify(source, { - filename: inputFile, - sourceMap: sourceMap.output, - usage: usageData, - restructure: !structureOptimisationOff, - comments: comments, - debug: debug - }); - - // for backward capability minify returns a string - if (typeof result === 'string') { - result = { - css: result, - map: null - }; - } - } catch (e) { - if (e.parseError) { - showParseError(source, inputFile, e.parseError, e.message); - if (!debug) { - process.exit(2); - } - } - - throw e; - } - - if (sourceMap.output && result.map) { - // apply input map - if (sourceMap.input) { - result.map.applySourceMap( - new SourceMapConsumer(sourceMap.input), - inputFile - ); - } - - // add source map to result - if (sourceMap.outputFile) { - // write source map to file - fs.writeFileSync(sourceMap.outputFile, result.map.toString(), 'utf-8'); - sourceMapAnnotation = '\n' + - '/*# sourceMappingURL=' + - path.relative(outputFile ? path.dirname(outputFile) : process.cwd(), sourceMap.outputFile) + - ' */'; - } else { - // inline source map - sourceMapAnnotation = '\n' + - '/*# sourceMappingURL=data:application/json;base64,' + - new Buffer(result.map.toString()).toString('base64') + - ' */'; - } - - result.css += sourceMapAnnotation; - } - - // output result - if (outputFile) { - fs.writeFileSync(outputFile, result.css, 'utf-8'); - } else { - console.log(result.css); - } - - // output statistics - if (statistics) { - var timeDiff = process.hrtime(time); - showStat( - path.relative(process.cwd(), inputFile), - source.length, - result.css.length, - sourceMap.inputFile, - sourceMapAnnotation.length, - parseInt(timeDiff[0] * 1e3 + timeDiff[1] / 1e6), - process.memoryUsage().heapUsed - mem - ); - } - }); - }); - -module.exports = { - run: command.run.bind(command), - isCliError: function(err) { - return err instanceof cli.Error; - } -}; diff --git a/node_modules/csso/lib/compressor/clean/Atrule.js b/node_modules/csso/lib/compressor/clean/Atrule.js deleted file mode 100644 index d27db04..0000000 --- a/node_modules/csso/lib/compressor/clean/Atrule.js +++ /dev/null @@ -1,54 +0,0 @@ -module.exports = function cleanAtrule(node, item, list) { - if (node.block) { - // otherwise removed at-rule don't prevent @import for removal - this.root.firstAtrulesAllowed = false; - - if (node.block.type === 'Block' && node.block.declarations.isEmpty()) { - list.remove(item); - return; - } - - if (node.block.type === 'StyleSheet' && node.block.rules.isEmpty()) { - list.remove(item); - return; - } - } - - switch (node.name) { - case 'charset': - if (node.expression.sequence.isEmpty()) { - list.remove(item); - return; - } - - // if there is any rule before @charset -> remove it - if (item.prev) { - list.remove(item); - return; - } - - break; - - case 'import': - if (!this.root.firstAtrulesAllowed) { - list.remove(item); - return; - } - - // if there are some rules that not an @import or @charset before @import - // remove it - list.prevUntil(item.prev, function(rule) { - if (rule.type === 'Atrule') { - if (rule.name === 'import' || rule.name === 'charset') { - return; - } - } - - this.root.firstAtrulesAllowed = false; - list.remove(item); - return true; - }, this); - - break; - } -}; diff --git a/node_modules/csso/lib/compressor/clean/Comment.js b/node_modules/csso/lib/compressor/clean/Comment.js deleted file mode 100644 index aa80108..0000000 --- a/node_modules/csso/lib/compressor/clean/Comment.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function cleanComment(data, item, list) { - list.remove(item); -}; diff --git a/node_modules/csso/lib/compressor/clean/Declaration.js b/node_modules/csso/lib/compressor/clean/Declaration.js deleted file mode 100644 index 05738d1..0000000 --- a/node_modules/csso/lib/compressor/clean/Declaration.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function cleanDeclartion(node, item, list) { - if (node.value.sequence.isEmpty()) { - list.remove(item); - } -}; diff --git a/node_modules/csso/lib/compressor/clean/Identifier.js b/node_modules/csso/lib/compressor/clean/Identifier.js deleted file mode 100644 index 20aec93..0000000 --- a/node_modules/csso/lib/compressor/clean/Identifier.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = function cleanIdentifier(node, item, list) { - // remove useless universal selector - if (this.selector !== null && node.name === '*') { - // remove when universal selector isn't last - if (item.next && item.next.data.type !== 'Combinator') { - list.remove(item); - } - } -}; diff --git a/node_modules/csso/lib/compressor/clean/Ruleset.js b/node_modules/csso/lib/compressor/clean/Ruleset.js deleted file mode 100644 index 4622b21..0000000 --- a/node_modules/csso/lib/compressor/clean/Ruleset.js +++ /dev/null @@ -1,39 +0,0 @@ -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function cleanUnused(node, usageData) { - return node.selector.selectors.each(function(selector, item, list) { - var hasUnused = selector.sequence.some(function(node) { - switch (node.type) { - case 'Class': - return usageData.classes && !hasOwnProperty.call(usageData.classes, node.name); - - case 'Id': - return usageData.ids && !hasOwnProperty.call(usageData.ids, node.name); - - case 'Identifier': - // ignore universal selector - if (node.name !== '*') { - // TODO: remove toLowerCase when type selectors will be normalized - return usageData.tags && !hasOwnProperty.call(usageData.tags, node.name.toLowerCase()); - } - - break; - } - }); - - if (hasUnused) { - list.remove(item); - } - }); -} - -module.exports = function cleanRuleset(node, item, list, usageData) { - if (usageData) { - cleanUnused(node, usageData); - } - - if (node.selector.selectors.isEmpty() || - node.block.declarations.isEmpty()) { - list.remove(item); - } -}; diff --git a/node_modules/csso/lib/compressor/clean/Space.js b/node_modules/csso/lib/compressor/clean/Space.js deleted file mode 100644 index 3342c4e..0000000 --- a/node_modules/csso/lib/compressor/clean/Space.js +++ /dev/null @@ -1,16 +0,0 @@ -function canCleanWhitespace(node) { - if (node.type !== 'Operator') { - return false; - } - - return node.value !== '+' && node.value !== '-'; -} - -module.exports = function cleanWhitespace(node, item, list) { - var prev = item.prev && item.prev.data; - var next = item.next && item.next.data; - - if (canCleanWhitespace(prev) || canCleanWhitespace(next)) { - list.remove(item); - } -}; diff --git a/node_modules/csso/lib/compressor/clean/index.js b/node_modules/csso/lib/compressor/clean/index.js deleted file mode 100644 index 750ee44..0000000 --- a/node_modules/csso/lib/compressor/clean/index.js +++ /dev/null @@ -1,17 +0,0 @@ -var walk = require('../../utils/walk.js').all; -var handlers = { - Space: require('./Space.js'), - Atrule: require('./Atrule.js'), - Ruleset: require('./Ruleset.js'), - Declaration: require('./Declaration.js'), - Identifier: require('./Identifier.js'), - Comment: require('./Comment.js') -}; - -module.exports = function(ast, usageData) { - walk(ast, function(node, item, list) { - if (handlers.hasOwnProperty(node.type)) { - handlers[node.type].call(this, node, item, list, usageData); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/compress/Atrule.js b/node_modules/csso/lib/compressor/compress/Atrule.js deleted file mode 100644 index c5410ab..0000000 --- a/node_modules/csso/lib/compressor/compress/Atrule.js +++ /dev/null @@ -1,9 +0,0 @@ -var resolveKeyword = require('../../utils/names.js').keyword; -var compressKeyframes = require('./atrule/keyframes.js'); - -module.exports = function(node) { - // compress @keyframe selectors - if (resolveKeyword(node.name).name === 'keyframes') { - compressKeyframes(node); - } -}; diff --git a/node_modules/csso/lib/compressor/compress/Attribute.js b/node_modules/csso/lib/compressor/compress/Attribute.js deleted file mode 100644 index 99cafdc..0000000 --- a/node_modules/csso/lib/compressor/compress/Attribute.js +++ /dev/null @@ -1,33 +0,0 @@ -// Can unquote attribute detection -// Adopted implementation of Mathias Bynens -// https://github.com/mathiasbynens/mothereff.in/blob/master/unquoted-attributes/eff.js -var escapesRx = /\\([0-9A-Fa-f]{1,6})[ \t\n\f\r]?|\\./g; -var blockUnquoteRx = /^(-?\d|--)|[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/; - -function canUnquote(value) { - if (value === '' || value === '-') { - return; - } - - // Escapes are valid, so replace them with a valid non-empty string - value = value.replace(escapesRx, 'a'); - - return !blockUnquoteRx.test(value); -} - -module.exports = function(node) { - var attrValue = node.value; - - if (!attrValue || attrValue.type !== 'String') { - return; - } - - var unquotedValue = attrValue.value.replace(/^(.)(.*)\1$/, '$2'); - if (canUnquote(unquotedValue)) { - node.value = { - type: 'Identifier', - info: attrValue.info, - name: unquotedValue - }; - } -}; diff --git a/node_modules/csso/lib/compressor/compress/Dimension.js b/node_modules/csso/lib/compressor/compress/Dimension.js deleted file mode 100644 index e614ad0..0000000 --- a/node_modules/csso/lib/compressor/compress/Dimension.js +++ /dev/null @@ -1,54 +0,0 @@ -var packNumber = require('./Number.js').pack; -var LENGTH_UNIT = { - // absolute length units - 'px': true, - 'mm': true, - 'cm': true, - 'in': true, - 'pt': true, - 'pc': true, - - // relative length units - 'em': true, - 'ex': true, - 'ch': true, - 'rem': true, - - // viewport-percentage lengths - 'vh': true, - 'vw': true, - 'vmin': true, - 'vmax': true, - 'vm': true -}; - -module.exports = function compressDimension(node, item) { - var value = packNumber(node.value); - - node.value = value; - - if (value === '0' && this.declaration) { - var unit = node.unit.toLowerCase(); - - // only length values can be compressed - if (!LENGTH_UNIT.hasOwnProperty(unit)) { - return; - } - - // issue #200: don't remove units in flex property as it could change value meaning - if (this.declaration.property.name === 'flex') { - return; - } - - // issue #222: don't remove units inside calc - if (this['function'] && this['function'].name === 'calc') { - return; - } - - item.data = { - type: 'Number', - info: node.info, - value: value - }; - } -}; diff --git a/node_modules/csso/lib/compressor/compress/Number.js b/node_modules/csso/lib/compressor/compress/Number.js deleted file mode 100644 index 8e17e11..0000000 --- a/node_modules/csso/lib/compressor/compress/Number.js +++ /dev/null @@ -1,22 +0,0 @@ -function packNumber(value) { - // 100 -> '100' - // 00100 -> '100' - // +100 -> '100' - // -100 -> '-100' - // 0.123 -> '.123' - // 0.12300 -> '.123' - // 0.0 -> '' - // 0 -> '' - value = String(value).replace(/^(?:\+|(-))?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/, '$1$2$3'); - - if (value.length === 0 || value === '-') { - value = '0'; - } - - return value; -}; - -module.exports = function(node) { - node.value = packNumber(node.value); -}; -module.exports.pack = packNumber; diff --git a/node_modules/csso/lib/compressor/compress/String.js b/node_modules/csso/lib/compressor/compress/String.js deleted file mode 100644 index 01a20a2..0000000 --- a/node_modules/csso/lib/compressor/compress/String.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = function(node) { - var value = node.value; - - // remove escaped \n, i.e. - // .a { content: "foo\ - // bar"} - // -> - // .a { content: "foobar" } - value = value.replace(/\\\n/g, ''); - - node.value = value; -}; diff --git a/node_modules/csso/lib/compressor/compress/Url.js b/node_modules/csso/lib/compressor/compress/Url.js deleted file mode 100644 index 040a359..0000000 --- a/node_modules/csso/lib/compressor/compress/Url.js +++ /dev/null @@ -1,33 +0,0 @@ -var UNICODE = '\\\\[0-9a-f]{1,6}(\\r\\n|[ \\n\\r\\t\\f])?'; -var ESCAPE = '(' + UNICODE + '|\\\\[^\\n\\r\\f0-9a-fA-F])'; -var NONPRINTABLE = '\u0000\u0008\u000b\u000e-\u001f\u007f'; -var SAFE_URL = new RegExp('^(' + ESCAPE + '|[^\"\'\\(\\)\\\\\\s' + NONPRINTABLE + '])*$', 'i'); - -module.exports = function(node) { - var value = node.value; - - if (value.type !== 'String') { - return; - } - - var quote = value.value[0]; - var url = value.value.substr(1, value.value.length - 2); - - // convert `\\` to `/` - url = url.replace(/\\\\/g, '/'); - - // remove quotes when safe - // https://www.w3.org/TR/css-syntax-3/#url-unquoted-diagram - if (SAFE_URL.test(url)) { - node.value = { - type: 'Raw', - info: node.value.info, - value: url - }; - } else { - // use double quotes if string has no double quotes - // otherwise use original quotes - // TODO: make better quote type selection - node.value.value = url.indexOf('"') === -1 ? '"' + url + '"' : quote + url + quote; - } -}; diff --git a/node_modules/csso/lib/compressor/compress/Value.js b/node_modules/csso/lib/compressor/compress/Value.js deleted file mode 100644 index 8196ba8..0000000 --- a/node_modules/csso/lib/compressor/compress/Value.js +++ /dev/null @@ -1,18 +0,0 @@ -var resolveName = require('../../utils/names.js').property; -var handlers = { - 'font': require('./property/font.js'), - 'font-weight': require('./property/font-weight.js'), - 'background': require('./property/background.js') -}; - -module.exports = function compressValue(node) { - if (!this.declaration) { - return; - } - - var property = resolveName(this.declaration.property.name); - - if (handlers.hasOwnProperty(property.name)) { - handlers[property.name](node); - } -}; diff --git a/node_modules/csso/lib/compressor/compress/atrule/keyframes.js b/node_modules/csso/lib/compressor/compress/atrule/keyframes.js deleted file mode 100644 index 74eff2c..0000000 --- a/node_modules/csso/lib/compressor/compress/atrule/keyframes.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = function(node) { - node.block.rules.each(function(ruleset) { - ruleset.selector.selectors.each(function(simpleselector) { - simpleselector.sequence.each(function(data, item) { - if (data.type === 'Percentage' && data.value === '100') { - item.data = { - type: 'Identifier', - info: data.info, - name: 'to' - }; - } else if (data.type === 'Identifier' && data.name === 'from') { - item.data = { - type: 'Percentage', - info: data.info, - value: '0' - }; - } - }); - }); - }); -}; diff --git a/node_modules/csso/lib/compressor/compress/color.js b/node_modules/csso/lib/compressor/compress/color.js deleted file mode 100644 index cf2a323..0000000 --- a/node_modules/csso/lib/compressor/compress/color.js +++ /dev/null @@ -1,489 +0,0 @@ -var List = require('../../utils/list.js'); -var packNumber = require('./Number.js').pack; - -// http://www.w3.org/TR/css3-color/#svg-color -var NAME_TO_HEX = { - 'aliceblue': 'f0f8ff', - 'antiquewhite': 'faebd7', - 'aqua': '0ff', - 'aquamarine': '7fffd4', - 'azure': 'f0ffff', - 'beige': 'f5f5dc', - 'bisque': 'ffe4c4', - 'black': '000', - 'blanchedalmond': 'ffebcd', - 'blue': '00f', - 'blueviolet': '8a2be2', - 'brown': 'a52a2a', - 'burlywood': 'deb887', - 'cadetblue': '5f9ea0', - 'chartreuse': '7fff00', - 'chocolate': 'd2691e', - 'coral': 'ff7f50', - 'cornflowerblue': '6495ed', - 'cornsilk': 'fff8dc', - 'crimson': 'dc143c', - 'cyan': '0ff', - 'darkblue': '00008b', - 'darkcyan': '008b8b', - 'darkgoldenrod': 'b8860b', - 'darkgray': 'a9a9a9', - 'darkgrey': 'a9a9a9', - 'darkgreen': '006400', - 'darkkhaki': 'bdb76b', - 'darkmagenta': '8b008b', - 'darkolivegreen': '556b2f', - 'darkorange': 'ff8c00', - 'darkorchid': '9932cc', - 'darkred': '8b0000', - 'darksalmon': 'e9967a', - 'darkseagreen': '8fbc8f', - 'darkslateblue': '483d8b', - 'darkslategray': '2f4f4f', - 'darkslategrey': '2f4f4f', - 'darkturquoise': '00ced1', - 'darkviolet': '9400d3', - 'deeppink': 'ff1493', - 'deepskyblue': '00bfff', - 'dimgray': '696969', - 'dimgrey': '696969', - 'dodgerblue': '1e90ff', - 'firebrick': 'b22222', - 'floralwhite': 'fffaf0', - 'forestgreen': '228b22', - 'fuchsia': 'f0f', - 'gainsboro': 'dcdcdc', - 'ghostwhite': 'f8f8ff', - 'gold': 'ffd700', - 'goldenrod': 'daa520', - 'gray': '808080', - 'grey': '808080', - 'green': '008000', - 'greenyellow': 'adff2f', - 'honeydew': 'f0fff0', - 'hotpink': 'ff69b4', - 'indianred': 'cd5c5c', - 'indigo': '4b0082', - 'ivory': 'fffff0', - 'khaki': 'f0e68c', - 'lavender': 'e6e6fa', - 'lavenderblush': 'fff0f5', - 'lawngreen': '7cfc00', - 'lemonchiffon': 'fffacd', - 'lightblue': 'add8e6', - 'lightcoral': 'f08080', - 'lightcyan': 'e0ffff', - 'lightgoldenrodyellow': 'fafad2', - 'lightgray': 'd3d3d3', - 'lightgrey': 'd3d3d3', - 'lightgreen': '90ee90', - 'lightpink': 'ffb6c1', - 'lightsalmon': 'ffa07a', - 'lightseagreen': '20b2aa', - 'lightskyblue': '87cefa', - 'lightslategray': '789', - 'lightslategrey': '789', - 'lightsteelblue': 'b0c4de', - 'lightyellow': 'ffffe0', - 'lime': '0f0', - 'limegreen': '32cd32', - 'linen': 'faf0e6', - 'magenta': 'f0f', - 'maroon': '800000', - 'mediumaquamarine': '66cdaa', - 'mediumblue': '0000cd', - 'mediumorchid': 'ba55d3', - 'mediumpurple': '9370db', - 'mediumseagreen': '3cb371', - 'mediumslateblue': '7b68ee', - 'mediumspringgreen': '00fa9a', - 'mediumturquoise': '48d1cc', - 'mediumvioletred': 'c71585', - 'midnightblue': '191970', - 'mintcream': 'f5fffa', - 'mistyrose': 'ffe4e1', - 'moccasin': 'ffe4b5', - 'navajowhite': 'ffdead', - 'navy': '000080', - 'oldlace': 'fdf5e6', - 'olive': '808000', - 'olivedrab': '6b8e23', - 'orange': 'ffa500', - 'orangered': 'ff4500', - 'orchid': 'da70d6', - 'palegoldenrod': 'eee8aa', - 'palegreen': '98fb98', - 'paleturquoise': 'afeeee', - 'palevioletred': 'db7093', - 'papayawhip': 'ffefd5', - 'peachpuff': 'ffdab9', - 'peru': 'cd853f', - 'pink': 'ffc0cb', - 'plum': 'dda0dd', - 'powderblue': 'b0e0e6', - 'purple': '800080', - 'rebeccapurple': '639', - 'red': 'f00', - 'rosybrown': 'bc8f8f', - 'royalblue': '4169e1', - 'saddlebrown': '8b4513', - 'salmon': 'fa8072', - 'sandybrown': 'f4a460', - 'seagreen': '2e8b57', - 'seashell': 'fff5ee', - 'sienna': 'a0522d', - 'silver': 'c0c0c0', - 'skyblue': '87ceeb', - 'slateblue': '6a5acd', - 'slategray': '708090', - 'slategrey': '708090', - 'snow': 'fffafa', - 'springgreen': '00ff7f', - 'steelblue': '4682b4', - 'tan': 'd2b48c', - 'teal': '008080', - 'thistle': 'd8bfd8', - 'tomato': 'ff6347', - 'turquoise': '40e0d0', - 'violet': 'ee82ee', - 'wheat': 'f5deb3', - 'white': 'fff', - 'whitesmoke': 'f5f5f5', - 'yellow': 'ff0', - 'yellowgreen': '9acd32' -}; - -var HEX_TO_NAME = { - '800000': 'maroon', - '800080': 'purple', - '808000': 'olive', - '808080': 'gray', - '00ffff': 'cyan', - 'f0ffff': 'azure', - 'f5f5dc': 'beige', - 'ffe4c4': 'bisque', - '000000': 'black', - '0000ff': 'blue', - 'a52a2a': 'brown', - 'ff7f50': 'coral', - 'ffd700': 'gold', - '008000': 'green', - '4b0082': 'indigo', - 'fffff0': 'ivory', - 'f0e68c': 'khaki', - '00ff00': 'lime', - 'faf0e6': 'linen', - '000080': 'navy', - 'ffa500': 'orange', - 'da70d6': 'orchid', - 'cd853f': 'peru', - 'ffc0cb': 'pink', - 'dda0dd': 'plum', - 'f00': 'red', - 'ff0000': 'red', - 'fa8072': 'salmon', - 'a0522d': 'sienna', - 'c0c0c0': 'silver', - 'fffafa': 'snow', - 'd2b48c': 'tan', - '008080': 'teal', - 'ff6347': 'tomato', - 'ee82ee': 'violet', - 'f5deb3': 'wheat', - 'ffffff': 'white', - 'ffff00': 'yellow' -}; - -function hueToRgb(p, q, t) { - if (t < 0) { - t += 1; - } - if (t > 1) { - t -= 1; - } - if (t < 1 / 6) { - return p + (q - p) * 6 * t; - } - if (t < 1 / 2) { - return q; - } - if (t < 2 / 3) { - return p + (q - p) * (2 / 3 - t) * 6; - } - return p; -} - -function hslToRgb(h, s, l, a) { - var r; - var g; - var b; - - if (s == 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - - r = hueToRgb(p, q, h + 1 / 3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1 / 3); - } - - return [ - Math.round(r * 255), - Math.round(g * 255), - Math.round(b * 255), - a - ]; -} - -function toHex(value) { - value = value.toString(16); - return value.length === 1 ? '0' + value : value; -} - -function parseFunctionArgs(functionArgs, count, rgb) { - var argument = functionArgs.head; - var args = []; - - while (argument !== null) { - var argumentPart = argument.data.sequence.head; - var wasValue = false; - - while (argumentPart !== null) { - var value = argumentPart.data; - var type = value.type; - - switch (type) { - case 'Number': - case 'Percentage': - if (wasValue) { - return; - } - - wasValue = true; - args.push({ - type: type, - value: Number(value.value) - }); - break; - - case 'Operator': - if (wasValue || value.value !== '+') { - return; - } - break; - - default: - // something we couldn't understand - return; - } - - argumentPart = argumentPart.next; - } - - argument = argument.next; - } - - if (args.length !== count) { - // invalid arguments count - // TODO: remove those tokens - return; - } - - if (args.length === 4) { - if (args[3].type !== 'Number') { - // 4th argument should be a number - // TODO: remove those tokens - return; - } - - args[3].type = 'Alpha'; - } - - if (rgb) { - if (args[0].type !== args[1].type || args[0].type !== args[2].type) { - // invalid color, numbers and percentage shouldn't be mixed - // TODO: remove those tokens - return; - } - } else { - if (args[0].type !== 'Number' || - args[1].type !== 'Percentage' || - args[2].type !== 'Percentage') { - // invalid color, for hsl values should be: number, percentage, percentage - // TODO: remove those tokens - return; - } - - args[0].type = 'Angle'; - } - - return args.map(function(arg) { - var value = Math.max(0, arg.value); - - switch (arg.type) { - case 'Number': - // fit value to [0..255] range - value = Math.min(value, 255); - break; - - case 'Percentage': - // convert 0..100% to value in [0..255] range - value = Math.min(value, 100) / 100; - - if (!rgb) { - return value; - } - - value = 255 * value; - break; - - case 'Angle': - // fit value to (-360..360) range - return (((value % 360) + 360) % 360) / 360; - - case 'Alpha': - // fit value to [0..1] range - return Math.min(value, 1); - } - - return Math.round(value); - }); -} - -function compressFunction(node, item, list) { - var functionName = node.name; - var args; - - if (functionName === 'rgba' || functionName === 'hsla') { - args = parseFunctionArgs(node.arguments, 4, functionName === 'rgba'); - - if (!args) { - // something went wrong - return; - } - - if (functionName === 'hsla') { - args = hslToRgb.apply(null, args); - node.name = 'rgba'; - } - - if (args[3] !== 1) { - // replace argument values for normalized/interpolated - node.arguments.each(function(argument) { - var item = argument.sequence.head; - - if (item.data.type === 'Operator') { - item = item.next; - } - - argument.sequence = new List([{ - type: 'Number', - info: item.data.info, - value: packNumber(args.shift()) - }]); - }); - - return; - } - - // otherwise convert to rgb, i.e. rgba(255, 0, 0, 1) -> rgb(255, 0, 0) - functionName = 'rgb'; - } - - if (functionName === 'hsl') { - args = args || parseFunctionArgs(node.arguments, 3, false); - - if (!args) { - // something went wrong - return; - } - - // convert to rgb - args = hslToRgb.apply(null, args); - functionName = 'rgb'; - } - - if (functionName === 'rgb') { - args = args || parseFunctionArgs(node.arguments, 3, true); - - if (!args) { - // something went wrong - return; - } - - // check if color is not at the end and not followed by space - var next = item.next; - if (next && next.data.type !== 'Space') { - list.insert(list.createItem({ - type: 'Space' - }), next); - } - - item.data = { - type: 'Hash', - info: node.info, - value: toHex(args[0]) + toHex(args[1]) + toHex(args[2]) - }; - - compressHex(item.data, item); - } -} - -function compressIdent(node, item) { - if (this.declaration === null) { - return; - } - - var color = node.name.toLowerCase(); - - if (NAME_TO_HEX.hasOwnProperty(color)) { - var hex = NAME_TO_HEX[color]; - - if (hex.length + 1 <= color.length) { - // replace for shorter hex value - item.data = { - type: 'Hash', - info: node.info, - value: hex - }; - } else { - // special case for consistent colors - if (color === 'grey') { - color = 'gray'; - } - - // just replace value for lower cased name - node.name = color; - } - } -} - -function compressHex(node, item) { - var color = node.value.toLowerCase(); - - // #112233 -> #123 - if (color.length === 6 && - color[0] === color[1] && - color[2] === color[3] && - color[4] === color[5]) { - color = color[0] + color[2] + color[4]; - } - - if (HEX_TO_NAME[color]) { - item.data = { - type: 'Identifier', - info: node.info, - name: HEX_TO_NAME[color] - }; - } else { - node.value = color; - } -} - -module.exports = { - compressFunction: compressFunction, - compressIdent: compressIdent, - compressHex: compressHex -}; diff --git a/node_modules/csso/lib/compressor/compress/index.js b/node_modules/csso/lib/compressor/compress/index.js deleted file mode 100644 index ff6b029..0000000 --- a/node_modules/csso/lib/compressor/compress/index.js +++ /dev/null @@ -1,22 +0,0 @@ -var walk = require('../../utils/walk.js').all; -var handlers = { - Atrule: require('./Atrule.js'), - Attribute: require('./Attribute.js'), - Value: require('./Value.js'), - Dimension: require('./Dimension.js'), - Percentage: require('./Number.js'), - Number: require('./Number.js'), - String: require('./String.js'), - Url: require('./Url.js'), - Hash: require('./color.js').compressHex, - Identifier: require('./color.js').compressIdent, - Function: require('./color.js').compressFunction -}; - -module.exports = function(ast) { - walk(ast, function(node, item, list) { - if (handlers.hasOwnProperty(node.type)) { - handlers[node.type].call(this, node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/compress/property/background.js b/node_modules/csso/lib/compressor/compress/property/background.js deleted file mode 100644 index 210127a..0000000 --- a/node_modules/csso/lib/compressor/compress/property/background.js +++ /dev/null @@ -1,66 +0,0 @@ -var List = require('../../../utils/list.js'); - -module.exports = function compressBackground(node) { - function lastType() { - if (buffer.length) { - return buffer[buffer.length - 1].type; - } - } - - function flush() { - if (lastType() === 'Space') { - buffer.pop(); - } - - if (!buffer.length) { - buffer.unshift( - { - type: 'Number', - value: '0' - }, - { - type: 'Space' - }, - { - type: 'Number', - value: '0' - } - ); - } - - newValue.push.apply(newValue, buffer); - - buffer = []; - } - - var newValue = []; - var buffer = []; - - node.sequence.each(function(node) { - if (node.type === 'Operator' && node.value === ',') { - flush(); - newValue.push(node); - return; - } - - // remove defaults - if (node.type === 'Identifier') { - if (node.name === 'transparent' || - node.name === 'none' || - node.name === 'repeat' || - node.name === 'scroll') { - return; - } - } - - // don't add redundant spaces - if (node.type === 'Space' && (!buffer.length || lastType() === 'Space')) { - return; - } - - buffer.push(node); - }); - - flush(); - node.sequence = new List(newValue); -}; diff --git a/node_modules/csso/lib/compressor/compress/property/font-weight.js b/node_modules/csso/lib/compressor/compress/property/font-weight.js deleted file mode 100644 index 29122eb..0000000 --- a/node_modules/csso/lib/compressor/compress/property/font-weight.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = function compressFontWeight(node) { - var value = node.sequence.head.data; - - if (value.type === 'Identifier') { - switch (value.name) { - case 'normal': - node.sequence.head.data = { - type: 'Number', - info: value.info, - value: '400' - }; - break; - case 'bold': - node.sequence.head.data = { - type: 'Number', - info: value.info, - value: '700' - }; - break; - } - } -}; diff --git a/node_modules/csso/lib/compressor/compress/property/font.js b/node_modules/csso/lib/compressor/compress/property/font.js deleted file mode 100644 index 783685f..0000000 --- a/node_modules/csso/lib/compressor/compress/property/font.js +++ /dev/null @@ -1,45 +0,0 @@ -module.exports = function compressFont(node) { - var list = node.sequence; - - list.eachRight(function(node, item) { - if (node.type === 'Identifier') { - if (node.name === 'bold') { - item.data = { - type: 'Number', - info: node.info, - value: '700' - }; - } else if (node.name === 'normal') { - var prev = item.prev; - - if (prev && prev.data.type === 'Operator' && prev.data.value === '/') { - this.remove(prev); - } - - this.remove(item); - } else if (node.name === 'medium') { - var next = item.next; - - if (!next || next.data.type !== 'Operator') { - this.remove(item); - } - } - } - }); - - // remove redundant spaces - list.each(function(node, item) { - if (node.type === 'Space') { - if (!item.prev || !item.next || item.next.data.type === 'Space') { - this.remove(item); - } - } - }); - - if (list.isEmpty()) { - list.insert(list.createItem({ - type: 'Identifier', - name: 'normal' - })); - } -}; diff --git a/node_modules/csso/lib/compressor/index.js b/node_modules/csso/lib/compressor/index.js deleted file mode 100644 index 6d3fdeb..0000000 --- a/node_modules/csso/lib/compressor/index.js +++ /dev/null @@ -1,186 +0,0 @@ -var List = require('../utils/list'); -var clone = require('../utils/clone'); -var usageUtils = require('./usage'); -var clean = require('./clean'); -var compress = require('./compress'); -var restructureBlock = require('./restructure'); -var walkRules = require('../utils/walk').rules; - -function readRulesChunk(rules, specialComments) { - var buffer = new List(); - var nonSpaceTokenInBuffer = false; - var protectedComment; - - rules.nextUntil(rules.head, function(node, item, list) { - if (node.type === 'Comment') { - if (!specialComments || node.value.charAt(0) !== '!') { - list.remove(item); - return; - } - - if (nonSpaceTokenInBuffer || protectedComment) { - return true; - } - - list.remove(item); - protectedComment = node; - return; - } - - if (node.type !== 'Space') { - nonSpaceTokenInBuffer = true; - } - - buffer.insert(list.remove(item)); - }); - - return { - comment: protectedComment, - stylesheet: { - type: 'StyleSheet', - info: null, - rules: buffer - } - }; -} - -function compressChunk(ast, firstAtrulesAllowed, usageData, num, logger) { - logger('Compress block #' + num, null, true); - - var seed = 1; - walkRules(ast, function markStylesheets() { - if ('id' in this.stylesheet === false) { - this.stylesheet.firstAtrulesAllowed = firstAtrulesAllowed; - this.stylesheet.id = seed++; - } - }); - logger('init', ast); - - // remove redundant - clean(ast, usageData); - logger('clean', ast); - - // compress nodes - compress(ast, usageData); - logger('compress', ast); - - return ast; -} - -function getCommentsOption(options) { - var comments = 'comments' in options ? options.comments : 'exclamation'; - - if (typeof comments === 'boolean') { - comments = comments ? 'exclamation' : false; - } else if (comments !== 'exclamation' && comments !== 'first-exclamation') { - comments = false; - } - - return comments; -} - -function getRestructureOption(options) { - return 'restructure' in options ? options.restructure : - 'restructuring' in options ? options.restructuring : - true; -} - -function wrapBlock(block) { - return new List([{ - type: 'Ruleset', - selector: { - type: 'Selector', - selectors: new List([{ - type: 'SimpleSelector', - sequence: new List([{ - type: 'Identifier', - name: 'x' - }]) - }]) - }, - block: block - }]); -} - -module.exports = function compress(ast, options) { - ast = ast || { type: 'StyleSheet', info: null, rules: new List() }; - options = options || {}; - - var logger = typeof options.logger === 'function' ? options.logger : Function(); - var specialComments = getCommentsOption(options); - var restructuring = getRestructureOption(options); - var firstAtrulesAllowed = true; - var usageData = false; - var inputRules; - var outputRules = new List(); - var chunk; - var chunkNum = 1; - var chunkRules; - - if (options.clone) { - ast = clone(ast); - } - - if (ast.type === 'StyleSheet') { - inputRules = ast.rules; - ast.rules = outputRules; - } else { - inputRules = wrapBlock(ast); - } - - if (options.usage) { - usageData = usageUtils.buildIndex(options.usage); - } - - do { - chunk = readRulesChunk(inputRules, Boolean(specialComments)); - - compressChunk(chunk.stylesheet, firstAtrulesAllowed, usageData, chunkNum++, logger); - - // structure optimisations - if (restructuring) { - restructureBlock(chunk.stylesheet, usageData, logger); - } - - chunkRules = chunk.stylesheet.rules; - - if (chunk.comment) { - // add \n before comment if there is another content in outputRules - if (!outputRules.isEmpty()) { - outputRules.insert(List.createItem({ - type: 'Raw', - value: '\n' - })); - } - - outputRules.insert(List.createItem(chunk.comment)); - - // add \n after comment if chunk is not empty - if (!chunkRules.isEmpty()) { - outputRules.insert(List.createItem({ - type: 'Raw', - value: '\n' - })); - } - } - - if (firstAtrulesAllowed && !chunkRules.isEmpty()) { - var lastRule = chunkRules.last(); - - if (lastRule.type !== 'Atrule' || - (lastRule.name !== 'import' && lastRule.name !== 'charset')) { - firstAtrulesAllowed = false; - } - } - - if (specialComments !== 'exclamation') { - specialComments = false; - } - - outputRules.appendList(chunkRules); - } while (!inputRules.isEmpty()); - - return { - ast: ast - }; -}; diff --git a/node_modules/csso/lib/compressor/restructure/1-initialMergeRuleset.js b/node_modules/csso/lib/compressor/restructure/1-initialMergeRuleset.js deleted file mode 100644 index 036a04b..0000000 --- a/node_modules/csso/lib/compressor/restructure/1-initialMergeRuleset.js +++ /dev/null @@ -1,48 +0,0 @@ -var utils = require('./utils.js'); -var walkRules = require('../../utils/walk.js').rules; - -function processRuleset(node, item, list) { - var selectors = node.selector.selectors; - var declarations = node.block.declarations; - - list.prevUntil(item.prev, function(prev) { - // skip non-ruleset node if safe - if (prev.type !== 'Ruleset') { - return utils.unsafeToSkipNode.call(selectors, prev); - } - - var prevSelectors = prev.selector.selectors; - var prevDeclarations = prev.block.declarations; - - // try to join rulesets with equal pseudo signature - if (node.pseudoSignature === prev.pseudoSignature) { - // try to join by selectors - if (utils.isEqualLists(prevSelectors, selectors)) { - prevDeclarations.appendList(declarations); - list.remove(item); - return true; - } - - // try to join by declarations - if (utils.isEqualDeclarations(declarations, prevDeclarations)) { - utils.addSelectors(prevSelectors, selectors); - list.remove(item); - return true; - } - } - - // go to prev ruleset if has no selector similarities - return utils.hasSimilarSelectors(selectors, prevSelectors); - }); -}; - -// NOTE: direction should be left to right, since rulesets merge to left -// ruleset. When direction right to left unmerged rulesets may prevent lookup -// TODO: remove initial merge -module.exports = function initialMergeRuleset(ast) { - walkRules(ast, function(node, item, list) { - if (node.type === 'Ruleset') { - processRuleset(node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/2-mergeAtrule.js b/node_modules/csso/lib/compressor/restructure/2-mergeAtrule.js deleted file mode 100644 index d07318f..0000000 --- a/node_modules/csso/lib/compressor/restructure/2-mergeAtrule.js +++ /dev/null @@ -1,35 +0,0 @@ -var walkRulesRight = require('../../utils/walk.js').rulesRight; - -function isMediaRule(node) { - return node.type === 'Atrule' && node.name === 'media'; -} - -function processAtrule(node, item, list) { - if (!isMediaRule(node)) { - return; - } - - var prev = item.prev && item.prev.data; - - if (!prev || !isMediaRule(prev)) { - return; - } - - // merge @media with same query - if (node.expression.id === prev.expression.id) { - prev.block.rules.appendList(node.block.rules); - prev.info = { - primary: prev.info, - merged: node.info - }; - list.remove(item); - } -}; - -module.exports = function rejoinAtrule(ast) { - walkRulesRight(ast, function(node, item, list) { - if (node.type === 'Atrule') { - processAtrule(node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/3-disjoinRuleset.js b/node_modules/csso/lib/compressor/restructure/3-disjoinRuleset.js deleted file mode 100644 index 6df4f80..0000000 --- a/node_modules/csso/lib/compressor/restructure/3-disjoinRuleset.js +++ /dev/null @@ -1,42 +0,0 @@ -var List = require('../../utils/list.js'); -var walkRulesRight = require('../../utils/walk.js').rulesRight; - -function processRuleset(node, item, list) { - var selectors = node.selector.selectors; - - // generate new rule sets: - // .a, .b { color: red; } - // -> - // .a { color: red; } - // .b { color: red; } - - // while there are more than 1 simple selector split for rulesets - while (selectors.head !== selectors.tail) { - var newSelectors = new List(); - newSelectors.insert(selectors.remove(selectors.head)); - - list.insert(list.createItem({ - type: 'Ruleset', - info: node.info, - pseudoSignature: node.pseudoSignature, - selector: { - type: 'Selector', - info: node.selector.info, - selectors: newSelectors - }, - block: { - type: 'Block', - info: node.block.info, - declarations: node.block.declarations.copy() - } - }), item); - } -}; - -module.exports = function disjoinRuleset(ast) { - walkRulesRight(ast, function(node, item, list) { - if (node.type === 'Ruleset') { - processRuleset(node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/4-restructShorthand.js b/node_modules/csso/lib/compressor/restructure/4-restructShorthand.js deleted file mode 100644 index 4edae28..0000000 --- a/node_modules/csso/lib/compressor/restructure/4-restructShorthand.js +++ /dev/null @@ -1,429 +0,0 @@ -var List = require('../../utils/list.js'); -var translate = require('../../utils/translate.js'); -var walkRulesRight = require('../../utils/walk.js').rulesRight; - -var REPLACE = 1; -var REMOVE = 2; -var TOP = 0; -var RIGHT = 1; -var BOTTOM = 2; -var LEFT = 3; -var SIDES = ['top', 'right', 'bottom', 'left']; -var SIDE = { - 'margin-top': 'top', - 'margin-right': 'right', - 'margin-bottom': 'bottom', - 'margin-left': 'left', - - 'padding-top': 'top', - 'padding-right': 'right', - 'padding-bottom': 'bottom', - 'padding-left': 'left', - - 'border-top-color': 'top', - 'border-right-color': 'right', - 'border-bottom-color': 'bottom', - 'border-left-color': 'left', - 'border-top-width': 'top', - 'border-right-width': 'right', - 'border-bottom-width': 'bottom', - 'border-left-width': 'left', - 'border-top-style': 'top', - 'border-right-style': 'right', - 'border-bottom-style': 'bottom', - 'border-left-style': 'left' -}; -var MAIN_PROPERTY = { - 'margin': 'margin', - 'margin-top': 'margin', - 'margin-right': 'margin', - 'margin-bottom': 'margin', - 'margin-left': 'margin', - - 'padding': 'padding', - 'padding-top': 'padding', - 'padding-right': 'padding', - 'padding-bottom': 'padding', - 'padding-left': 'padding', - - 'border-color': 'border-color', - 'border-top-color': 'border-color', - 'border-right-color': 'border-color', - 'border-bottom-color': 'border-color', - 'border-left-color': 'border-color', - 'border-width': 'border-width', - 'border-top-width': 'border-width', - 'border-right-width': 'border-width', - 'border-bottom-width': 'border-width', - 'border-left-width': 'border-width', - 'border-style': 'border-style', - 'border-top-style': 'border-style', - 'border-right-style': 'border-style', - 'border-bottom-style': 'border-style', - 'border-left-style': 'border-style' -}; - -function TRBL(name) { - this.name = name; - this.info = null; - this.iehack = undefined; - this.sides = { - 'top': null, - 'right': null, - 'bottom': null, - 'left': null - }; -} - -TRBL.prototype.getValueSequence = function(value, count) { - var values = []; - var iehack = false; - var hasBadValues = value.sequence.some(function(child) { - var special = false; - - switch (child.type) { - case 'Identifier': - switch (child.name) { - case '\\9': - iehack = true; - return; - - case 'inherit': - case 'initial': - case 'unset': - case 'revert': - special = child.name; - break; - } - break; - - case 'Dimension': - switch (child.unit) { - // is not supported until IE11 - case 'rem': - - // v* units is too buggy across browsers and better - // don't merge values with those units - case 'vw': - case 'vh': - case 'vmin': - case 'vmax': - case 'vm': // IE9 supporting "vm" instead of "vmin". - special = child.unit; - break; - } - break; - - case 'Hash': // color - case 'Number': - case 'Percentage': - break; - - case 'Function': - special = child.name; - break; - - case 'Space': - return false; // ignore space - - default: - return true; // bad value - } - - values.push({ - node: child, - special: special, - important: value.important - }); - }); - - if (hasBadValues || values.length > count) { - return false; - } - - if (typeof this.iehack === 'boolean' && this.iehack !== iehack) { - return false; - } - - this.iehack = iehack; // move outside - - return values; -}; - -TRBL.prototype.canOverride = function(side, value) { - var currentValue = this.sides[side]; - - return !currentValue || (value.important && !currentValue.important); -}; - -TRBL.prototype.add = function(name, value, info) { - function attemptToAdd() { - var sides = this.sides; - var side = SIDE[name]; - - if (side) { - if (side in sides === false) { - return false; - } - - var values = this.getValueSequence(value, 1); - - if (!values || !values.length) { - return false; - } - - // can mix only if specials are equal - for (var key in sides) { - if (sides[key] !== null && sides[key].special !== values[0].special) { - return false; - } - } - - if (!this.canOverride(side, values[0])) { - return true; - } - - sides[side] = values[0]; - return true; - } else if (name === this.name) { - var values = this.getValueSequence(value, 4); - - if (!values || !values.length) { - return false; - } - - switch (values.length) { - case 1: - values[RIGHT] = values[TOP]; - values[BOTTOM] = values[TOP]; - values[LEFT] = values[TOP]; - break; - - case 2: - values[BOTTOM] = values[TOP]; - values[LEFT] = values[RIGHT]; - break; - - case 3: - values[LEFT] = values[RIGHT]; - break; - } - - // can mix only if specials are equal - for (var i = 0; i < 4; i++) { - for (var key in sides) { - if (sides[key] !== null && sides[key].special !== values[i].special) { - return false; - } - } - } - - for (var i = 0; i < 4; i++) { - if (this.canOverride(SIDES[i], values[i])) { - sides[SIDES[i]] = values[i]; - } - } - - return true; - } - } - - if (!attemptToAdd.call(this)) { - return false; - } - - if (this.info) { - this.info = { - primary: this.info, - merged: info - }; - } else { - this.info = info; - } - - return true; -}; - -TRBL.prototype.isOkToMinimize = function() { - var top = this.sides.top; - var right = this.sides.right; - var bottom = this.sides.bottom; - var left = this.sides.left; - - if (top && right && bottom && left) { - var important = - top.important + - right.important + - bottom.important + - left.important; - - return important === 0 || important === 4; - } - - return false; -}; - -TRBL.prototype.getValue = function() { - var result = []; - var sides = this.sides; - var values = [ - sides.top, - sides.right, - sides.bottom, - sides.left - ]; - var stringValues = [ - translate(sides.top.node), - translate(sides.right.node), - translate(sides.bottom.node), - translate(sides.left.node) - ]; - - if (stringValues[LEFT] === stringValues[RIGHT]) { - values.pop(); - if (stringValues[BOTTOM] === stringValues[TOP]) { - values.pop(); - if (stringValues[RIGHT] === stringValues[TOP]) { - values.pop(); - } - } - } - - for (var i = 0; i < values.length; i++) { - if (i) { - result.push({ type: 'Space' }); - } - - result.push(values[i].node); - } - - if (this.iehack) { - result.push({ type: 'Space' }, { - type: 'Identifier', - info: {}, - name: '\\9' - }); - } - - return { - type: 'Value', - info: {}, - important: sides.top.important, - sequence: new List(result) - }; -}; - -TRBL.prototype.getProperty = function() { - return { - type: 'Property', - info: {}, - name: this.name - }; -}; - -function processRuleset(ruleset, shorts, shortDeclarations, lastShortSelector) { - var declarations = ruleset.block.declarations; - var selector = ruleset.selector.selectors.first().id; - - ruleset.block.declarations.eachRight(function(declaration, item) { - var property = declaration.property.name; - - if (!MAIN_PROPERTY.hasOwnProperty(property)) { - return; - } - - var key = MAIN_PROPERTY[property]; - var shorthand; - var operation; - - if (!lastShortSelector || selector === lastShortSelector) { - if (key in shorts) { - operation = REMOVE; - shorthand = shorts[key]; - } - } - - if (!shorthand || !shorthand.add(property, declaration.value, declaration.info)) { - operation = REPLACE; - shorthand = new TRBL(key); - - // if can't parse value ignore it and break shorthand sequence - if (!shorthand.add(property, declaration.value, declaration.info)) { - lastShortSelector = null; - return; - } - } - - shorts[key] = shorthand; - shortDeclarations.push({ - operation: operation, - block: declarations, - item: item, - shorthand: shorthand - }); - - lastShortSelector = selector; - }); - - return lastShortSelector; -}; - -function processShorthands(shortDeclarations, markDeclaration) { - shortDeclarations.forEach(function(item) { - var shorthand = item.shorthand; - - if (!shorthand.isOkToMinimize()) { - return; - } - - if (item.operation === REPLACE) { - item.item.data = markDeclaration({ - type: 'Declaration', - info: shorthand.info, - property: shorthand.getProperty(), - value: shorthand.getValue(), - id: 0, - length: 0, - fingerprint: null - }); - } else { - item.block.remove(item.item); - } - }); -}; - -module.exports = function restructBlock(ast, indexer) { - var stylesheetMap = {}; - var shortDeclarations = []; - - walkRulesRight(ast, function(node) { - if (node.type !== 'Ruleset') { - return; - } - - var stylesheet = this.stylesheet; - var rulesetId = (node.pseudoSignature || '') + '|' + node.selector.selectors.first().id; - var rulesetMap; - var shorts; - - if (!stylesheetMap.hasOwnProperty(stylesheet.id)) { - rulesetMap = { - lastShortSelector: null - }; - stylesheetMap[stylesheet.id] = rulesetMap; - } else { - rulesetMap = stylesheetMap[stylesheet.id]; - } - - if (rulesetMap.hasOwnProperty(rulesetId)) { - shorts = rulesetMap[rulesetId]; - } else { - shorts = {}; - rulesetMap[rulesetId] = shorts; - } - - rulesetMap.lastShortSelector = processRuleset.call(this, node, shorts, shortDeclarations, rulesetMap.lastShortSelector); - }); - - processShorthands(shortDeclarations, indexer.declaration); -}; diff --git a/node_modules/csso/lib/compressor/restructure/6-restructBlock.js b/node_modules/csso/lib/compressor/restructure/6-restructBlock.js deleted file mode 100644 index 7b3fd83..0000000 --- a/node_modules/csso/lib/compressor/restructure/6-restructBlock.js +++ /dev/null @@ -1,261 +0,0 @@ -var resolveProperty = require('../../utils/names.js').property; -var resolveKeyword = require('../../utils/names.js').keyword; -var walkRulesRight = require('../../utils/walk.js').rulesRight; -var translate = require('../../utils/translate.js'); -var dontRestructure = { - 'src': 1 // https://github.com/afelix/csso/issues/50 -}; - -var DONT_MIX_VALUE = { - // https://developer.mozilla.org/en-US/docs/Web/CSS/display#Browser_compatibility - 'display': /table|ruby|flex|-(flex)?box$|grid|contents|run-in/i, - // https://developer.mozilla.org/en/docs/Web/CSS/text-align - 'text-align': /^(start|end|match-parent|justify-all)$/i -}; - -var CURSOR_SAFE_VALUE = [ - 'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help', - 'n-resize', 'e-resize', 's-resize', 'w-resize', - 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', - 'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll', - 'col-resize', 'row-resize' -]; - -var NEEDLESS_TABLE = { - 'border-width': ['border'], - 'border-style': ['border'], - 'border-color': ['border'], - 'border-top': ['border'], - 'border-right': ['border'], - 'border-bottom': ['border'], - 'border-left': ['border'], - 'border-top-width': ['border-top', 'border-width', 'border'], - 'border-right-width': ['border-right', 'border-width', 'border'], - 'border-bottom-width': ['border-bottom', 'border-width', 'border'], - 'border-left-width': ['border-left', 'border-width', 'border'], - 'border-top-style': ['border-top', 'border-style', 'border'], - 'border-right-style': ['border-right', 'border-style', 'border'], - 'border-bottom-style': ['border-bottom', 'border-style', 'border'], - 'border-left-style': ['border-left', 'border-style', 'border'], - 'border-top-color': ['border-top', 'border-color', 'border'], - 'border-right-color': ['border-right', 'border-color', 'border'], - 'border-bottom-color': ['border-bottom', 'border-color', 'border'], - 'border-left-color': ['border-left', 'border-color', 'border'], - 'margin-top': ['margin'], - 'margin-right': ['margin'], - 'margin-bottom': ['margin'], - 'margin-left': ['margin'], - 'padding-top': ['padding'], - 'padding-right': ['padding'], - 'padding-bottom': ['padding'], - 'padding-left': ['padding'], - 'font-style': ['font'], - 'font-variant': ['font'], - 'font-weight': ['font'], - 'font-size': ['font'], - 'font-family': ['font'], - 'list-style-type': ['list-style'], - 'list-style-position': ['list-style'], - 'list-style-image': ['list-style'] -}; - -function getPropertyFingerprint(propertyName, declaration, fingerprints) { - var realName = resolveProperty(propertyName).name; - - if (realName === 'background' || - (realName === 'filter' && declaration.value.sequence.first().type === 'Progid')) { - return propertyName + ':' + translate(declaration.value); - } - - var declarationId = declaration.id; - var fingerprint = fingerprints[declarationId]; - - if (!fingerprint) { - var vendorId = ''; - var hack9 = ''; - var special = {}; - - declaration.value.sequence.each(function walk(node) { - switch (node.type) { - case 'Argument': - case 'Value': - case 'Braces': - node.sequence.each(walk); - break; - - case 'Identifier': - var name = node.name; - - if (!vendorId) { - vendorId = resolveKeyword(name).vendor; - } - - if (/\\9/.test(name)) { - hack9 = name; - } - - if (realName === 'cursor') { - if (CURSOR_SAFE_VALUE.indexOf(name) === -1) { - special[name] = true; - } - } else if (DONT_MIX_VALUE.hasOwnProperty(realName)) { - if (DONT_MIX_VALUE[realName].test(name)) { - special[name] = true; - } - } - - break; - - case 'Function': - var name = node.name; - - if (!vendorId) { - vendorId = resolveKeyword(name).vendor; - } - - if (name === 'rect') { - // there are 2 forms of rect: - // rect(, , , ) - standart - // rect( ) – backwards compatible syntax - // only the same form values can be merged - if (node.arguments.size < 4) { - name = 'rect-backward'; - } - } - - special[name + '()'] = true; - - // check nested tokens too - node.arguments.each(walk); - - break; - - case 'Dimension': - var unit = node.unit; - - switch (unit) { - // is not supported until IE11 - case 'rem': - - // v* units is too buggy across browsers and better - // don't merge values with those units - case 'vw': - case 'vh': - case 'vmin': - case 'vmax': - case 'vm': // IE9 supporting "vm" instead of "vmin". - special[unit] = true; - break; - } - break; - } - }); - - fingerprint = '|' + Object.keys(special).sort() + '|' + hack9 + vendorId; - - fingerprints[declarationId] = fingerprint; - } - - return propertyName + fingerprint; -} - -function needless(props, declaration, fingerprints) { - var property = resolveProperty(declaration.property.name); - - if (NEEDLESS_TABLE.hasOwnProperty(property.name)) { - var table = NEEDLESS_TABLE[property.name]; - - for (var i = 0; i < table.length; i++) { - var ppre = getPropertyFingerprint(property.prefix + table[i], declaration, fingerprints); - var prev = props[ppre]; - - if (prev && (!declaration.value.important || prev.item.data.value.important)) { - return prev; - } - } - } -} - -function processRuleset(ruleset, item, list, props, fingerprints) { - var declarations = ruleset.block.declarations; - - declarations.eachRight(function(declaration, declarationItem) { - var property = declaration.property.name; - var fingerprint = getPropertyFingerprint(property, declaration, fingerprints); - var prev = props[fingerprint]; - - if (prev && !dontRestructure.hasOwnProperty(property)) { - if (declaration.value.important && !prev.item.data.value.important) { - props[fingerprint] = { - block: declarations, - item: declarationItem - }; - - prev.block.remove(prev.item); - declaration.info = { - primary: declaration.info, - merged: prev.item.data.info - }; - } else { - declarations.remove(declarationItem); - prev.item.data.info = { - primary: prev.item.data.info, - merged: declaration.info - }; - } - } else { - var prev = needless(props, declaration, fingerprints); - - if (prev) { - declarations.remove(declarationItem); - prev.item.data.info = { - primary: prev.item.data.info, - merged: declaration.info - }; - } else { - declaration.fingerprint = fingerprint; - - props[fingerprint] = { - block: declarations, - item: declarationItem - }; - } - } - }); - - if (declarations.isEmpty()) { - list.remove(item); - } -}; - -module.exports = function restructBlock(ast) { - var stylesheetMap = {}; - var fingerprints = Object.create(null); - - walkRulesRight(ast, function(node, item, list) { - if (node.type !== 'Ruleset') { - return; - } - - var stylesheet = this.stylesheet; - var rulesetId = (node.pseudoSignature || '') + '|' + node.selector.selectors.first().id; - var rulesetMap; - var props; - - if (!stylesheetMap.hasOwnProperty(stylesheet.id)) { - rulesetMap = {}; - stylesheetMap[stylesheet.id] = rulesetMap; - } else { - rulesetMap = stylesheetMap[stylesheet.id]; - } - - if (rulesetMap.hasOwnProperty(rulesetId)) { - props = rulesetMap[rulesetId]; - } else { - props = {}; - rulesetMap[rulesetId] = props; - } - - processRuleset.call(this, node, item, list, props, fingerprints); - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/7-mergeRuleset.js b/node_modules/csso/lib/compressor/restructure/7-mergeRuleset.js deleted file mode 100644 index 0ae7edb..0000000 --- a/node_modules/csso/lib/compressor/restructure/7-mergeRuleset.js +++ /dev/null @@ -1,87 +0,0 @@ -var utils = require('./utils.js'); -var walkRules = require('../../utils/walk.js').rules; - -/* - At this step all rules has single simple selector. We try to join by equal - declaration blocks to first rule, e.g. - - .a { color: red } - b { ... } - .b { color: red } - -> - .a, .b { color: red } - b { ... } -*/ - -function processRuleset(node, item, list) { - var selectors = node.selector.selectors; - var declarations = node.block.declarations; - var nodeCompareMarker = selectors.first().compareMarker; - var skippedCompareMarkers = {}; - - list.nextUntil(item.next, function(next, nextItem) { - // skip non-ruleset node if safe - if (next.type !== 'Ruleset') { - return utils.unsafeToSkipNode.call(selectors, next); - } - - if (node.pseudoSignature !== next.pseudoSignature) { - return true; - } - - var nextFirstSelector = next.selector.selectors.head; - var nextDeclarations = next.block.declarations; - var nextCompareMarker = nextFirstSelector.data.compareMarker; - - // if next ruleset has same marked as one of skipped then stop joining - if (nextCompareMarker in skippedCompareMarkers) { - return true; - } - - // try to join by selectors - if (selectors.head === selectors.tail) { - if (selectors.first().id === nextFirstSelector.data.id) { - declarations.appendList(nextDeclarations); - list.remove(nextItem); - return; - } - } - - // try to join by properties - if (utils.isEqualDeclarations(declarations, nextDeclarations)) { - var nextStr = nextFirstSelector.data.id; - - selectors.some(function(data, item) { - var curStr = data.id; - - if (nextStr < curStr) { - selectors.insert(nextFirstSelector, item); - return true; - } - - if (!item.next) { - selectors.insert(nextFirstSelector); - return true; - } - }); - - list.remove(nextItem); - return; - } - - // go to next ruleset if current one can be skipped (has no equal specificity nor element selector) - if (nextCompareMarker === nodeCompareMarker) { - return true; - } - - skippedCompareMarkers[nextCompareMarker] = true; - }); -}; - -module.exports = function mergeRuleset(ast) { - walkRules(ast, function(node, item, list) { - if (node.type === 'Ruleset') { - processRuleset(node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/8-restructRuleset.js b/node_modules/csso/lib/compressor/restructure/8-restructRuleset.js deleted file mode 100644 index 9a9e545..0000000 --- a/node_modules/csso/lib/compressor/restructure/8-restructRuleset.js +++ /dev/null @@ -1,157 +0,0 @@ -var List = require('../../utils/list.js'); -var utils = require('./utils.js'); -var walkRulesRight = require('../../utils/walk.js').rulesRight; - -function calcSelectorLength(list) { - var length = 0; - - list.each(function(data) { - length += data.id.length + 1; - }); - - return length - 1; -} - -function calcDeclarationsLength(tokens) { - var length = 0; - - for (var i = 0; i < tokens.length; i++) { - length += tokens[i].length; - } - - return ( - length + // declarations - tokens.length - 1 // delimeters - ); -} - -function processRuleset(node, item, list) { - var avoidRulesMerge = this.stylesheet.avoidRulesMerge; - var selectors = node.selector.selectors; - var block = node.block; - var disallowDownMarkers = Object.create(null); - var allowMergeUp = true; - var allowMergeDown = true; - - list.prevUntil(item.prev, function(prev, prevItem) { - // skip non-ruleset node if safe - if (prev.type !== 'Ruleset') { - return utils.unsafeToSkipNode.call(selectors, prev); - } - - var prevSelectors = prev.selector.selectors; - var prevBlock = prev.block; - - if (node.pseudoSignature !== prev.pseudoSignature) { - return true; - } - - allowMergeDown = !prevSelectors.some(function(selector) { - return selector.compareMarker in disallowDownMarkers; - }); - - // try prev ruleset if simpleselectors has no equal specifity and element selector - if (!allowMergeDown && !allowMergeUp) { - return true; - } - - // try to join by selectors - if (allowMergeUp && utils.isEqualLists(prevSelectors, selectors)) { - prevBlock.declarations.appendList(block.declarations); - list.remove(item); - return true; - } - - // try to join by properties - var diff = utils.compareDeclarations(block.declarations, prevBlock.declarations); - - // console.log(diff.eq, diff.ne1, diff.ne2); - - if (diff.eq.length) { - if (!diff.ne1.length && !diff.ne2.length) { - // equal blocks - if (allowMergeDown) { - utils.addSelectors(selectors, prevSelectors); - list.remove(prevItem); - } - - return true; - } else if (!avoidRulesMerge) { /* probably we don't need to prevent those merges for @keyframes - TODO: need to be checked */ - - if (diff.ne1.length && !diff.ne2.length) { - // prevBlock is subset block - var selectorLength = calcSelectorLength(selectors); - var blockLength = calcDeclarationsLength(diff.eq); // declarations length - - if (allowMergeUp && selectorLength < blockLength) { - utils.addSelectors(prevSelectors, selectors); - block.declarations = new List(diff.ne1); - } - } else if (!diff.ne1.length && diff.ne2.length) { - // node is subset of prevBlock - var selectorLength = calcSelectorLength(prevSelectors); - var blockLength = calcDeclarationsLength(diff.eq); // declarations length - - if (allowMergeDown && selectorLength < blockLength) { - utils.addSelectors(selectors, prevSelectors); - prevBlock.declarations = new List(diff.ne2); - } - } else { - // diff.ne1.length && diff.ne2.length - // extract equal block - var newSelector = { - type: 'Selector', - info: {}, - selectors: utils.addSelectors(prevSelectors.copy(), selectors) - }; - var newBlockLength = calcSelectorLength(newSelector.selectors) + 2; // selectors length + curly braces length - var blockLength = calcDeclarationsLength(diff.eq); // declarations length - - // create new ruleset if declarations length greater than - // ruleset description overhead - if (allowMergeDown && blockLength >= newBlockLength) { - var newRuleset = { - type: 'Ruleset', - info: {}, - pseudoSignature: node.pseudoSignature, - selector: newSelector, - block: { - type: 'Block', - info: {}, - declarations: new List(diff.eq) - } - }; - - block.declarations = new List(diff.ne1); - prevBlock.declarations = new List(diff.ne2.concat(diff.ne2overrided)); - list.insert(list.createItem(newRuleset), prevItem); - return true; - } - } - } - } - - if (allowMergeUp) { - // TODO: disallow up merge only if any property interception only (i.e. diff.ne2overrided.length > 0); - // await property families to find property interception correctly - allowMergeUp = !prevSelectors.some(function(prevSelector) { - return selectors.some(function(selector) { - return selector.compareMarker === prevSelector.compareMarker; - }); - }); - } - - prevSelectors.each(function(data) { - disallowDownMarkers[data.compareMarker] = true; - }); - }); -}; - -module.exports = function restructRuleset(ast) { - walkRulesRight(ast, function(node, item, list) { - if (node.type === 'Ruleset') { - processRuleset.call(this, node, item, list); - } - }); -}; diff --git a/node_modules/csso/lib/compressor/restructure/index.js b/node_modules/csso/lib/compressor/restructure/index.js deleted file mode 100644 index 6a05974..0000000 --- a/node_modules/csso/lib/compressor/restructure/index.js +++ /dev/null @@ -1,35 +0,0 @@ -var prepare = require('./prepare/index.js'); -var initialMergeRuleset = require('./1-initialMergeRuleset.js'); -var mergeAtrule = require('./2-mergeAtrule.js'); -var disjoinRuleset = require('./3-disjoinRuleset.js'); -var restructShorthand = require('./4-restructShorthand.js'); -var restructBlock = require('./6-restructBlock.js'); -var mergeRuleset = require('./7-mergeRuleset.js'); -var restructRuleset = require('./8-restructRuleset.js'); - -module.exports = function(ast, usageData, debug) { - // prepare ast for restructing - var indexer = prepare(ast, usageData); - debug('prepare', ast); - - initialMergeRuleset(ast); - debug('initialMergeRuleset', ast); - - mergeAtrule(ast); - debug('mergeAtrule', ast); - - disjoinRuleset(ast); - debug('disjoinRuleset', ast); - - restructShorthand(ast, indexer); - debug('restructShorthand', ast); - - restructBlock(ast); - debug('restructBlock', ast); - - mergeRuleset(ast); - debug('mergeRuleset', ast); - - restructRuleset(ast); - debug('restructRuleset', ast); -}; diff --git a/node_modules/csso/lib/compressor/restructure/prepare/createDeclarationIndexer.js b/node_modules/csso/lib/compressor/restructure/prepare/createDeclarationIndexer.js deleted file mode 100644 index c523530..0000000 --- a/node_modules/csso/lib/compressor/restructure/prepare/createDeclarationIndexer.js +++ /dev/null @@ -1,32 +0,0 @@ -var translate = require('../../../utils/translate.js'); - -function Index() { - this.seed = 0; - this.map = Object.create(null); -} - -Index.prototype.resolve = function(str) { - var index = this.map[str]; - - if (!index) { - index = ++this.seed; - this.map[str] = index; - } - - return index; -}; - -module.exports = function createDeclarationIndexer() { - var names = new Index(); - var values = new Index(); - - return function markDeclaration(node) { - var property = node.property.name; - var value = translate(node.value); - - node.id = names.resolve(property) + (values.resolve(value) << 12); - node.length = property.length + 1 + value.length; - - return node; - }; -}; diff --git a/node_modules/csso/lib/compressor/restructure/prepare/index.js b/node_modules/csso/lib/compressor/restructure/prepare/index.js deleted file mode 100644 index 075dc5f..0000000 --- a/node_modules/csso/lib/compressor/restructure/prepare/index.js +++ /dev/null @@ -1,44 +0,0 @@ -var resolveKeyword = require('../../../utils/names.js').keyword; -var walkRules = require('../../../utils/walk.js').rules; -var translate = require('../../../utils/translate.js'); -var createDeclarationIndexer = require('./createDeclarationIndexer.js'); -var processSelector = require('./processSelector.js'); - -function walk(node, markDeclaration, usageData) { - switch (node.type) { - case 'Ruleset': - node.block.declarations.each(markDeclaration); - processSelector(node, usageData); - break; - - case 'Atrule': - if (node.expression) { - node.expression.id = translate(node.expression); - } - - // compare keyframe selectors by its values - // NOTE: still no clarification about problems with keyframes selector grouping (issue #197) - if (resolveKeyword(node.name).name === 'keyframes') { - node.block.avoidRulesMerge = true; /* probably we don't need to prevent those merges for @keyframes - TODO: need to be checked */ - node.block.rules.each(function(ruleset) { - ruleset.selector.selectors.each(function(simpleselector) { - simpleselector.compareMarker = simpleselector.id; - }); - }); - } - break; - } -}; - -module.exports = function prepare(ast, usageData) { - var markDeclaration = createDeclarationIndexer(); - - walkRules(ast, function(node) { - walk(node, markDeclaration, usageData); - }); - - return { - declaration: markDeclaration - }; -}; diff --git a/node_modules/csso/lib/compressor/restructure/prepare/processSelector.js b/node_modules/csso/lib/compressor/restructure/prepare/processSelector.js deleted file mode 100644 index 56c46b5..0000000 --- a/node_modules/csso/lib/compressor/restructure/prepare/processSelector.js +++ /dev/null @@ -1,99 +0,0 @@ -var translate = require('../../../utils/translate.js'); -var specificity = require('./specificity.js'); - -var nonFreezePseudoElements = { - 'first-letter': true, - 'first-line': true, - 'after': true, - 'before': true -}; -var nonFreezePseudoClasses = { - 'link': true, - 'visited': true, - 'hover': true, - 'active': true, - 'first-letter': true, - 'first-line': true, - 'after': true, - 'before': true -}; - -module.exports = function freeze(node, usageData) { - var pseudos = Object.create(null); - var hasPseudo = false; - - node.selector.selectors.each(function(simpleSelector) { - var tagName = '*'; - var scope = 0; - - simpleSelector.sequence.some(function(node) { - switch (node.type) { - case 'Class': - if (usageData && usageData.scopes) { - var classScope = usageData.scopes[node.name] || 0; - - if (scope !== 0 && classScope !== scope) { - throw new Error('Selector can\'t has classes from different scopes: ' + translate(simpleSelector)); - } - - scope = classScope; - } - break; - - case 'PseudoClass': - if (!nonFreezePseudoClasses.hasOwnProperty(node.name)) { - pseudos[node.name] = true; - hasPseudo = true; - } - break; - - case 'PseudoElement': - if (!nonFreezePseudoElements.hasOwnProperty(node.name)) { - pseudos[node.name] = true; - hasPseudo = true; - } - break; - - case 'FunctionalPseudo': - pseudos[node.name] = true; - hasPseudo = true; - break; - - case 'Negation': - pseudos.not = true; - hasPseudo = true; - break; - - case 'Identifier': - tagName = node.name; - break; - - case 'Attribute': - if (node.flags) { - pseudos['[' + node.flags + ']'] = true; - hasPseudo = true; - } - break; - - case 'Combinator': - tagName = '*'; - break; - } - }); - - simpleSelector.id = translate(simpleSelector); - simpleSelector.compareMarker = specificity(simpleSelector).toString(); - - if (scope) { - simpleSelector.compareMarker += ':' + scope; - } - - if (tagName !== '*') { - simpleSelector.compareMarker += ',' + tagName; - } - }); - - if (hasPseudo) { - node.pseudoSignature = Object.keys(pseudos).sort().join(','); - } -}; diff --git a/node_modules/csso/lib/compressor/restructure/prepare/specificity.js b/node_modules/csso/lib/compressor/restructure/prepare/specificity.js deleted file mode 100644 index 506c337..0000000 --- a/node_modules/csso/lib/compressor/restructure/prepare/specificity.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = function specificity(simpleSelector) { - var A = 0; - var B = 0; - var C = 0; - - simpleSelector.sequence.each(function walk(data) { - switch (data.type) { - case 'SimpleSelector': - case 'Negation': - data.sequence.each(walk); - break; - - case 'Id': - A++; - break; - - case 'Class': - case 'Attribute': - case 'FunctionalPseudo': - B++; - break; - - case 'Identifier': - if (data.name !== '*') { - C++; - } - break; - - case 'PseudoElement': - C++; - break; - - case 'PseudoClass': - var name = data.name.toLowerCase(); - if (name === 'before' || - name === 'after' || - name === 'first-line' || - name === 'first-letter') { - C++; - } else { - B++; - } - break; - } - }); - - return [A, B, C]; -}; diff --git a/node_modules/csso/lib/compressor/restructure/utils.js b/node_modules/csso/lib/compressor/restructure/utils.js deleted file mode 100644 index 70c92c5..0000000 --- a/node_modules/csso/lib/compressor/restructure/utils.js +++ /dev/null @@ -1,141 +0,0 @@ -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function isEqualLists(a, b) { - var cursor1 = a.head; - var cursor2 = b.head; - - while (cursor1 !== null && cursor2 !== null && cursor1.data.id === cursor2.data.id) { - cursor1 = cursor1.next; - cursor2 = cursor2.next; - } - - return cursor1 === null && cursor2 === null; -} - -function isEqualDeclarations(a, b) { - var cursor1 = a.head; - var cursor2 = b.head; - - while (cursor1 !== null && cursor2 !== null && cursor1.data.id === cursor2.data.id) { - cursor1 = cursor1.next; - cursor2 = cursor2.next; - } - - return cursor1 === null && cursor2 === null; -} - -function compareDeclarations(declarations1, declarations2) { - var result = { - eq: [], - ne1: [], - ne2: [], - ne2overrided: [] - }; - - var fingerprints = Object.create(null); - var declarations2hash = Object.create(null); - - for (var cursor = declarations2.head; cursor; cursor = cursor.next) { - declarations2hash[cursor.data.id] = true; - } - - for (var cursor = declarations1.head; cursor; cursor = cursor.next) { - var data = cursor.data; - - if (data.fingerprint) { - fingerprints[data.fingerprint] = data.value.important; - } - - if (declarations2hash[data.id]) { - declarations2hash[data.id] = false; - result.eq.push(data); - } else { - result.ne1.push(data); - } - } - - for (var cursor = declarations2.head; cursor; cursor = cursor.next) { - var data = cursor.data; - - if (declarations2hash[data.id]) { - // if declarations1 has overriding declaration, this is not a difference - // but take in account !important - prev should be equal or greater than follow - if (hasOwnProperty.call(fingerprints, data.fingerprint) && - Number(fingerprints[data.fingerprint]) >= Number(data.value.important)) { - result.ne2overrided.push(data); - } else { - result.ne2.push(data); - } - } - } - - return result; -} - -function addSelectors(dest, source) { - source.each(function(sourceData) { - var newStr = sourceData.id; - var cursor = dest.head; - - while (cursor) { - var nextStr = cursor.data.id; - - if (nextStr === newStr) { - return; - } - - if (nextStr > newStr) { - break; - } - - cursor = cursor.next; - } - - dest.insert(dest.createItem(sourceData), cursor); - }); - - return dest; -} - -// check if simpleselectors has no equal specificity and element selector -function hasSimilarSelectors(selectors1, selectors2) { - return selectors1.some(function(a) { - return selectors2.some(function(b) { - return a.compareMarker === b.compareMarker; - }); - }); -} - -// test node can't to be skipped -function unsafeToSkipNode(node) { - switch (node.type) { - case 'Ruleset': - // unsafe skip ruleset with selector similarities - return hasSimilarSelectors(node.selector.selectors, this); - - case 'Atrule': - // can skip at-rules with blocks - if (node.block) { - // non-stylesheet blocks are safe to skip since have no selectors - if (node.block.type !== 'StyleSheet') { - return false; - } - - // unsafe skip at-rule if block contains something unsafe to skip - return node.block.rules.some(unsafeToSkipNode, this); - } - break; - } - - // unsafe by default - return true; -} - -module.exports = { - isEqualLists: isEqualLists, - isEqualDeclarations: isEqualDeclarations, - compareDeclarations: compareDeclarations, - addSelectors: addSelectors, - hasSimilarSelectors: hasSimilarSelectors, - unsafeToSkipNode: unsafeToSkipNode -}; diff --git a/node_modules/csso/lib/compressor/usage.js b/node_modules/csso/lib/compressor/usage.js deleted file mode 100644 index 72d8b15..0000000 --- a/node_modules/csso/lib/compressor/usage.js +++ /dev/null @@ -1,58 +0,0 @@ -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function buildMap(list, caseInsensitive) { - var map = Object.create(null); - - if (!Array.isArray(list)) { - return false; - } - - for (var i = 0; i < list.length; i++) { - var name = list[i]; - - if (caseInsensitive) { - name = name.toLowerCase(); - } - - map[name] = true; - } - - return map; -} - -function buildIndex(data) { - var scopes = false; - - if (data.scopes && Array.isArray(data.scopes)) { - scopes = Object.create(null); - - for (var i = 0; i < data.scopes.length; i++) { - var list = data.scopes[i]; - - if (!list || !Array.isArray(list)) { - throw new Error('Wrong usage format'); - } - - for (var j = 0; j < list.length; j++) { - var name = list[j]; - - if (hasOwnProperty.call(scopes, name)) { - throw new Error('Class can\'t be used for several scopes: ' + name); - } - - scopes[name] = i + 1; - } - } - } - - return { - tags: buildMap(data.tags, true), - ids: buildMap(data.ids), - classes: buildMap(data.classes), - scopes: scopes - }; -} - -module.exports = { - buildIndex: buildIndex -}; diff --git a/node_modules/csso/lib/index.js b/node_modules/csso/lib/index.js deleted file mode 100644 index f8a4ce8..0000000 --- a/node_modules/csso/lib/index.js +++ /dev/null @@ -1,132 +0,0 @@ -var parse = require('./parser'); -var compress = require('./compressor'); -var translate = require('./utils/translate'); -var translateWithSourceMap = require('./utils/translateWithSourceMap'); -var walkers = require('./utils/walk'); -var clone = require('./utils/clone'); -var List = require('./utils/list'); - -function debugOutput(name, options, startTime, data) { - if (options.debug) { - console.error('## ' + name + ' done in %d ms\n', Date.now() - startTime); - } - - return data; -} - -function createDefaultLogger(level) { - var lastDebug; - - return function logger(title, ast) { - var line = title; - - if (ast) { - line = '[' + ((Date.now() - lastDebug) / 1000).toFixed(3) + 's] ' + line; - } - - if (level > 1 && ast) { - var css = translate(ast, true); - - // when level 2, limit css to 256 symbols - if (level === 2 && css.length > 256) { - css = css.substr(0, 256) + '...'; - } - - line += '\n ' + css + '\n'; - } - - console.error(line); - lastDebug = Date.now(); - }; -} - -function copy(obj) { - var result = {}; - - for (var key in obj) { - result[key] = obj[key]; - } - - return result; -} - -function buildCompressOptions(options) { - options = copy(options); - - if (typeof options.logger !== 'function' && options.debug) { - options.logger = createDefaultLogger(options.debug); - } - - return options; -} - -function minify(context, source, options) { - options = options || {}; - - var filename = options.filename || ''; - var result; - - // parse - var ast = debugOutput('parsing', options, Date.now(), - parse(source, { - context: context, - filename: filename, - positions: Boolean(options.sourceMap) - }) - ); - - // compress - var compressResult = debugOutput('compress', options, Date.now(), - compress(ast, buildCompressOptions(options)) - ); - - // translate - if (options.sourceMap) { - result = debugOutput('translateWithSourceMap', options, Date.now(), (function() { - var tmp = translateWithSourceMap(compressResult.ast); - tmp.map._file = filename; // since other tools can relay on file in source map transform chain - tmp.map.setSourceContent(filename, source); - return tmp; - })()); - } else { - result = debugOutput('translate', options, Date.now(), { - css: translate(compressResult.ast), - map: null - }); - } - - return result; -} - -function minifyStylesheet(source, options) { - return minify('stylesheet', source, options); -}; - -function minifyBlock(source, options) { - return minify('block', source, options); -} - -module.exports = { - version: require('../package.json').version, - - // classes - List: List, - - // main methods - minify: minifyStylesheet, - minifyBlock: minifyBlock, - - // step by step - parse: parse, - compress: compress, - translate: translate, - translateWithSourceMap: translateWithSourceMap, - - // walkers - walk: walkers.all, - walkRules: walkers.rules, - walkRulesRight: walkers.rulesRight, - - // utils - clone: clone -}; diff --git a/node_modules/csso/lib/parser/const.js b/node_modules/csso/lib/parser/const.js deleted file mode 100644 index 4c2d400..0000000 --- a/node_modules/csso/lib/parser/const.js +++ /dev/null @@ -1,46 +0,0 @@ -exports.TokenType = { - String: 'String', - Comment: 'Comment', - Unknown: 'Unknown', - Newline: 'Newline', - Space: 'Space', - Tab: 'Tab', - ExclamationMark: 'ExclamationMark', // ! - QuotationMark: 'QuotationMark', // " - NumberSign: 'NumberSign', // # - DollarSign: 'DollarSign', // $ - PercentSign: 'PercentSign', // % - Ampersand: 'Ampersand', // & - Apostrophe: 'Apostrophe', // ' - LeftParenthesis: 'LeftParenthesis', // ( - RightParenthesis: 'RightParenthesis', // ) - Asterisk: 'Asterisk', // * - PlusSign: 'PlusSign', // + - Comma: 'Comma', // , - HyphenMinus: 'HyphenMinus', // - - FullStop: 'FullStop', // . - Solidus: 'Solidus', // / - Colon: 'Colon', // : - Semicolon: 'Semicolon', // ; - LessThanSign: 'LessThanSign', // < - EqualsSign: 'EqualsSign', // = - GreaterThanSign: 'GreaterThanSign', // > - QuestionMark: 'QuestionMark', // ? - CommercialAt: 'CommercialAt', // @ - LeftSquareBracket: 'LeftSquareBracket', // [ - ReverseSolidus: 'ReverseSolidus', // \ - RightSquareBracket: 'RightSquareBracket', // ] - CircumflexAccent: 'CircumflexAccent', // ^ - LowLine: 'LowLine', // _ - LeftCurlyBracket: 'LeftCurlyBracket', // { - VerticalLine: 'VerticalLine', // | - RightCurlyBracket: 'RightCurlyBracket', // } - Tilde: 'Tilde', // ~ - Identifier: 'Identifier', - DecimalNumber: 'DecimalNumber' -}; - -// var i = 1; -// for (var key in exports.TokenType) { -// exports.TokenType[key] = i++; -// } diff --git a/node_modules/csso/lib/parser/index.js b/node_modules/csso/lib/parser/index.js deleted file mode 100644 index 5f86b8b..0000000 --- a/node_modules/csso/lib/parser/index.js +++ /dev/null @@ -1,1863 +0,0 @@ -'use strict'; - -var TokenType = require('./const').TokenType; -var Scanner = require('./scanner'); -var List = require('../utils/list'); -var needPositions; -var filename; -var scanner; - -var SCOPE_ATRULE_EXPRESSION = 1; -var SCOPE_SELECTOR = 2; -var SCOPE_VALUE = 3; - -var specialFunctions = {}; -specialFunctions[SCOPE_ATRULE_EXPRESSION] = { - url: getUri -}; -specialFunctions[SCOPE_SELECTOR] = { - url: getUri, - not: getNotFunction -}; -specialFunctions[SCOPE_VALUE] = { - url: getUri, - expression: getOldIEExpression, - var: getVarFunction -}; - -var initialContext = { - stylesheet: getStylesheet, - atrule: getAtrule, - atruleExpression: getAtruleExpression, - ruleset: getRuleset, - selector: getSelector, - simpleSelector: getSimpleSelector, - block: getBlock, - declaration: getDeclaration, - value: getValue -}; - -var blockMode = { - 'declaration': true, - 'property': true -}; - -function parseError(message) { - var error = new Error(message); - var offset = 0; - var line = 1; - var column = 1; - var lines; - - if (scanner.token !== null) { - offset = scanner.token.offset; - line = scanner.token.line; - column = scanner.token.column; - } else if (scanner.prevToken !== null) { - lines = scanner.prevToken.value.trimRight(); - offset = scanner.prevToken.offset + lines.length; - lines = lines.split(/\n|\r\n?|\f/); - line = scanner.prevToken.line + lines.length - 1; - column = lines.length > 1 - ? lines[lines.length - 1].length + 1 - : scanner.prevToken.column + lines[lines.length - 1].length; - } - - error.name = 'CssSyntaxError'; - error.parseError = { - offset: offset, - line: line, - column: column - }; - - throw error; -} - -function eat(tokenType) { - if (scanner.token !== null && scanner.token.type === tokenType) { - scanner.next(); - return true; - } - - parseError(tokenType + ' is expected'); -} - -function expectIdentifier(name, eat) { - if (scanner.token !== null) { - if (scanner.token.type === TokenType.Identifier && - scanner.token.value.toLowerCase() === name) { - if (eat) { - scanner.next(); - } - - return true; - } - } - - parseError('Identifier `' + name + '` is expected'); -} - -function expectAny(what) { - if (scanner.token !== null) { - for (var i = 1, type = scanner.token.type; i < arguments.length; i++) { - if (type === arguments[i]) { - return true; - } - } - } - - parseError(what + ' is expected'); -} - -function getInfo() { - if (needPositions && scanner.token) { - return { - source: filename, - offset: scanner.token.offset, - line: scanner.token.line, - column: scanner.token.column - }; - } - - return null; - -} - -function removeTrailingSpaces(list) { - while (list.tail) { - if (list.tail.data.type === 'Space') { - list.remove(list.tail); - } else { - break; - } - } -} - -function getStylesheet(nested) { - var child = null; - var node = { - type: 'StyleSheet', - info: getInfo(), - rules: new List() - }; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.Space: - scanner.next(); - child = null; - break; - - case TokenType.Comment: - // ignore comments except exclamation comments on top level - if (nested || scanner.token.value.charAt(2) !== '!') { - scanner.next(); - child = null; - } else { - child = getComment(); - } - break; - - case TokenType.Unknown: - child = getUnknown(); - break; - - case TokenType.CommercialAt: - child = getAtrule(); - break; - - case TokenType.RightCurlyBracket: - if (!nested) { - parseError('Unexpected right curly brace'); - } - - break scan; - - default: - child = getRuleset(); - } - - if (child !== null) { - node.rules.insert(List.createItem(child)); - } - } - - return node; -} - -// '//' ... -// TODO: remove it as wrong thing -function getUnknown() { - var info = getInfo(); - var value = scanner.token.value; - - eat(TokenType.Unknown); - - return { - type: 'Unknown', - info: info, - value: value - }; -} - -function isBlockAtrule() { - for (var offset = 1, cursor; cursor = scanner.lookup(offset); offset++) { - var type = cursor.type; - - if (type === TokenType.RightCurlyBracket) { - return true; - } - - if (type === TokenType.LeftCurlyBracket || - type === TokenType.CommercialAt) { - return false; - } - } - - return true; -} - -function getAtruleExpression() { - var child = null; - var node = { - type: 'AtruleExpression', - info: getInfo(), - sequence: new List() - }; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.Semicolon: - break scan; - - case TokenType.LeftCurlyBracket: - break scan; - - case TokenType.Space: - if (node.sequence.isEmpty()) { - scanner.next(); // ignore spaces in beginning - child = null; - } else { - child = getS(); - } - break; - - case TokenType.Comment: // ignore comments - scanner.next(); - child = null; - break; - - case TokenType.Comma: - child = getOperator(); - break; - - case TokenType.Colon: - child = getPseudo(); - break; - - case TokenType.LeftParenthesis: - child = getBraces(SCOPE_ATRULE_EXPRESSION); - break; - - default: - child = getAny(SCOPE_ATRULE_EXPRESSION); - } - - if (child !== null) { - node.sequence.insert(List.createItem(child)); - } - } - - removeTrailingSpaces(node.sequence); - - return node; -} - -function getAtrule() { - eat(TokenType.CommercialAt); - - var node = { - type: 'Atrule', - info: getInfo(), - name: readIdent(false), - expression: getAtruleExpression(), - block: null - }; - - if (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.Semicolon: - scanner.next(); // { - break; - - case TokenType.LeftCurlyBracket: - scanner.next(); // { - - if (isBlockAtrule()) { - node.block = getBlock(); - } else { - node.block = getStylesheet(true); - } - - eat(TokenType.RightCurlyBracket); - break; - - default: - parseError('Unexpected input'); - } - } - - return node; -} - -function getRuleset() { - return { - type: 'Ruleset', - info: getInfo(), - selector: getSelector(), - block: getBlockWithBrackets() - }; -} - -function getSelector() { - var isBadSelector = false; - var lastComma = true; - var node = { - type: 'Selector', - info: getInfo(), - selectors: new List() - }; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.LeftCurlyBracket: - break scan; - - case TokenType.Comma: - if (lastComma) { - isBadSelector = true; - } - - lastComma = true; - scanner.next(); - break; - - default: - if (!lastComma) { - isBadSelector = true; - } - - lastComma = false; - node.selectors.insert(List.createItem(getSimpleSelector())); - - if (node.selectors.tail.data.sequence.isEmpty()) { - isBadSelector = true; - } - } - } - - if (lastComma) { - isBadSelector = true; - // parseError('Unexpected trailing comma'); - } - - if (isBadSelector) { - node.selectors = new List(); - } - - return node; -} - -function getSimpleSelector(nested) { - var child = null; - var combinator = null; - var node = { - type: 'SimpleSelector', - info: getInfo(), - sequence: new List() - }; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.Comma: - break scan; - - case TokenType.LeftCurlyBracket: - if (nested) { - parseError('Unexpected input'); - } - - break scan; - - case TokenType.RightParenthesis: - if (!nested) { - parseError('Unexpected input'); - } - - break scan; - - case TokenType.Comment: - scanner.next(); - child = null; - break; - - case TokenType.Space: - child = null; - if (!combinator && node.sequence.head) { - combinator = getCombinator(); - } else { - scanner.next(); - } - break; - - case TokenType.PlusSign: - case TokenType.GreaterThanSign: - case TokenType.Tilde: - case TokenType.Solidus: - if (combinator && combinator.name !== ' ') { - parseError('Unexpected combinator'); - } - - child = null; - combinator = getCombinator(); - break; - - case TokenType.FullStop: - child = getClass(); - break; - - case TokenType.LeftSquareBracket: - child = getAttribute(); - break; - - case TokenType.NumberSign: - child = getShash(); - break; - - case TokenType.Colon: - child = getPseudo(); - break; - - case TokenType.LowLine: - case TokenType.Identifier: - case TokenType.Asterisk: - child = getNamespacedIdentifier(false); - break; - - case TokenType.HyphenMinus: - case TokenType.DecimalNumber: - child = tryGetPercentage() || getNamespacedIdentifier(false); - break; - - default: - parseError('Unexpected input'); - } - - if (child !== null) { - if (combinator !== null) { - node.sequence.insert(List.createItem(combinator)); - combinator = null; - } - - node.sequence.insert(List.createItem(child)); - } - } - - if (combinator && combinator.name !== ' ') { - parseError('Unexpected combinator'); - } - - return node; -} - -function getDeclarations() { - var child = null; - var declarations = new List(); - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.RightCurlyBracket: - break scan; - - case TokenType.Space: - case TokenType.Comment: - scanner.next(); - child = null; - break; - - case TokenType.Semicolon: // ; - scanner.next(); - child = null; - break; - - default: - child = getDeclaration(); - } - - if (child !== null) { - declarations.insert(List.createItem(child)); - } - } - - return declarations; -} - -function getBlockWithBrackets() { - var info = getInfo(); - var node; - - eat(TokenType.LeftCurlyBracket); - node = { - type: 'Block', - info: info, - declarations: getDeclarations() - }; - eat(TokenType.RightCurlyBracket); - - return node; -} - -function getBlock() { - return { - type: 'Block', - info: getInfo(), - declarations: getDeclarations() - }; -} - -function getDeclaration(nested) { - var info = getInfo(); - var property = getProperty(); - var value; - - eat(TokenType.Colon); - - // check it's a filter - if (/filter$/.test(property.name.toLowerCase()) && checkProgid()) { - value = getFilterValue(); - } else { - value = getValue(nested); - } - - return { - type: 'Declaration', - info: info, - property: property, - value: value - }; -} - -function getProperty() { - var name = ''; - var node = { - type: 'Property', - info: getInfo(), - name: null - }; - - for (; scanner.token !== null; scanner.next()) { - var type = scanner.token.type; - - if (type !== TokenType.Solidus && - type !== TokenType.Asterisk && - type !== TokenType.DollarSign) { - break; - } - - name += scanner.token.value; - } - - node.name = name + readIdent(true); - - readSC(); - - return node; -} - -function getValue(nested) { - var child = null; - var node = { - type: 'Value', - info: getInfo(), - important: false, - sequence: new List() - }; - - readSC(); - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.RightCurlyBracket: - case TokenType.Semicolon: - break scan; - - case TokenType.RightParenthesis: - if (!nested) { - parseError('Unexpected input'); - } - break scan; - - case TokenType.Space: - child = getS(); - break; - - case TokenType.Comment: // ignore comments - scanner.next(); - child = null; - break; - - case TokenType.NumberSign: - child = getVhash(); - break; - - case TokenType.Solidus: - case TokenType.Comma: - child = getOperator(); - break; - - case TokenType.LeftParenthesis: - case TokenType.LeftSquareBracket: - child = getBraces(SCOPE_VALUE); - break; - - case TokenType.ExclamationMark: - node.important = getImportant(); - child = null; - break; - - default: - // check for unicode range: U+0F00, U+0F00-0FFF, u+0F00?? - if (scanner.token.type === TokenType.Identifier) { - var prefix = scanner.token.value; - if (prefix === 'U' || prefix === 'u') { - if (scanner.lookupType(1, TokenType.PlusSign)) { - scanner.next(); // U or u - scanner.next(); // + - - child = { - type: 'Identifier', - info: getInfo(), // FIXME: wrong position - name: prefix + '+' + readUnicodeRange(true) - }; - } - break; - } - } - - child = getAny(SCOPE_VALUE); - } - - if (child !== null) { - node.sequence.insert(List.createItem(child)); - } - } - - removeTrailingSpaces(node.sequence); - - return node; -} - -// any = string | percentage | dimension | number | uri | functionExpression | funktion | unary | operator | ident -function getAny(scope) { - switch (scanner.token.type) { - case TokenType.String: - return getString(); - - case TokenType.LowLine: - case TokenType.Identifier: - break; - - case TokenType.FullStop: - case TokenType.DecimalNumber: - case TokenType.HyphenMinus: - case TokenType.PlusSign: - var number = tryGetNumber(); - - if (number !== null) { - if (scanner.token !== null) { - if (scanner.token.type === TokenType.PercentSign) { - return getPercentage(number); - } else if (scanner.token.type === TokenType.Identifier) { - return getDimension(number.value); - } - } - - return number; - } - - if (scanner.token.type === TokenType.HyphenMinus) { - var next = scanner.lookup(1); - if (next && (next.type === TokenType.Identifier || next.type === TokenType.HyphenMinus)) { - break; - } - } - - if (scanner.token.type === TokenType.HyphenMinus || - scanner.token.type === TokenType.PlusSign) { - return getOperator(); - } - - parseError('Unexpected input'); - - default: - parseError('Unexpected input'); - } - - var ident = getIdentifier(false); - - if (scanner.token !== null && scanner.token.type === TokenType.LeftParenthesis) { - return getFunction(scope, ident); - } - - return ident; -} - -function readAttrselector() { - expectAny('Attribute selector (=, ~=, ^=, $=, *=, |=)', - TokenType.EqualsSign, // = - TokenType.Tilde, // ~= - TokenType.CircumflexAccent, // ^= - TokenType.DollarSign, // $= - TokenType.Asterisk, // *= - TokenType.VerticalLine // |= - ); - - var name; - - if (scanner.token.type === TokenType.EqualsSign) { - name = '='; - scanner.next(); - } else { - name = scanner.token.value + '='; - scanner.next(); - eat(TokenType.EqualsSign); - } - - return name; -} - -// '[' S* attrib_name ']' -// '[' S* attrib_name S* attrib_match S* [ IDENT | STRING ] S* attrib_flags? S* ']' -function getAttribute() { - var node = { - type: 'Attribute', - info: getInfo(), - name: null, - operator: null, - value: null, - flags: null - }; - - eat(TokenType.LeftSquareBracket); - - readSC(); - - node.name = getNamespacedIdentifier(true); - - readSC(); - - if (scanner.token !== null && scanner.token.type !== TokenType.RightSquareBracket) { - // avoid case `[name i]` - if (scanner.token.type !== TokenType.Identifier) { - node.operator = readAttrselector(); - - readSC(); - - if (scanner.token !== null && scanner.token.type === TokenType.String) { - node.value = getString(); - } else { - node.value = getIdentifier(false); - } - - readSC(); - } - - // attribute flags - if (scanner.token !== null && scanner.token.type === TokenType.Identifier) { - node.flags = scanner.token.value; - - scanner.next(); - readSC(); - } - } - - eat(TokenType.RightSquareBracket); - - return node; -} - -function getBraces(scope) { - var close; - var child = null; - var node = { - type: 'Braces', - info: getInfo(), - open: scanner.token.value, - close: null, - sequence: new List() - }; - - if (scanner.token.type === TokenType.LeftParenthesis) { - close = TokenType.RightParenthesis; - } else { - close = TokenType.RightSquareBracket; - } - - // left brace - scanner.next(); - - readSC(); - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case close: - node.close = scanner.token.value; - break scan; - - case TokenType.Space: - child = getS(); - break; - - case TokenType.Comment: - scanner.next(); - child = null; - break; - - case TokenType.NumberSign: // ?? - child = getVhash(); - break; - - case TokenType.LeftParenthesis: - case TokenType.LeftSquareBracket: - child = getBraces(scope); - break; - - case TokenType.Solidus: - case TokenType.Asterisk: - case TokenType.Comma: - case TokenType.Colon: - child = getOperator(); - break; - - default: - child = getAny(scope); - } - - if (child !== null) { - node.sequence.insert(List.createItem(child)); - } - } - - removeTrailingSpaces(node.sequence); - - // right brace - eat(close); - - return node; -} - -// '.' ident -function getClass() { - var info = getInfo(); - - eat(TokenType.FullStop); - - return { - type: 'Class', - info: info, - name: readIdent(false) - }; -} - -// '#' ident -function getShash() { - var info = getInfo(); - - eat(TokenType.NumberSign); - - return { - type: 'Id', - info: info, - name: readIdent(false) - }; -} - -// + | > | ~ | /deep/ -function getCombinator() { - var info = getInfo(); - var combinator; - - switch (scanner.token.type) { - case TokenType.Space: - combinator = ' '; - scanner.next(); - break; - - case TokenType.PlusSign: - case TokenType.GreaterThanSign: - case TokenType.Tilde: - combinator = scanner.token.value; - scanner.next(); - break; - - case TokenType.Solidus: - combinator = '/deep/'; - scanner.next(); - - expectIdentifier('deep', true); - - eat(TokenType.Solidus); - break; - - default: - parseError('Combinator (+, >, ~, /deep/) is expected'); - } - - return { - type: 'Combinator', - info: info, - name: combinator - }; -} - -// '/*' .* '*/' -function getComment() { - var info = getInfo(); - var value = scanner.token.value; - var len = value.length; - - if (len > 4 && value.charAt(len - 2) === '*' && value.charAt(len - 1) === '/') { - len -= 2; - } - - scanner.next(); - - return { - type: 'Comment', - info: info, - value: value.substring(2, len) - }; -} - -// special reader for units to avoid adjoined IE hacks (i.e. '1px\9') -function readUnit() { - if (scanner.token !== null && scanner.token.type === TokenType.Identifier) { - var unit = scanner.token.value; - var backSlashPos = unit.indexOf('\\'); - - // no backslash in unit name - if (backSlashPos === -1) { - scanner.next(); - return unit; - } - - // patch token - scanner.token.value = unit.substr(backSlashPos); - scanner.token.offset += backSlashPos; - scanner.token.column += backSlashPos; - - // return unit w/o backslash part - return unit.substr(0, backSlashPos); - } - - parseError('Identifier is expected'); -} - -// number ident -function getDimension(number) { - return { - type: 'Dimension', - info: getInfo(), - value: number || readNumber(), - unit: readUnit() - }; -} - -// number "%" -function tryGetPercentage() { - var number = tryGetNumber(); - - if (number && scanner.token !== null && scanner.token.type === TokenType.PercentSign) { - return getPercentage(number); - } - - return null; -} - -function getPercentage(number) { - var info; - - if (!number) { - info = getInfo(); - number = readNumber(); - } else { - info = number.info; - number = number.value; - } - - eat(TokenType.PercentSign); - - return { - type: 'Percentage', - info: info, - value: number - }; -} - -// ident '(' functionBody ')' | -// not '(' * ')' -function getFunction(scope, ident) { - var defaultArguments = getFunctionArguments; - - if (!ident) { - ident = getIdentifier(false); - } - - // parse special functions - var name = ident.name.toLowerCase(); - - if (specialFunctions.hasOwnProperty(scope)) { - if (specialFunctions[scope].hasOwnProperty(name)) { - return specialFunctions[scope][name](scope, ident); - } - } - - return getFunctionInternal(defaultArguments, scope, ident); -} - -function getFunctionInternal(functionArgumentsReader, scope, ident) { - var args; - - eat(TokenType.LeftParenthesis); - args = functionArgumentsReader(scope); - eat(TokenType.RightParenthesis); - - return { - type: scope === SCOPE_SELECTOR ? 'FunctionalPseudo' : 'Function', - info: ident.info, - name: ident.name, - arguments: args - }; -} - -function getFunctionArguments(scope) { - var args = new List(); - var argument = null; - var child = null; - - readSC(); - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.RightParenthesis: - break scan; - - case TokenType.Space: - child = getS(); - break; - - case TokenType.Comment: // ignore comments - scanner.next(); - child = null; - break; - - case TokenType.NumberSign: // TODO: not sure it should be here - child = getVhash(); - break; - - case TokenType.LeftParenthesis: - case TokenType.LeftSquareBracket: - child = getBraces(scope); - break; - - case TokenType.Comma: - removeTrailingSpaces(argument.sequence); - scanner.next(); - readSC(); - argument = null; - child = null; - break; - - case TokenType.Solidus: - case TokenType.Asterisk: - case TokenType.Colon: - case TokenType.EqualsSign: - child = getOperator(); - break; - - default: - child = getAny(scope); - } - - if (argument === null) { - argument = { - type: 'Argument', - sequence: new List() - }; - args.insert(List.createItem(argument)); - } - - if (child !== null) { - argument.sequence.insert(List.createItem(child)); - } - } - - if (argument !== null) { - removeTrailingSpaces(argument.sequence); - } - - return args; -} - -function getVarFunction(scope, ident) { - return getFunctionInternal(getVarFunctionArguments, scope, ident); -} - -function getNotFunctionArguments() { - var args = new List(); - var wasSelector = false; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.RightParenthesis: - if (!wasSelector) { - parseError('Simple selector is expected'); - } - - break scan; - - case TokenType.Comma: - if (!wasSelector) { - parseError('Simple selector is expected'); - } - - wasSelector = false; - scanner.next(); - break; - - default: - wasSelector = true; - args.insert(List.createItem(getSimpleSelector(true))); - } - } - - return args; -} - -function getNotFunction(scope, ident) { - var args; - - eat(TokenType.LeftParenthesis); - args = getNotFunctionArguments(scope); - eat(TokenType.RightParenthesis); - - return { - type: 'Negation', - info: ident.info, - // name: ident.name, // TODO: add name? - sequence: args // FIXME: -> arguments? - }; -} - -// var '(' ident (',' )? ')' -function getVarFunctionArguments() { // TODO: special type Variable? - var args = new List(); - - readSC(); - - args.insert(List.createItem({ - type: 'Argument', - sequence: new List([getIdentifier(true)]) - })); - - readSC(); - - if (scanner.token !== null && scanner.token.type === TokenType.Comma) { - eat(TokenType.Comma); - readSC(); - - args.insert(List.createItem({ - type: 'Argument', - sequence: new List([getValue(true)]) - })); - - readSC(); - } - - return args; -} - -// url '(' ws* (string | raw) ws* ')' -function getUri(scope, ident) { - var node = { - type: 'Url', - info: ident.info, - // name: ident.name, - value: null - }; - - eat(TokenType.LeftParenthesis); // ( - - readSC(); - - if (scanner.token.type === TokenType.String) { - node.value = getString(); - readSC(); - } else { - var rawInfo = getInfo(); - var raw = ''; - - for (; scanner.token !== null; scanner.next()) { - var type = scanner.token.type; - - if (type === TokenType.Space || - type === TokenType.LeftParenthesis || - type === TokenType.RightParenthesis) { - break; - } - - raw += scanner.token.value; - } - - node.value = { - type: 'Raw', - info: rawInfo, - value: raw - }; - - readSC(); - } - - eat(TokenType.RightParenthesis); // ) - - return node; -} - -// expression '(' raw ')' -function getOldIEExpression(scope, ident) { - var balance = 0; - var raw = ''; - - eat(TokenType.LeftParenthesis); - - for (; scanner.token !== null; scanner.next()) { - if (scanner.token.type === TokenType.RightParenthesis) { - if (balance === 0) { - break; - } - - balance--; - } else if (scanner.token.type === TokenType.LeftParenthesis) { - balance++; - } - - raw += scanner.token.value; - } - - eat(TokenType.RightParenthesis); - - return { - type: 'Function', - info: ident.info, - name: ident.name, - arguments: new List([{ - type: 'Argument', - sequence: new List([{ - type: 'Raw', - value: raw - }]) - }]) - }; -} - -function readUnicodeRange(tryNext) { - var hex = ''; - - for (; scanner.token !== null; scanner.next()) { - if (scanner.token.type !== TokenType.DecimalNumber && - scanner.token.type !== TokenType.Identifier) { - break; - } - - hex += scanner.token.value; - } - - if (!/^[0-9a-f]{1,6}$/i.test(hex)) { - parseError('Unexpected input'); - } - - // U+abc??? - if (tryNext) { - for (; hex.length < 6 && scanner.token !== null; scanner.next()) { - if (scanner.token.type !== TokenType.QuestionMark) { - break; - } - - hex += scanner.token.value; - tryNext = false; - } - } - - // U+aaa-bbb - if (tryNext) { - if (scanner.token !== null && scanner.token.type === TokenType.HyphenMinus) { - scanner.next(); - - var next = readUnicodeRange(false); - - if (!next) { - parseError('Unexpected input'); - } - - hex += '-' + next; - } - } - - return hex; -} - -function readIdent(varAllowed) { - var name = ''; - - // optional first - - if (scanner.token !== null && scanner.token.type === TokenType.HyphenMinus) { - name = '-'; - scanner.next(); - - if (varAllowed && scanner.token !== null && scanner.token.type === TokenType.HyphenMinus) { - name = '--'; - scanner.next(); - } - } - - expectAny('Identifier', - TokenType.LowLine, - TokenType.Identifier - ); - - if (scanner.token !== null) { - name += scanner.token.value; - scanner.next(); - - for (; scanner.token !== null; scanner.next()) { - var type = scanner.token.type; - - if (type !== TokenType.LowLine && - type !== TokenType.Identifier && - type !== TokenType.DecimalNumber && - type !== TokenType.HyphenMinus) { - break; - } - - name += scanner.token.value; - } - } - - return name; -} - -function getNamespacedIdentifier(checkColon) { - if (scanner.token === null) { - parseError('Unexpected end of input'); - } - - var info = getInfo(); - var name; - - if (scanner.token.type === TokenType.Asterisk) { - checkColon = false; - name = '*'; - scanner.next(); - } else { - name = readIdent(false); - } - - if (scanner.token !== null) { - if (scanner.token.type === TokenType.VerticalLine && - scanner.lookupType(1, TokenType.EqualsSign) === false) { - name += '|'; - - if (scanner.next() !== null) { - if (scanner.token.type === TokenType.HyphenMinus || - scanner.token.type === TokenType.Identifier || - scanner.token.type === TokenType.LowLine) { - name += readIdent(false); - } else if (scanner.token.type === TokenType.Asterisk) { - checkColon = false; - name += '*'; - scanner.next(); - } - } - } - } - - if (checkColon && scanner.token !== null && scanner.token.type === TokenType.Colon) { - scanner.next(); - name += ':' + readIdent(false); - } - - return { - type: 'Identifier', - info: info, - name: name - }; -} - -function getIdentifier(varAllowed) { - return { - type: 'Identifier', - info: getInfo(), - name: readIdent(varAllowed) - }; -} - -// ! ws* important -function getImportant() { // TODO? - // var info = getInfo(); - - eat(TokenType.ExclamationMark); - - readSC(); - - // return { - // type: 'Identifier', - // info: info, - // name: readIdent(false) - // }; - - expectIdentifier('important'); - - readIdent(false); - - // should return identifier in future for original source restoring as is - // returns true for now since it's fit to optimizer purposes - return true; -} - -// odd | even | number? n -function getNth() { - expectAny('Number, odd or even', - TokenType.Identifier, - TokenType.DecimalNumber - ); - - var info = getInfo(); - var value = scanner.token.value; - var cmpValue; - - if (scanner.token.type === TokenType.DecimalNumber) { - var next = scanner.lookup(1); - if (next !== null && - next.type === TokenType.Identifier && - next.value.toLowerCase() === 'n') { - value += next.value; - scanner.next(); - } - } else { - var cmpValue = value.toLowerCase(); - if (cmpValue !== 'odd' && cmpValue !== 'even' && cmpValue !== 'n') { - parseError('Unexpected identifier'); - } - } - - scanner.next(); - - return { - type: 'Nth', - info: info, - value: value - }; -} - -function getNthSelector() { - var info = getInfo(); - var sequence = new List(); - var node; - var child = null; - - eat(TokenType.Colon); - expectIdentifier('nth', false); - - node = { - type: 'FunctionalPseudo', - info: info, - name: readIdent(false), - arguments: new List([{ - type: 'Argument', - sequence: sequence - }]) - }; - - eat(TokenType.LeftParenthesis); - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.RightParenthesis: - break scan; - - case TokenType.Space: - case TokenType.Comment: - scanner.next(); - child = null; - break; - - case TokenType.HyphenMinus: - case TokenType.PlusSign: - child = getOperator(); - break; - - default: - child = getNth(); - } - - if (child !== null) { - sequence.insert(List.createItem(child)); - } - } - - eat(TokenType.RightParenthesis); - - return node; -} - -function readNumber() { - var wasDigits = false; - var number = ''; - var offset = 0; - - if (scanner.lookupType(offset, TokenType.HyphenMinus)) { - number = '-'; - offset++; - } - - if (scanner.lookupType(offset, TokenType.DecimalNumber)) { - wasDigits = true; - number += scanner.lookup(offset).value; - offset++; - } - - if (scanner.lookupType(offset, TokenType.FullStop)) { - number += '.'; - offset++; - } - - if (scanner.lookupType(offset, TokenType.DecimalNumber)) { - wasDigits = true; - number += scanner.lookup(offset).value; - offset++; - } - - if (wasDigits) { - while (offset--) { - scanner.next(); - } - - return number; - } - - return null; -} - -function tryGetNumber() { - var info = getInfo(); - var number = readNumber(); - - if (number !== null) { - return { - type: 'Number', - info: info, - value: number - }; - } - - return null; -} - -// '/' | '*' | ',' | ':' | '=' | '+' | '-' -// TODO: remove '=' since it's wrong operator, but theat as operator -// to make old things like `filter: alpha(opacity=0)` works -function getOperator() { - var node = { - type: 'Operator', - info: getInfo(), - value: scanner.token.value - }; - - scanner.next(); - - return node; -} - -function getFilterValue() { // TODO - var progid; - var node = { - type: 'Value', - info: getInfo(), - important: false, - sequence: new List() - }; - - while (progid = checkProgid()) { - node.sequence.insert(List.createItem(getProgid(progid))); - } - - readSC(node); - - if (scanner.token !== null && scanner.token.type === TokenType.ExclamationMark) { - node.important = getImportant(); - } - - return node; -} - -// 'progid:' ws* 'DXImageTransform.Microsoft.' ident ws* '(' .* ')' -function checkProgid() { - function checkSC(offset) { - for (var cursor; cursor = scanner.lookup(offset); offset++) { - if (cursor.type !== TokenType.Space && - cursor.type !== TokenType.Comment) { - break; - } - } - - return offset; - } - - var offset = checkSC(0); - - if (scanner.lookup(offset + 1) === null || - scanner.lookup(offset + 0).value.toLowerCase() !== 'progid' || - scanner.lookup(offset + 1).type !== TokenType.Colon) { - return false; // fail - } - - offset += 2; - offset = checkSC(offset); - - if (scanner.lookup(offset + 5) === null || - scanner.lookup(offset + 0).value.toLowerCase() !== 'dximagetransform' || - scanner.lookup(offset + 1).type !== TokenType.FullStop || - scanner.lookup(offset + 2).value.toLowerCase() !== 'microsoft' || - scanner.lookup(offset + 3).type !== TokenType.FullStop || - scanner.lookup(offset + 4).type !== TokenType.Identifier) { - return false; // fail - } - - offset += 5; - offset = checkSC(offset); - - if (scanner.lookupType(offset, TokenType.LeftParenthesis) === false) { - return false; // fail - } - - for (var cursor; cursor = scanner.lookup(offset); offset++) { - if (cursor.type === TokenType.RightParenthesis) { - return cursor; - } - } - - return false; -} - -function getProgid(progidEnd) { - var value = ''; - var node = { - type: 'Progid', - info: getInfo(), - value: null - }; - - if (!progidEnd) { - progidEnd = checkProgid(); - } - - if (!progidEnd) { - parseError('progid is expected'); - } - - readSC(node); - - var rawInfo = getInfo(); - for (; scanner.token && scanner.token !== progidEnd; scanner.next()) { - value += scanner.token.value; - } - - eat(TokenType.RightParenthesis); - value += ')'; - - node.value = { - type: 'Raw', - info: rawInfo, - value: value - }; - - readSC(node); - - return node; -} - -// | | -function getPseudo() { - var next = scanner.lookup(1); - - if (next === null) { - scanner.next(); - parseError('Colon or identifier is expected'); - } - - if (next.type === TokenType.Colon) { - return getPseudoElement(); - } - - if (next.type === TokenType.Identifier && - next.value.toLowerCase() === 'nth') { - return getNthSelector(); - } - - return getPseudoClass(); -} - -// :: ident -function getPseudoElement() { - var info = getInfo(); - - eat(TokenType.Colon); - eat(TokenType.Colon); - - return { - type: 'PseudoElement', - info: info, - name: readIdent(false) - }; -} - -// : ( ident | function ) -function getPseudoClass() { - var info = getInfo(); - var ident = eat(TokenType.Colon) && getIdentifier(false); - - if (scanner.token !== null && scanner.token.type === TokenType.LeftParenthesis) { - return getFunction(SCOPE_SELECTOR, ident); - } - - return { - type: 'PseudoClass', - info: info, - name: ident.name - }; -} - -// ws -function getS() { - var node = { - type: 'Space' - // value: scanner.token.value - }; - - scanner.next(); - - return node; -} - -function readSC() { - // var nodes = []; - - scan: - while (scanner.token !== null) { - switch (scanner.token.type) { - case TokenType.Space: - scanner.next(); - // nodes.push(getS()); - break; - - case TokenType.Comment: - scanner.next(); - // nodes.push(getComment()); - break; - - default: - break scan; - } - } - - return null; - - // return nodes.length ? new List(nodes) : null; -} - -// node: String -function getString() { - var node = { - type: 'String', - info: getInfo(), - value: scanner.token.value - }; - - scanner.next(); - - return node; -} - -// # ident -function getVhash() { - var info = getInfo(); - var value; - - eat(TokenType.NumberSign); - - expectAny('Number or identifier', - TokenType.DecimalNumber, - TokenType.Identifier - ); - - value = scanner.token.value; - - if (scanner.token.type === TokenType.DecimalNumber && - scanner.lookupType(1, TokenType.Identifier)) { - scanner.next(); - value += scanner.token.value; - } - - scanner.next(); - - return { - type: 'Hash', - info: info, - value: value - }; -} - -module.exports = function parse(source, options) { - var ast; - - if (!options || typeof options !== 'object') { - options = {}; - } - - var context = options.context || 'stylesheet'; - needPositions = Boolean(options.positions); - filename = options.filename || ''; - - if (!initialContext.hasOwnProperty(context)) { - throw new Error('Unknown context `' + context + '`'); - } - - scanner = new Scanner(source, blockMode.hasOwnProperty(context), options.line, options.column); - scanner.next(); - ast = initialContext[context](); - - scanner = null; - - // console.log(JSON.stringify(ast, null, 4)); - return ast; -}; diff --git a/node_modules/csso/lib/parser/scanner.js b/node_modules/csso/lib/parser/scanner.js deleted file mode 100644 index 066fa8e..0000000 --- a/node_modules/csso/lib/parser/scanner.js +++ /dev/null @@ -1,380 +0,0 @@ -'use strict'; - -var TokenType = require('./const.js').TokenType; - -var TAB = 9; -var N = 10; -var F = 12; -var R = 13; -var SPACE = 32; -var DOUBLE_QUOTE = 34; -var QUOTE = 39; -var RIGHT_PARENTHESIS = 41; -var STAR = 42; -var SLASH = 47; -var BACK_SLASH = 92; -var UNDERSCORE = 95; -var LEFT_CURLY_BRACE = 123; -var RIGHT_CURLY_BRACE = 125; - -var WHITESPACE = 1; -var PUNCTUATOR = 2; -var DIGIT = 3; -var STRING = 4; - -var PUNCTUATION = { - 9: TokenType.Tab, // '\t' - 10: TokenType.Newline, // '\n' - 13: TokenType.Newline, // '\r' - 32: TokenType.Space, // ' ' - 33: TokenType.ExclamationMark, // '!' - 34: TokenType.QuotationMark, // '"' - 35: TokenType.NumberSign, // '#' - 36: TokenType.DollarSign, // '$' - 37: TokenType.PercentSign, // '%' - 38: TokenType.Ampersand, // '&' - 39: TokenType.Apostrophe, // '\'' - 40: TokenType.LeftParenthesis, // '(' - 41: TokenType.RightParenthesis, // ')' - 42: TokenType.Asterisk, // '*' - 43: TokenType.PlusSign, // '+' - 44: TokenType.Comma, // ',' - 45: TokenType.HyphenMinus, // '-' - 46: TokenType.FullStop, // '.' - 47: TokenType.Solidus, // '/' - 58: TokenType.Colon, // ':' - 59: TokenType.Semicolon, // ';' - 60: TokenType.LessThanSign, // '<' - 61: TokenType.EqualsSign, // '=' - 62: TokenType.GreaterThanSign, // '>' - 63: TokenType.QuestionMark, // '?' - 64: TokenType.CommercialAt, // '@' - 91: TokenType.LeftSquareBracket, // '[' - 93: TokenType.RightSquareBracket, // ']' - 94: TokenType.CircumflexAccent, // '^' - 95: TokenType.LowLine, // '_' - 123: TokenType.LeftCurlyBracket, // '{' - 124: TokenType.VerticalLine, // '|' - 125: TokenType.RightCurlyBracket, // '}' - 126: TokenType.Tilde // '~' -}; -var SYMBOL_CATEGORY_LENGTH = Math.max.apply(null, Object.keys(PUNCTUATION)) + 1; -var SYMBOL_CATEGORY = new Uint32Array(SYMBOL_CATEGORY_LENGTH); -var IS_PUNCTUATOR = new Uint32Array(SYMBOL_CATEGORY_LENGTH); - -// fill categories -Object.keys(PUNCTUATION).forEach(function(key) { - SYMBOL_CATEGORY[Number(key)] = PUNCTUATOR; - IS_PUNCTUATOR[Number(key)] = PUNCTUATOR; -}, SYMBOL_CATEGORY); - -// don't treat as punctuator -IS_PUNCTUATOR[UNDERSCORE] = 0; - -for (var i = 48; i <= 57; i++) { - SYMBOL_CATEGORY[i] = DIGIT; -} - -SYMBOL_CATEGORY[SPACE] = WHITESPACE; -SYMBOL_CATEGORY[TAB] = WHITESPACE; -SYMBOL_CATEGORY[N] = WHITESPACE; -SYMBOL_CATEGORY[R] = WHITESPACE; -SYMBOL_CATEGORY[F] = WHITESPACE; - -SYMBOL_CATEGORY[QUOTE] = STRING; -SYMBOL_CATEGORY[DOUBLE_QUOTE] = STRING; - -// -// scanner -// - -var Scanner = function(source, initBlockMode, initLine, initColumn) { - this.source = source; - - this.pos = source.charCodeAt(0) === 0xFEFF ? 1 : 0; - this.eof = this.pos === this.source.length; - this.line = typeof initLine === 'undefined' ? 1 : initLine; - this.lineStartPos = typeof initColumn === 'undefined' ? -1 : -initColumn; - - this.minBlockMode = initBlockMode ? 1 : 0; - this.blockMode = this.minBlockMode; - this.urlMode = false; - - this.prevToken = null; - this.token = null; - this.buffer = []; -}; - -Scanner.prototype = { - lookup: function(offset) { - if (offset === 0) { - return this.token; - } - - for (var i = this.buffer.length; !this.eof && i < offset; i++) { - this.buffer.push(this.getToken()); - } - - return offset <= this.buffer.length ? this.buffer[offset - 1] : null; - }, - lookupType: function(offset, type) { - var token = this.lookup(offset); - - return token !== null && token.type === type; - }, - next: function() { - var newToken = null; - - if (this.buffer.length !== 0) { - newToken = this.buffer.shift(); - } else if (!this.eof) { - newToken = this.getToken(); - } - - this.prevToken = this.token; - this.token = newToken; - - return newToken; - }, - - tokenize: function() { - var tokens = []; - - for (; this.pos < this.source.length; this.pos++) { - tokens.push(this.getToken()); - } - - return tokens; - }, - - getToken: function() { - var code = this.source.charCodeAt(this.pos); - var line = this.line; - var column = this.pos - this.lineStartPos; - var offset = this.pos; - var next; - var type; - var value; - - switch (code < SYMBOL_CATEGORY_LENGTH ? SYMBOL_CATEGORY[code] : 0) { - case DIGIT: - type = TokenType.DecimalNumber; - value = this.readDecimalNumber(); - break; - - case STRING: - type = TokenType.String; - value = this.readString(code); - break; - - case WHITESPACE: - type = TokenType.Space; - value = this.readSpaces(); - break; - - case PUNCTUATOR: - if (code === SLASH) { - next = this.pos + 1 < this.source.length ? this.source.charCodeAt(this.pos + 1) : 0; - - if (next === STAR) { // /* - type = TokenType.Comment; - value = this.readComment(); - break; - } else if (next === SLASH && !this.urlMode) { // // - if (this.blockMode > 0) { - var skip = 2; - - while (this.source.charCodeAt(this.pos + 2) === SLASH) { - skip++; - } - - type = TokenType.Identifier; - value = this.readIdentifier(skip); - - this.urlMode = this.urlMode || value === 'url'; - } else { - type = TokenType.Unknown; - value = this.readUnknown(); - } - break; - } - } - - type = PUNCTUATION[code]; - value = String.fromCharCode(code); - this.pos++; - - if (code === RIGHT_PARENTHESIS) { - this.urlMode = false; - } else if (code === LEFT_CURLY_BRACE) { - this.blockMode++; - } else if (code === RIGHT_CURLY_BRACE) { - if (this.blockMode > this.minBlockMode) { - this.blockMode--; - } - } - - break; - - default: - type = TokenType.Identifier; - value = this.readIdentifier(0); - - this.urlMode = this.urlMode || value === 'url'; - } - - this.eof = this.pos === this.source.length; - - return { - type: type, - value: value, - - offset: offset, - line: line, - column: column - }; - }, - - isNewline: function(code) { - if (code === N || code === F || code === R) { - if (code === R && this.pos + 1 < this.source.length && this.source.charCodeAt(this.pos + 1) === N) { - this.pos++; - } - - this.line++; - this.lineStartPos = this.pos; - return true; - } - - return false; - }, - - readSpaces: function() { - var start = this.pos; - - for (; this.pos < this.source.length; this.pos++) { - var code = this.source.charCodeAt(this.pos); - - if (!this.isNewline(code) && code !== SPACE && code !== TAB) { - break; - } - } - - return this.source.substring(start, this.pos); - }, - - readComment: function() { - var start = this.pos; - - for (this.pos += 2; this.pos < this.source.length; this.pos++) { - var code = this.source.charCodeAt(this.pos); - - if (code === STAR) { // */ - if (this.source.charCodeAt(this.pos + 1) === SLASH) { - this.pos += 2; - break; - } - } else { - this.isNewline(code); - } - } - - return this.source.substring(start, this.pos); - }, - - readUnknown: function() { - var start = this.pos; - - for (this.pos += 2; this.pos < this.source.length; this.pos++) { - if (this.isNewline(this.source.charCodeAt(this.pos), this.source)) { - break; - } - } - - return this.source.substring(start, this.pos); - }, - - readString: function(quote) { - var start = this.pos; - var res = ''; - - for (this.pos++; this.pos < this.source.length; this.pos++) { - var code = this.source.charCodeAt(this.pos); - - if (code === BACK_SLASH) { - var end = this.pos++; - - if (this.isNewline(this.source.charCodeAt(this.pos), this.source)) { - res += this.source.substring(start, end); - start = this.pos + 1; - } - } else if (code === quote) { - this.pos++; - break; - } - } - - return res + this.source.substring(start, this.pos); - }, - - readDecimalNumber: function() { - var start = this.pos; - var code; - - for (this.pos++; this.pos < this.source.length; this.pos++) { - code = this.source.charCodeAt(this.pos); - - if (code < 48 || code > 57) { // 0 .. 9 - break; - } - } - - return this.source.substring(start, this.pos); - }, - - readIdentifier: function(skip) { - var start = this.pos; - - for (this.pos += skip; this.pos < this.source.length; this.pos++) { - var code = this.source.charCodeAt(this.pos); - - if (code === BACK_SLASH) { - this.pos++; - - // skip escaped unicode sequence that can ends with space - // [0-9a-f]{1,6}(\r\n|[ \n\r\t\f])? - for (var i = 0; i < 7 && this.pos + i < this.source.length; i++) { - code = this.source.charCodeAt(this.pos + i); - - if (i !== 6) { - if ((code >= 48 && code <= 57) || // 0 .. 9 - (code >= 65 && code <= 70) || // A .. F - (code >= 97 && code <= 102)) { // a .. f - continue; - } - } - - if (i > 0) { - this.pos += i - 1; - if (code === SPACE || code === TAB || this.isNewline(code)) { - this.pos++; - } - } - - break; - } - } else if (code < SYMBOL_CATEGORY_LENGTH && - IS_PUNCTUATOR[code] === PUNCTUATOR) { - break; - } - } - - return this.source.substring(start, this.pos); - } -}; - -// warm up tokenizer to elimitate code branches that never execute -// fix soft deoptimizations (insufficient type feedback) -new Scanner('\n\r\r\n\f//""\'\'/**/1a;.{url(a)}').lookup(1e3); - -module.exports = Scanner; diff --git a/node_modules/csso/lib/utils/clone.js b/node_modules/csso/lib/utils/clone.js deleted file mode 100644 index 7592e9e..0000000 --- a/node_modules/csso/lib/utils/clone.js +++ /dev/null @@ -1,23 +0,0 @@ -var List = require('./list'); - -module.exports = function clone(node) { - var result = {}; - - for (var key in node) { - var value = node[key]; - - if (value) { - if (Array.isArray(value)) { - value = value.slice(0); - } else if (value instanceof List) { - value = new List(value.map(clone)); - } else if (value.constructor === Object) { - value = clone(value); - } - } - - result[key] = value; - } - - return result; -}; diff --git a/node_modules/csso/lib/utils/list.js b/node_modules/csso/lib/utils/list.js deleted file mode 100644 index 30d1487..0000000 --- a/node_modules/csso/lib/utils/list.js +++ /dev/null @@ -1,389 +0,0 @@ -// -// item item item item -// /------\ /------\ /------\ /------\ -// | data | | data | | data | | data | -// null <--+-prev |<---+-prev |<---+-prev |<---+-prev | -// | next-+--->| next-+--->| next-+--->| next-+--> null -// \------/ \------/ \------/ \------/ -// ^ ^ -// | list | -// | /------\ | -// \--------------+-head | | -// | tail-+--------------/ -// \------/ -// - -function createItem(data) { - return { - data: data, - next: null, - prev: null - }; -} - -var List = function(values) { - this.cursor = null; - this.head = null; - this.tail = null; - - if (Array.isArray(values)) { - var cursor = null; - - for (var i = 0; i < values.length; i++) { - var item = createItem(values[i]); - - if (cursor !== null) { - cursor.next = item; - } else { - this.head = item; - } - - item.prev = cursor; - cursor = item; - } - - this.tail = cursor; - } -}; - -Object.defineProperty(List.prototype, 'size', { - get: function() { - var size = 0; - var cursor = this.head; - - while (cursor) { - size++; - cursor = cursor.next; - } - - return size; - } -}); - -List.createItem = createItem; -List.prototype.createItem = createItem; - -List.prototype.toArray = function() { - var cursor = this.head; - var result = []; - - while (cursor) { - result.push(cursor.data); - cursor = cursor.next; - } - - return result; -}; -List.prototype.toJSON = function() { - return this.toArray(); -}; - -List.prototype.isEmpty = function() { - return this.head === null; -}; - -List.prototype.first = function() { - return this.head && this.head.data; -}; - -List.prototype.last = function() { - return this.tail && this.tail.data; -}; - -List.prototype.each = function(fn, context) { - var item; - var cursor = { - prev: null, - next: this.head, - cursor: this.cursor - }; - - if (context === undefined) { - context = this; - } - - // push cursor - this.cursor = cursor; - - while (cursor.next !== null) { - item = cursor.next; - cursor.next = item.next; - - fn.call(context, item.data, item, this); - } - - // pop cursor - this.cursor = this.cursor.cursor; -}; - -List.prototype.eachRight = function(fn, context) { - var item; - var cursor = { - prev: this.tail, - next: null, - cursor: this.cursor - }; - - if (context === undefined) { - context = this; - } - - // push cursor - this.cursor = cursor; - - while (cursor.prev !== null) { - item = cursor.prev; - cursor.prev = item.prev; - - fn.call(context, item.data, item, this); - } - - // pop cursor - this.cursor = this.cursor.cursor; -}; - -List.prototype.nextUntil = function(start, fn, context) { - if (start === null) { - return; - } - - var item; - var cursor = { - prev: null, - next: start, - cursor: this.cursor - }; - - if (context === undefined) { - context = this; - } - - // push cursor - this.cursor = cursor; - - while (cursor.next !== null) { - item = cursor.next; - cursor.next = item.next; - - if (fn.call(context, item.data, item, this)) { - break; - } - } - - // pop cursor - this.cursor = this.cursor.cursor; -}; - -List.prototype.prevUntil = function(start, fn, context) { - if (start === null) { - return; - } - - var item; - var cursor = { - prev: start, - next: null, - cursor: this.cursor - }; - - if (context === undefined) { - context = this; - } - - // push cursor - this.cursor = cursor; - - while (cursor.prev !== null) { - item = cursor.prev; - cursor.prev = item.prev; - - if (fn.call(context, item.data, item, this)) { - break; - } - } - - // pop cursor - this.cursor = this.cursor.cursor; -}; - -List.prototype.some = function(fn, context) { - var cursor = this.head; - - if (context === undefined) { - context = this; - } - - while (cursor !== null) { - if (fn.call(context, cursor.data, cursor, this)) { - return true; - } - - cursor = cursor.next; - } - - return false; -}; - -List.prototype.map = function(fn, context) { - var result = []; - var cursor = this.head; - - if (context === undefined) { - context = this; - } - - while (cursor !== null) { - result.push(fn.call(context, cursor.data, cursor, this)); - cursor = cursor.next; - } - - return result; -}; - -List.prototype.copy = function() { - var result = new List(); - var cursor = this.head; - - while (cursor !== null) { - result.insert(createItem(cursor.data)); - cursor = cursor.next; - } - - return result; -}; - -List.prototype.updateCursors = function(prevOld, prevNew, nextOld, nextNew) { - var cursor = this.cursor; - - while (cursor !== null) { - if (prevNew === true || cursor.prev === prevOld) { - cursor.prev = prevNew; - } - - if (nextNew === true || cursor.next === nextOld) { - cursor.next = nextNew; - } - - cursor = cursor.cursor; - } -}; - -List.prototype.insert = function(item, before) { - if (before !== undefined && before !== null) { - // prev before - // ^ - // item - this.updateCursors(before.prev, item, before, item); - - if (before.prev === null) { - // insert to the beginning of list - if (this.head !== before) { - throw new Error('before doesn\'t below to list'); - } - - // since head points to before therefore list doesn't empty - // no need to check tail - this.head = item; - before.prev = item; - item.next = before; - - this.updateCursors(null, item); - } else { - - // insert between two items - before.prev.next = item; - item.prev = before.prev; - - before.prev = item; - item.next = before; - } - } else { - // tail - // ^ - // item - this.updateCursors(this.tail, item, null, item); - - // insert to end of the list - if (this.tail !== null) { - // if list has a tail, then it also has a head, but head doesn't change - - // last item -> new item - this.tail.next = item; - - // last item <- new item - item.prev = this.tail; - } else { - // if list has no a tail, then it also has no a head - // in this case points head to new item - this.head = item; - } - - // tail always start point to new item - this.tail = item; - } -}; - -List.prototype.remove = function(item) { - // item - // ^ - // prev next - this.updateCursors(item, item.prev, item, item.next); - - if (item.prev !== null) { - item.prev.next = item.next; - } else { - if (this.head !== item) { - throw new Error('item doesn\'t below to list'); - } - - this.head = item.next; - } - - if (item.next !== null) { - item.next.prev = item.prev; - } else { - if (this.tail !== item) { - throw new Error('item doesn\'t below to list'); - } - - this.tail = item.prev; - } - - item.prev = null; - item.next = null; - - return item; -}; - -List.prototype.appendList = function(list) { - // ignore empty lists - if (list.head === null) { - return; - } - - this.updateCursors(this.tail, list.tail, null, list.head); - - // insert to end of the list - if (this.tail !== null) { - // if destination list has a tail, then it also has a head, - // but head doesn't change - - // dest tail -> source head - this.tail.next = list.head; - - // dest tail <- source head - list.head.prev = this.tail; - } else { - // if list has no a tail, then it also has no a head - // in this case points head to new item - this.head = list.head; - } - - // tail always start point to new item - this.tail = list.tail; - - list.head = null; - list.tail = null; -}; - -module.exports = List; diff --git a/node_modules/csso/lib/utils/names.js b/node_modules/csso/lib/utils/names.js deleted file mode 100644 index 2727771..0000000 --- a/node_modules/csso/lib/utils/names.js +++ /dev/null @@ -1,73 +0,0 @@ -var hasOwnProperty = Object.prototype.hasOwnProperty; -var knownKeywords = Object.create(null); -var knownProperties = Object.create(null); - -function getVendorPrefix(string) { - if (string[0] === '-') { - // skip 2 chars to avoid wrong match with variables names - var secondDashIndex = string.indexOf('-', 2); - - if (secondDashIndex !== -1) { - return string.substr(0, secondDashIndex + 1); - } - } - - return ''; -} - -function getKeywordInfo(keyword) { - if (hasOwnProperty.call(knownKeywords, keyword)) { - return knownKeywords[keyword]; - } - - var lowerCaseKeyword = keyword.toLowerCase(); - var vendor = getVendorPrefix(lowerCaseKeyword); - var name = lowerCaseKeyword; - - if (vendor) { - name = name.substr(vendor.length); - } - - return knownKeywords[keyword] = Object.freeze({ - vendor: vendor, - prefix: vendor, - name: name - }); -} - -function getPropertyInfo(property) { - if (hasOwnProperty.call(knownProperties, property)) { - return knownProperties[property]; - } - - var lowerCaseProperty = property.toLowerCase(); - var hack = lowerCaseProperty[0]; - - if (hack === '*' || hack === '_' || hack === '$') { - lowerCaseProperty = lowerCaseProperty.substr(1); - } else if (hack === '/' && property[1] === '/') { - hack = '//'; - lowerCaseProperty = lowerCaseProperty.substr(2); - } else { - hack = ''; - } - - var vendor = getVendorPrefix(lowerCaseProperty); - var name = lowerCaseProperty; - - if (vendor) { - name = name.substr(vendor.length); - } - - return knownProperties[property] = Object.freeze({ - hack: hack, - vendor: vendor, - prefix: hack + vendor, - name: name - }); -} - -module.exports = { - keyword: getKeywordInfo, - property: getPropertyInfo -}; diff --git a/node_modules/csso/lib/utils/translate.js b/node_modules/csso/lib/utils/translate.js deleted file mode 100644 index ae7beeb..0000000 --- a/node_modules/csso/lib/utils/translate.js +++ /dev/null @@ -1,178 +0,0 @@ -function each(list) { - if (list.head === null) { - return ''; - } - - if (list.head === list.tail) { - return translate(list.head.data); - } - - return list.map(translate).join(''); -} - -function eachDelim(list, delimeter) { - if (list.head === null) { - return ''; - } - - if (list.head === list.tail) { - return translate(list.head.data); - } - - return list.map(translate).join(delimeter); -} - -function translate(node) { - switch (node.type) { - case 'StyleSheet': - return each(node.rules); - - case 'Atrule': - var nodes = ['@', node.name]; - - if (node.expression && !node.expression.sequence.isEmpty()) { - nodes.push(' ', translate(node.expression)); - } - - if (node.block) { - nodes.push('{', translate(node.block), '}'); - } else { - nodes.push(';'); - } - - return nodes.join(''); - - case 'Ruleset': - return translate(node.selector) + '{' + translate(node.block) + '}'; - - case 'Selector': - return eachDelim(node.selectors, ','); - - case 'SimpleSelector': - var nodes = node.sequence.map(function(node) { - // add extra spaces around /deep/ combinator since comment beginning/ending may to be produced - if (node.type === 'Combinator' && node.name === '/deep/') { - return ' ' + translate(node) + ' '; - } - - return translate(node); - }); - - return nodes.join(''); - - case 'Block': - return eachDelim(node.declarations, ';'); - - case 'Declaration': - return translate(node.property) + ':' + translate(node.value); - - case 'Property': - return node.name; - - case 'Value': - return node.important - ? each(node.sequence) + '!important' - : each(node.sequence); - - case 'Attribute': - var result = translate(node.name); - var flagsPrefix = ' '; - - if (node.operator !== null) { - result += node.operator; - - if (node.value !== null) { - result += translate(node.value); - - // space between string and flags is not required - if (node.value.type === 'String') { - flagsPrefix = ''; - } - } - } - - if (node.flags !== null) { - result += flagsPrefix + node.flags; - } - - return '[' + result + ']'; - - case 'FunctionalPseudo': - return ':' + node.name + '(' + eachDelim(node.arguments, ',') + ')'; - - case 'Function': - return node.name + '(' + eachDelim(node.arguments, ',') + ')'; - - case 'Negation': - return ':not(' + eachDelim(node.sequence, ',') + ')'; - - case 'Braces': - return node.open + each(node.sequence) + node.close; - - case 'Argument': - case 'AtruleExpression': - return each(node.sequence); - - case 'Url': - return 'url(' + translate(node.value) + ')'; - - case 'Progid': - return translate(node.value); - - case 'Combinator': - return node.name; - - case 'Identifier': - return node.name; - - case 'PseudoClass': - return ':' + node.name; - - case 'PseudoElement': - return '::' + node.name; - - case 'Class': - return '.' + node.name; - - case 'Id': - return '#' + node.name; - - case 'Hash': - return '#' + node.value; - - case 'Dimension': - return node.value + node.unit; - - case 'Nth': - return node.value; - - case 'Number': - return node.value; - - case 'String': - return node.value; - - case 'Operator': - return node.value; - - case 'Raw': - return node.value; - - case 'Unknown': - return node.value; - - case 'Percentage': - return node.value + '%'; - - case 'Space': - return ' '; - - case 'Comment': - return '/*' + node.value + '*/'; - - default: - throw new Error('Unknown node type: ' + node.type); - } -} - -module.exports = translate; diff --git a/node_modules/csso/lib/utils/translateWithSourceMap.js b/node_modules/csso/lib/utils/translateWithSourceMap.js deleted file mode 100644 index 819b7af..0000000 --- a/node_modules/csso/lib/utils/translateWithSourceMap.js +++ /dev/null @@ -1,291 +0,0 @@ -var SourceMapGenerator = require('source-map').SourceMapGenerator; -var SourceNode = require('source-map').SourceNode; - -// Our own implementation of SourceNode#toStringWithSourceMap, -// since SourceNode doesn't allow multiple references to original source. -// Also, as we know structure of result we could be optimize generation -// (currently it's ~40% faster). -function walk(node, fn) { - for (var chunk, i = 0; i < node.children.length; i++) { - chunk = node.children[i]; - - if (chunk instanceof SourceNode) { - // this is a hack, because source maps doesn't support for 1(generated):N(original) - // if (chunk.merged) { - // fn('', chunk); - // } - - walk(chunk, fn); - } else { - fn(chunk, node); - } - } -} - -function generateSourceMap(root) { - var map = new SourceMapGenerator(); - var css = ''; - var sourceMappingActive = false; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastIndexOfNewline; - var generated = { - line: 1, - column: 0 - }; - var activatedMapping = { - generated: generated - }; - - walk(root, function(chunk, original) { - if (original.line !== null && - original.column !== null) { - if (lastOriginalLine !== original.line || - lastOriginalColumn !== original.column) { - map.addMapping({ - source: original.source, - original: original, - generated: generated - }); - } - - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping(activatedMapping); - sourceMappingActive = false; - } - - css += chunk; - - lastIndexOfNewline = chunk.lastIndexOf('\n'); - if (lastIndexOfNewline !== -1) { - generated.line += chunk.match(/\n/g).length; - generated.column = chunk.length - lastIndexOfNewline - 1; - } else { - generated.column += chunk.length; - } - }); - - return { - css: css, - map: map - }; -} - -function createAnonymousSourceNode(children) { - return new SourceNode( - null, - null, - null, - children - ); -} - -function createSourceNode(info, children) { - if (info.primary) { - // special marker node to add several references to original - // var merged = createSourceNode(info.merged, []); - // merged.merged = true; - // children.unshift(merged); - - // use recursion, because primary can also has a primary/merged info - return createSourceNode(info.primary, children); - } - - return new SourceNode( - info.line, - info.column - 1, - info.source, - children - ); -} - -function each(list) { - if (list.head === null) { - return ''; - } - - if (list.head === list.tail) { - return translate(list.head.data); - } - - return list.map(translate).join(''); -} - -function eachDelim(list, delimeter) { - if (list.head === null) { - return ''; - } - - if (list.head === list.tail) { - return translate(list.head.data); - } - - return list.map(translate).join(delimeter); -} - -function translate(node) { - switch (node.type) { - case 'StyleSheet': - return createAnonymousSourceNode(node.rules.map(translate)); - - case 'Atrule': - var nodes = ['@', node.name]; - - if (node.expression && !node.expression.sequence.isEmpty()) { - nodes.push(' ', translate(node.expression)); - } - - if (node.block) { - nodes.push('{', translate(node.block), '}'); - } else { - nodes.push(';'); - } - - return createSourceNode(node.info, nodes); - - case 'Ruleset': - return createAnonymousSourceNode([ - translate(node.selector), '{', translate(node.block), '}' - ]); - - case 'Selector': - return createAnonymousSourceNode(node.selectors.map(translate)).join(','); - - case 'SimpleSelector': - var nodes = node.sequence.map(function(node) { - // add extra spaces around /deep/ combinator since comment beginning/ending may to be produced - if (node.type === 'Combinator' && node.name === '/deep/') { - return ' ' + translate(node) + ' '; - } - - return translate(node); - }); - - return createSourceNode(node.info, nodes); - - case 'Block': - return createAnonymousSourceNode(node.declarations.map(translate)).join(';'); - - case 'Declaration': - return createSourceNode( - node.info, - [translate(node.property), ':', translate(node.value)] - ); - - case 'Property': - return node.name; - - case 'Value': - return node.important - ? each(node.sequence) + '!important' - : each(node.sequence); - - case 'Attribute': - var result = translate(node.name); - var flagsPrefix = ' '; - - if (node.operator !== null) { - result += node.operator; - - if (node.value !== null) { - result += translate(node.value); - - // space between string and flags is not required - if (node.value.type === 'String') { - flagsPrefix = ''; - } - } - } - - if (node.flags !== null) { - result += flagsPrefix + node.flags; - } - - return '[' + result + ']'; - - case 'FunctionalPseudo': - return ':' + node.name + '(' + eachDelim(node.arguments, ',') + ')'; - - case 'Function': - return node.name + '(' + eachDelim(node.arguments, ',') + ')'; - - case 'Negation': - return ':not(' + eachDelim(node.sequence, ',') + ')'; - - case 'Braces': - return node.open + each(node.sequence) + node.close; - - case 'Argument': - case 'AtruleExpression': - return each(node.sequence); - - case 'Url': - return 'url(' + translate(node.value) + ')'; - - case 'Progid': - return translate(node.value); - - case 'Combinator': - return node.name; - - case 'Identifier': - return node.name; - - case 'PseudoClass': - return ':' + node.name; - - case 'PseudoElement': - return '::' + node.name; - - case 'Class': - return '.' + node.name; - - case 'Id': - return '#' + node.name; - - case 'Hash': - return '#' + node.value; - - case 'Dimension': - return node.value + node.unit; - - case 'Nth': - return node.value; - - case 'Number': - return node.value; - - case 'String': - return node.value; - - case 'Operator': - return node.value; - - case 'Raw': - return node.value; - - case 'Unknown': - return node.value; - - case 'Percentage': - return node.value + '%'; - - case 'Space': - return ' '; - - case 'Comment': - return '/*' + node.value + '*/'; - - default: - throw new Error('Unknown node type: ' + node.type); - } -} - -module.exports = function(node) { - return generateSourceMap( - createAnonymousSourceNode(translate(node)) - ); -}; diff --git a/node_modules/csso/lib/utils/walk.js b/node_modules/csso/lib/utils/walk.js deleted file mode 100644 index a7948eb..0000000 --- a/node_modules/csso/lib/utils/walk.js +++ /dev/null @@ -1,189 +0,0 @@ -function walkRules(node, item, list) { - switch (node.type) { - case 'StyleSheet': - var oldStylesheet = this.stylesheet; - this.stylesheet = node; - - node.rules.each(walkRules, this); - - this.stylesheet = oldStylesheet; - break; - - case 'Atrule': - if (node.block !== null) { - walkRules.call(this, node.block); - } - - this.fn(node, item, list); - break; - - case 'Ruleset': - this.fn(node, item, list); - break; - } - -} - -function walkRulesRight(node, item, list) { - switch (node.type) { - case 'StyleSheet': - var oldStylesheet = this.stylesheet; - this.stylesheet = node; - - node.rules.eachRight(walkRulesRight, this); - - this.stylesheet = oldStylesheet; - break; - - case 'Atrule': - if (node.block !== null) { - walkRulesRight.call(this, node.block); - } - - this.fn(node, item, list); - break; - - case 'Ruleset': - this.fn(node, item, list); - break; - } -} - -function walkAll(node, item, list) { - switch (node.type) { - case 'StyleSheet': - var oldStylesheet = this.stylesheet; - this.stylesheet = node; - - node.rules.each(walkAll, this); - - this.stylesheet = oldStylesheet; - break; - - case 'Atrule': - if (node.expression !== null) { - walkAll.call(this, node.expression); - } - if (node.block !== null) { - walkAll.call(this, node.block); - } - break; - - case 'Ruleset': - this.ruleset = node; - - if (node.selector !== null) { - walkAll.call(this, node.selector); - } - walkAll.call(this, node.block); - - this.ruleset = null; - break; - - case 'Selector': - var oldSelector = this.selector; - this.selector = node; - - node.selectors.each(walkAll, this); - - this.selector = oldSelector; - break; - - case 'Block': - node.declarations.each(walkAll, this); - break; - - case 'Declaration': - this.declaration = node; - - walkAll.call(this, node.property); - walkAll.call(this, node.value); - - this.declaration = null; - break; - - case 'Attribute': - walkAll.call(this, node.name); - if (node.value !== null) { - walkAll.call(this, node.value); - } - break; - - case 'FunctionalPseudo': - case 'Function': - this['function'] = node; - - node.arguments.each(walkAll, this); - - this['function'] = null; - break; - - case 'AtruleExpression': - this.atruleExpression = node; - - node.sequence.each(walkAll, this); - - this.atruleExpression = null; - break; - - case 'Value': - case 'Argument': - case 'SimpleSelector': - case 'Braces': - case 'Negation': - node.sequence.each(walkAll, this); - break; - - case 'Url': - case 'Progid': - walkAll.call(this, node.value); - break; - - // nothig to do with - // case 'Property': - // case 'Combinator': - // case 'Dimension': - // case 'Hash': - // case 'Identifier': - // case 'Nth': - // case 'Class': - // case 'Id': - // case 'Percentage': - // case 'PseudoClass': - // case 'PseudoElement': - // case 'Space': - // case 'Number': - // case 'String': - // case 'Operator': - // case 'Raw': - } - - this.fn(node, item, list); -} - -function createContext(root, fn) { - var context = { - fn: fn, - root: root, - stylesheet: null, - atruleExpression: null, - ruleset: null, - selector: null, - declaration: null, - function: null - }; - - return context; -} - -module.exports = { - all: function(root, fn) { - walkAll.call(createContext(root, fn), root); - }, - rules: function(root, fn) { - walkRules.call(createContext(root, fn), root); - }, - rulesRight: function(root, fn) { - walkRulesRight.call(createContext(root, fn), root); - } -}; diff --git a/node_modules/csso/package.json b/node_modules/csso/package.json deleted file mode 100644 index 3c81742..0000000 --- a/node_modules/csso/package.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "csso@~2.2.1", - "scope": null, - "escapedName": "csso", - "name": "csso", - "rawSpec": "~2.2.1", - "spec": ">=2.2.1 <2.3.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/svgo" - ] - ], - "_from": "csso@>=2.2.1 <2.3.0", - "_id": "csso@2.2.1", - "_inCache": true, - "_location": "/csso", - "_nodeVersion": "6.2.1", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/csso-2.2.1.tgz_1469398647720_0.4500888998154551" - }, - "_npmUser": { - "name": "lahmatiy", - "email": "rdvornov@gmail.com" - }, - "_npmVersion": "3.10.4", - "_phantomChildren": {}, - "_requested": { - "raw": "csso@~2.2.1", - "scope": null, - "escapedName": "csso", - "name": "csso", - "rawSpec": "~2.2.1", - "spec": ">=2.2.1 <2.3.0", - "type": "range" - }, - "_requiredBy": [ - "/svgo" - ], - "_resolved": "https://registry.npmjs.org/csso/-/csso-2.2.1.tgz", - "_shasum": "51fbb5347e50e81e6ed51668a48490ae6fe2afe2", - "_shrinkwrap": null, - "_spec": "csso@~2.2.1", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/svgo", - "author": { - "name": "Sergey Kryzhanovsky", - "email": "skryzhanovsky@ya.ru", - "url": "https://github.com/afelix" - }, - "bin": { - "csso": "./bin/csso" - }, - "bugs": { - "url": "https://github.com/css/csso/issues" - }, - "dependencies": { - "clap": "^1.0.9", - "source-map": "^0.5.3" - }, - "description": "CSSO (CSS Optimizer) is a CSS minifier with structural optimisations", - "devDependencies": { - "browserify": "^13.0.0", - "coveralls": "^2.11.6", - "eslint": "^2.2.0", - "istanbul": "^0.4.2", - "jscs": "~2.10.0", - "mocha": "~2.4.2", - "uglify-js": "^2.6.1" - }, - "directories": {}, - "dist": { - "shasum": "51fbb5347e50e81e6ed51668a48490ae6fe2afe2", - "tarball": "https://registry.npmjs.org/csso/-/csso-2.2.1.tgz" - }, - "engines": { - "node": ">=0.10.0" - }, - "eslintConfig": { - "env": { - "node": true, - "mocha": true, - "es6": true - }, - "rules": { - "no-duplicate-case": 2, - "no-undef": 2, - "no-unused-vars": [ - 2, - { - "vars": "all", - "args": "after-used" - } - ] - } - }, - "files": [ - "bin", - "dist/csso-browser.js", - "lib", - "HISTORY.md", - "LICENSE", - "README.md" - ], - "gitHead": "62bf7207f117e4726decc8f1da272e77ac0f3ea5", - "homepage": "https://github.com/css/csso", - "keywords": [ - "css", - "minifier", - "minify", - "compress", - "optimisation" - ], - "license": "MIT", - "main": "./lib/index", - "maintainers": [ - { - "name": "afelix", - "email": "skryzhanovsky@gmail.com" - }, - { - "name": "lahmatiy", - "email": "rdvornov@gmail.com" - }, - { - "name": "tadatuta", - "email": "i@tadatuta.com" - } - ], - "name": "csso", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/css/csso.git" - }, - "scripts": { - "browserify": "browserify --standalone csso lib/index.js | uglifyjs --compress --mangle -o dist/csso-browser.js", - "codestyle": "jscs lib && eslint lib test", - "codestyle-and-test": "npm run codestyle && npm test", - "coverage": "istanbul cover _mocha -- -R dot", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | coveralls", - "gh-pages": "git clone -b gh-pages https://github.com/css/csso.git .gh-pages && npm run browserify && cp dist/csso-browser.js .gh-pages/ && cd .gh-pages && git commit -am \"update\" && git push && cd .. && rm -rf .gh-pages", - "hydrogen": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/csso --stat -o /dev/null", - "prepublish": "npm run browserify", - "test": "mocha --reporter dot", - "travis": "npm run codestyle-and-test && npm run coveralls" - }, - "version": "2.2.1" -} diff --git a/node_modules/date-now/.npmignore b/node_modules/date-now/.npmignore deleted file mode 100644 index aa3fd4b..0000000 --- a/node_modules/date-now/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -.DS_Store -.monitor -.*.swp -.nodemonignore -releases -*.log -*.err -fleet.json -public/browserify -bin/*.json -.bin -build -compile -.lock-wscript diff --git a/node_modules/date-now/.testem.json b/node_modules/date-now/.testem.json deleted file mode 100644 index 633c2ba..0000000 --- a/node_modules/date-now/.testem.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "launchers": { - "node": { - "command": "npm test" - } - }, - "src_files": [ - "./**/*.js" - ], - "before_tests": "npm run build", - "on_exit": "rm test/static/bundle.js", - "test_page": "test/static/index.html", - "launch_in_dev": ["node", "phantomjs"] -} diff --git a/node_modules/date-now/.travis.yml b/node_modules/date-now/.travis.yml deleted file mode 100644 index ed178f6..0000000 --- a/node_modules/date-now/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.9 diff --git a/node_modules/date-now/LICENCE b/node_modules/date-now/LICENCE deleted file mode 100644 index 822d880..0000000 --- a/node_modules/date-now/LICENCE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Colingo. - -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/date-now/README.md b/node_modules/date-now/README.md deleted file mode 100644 index 22d2675..0000000 --- a/node_modules/date-now/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# date-now - -[![build status][1]][2] - -[![browser support][3]][4] - -A requirable version of Date.now() - -Use-case is to be able to mock out Date.now() using require interception. - -## Example - -```js -var now = require("date-now") - -var ts = now() -var ts2 = Date.now() -assert.equal(ts, ts2) -``` - -## example of seed - -``` -var now = require("date-now/seed")(timeStampFromServer) - -// ts is in "sync" with the seed value from the server -// useful if your users have their local time being a few minutes -// out of your server time. -var ts = now() -``` - -## Installation - -`npm install date-now` - -## Contributors - - - Raynos - -## MIT Licenced - - [1]: https://secure.travis-ci.org/Colingo/date-now.png - [2]: http://travis-ci.org/Colingo/date-now - [3]: http://ci.testling.com/Colingo/date-now.png - [4]: http://ci.testling.com/Colingo/date-now diff --git a/node_modules/date-now/index.js b/node_modules/date-now/index.js deleted file mode 100644 index d5f143a..0000000 --- a/node_modules/date-now/index.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = now - -function now() { - return new Date().getTime() -} diff --git a/node_modules/date-now/package.json b/node_modules/date-now/package.json deleted file mode 100644 index 45a5188..0000000 --- a/node_modules/date-now/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "date-now@^0.1.4", - "scope": null, - "escapedName": "date-now", - "name": "date-now", - "rawSpec": "^0.1.4", - "spec": ">=0.1.4 <0.2.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/console-browserify" - ] - ], - "_from": "date-now@>=0.1.4 <0.2.0", - "_id": "date-now@0.1.4", - "_inCache": true, - "_location": "/date-now", - "_npmUser": { - "name": "raynos", - "email": "raynos2@gmail.com" - }, - "_npmVersion": "1.2.3", - "_phantomChildren": {}, - "_requested": { - "raw": "date-now@^0.1.4", - "scope": null, - "escapedName": "date-now", - "name": "date-now", - "rawSpec": "^0.1.4", - "spec": ">=0.1.4 <0.2.0", - "type": "range" - }, - "_requiredBy": [ - "/console-browserify" - ], - "_resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "_shasum": "eaf439fd4d4848ad74e5cc7dbef200672b9e345b", - "_shrinkwrap": null, - "_spec": "date-now@^0.1.4", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/console-browserify", - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "bugs": { - "url": "https://github.com/Colingo/date-now/issues", - "email": "raynos2@gmail.com" - }, - "contributors": [ - { - "name": "Artem Shoobovych" - } - ], - "dependencies": {}, - "description": "A requirable version of Date.now()", - "devDependencies": { - "browserify": "https://github.com/raynos/node-browserify/tarball/master", - "tape": "~0.2.2", - "testem": "~0.2.52" - }, - "directories": {}, - "dist": { - "shasum": "eaf439fd4d4848ad74e5cc7dbef200672b9e345b", - "tarball": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz" - }, - "homepage": "https://github.com/Colingo/date-now", - "keywords": [], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/Colingo/date-now/raw/master/LICENSE" - } - ], - "main": "index", - "maintainers": [ - { - "name": "raynos", - "email": "raynos2@gmail.com" - } - ], - "name": "date-now", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/Colingo/date-now.git" - }, - "scripts": { - "build": "browserify test/index.js -o test/static/bundle.js", - "test": "node ./test", - "testem": "testem" - }, - "testling": { - "files": "test/*.js", - "browsers": { - "ie": [ - "8", - "9", - "10" - ], - "firefox": [ - "16", - "17", - "nightly" - ], - "chrome": [ - "22", - "23", - "canary" - ], - "opera": [ - "12", - "next" - ], - "safari": [ - "5.1" - ] - } - }, - "version": "0.1.4" -} diff --git a/node_modules/date-now/seed.js b/node_modules/date-now/seed.js deleted file mode 100644 index b9727c5..0000000 --- a/node_modules/date-now/seed.js +++ /dev/null @@ -1,16 +0,0 @@ -var now = require("./index") - -module.exports = seeded - -/* Returns a Date.now() like function that's in sync with - the seed value -*/ -function seeded(seed) { - var current = now() - - return time - - function time() { - return seed + (now() - current) - } -} diff --git a/node_modules/date-now/test/index.js b/node_modules/date-now/test/index.js deleted file mode 100644 index 270584c..0000000 --- a/node_modules/date-now/test/index.js +++ /dev/null @@ -1,28 +0,0 @@ -var test = require("tape") -var setTimeout = require("timers").setTimeout - -var now = require("../index") -var seeded = require("../seed") - -test("date", function (assert) { - var ts = now() - var ts2 = Date.now() - assert.equal(ts, ts2) - assert.end() -}) - -test("seeded", function (assert) { - var time = seeded(40) - var ts = time() - - within(assert, time(), 40, 5) - setTimeout(function () { - within(assert, time(), 90, 10) - assert.end() - }, 50) -}) - -function within(assert, a, b, offset) { - assert.ok(a + offset > b) - assert.ok(a - offset < b) -} diff --git a/node_modules/date-now/test/static/index.html b/node_modules/date-now/test/static/index.html deleted file mode 100644 index 3d5384d..0000000 --- a/node_modules/date-now/test/static/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - TAPE Example - - - - - - diff --git a/node_modules/debug/.jshintrc b/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f..0000000 --- a/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/node_modules/debug/.npmignore b/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163d..0000000 --- a/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/node_modules/debug/History.md b/node_modules/debug/History.md deleted file mode 100644 index 854c971..0000000 --- a/node_modules/debug/History.md +++ /dev/null @@ -1,195 +0,0 @@ - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/debug/Makefile b/node_modules/debug/Makefile deleted file mode 100644 index 5cf4a59..0000000 --- a/node_modules/debug/Makefile +++ /dev/null @@ -1,36 +0,0 @@ - -# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 -THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) - -# BIN directory -BIN := $(THIS_DIR)/node_modules/.bin - -# applications -NODE ?= $(shell which node) -NPM ?= $(NODE) $(shell which npm) -BROWSERIFY ?= $(NODE) $(BIN)/browserify - -all: dist/debug.js - -install: node_modules - -clean: - @rm -rf dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -distclean: clean - @rm -rf node_modules - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean distclean diff --git a/node_modules/debug/Readme.md b/node_modules/debug/Readme.md deleted file mode 100644 index b4f45e3..0000000 --- a/node_modules/debug/Readme.md +++ /dev/null @@ -1,188 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -#### Windows note - - On Windows the environment variable is set using the `set` command. - - ```cmd - set DEBUG=*,-not_this - ``` - -Then, run the program to be debugged as usual. - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: - -```js -window.myDebug = require("debug"); -``` - - ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: - -```js -myDebug.enable("worker:*") -``` - - Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, Firefox ([since version - 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) - and the Firebug plugin for Firefox (any version). - - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stdout.js_: - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -### Save debug output to a file - -You can save all debug statements to a file by piping them. - -Example: - -```bash -$ DEBUG_FD=3 node your-app.js 3> whatever.log -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 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/debug/bower.json b/node_modules/debug/bower.json deleted file mode 100644 index 6af573f..0000000 --- a/node_modules/debug/bower.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "visionmedia-debug", - "main": "dist/debug.js", - "version": "2.2.0", - "homepage": "https://github.com/visionmedia/debug", - "authors": [ - "TJ Holowaychuk " - ], - "description": "visionmedia-debug", - "moduleType": [ - "amd", - "es6", - "globals", - "node" - ], - "keywords": [ - "visionmedia", - "debug" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/node_modules/debug/browser.js b/node_modules/debug/browser.js deleted file mode 100644 index 7c76452..0000000 --- a/node_modules/debug/browser.js +++ /dev/null @@ -1,168 +0,0 @@ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage(){ - try { - return window.localStorage; - } catch (e) {} -} diff --git a/node_modules/debug/component.json b/node_modules/debug/component.json deleted file mode 100644 index ca10637..0000000 --- a/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "2.2.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "rauchg/ms.js": "0.7.1" - } -} diff --git a/node_modules/debug/debug.js b/node_modules/debug/debug.js deleted file mode 100644 index 7571a86..0000000 --- a/node_modules/debug/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/node_modules/debug/node.js b/node_modules/debug/node.js deleted file mode 100644 index 1d392a8..0000000 --- a/node_modules/debug/node.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Module dependencies. - */ - -var tty = require('tty'); -var util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[3' + c + ';1m' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = require('fs'); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = require('net'); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json deleted file mode 100644 index cac74ef..0000000 --- a/node_modules/debug/package.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "debug@~2.2.0", - "scope": null, - "escapedName": "debug", - "name": "debug", - "rawSpec": "~2.2.0", - "spec": ">=2.2.0 <2.3.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/compression" - ] - ], - "_from": "debug@>=2.2.0 <2.3.0", - "_id": "debug@2.2.0", - "_inCache": true, - "_location": "/debug", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "_npmVersion": "2.7.4", - "_phantomChildren": {}, - "_requested": { - "raw": "debug@~2.2.0", - "scope": null, - "escapedName": "debug", - "name": "debug", - "rawSpec": "~2.2.0", - "spec": ">=2.2.0 <2.3.0", - "type": "range" - }, - "_requiredBy": [ - "/compression", - "/express", - "/finalhandler", - "/send", - "/serve-index", - "/sockjs-client" - ], - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "_shrinkwrap": null, - "_spec": "debug@~2.2.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/compression", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "browser": "./browser.js", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - } - ], - "dependencies": { - "ms": "0.7.1" - }, - "description": "small debugging utility", - "devDependencies": { - "browserify": "9.0.3", - "mocha": "*" - }, - "directories": {}, - "dist": { - "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "tarball": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz" - }, - "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", - "homepage": "https://github.com/visionmedia/debug", - "keywords": [ - "debug", - "log", - "debugger" - ], - "license": "MIT", - "main": "./node.js", - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "name": "debug", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "scripts": {}, - "version": "2.2.0" -} diff --git a/node_modules/decamelize/index.js b/node_modules/decamelize/index.js deleted file mode 100644 index 8d5bab7..0000000 --- a/node_modules/decamelize/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; -module.exports = function (str, sep) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - sep = typeof sep === 'undefined' ? '_' : sep; - - return str - .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2') - .toLowerCase(); -}; diff --git a/node_modules/decamelize/license b/node_modules/decamelize/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/decamelize/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.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/decamelize/package.json b/node_modules/decamelize/package.json deleted file mode 100644 index f37b3d0..0000000 --- a/node_modules/decamelize/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "decamelize@^1.0.0", - "scope": null, - "escapedName": "decamelize", - "name": "decamelize", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/yargs" - ] - ], - "_from": "decamelize@>=1.0.0 <2.0.0", - "_id": "decamelize@1.2.0", - "_inCache": true, - "_location": "/decamelize", - "_nodeVersion": "4.3.0", - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/decamelize-1.2.0.tgz_1457167749082_0.9810893186368048" - }, - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "_npmVersion": "3.8.0", - "_phantomChildren": {}, - "_requested": { - "raw": "decamelize@^1.0.0", - "scope": null, - "escapedName": "decamelize", - "name": "decamelize", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "_requiredBy": [ - "/yargs" - ], - "_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "_shasum": "f6534d15148269b20352e7bee26f501f9a191290", - "_shrinkwrap": null, - "_spec": "decamelize@^1.0.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/yargs", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/decamelize/issues" - }, - "dependencies": {}, - "description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "directories": {}, - "dist": { - "shasum": "f6534d15148269b20352e7bee26f501f9a191290", - "tarball": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "gitHead": "95980ab6fb44c40eaca7792bdf93aff7c210c805", - "homepage": "https://github.com/sindresorhus/decamelize#readme", - "keywords": [ - "decamelize", - "decamelcase", - "camelcase", - "lowercase", - "case", - "dash", - "hyphen", - "string", - "str", - "text", - "convert" - ], - "license": "MIT", - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "name": "decamelize", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/decamelize.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "1.2.0" -} diff --git a/node_modules/decamelize/readme.md b/node_modules/decamelize/readme.md deleted file mode 100644 index 624c7ee..0000000 --- a/node_modules/decamelize/readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# decamelize [![Build Status](https://travis-ci.org/sindresorhus/decamelize.svg?branch=master)](https://travis-ci.org/sindresorhus/decamelize) - -> Convert a camelized string into a lowercased one with a custom separator
-> Example: `unicornRainbow` → `unicorn_rainbow` - - -## Install - -``` -$ npm install --save decamelize -``` - - -## Usage - -```js -const decamelize = require('decamelize'); - -decamelize('unicornRainbow'); -//=> 'unicorn_rainbow' - -decamelize('unicornRainbow', '-'); -//=> 'unicorn-rainbow' -``` - - -## API - -### decamelize(input, [separator]) - -#### input - -Type: `string` - -#### separator - -Type: `string`
-Default: `_` - - -## Related - -See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/defined/.travis.yml b/node_modules/defined/.travis.yml deleted file mode 100644 index 895dbd3..0000000 --- a/node_modules/defined/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 diff --git a/node_modules/defined/LICENSE b/node_modules/defined/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/defined/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under 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/defined/example/defined.js b/node_modules/defined/example/defined.js deleted file mode 100644 index 7b5d982..0000000 --- a/node_modules/defined/example/defined.js +++ /dev/null @@ -1,4 +0,0 @@ -var defined = require('../'); -var opts = { y : false, w : 4 }; -var x = defined(opts.x, opts.y, opts.w, 8); -console.log(x); diff --git a/node_modules/defined/index.js b/node_modules/defined/index.js deleted file mode 100644 index f8a2219..0000000 --- a/node_modules/defined/index.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function () { - for (var i = 0; i < arguments.length; i++) { - if (arguments[i] !== undefined) return arguments[i]; - } -}; diff --git a/node_modules/defined/package.json b/node_modules/defined/package.json deleted file mode 100644 index c2eefe9..0000000 --- a/node_modules/defined/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "defined@^1.0.0", - "scope": null, - "escapedName": "defined", - "name": "defined", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/cssnano" - ] - ], - "_from": "defined@>=1.0.0 <2.0.0", - "_id": "defined@1.0.0", - "_inCache": true, - "_location": "/defined", - "_nodeVersion": "0.12.0", - "_npmUser": { - "name": "substack", - "email": "mail@substack.net" - }, - "_npmVersion": "2.7.5", - "_phantomChildren": {}, - "_requested": { - "raw": "defined@^1.0.0", - "scope": null, - "escapedName": "defined", - "name": "defined", - "rawSpec": "^1.0.0", - "spec": ">=1.0.0 <2.0.0", - "type": "range" - }, - "_requiredBy": [ - "/cssnano" - ], - "_resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "_shasum": "c98d9bcef75674188e110969151199e39b1fa693", - "_shrinkwrap": null, - "_spec": "defined@^1.0.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/cssnano", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "bugs": { - "url": "https://github.com/substack/defined/issues" - }, - "dependencies": {}, - "description": "return the first argument that is `!== undefined`", - "devDependencies": { - "tape": "~3.5.0" - }, - "directories": { - "example": "example", - "test": "test" - }, - "dist": { - "shasum": "c98d9bcef75674188e110969151199e39b1fa693", - "tarball": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz" - }, - "gitHead": "3a46c81d39b5f94c0c17c47638939af2528520f3", - "homepage": "https://github.com/substack/defined", - "keywords": [ - "undefined", - "short-circuit", - "||", - "or", - "//", - "defined-or" - ], - "license": "MIT", - "main": "index.js", - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "name": "defined", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/substack/defined.git" - }, - "scripts": { - "test": "tape test/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": { - "ie": [ - 6, - 7, - 8, - 9 - ], - "ff": [ - 3.5, - 10, - 15 - ], - "chrome": [ - 10, - 22 - ], - "safari": [ - 5.1 - ], - "opera": [ - 12 - ] - } - }, - "version": "1.0.0" -} diff --git a/node_modules/defined/readme.markdown b/node_modules/defined/readme.markdown deleted file mode 100644 index 9616195..0000000 --- a/node_modules/defined/readme.markdown +++ /dev/null @@ -1,53 +0,0 @@ -# defined - -return the first argument that is `!== undefined` - -[![browser support](http://ci.testling.com/substack/defined.png)](http://ci.testling.com/substack/defined) - -[![build status](https://secure.travis-ci.org/substack/defined.png)](http://travis-ci.org/substack/defined) - -Most of the time when I chain together `||`s, I actually just want the first -item that is not `undefined`, not the first non-falsy item. - -This module is like the defined-or (`//`) operator in perl 5.10+. - -# example - -``` js -var defined = require('defined'); -var opts = { y : false, w : 4 }; -var x = defined(opts.x, opts.y, opts.w, 100); -console.log(x); -``` - -``` -$ node example/defined.js -false -``` - -The return value is `false` because `false` is the first item that is -`!== undefined`. - -# methods - -``` js -var defined = require('defined') -``` - -## var x = defined(a, b, c...) - -Return the first item in the argument list `a, b, c...` that is `!== undefined`. - -If all the items are `=== undefined`, return undefined. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install defined -``` - -# license - -MIT diff --git a/node_modules/defined/test/def.js b/node_modules/defined/test/def.js deleted file mode 100644 index 48da517..0000000 --- a/node_modules/defined/test/def.js +++ /dev/null @@ -1,22 +0,0 @@ -var defined = require('../'); -var test = require('tape'); - -test('defined-or', function (t) { - var u = undefined; - - t.equal(defined(), u, 'empty arguments'); - t.equal(defined(u), u, '1 undefined'); - t.equal(defined(u, u), u, '2 undefined'); - t.equal(defined(u, u, u, u), u, '4 undefineds'); - - t.equal(defined(undefined, false, true), false, 'false[0]'); - t.equal(defined(false, true), false, 'false[1]'); - t.equal(defined(undefined, 0, true), 0, 'zero[0]'); - t.equal(defined(0, true), 0, 'zero[1]'); - - t.equal(defined(3, undefined, 4), 3, 'first arg'); - t.equal(defined(undefined, 3, 4), 3, 'second arg'); - t.equal(defined(undefined, undefined, 3), 3, 'third arg'); - - t.end(); -}); diff --git a/node_modules/defined/test/falsy.js b/node_modules/defined/test/falsy.js deleted file mode 100644 index 6b7d623..0000000 --- a/node_modules/defined/test/falsy.js +++ /dev/null @@ -1,9 +0,0 @@ -var test = require('tape'); -var defined = require('../'); - -test('falsy', function (t) { - t.plan(1); - var opts = { y : false, w : 4 }; - var x = defined(opts.x, opts.y, opts.w, 8); - t.equal(x, false); -}); diff --git a/node_modules/depd/History.md b/node_modules/depd/History.md deleted file mode 100644 index ace1171..0000000 --- a/node_modules/depd/History.md +++ /dev/null @@ -1,84 +0,0 @@ -1.1.0 / 2015-09-14 -================== - - * Enable strict mode in more places - * Support io.js 3.x - * Support io.js 2.x - * Support web browser loading - - Requires bundler like Browserify or webpack - -1.0.1 / 2015-04-07 -================== - - * Fix `TypeError`s when under `'use strict'` code - * Fix useless type name on auto-generated messages - * Support io.js 1.x - * Support Node.js 0.12 - -1.0.0 / 2014-09-17 -================== - - * No changes - -0.4.5 / 2014-09-09 -================== - - * Improve call speed to functions using the function wrapper - * Support Node.js 0.6 - -0.4.4 / 2014-07-27 -================== - - * Work-around v8 generating empty stack traces - -0.4.3 / 2014-07-26 -================== - - * Fix exception when global `Error.stackTraceLimit` is too low - -0.4.2 / 2014-07-19 -================== - - * Correct call site for wrapped functions and properties - -0.4.1 / 2014-07-19 -================== - - * Improve automatic message generation for function properties - -0.4.0 / 2014-07-19 -================== - - * Add `TRACE_DEPRECATION` environment variable - * Remove non-standard grey color from color output - * Support `--no-deprecation` argument - * Support `--trace-deprecation` argument - * Support `deprecate.property(fn, prop, message)` - -0.3.0 / 2014-06-16 -================== - - * Add `NO_DEPRECATION` environment variable - -0.2.0 / 2014-06-15 -================== - - * Add `deprecate.property(obj, prop, message)` - * Remove `supports-color` dependency for node.js 0.8 - -0.1.0 / 2014-06-15 -================== - - * Add `deprecate.function(fn, message)` - * Add `process.on('deprecation', fn)` emitter - * Automatically generate message when omitted from `deprecate()` - -0.0.1 / 2014-06-15 -================== - - * Fix warning for dynamic calls at singe call site - -0.0.0 / 2014-06-15 -================== - - * Initial implementation diff --git a/node_modules/depd/LICENSE b/node_modules/depd/LICENSE deleted file mode 100644 index 142ede3..0000000 --- a/node_modules/depd/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014-2015 Douglas Christopher Wilson - -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/depd/Readme.md b/node_modules/depd/Readme.md deleted file mode 100644 index 09bb979..0000000 --- a/node_modules/depd/Readme.md +++ /dev/null @@ -1,281 +0,0 @@ -# depd - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-image]][node-url] -[![Linux Build][travis-image]][travis-url] -[![Windows Build][appveyor-image]][appveyor-url] -[![Coverage Status][coveralls-image]][coveralls-url] -[![Gratipay][gratipay-image]][gratipay-url] - -Deprecate all the things - -> With great modules comes great responsibility; mark things deprecated! - -## Install - -This module is installed directly using `npm`: - -```sh -$ npm install depd -``` - -This module can also be bundled with systems like -[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/), -though by default this module will alter it's API to no longer display or -track deprecations. - -## API - -```js -var deprecate = require('depd')('my-module') -``` - -This library allows you to display deprecation messages to your users. -This library goes above and beyond with deprecation warnings by -introspection of the call stack (but only the bits that it is interested -in). - -Instead of just warning on the first invocation of a deprecated -function and never again, this module will warn on the first invocation -of a deprecated function per unique call site, making it ideal to alert -users of all deprecated uses across the code base, rather than just -whatever happens to execute first. - -The deprecation warnings from this module also include the file and line -information for the call into the module that the deprecated function was -in. - -**NOTE** this library has a similar interface to the `debug` module, and -this module uses the calling file to get the boundary for the call stacks, -so you should always create a new `deprecate` object in each file and not -within some central file. - -### depd(namespace) - -Create a new deprecate function that uses the given namespace name in the -messages and will display the call site prior to the stack entering the -file this function was called from. It is highly suggested you use the -name of your module as the namespace. - -### deprecate(message) - -Call this function from deprecated code to display a deprecation message. -This message will appear once per unique caller site. Caller site is the -first call site in the stack in a different file from the caller of this -function. - -If the message is omitted, a message is generated for you based on the site -of the `deprecate()` call and will display the name of the function called, -similar to the name displayed in a stack trace. - -### deprecate.function(fn, message) - -Call this function to wrap a given function in a deprecation message on any -call to the function. An optional message can be supplied to provide a custom -message. - -### deprecate.property(obj, prop, message) - -Call this function to wrap a given property on object in a deprecation message -on any accessing or setting of the property. An optional message can be supplied -to provide a custom message. - -The method must be called on the object where the property belongs (not -inherited from the prototype). - -If the property is a data descriptor, it will be converted to an accessor -descriptor in order to display the deprecation message. - -### process.on('deprecation', fn) - -This module will allow easy capturing of deprecation errors by emitting the -errors as the type "deprecation" on the global `process`. If there are no -listeners for this type, the errors are written to STDERR as normal, but if -there are any listeners, nothing will be written to STDERR and instead only -emitted. From there, you can write the errors in a different format or to a -logging source. - -The error represents the deprecation and is emitted only once with the same -rules as writing to STDERR. The error has the following properties: - - - `message` - This is the message given by the library - - `name` - This is always `'DeprecationError'` - - `namespace` - This is the namespace the deprecation came from - - `stack` - This is the stack of the call to the deprecated thing - -Example `error.stack` output: - -``` -DeprecationError: my-cool-module deprecated oldfunction - at Object. ([eval]-wrapper:6:22) - at Module._compile (module.js:456:26) - at evalScript (node.js:532:25) - at startup (node.js:80:7) - at node.js:902:3 -``` - -### process.env.NO_DEPRECATION - -As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` -is provided as a quick solution to silencing deprecation warnings from being -output. The format of this is similar to that of `DEBUG`: - -```sh -$ NO_DEPRECATION=my-module,othermod node app.js -``` - -This will suppress deprecations from being output for "my-module" and "othermod". -The value is a list of comma-separated namespaces. To suppress every warning -across all namespaces, use the value `*` for a namespace. - -Providing the argument `--no-deprecation` to the `node` executable will suppress -all deprecations (only available in Node.js 0.8 or higher). - -**NOTE** This will not suppress the deperecations given to any "deprecation" -event listeners, just the output to STDERR. - -### process.env.TRACE_DEPRECATION - -As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` -is provided as a solution to getting more detailed location information in deprecation -warnings by including the entire stack trace. The format of this is the same as -`NO_DEPRECATION`: - -```sh -$ TRACE_DEPRECATION=my-module,othermod node app.js -``` - -This will include stack traces for deprecations being output for "my-module" and -"othermod". The value is a list of comma-separated namespaces. To trace every -warning across all namespaces, use the value `*` for a namespace. - -Providing the argument `--trace-deprecation` to the `node` executable will trace -all deprecations (only available in Node.js 0.8 or higher). - -**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. - -## Display - -![message](files/message.png) - -When a user calls a function in your library that you mark deprecated, they -will see the following written to STDERR (in the given colors, similar colors -and layout to the `debug` module): - -``` -bright cyan bright yellow -| | reset cyan -| | | | -▼ ▼ ▼ ▼ -my-cool-module deprecated oldfunction [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ -| | | | -namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -If the user redirects their STDERR to a file or somewhere that does not support -colors, they see (similar layout to the `debug` module): - -``` -Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ ▲ -| | | | | -timestamp of message namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -## Examples - -### Deprecating all calls to a function - -This will display a deprecated message about "oldfunction" being deprecated -from "my-module" on STDERR. - -```js -var deprecate = require('depd')('my-cool-module') - -// message automatically derived from function name -// Object.oldfunction -exports.oldfunction = deprecate.function(function oldfunction() { - // all calls to function are deprecated -}) - -// specific message -exports.oldfunction = deprecate.function(function () { - // all calls to function are deprecated -}, 'oldfunction') -``` - -### Conditionally deprecating a function call - -This will display a deprecated message about "weirdfunction" being deprecated -from "my-module" on STDERR when called with less than 2 arguments. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } -} -``` - -When calling `deprecate` as a function, the warning is counted per call site -within your own module, so you can display different deprecations depending -on different situations and the users will still get all the warnings: - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } else if (typeof arguments[0] !== 'string') { - // calls with non-string first argument are deprecated - deprecate('weirdfunction non-string first arg') - } -} -``` - -### Deprecating property access - -This will display a deprecated message about "oldprop" being deprecated -from "my-module" on STDERR when accessed. A deprecation will be displayed -when setting the value and when getting the value. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.oldprop = 'something' - -// message automatically derives from property name -deprecate.property(exports, 'oldprop') - -// explicit message -deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') -``` - -## License - -[MIT](LICENSE) - -[npm-version-image]: https://img.shields.io/npm/v/depd.svg -[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg -[npm-url]: https://npmjs.org/package/depd -[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd/master.svg?label=linux -[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd -[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/nodejs-depd/master.svg?label=windows -[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd -[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg -[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master -[node-image]: https://img.shields.io/node/v/depd.svg -[node-url]: http://nodejs.org/download/ -[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg -[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/depd/index.js b/node_modules/depd/index.js deleted file mode 100644 index fddcae8..0000000 --- a/node_modules/depd/index.js +++ /dev/null @@ -1,521 +0,0 @@ -/*! - * depd - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var callSiteToString = require('./lib/compat').callSiteToString -var eventListenerCount = require('./lib/compat').eventListenerCount -var relative = require('path').relative - -/** - * Module exports. - */ - -module.exports = depd - -/** - * Get the path to base files on. - */ - -var basePath = process.cwd() - -/** - * Determine if namespace is contained in the string. - */ - -function containsNamespace(str, namespace) { - var val = str.split(/[ ,]+/) - - namespace = String(namespace).toLowerCase() - - for (var i = 0 ; i < val.length; i++) { - if (!(str = val[i])) continue; - - // namespace contained - if (str === '*' || str.toLowerCase() === namespace) { - return true - } - } - - return false -} - -/** - * Convert a data descriptor to accessor descriptor. - */ - -function convertDataDescriptorToAccessor(obj, prop, message) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - var value = descriptor.value - - descriptor.get = function getter() { return value } - - if (descriptor.writable) { - descriptor.set = function setter(val) { return value = val } - } - - delete descriptor.value - delete descriptor.writable - - Object.defineProperty(obj, prop, descriptor) - - return descriptor -} - -/** - * Create arguments string to keep arity. - */ - -function createArgumentsString(arity) { - var str = '' - - for (var i = 0; i < arity; i++) { - str += ', arg' + i - } - - return str.substr(2) -} - -/** - * Create stack string from stack. - */ - -function createStackString(stack) { - var str = this.name + ': ' + this.namespace - - if (this.message) { - str += ' deprecated ' + this.message - } - - for (var i = 0; i < stack.length; i++) { - str += '\n at ' + callSiteToString(stack[i]) - } - - return str -} - -/** - * Create deprecate for namespace in caller. - */ - -function depd(namespace) { - if (!namespace) { - throw new TypeError('argument namespace is required') - } - - var stack = getStack() - var site = callSiteLocation(stack[1]) - var file = site[0] - - function deprecate(message) { - // call to self as log - log.call(deprecate, message) - } - - deprecate._file = file - deprecate._ignored = isignored(namespace) - deprecate._namespace = namespace - deprecate._traced = istraced(namespace) - deprecate._warned = Object.create(null) - - deprecate.function = wrapfunction - deprecate.property = wrapproperty - - return deprecate -} - -/** - * Determine if namespace is ignored. - */ - -function isignored(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.noDeprecation) { - // --no-deprecation support - return true - } - - var str = process.env.NO_DEPRECATION || '' - - // namespace ignored - return containsNamespace(str, namespace) -} - -/** - * Determine if namespace is traced. - */ - -function istraced(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.traceDeprecation) { - // --trace-deprecation support - return true - } - - var str = process.env.TRACE_DEPRECATION || '' - - // namespace traced - return containsNamespace(str, namespace) -} - -/** - * Display deprecation message. - */ - -function log(message, site) { - var haslisteners = eventListenerCount(process, 'deprecation') !== 0 - - // abort early if no destination - if (!haslisteners && this._ignored) { - return - } - - var caller - var callFile - var callSite - var i = 0 - var seen = false - var stack = getStack() - var file = this._file - - if (site) { - // provided site - callSite = callSiteLocation(stack[1]) - callSite.name = site.name - file = callSite[0] - } else { - // get call site - i = 2 - site = callSiteLocation(stack[i]) - callSite = site - } - - // get caller of deprecated thing in relation to file - for (; i < stack.length; i++) { - caller = callSiteLocation(stack[i]) - callFile = caller[0] - - if (callFile === file) { - seen = true - } else if (callFile === this._file) { - file = this._file - } else if (seen) { - break - } - } - - var key = caller - ? site.join(':') + '__' + caller.join(':') - : undefined - - if (key !== undefined && key in this._warned) { - // already warned - return - } - - this._warned[key] = true - - // generate automatic message from call site - if (!message) { - message = callSite === site || !callSite.name - ? defaultMessage(site) - : defaultMessage(callSite) - } - - // emit deprecation if listeners exist - if (haslisteners) { - var err = DeprecationError(this._namespace, message, stack.slice(i)) - process.emit('deprecation', err) - return - } - - // format and write message - var format = process.stderr.isTTY - ? formatColor - : formatPlain - var msg = format.call(this, message, caller, stack.slice(i)) - process.stderr.write(msg + '\n', 'utf8') - - return -} - -/** - * Get call site location as array. - */ - -function callSiteLocation(callSite) { - var file = callSite.getFileName() || '' - var line = callSite.getLineNumber() - var colm = callSite.getColumnNumber() - - if (callSite.isEval()) { - file = callSite.getEvalOrigin() + ', ' + file - } - - var site = [file, line, colm] - - site.callSite = callSite - site.name = callSite.getFunctionName() - - return site -} - -/** - * Generate a default message from the site. - */ - -function defaultMessage(site) { - var callSite = site.callSite - var funcName = site.name - - // make useful anonymous name - if (!funcName) { - funcName = '' - } - - var context = callSite.getThis() - var typeName = context && callSite.getTypeName() - - // ignore useless type name - if (typeName === 'Object') { - typeName = undefined - } - - // make useful type name - if (typeName === 'Function') { - typeName = context.name || typeName - } - - return typeName && callSite.getMethodName() - ? typeName + '.' + funcName - : funcName -} - -/** - * Format deprecation message without color. - */ - -function formatPlain(msg, caller, stack) { - var timestamp = new Date().toUTCString() - - var formatted = timestamp - + ' ' + this._namespace - + ' deprecated ' + msg - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n at ' + callSiteToString(stack[i]) - } - - return formatted - } - - if (caller) { - formatted += ' at ' + formatLocation(caller) - } - - return formatted -} - -/** - * Format deprecation message with color. - */ - -function formatColor(msg, caller, stack) { - var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan - + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow - + ' \x1b[0m' + msg + '\x1b[39m' // reset - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan - } - - return formatted - } - - if (caller) { - formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan - } - - return formatted -} - -/** - * Format call site location. - */ - -function formatLocation(callSite) { - return relative(basePath, callSite[0]) - + ':' + callSite[1] - + ':' + callSite[2] -} - -/** - * Get the stack as array of call sites. - */ - -function getStack() { - var limit = Error.stackTraceLimit - var obj = {} - var prep = Error.prepareStackTrace - - Error.prepareStackTrace = prepareObjectStackTrace - Error.stackTraceLimit = Math.max(10, limit) - - // capture the stack - Error.captureStackTrace(obj) - - // slice this function off the top - var stack = obj.stack.slice(1) - - Error.prepareStackTrace = prep - Error.stackTraceLimit = limit - - return stack -} - -/** - * Capture call site stack from v8. - */ - -function prepareObjectStackTrace(obj, stack) { - return stack -} - -/** - * Return a wrapped function in a deprecation message. - */ - -function wrapfunction(fn, message) { - if (typeof fn !== 'function') { - throw new TypeError('argument fn must be a function') - } - - var args = createArgumentsString(fn.length) - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - site.name = fn.name - - var deprecatedfn = eval('(function (' + args + ') {\n' - + '"use strict"\n' - + 'log.call(deprecate, message, site)\n' - + 'return fn.apply(this, arguments)\n' - + '})') - - return deprecatedfn -} - -/** - * Wrap property in a deprecation message. - */ - -function wrapproperty(obj, prop, message) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new TypeError('argument obj must be object') - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - - if (!descriptor) { - throw new TypeError('must call property on owner object') - } - - if (!descriptor.configurable) { - throw new TypeError('property must be configurable') - } - - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - // set site name - site.name = prop - - // convert data descriptor - if ('value' in descriptor) { - descriptor = convertDataDescriptorToAccessor(obj, prop, message) - } - - var get = descriptor.get - var set = descriptor.set - - // wrap getter - if (typeof get === 'function') { - descriptor.get = function getter() { - log.call(deprecate, message, site) - return get.apply(this, arguments) - } - } - - // wrap setter - if (typeof set === 'function') { - descriptor.set = function setter() { - log.call(deprecate, message, site) - return set.apply(this, arguments) - } - } - - Object.defineProperty(obj, prop, descriptor) -} - -/** - * Create DeprecationError for deprecation - */ - -function DeprecationError(namespace, message, stack) { - var error = new Error() - var stackString - - Object.defineProperty(error, 'constructor', { - value: DeprecationError - }) - - Object.defineProperty(error, 'message', { - configurable: true, - enumerable: false, - value: message, - writable: true - }) - - Object.defineProperty(error, 'name', { - enumerable: false, - configurable: true, - value: 'DeprecationError', - writable: true - }) - - Object.defineProperty(error, 'namespace', { - configurable: true, - enumerable: false, - value: namespace, - writable: true - }) - - Object.defineProperty(error, 'stack', { - configurable: true, - enumerable: false, - get: function () { - if (stackString !== undefined) { - return stackString - } - - // prepare stack trace - return stackString = createStackString.call(this, stack) - }, - set: function setter(val) { - stackString = val - } - }) - - return error -} diff --git a/node_modules/depd/lib/browser/index.js b/node_modules/depd/lib/browser/index.js deleted file mode 100644 index f464e05..0000000 --- a/node_modules/depd/lib/browser/index.js +++ /dev/null @@ -1,79 +0,0 @@ -/*! - * depd - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - * @public - */ - -module.exports = depd - -/** - * Create deprecate for namespace in caller. - */ - -function depd(namespace) { - if (!namespace) { - throw new TypeError('argument namespace is required') - } - - function deprecate(message) { - // no-op in browser - } - - deprecate._file = undefined - deprecate._ignored = true - deprecate._namespace = namespace - deprecate._traced = false - deprecate._warned = Object.create(null) - - deprecate.function = wrapfunction - deprecate.property = wrapproperty - - return deprecate -} - -/** - * Return a wrapped function in a deprecation message. - * - * This is a no-op version of the wrapper, which does nothing but call - * validation. - */ - -function wrapfunction(fn, message) { - if (typeof fn !== 'function') { - throw new TypeError('argument fn must be a function') - } - - return fn -} - -/** - * Wrap property in a deprecation message. - * - * This is a no-op version of the wrapper, which does nothing but call - * validation. - */ - -function wrapproperty(obj, prop, message) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new TypeError('argument obj must be object') - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - - if (!descriptor) { - throw new TypeError('must call property on owner object') - } - - if (!descriptor.configurable) { - throw new TypeError('property must be configurable') - } - - return -} diff --git a/node_modules/depd/lib/compat/buffer-concat.js b/node_modules/depd/lib/compat/buffer-concat.js deleted file mode 100644 index 4b73381..0000000 --- a/node_modules/depd/lib/compat/buffer-concat.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - */ - -module.exports = bufferConcat - -/** - * Concatenate an array of Buffers. - */ - -function bufferConcat(bufs) { - var length = 0 - - for (var i = 0, len = bufs.length; i < len; i++) { - length += bufs[i].length - } - - var buf = new Buffer(length) - var pos = 0 - - for (var i = 0, len = bufs.length; i < len; i++) { - bufs[i].copy(buf, pos) - pos += bufs[i].length - } - - return buf -} diff --git a/node_modules/depd/lib/compat/callsite-tostring.js b/node_modules/depd/lib/compat/callsite-tostring.js deleted file mode 100644 index 9ecef34..0000000 --- a/node_modules/depd/lib/compat/callsite-tostring.js +++ /dev/null @@ -1,103 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - */ - -module.exports = callSiteToString - -/** - * Format a CallSite file location to a string. - */ - -function callSiteFileLocation(callSite) { - var fileName - var fileLocation = '' - - if (callSite.isNative()) { - fileLocation = 'native' - } else if (callSite.isEval()) { - fileName = callSite.getScriptNameOrSourceURL() - if (!fileName) { - fileLocation = callSite.getEvalOrigin() - } - } else { - fileName = callSite.getFileName() - } - - if (fileName) { - fileLocation += fileName - - var lineNumber = callSite.getLineNumber() - if (lineNumber != null) { - fileLocation += ':' + lineNumber - - var columnNumber = callSite.getColumnNumber() - if (columnNumber) { - fileLocation += ':' + columnNumber - } - } - } - - return fileLocation || 'unknown source' -} - -/** - * Format a CallSite to a string. - */ - -function callSiteToString(callSite) { - var addSuffix = true - var fileLocation = callSiteFileLocation(callSite) - var functionName = callSite.getFunctionName() - var isConstructor = callSite.isConstructor() - var isMethodCall = !(callSite.isToplevel() || isConstructor) - var line = '' - - if (isMethodCall) { - var methodName = callSite.getMethodName() - var typeName = getConstructorName(callSite) - - if (functionName) { - if (typeName && functionName.indexOf(typeName) !== 0) { - line += typeName + '.' - } - - line += functionName - - if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) { - line += ' [as ' + methodName + ']' - } - } else { - line += typeName + '.' + (methodName || '') - } - } else if (isConstructor) { - line += 'new ' + (functionName || '') - } else if (functionName) { - line += functionName - } else { - addSuffix = false - line += fileLocation - } - - if (addSuffix) { - line += ' (' + fileLocation + ')' - } - - return line -} - -/** - * Get constructor name of reviver. - */ - -function getConstructorName(obj) { - var receiver = obj.receiver - return (receiver.constructor && receiver.constructor.name) || null -} diff --git a/node_modules/depd/lib/compat/event-listener-count.js b/node_modules/depd/lib/compat/event-listener-count.js deleted file mode 100644 index a05fceb..0000000 --- a/node_modules/depd/lib/compat/event-listener-count.js +++ /dev/null @@ -1,22 +0,0 @@ -/*! - * depd - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - * @public - */ - -module.exports = eventListenerCount - -/** - * Get the count of listeners on an event emitter of a specific type. - */ - -function eventListenerCount(emitter, type) { - return emitter.listeners(type).length -} diff --git a/node_modules/depd/lib/compat/index.js b/node_modules/depd/lib/compat/index.js deleted file mode 100644 index aa3c1de..0000000 --- a/node_modules/depd/lib/compat/index.js +++ /dev/null @@ -1,84 +0,0 @@ -/*! - * depd - * Copyright(c) 2014-2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var Buffer = require('buffer') -var EventEmitter = require('events').EventEmitter - -/** - * Module exports. - * @public - */ - -lazyProperty(module.exports, 'bufferConcat', function bufferConcat() { - return Buffer.concat || require('./buffer-concat') -}) - -lazyProperty(module.exports, 'callSiteToString', function callSiteToString() { - var limit = Error.stackTraceLimit - var obj = {} - var prep = Error.prepareStackTrace - - function prepareObjectStackTrace(obj, stack) { - return stack - } - - Error.prepareStackTrace = prepareObjectStackTrace - Error.stackTraceLimit = 2 - - // capture the stack - Error.captureStackTrace(obj) - - // slice the stack - var stack = obj.stack.slice() - - Error.prepareStackTrace = prep - Error.stackTraceLimit = limit - - return stack[0].toString ? toString : require('./callsite-tostring') -}) - -lazyProperty(module.exports, 'eventListenerCount', function eventListenerCount() { - return EventEmitter.listenerCount || require('./event-listener-count') -}) - -/** - * Define a lazy property. - */ - -function lazyProperty(obj, prop, getter) { - function get() { - var val = getter() - - Object.defineProperty(obj, prop, { - configurable: true, - enumerable: true, - value: val - }) - - return val - } - - Object.defineProperty(obj, prop, { - configurable: true, - enumerable: true, - get: get - }) -} - -/** - * Call toString() on the obj - */ - -function toString(obj) { - return obj.toString() -} diff --git a/node_modules/depd/package.json b/node_modules/depd/package.json deleted file mode 100644 index cdcf5b5..0000000 --- a/node_modules/depd/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "depd@~1.1.0", - "scope": null, - "escapedName": "depd", - "name": "depd", - "rawSpec": "~1.1.0", - "spec": ">=1.1.0 <1.2.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/express" - ] - ], - "_from": "depd@>=1.1.0 <1.2.0", - "_id": "depd@1.1.0", - "_inCache": true, - "_location": "/depd", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "_npmVersion": "1.4.28", - "_phantomChildren": {}, - "_requested": { - "raw": "depd@~1.1.0", - "scope": null, - "escapedName": "depd", - "name": "depd", - "rawSpec": "~1.1.0", - "spec": ">=1.1.0 <1.2.0", - "type": "range" - }, - "_requiredBy": [ - "/express", - "/send" - ], - "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz", - "_shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3", - "_shrinkwrap": null, - "_spec": "depd@~1.1.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/express", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "browser": "lib/browser/index.js", - "bugs": { - "url": "https://github.com/dougwilson/nodejs-depd/issues" - }, - "dependencies": {}, - "description": "Deprecate all the things", - "devDependencies": { - "beautify-benchmark": "0.2.4", - "benchmark": "1.0.0", - "istanbul": "0.3.5", - "mocha": "~1.21.5" - }, - "directories": {}, - "dist": { - "shasum": "e1bd82c6aab6ced965b97b88b17ed3e528ca18c3", - "tarball": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz" - }, - "engines": { - "node": ">= 0.6" - }, - "files": [ - "lib/", - "History.md", - "LICENSE", - "index.js", - "Readme.md" - ], - "gitHead": "78c659de20283e3a6bee92bda455e6daff01686a", - "homepage": "https://github.com/dougwilson/nodejs-depd", - "keywords": [ - "deprecate", - "deprecated" - ], - "license": "MIT", - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "name": "depd", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/dougwilson/nodejs-depd.git" - }, - "scripts": { - "bench": "node benchmark/index.js", - "test": "mocha --reporter spec --bail test/", - "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --no-exit test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/" - }, - "version": "1.1.0" -} diff --git a/node_modules/destroy/LICENSE b/node_modules/destroy/LICENSE deleted file mode 100644 index a7ae8ee..0000000 --- a/node_modules/destroy/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2014 Jonathan Ong me@jongleberry.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/destroy/README.md b/node_modules/destroy/README.md deleted file mode 100644 index 6474bc3..0000000 --- a/node_modules/destroy/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# Destroy - -[![NPM version][npm-image]][npm-url] -[![Build status][travis-image]][travis-url] -[![Test coverage][coveralls-image]][coveralls-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] -[![Gittip][gittip-image]][gittip-url] - -Destroy a stream. - -This module is meant to ensure a stream gets destroyed, handling different APIs -and Node.js bugs. - -## API - -```js -var destroy = require('destroy') -``` - -### destroy(stream) - -Destroy the given stream. In most cases, this is identical to a simple -`stream.destroy()` call. The rules are as follows for a given stream: - - 1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()` - and add a listener to the `open` event to call `stream.close()` if it is - fired. This is for a Node.js bug that will leak a file descriptor if - `.destroy()` is called before `open`. - 2. If the `stream` is not an instance of `Stream`, then nothing happens. - 3. If the `stream` has a `.destroy()` method, then call it. - -The function returns the `stream` passed in as the argument. - -## Example - -```js -var destroy = require('destroy') - -var fs = require('fs') -var stream = fs.createReadStream('package.json') - -// ... and later -destroy(stream) -``` - -[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square -[npm-url]: https://npmjs.org/package/destroy -[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square -[github-url]: https://github.com/stream-utils/destroy/tags -[travis-image]: https://img.shields.io/travis/stream-utils/destroy.svg?style=flat-square -[travis-url]: https://travis-ci.org/stream-utils/destroy -[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master -[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square -[license-url]: LICENSE.md -[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/destroy -[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square -[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/node_modules/destroy/index.js b/node_modules/destroy/index.js deleted file mode 100644 index 6da2d26..0000000 --- a/node_modules/destroy/index.js +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * destroy - * Copyright(c) 2014 Jonathan Ong - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var ReadStream = require('fs').ReadStream -var Stream = require('stream') - -/** - * Module exports. - * @public - */ - -module.exports = destroy - -/** - * Destroy a stream. - * - * @param {object} stream - * @public - */ - -function destroy(stream) { - if (stream instanceof ReadStream) { - return destroyReadStream(stream) - } - - if (!(stream instanceof Stream)) { - return stream - } - - if (typeof stream.destroy === 'function') { - stream.destroy() - } - - return stream -} - -/** - * Destroy a ReadStream. - * - * @param {object} stream - * @private - */ - -function destroyReadStream(stream) { - stream.destroy() - - if (typeof stream.close === 'function') { - // node.js core bug work-around - stream.on('open', onOpenClose) - } - - return stream -} - -/** - * On open handler to close stream. - * @private - */ - -function onOpenClose() { - if (typeof this.fd === 'number') { - // actually close down the fd - this.close() - } -} diff --git a/node_modules/destroy/package.json b/node_modules/destroy/package.json deleted file mode 100644 index d7dbd2b..0000000 --- a/node_modules/destroy/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "destroy@~1.0.4", - "scope": null, - "escapedName": "destroy", - "name": "destroy", - "rawSpec": "~1.0.4", - "spec": ">=1.0.4 <1.1.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/send" - ] - ], - "_from": "destroy@>=1.0.4 <1.1.0", - "_id": "destroy@1.0.4", - "_inCache": true, - "_location": "/destroy", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "_npmVersion": "1.4.28", - "_phantomChildren": {}, - "_requested": { - "raw": "destroy@~1.0.4", - "scope": null, - "escapedName": "destroy", - "name": "destroy", - "rawSpec": "~1.0.4", - "spec": ">=1.0.4 <1.1.0", - "type": "range" - }, - "_requiredBy": [ - "/send" - ], - "_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "_shasum": "978857442c44749e4206613e37946205826abd80", - "_shrinkwrap": null, - "_spec": "destroy@~1.0.4", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/send", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "bugs": { - "url": "https://github.com/stream-utils/destroy/issues" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "dependencies": {}, - "description": "destroy a stream if possible", - "devDependencies": { - "istanbul": "0.4.2", - "mocha": "2.3.4" - }, - "directories": {}, - "dist": { - "shasum": "978857442c44749e4206613e37946205826abd80", - "tarball": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz" - }, - "files": [ - "index.js", - "LICENSE" - ], - "gitHead": "86edea01456f5fa1027f6a47250c34c713cbcc3b", - "homepage": "https://github.com/stream-utils/destroy", - "keywords": [ - "stream", - "streams", - "destroy", - "cleanup", - "leak", - "fd" - ], - "license": "MIT", - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "name": "destroy", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/stream-utils/destroy.git" - }, - "scripts": { - "test": "mocha --reporter spec", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" - }, - "version": "1.0.4" -} diff --git a/node_modules/detect-indent/index.js b/node_modules/detect-indent/index.js deleted file mode 100644 index c2da337..0000000 --- a/node_modules/detect-indent/index.js +++ /dev/null @@ -1,120 +0,0 @@ -/* eslint-disable guard-for-in */ -'use strict'; -var repeating = require('repeating'); - -// detect either spaces or tabs but not both to properly handle tabs -// for indentation and spaces for alignment -var INDENT_RE = /^(?:( )+|\t+)/; - -function getMostUsed(indents) { - var result = 0; - var maxUsed = 0; - var maxWeight = 0; - - for (var n in indents) { - var indent = indents[n]; - var u = indent[0]; - var w = indent[1]; - - if (u > maxUsed || u === maxUsed && w > maxWeight) { - maxUsed = u; - maxWeight = w; - result = Number(n); - } - } - - return result; -} - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - // used to see if tabs or spaces are the most used - var tabs = 0; - var spaces = 0; - - // remember the size of previous line's indentation - var prev = 0; - - // remember how many indents/unindents as occurred for a given size - // and how much lines follow a given indentation - // - // indents = { - // 3: [1, 0], - // 4: [1, 5], - // 5: [1, 0], - // 12: [1, 0], - // } - var indents = {}; - - // pointer to the array of last used indent - var current; - - // whether the last action was an indent (opposed to an unindent) - var isIndent; - - str.split(/\n/g).forEach(function (line) { - if (!line) { - // ignore empty lines - return; - } - - var indent; - var matches = line.match(INDENT_RE); - - if (!matches) { - indent = 0; - } else { - indent = matches[0].length; - - if (matches[1]) { - spaces++; - } else { - tabs++; - } - } - - var diff = indent - prev; - prev = indent; - - if (diff) { - // an indent or unindent has been detected - - isIndent = diff > 0; - - current = indents[isIndent ? diff : -diff]; - - if (current) { - current[0]++; - } else { - current = indents[diff] = [1, 0]; - } - } else if (current) { - // if the last action was an indent, increment the weight - current[1] += Number(isIndent); - } - }); - - var amount = getMostUsed(indents); - - var type; - var actual; - if (!amount) { - type = null; - actual = ''; - } else if (spaces >= tabs) { - type = 'space'; - actual = repeating(' ', amount); - } else { - type = 'tab'; - actual = repeating('\t', amount); - } - - return { - amount: amount, - type: type, - indent: actual - }; -}; diff --git a/node_modules/detect-indent/license b/node_modules/detect-indent/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/detect-indent/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.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/detect-indent/package.json b/node_modules/detect-indent/package.json deleted file mode 100644 index cb66782..0000000 --- a/node_modules/detect-indent/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "detect-indent@^4.0.0", - "scope": null, - "escapedName": "detect-indent", - "name": "detect-indent", - "rawSpec": "^4.0.0", - "spec": ">=4.0.0 <5.0.0", - "type": "range" - }, - "/home/nanosat/web/boilerplate-static-html/node_modules/babel-generator" - ] - ], - "_from": "detect-indent@>=4.0.0 <5.0.0", - "_id": "detect-indent@4.0.0", - "_inCache": true, - "_location": "/detect-indent", - "_nodeVersion": "3.0.0", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "_npmVersion": "2.13.3", - "_phantomChildren": {}, - "_requested": { - "raw": "detect-indent@^4.0.0", - "scope": null, - "escapedName": "detect-indent", - "name": "detect-indent", - "rawSpec": "^4.0.0", - "spec": ">=4.0.0 <5.0.0", - "type": "range" - }, - "_requiredBy": [ - "/babel-generator" - ], - "_resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "_shasum": "f76d064352cdf43a1cb6ce619c4ee3a9475de208", - "_shrinkwrap": null, - "_spec": "detect-indent@^4.0.0", - "_where": "/home/nanosat/web/boilerplate-static-html/node_modules/babel-generator", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/sindresorhus/detect-indent/issues" - }, - "dependencies": { - "repeating": "^2.0.0" - }, - "description": "Detect the indentation of code", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "directories": {}, - "dist": { - "shasum": "f76d064352cdf43a1cb6ce619c4ee3a9475de208", - "tarball": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz" - }, - "engines": { - "node": ">=0.10.0" - }, - "files": [ - "index.js" - ], - "gitHead": "dbbc78fcb37907116eb120a8324070a1df0e8d86", - "homepage": "https://github.com/sindresorhus/detect-indent", - "keywords": [ - "indent", - "indentation", - "detect", - "infer", - "identify", - "code", - "string", - "text", - "source", - "space", - "tab" - ], - "license": "MIT", - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "name": "detect-indent", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git+https://github.com/sindresorhus/detect-indent.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "4.0.0", - "xo": { - "ignores": [ - "fixture/**" - ] - } -} diff --git a/node_modules/detect-indent/readme.md b/node_modules/detect-indent/readme.md deleted file mode 100644 index 22938ab..0000000 --- a/node_modules/detect-indent/readme.md +++ /dev/null @@ -1,110 +0,0 @@ -# detect-indent [![Build Status](https://travis-ci.org/sindresorhus/detect-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/detect-indent) - -> Detect the indentation of code - -Pass in a string of any kind of text and get the indentation. - - -## Use cases - -- Persisting the indentation when modifying a file. -- Have new content match the existing indentation. -- Setting the right indentation in your editor. - - -## Install - -``` -$ npm install --save detect-indent -``` - - -## Usage - -Here we modify a JSON file while persisting the indentation: - -```js -var fs = require('fs'); -var detectIndent = require('detect-indent'); - -/* -{ - "ilove": "pizza" -} -*/ -var file = fs.readFileSync('foo.json', 'utf8'); - -// tries to detect the indentation and falls back to a default if it can't -var indent = detectIndent(file).indent || ' '; - -var json = JSON.parse(file); - -json.ilove = 'unicorns'; - -fs.writeFileSync('foo.json', JSON.stringify(json, null, indent)); -/* -{ - "ilove": "unicorns" -} -*/ -``` - - -## API - -Accepts a string and returns an object with stats about the indentation: - -* `amount` {number} - Amount of indentation, e.g. `2` -* `type` {string|null} - Type of indentation. Possible values are `tab`, `space` or `null` if no indentation is detected -* `indent` {string} - Actual indentation - - -## Algorithm - -The current algorithm looks for the most common difference between two consecutive non-empty lines. - -In the following example, even if the 4-space indentation is used 3 times whereas the 2-space one is used 2 times, it is detected as less used because there were only 2 differences with this value instead of 4 for the 2-space indentation: - -```css -html { - box-sizing: border-box; -} - -body { - background: gray; -} - -p { - line-height: 1.3em; - margin-top: 1em; - text-indent: 2em; -} -``` - -[Source.](https://medium.com/@heatherarthur/detecting-code-indentation-eff3ed0fb56b#3918) - -Furthermore, if there are more than one most used difference, the indentation with the most lines is selected. - -In the following example, the indentation is detected as 4-spaces: - -```css -body { - background: gray; -} - -p { - line-height: 1.3em; - margin-top: 1em; - text-indent: 2em; -} -``` - - -## Related - -- [detect-indent-cli](https://github.com/sindresorhus/detect-indent-cli) - CLI for this module - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/dom-serializer/LICENSE b/node_modules/dom-serializer/LICENSE deleted file mode 100644 index 3d241a8..0000000 --- a/node_modules/dom-serializer/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -License - -(The MIT License) - -Copyright (c) 2014 The cheeriojs contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/dom-serializer/index.js b/node_modules/dom-serializer/index.js deleted file mode 100644 index 3316dfe..0000000 --- a/node_modules/dom-serializer/index.js +++ /dev/null @@ -1,178 +0,0 @@ -/* - Module dependencies -*/ -var ElementType = require('domelementtype'); -var entities = require('entities'); - -/* - Boolean Attributes -*/ -var booleanAttributes = { - __proto__: null, - allowfullscreen: true, - async: true, - autofocus: true, - autoplay: true, - checked: true, - controls: true, - default: true, - defer: true, - disabled: true, - hidden: true, - ismap: true, - loop: true, - multiple: true, - muted: true, - open: true, - readonly: true, - required: true, - reversed: true, - scoped: true, - seamless: true, - selected: true, - typemustmatch: true -}; - -var unencodedElements = { - __proto__: null, - style: true, - script: true, - xmp: true, - iframe: true, - noembed: true, - noframes: true, - plaintext: true, - noscript: true -}; - -/* - Format attributes -*/ -function formatAttrs(attributes, opts) { - if (!attributes) return; - - var output = '', - value; - - // Loop through the attributes - for (var key in attributes) { - value = attributes[key]; - if (output) { - output += ' '; - } - - if (!value && booleanAttributes[key]) { - output += key; - } else { - output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"'; - } - } - - return output; -} - -/* - Self-enclosing tags (stolen from node-htmlparser) -*/ -var singleTag = { - __proto__: null, - area: true, - base: true, - basefont: true, - br: true, - col: true, - command: true, - embed: true, - frame: true, - hr: true, - img: true, - input: true, - isindex: true, - keygen: true, - link: true, - meta: true, - param: true, - source: true, - track: true, - wbr: true, -}; - - -var render = module.exports = function(dom, opts) { - if (!Array.isArray(dom) && !dom.cheerio) dom = [dom]; - opts = opts || {}; - - var output = ''; - - for(var i = 0; i < dom.length; i++){ - var elem = dom[i]; - - if (elem.type === 'root') - output += render(elem.children, opts); - else if (ElementType.isTag(elem)) - output += renderTag(elem, opts); - else if (elem.type === ElementType.Directive) - output += renderDirective(elem); - else if (elem.type === ElementType.Comment) - output += renderComment(elem); - else if (elem.type === ElementType.CDATA) - output += renderCdata(elem); - else - output += renderText(elem, opts); - } - - return output; -}; - -function renderTag(elem, opts) { - // Handle SVG - if (elem.name === "svg") opts = {decodeEntities: opts.decodeEntities, xmlMode: true}; - - var tag = '<' + elem.name, - attribs = formatAttrs(elem.attribs, opts); - - if (attribs) { - tag += ' ' + attribs; - } - - if ( - opts.xmlMode - && (!elem.children || elem.children.length === 0) - ) { - tag += '/>'; - } else { - tag += '>'; - if (elem.children) { - tag += render(elem.children, opts); - } - - if (!singleTag[elem.name] || opts.xmlMode) { - tag += ''; - } - } - - return tag; -} - -function renderDirective(elem) { - return '<' + elem.data + '>'; -} - -function renderText(elem, opts) { - var data = elem.data || ''; - - // if entities weren't decoded, no need to encode them back - if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) { - data = entities.encodeXML(data); - } - - return data; -} - -function renderCdata(elem) { - return ''; -} - -function renderComment(elem) { - return ''; -} diff --git a/node_modules/dom-serializer/node_modules/domelementtype/LICENSE b/node_modules/dom-serializer/node_modules/domelementtype/LICENSE deleted file mode 100644 index c464f86..0000000 --- a/node_modules/dom-serializer/node_modules/domelementtype/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Felix Böhm -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/dom-serializer/node_modules/domelementtype/index.js b/node_modules/dom-serializer/node_modules/domelementtype/index.js deleted file mode 100644 index 89e0b17..0000000 --- a/node_modules/dom-serializer/node_modules/domelementtype/index.js +++ /dev/null @@ -1,14 +0,0 @@ -//Types of elements found in the DOM -module.exports = { - Text: "text", //Text - Directive: "directive", // - Comment: "comment", // - Script: "script", //", - "expected": [ - { - "type": "script", - "name": "script", - "attribs": {}, - "children": [ - { - "data": "", - "type": "text" - } - ] - } - ] -} \ No newline at end of file diff --git a/node_modules/domhandler/test/cases/07-unescaped_in_style.json b/node_modules/domhandler/test/cases/07-unescaped_in_style.json deleted file mode 100644 index 77438fd..0000000 --- a/node_modules/domhandler/test/cases/07-unescaped_in_style.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Unescaped chars in style", - "options": {}, - "html": "", - "expected": [ - { - "type": "style", - "name": "style", - "attribs": { - "type": "text/css" - }, - "children": [ - { - "data": "\n body > p\n\t{ font-weight: bold; }", - "type": "text" - } - ] - } - ] -} \ No newline at end of file diff --git a/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json b/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json deleted file mode 100644 index 5c2492e..0000000 --- a/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Extra spaces in tag", - "options": {}, - "html": "the text", - "expected": [ - { - "type": "tag", - "name": "font", - "attribs": { - "size": "14" - }, - "children": [ - { - "data": "the text", - "type": "text" - } - ] - } - ] -} \ No newline at end of file diff --git a/node_modules/domhandler/test/cases/09-unquoted_attrib.json b/node_modules/domhandler/test/cases/09-unquoted_attrib.json deleted file mode 100644 index 543ccee..0000000 --- a/node_modules/domhandler/test/cases/09-unquoted_attrib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Unquoted attributes", - "options": {}, - "html": "the text", - "expected": [ - { - "type": "tag", - "name": "font", - "attribs": { - "size": "14" - }, - "children": [ - { - "data": "the text", - "type": "text" - } - ] - } - ] -} \ No newline at end of file diff --git a/node_modules/domhandler/test/cases/10-singular_attribute.json b/node_modules/domhandler/test/cases/10-singular_attribute.json deleted file mode 100644 index 544636e..0000000 --- a/node_modules/domhandler/test/cases/10-singular_attribute.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "Singular attribute", - "options": {}, - "html": "