You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/06/07 06:04:37 UTC
[46/51] [abbrv] [partial] cordova-lib git commit: CB-11980: added
missing node modules for test fixtures
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/index.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/index.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/index.js
new file mode 100644
index 0000000..b8c9463
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/index.js
@@ -0,0 +1,51 @@
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto');
+
+/**
+ * Sign the given `val` with `secret`.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(val, secret){
+ if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string.");
+ if ('string' != typeof secret) throw new TypeError("Secret string must be provided.");
+ return val + '.' + crypto
+ .createHmac('sha256', secret)
+ .update(val)
+ .digest('base64')
+ .replace(/\=+$/, '');
+};
+
+/**
+ * Unsign and decode the given `val` with `secret`,
+ * returning `false` if the signature is invalid.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String|Boolean}
+ * @api private
+ */
+
+exports.unsign = function(val, secret){
+ if ('string' != typeof val) throw new TypeError("Signed cookie string must be provided.");
+ if ('string' != typeof secret) throw new TypeError("Secret string must be provided.");
+ var str = val.slice(0, val.lastIndexOf('.'))
+ , mac = exports.sign(str, secret);
+
+ return sha1(mac) == sha1(val) ? str : false;
+};
+
+/**
+ * Private
+ */
+
+function sha1(str){
+ return crypto.createHash('sha1').update(str).digest('hex');
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/package.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/package.json b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/package.json
new file mode 100644
index 0000000..d3de0d9
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie-signature/package.json
@@ -0,0 +1,92 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "cookie-signature@1.0.6",
+ "scope": null,
+ "escapedName": "cookie-signature",
+ "name": "cookie-signature",
+ "rawSpec": "1.0.6",
+ "spec": "1.0.6",
+ "type": "version"
+ },
+ "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser/node_modules/express"
+ ]
+ ],
+ "_from": "cookie-signature@1.0.6",
+ "_id": "cookie-signature@1.0.6",
+ "_inCache": true,
+ "_location": "/cookie-signature",
+ "_nodeVersion": "0.10.36",
+ "_npmUser": {
+ "name": "natevw",
+ "email": "natevw@yahoo.com"
+ },
+ "_npmVersion": "2.3.0",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "cookie-signature@1.0.6",
+ "scope": null,
+ "escapedName": "cookie-signature",
+ "name": "cookie-signature",
+ "rawSpec": "1.0.6",
+ "spec": "1.0.6",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/express"
+ ],
+ "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
+ "_shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c",
+ "_shrinkwrap": null,
+ "_spec": "cookie-signature@1.0.6",
+ "_where": "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser/node_modules/express",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@learnboost.com"
+ },
+ "bugs": {
+ "url": "https://github.com/visionmedia/node-cookie-signature/issues"
+ },
+ "dependencies": {},
+ "description": "Sign and unsign cookies",
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c",
+ "tarball": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
+ },
+ "gitHead": "391b56cf44d88c493491b7e3fc53208cfb976d2a",
+ "homepage": "https://github.com/visionmedia/node-cookie-signature",
+ "keywords": [
+ "cookie",
+ "sign",
+ "unsign"
+ ],
+ "license": "MIT",
+ "main": "index",
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ {
+ "name": "natevw",
+ "email": "natevw@yahoo.com"
+ }
+ ],
+ "name": "cookie-signature",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/visionmedia/node-cookie-signature.git"
+ },
+ "scripts": {
+ "test": "mocha --require should --reporter spec"
+ },
+ "version": "1.0.6"
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/HISTORY.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/HISTORY.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/HISTORY.md
new file mode 100644
index 0000000..5bd6485
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/HISTORY.md
@@ -0,0 +1,118 @@
+0.3.1 / 2016-05-26
+==================
+
+ * Fix `sameSite: true` to work with draft-7 clients
+ - `true` now sends `SameSite=Strict` instead of `SameSite`
+
+0.3.0 / 2016-05-26
+==================
+
+ * Add `sameSite` option
+ - Replaces `firstPartyOnly` option, never implemented by browsers
+ * Improve error message when `encode` is not a function
+ * Improve error message when `expires` is not a `Date`
+
+0.2.4 / 2016-05-20
+==================
+
+ * perf: enable strict mode
+ * perf: use for loop in parse
+ * perf: use string concatination for serialization
+
+0.2.3 / 2015-10-25
+==================
+
+ * Fix cookie `Max-Age` to never be a floating point number
+
+0.2.2 / 2015-09-17
+==================
+
+ * Fix regression when setting empty cookie value
+ - Ease the new restriction, which is just basic header-level validation
+ * Fix typo in invalid value errors
+
+0.2.1 / 2015-09-17
+==================
+
+ * Throw on invalid values provided to `serialize`
+ - Ensures the resulting string is a valid HTTP header value
+
+0.2.0 / 2015-08-13
+==================
+
+ * Add `firstPartyOnly` option
+ * Throw better error for invalid argument to parse
+ * perf: hoist regular expression
+
+0.1.5 / 2015-09-17
+==================
+
+ * Fix regression when setting empty cookie value
+ - Ease the new restriction, which is just basic header-level validation
+ * Fix typo in invalid value errors
+
+0.1.4 / 2015-09-17
+==================
+
+ * Throw better error for invalid argument to parse
+ * Throw on invalid values provided to `serialize`
+ - Ensures the resulting string is a valid HTTP header value
+
+0.1.3 / 2015-05-19
+==================
+
+ * Reduce the scope of try-catch deopt
+ * Remove argument reassignments
+
+0.1.2 / 2014-04-16
+==================
+
+ * Remove unnecessary files from npm package
+
+0.1.1 / 2014-02-23
+==================
+
+ * Fix bad parse when cookie value contained a comma
+ * Fix support for `maxAge` of `0`
+
+0.1.0 / 2013-05-01
+==================
+
+ * Add `decode` option
+ * Add `encode` option
+
+0.0.6 / 2013-04-08
+==================
+
+ * Ignore cookie parts missing `=`
+
+0.0.5 / 2012-10-29
+==================
+
+ * Return raw cookie value if value unescape errors
+
+0.0.4 / 2012-06-21
+==================
+
+ * Use encode/decodeURIComponent for cookie encoding/decoding
+ - Improve server/client interoperability
+
+0.0.3 / 2012-06-06
+==================
+
+ * Only escape special characters per the cookie RFC
+
+0.0.2 / 2012-06-01
+==================
+
+ * Fix `maxAge` option to not throw error
+
+0.0.1 / 2012-05-28
+==================
+
+ * Add more tests
+
+0.0.0 / 2012-05-28
+==================
+
+ * Initial release
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/LICENSE
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/LICENSE b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/LICENSE
new file mode 100644
index 0000000..058b6b4
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/LICENSE
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2012-2014 Roman Shtylman <sh...@gmail.com>
+Copyright (c) 2015 Douglas Christopher Wilson <do...@somethingdoug.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.
+
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/README.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/README.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/README.md
new file mode 100644
index 0000000..db0d078
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/README.md
@@ -0,0 +1,220 @@
+# cookie
+
+[![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]
+
+Basic HTTP cookie parser and serializer for HTTP servers.
+
+## Installation
+
+```sh
+$ npm install cookie
+```
+
+## API
+
+```js
+var cookie = require('cookie');
+```
+
+### cookie.parse(str, options)
+
+Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
+The `str` argument is the string representing a `Cookie` header value and `options` is an
+optional object containing additional parsing options.
+
+```js
+var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2');
+// { foo: 'bar', equation: 'E=mc^2' }
+```
+
+#### Options
+
+`cookie.parse` accepts these properties in the options object.
+
+##### decode
+
+Specifies a function that will be used to decode a cookie's value. Since the value of a cookie
+has a limited character set (and must be a simple string), this function can be used to decode
+a previously-encoded cookie value into a JavaScript string or other object.
+
+The default function is the global `decodeURIComponent`, which will decode any URL-encoded
+sequences into their byte representations.
+
+**note** if an error is thrown from this function, the original, non-decoded cookie value will
+be returned as the cookie's value.
+
+### cookie.serialize(name, value, options)
+
+Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
+name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
+argument is an optional object containing additional serialization options.
+
+```js
+var setCookie = cookie.serialize('foo', 'bar');
+// foo=bar
+```
+
+#### Options
+
+`cookie.serialize` accepts these properties in the options object.
+
+##### domain
+
+Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no
+domain is set, and most clients will consider the cookie to apply to only the current domain.
+
+##### encode
+
+Specifies a function that will be used to encode a cookie's value. Since value of a cookie
+has a limited character set (and must be a simple string), this function can be used to encode
+a value into a string suited for a cookie's value.
+
+The default function is the global `ecodeURIComponent`, which will encode a JavaScript string
+into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range.
+
+##### expires
+
+Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1].
+By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and
+will delete it on a condition like exiting a web browser application.
+
+**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and
+`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this,
+so if both are set, they should point to the same date and time.
+
+##### httpOnly
+
+Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy,
+the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set.
+
+**note** be careful when setting this to `true`, as compliant clients will not allow client-side
+JavaScript to see the cookie in `document.cookie`.
+
+##### maxAge
+
+Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2].
+The given number will be converted to an integer by rounding down. By default, no maximum age is set.
+
+**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and
+`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this,
+so if both are set, they should point to the same date and time.
+
+##### path
+
+Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path
+is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most
+clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting
+a web browser application.
+
+##### sameSite
+
+Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07].
+
+ - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
+ - `false` will not set the `SameSite` attribute.
+ - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
+ - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
+
+More information about the different enforcement levels can be found in the specification
+https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1
+
+**note** This is an attribute that has not yet been fully standardized, and may change in the future.
+This also means many clients may ignore this attribute until they understand it.
+
+##### secure
+
+Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy,
+the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
+
+**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to
+the server in the future if the browser does not have an HTTPS connection.
+
+## Example
+
+The following example uses this module in conjunction with the Node.js core HTTP server
+to prompt a user for their name and display it back on future visits.
+
+```js
+var cookie = require('cookie');
+var escapeHtml = require('escape-html');
+var http = require('http');
+var url = require('url');
+
+function onRequest(req, res) {
+ // Parse the query string
+ var query = url.parse(req.url, true, true).query;
+
+ if (query && query.name) {
+ // Set a new cookie with the name
+ res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), {
+ httpOnly: true,
+ maxAge: 60 * 60 * 24 * 7 // 1 week
+ }));
+
+ // Redirect back after setting cookie
+ res.statusCode = 302;
+ res.setHeader('Location', req.headers.referer || '/');
+ res.end();
+ return;
+ }
+
+ // Parse the cookies on the request
+ var cookies = cookie.parse(req.headers.cookie || '');
+
+ // Get the visitor name set in the cookie
+ var name = cookies.name;
+
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
+
+ if (name) {
+ res.write('<p>Welcome back, <b>' + escapeHtml(name) + '</b>!</p>');
+ } else {
+ res.write('<p>Hello, new visitor!</p>');
+ }
+
+ res.write('<form method="GET">');
+ res.write('<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">');
+ res.end('</form');
+}
+
+http.createServer(onRequest).listen(3000);
+```
+
+## Testing
+
+```sh
+$ npm test
+```
+
+## References
+
+- [RFC 6266: HTTP State Management Mechanism][rfc-6266]
+- [Same-site Cookies][draft-west-first-party-cookies-07]
+
+[draft-west-first-party-cookies-07]: https://tools.ietf.org/html/draft-west-first-party-cookies-07
+[rfc-6266]: https://tools.ietf.org/html/rfc6266
+[rfc-6266-5.1.4]: https://tools.ietf.org/html/rfc6266#section-5.1.4
+[rfc-6266-5.2.1]: https://tools.ietf.org/html/rfc6266#section-5.2.1
+[rfc-6266-5.2.2]: https://tools.ietf.org/html/rfc6266#section-5.2.2
+[rfc-6266-5.2.3]: https://tools.ietf.org/html/rfc6266#section-5.2.3
+[rfc-6266-5.2.4]: https://tools.ietf.org/html/rfc6266#section-5.2.4
+[rfc-6266-5.3]: https://tools.ietf.org/html/rfc6266#section-5.3
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/cookie.svg
+[npm-url]: https://npmjs.org/package/cookie
+[node-version-image]: https://img.shields.io/node/v/cookie.svg
+[node-version-url]: https://nodejs.org/en/download
+[travis-image]: https://img.shields.io/travis/jshttp/cookie/master.svg
+[travis-url]: https://travis-ci.org/jshttp/cookie
+[coveralls-image]: https://img.shields.io/coveralls/jshttp/cookie/master.svg
+[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
+[downloads-image]: https://img.shields.io/npm/dm/cookie.svg
+[downloads-url]: https://npmjs.org/package/cookie
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/index.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/index.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/index.js
new file mode 100644
index 0000000..ab2e467
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/index.js
@@ -0,0 +1,195 @@
+/*!
+ * cookie
+ * Copyright(c) 2012-2014 Roman Shtylman
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict';
+
+/**
+ * Module exports.
+ * @public
+ */
+
+exports.parse = parse;
+exports.serialize = serialize;
+
+/**
+ * Module variables.
+ * @private
+ */
+
+var decode = decodeURIComponent;
+var encode = encodeURIComponent;
+var pairSplitRegExp = /; */;
+
+/**
+ * RegExp to match field-content in RFC 7230 sec 3.2
+ *
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
+ * field-vchar = VCHAR / obs-text
+ * obs-text = %x80-FF
+ */
+
+var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
+
+/**
+ * Parse a cookie header.
+ *
+ * Parse the given cookie header string into an object
+ * The object has the various cookies as keys(names) => values
+ *
+ * @param {string} str
+ * @param {object} [options]
+ * @return {object}
+ * @public
+ */
+
+function parse(str, options) {
+ if (typeof str !== 'string') {
+ throw new TypeError('argument str must be a string');
+ }
+
+ var obj = {}
+ var opt = options || {};
+ var pairs = str.split(pairSplitRegExp);
+ var dec = opt.decode || decode;
+
+ for (var i = 0; i < pairs.length; i++) {
+ var pair = pairs[i];
+ var eq_idx = pair.indexOf('=');
+
+ // skip things that don't look like key=value
+ if (eq_idx < 0) {
+ continue;
+ }
+
+ var key = pair.substr(0, eq_idx).trim()
+ var val = pair.substr(++eq_idx, pair.length).trim();
+
+ // quoted values
+ if ('"' == val[0]) {
+ val = val.slice(1, -1);
+ }
+
+ // only assign once
+ if (undefined == obj[key]) {
+ obj[key] = tryDecode(val, dec);
+ }
+ }
+
+ return obj;
+}
+
+/**
+ * Serialize data into a cookie header.
+ *
+ * Serialize the a name value pair into a cookie string suitable for
+ * http headers. An optional options object specified cookie parameters.
+ *
+ * serialize('foo', 'bar', { httpOnly: true })
+ * => "foo=bar; httpOnly"
+ *
+ * @param {string} name
+ * @param {string} val
+ * @param {object} [options]
+ * @return {string}
+ * @public
+ */
+
+function serialize(name, val, options) {
+ var opt = options || {};
+ var enc = opt.encode || encode;
+
+ if (typeof enc !== 'function') {
+ throw new TypeError('option encode is invalid');
+ }
+
+ if (!fieldContentRegExp.test(name)) {
+ throw new TypeError('argument name is invalid');
+ }
+
+ var value = enc(val);
+
+ if (value && !fieldContentRegExp.test(value)) {
+ throw new TypeError('argument val is invalid');
+ }
+
+ var str = name + '=' + value;
+
+ if (null != opt.maxAge) {
+ var maxAge = opt.maxAge - 0;
+ if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
+ str += '; Max-Age=' + Math.floor(maxAge);
+ }
+
+ if (opt.domain) {
+ if (!fieldContentRegExp.test(opt.domain)) {
+ throw new TypeError('option domain is invalid');
+ }
+
+ str += '; Domain=' + opt.domain;
+ }
+
+ if (opt.path) {
+ if (!fieldContentRegExp.test(opt.path)) {
+ throw new TypeError('option path is invalid');
+ }
+
+ str += '; Path=' + opt.path;
+ }
+
+ if (opt.expires) {
+ if (typeof opt.expires.toUTCString !== 'function') {
+ throw new TypeError('option expires is invalid');
+ }
+
+ str += '; Expires=' + opt.expires.toUTCString();
+ }
+
+ if (opt.httpOnly) {
+ str += '; HttpOnly';
+ }
+
+ if (opt.secure) {
+ str += '; Secure';
+ }
+
+ if (opt.sameSite) {
+ var sameSite = typeof opt.sameSite === 'string'
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
+
+ switch (sameSite) {
+ case true:
+ str += '; SameSite=Strict';
+ break;
+ case 'lax':
+ str += '; SameSite=Lax';
+ break;
+ case 'strict':
+ str += '; SameSite=Strict';
+ break;
+ default:
+ throw new TypeError('option sameSite is invalid');
+ }
+ }
+
+ return str;
+}
+
+/**
+ * Try decoding a string using a decoding function.
+ *
+ * @param {string} str
+ * @param {function} decode
+ * @private
+ */
+
+function tryDecode(str, decode) {
+ try {
+ return decode(str);
+ } catch (e) {
+ return str;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/package.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/package.json b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/package.json
new file mode 100644
index 0000000..6066d90
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cookie/package.json
@@ -0,0 +1,106 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "cookie@0.3.1",
+ "scope": null,
+ "escapedName": "cookie",
+ "name": "cookie",
+ "rawSpec": "0.3.1",
+ "spec": "0.3.1",
+ "type": "version"
+ },
+ "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser/node_modules/express"
+ ]
+ ],
+ "_from": "cookie@0.3.1",
+ "_id": "cookie@0.3.1",
+ "_inCache": true,
+ "_location": "/cookie",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/cookie-0.3.1.tgz_1464323556714_0.6435900838114321"
+ },
+ "_npmUser": {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ "_npmVersion": "1.4.28",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "cookie@0.3.1",
+ "scope": null,
+ "escapedName": "cookie",
+ "name": "cookie",
+ "rawSpec": "0.3.1",
+ "spec": "0.3.1",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/express"
+ ],
+ "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
+ "_shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb",
+ "_shrinkwrap": null,
+ "_spec": "cookie@0.3.1",
+ "_where": "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser/node_modules/express",
+ "author": {
+ "name": "Roman Shtylman",
+ "email": "shtylman@gmail.com"
+ },
+ "bugs": {
+ "url": "https://github.com/jshttp/cookie/issues"
+ },
+ "contributors": [
+ {
+ "name": "Douglas Christopher Wilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "dependencies": {},
+ "description": "HTTP server cookie parsing and serialization",
+ "devDependencies": {
+ "istanbul": "0.4.3",
+ "mocha": "1.21.5"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb",
+ "tarball": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ },
+ "files": [
+ "HISTORY.md",
+ "LICENSE",
+ "README.md",
+ "index.js"
+ ],
+ "gitHead": "e3c77d497d66c8b8d4b677b8954c1b192a09f0b3",
+ "homepage": "https://github.com/jshttp/cookie",
+ "keywords": [
+ "cookie",
+ "cookies"
+ ],
+ "license": "MIT",
+ "maintainers": [
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "name": "cookie",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jshttp/cookie.git"
+ },
+ "scripts": {
+ "test": "mocha --reporter spec --bail --check-leaks test/",
+ "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
+ },
+ "version": "0.3.1"
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/.jshintrc
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/.jshintrc b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/.jshintrc
new file mode 100755
index 0000000..6997763
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/.jshintrc
@@ -0,0 +1,11 @@
+{
+ "node": true,
+ "bitwise": true,
+ "undef": true,
+ "trailing": true,
+ "quotmark": true,
+ "indent": 4,
+ "unused": "vars",
+ "latedef": "nofunc",
+ "-W030": false
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/README.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/README.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/README.md
new file mode 100755
index 0000000..4d45447
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/README.md
@@ -0,0 +1,80 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+
+# cordova-serve
+This module can be used to serve up a Cordova application in the browser. It has no command-line, but rather is intended
+to be called using the following API:
+
+``` js
+var serve = require('cordova-serve');
+serve.launchServer(opts);
+serve.servePlatform(platform, opts);
+serve.launchBrowser(ops);
+```
+
+## launchServer()
+
+``` js
+launchServer(opts);
+```
+
+Launches a server with the specified options. Parameters:
+
+* **opts**: Options, as described below.
+
+## servePlatform()
+
+``` js
+servePlatform(platform, opts);
+```
+
+Launches a server that serves up any Cordova platform (e.g. `browser`, `android` etc) from the current project.
+Parameters:
+
+* **opts**: Options, as described below. Note that for `servePlatform()`, the `root` value should be a Cordova project's
+ root folder, or any folder within it - `servePlatform()` will replace it with the platform's `www_dir` folder. If this
+ value is not specified, the *cwd* will be used.
+
+## launchBrowser()
+
+``` js
+launchBrowser(opts);
+```
+
+Launches a browser window pointing to the specified URL. The single parameter is an options object that supports the
+following values (both optional):
+
+* **url**: The URL to open in the browser.
+* **target**: The name of the browser to launch. Can be any of the following: `chrome`, `chromium`, `firefox`, `ie`,
+ `opera`, `safari`. If no browser is specified,
+
+## The *opts* Options Object
+The opts object passed to `launchServer()` and `servePlatform()` supports the following values (all optional):
+
+* **root**: The file path on the local file system that is used as the root for the server, for default mapping of URL
+ path to local file system path.
+* **port**: The port for the server. Note that if this port is already in use, it will be incremented until a free port
+ is found.
+* **router**: An `ExpressJS` router. If provided, this will be attached *before* default static handling.
+* **noLogOutput**: If `true`, turns off all log output.
+* **noServerInfo**: If `true`, cordova-serve won't output `Static file server running on...` message.
+* **events**: An `EventEmitter` to use for logging. If provided, logging will be output using `events.emit('log', msg)`.
+ If not provided, `console.log()` will be used. Note that nothing will be output in either case if `noLogOutput` is `true`.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/RELEASENOTES.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/RELEASENOTES.md
new file mode 100755
index 0000000..cf9eab4
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/RELEASENOTES.md
@@ -0,0 +1,36 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+-->
+# Cordova-serve Release Notes
+
+### 1.0.1 (Dec 21, 2016)
+* CB-12284 Include project root as additional root for static router
+
+### 1.0.0 (Oct 05, 2015)
+* Refactor cordova-serve to use Express.
+
+### 0.1.3 (Aug 22, 2015)
+* Clean up cordova-serve console output.
+* CB-9546 cordova-serve.servePlatform() should provide project folders
+* CB-9545 Cordova-serve's 'noCache' option does not work in IE.
+* Add support for --target=edge to launch app in Edge browser.
+
+### 0.1.2 (June 15, 2015)
+Initial release
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/package.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/package.json b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/package.json
new file mode 100755
index 0000000..8be5056
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/package.json
@@ -0,0 +1,118 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "cordova-serve@^1.0.0",
+ "scope": null,
+ "escapedName": "cordova-serve",
+ "name": "cordova-serve",
+ "rawSpec": "^1.0.0",
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser"
+ ]
+ ],
+ "_from": "cordova-serve@>=1.0.0 <2.0.0",
+ "_id": "cordova-serve@1.0.1",
+ "_inCache": true,
+ "_location": "/cordova-serve",
+ "_nodeVersion": "6.9.2",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/cordova-serve-1.0.1.tgz_1482379745792_0.331234929850325"
+ },
+ "_npmUser": {
+ "name": "timbarham",
+ "email": "npmjs@barhams.info"
+ },
+ "_npmVersion": "3.10.9",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "cordova-serve@^1.0.0",
+ "scope": null,
+ "escapedName": "cordova-serve",
+ "name": "cordova-serve",
+ "rawSpec": "^1.0.0",
+ "spec": ">=1.0.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/cordova-serve/-/cordova-serve-1.0.1.tgz",
+ "_shasum": "895c7fb4bbe630fa1c89feaf6d74779cbff66da7",
+ "_shrinkwrap": null,
+ "_spec": "cordova-serve@^1.0.0",
+ "_where": "/Users/auso/cordova/cordova-lib/cordova-lib/spec-cordova/fixtures/platforms/cordova-browser",
+ "author": {
+ "name": "Apache Software Foundation"
+ },
+ "bugs": {
+ "url": "https://issues.apache.org/jira/browse/CB",
+ "email": "dev@cordova.apache.org"
+ },
+ "dependencies": {
+ "chalk": "^1.1.1",
+ "compression": "^1.6.0",
+ "express": "^4.13.3",
+ "q": "^1.4.1"
+ },
+ "description": "Apache Cordova server support for cordova-lib and cordova-browser.",
+ "devDependencies": {
+ "jshint": "^2.8.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "895c7fb4bbe630fa1c89feaf6d74779cbff66da7",
+ "tarball": "https://registry.npmjs.org/cordova-serve/-/cordova-serve-1.0.1.tgz"
+ },
+ "engines": {
+ "node": ">= 0.12.0",
+ "npm": ">= 2.5.1"
+ },
+ "keywords": [
+ "cordova",
+ "server",
+ "apache"
+ ],
+ "license": "Apache-2.0",
+ "main": "serve.js",
+ "maintainers": [
+ {
+ "name": "bowserj",
+ "email": "bowserj@apache.org"
+ },
+ {
+ "name": "filmaj",
+ "email": "maj.fil@gmail.com"
+ },
+ {
+ "name": "purplecabbage",
+ "email": "purplecabbage@gmail.com"
+ },
+ {
+ "name": "shazron",
+ "email": "shazron@gmail.com"
+ },
+ {
+ "name": "stevegill",
+ "email": "stevengill97@gmail.com"
+ },
+ {
+ "name": "timbarham",
+ "email": "npmjs@barhams.info"
+ }
+ ],
+ "name": "cordova-serve",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://git-wip-us.apache.org/repos/asf/cordova-lib.git"
+ },
+ "scripts": {
+ "jshint": "node node_modules/jshint/bin/jshint src"
+ },
+ "version": "1.0.1"
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/serve.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/serve.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/serve.js
new file mode 100755
index 0000000..10d000a
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/serve.js
@@ -0,0 +1,57 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ 'License'); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var chalk = require('chalk'),
+ compression = require('compression'),
+ express = require('express'),
+ server = require('./src/server');
+
+module.exports = function () {
+ return new CordovaServe();
+};
+
+function CordovaServe() {
+ this.app = express();
+
+ // Attach this before anything else to provide status output
+ this.app.use(function (req, res, next) {
+ res.on('finish', function () {
+ var color = this.statusCode == '404' ? chalk.red : chalk.green;
+ var msg = color(this.statusCode) + ' ' + this.req.originalUrl;
+ var encoding = this._headers && this._headers['content-encoding'];
+ if (encoding) {
+ msg += chalk.gray(' (' + encoding + ')');
+ }
+ server.log(msg);
+ });
+ next();
+ });
+
+ // Turn on compression
+ this.app.use(compression());
+
+ this.servePlatform = require('./src/platform');
+ this.launchServer = server;
+}
+
+module.exports.launchBrowser = require('./src/browser');
+
+// Expose some useful express statics
+module.exports.Router = express.Router;
+module.exports.static = express.static;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/browser.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/browser.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/browser.js
new file mode 100755
index 0000000..c701ca0
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/browser.js
@@ -0,0 +1,110 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var exec = require('./exec'),
+ Q = require('q');
+
+/**
+ * Launches the specified browser with the given URL.
+ * Based on https://github.com/domenic/opener
+ * @param {{target: ?string, url: ?string, dataDir: ?string}} opts - parameters:
+ * target - the target browser - ie, chrome, safari, opera, firefox or chromium
+ * url - the url to open in the browser
+ * dataDir - a data dir to provide to Chrome (can be used to force it to open in a new window)
+ * @return {Q} Promise to launch the specified browser
+ */
+module.exports = function (opts) {
+ var target = opts.target || 'chrome';
+ var url = opts.url || '';
+
+ return getBrowser(target, opts.dataDir).then(function (browser) {
+ var args;
+
+ var urlAdded = false;
+ switch (process.platform) {
+ case 'darwin':
+ args = ['open'];
+ if (target == 'chrome') {
+ // Chrome needs to be launched in a new window. Other browsers, particularly, opera does not work with this.
+ args.push('-n');
+ }
+ args.push('-a', browser);
+ break;
+ case 'win32':
+ // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and
+ // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the
+ // responsibility to "cmd /c", which has that logic built in.
+ //
+ // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
+ // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
+
+ if (target === 'edge') {
+ browser += ':' + url;
+ urlAdded = true;
+ }
+
+ args = ['cmd /c start ""', browser];
+ break;
+ case 'linux':
+ // if a browser is specified, launch it with the url as argument
+ // otherwise, use xdg-open.
+ args = [browser];
+ break;
+ }
+
+ if (!urlAdded) {
+ args.push(url);
+ }
+ var command = args.join(' ');
+ return exec(command);
+ });
+};
+
+function getBrowser(target, dataDir) {
+ dataDir = dataDir || 'temp_chrome_user_data_dir_for_cordova';
+
+ var chromeArgs = ' --user-data-dir=/tmp/' + dataDir;
+ var browsers = {
+ 'win32': {
+ 'ie': 'iexplore',
+ 'chrome': 'chrome --user-data-dir=%TEMP%\\' + dataDir,
+ 'safari': 'safari',
+ 'opera': 'opera',
+ 'firefox': 'firefox',
+ 'edge': 'microsoft-edge'
+ },
+ 'darwin': {
+ 'chrome': '"Google Chrome" --args' + chromeArgs,
+ 'safari': 'safari',
+ 'firefox': 'firefox',
+ 'opera': 'opera'
+ },
+ 'linux' : {
+ 'chrome': 'google-chrome' + chromeArgs ,
+ 'chromium': 'chromium-browser' + chromeArgs,
+ 'firefox': 'firefox',
+ 'opera': 'opera'
+ }
+ };
+ target = target.toLowerCase();
+ if (target in browsers[process.platform]) {
+ return Q(browsers[process.platform][target]);
+ }
+ return Q.reject('Browser target not supported: ' + target);
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/exec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/exec.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/exec.js
new file mode 100755
index 0000000..d1c02a4
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/exec.js
@@ -0,0 +1,46 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var child_process = require('child_process'),
+ Q = require('q');
+
+/**
+ * Executes the command specified.
+ * @param {string} cmd Command to execute
+ * @param {[string]} opt_cwd Current working directory
+ * @return {Q} promise a promise that either resolves with the stdout, or rejects with an error message and the stderr.
+ */
+module.exports = function (cmd, opt_cwd) {
+ var d = Q.defer();
+ try {
+ child_process.exec(cmd, {cwd: opt_cwd, maxBuffer: 1024000}, function (err, stdout, stderr) {
+ if (err) {
+ d.reject(new Error('Error executing "' + cmd + '": ' + stderr));
+ }
+ else {
+ d.resolve(stdout);
+ }
+ });
+ } catch (e) {
+ console.error('error caught: ' + e);
+ d.reject(e);
+ }
+ return d.promise;
+};
+
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/platform.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/platform.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/platform.js
new file mode 100755
index 0000000..7abbb81
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/platform.js
@@ -0,0 +1,62 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var fs = require('fs'),
+ Q = require('q'),
+ util = require('./util');
+
+/**
+ * Launches a server where the root points to the specified platform in a Cordova project.
+ * @param {string} platform - Cordova platform to serve.
+ * @param {{root: ?string, port: ?number, urlPathProcessor: ?function, streamHandler: ?function, serverExtender: ?function}} opts
+ * root - cordova project directory, or any directory within it. If not specified, cwd is used. This will be modified to point to the platform's www_dir.
+ * All other values are passed unaltered to launchServer().
+ * @returns {*|promise}
+ */
+module.exports = function (platform, opts) {
+ var that = this;
+ return Q().then(function () {
+ if (!platform) {
+ throw new Error('A platform must be specified');
+ }
+
+ opts = opts || {};
+ var projectRoot = findProjectRoot(opts.root);
+ that.projectRoot = projectRoot;
+
+ opts.root = util.getPlatformWwwRoot(projectRoot, platform);
+ if (!fs.existsSync(opts.root)) {
+ throw new Error('Project does not include the specified platform: ' + platform);
+ }
+
+ return that.launchServer(opts);
+ });
+};
+
+function findProjectRoot(path) {
+ var projectRoot = util.cordovaProjectRoot(path);
+ if (!projectRoot) {
+ if (!path) {
+ throw new Error('Current directory does not appear to be in a Cordova project.');
+ } else {
+ throw new Error('Directory "' + path + '" does not appear to be in a Cordova project.');
+ }
+ }
+ return projectRoot;
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/server.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/server.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/server.js
new file mode 100755
index 0000000..9040d2b
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/server.js
@@ -0,0 +1,82 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var chalk = require('chalk'),
+ express = require('express'),
+ Q = require('q');
+
+/**
+ * @desc Launches a server with the specified options and optional custom handlers.
+ * @param {{root: ?string, port: ?number, noLogOutput: ?bool, noServerInfo: ?bool, router: ?express.Router, events: EventEmitter}} opts
+ * @returns {*|promise}
+ */
+module.exports = function (opts) {
+ var deferred = Q.defer();
+
+ opts = opts || {};
+ var port = opts.port || 8000;
+
+ var log = module.exports.log = function (msg) {
+ if (!opts.noLogOutput) {
+ if (opts.events) {
+ opts.events.emit('log', msg);
+ } else {
+ console.log(msg);
+ }
+ }
+ };
+
+ var app = this.app;
+ var server = require('http').Server(app);
+ this.server = server;
+
+ if (opts.router) {
+ app.use(opts.router);
+ }
+
+ if (opts.root) {
+ this.root = opts.root;
+ app.use(express.static(opts.root));
+ }
+
+ // If we have a project root, make that available as a static root also. This can be useful in cases where source
+ // files that have been transpiled (such as TypeScript) are located under the project root on a path that mirrors
+ // the the transpiled file's path under the platform root and is pointed to by a map file.
+ if (this.projectRoot) {
+ app.use(express.static(this.projectRoot));
+ }
+
+ var that = this;
+ server.listen(port).on('listening', function () {
+ that.port = port;
+ if (!opts.noServerInfo) {
+ log('Static file server running on: ' + chalk.green('http://localhost:' + port) + ' (CTRL + C to shut down)');
+ }
+ deferred.resolve();
+ }).on('error', function (e) {
+ if (e && e.toString().indexOf('EADDRINUSE') !== -1) {
+ port++;
+ server.listen(port);
+ } else {
+ deferred.reject(e);
+ }
+ });
+
+ return deferred.promise;
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/util.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/util.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/util.js
new file mode 100755
index 0000000..8fb076b
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/cordova-serve/src/util.js
@@ -0,0 +1,104 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+var fs = require('fs'),
+ path = require('path');
+
+// Some helpful utility stuff copied from cordova-lib. This is a bit nicer than taking a dependency on cordova-lib just
+// to get this minimal stuff. Hopefully we won't need the platform stuff (finding platform www_dir) once it is moved
+// into the actual platform.
+
+var platforms = {
+ amazon_fireos: {www_dir: 'assets/www'},
+ android: {www_dir: 'assets/www'},
+ blackberry10: {www_dir: 'www'},
+ browser: {www_dir: 'www'},
+ firefoxos: {www_dir: 'www'},
+ ios: {www_dir: 'www'},
+ ubuntu: {www_dir: 'www'},
+ windows: {www_dir: 'www'},
+ wp8: {www_dir: 'www'}
+};
+
+/**
+ * @desc Look for a Cordova project's root directory, starting at the specified directory (or CWD if none specified).
+ * @param {string=} dir - the directory to start from (we check this directory then work up), or CWD if none specified.
+ * @returns {string} - the Cordova project's root directory, or null if not found.
+ */
+function cordovaProjectRoot(dir) {
+ if (!dir) {
+ // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly.
+ var pwd = process.env.PWD;
+ var cwd = process.cwd();
+ if (pwd && pwd != cwd && pwd != 'undefined') {
+ return cordovaProjectRoot(pwd) || cordovaProjectRoot(cwd);
+ }
+ return cordovaProjectRoot(cwd);
+ }
+
+ var bestReturnValueSoFar = null;
+ for (var i = 0; i < 1000; ++i) {
+ var result = isRootDir(dir);
+ if (result === 2) {
+ return dir;
+ }
+ if (result === 1) {
+ bestReturnValueSoFar = dir;
+ }
+ var parentDir = path.normalize(path.join(dir, '..'));
+ // Detect fs root.
+ if (parentDir == dir) {
+ return bestReturnValueSoFar;
+ }
+ dir = parentDir;
+ }
+ return null;
+}
+
+function getPlatformWwwRoot(cordovaProjectRoot, platformName) {
+ var platform = platforms[platformName];
+ if (!platform) {
+ throw new Error ('Unrecognized platform: ' + platformName);
+ }
+ return path.join(cordovaProjectRoot, 'platforms', platformName, platform.www_dir);
+}
+
+function isRootDir(dir) {
+ if (fs.existsSync(path.join(dir, 'www'))) {
+ if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ // For sure is.
+ if (fs.existsSync(path.join(dir, 'platforms'))) {
+ return 2;
+ } else {
+ return 1;
+ }
+ }
+ // Might be (or may be under platforms/).
+ if (fs.existsSync(path.join(dir, 'www', 'config.xml'))) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+module.exports = {
+ cordovaProjectRoot: cordovaProjectRoot,
+ getPlatformWwwRoot: getPlatformWwwRoot,
+ platforms: platforms
+};
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.jshintrc
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.jshintrc b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.jshintrc
new file mode 100644
index 0000000..299877f
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.jshintrc
@@ -0,0 +1,3 @@
+{
+ "laxbreak": true
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.npmignore
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.npmignore b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.npmignore
new file mode 100644
index 0000000..7e6163d
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/.npmignore
@@ -0,0 +1,6 @@
+support
+test
+examples
+example
+*.sock
+dist
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/History.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/History.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/History.md
new file mode 100644
index 0000000..854c971
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/History.md
@@ -0,0 +1,195 @@
+
+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
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Makefile
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Makefile b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Makefile
new file mode 100644
index 0000000..5cf4a59
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Makefile
@@ -0,0 +1,36 @@
+
+# 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
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Readme.md
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Readme.md b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Readme.md
new file mode 100644
index 0000000..b4f45e3
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/Readme.md
@@ -0,0 +1,188 @@
+# 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:
+
+ 
+
+ 
+
+#### 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.
+
+ 
+
+ When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
+
+ 
+
+## 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:
+
+ 
+
+### 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.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/bower.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/bower.json b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/bower.json
new file mode 100644
index 0000000..6af573f
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/bower.json
@@ -0,0 +1,28 @@
+{
+ "name": "visionmedia-debug",
+ "main": "dist/debug.js",
+ "version": "2.2.0",
+ "homepage": "https://github.com/visionmedia/debug",
+ "authors": [
+ "TJ Holowaychuk <tj...@vision-media.ca>"
+ ],
+ "description": "visionmedia-debug",
+ "moduleType": [
+ "amd",
+ "es6",
+ "globals",
+ "node"
+ ],
+ "keywords": [
+ "visionmedia",
+ "debug"
+ ],
+ "license": "MIT",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/browser.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/browser.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/browser.js
new file mode 100644
index 0000000..7c76452
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/browser.js
@@ -0,0 +1,168 @@
+
+/**
+ * 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) {}
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/component.json
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/component.json b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/component.json
new file mode 100644
index 0000000..ca10637
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/component.json
@@ -0,0 +1,19 @@
+{
+ "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"
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cef2959c/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/debug.js
----------------------------------------------------------------------
diff --git a/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/debug.js b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/debug.js
new file mode 100644
index 0000000..7571a86
--- /dev/null
+++ b/spec-cordova/fixtures/platforms/cordova-browser/node_modules/debug/debug.js
@@ -0,0 +1,197 @@
+
+/**
+ * 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;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org