Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F52E1852D for ; Sat, 20 Jun 2015 19:33:30 +0000 (UTC) Received: (qmail 37320 invoked by uid 500); 20 Jun 2015 19:33:29 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 37240 invoked by uid 500); 20 Jun 2015 19:33:29 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 36772 invoked by uid 99); 20 Jun 2015 19:33:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Jun 2015 19:33:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 293ECE362F; Sat, 20 Jun 2015 19:33:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: timb@apache.org To: commits@cordova.apache.org Date: Sat, 20 Jun 2015 19:33:43 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [16/16] cordova-browser git commit: Update 'cordova run browser' command to use cordova-serve module. Update 'cordova run browser' command to use cordova-serve module. Project: http://git-wip-us.apache.org/repos/asf/cordova-browser/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-browser/commit/0044fe33 Tree: http://git-wip-us.apache.org/repos/asf/cordova-browser/tree/0044fe33 Diff: http://git-wip-us.apache.org/repos/asf/cordova-browser/diff/0044fe33 Branch: refs/heads/master Commit: 0044fe33ca181db99cebf04558035cffc86f9418 Parents: 42bd8f1 Author: Tim Barham Authored: Tue May 12 09:57:08 2015 +1000 Committer: Tim Barham Committed: Fri Jun 19 15:02:49 2015 -0700 ---------------------------------------------------------------------- bin/templates/project/cordova/lib/exec.js | 46 - bin/templates/project/cordova/lib/run.js | 191 -- bin/templates/project/cordova/run | 24 +- node_modules/cordova-serve/.jshintrc | 11 + node_modules/cordova-serve/README.md | 156 ++ node_modules/cordova-serve/RELEASENOTES.md | 24 + .../cordova-serve/node_modules/.bin/mime | 15 + .../cordova-serve/node_modules/.bin/mime.cmd | 7 + .../cordova-serve/node_modules/.bin/shjs | 15 + .../cordova-serve/node_modules/.bin/shjs.cmd | 7 + .../node_modules/combined-stream/License | 19 + .../node_modules/combined-stream/Readme.md | 138 ++ .../combined-stream/lib/combined_stream.js | 188 ++ .../node_modules/delayed-stream/.npmignore | 1 + .../node_modules/delayed-stream/License | 19 + .../node_modules/delayed-stream/Makefile | 7 + .../node_modules/delayed-stream/Readme.md | 141 ++ .../delayed-stream/lib/delayed_stream.js | 107 + .../node_modules/delayed-stream/package.json | 64 + .../node_modules/combined-stream/package.json | 67 + .../cordova-serve/node_modules/d8/.catn8 | 12 + .../cordova-serve/node_modules/d8/.npmignore | 11 + .../cordova-serve/node_modules/d8/.travis.yml | 2 + .../cordova-serve/node_modules/d8/LICENSE | 9 + .../cordova-serve/node_modules/d8/README.md | 430 ++++ .../cordova-serve/node_modules/d8/d8.js | 800 +++++++ .../cordova-serve/node_modules/d8/d8.min.js | 1 + .../cordova-serve/node_modules/d8/locale/GR.js | 55 + .../node_modules/d8/locale/en-GB.js | 55 + .../node_modules/d8/locale/en-US.js | 55 + .../node_modules/d8/node_modules/m8/.catn8 | 11 + .../d8/node_modules/m8/.nodemonignore | 6 + .../node_modules/d8/node_modules/m8/.npmignore | 11 + .../node_modules/d8/node_modules/m8/.travis.yml | 2 + .../node_modules/d8/node_modules/m8/LICENSE | 9 + .../node_modules/d8/node_modules/m8/README.md | 1085 ++++++++++ .../node_modules/d8/node_modules/m8/entrago.sh | 13 + .../node_modules/d8/node_modules/m8/m8.js | 670 ++++++ .../node_modules/d8/node_modules/m8/m8.min.js | 1 + .../d8/node_modules/m8/package.json | 67 + .../d8/node_modules/m8/src/_begin.js | 2 + .../node_modules/d8/node_modules/m8/src/_end.js | 1 + .../d8/node_modules/m8/src/expose.js | 26 + .../node_modules/d8/node_modules/m8/src/lib.js | 383 ++++ .../d8/node_modules/m8/src/lib.x.js | 25 + .../d8/node_modules/m8/src/nativex.js | 143 ++ .../node_modules/d8/node_modules/m8/src/vars.js | 62 + .../node_modules/d8/node_modules/m8/test/id8.js | 978 +++++++++ .../d8/node_modules/m8/test/index.html | 29 + .../d8/node_modules/m8/test/index.require.html | 47 + .../d8/node_modules/m8/test/m8.test.js | 656 ++++++ .../d8/node_modules/m8/test/require.js | 1981 +++++++++++++++++ .../cordova-serve/node_modules/d8/package.json | 64 + .../cordova-serve/node_modules/d8/src/_begin.js | 3 + .../cordova-serve/node_modules/d8/src/_end.js | 4 + .../cordova-serve/node_modules/d8/src/coerce.js | 103 + .../cordova-serve/node_modules/d8/src/diff.js | 137 ++ .../cordova-serve/node_modules/d8/src/expose.js | 27 + .../node_modules/d8/src/filters.js | 64 + .../cordova-serve/node_modules/d8/src/fns.js | 111 + .../cordova-serve/node_modules/d8/src/format.js | 28 + .../node_modules/d8/src/formats.js | 13 + .../node_modules/d8/src/lexicalize.js | 110 + .../node_modules/d8/src/localize.js | 35 + .../node_modules/d8/src/parsers.js | 59 + .../cordova-serve/node_modules/d8/src/utils.js | 13 + .../cordova-serve/node_modules/d8/src/vars.js | 30 + .../node_modules/d8/test/d8.test.js | 668 ++++++ .../node_modules/d8/test/index.html | 39 + .../node_modules/d8/test/locale/GR.test.js | 667 ++++++ .../node_modules/d8/test/locale/en-US.test.js | 664 ++++++ .../cordova-serve/node_modules/mime/.npmignore | 0 .../cordova-serve/node_modules/mime/LICENSE | 19 + .../cordova-serve/node_modules/mime/README.md | 90 + .../node_modules/mime/build/build.js | 11 + .../node_modules/mime/build/test.js | 57 + .../cordova-serve/node_modules/mime/cli.js | 8 + .../cordova-serve/node_modules/mime/mime.js | 108 + .../node_modules/mime/package.json | 73 + .../cordova-serve/node_modules/mime/types.json | 1 + .../cordova-serve/node_modules/q/CHANGES.md | 786 +++++++ .../cordova-serve/node_modules/q/LICENSE | 18 + .../cordova-serve/node_modules/q/README.md | 881 ++++++++ .../cordova-serve/node_modules/q/package.json | 120 + node_modules/cordova-serve/node_modules/q/q.js | 2048 ++++++++++++++++++ .../cordova-serve/node_modules/q/queue.js | 35 + .../node_modules/shelljs/.documentup.json | 6 + .../node_modules/shelljs/.jshintrc | 7 + .../node_modules/shelljs/.npmignore | 2 + .../node_modules/shelljs/.travis.yml | 6 + .../cordova-serve/node_modules/shelljs/LICENSE | 26 + .../node_modules/shelljs/README.md | 583 +++++ .../node_modules/shelljs/RELEASE.md | 9 + .../cordova-serve/node_modules/shelljs/bin/shjs | 51 + .../node_modules/shelljs/global.js | 3 + .../cordova-serve/node_modules/shelljs/make.js | 56 + .../node_modules/shelljs/package.json | 64 + .../shelljs/scripts/generate-docs.js | 21 + .../node_modules/shelljs/scripts/run-tests.js | 50 + .../cordova-serve/node_modules/shelljs/shell.js | 159 ++ .../node_modules/shelljs/src/cat.js | 43 + .../node_modules/shelljs/src/cd.js | 19 + .../node_modules/shelljs/src/chmod.js | 208 ++ .../node_modules/shelljs/src/common.js | 203 ++ .../node_modules/shelljs/src/cp.js | 204 ++ .../node_modules/shelljs/src/dirs.js | 191 ++ .../node_modules/shelljs/src/echo.js | 20 + .../node_modules/shelljs/src/error.js | 10 + .../node_modules/shelljs/src/exec.js | 212 ++ .../node_modules/shelljs/src/find.js | 51 + .../node_modules/shelljs/src/grep.js | 52 + .../node_modules/shelljs/src/ln.js | 53 + .../node_modules/shelljs/src/ls.js | 126 ++ .../node_modules/shelljs/src/mkdir.js | 68 + .../node_modules/shelljs/src/mv.js | 80 + .../node_modules/shelljs/src/popd.js | 1 + .../node_modules/shelljs/src/pushd.js | 1 + .../node_modules/shelljs/src/pwd.js | 11 + .../node_modules/shelljs/src/rm.js | 163 ++ .../node_modules/shelljs/src/sed.js | 43 + .../node_modules/shelljs/src/tempdir.js | 56 + .../node_modules/shelljs/src/test.js | 85 + .../node_modules/shelljs/src/to.js | 29 + .../node_modules/shelljs/src/toEnd.js | 29 + .../node_modules/shelljs/src/which.js | 83 + node_modules/cordova-serve/package.json | 62 + node_modules/cordova-serve/serve.js | 25 + node_modules/cordova-serve/src/browser.js | 100 + node_modules/cordova-serve/src/exec.js | 46 + node_modules/cordova-serve/src/platform.js | 59 + node_modules/cordova-serve/src/server.js | 141 ++ node_modules/cordova-serve/src/stream.js | 72 + node_modules/cordova-serve/src/util.js | 104 + node_modules/mime/LICENSE | 19 - node_modules/mime/README.md | 66 - node_modules/mime/mime.js | 114 - node_modules/mime/package.json | 38 - node_modules/mime/test.js | 84 - node_modules/mime/types/mime.types | 1588 -------------- node_modules/mime/types/node.types | 77 - node_modules/q/CONTRIBUTING.md | 40 - node_modules/q/LICENSE | 18 - node_modules/q/README.md | 820 ------- .../q/benchmark/compare-with-callbacks.js | 71 - node_modules/q/benchmark/scenarios.js | 36 - node_modules/q/package.json | 112 - node_modules/q/q.js | 1904 ---------------- node_modules/q/queue.js | 35 - package.json | 74 +- 149 files changed, 19457 insertions(+), 5311 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/bin/templates/project/cordova/lib/exec.js ---------------------------------------------------------------------- diff --git a/bin/templates/project/cordova/lib/exec.js b/bin/templates/project/cordova/lib/exec.js deleted file mode 100644 index 43bbc55..0000000 --- a/bin/templates/project/cordova/lib/exec.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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-browser/blob/0044fe33/bin/templates/project/cordova/lib/run.js ---------------------------------------------------------------------- diff --git a/bin/templates/project/cordova/lib/run.js b/bin/templates/project/cordova/lib/run.js deleted file mode 100644 index 2022f89..0000000 --- a/bin/templates/project/cordova/lib/run.js +++ /dev/null @@ -1,191 +0,0 @@ -var spawn = require('child_process').spawn, - shell = require('shelljs'), - fs = require('fs'), - path = require('path'), - exec = require('./exec'), - Q = require('q'), - http = require('http'), - url = require('url'), - mime = require('mime'), - zlib = require('zlib'); - -/** - * Launches the specified browser with the given URL. - * Based on https://github.com/domenic/opener - * @param {string} target Browser target to launch. - * @param {string} url - * @return {Q} Promise to launch the specified browser - */ -exports.runBrowser = function (target, url) { - return mapTarget(target).then(function (browser) { - var args; - 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 - 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; - } - args.push(url); - var command = args.join(" "); - console.log("Executing comamnd: " + command); - return exec(command); - }); -} - -function mapTarget(target) { - var chromeArgs = ' --user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser'; - var browsers = { - 'win32': { - 'ie': 'iexplore', - 'chrome': 'chrome --user-data-dir=C:/Chromedevsession', - 'safari': 'safari', - 'opera': 'opera', - 'firefox': 'firefox', - }, - '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); -} - -function launchServer(projectRoot, port) { - var server = http.createServer( function(request, response) { - function do404() { - console.log('404 ' + request.url); - response.writeHead(404, {'Content-Type': 'text/plain'}); - response.write('404 Not Found\n'); - response.end(); - return ''; - } - function do302(where) { - console.log('302 ' + request.url); - response.setHeader('Location', where); - response.writeHead(302, {'Content-Type': 'text/plain'}); - response.end(); - return ''; - } - function do304() { - console.log('304 ' + request.url); - response.writeHead(304, {'Content-Type': 'text/plain'}); - response.end(); - return ''; - } - function isFileChanged(path) { - var mtime = fs.statSync(path).mtime, - itime = request.headers['if-modified-since']; - return !itime || new Date(mtime) > new Date(itime); - } - - var urlPath = url.parse(request.url).pathname, - filePath = path.join(projectRoot, urlPath); - - fs.exists(filePath, function(exists) { - if (!exists) { - return do404(); - } - if (fs.statSync(filePath).isDirectory()) { - if (!/\/$/.test(urlPath)) { - return do302(request.url + '/'); - } - console.log('200 ' + request.url); - response.writeHead(200, {'Content-Type': 'text/html'}); - response.write('Directory listing of '+ urlPath + ''); - response.write('

Items in this directory

'); - var items = fs.readdirSync(filePath); - response.write('
    '); - for (var i in items) { - var file = items[i]; - if (file) { - response.write('
  • '+file+'
  • \n'); - } - } - response.write('
'); - response.end(); - } else if (!isFileChanged(filePath)) { - do304(); - } else { - var mimeType = mime.lookup(filePath); - var respHeaders = { - 'Content-Type': mimeType - }; - var readStream = fs.createReadStream(filePath); - - var acceptEncoding = request.headers['accept-encoding'] || ''; - if (acceptEncoding.match(/\bgzip\b/)) { - respHeaders['content-encoding'] = 'gzip'; - readStream = readStream.pipe(zlib.createGzip()); - } else if (acceptEncoding.match(/\bdeflate\b/)) { - respHeaders['content-encoding'] = 'deflate'; - readStream = readStream.pipe(zlib.createDeflate()); - } - - var mtime = new Date(fs.statSync(filePath).mtime).toUTCString(); - respHeaders['Last-Modified'] = mtime; - - console.log('200 ' + request.url + ', ' + mimeType + ', ' + mtime + ', ' + filePath); - - response.writeHead(200, respHeaders); - readStream.pipe(response); - } - return ''; - }); - }); - - server.listen(port); - - return server; -} - -/** - * Launches a server of the specified path and returns the URL that will access the path. - * Based on subset of `cordova serve` - * @param {string} path to serve over http - * @param {number} port to serve http on - * @return {Q} Promise to URL that will access the path - */ -exports.runHttpServer = function (path, port) { - - var server = launchServer(path, port), - urlRoot = 'http://localhost:' + port + '/', - deferred = Q.defer(); - - server.on('listening', function () { - deferred.resolve(urlRoot); - }).on('error', function (e) { - deferred.reject(e); - }); - - return deferred.promise; -} http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/bin/templates/project/cordova/run ---------------------------------------------------------------------- diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run index 66ebc95..4ca30a6 100755 --- a/bin/templates/project/cordova/run +++ b/bin/templates/project/cordova/run @@ -19,12 +19,11 @@ under the License. */ -var shell = require('shelljs'), - fs = require('fs'), +var fs = require('fs'), path = require('path'), - run = require('./lib/run'), nopt = require('nopt'), - url = require('url'); + url = require('url'), + serve = require('cordova-serve'); var args = process.argv; @@ -43,26 +42,23 @@ function start(argv) { var root = path.join(__dirname, '../'), configFile = path.resolve(path.join(root, 'config.xml')), configXML = fs.readFileSync(configFile, 'utf8'), - sourceFile = / ] [ --port= ]"); console.log(" --target= : Launches the specified browser. Chrome is default."); - console.log(" --port= : Http server uses specified port numner."); + console.log(" --port= : Http server uses specified port number."); console.log("Examples:"); console.log(" run"); console.log(" run -- --target=ie"); console.log(" run -- --target=chrome --port=8000"); console.log(""); process.exit(0); -}; +} http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/.jshintrc ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/.jshintrc b/node_modules/cordova-serve/.jshintrc new file mode 100644 index 0000000..6997763 --- /dev/null +++ b/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-browser/blob/0044fe33/node_modules/cordova-serve/README.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/README.md b/node_modules/cordova-serve/README.md new file mode 100644 index 0000000..0cd0065 --- /dev/null +++ b/node_modules/cordova-serve/README.md @@ -0,0 +1,156 @@ + + +# 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); +serve.sendStream(filePath, request, response[, readStream][, noCache]); +``` + +## 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, + +## sendStream() + +``` js +sendStream(filePath, request, response[, readStream][, noCache]); +``` + +The server uses this method to stream files, and it is provided as a convenience method you can use if you are +customizing the stream by specifying `opts.streamHandler`. Parameters: + +* **filePath**: The absolute path to the file to be served (which will have been passed to your `streamHandler`). +* **request**: The request object (which will have been passed to your `streamHandler`). +* **response**: The response object (which will have been passed to your `streamHandler`). +* **readStream**: (optional) A custom read stream, if required. +* **noCache**: (optional) If true, browser caching will be disabled for this file (by setting response header + Cache-Control will be set to 'no-cache') + +## 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. +* **urlPathHandler**: An optional method to provide custom handling for processing URLs and serving up the resulting data. + Can serve up the data itself using `response.write()`, or determine a custom local file path and call `serveFile()` to + serve it up, or do no processing and call `serveFile` with no params to treat `urlPath` as relative to the root. +* **streamHandler**: An optional custom stream handler - `cordova-serve` will by default stream files using + `sendStream()`, described above, which just streams files, but will first call this method, if provided, to + support custom streaming. This method is described in more detail below. +* **serverExtender**: This method is called as soon as the server is created, so that the caller can do + additional things with the server (like attach to certain events, for example). This method is described in more + detail below. + +## urlPathHandler() +Provide this method if you need to do custom processing of URL paths (that is, custom mapping of URL path to local file +path) and potentially directly handle serving up the resulting data. The signature of this method is as follows: + +``` js +urlPathHandler(urlPath, request, response, do302, do404, serveFile) +``` + +Parameters: + +* **urlPath**: The URL path to process. It is the value of `url.parse(request.url).pathname`. +* **request**: The server request object. +* **response**: The server response object. +* **do302**: A helper method to do a 302 HTTP response (redirection). It takes a single parameter - the URL to redirect to. +* **do404**: A helper method to do a 404 HTTP response (not found). +* **serveFile**: A helper method to serve up the resulting file. If `urlPathHandler()` doesn't write the response itself, + it should call this method either passing it the local file path to be served, or passing it nothing. In the latter case, + it will treat `urlPath` as relative to the root. + +## streamHandler() +Provide this method if you wish to perform custom stream handling. The signature of this method is as follows: + +``` js +streamHandler(filePath, request, response) +``` + +Parameters: + +* **filePath**: This is the path to the local file that will be streamed. It might be the value you returned from + urlPathProcessor(), in which case it doesn't necessarily have to reference an actual file: it might just be an + identifier string that your custom stream handler will recognize. If you are going to end up calling `sendStream()`, + it is useful if even a fake file name has a file extension, as that is used for mime type lookup. +* **request**: The server request object. +* **response**: The serve response object. + +Return value: + +Return `true` if you have handled the stream request, otherwise `false`. + +## serverExtender() + +If you provide this method, it will be called as soon as the server is created. It allows you to attach additional +functionality to the server, such has event handlers, web sockets etc. The signature of this method is as follows: + +``` js +serverExtender(server, root) +``` + +Parameters: + +* **server**: A reference to the server (the result of calling `http.createServer()`). +* **root**: The file path on the local file system that is used as the root for the server (if it was provided), for + default mapping of URL path to local file system path. + http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/RELEASENOTES.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/RELEASENOTES.md b/node_modules/cordova-serve/RELEASENOTES.md new file mode 100644 index 0000000..14e1142 --- /dev/null +++ b/node_modules/cordova-serve/RELEASENOTES.md @@ -0,0 +1,24 @@ + +# Cordova-serve Release Notes + +### 0.1.2 (June 15, 2015) +Initial release http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/.bin/mime ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/.bin/mime b/node_modules/cordova-serve/node_modules/.bin/mime new file mode 100644 index 0000000..f309578 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/.bin/mime @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=`dirname "$0"` + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../mime/cli.js" "$@" + ret=$? +else + node "$basedir/../mime/cli.js" "$@" + ret=$? +fi +exit $ret http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/.bin/mime.cmd ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/.bin/mime.cmd b/node_modules/cordova-serve/node_modules/.bin/mime.cmd new file mode 100644 index 0000000..8169562 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/.bin/mime.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\mime\cli.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\mime\cli.js" %* +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/.bin/shjs ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/.bin/shjs b/node_modules/cordova-serve/node_modules/.bin/shjs new file mode 100644 index 0000000..9908675 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/.bin/shjs @@ -0,0 +1,15 @@ +#!/bin/sh +basedir=`dirname "$0"` + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/../shelljs/bin/shjs" "$@" + ret=$? +else + node "$basedir/../shelljs/bin/shjs" "$@" + ret=$? +fi +exit $ret http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/.bin/shjs.cmd ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/.bin/shjs.cmd b/node_modules/cordova-serve/node_modules/.bin/shjs.cmd new file mode 100644 index 0000000..3d98b0b --- /dev/null +++ b/node_modules/cordova-serve/node_modules/.bin/shjs.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\shelljs\bin\shjs" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\shelljs\bin\shjs" %* +) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/License ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/License b/node_modules/cordova-serve/node_modules/combined-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/Readme.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/Readme.md b/node_modules/cordova-serve/node_modules/combined-stream/Readme.md new file mode 100644 index 0000000..3a9e025 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/Readme.md @@ -0,0 +1,138 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** Currently `combined-stream` works with streams vesrion 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatability with `combined-stream`. + +- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. + +- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = `true` + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = `2 * 1024 * 1024` + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = `0` + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/lib/combined_stream.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/lib/combined_stream.js b/node_modules/cordova-serve/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 0000000..6b5c21b --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,188 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/License ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/License b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/License new file mode 100644 index 0000000..4804b7a --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +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-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Makefile ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Makefile new file mode 100644 index 0000000..b4ff85a --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Readme.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Readme.md new file mode 100644 index 0000000..aca36f9 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 0000000..b38fc85 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/package.json ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/package.json b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/package.json new file mode 100644 index 0000000..8ac66b8 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/node_modules/delayed-stream/package.json @@ -0,0 +1,64 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "contributors": [ + { + "name": "Mike Atkins", + "email": "apeherder@gmail.com" + } + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + }, + "gitHead": "07a9dc99fb8f1a488160026b9ad77493f766fb84", + "bugs": { + "url": "https://github.com/felixge/node-delayed-stream/issues" + }, + "_id": "delayed-stream@1.0.0", + "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", + "_from": "delayed-stream@>=1.0.0 <1.1.0", + "_npmVersion": "2.8.3", + "_nodeVersion": "1.6.4", + "_npmUser": { + "name": "apechimp", + "email": "apeherder@gmail.com" + }, + "dist": { + "shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", + "tarball": "http://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + }, + "maintainers": [ + { + "name": "felixge", + "email": "felix@debuggable.com" + }, + { + "name": "apechimp", + "email": "apeherder@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/combined-stream/package.json ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/combined-stream/package.json b/node_modules/cordova-serve/node_modules/combined-stream/package.json new file mode 100644 index 0000000..7c5c82c --- /dev/null +++ b/node_modules/cordova-serve/node_modules/combined-stream/package.json @@ -0,0 +1,67 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "1.0.5", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT", + "gitHead": "cfc7b815d090a109bcedb5bb0f6713148d55a6b7", + "bugs": { + "url": "https://github.com/felixge/node-combined-stream/issues" + }, + "_id": "combined-stream@1.0.5", + "_shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", + "_from": "combined-stream@>=1.0.3 <2.0.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "0.12.4", + "_npmUser": { + "name": "alexindigo", + "email": "iam@alexindigo.com" + }, + "dist": { + "shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", + "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz" + }, + "maintainers": [ + { + "name": "felixge", + "email": "felix@debuggable.com" + }, + { + "name": "celer", + "email": "dtyree77@gmail.com" + }, + { + "name": "alexindigo", + "email": "iam@alexindigo.com" + }, + { + "name": "apechimp", + "email": "apeherder@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "readme": "ERROR: No README data found!" +} http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/d8/.catn8 ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/d8/.catn8 b/node_modules/cordova-serve/node_modules/d8/.catn8 new file mode 100644 index 0000000..8768cab --- /dev/null +++ b/node_modules/cordova-serve/node_modules/d8/.catn8 @@ -0,0 +1,12 @@ +{ + "source" : { + "dir" : "./src", + "files" : ["utils", "vars", "coerce", "diff", "fns", "format", + "lexicalize", "localize", "filters", "formats", "parsers", "expose"] + }, + "target" : { + "dir" : "{pwd}", + "min" : true + }, + "type" : "application/javascript" +} http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/d8/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/d8/.npmignore b/node_modules/cordova-serve/node_modules/d8/.npmignore new file mode 100644 index 0000000..aaceacc --- /dev/null +++ b/node_modules/cordova-serve/node_modules/d8/.npmignore @@ -0,0 +1,11 @@ +.git* +.DS_Store +.idea + +node_modules +npm-debug.log + +*.bak* +*.local* + +__ignore__ http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/d8/.travis.yml ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/d8/.travis.yml b/node_modules/cordova-serve/node_modules/d8/.travis.yml new file mode 100644 index 0000000..a2f5f9f --- /dev/null +++ b/node_modules/cordova-serve/node_modules/d8/.travis.yml @@ -0,0 +1,2 @@ +language: node_js +node_js: 0.8 http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/d8/LICENSE ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/d8/LICENSE b/node_modules/cordova-serve/node_modules/d8/LICENSE new file mode 100644 index 0000000..3d98f9f --- /dev/null +++ b/node_modules/cordova-serve/node_modules/d8/LICENSE @@ -0,0 +1,9 @@ +(The MIT License) + +Copyright (c) 2011 christos "constantology" constandinou http://muigui.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-browser/blob/0044fe33/node_modules/cordova-serve/node_modules/d8/README.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-serve/node_modules/d8/README.md b/node_modules/cordova-serve/node_modules/d8/README.md new file mode 100644 index 0000000..13b2795 --- /dev/null +++ b/node_modules/cordova-serve/node_modules/d8/README.md @@ -0,0 +1,430 @@ +# d8.js [![build status](https://secure.travis-ci.org/constantology/d8.png)](http://travis-ci.org/constantology/d8) + +d8 is a date parsing and formatting micro-framework for modern JavaScript engines. + +d8 formats Dates into Strings and conversley turns Strings into Dates based on [php formatting options](http://php.net/manual/en/function.date.php). + +As d8 extends JavaScript's native `Date` & `Date.prototype` – the CORRECT way – there is no actual global called d8. Instead all static and instance methods are available on the native `Date` & `Date.prototype` respectively. + +currently the only locales available are: + +- en-GB (0.9kb gzipped) +- en-US (0.9kb gzipped) +- GR (1.1kb gzipped) **this still needs some work as my Greek is — how you say — "hella-rusty"** + +but feel free to create a locale for your specific nationality and submit a pull request! :D + +## File size + +- d8.js ≅ 8.8kb (gzipped) +- d8.min.js ≅ 5.2kb (minzipped) + +## Dependencies + +d8.js only has one dependency [m8.js](/constantology/m8). + +**NOTE:** +If you are using d8 within a commonjs module, you don't need to require m8 before requiring d8 as this is done internally. + +Also, since d8.js simply extends the Native Date Class, a reference to **m8 IS NOT** stored. + +## browser usage + +```html + + + + + + + +``` + +## nodejs usage + +```javascript + + require( 'd8' ); + require( 'd8/locale/en-GB' ); // NOTE: This should now come after the actual library, since it is now possible to have use locales at once + + // if running in a sandboxed environment remember to: + require( 'm8' ).x( Date/*[, Object, Array, Boolean Function]*/ ); // and/ or any other Types that require extending. + +``` + +As mentioned above d8 extends JavaScript's native `Date` & `Date.prototype`, so when requiring d8, you don't need to assign it to a variable to use d8's features. + +## Support + +Tested to work with nodejs, FF4+, Safari 5+, Chrome 7+, IE9+ and Opera — with one exception: `( new Date( [] ) ).valid() )` returns `true` in Opera and false in every other browser — technically **d8** should work in any JavaScript parser that supports [ecma 5]( http://kangax.github.com/es5-compat-table/) without throwing any JavaScript errors. + +## API + +### Static methods + +#### isLeapYear( year:String ):Boolean +Returns true if the passed **4 digit** year is a leap year. + +**NOTE:** This method is located in the locale file. If your calendar system does not contain leap years, you can simply change the method to only `return false`. + +#### getOrdinal( date:Number ):String +Returns the ordinal for a given date. + +##### Example: + +```javascript + + Date.getOrdinal( 1 ); // returns => "st" + Date.getOrdinal( 10 ); // returns => "th" + Date.getOrdinal( 22 ); // returns => "nd" + Date.getOrdinal( 33 ); // returns => "rd" + +``` + +**NOTE:** Ordinals and the `getOrdinal` This method is located in the locale file. You can simply change the `ordinal` Array to your specific language; overwrite the `getOrdinal` method or both. + +#### setLeapYear( date:Date ):Void +Sets the inlcuded locale's February day count to the correct number of days, based on whether or not the date is a leap year or not. + +**NOTE:** This method is located in the locale file. If your calendar system does not contain leap years, you can simply change the method to do nothing. + +#### toDate( date:String, format:String ):Date +Takes a date String and a format String based on the **Date formatting and parsing options** described below and returns a – hopefully – correct and valid Date. + +```javascript + + Date.toDate( 'Sunday, the 1st of January 2012', 'l, jS F Y' ); // returns => Date { Sun Jan 01 2012 00:00:00 GMT+0000 (GMT) } + Date.toDate( '2012-01-01T00:00:00+00:00', Date.formats.ISO_8601 ); // returns => Date { Sun Jan 01 2012 00:00:00 GMT+0000 (GMT) } + +``` + +### Static properties + +#### filters +An Object of all the available filters for formatting a Date. + +**IMPORTANT: Don't change these unless you know what you are doing!** + +#### formats +An Object containing some default date formats: + + + + + + +
ISO_8601Y-m-dH:i:sP
ISO_8601_SHORTY-m-d
RFC_850l, d-M-y H:i:s T
RFC_2822D, d M Y H:i:s O
sortableY-m-d H:i:sO
+ +### Instance methods + +#### adjust( interval:Object|String[, value:Number] ):Date +Your one stop shop for all Date arithmetic. Adjusts the Date based on the passed `interval`, by the passed numeric `value`. + +**Note:** The method also accepts a single Object param where each key is the interval and each value is the number to adjust the Date by. + +**Valid intervals are:** year, month, week, day, hr, min, sec, ms. + +##### Example: + +```javascript + + var date = new Date( 2012, 0, 1 ); // Date {Sun Jan 01 2012 00:00:00 GMT+0000 (GMT)} + + date.adjust( Date.DAY, 1 ); // Date {Mon Jan 02 2012 00:00:00 GMT+0000 (GMT)} + date.adjust( Date.HOUR, -1 ); // Date {Sun Jan 01 2012 23:00:00 GMT+0000 (GMT)} + date.adjust( { + year : -1, month : -1, day : 24, + hr : 1, sec : -1 + } ); // Date {Sat Dec 25 2010 23:59:59 GMT+0000 (GMT)} + +``` + +#### between( date_lower:Date, date_higher:Date ):Boolean +Checks to see if the Date instance is in between the two passed Dates. + +##### Example: + +```javascript + + var date = new Date( 2012, 0, 1 ); + + date.between( new Date( 2011, 0, 1 ), new Date( 2013, 0, 1 ) ); // returns => true; + + date.between( new Date( 2013, 0, 1 ), new Date( 2011, 0, 1 ) ); // returns => false; + +``` + +#### clearTime():Date +Clears the time from the Date instance. + +#### clone():Date +Returns a clone of the current Date. + +#### diff( [date:Date, exclude:String] ):Object +Returns an Object describing the difference between the Date instance and now — or the optionally passed Date. + +The Object will contain any or all of the following properties: + + + + + + + + + + + + + + + + + +
PropTypeDescription
tenseNumberThis will either be: +
+
-1
The Date instance is less than now or the passed Date, i.e. in the past
+
0
The Date instance is equal to now or the passed Date, i.e. in the present.
NOTE: If tense is 0 then the Object will most probably have no other properties, except value, which will be zero.
+
1
The Date instance is greater than now or the passed Date, i.e. in the future
+
+ NOTE: To make the diff Object's values easier to work with all other properties will be positive Numbers. You should use the tense property as your reference for the diff being in the past, present or future. +
valueNumberThe — absolute — number of milliseconds difference between the two Dates.
yearsNumberThe number of years the Date instance is ahead or behind the passed Date.
monthsNumberThe months of years the Date instance is ahead or behind the passed Date.
weeksNumberThe weeks of years the Date instance is ahead or behind the passed Date.
daysNumberThe days of years the Date instance is ahead or behind the passed Date.
hoursNumberThe hours of years the Date instance is ahead or behind the passed Date.
minutesNumberThe minutes of years the Date instance is ahead or behind the passed Date.
secondsNumberThe seconds of years the Date instance is ahead or behind the passed Date.
millisecondsNumberThe milliseconds of years the Date instance is ahead or behind the passed Date.
+ +**NOTE:** If any property — other than `tense` & `value` — is zero it will be omitted from the `diff` Object. + + +##### Example: + +```javascript + + ( new Date( 2012, 0, 1 ) ).diff( new Date( 2012, 0, 1 ) ) // returns => { tense : 0 } + + ( new Date( 2012, 0, 1 ) ).diff( new Date( 2012, 0, 2 ) ) // returns => { tense : -1, value : 86400000, days : 1 } + + ( new Date( 2012, 0, 2 ) ).diff( new Date( 2012, 0, 1 ) ) // returns => { tense : 1, value : 86400000, days : 1 } + + ( new Date( 2012, 0, 1 ) ).diff( new Date( 2010, 9, 8, 7, 6, 5, 4 ) ) // returns => { tense : 1, value : 38858034996, years : 1, months : 2, weeks : 3, days : 3, hours : 17, minutes : 53, seconds : 54, ms : 995 } + +``` + +**NOTE:** You can supply a **space delimited** String defining which properties you want to exclude from the result and `diff` will either pass the current calculation to the next time unit or, if there are none will round off — up if over .5 or down if less, uses `Math.round` to figure this out — to the previous time unit. + +Exclusion codes: +- `-` will exclude the time unit from the `diff` Object. +- `+` will include the time unit in the `diff` Object. **Note:** this is the same as not including the time unit in the `exclusions` String. +- `>` will exclude all time units from this time unit down from the `diff` Object. + +##### Example with exclusions: + +```javascript + + ( new Date( 2012, 0, 1 ) ).diff( new Date( 2012, 0, 2 ), '-days' ) // returns => { tense : -1, value : 86400000, hours : 24 } + + ( new Date( 2012, 0, 2 ) ).diff( new Date( 2012, 0, 1 ), '-days' ) // returns => { tense : 1, value : 86400000, hours : 24 } + + ( new Date( 2012, 0, 1 ) ).diff( new Date( 2010, 9, 8, 7, 6, 5, 4 ), '-years -weeks >minutes' ) // returns => { tense : 1, value : 38858034996, months : 14, days : 29, hours : 18 } + +``` + +#### format( format:String ):String +Returns a string representation of the Date instance, based on the passed format. See the [Date formatting and parsing options](#date-formatting-and-parsing-options) below. + +##### Example: + +```javascript + + ( new Date( 2012, 0, 1 ) ).format( 'c' ); // returns => "2012-01-01T00:00:00.000Z" + // which is a short hand format for: + ( new Date( 2012, 0, 1 ) ).format( 'Y-m-dH:i:s.u' ); // returns => "2012-01-01T00:00:00.000Z" + + ( new Date( 2012, 0, 1 ) ).format( 'l, nS F Y' ) // returns => "Sunday, the 1st of January 2012" + +``` + +You can use predefined formats found in `Date.formats`. **Hint:** You can do: + +```javascript + + console.dir( Date.formats ); + +``` + +within your browser's JavaScript console to see a list of available formats. + +Previously used formats are also cached to save the overhead of having to create a `new Function` everytime you want to format a date. + +#### getDayOfYear():Number +Returns the zero based day of the year. + +#### getFirstOfTheMonth():Date +Returns a Date instance of the first day of this Date instance's month. + +#### getGMTOffset( [colon:Boolean] ):String +Returns the Date instances offset from GMT. + +#### getISODay():Number +Returns the ISO day of the week. + +#### getISODaysInYear():Number +Returns the ISO number of days in the year. + +#### getISOFirstMondayOfYear():Date +Returns the ISO first Monday of the year. + +#### getISOWeek():Number +Returns the ISO week of the year + +#### getISOWeeksInYear():Number +Returns the number of weeks in the ISO year. + +#### getLastOfTheMonth():Date +Returns a Date instance of the last day of this Date instance's month. + +#### getWeek():Number +Returns the week of the year, based on the `dayOfYear` divided by 7. + +##### Example: + +```javascript + + ( new Date( 2012, 0, 1 ) ).getWeek(); // returns => 0 + ( new Date( 2012, 2, 13 ) ).getWeek(); // returns => 10 + ( new Date( 2012, 11, 31 ) ).getWeek(); // returns => 52 + +``` + +#### isDST():Boolean +Returns true if the Date instance is within daylight savings time. + +#### isLeapYear():Boolean +Returns true if the Date instance is a leap year. + +#### lexicalize( [now:Date, format:String] ):String +Returns a String representation of the difference between the date instance and now, or the passed `Date`. + +#### Available formats +The default format is `approx`, however this can be over-written by changing the **locale** file and/ or by passing in the desired format to the method. + + + + +
approxWill return an approximate difference. e.g. about 2 days ago; almost 1 and a half years from now.
exactWill return the exact difference, e.g. 2 days 3 hours and 5 minutes ago; 1 year, 4 months, 2 weeks, 1 day, 5 hours, 3 minutes and 7 seconds from now.
+ +##### Example: + +```javascript + + var date = new Date( 2012, 0, 1 ); + + date.clone().adjust( { hr : -3, day : -2 } ).lexicalize( date, 'approx' ); // returns => "just over 2 days ago" + date.clone().adjust( { hr : -3, day : -2 } ).lexicalize( date, 'exact' ); // returns => "2 days and 3 hours ago" + + date.lexicalize( date.clone().adjust( { hr : -6, day : -2 } ), 'approx' ); // returns => "almost 2 and a half days from now" + date.lexicalize( date.clone().adjust( { hr : -6, day : -2 } ), 'exact' ); // returns => "2 days and 6 hours from now" + +``` + +#### setWeek():Number(UnixTimeStamp) +Sets the week of the year from the 1st January. + +##### Example: + +```javascript + + new Date( ( new Date( 2012, 0, 1 ) ).setWeek( 17 ) ); // returns => Date {Sun Apr 29 2012 00:00:00 GMT+0100 (BST)} + + ( new Date( 2012, 2, 13 ) ).setWeek( 17 ); // returns => 1335654000000 same as above + + ( new Date( 2012, 11, 31 ) ).setWeek( 17 ); // returns => 1335654000000 + +``` + +#### timezone():String +Returns the JavaScript engine's Date.prototype.toString() timezone abbreviation. + +## Date formatting and parsing options + +### escaping characters + +If you want to escape characters that are used by the Date parser you can wrap them between <>. + +#### Example: + +```javascript + + ( new Date( 2012, 0, 1 ) ).format( 'l, jS F Y' ); // returns => "Sunday, the 1st of January 2012" + +``` + +### day + + + + + + + + + +
dDay of the month, 2 digits with leading zeros
DA textual representation of a day, three letters
jDay of the month without leading zeros
lA full textual representation of the day of the week
NISO-8601 numeric representation of the day of the week
SEnglish ordinal suffix for the day of the month, 2 characters
wNumeric representation of the day of the week
zThe day of the year (starting from 0)
+### week + + +
WISO-8601 week number of year, weeks starting on Monday
+### month + + + + + + +
FA full textual representation of a month
mNumeric representation of a month, with leading zeros
MA short textual representation of a month, three letters
nNumeric representation of a month, without leading zeros
tNumber of days in the given month
+### year + + + + + +
LWhether it's a leap year
oISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead.
YA full numeric representation of a year, 4 digits
yA two digit representation of a year
+### time + + + + + + + + + + +
aLowercase Ante meridiem and Post meridiem
AUppercase Ante meridiem and Post meridiem
g12-hour format of an hour without leading zeros
G24-hour format of an hour without leading zeros
h12-hour format of an hour with leading zeros
H24-hour format of an hour with leading zeros
iMinutes with leading zeros
sSeconds, with leading zeros
uMilliseconds
+### timezone + + + + + +
ODifference to Greenwich time (GMT) in hours
PDifference to Greenwich time (GMT) with colon between hours and minutes
TTimezone abbreviation
ZTimezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
+### full date/time + + + + +
cISO 8601 date
rRFC 2822 formatted date
USeconds since the Unix Epoch January 1 1970 00:00:00 GMT
+### custom + + + +
ethis is a convenience for `date.lexicalize( 'exact' );`
xthis is a convenience for `date.lexicalize( 'approx' );`
+ +## License + +(The MIT License) + +Copyright © 2012 christos "constantology" constandinou http://muigui.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. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org