UNPKG

cordova-browser

Version:
132 lines (131 loc) 8.97 kB
{ "_args": [ [ { "raw": "cordova-serve@^2.0.0", "scope": null, "escapedName": "cordova-serve", "name": "cordova-serve", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "/Users/steveng/repo/cordova/cordova-browser" ] ], "_from": "cordova-serve@>=2.0.0 <3.0.0", "_id": "cordova-serve@2.0.0", "_inCache": true, "_location": "/cordova-serve", "_nodeVersion": "6.6.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/cordova-serve-2.0.0.tgz_1504051489694_0.8920979660470039" }, "_npmUser": { "name": "stevegill", "email": "stevengill97@gmail.com" }, "_npmVersion": "4.6.1", "_phantomChildren": {}, "_requested": { "raw": "cordova-serve@^2.0.0", "scope": null, "escapedName": "cordova-serve", "name": "cordova-serve", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/" ], "_resolved": "file:tools/cordova-serve-2.0.0.tgz", "_shasum": "d7834b83b186607e2b8f1943e073c0633360ea43", "_shrinkwrap": null, "_spec": "cordova-serve@^2.0.0", "_where": "/Users/steveng/repo/cordova/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", "open": "0.0.5", "shelljs": "^0.5.3" }, "description": "Apache Cordova server support for cordova-lib and cordova-browser.", "devDependencies": { "eslint": "^4.0.0", "eslint-config-semistandard": "^11.0.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.3.0", "eslint-plugin-node": "^5.0.0", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", "jasmine": "^2.5.2", "rewire": "^2.5.2" }, "directories": {}, "dist": { "shasum": "d7834b83b186607e2b8f1943e073c0633360ea43", "tarball": "https://registry.npmjs.org/cordova-serve/-/cordova-serve-2.0.0.tgz" }, "engines": { "node": ">=4.0.0", "npm": ">= 2.5.1" }, "homepage": "https://github.com/apache/cordova-lib#readme", "keywords": [ "cordova", "server", "apache" ], "license": "Apache-2.0", "main": "src/main.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": "<!--\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n-->\n\n[![Build status](https://ci.appveyor.com/api/projects/status/ewv1mhbvms0bfm26?svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-serve/branch/master)\n[![Build Status](https://travis-ci.org/apache/cordova-serve.svg?branch=master)](https://travis-ci.org/apache/cordova-serve)\n[![NPM](https://nodei.co/npm/cordova-serve.png)](https://nodei.co/npm/cordova-serve/)\n\n# cordova-serve\nThis module can be used to serve up a Cordova application in the browser. It has no command-line, but rather is intended\nto be called using the following API:\n\n``` js\nvar cordovaServe = require('cordova-serve')();\ncordovaServe.launchServer(opts);\ncordovaServe.servePlatform(platform, opts);\ncordovaServe.launchBrowser(ops);\n```\n\n## launchServer()\n\n``` js\nvar cordovaServe = require('cordova-serve')();\ncordovaServe.launchServer(opts).then(function () {\n var server = cordovaServe.server;\n var root = cordovaServe.root;\n var port = cordovaServe.port;\n\n ...\n}, function (error) {\n console.log('An error occurred: ' + error);\n});\n```\n\nLaunches a server with the specified options. Parameters:\n\n* **opts**: Options, as described below.\n\nReturns a promise that is fulfilled once the server has launched, or rejected if the server fails to launch. Once the\npromise is fulfilled, the following properties are available on the `cordovaServe` object:\n \n * **cordovaServe.serve**: The Node http.Server instance.\n * **cordovaServe.root**: The root that was specified, or cwd if none specified.\n * **cordovaServe.port**: The port that was used (could be the requested port, the default port, or some incremented\n value if the chosen port was in use).\n\n## servePlatform()\n\n``` js\nvar cordovaServe = require('cordova-serve')();\ncordovaServe.servePlatform(platform, opts).then(function () {\n var server = cordovaServe.server;\n var port = cordovaServe.port;\n var projectRoot = cordovaServe.projectRoot;\n var platformRoot = cordovaServe.root;\n\n ...\n}, function (error) {\n console.log('An error occurred: ' + error);\n});\n```\n\nLaunches a server that serves up any Cordova platform (e.g. `browser`, `android` etc) from the current project.\nParameters:\n\n* **opts**: Options, as described below. Note that for `servePlatform()`, the `root` value should be a Cordova project's\n root folder, or any folder within it - `servePlatform()` will replace it with the platform's `www_dir` folder. If this\n value is not specified, the *cwd* will be used.\n\nReturns a promise that is fulfilled once the server has launched, or rejected if the server fails to launch. Once the\npromise is fulfilled, the following properties are available on the `cordovaServe` object:\n \n * **cordovaServe.serve**: The Node http.Server instance.\n * **cordovaServe.root**: The requested platform's `www` folder.\n * **cordovaServe.projectRoot**: The root folder of the Cordova project.\n * **cordovaServe.port**: The port that was used (could be the requested port, the default port, or some incremented\n value if the chosen port was in use).\n\n## launchBrowser()\n\n``` js\nvar cordovaServe = require('cordova-serve')();\ncordovaServe.launchBrowser(opts).then(function (stdout) {\n console.log('Browser was launched successfully: ' + stdout);\n}, function (error) {\n console.log('An error occurred: ' + error);\n});\n```\n\nLaunches a browser window pointing to the specified URL. The single parameter is an options object that supports the\nfollowing values (both optional):\n\n* **url**: The URL to open in the browser.\n* **target**: The name of the browser to launch. Can be any of the following: `chrome`, `chromium`, `firefox`, `ie`,\n `opera`, `safari`. Defaults to `chrome` if no browser is specified.\n\nReturns a promise that is fulfilled once the browser has been launched, or rejected if an error occurs.\n\n## The *opts* Options Object\nThe opts object passed to `launchServer()` and `servePlatform()` supports the following values (all optional):\n\n* **root**: The file path on the local file system that is used as the root for the server, for default mapping of URL\n path to local file system path. \n* **port**: The port for the server. Note that if this port is already in use, it will be incremented until a free port\n is found.\n* **router**: An `ExpressJS` router. If provided, this will be attached *before* default static handling.\n* **noLogOutput**: If `true`, turns off all log output. \n* **noServerInfo**: If `true`, cordova-serve won't output `Static file server running on...` message.\n* **events**: An `EventEmitter` to use for logging. If provided, logging will be output using `events.emit('log', msg)`.\n If not provided, `console.log()` will be used. Note that nothing will be output in either case if `noLogOutput` is `true`.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/apache/cordova-lib.git" }, "scripts": { "eslint": "node node_modules/eslint/bin/eslint ./src", "jasmine": "jasmine JASMINE_CONFIG_PATH=spec/jasmine.json", "test": "npm run eslint && npm run jasmine" }, "version": "2.0.0" }