@ionic/cli-plugin-ionic1
Advanced tools
Comparing version
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="2.1.1"></a> | ||
## [2.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic1@2.1.0...@ionic/cli-plugin-ionic1@2.1.1) (2017-08-03) | ||
### Bug Fixes | ||
* **ionic1:** have --lab respect -b ([93bbc88](https://github.com/ionic-team/ionic-cli/commit/93bbc88)) | ||
* **serve:** allow binding of localhost ([e8a74d0](https://github.com/ionic-team/ionic-cli/commit/e8a74d0)) | ||
<a name="2.1.0"></a> | ||
@@ -8,0 +20,0 @@ # [2.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic1@2.0.1...@ionic/cli-plugin-ionic1@2.1.0) (2017-07-27) |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.name = '@ionic/cli-plugin-ionic1'; | ||
exports.version = '2.2.0-alpha.34095a41'; | ||
exports.version = '2.2.0-alpha.35fa3b5c'; | ||
function registerHooks(hooks) { | ||
@@ -12,0 +12,0 @@ hooks.register(exports.name, 'command:docs', () => tslib_1.__awaiter(this, void 0, void 0, function* () { |
/// <reference types="express" /> | ||
import * as expressType from 'express'; | ||
import { IProject } from '@ionic/cli-utils'; | ||
import { IonicEnvironment } from '@ionic/cli-utils'; | ||
import { ServerOptions } from './config'; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function createHttpServer(project: IProject, options: ServerOptions): Promise<expressType.Application>; | ||
export declare function createHttpServer(env: IonicEnvironment, options: ServerOptions): Promise<expressType.Application>; |
@@ -9,10 +9,8 @@ "use strict"; | ||
const live_reload_1 = require("./live-reload"); | ||
const lab_1 = require("./lab"); | ||
const modules_1 = require("../lib/modules"); | ||
/** | ||
* Create HTTP server | ||
*/ | ||
function createHttpServer(project, options) { | ||
function createHttpServer(env, options) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const express = modules_1.load('express'); | ||
const express = yield Promise.resolve().then(function () { return require('express'); }); | ||
const app = express(); | ||
@@ -25,4 +23,12 @@ app.set('serveOptions', options); | ||
app.use(config_1.IONIC_LAB_URL + '/static', express.static(path.join(__dirname, '..', '..', 'lab', 'static'))); | ||
app.get(config_1.IONIC_LAB_URL, lab_1.LabAppView); | ||
app.get(config_1.IONIC_LAB_URL + '/api/v1/cordova', lab_1.ApiCordovaProject); | ||
app.get(config_1.IONIC_LAB_URL, (req, res) => res.sendFile('index.html', { root: path.join(__dirname, '..', '..', 'lab') })); | ||
app.get(config_1.IONIC_LAB_URL + '/api/v1/cordova', (req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const [info] = yield env.hooks.fire('cordova:project:info', { env }); | ||
if (info) { | ||
res.json(info); | ||
} | ||
else { | ||
res.status(400).json({ status: 'error', message: 'Unable to load config.xml' }); | ||
} | ||
})); | ||
app.get('/cordova.js', servePlatformResource, serveMockCordovaJS); | ||
@@ -32,3 +38,3 @@ app.get('/cordova_plugins.js', servePlatformResource); | ||
if (!options.noproxy) { | ||
yield setupProxies(project, app); | ||
yield setupProxies(env.project, app); | ||
} | ||
@@ -48,3 +54,3 @@ return app; | ||
opts.rejectUnauthorized = !(proxy.rejectUnauthorized === false); | ||
const proxyMiddleware = modules_1.load('proxy-middleware'); | ||
const proxyMiddleware = yield Promise.resolve().then(function () { return require('proxy-middleware'); }); | ||
app.use(proxy.path, proxyMiddleware(opts)); | ||
@@ -51,0 +57,0 @@ console.log('Proxy added:' + proxy.path + ' => ' + url.format(opts)); |
@@ -11,7 +11,8 @@ "use strict"; | ||
const config_1 = require("./config"); | ||
const modules_1 = require("../lib/modules"); | ||
function serve(args) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
let chosenIP = 'localhost'; | ||
if (args.options.externalIpRequired) { | ||
const address = args.options['address'] || config_1.DEFAULT_ADDRESS; | ||
const locallyAccessible = ['0.0.0.0', 'localhost', '127.0.0.1'].includes(address); | ||
let externalIP = address; | ||
if (address === '0.0.0.0') { | ||
// Find appropriate IP to use for cordova to reference | ||
@@ -23,3 +24,3 @@ const availableIPs = cli_utils_1.getAvailableIPAddress(); | ||
} | ||
chosenIP = availableIPs[0].address; | ||
externalIP = availableIPs[0].address; | ||
if (availableIPs.length > 1) { | ||
@@ -35,3 +36,3 @@ args.env.log.warn(`${chalk.bold('Multiple network interfaces detected!')}\n` + | ||
}); | ||
chosenIP = promptedIp; | ||
externalIP = promptedIp; | ||
} | ||
@@ -46,5 +47,5 @@ } | ||
wwwDir: path.join(args.env.project.directory, projectConfig.documentRoot || 'www'), | ||
address: args.options['address'] || config_1.DEFAULT_ADDRESS, | ||
address, | ||
protocol: 'http', | ||
externalAddress: chosenIP, | ||
externalAddress: externalIP, | ||
port: helpers_1.stringToInt(args.options['port'], config_1.DEFAULT_SERVER_PORT), | ||
@@ -65,8 +66,16 @@ httpPort: helpers_1.stringToInt(args.options['port'], config_1.DEFAULT_SERVER_PORT), | ||
// Clean up args based on environment state | ||
const portResults = yield Promise.all([ | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.port), | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.livereloadPort), | ||
]); | ||
serverOptions.port = serverOptions.httpPort = portResults[0]; | ||
serverOptions.livereloadPort = portResults[1]; | ||
try { | ||
const portResults = yield Promise.all([ | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.port), | ||
cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.livereloadPort), | ||
]); | ||
serverOptions.port = serverOptions.httpPort = portResults[0]; | ||
serverOptions.livereloadPort = portResults[1]; | ||
} | ||
catch (e) { | ||
if (e !== cli_utils_1.ERROR_NETWORK_ADDRESS_NOT_AVAIL) { | ||
throw e; | ||
} | ||
throw new cli_utils_1.FatalException(`${chalk.green(serverOptions.address)} is not available--cannot bind.`); | ||
} | ||
// Start up server | ||
@@ -76,6 +85,7 @@ const settings = yield setupServer(args.env, serverOptions); | ||
const externalAddress = 'http://' + serverOptions.externalAddress + ':' + serverOptions.port; | ||
const externallyAccessible = localAddress !== externalAddress; | ||
args.env.log.info(`Development server running\n` + | ||
`Local: ${chalk.bold(localAddress)}\n` + | ||
(localAddress !== externalAddress ? `External: ${chalk.bold(externalAddress)}\n` : '')); | ||
if (!serverOptions.nobrowser || serverOptions.lab) { | ||
(locallyAccessible ? `Local: ${chalk.bold(localAddress)}\n` : '') + | ||
(externallyAccessible ? `External: ${chalk.bold(externalAddress)}\n` : '')); | ||
if (locallyAccessible && !serverOptions.nobrowser) { | ||
const openOptions = [localAddress] | ||
@@ -85,6 +95,7 @@ .concat(serverOptions.lab ? [config_1.IONIC_LAB_URL] : []) | ||
.concat(serverOptions.platform ? ['?ionicplatform=', serverOptions.platform] : []); | ||
const opn = modules_1.load('opn'); | ||
const opn = yield Promise.resolve().then(function () { return require('opn'); }); | ||
opn(openOptions.join('')); | ||
} | ||
return Object.assign({ publicIp: serverOptions.externalAddress, localAddress: 'localhost' }, settings); | ||
return Object.assign({ publicIp: serverOptions.externalAddress, localAddress: 'localhost', locallyAccessible, | ||
externallyAccessible }, settings); | ||
}); | ||
@@ -95,5 +106,5 @@ } | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const liveReloadBrowser = live_reload_1.createLiveReloadServer(options); | ||
yield http_server_1.createHttpServer(env.project, options); | ||
const chokidar = modules_1.load('chokidar'); | ||
const liveReloadBrowser = yield live_reload_1.createLiveReloadServer(options); | ||
yield http_server_1.createHttpServer(env, options); | ||
const chokidar = yield Promise.resolve().then(function () { return require('chokidar'); }); | ||
const projectConfig = yield env.project.load(); | ||
@@ -100,0 +111,0 @@ if (!projectConfig.watchPatterns) { |
import { ServerOptions } from './config'; | ||
export declare function createLiveReloadServer(options: ServerOptions): (changedFile: string[]) => void; | ||
export declare function createLiveReloadServer(options: ServerOptions): Promise<(changedFile: string[]) => void>; | ||
export declare function injectLiveReloadScript(content: any, host: string, port: number): any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const path = require("path"); | ||
const modules_1 = require("../lib/modules"); | ||
function createLiveReloadServer(options) { | ||
const tinylr = modules_1.load('tiny-lr'); | ||
const liveReloadServer = tinylr(); | ||
liveReloadServer.listen(options.livereloadPort, options.externalAddress); | ||
return (changedFiles) => { | ||
liveReloadServer.changed({ | ||
body: { | ||
files: changedFiles.map(changedFile => ('/' + path.relative(options.wwwDir, changedFile))) | ||
} | ||
}); | ||
}; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const tinylr = yield Promise.resolve().then(function () { return require('tiny-lr'); }); | ||
const liveReloadServer = tinylr(); | ||
liveReloadServer.listen(options.livereloadPort); | ||
return (changedFiles) => { | ||
liveReloadServer.changed({ | ||
body: { | ||
files: changedFiles.map(changedFile => ('/' + path.relative(options.wwwDir, changedFile))) | ||
} | ||
}); | ||
}; | ||
}); | ||
} | ||
@@ -17,0 +19,0 @@ exports.createLiveReloadServer = createLiveReloadServer; |
{ | ||
"name": "@ionic/cli-plugin-ionic1", | ||
"version": "2.2.0-alpha.34095a41", | ||
"version": "2.2.0-alpha.35fa3b5c", | ||
"description": "Ionic CLI build plugin for Ionic 1 projects", | ||
@@ -46,20 +46,18 @@ "homepage": "https://ionic.io/", | ||
"dependencies": { | ||
"@ionic/cli-utils": "1.7.0-alpha.34095a41", | ||
"@ionic/cli-utils": "1.8.0-alpha.35fa3b5c", | ||
"chalk": "^2.0.0", | ||
"chokidar": "^1.7.0", | ||
"express": "^4.15.2", | ||
"opn": "^4.0.2", | ||
"opn": "^5.1.0", | ||
"proxy-middleware": "^0.15.0", | ||
"tiny-lr": "^1.0.3", | ||
"tslib": "^1.7.1", | ||
"xml2js": "^0.4.17" | ||
"tslib": "^1.7.1" | ||
}, | ||
"devDependencies": { | ||
"@ionic/cli-scripts": "0.4.0-alpha.34095a41", | ||
"@ionic/cli-scripts": "0.4.0-alpha.35fa3b5c", | ||
"@types/chalk": "^0.4.31", | ||
"@types/chokidar": "^1.6.0", | ||
"@types/chokidar": "^1.7.1", | ||
"@types/express": "^4.0.35", | ||
"@types/opn": "^3.0.28", | ||
"@types/xml2js": "0.0.33" | ||
"@types/opn": "^3.0.28" | ||
} | ||
} |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8
-11.11%5
-16.67%2
-50%175129
-1.06%25
-19.35%839
-9.4%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated