🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@ionic/cli-plugin-ionic1

Package Overview
Dependencies
Maintainers
12
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/cli-plugin-ionic1 - npm Package Compare versions

Comparing version

to
2.1.0-alpha.22543634

1

dist/index.d.ts
import { IHookEngine } from '@ionic/cli-utils';
export declare const name = "__NAME__";
export declare const version = "__VERSION__";
export declare const preferGlobal: boolean;
export declare function registerHooks(hooks: IHookEngine): void;

24

dist/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chalk = require("chalk");

@@ -16,14 +9,13 @@ const path = require("path");

exports.name = '@ionic/cli-plugin-ionic1';
exports.version = '2.0.1';
exports.preferGlobal = false;
exports.version = '2.1.0-alpha.22543634';
function registerHooks(hooks) {
hooks.register(exports.name, 'command:docs', () => __awaiter(this, void 0, void 0, function* () {
hooks.register(exports.name, 'command:docs', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
return 'https://ionicframework.com/docs/v1/';
}));
hooks.register(exports.name, 'command:info', ({ env }) => __awaiter(this, void 0, void 0, function* () {
hooks.register(exports.name, 'command:info', ({ env }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
if (!env.project.directory) {
return [];
}
const getIonic1Version = () => __awaiter(this, void 0, void 0, function* () {
const ionicVersionFilePath = path.resolve(env.project.directory, 'www', 'lib', 'ionic', 'version.json');
const getIonic1Version = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
const ionicVersionFilePath = path.resolve(env.project.directory, 'www', 'lib', 'ionic', 'version.json'); // TODO
try {

@@ -40,6 +32,6 @@ const ionicVersionJson = yield cli_utils_1.fsReadJsonFile(ionicVersionFilePath);

{ type: 'local-packages', name: 'Ionic Framework', version: ionic1Version ? `ionic1 ${ionic1Version}` : 'unknown' },
{ type: 'local-packages', name: exports.name, version: exports.version },
{ type: 'cli-packages', name: exports.name, version: exports.version, path: path.dirname(path.dirname(__filename)) },
];
}));
hooks.register(exports.name, 'command:serve', (args) => __awaiter(this, void 0, void 0, function* () {
hooks.register(exports.name, 'command:serve', (args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
return index_1.serve(args);

@@ -46,0 +38,0 @@ }));

export interface ServerOptions {
projectRoot: string;
wwwDir: string;
protocol: string;
address: string;
externalAddress: string;
port: number;

@@ -6,0 +8,0 @@ httpPort: number;

@@ -5,2 +5,5 @@ /// <reference types="express" />

import { ServerOptions } from './config';
/**
* Create HTTP server
*/
export declare function createHttpServer(project: IProject, options: ServerOptions): Promise<expressType.Application>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fs = require("fs");

@@ -18,4 +11,7 @@ const path = require("path");

const modules_1 = require("../lib/modules");
/**
* Create HTTP server
*/
function createHttpServer(project, options) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const express = modules_1.load('express');

@@ -27,2 +23,3 @@ const app = express();

app.use('/', express.static(options.wwwDir));
// Lab routes
app.use(config_1.IONIC_LAB_URL + '/static', express.static(path.join(__dirname, '..', '..', 'lab', 'static')));

@@ -42,3 +39,3 @@ app.get(config_1.IONIC_LAB_URL, lab_1.LabAppView);

function setupProxies(project, app) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const projectConfig = yield project.load();

@@ -57,8 +54,12 @@ for (const proxy of projectConfig.proxies || []) {

}
/**
* http responder for /index.html base entrypoint
*/
function serveIndex(req, res) {
const options = req.app.get('serveOptions');
// respond with the index.html file
const indexFileName = path.join(options.wwwDir, 'index.html');
fs.readFile(indexFileName, (err, indexHtml) => {
if (!options.nolivereload) {
indexHtml = live_reload_1.injectLiveReloadScript(indexHtml, options.address, options.livereloadPort);
indexHtml = live_reload_1.injectLiveReloadScript(indexHtml, options.externalAddress, options.livereloadPort);
}

@@ -69,2 +70,5 @@ res.set('Content-Type', 'text/html');

}
/**
* http responder for cordova.js file
*/
function serveMockCordovaJS(req, res) {

@@ -74,2 +78,5 @@ res.set('Content-Type', 'application/javascript');

}
/**
* Middleware to serve platform resources
*/
function servePlatformResource(req, res, next) {

@@ -76,0 +83,0 @@ const options = req.app.get('serveOptions');

@@ -1,4 +0,2 @@

import { CommandHookArgs } from '@ionic/cli-utils';
export declare function serve(args: CommandHookArgs): Promise<{
[key: string]: any;
}>;
import { CommandHookArgs, ServeCommandHookResponse } from '@ionic/cli-utils';
export declare function serve(args: CommandHookArgs): Promise<ServeCommandHookResponse>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path = require("path");

@@ -20,5 +13,6 @@ const chalk = require("chalk");

function serve(args) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
let chosenIP = 'localhost';
if (args.options.externalIpRequired) {
// Find appropriate IP to use for cordova to reference
const availableIPs = cli_utils_1.getAvailableIPAddress();

@@ -46,2 +40,3 @@ if (availableIPs.length === 0) {

const projectConfig = yield args.env.project.load();
// Setup Options and defaults
const serverOptions = {

@@ -51,2 +46,4 @@ projectRoot: args.env.project.directory,

address: args.options['address'] || config_1.DEFAULT_ADDRESS,
protocol: 'http',
externalAddress: chosenIP,
port: helpers_1.stringToInt(args.options['port'], config_1.DEFAULT_SERVER_PORT),

@@ -66,2 +63,3 @@ httpPort: helpers_1.stringToInt(args.options['port'], config_1.DEFAULT_SERVER_PORT),

};
// Clean up args based on environment state
const portResults = yield Promise.all([

@@ -73,5 +71,6 @@ cli_utils_1.findClosestOpenPort(serverOptions.address, serverOptions.port),

serverOptions.livereloadPort = portResults[1];
// Start up server
const settings = yield setupServer(args.env, serverOptions);
const localAddress = 'http://localhost:' + serverOptions.port;
const externalAddress = 'http://' + chosenIP + ':' + serverOptions.port;
const externalAddress = 'http://' + serverOptions.externalAddress + ':' + serverOptions.port;
args.env.log.info(`Development server running\n` +

@@ -88,3 +87,3 @@ `Local: ${chalk.bold(localAddress)}\n` +

}
return Object.assign({ publicIp: chosenIP }, settings);
return Object.assign({ publicIp: serverOptions.externalAddress, localAddress: 'localhost' }, settings);
});

@@ -94,3 +93,3 @@ }

function setupServer(env, options) {
return __awaiter(this, void 0, void 0, function* () {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const liveReloadBrowser = live_reload_1.createLiveReloadServer(options);

@@ -104,3 +103,3 @@ yield http_server_1.createHttpServer(env.project, options);

const watchPatterns = [...new Set([...projectConfig.watchPatterns, ...config_1.WATCH_PATTERNS])];
env.log.debug(`Watch patterns: ${watchPatterns.map(v => chalk.bold(v)).join(', ')}`);
env.log.debug(() => `Watch patterns: ${watchPatterns.map(v => chalk.bold(v)).join(', ')}`);
const watcher = chokidar.watch(watchPatterns, { cwd: env.project.directory });

@@ -107,0 +106,0 @@ env.events.emit('watch:init');

@@ -0,2 +1,5 @@

/**
* Main Lab app view
*/
export declare function LabAppView(req: any, res: any): any;
export declare function ApiCordovaProject(req: any, res: any): void;

@@ -5,2 +5,5 @@ "use strict";

const cordova_config_1 = require("../utils/cordova-config");
/**
* Main Lab app view
*/
function LabAppView(req, res) {

@@ -7,0 +10,0 @@ return res.sendFile('index.html', {

@@ -8,3 +8,3 @@ "use strict";

const liveReloadServer = tinylr();
liveReloadServer.listen(options.livereloadPort, options.address);
liveReloadServer.listen(options.livereloadPort, options.externalAddress);
return (changedFiles) => {

@@ -23,2 +23,3 @@ liveReloadServer.changed({

if (contentStr.indexOf('/livereload.js') > -1) {
// already added script
return content;

@@ -25,0 +26,0 @@ }

@@ -6,3 +6,7 @@ export interface CordovaProject {

}
/**
* Parse and build a CordovaProject config object by parsing the
* config.xml file in the project root.
*/
export declare function buildCordovaConfig(errCb: Function, cb: Function): void;
export declare function parseConfig(parsedConfig: any): CordovaProject;

@@ -6,2 +6,6 @@ "use strict";

let lastConfig;
/**
* Parse and build a CordovaProject config object by parsing the
* config.xml file in the project root.
*/
function buildCordovaConfig(errCb, cb) {

@@ -30,2 +34,3 @@ const xml2js = modules_1.load('xml2js');

let widget = parsedConfig.widget;
// Widget attrs are defined on the <widget> tag
let widgetAttrs = widget.$;

@@ -32,0 +37,0 @@ let config = {

{
"name": "@ionic/cli-plugin-ionic1",
"version": "2.0.1",
"version": "2.1.0-alpha.22543634",
"description": "Ionic CLI build plugin for Ionic 1 projects",

@@ -10,3 +10,3 @@ "homepage": "https://ionic.io/",

"clean": "rm -rf ./dist",
"lint": "tslint -c ../../tslint.json \"src/**/*.ts\"",
"lint": "tslint --config ../../tslint.js --project tsconfig.json --type-check",
"build": "npm run clean && npm run build-ts && npm run build-js",

@@ -47,3 +47,3 @@ "build-ts": "tsc",

"dependencies": {
"@ionic/cli-utils": "1.5.0",
"@ionic/cli-utils": "1.6.0-alpha.22543634",
"chalk": "^2.0.0",

@@ -55,6 +55,7 @@ "chokidar": "^1.7.0",

"tiny-lr": "^1.0.3",
"tslib": "^1.7.1",
"xml2js": "^0.4.17"
},
"devDependencies": {
"@ionic/cli-scripts": "0.2.1",
"@ionic/cli-scripts": "0.3.0-alpha.22543634",
"@types/chalk": "^0.4.31",

@@ -61,0 +62,0 @@ "@types/chokidar": "^1.6.0",