6 Commits

Author SHA1 Message Date
  jpsp91 0c836bacfc SideMenu Update 6 years ago
  jpsp91 172a6ed225 registerPageFix 6 years ago
  Nicholas Maidanos d61461579e message bar added 6 years ago
  Nicholas Maidanos effbb37ca4 Working loop 6 years ago
  Nicholas Maidanos 23f6576076 Channel stuff added 6 years ago
  Nicholas Maidanos 5cb0bae6c5 Heroku is livegit add . 6 years ago
100 changed files with 5400 additions and 4 deletions
  1. BIN
      .DS_Store
  2. 1
    1
      .sourcemaps/main.js.map
  3. 3
    3
      ionic.config.json
  4. 1
    0
      node_modules/.bin/ncp
  5. 90
    0
      node_modules/@ionic/cli-plugin-ionic-angular/CHANGELOG.md
  6. 3
    0
      node_modules/@ionic/cli-plugin-ionic-angular/README.md
  7. 2
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/build.d.ts
  8. 17
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/build.js
  9. 2
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/generate.d.ts
  10. 72
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/generate.js
  11. 4
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/index.d.ts
  12. 67
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/index.js
  13. 2
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/lib/modules.d.ts
  14. 6
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/lib/modules.js
  15. 2
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/serve.d.ts
  16. 60
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/serve.js
  17. 10
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/utils/generate.d.ts
  18. 61
    0
      node_modules/@ionic/cli-plugin-ionic-angular/dist/utils/generate.js
  19. 90
    0
      node_modules/@ionic/cli-plugin-ionic-angular/package.json
  20. 2
    0
      node_modules/@ionic/cli-utils/.npmignore
  21. 146
    0
      node_modules/@ionic/cli-utils/CHANGELOG.md
  22. 1
    0
      node_modules/@ionic/cli-utils/README.md
  23. 1
    0
      node_modules/@ionic/cli-utils/bootstrap.d.ts
  24. 19
    0
      node_modules/@ionic/cli-utils/bootstrap.js
  25. 556
    0
      node_modules/@ionic/cli-utils/definitions.d.ts
  26. 2
    0
      node_modules/@ionic/cli-utils/definitions.js
  27. 41
    0
      node_modules/@ionic/cli-utils/guards.d.ts
  28. 238
    0
      node_modules/@ionic/cli-utils/guards.js
  29. 44
    0
      node_modules/@ionic/cli-utils/index.d.ts
  30. 197
    0
      node_modules/@ionic/cli-utils/index.js
  31. 7
    0
      node_modules/@ionic/cli-utils/lib/app.d.ts
  32. 24
    0
      node_modules/@ionic/cli-utils/lib/app.js
  33. 3
    0
      node_modules/@ionic/cli-utils/lib/backends.d.ts
  34. 4
    0
      node_modules/@ionic/cli-utils/lib/backends.js
  35. 18
    0
      node_modules/@ionic/cli-utils/lib/command/command.d.ts
  36. 121
    0
      node_modules/@ionic/cli-utils/lib/command/command.js
  37. 2
    0
      node_modules/@ionic/cli-utils/lib/command/index.d.ts
  38. 8
    0
      node_modules/@ionic/cli-utils/lib/command/index.js
  39. 24
    0
      node_modules/@ionic/cli-utils/lib/command/namespace.d.ts
  40. 95
    0
      node_modules/@ionic/cli-utils/lib/command/namespace.js
  41. 10
    0
      node_modules/@ionic/cli-utils/lib/command/utils.d.ts
  42. 103
    0
      node_modules/@ionic/cli-utils/lib/command/utils.js
  43. 27
    0
      node_modules/@ionic/cli-utils/lib/config.d.ts
  44. 185
    0
      node_modules/@ionic/cli-utils/lib/config.js
  45. 16
    0
      node_modules/@ionic/cli-utils/lib/daemon.d.ts
  46. 125
    0
      node_modules/@ionic/cli-utils/lib/daemon.js
  47. 18
    0
      node_modules/@ionic/cli-utils/lib/deploy.d.ts
  48. 78
    0
      node_modules/@ionic/cli-utils/lib/deploy.js
  49. 47
    0
      node_modules/@ionic/cli-utils/lib/environment.d.ts
  50. 85
    0
      node_modules/@ionic/cli-utils/lib/environment.js
  51. 18
    0
      node_modules/@ionic/cli-utils/lib/errors.d.ts
  52. 31
    0
      node_modules/@ionic/cli-utils/lib/errors.js
  53. 5
    0
      node_modules/@ionic/cli-utils/lib/events.d.ts
  54. 6
    0
      node_modules/@ionic/cli-utils/lib/events.js
  55. 2
    0
      node_modules/@ionic/cli-utils/lib/help.d.ts
  56. 227
    0
      node_modules/@ionic/cli-utils/lib/help.js
  57. 17
    0
      node_modules/@ionic/cli-utils/lib/hooks.d.ts
  58. 49
    0
      node_modules/@ionic/cli-utils/lib/hooks.js
  59. 30
    0
      node_modules/@ionic/cli-utils/lib/http.d.ts
  60. 155
    0
      node_modules/@ionic/cli-utils/lib/http.js
  61. 2
    0
      node_modules/@ionic/cli-utils/lib/login.d.ts
  62. 23
    0
      node_modules/@ionic/cli-utils/lib/login.js
  63. 23
    0
      node_modules/@ionic/cli-utils/lib/modules.d.ts
  64. 6
    0
      node_modules/@ionic/cli-utils/lib/modules.js
  65. 34
    0
      node_modules/@ionic/cli-utils/lib/package.d.ts
  66. 142
    0
      node_modules/@ionic/cli-utils/lib/package.js
  67. 34
    0
      node_modules/@ionic/cli-utils/lib/plugins.d.ts
  68. 445
    0
      node_modules/@ionic/cli-utils/lib/plugins.js
  69. 17
    0
      node_modules/@ionic/cli-utils/lib/project.d.ts
  70. 128
    0
      node_modules/@ionic/cli-utils/lib/project.js
  71. 7
    0
      node_modules/@ionic/cli-utils/lib/prompts.d.ts
  72. 37
    0
      node_modules/@ionic/cli-utils/lib/prompts.js
  73. 11
    0
      node_modules/@ionic/cli-utils/lib/security.d.ts
  74. 38
    0
      node_modules/@ionic/cli-utils/lib/security.js
  75. 18
    0
      node_modules/@ionic/cli-utils/lib/session.d.ts
  76. 128
    0
      node_modules/@ionic/cli-utils/lib/session.js
  77. 8
    0
      node_modules/@ionic/cli-utils/lib/shell.d.ts
  78. 87
    0
      node_modules/@ionic/cli-utils/lib/shell.js
  79. 21
    0
      node_modules/@ionic/cli-utils/lib/telemetry.d.ts
  80. 104
    0
      node_modules/@ionic/cli-utils/lib/telemetry.js
  81. 2
    0
      node_modules/@ionic/cli-utils/lib/utils/archive.d.ts
  82. 8
    0
      node_modules/@ionic/cli-utils/lib/utils/archive.js
  83. 4
    0
      node_modules/@ionic/cli-utils/lib/utils/array.d.ts
  84. 11
    0
      node_modules/@ionic/cli-utils/lib/utils/array.js
  85. 7
    0
      node_modules/@ionic/cli-utils/lib/utils/aws.d.ts
  86. 36
    0
      node_modules/@ionic/cli-utils/lib/utils/aws.js
  87. 1
    0
      node_modules/@ionic/cli-utils/lib/utils/environmentInfo.d.ts
  88. 14
    0
      node_modules/@ionic/cli-utils/lib/utils/environmentInfo.js
  89. 17
    0
      node_modules/@ionic/cli-utils/lib/utils/format.d.ts
  90. 98
    0
      node_modules/@ionic/cli-utils/lib/utils/format.js
  91. 41
    0
      node_modules/@ionic/cli-utils/lib/utils/fs.d.ts
  92. 184
    0
      node_modules/@ionic/cli-utils/lib/utils/fs.js
  93. 21
    0
      node_modules/@ionic/cli-utils/lib/utils/logger.d.ts
  94. 78
    0
      node_modules/@ionic/cli-utils/lib/utils/logger.js
  95. 4
    0
      node_modules/@ionic/cli-utils/lib/utils/network.d.ts
  96. 60
    0
      node_modules/@ionic/cli-utils/lib/utils/network.js
  97. 25
    0
      node_modules/@ionic/cli-utils/lib/utils/npm.d.ts
  98. 184
    0
      node_modules/@ionic/cli-utils/lib/utils/npm.js
  99. 12
    0
      node_modules/@ionic/cli-utils/lib/utils/promise.d.ts
  100. 0
    0
      node_modules/@ionic/cli-utils/lib/utils/promise.js

BIN
.DS_Store View File


+ 1
- 1
.sourcemaps/main.js.map
File diff suppressed because it is too large
View File


+ 3
- 3
ionic.config.json View File

@@ -1,8 +1,8 @@
1 1
 {
2 2
   "name": "zipteamUIv2",
3
-  "app_id": "",
4
-  "type": "ionic-angular",
5 3
   "integrations": {
6 4
     "cordova": {}
7
-  }
5
+  },
6
+  "type": "ionic-angular",
7
+  "app_id": ""
8 8
 }

+ 1
- 0
node_modules/.bin/ncp View File

@@ -0,0 +1 @@
1
+../ncp/bin/ncp

+ 90
- 0
node_modules/@ionic/cli-plugin-ionic-angular/CHANGELOG.md View File

@@ -0,0 +1,90 @@
1
+# Change Log
2
+
3
+All notable changes to this project will be documented in this file.
4
+See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
5
+
6
+<a name="1.4.1"></a>
7
+## [1.4.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.4.0...@ionic/cli-plugin-ionic-angular@1.4.1) (2017-08-03)
8
+
9
+
10
+### Bug Fixes
11
+
12
+* **serve:** allow binding of localhost ([e8a74d0](https://github.com/ionic-team/ionic-cli/commit/e8a74d0))
13
+
14
+
15
+
16
+
17
+<a name="1.4.0"></a>
18
+# [1.4.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.3.2...@ionic/cli-plugin-ionic-angular@1.4.0) (2017-07-27)
19
+
20
+
21
+### Features
22
+
23
+* ionic pro ([36dc2f7](https://github.com/ionic-team/ionic-cli/commit/36dc2f7))
24
+* **generators:** add fall back for old app-scripts ([d41a4b5](https://github.com/ionic-team/ionic-cli/commit/d41a4b5))
25
+* **generators:** add fall back for old app-scripts ([33097e7](https://github.com/ionic-team/ionic-cli/commit/33097e7))
26
+* **generators:** add module options ([6c85a8e](https://github.com/ionic-team/ionic-cli/commit/6c85a8e))
27
+* **generators:** add option for creating a constants file ([db7b983](https://github.com/ionic-team/ionic-cli/commit/db7b983))
28
+* **generators:** pass all the options ([6401822](https://github.com/ionic-team/ionic-cli/commit/6401822))
29
+
30
+
31
+
32
+
33
+<a name="1.3.2"></a>
34
+## [1.3.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.3.1...@ionic/cli-plugin-ionic-angular@1.3.2) (2017-07-11)
35
+
36
+
37
+
38
+
39
+<a name="1.3.1"></a>
40
+## [1.3.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.3.0...@ionic/cli-plugin-ionic-angular@1.3.1) (2017-06-12)
41
+
42
+
43
+### Bug Fixes
44
+
45
+* **serve:** 0.0.0.0, but open localhost in local browser ([e337813](https://github.com/ionic-team/ionic-cli/commit/e337813))
46
+
47
+
48
+
49
+
50
+<a name="1.3.0"></a>
51
+# [1.3.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.2.0...@ionic/cli-plugin-ionic-angular@1.3.0) (2017-05-31)
52
+
53
+
54
+### Bug Fixes
55
+
56
+* **cordova:** fix arg parser ([94db925](https://github.com/ionic-team/ionic-cli/commit/94db925))
57
+
58
+
59
+
60
+
61
+<a name="1.2.0"></a>
62
+# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.1.2...@ionic/cli-plugin-ionic-angular@1.2.0) (2017-05-23)
63
+
64
+
65
+### Features
66
+
67
+* **flags:** --no-interactive mode, with --confirm/--no-confirm ([1966a0c](https://github.com/ionic-team/ionic-cli/commit/1966a0c))
68
+
69
+
70
+
71
+
72
+<a name="1.1.2"></a>
73
+## [1.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.1.1...@ionic/cli-plugin-ionic-angular@1.1.2) (2017-05-17)
74
+
75
+
76
+
77
+
78
+<a name="1.1.1"></a>
79
+## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.1.0...@ionic/cli-plugin-ionic-angular@1.1.1) (2017-05-16)
80
+
81
+
82
+### Bug Fixes
83
+
84
+* **plugins:** messaging about globally installed plugins ([def3891](https://github.com/ionic-team/ionic-cli/commit/def3891))
85
+
86
+
87
+
88
+
89
+<a name="1.1.0"></a>
90
+# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-plugin-ionic-angular@1.0.0...@ionic/cli-plugin-ionic-angular@1.1.0) (2017-05-16)

+ 3
- 0
node_modules/@ionic/cli-plugin-ionic-angular/README.md View File

@@ -0,0 +1,3 @@
1
+# @ionic/cli-plugin-ionic-angular
2
+
3
+This CLI project plugin provides Ionic Angular functionality to the CLI.

+ 2
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/build.d.ts View File

@@ -0,0 +1,2 @@
1
+import { CommandHookArgs } from '@ionic/cli-utils';
2
+export declare function build(args: CommandHookArgs): Promise<void>;

+ 17
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/build.js View File

@@ -0,0 +1,17 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const cli_utils_1 = require("@ionic/cli-utils");
6
+const modules_1 = require("./lib/modules");
7
+function build(args) {
8
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+        const appScriptsArgs = cli_utils_1.minimistOptionsToArray(args.options, { useEquals: false, ignoreFalse: true, allowCamelCase: true });
10
+        process.argv = ['node', 'appscripts'].concat(appScriptsArgs);
11
+        const AppScripts = modules_1.load('@ionic/app-scripts');
12
+        const context = AppScripts.generateContext();
13
+        console.log(`Running app-scripts build: ${chalk.bold(appScriptsArgs.join(' '))}\n`);
14
+        return yield AppScripts.build(context);
15
+    });
16
+}
17
+exports.build = build;

+ 2
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/generate.d.ts View File

@@ -0,0 +1,2 @@
1
+import { CommandHookArgs } from '@ionic/cli-utils';
2
+export declare function generate(args: CommandHookArgs): Promise<string[]>;

+ 72
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/generate.js View File

@@ -0,0 +1,72 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const path = require("path");
6
+const cli_utils_1 = require("@ionic/cli-utils");
7
+const modules_1 = require("./lib/modules");
8
+const generate_1 = require("./utils/generate");
9
+function generate(args) {
10
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+        if (!args.env.project.directory) {
12
+            return [];
13
+        }
14
+        const appScriptsArgs = cli_utils_1.minimistOptionsToArray(args.options, { useEquals: false, ignoreFalse: true, allowCamelCase: true });
15
+        process.argv = ['node', 'appscripts'].concat(appScriptsArgs);
16
+        const ionicAngularPackageJsonFilePath = path.resolve(args.env.project.directory, 'node_modules', 'ionic-angular', 'package.json'); // TODO
17
+        try {
18
+            const ionicAngularPackageJson = yield cli_utils_1.readPackageJsonFile(ionicAngularPackageJsonFilePath);
19
+            if (ionicAngularPackageJson.version && Number(ionicAngularPackageJson.version.charAt(0)) < 3) {
20
+                throw new Error(`The generate command is only available for projects that use ionic-angular >= 3.0.0`);
21
+            }
22
+        }
23
+        catch (e) {
24
+            args.env.log.error(`Error with ${chalk.bold(cli_utils_1.prettyPath(ionicAngularPackageJsonFilePath))} file: ${e}`);
25
+        }
26
+        const AppScripts = modules_1.load('@ionic/app-scripts');
27
+        const context = AppScripts.generateContext();
28
+        const [type, name] = args.inputs;
29
+        const commandOptions = {
30
+            module: false,
31
+            constants: false,
32
+        };
33
+        if (args.options['module']) {
34
+            commandOptions.module = true;
35
+        }
36
+        if (args.options['constants']) {
37
+            commandOptions.constants = true;
38
+        }
39
+        switch (type) {
40
+            case 'page':
41
+                yield AppScripts.processPageRequest(context, name, commandOptions);
42
+                break;
43
+            case 'component':
44
+                const componentData = yield generate_1.getModules(context, 'component');
45
+                yield AppScripts.processComponentRequest(context, name, componentData);
46
+                break;
47
+            case 'directive':
48
+                const directiveData = yield generate_1.getModules(context, 'directive');
49
+                yield AppScripts.processDirectiveRequest(context, name, directiveData);
50
+                break;
51
+            case 'pipe':
52
+                const pipeData = yield generate_1.getModules(context, 'pipe');
53
+                yield AppScripts.processPipeRequest(context, name, pipeData);
54
+                break;
55
+            case 'provider':
56
+                const providerData = yield promptQuestions(context);
57
+                yield AppScripts.processProviderRequest(context, name, providerData);
58
+                break;
59
+            case 'tabs':
60
+                const tabsData = yield generate_1.tabsPrompt(args.env);
61
+                yield AppScripts.processTabsRequest(context, name, tabsData, commandOptions);
62
+                break;
63
+        }
64
+        return [];
65
+    });
66
+}
67
+exports.generate = generate;
68
+function promptQuestions(context) {
69
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+        return yield generate_1.prompt(context);
71
+    });
72
+}

+ 4
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/index.d.ts View File

@@ -0,0 +1,4 @@
1
+import { IHookEngine } from '@ionic/cli-utils';
2
+export declare const name = "__NAME__";
3
+export declare const version = "__VERSION__";
4
+export declare function registerHooks(hooks: IHookEngine): void;

+ 67
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/index.js View File

@@ -0,0 +1,67 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const path = require("path");
6
+const cli_utils_1 = require("@ionic/cli-utils");
7
+const build_1 = require("./build");
8
+const generate_1 = require("./generate");
9
+const serve_1 = require("./serve");
10
+exports.name = '@ionic/cli-plugin-ionic-angular';
11
+exports.version = '1.4.1';
12
+function getIonicAngularVersion(env) {
13
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+        const ionicAngularPackageJsonFilePath = path.resolve(env.project.directory, 'node_modules', 'ionic-angular', 'package.json'); // TODO
15
+        try {
16
+            const ionicAngularPackageJson = yield cli_utils_1.readPackageJsonFile(ionicAngularPackageJsonFilePath);
17
+            return ionicAngularPackageJson.version;
18
+        }
19
+        catch (e) {
20
+            env.log.error(`Error with ${chalk.bold(cli_utils_1.prettyPath(ionicAngularPackageJsonFilePath))} file: ${e}`);
21
+        }
22
+    });
23
+}
24
+function getAppScriptsVersion(env) {
25
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+        const appScriptsPackageJsonFilePath = path.resolve(env.project.directory, 'node_modules', '@ionic', 'app-scripts', 'package.json'); // TODO
27
+        try {
28
+            const appScriptsPackageJson = yield cli_utils_1.readPackageJsonFile(appScriptsPackageJsonFilePath);
29
+            return appScriptsPackageJson.version;
30
+        }
31
+        catch (e) {
32
+            env.log.error(`Error with ${chalk.bold(cli_utils_1.prettyPath(appScriptsPackageJsonFilePath))} file: ${e}`);
33
+        }
34
+    });
35
+}
36
+function registerHooks(hooks) {
37
+    hooks.register(exports.name, 'command:docs', ({ env }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+        const docsHomepage = 'https://ionicframework.com/docs';
39
+        if (!env.project.directory) {
40
+            return docsHomepage;
41
+        }
42
+        const ionicAngularVersion = yield getIonicAngularVersion(env);
43
+        const url = `${docsHomepage}/${ionicAngularVersion ? ionicAngularVersion + '/' : ''}api`;
44
+        return url;
45
+    }));
46
+    hooks.register(exports.name, 'command:generate', (args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+        yield generate_1.generate(args);
48
+    }));
49
+    hooks.register(exports.name, 'command:info', ({ env }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+        if (!env.project.directory) {
51
+            return [];
52
+        }
53
+        const [ionicAngularVersion, appScriptsVersion] = yield Promise.all([getIonicAngularVersion(env), getAppScriptsVersion(env)]);
54
+        return [
55
+            { type: 'local-packages', name: 'Ionic Framework', version: ionicAngularVersion ? `ionic-angular ${ionicAngularVersion}` : 'not installed' },
56
+            { type: 'cli-packages', name: exports.name, version: exports.version, path: path.dirname(path.dirname(__filename)) },
57
+            { type: 'local-packages', name: '@ionic/app-scripts', version: appScriptsVersion ? appScriptsVersion : 'not installed' },
58
+        ];
59
+    }));
60
+    hooks.register(exports.name, 'command:serve', (args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+        return serve_1.serve(args);
62
+    }));
63
+    hooks.register(exports.name, 'command:build', (args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
64
+        yield build_1.build(args);
65
+    }));
66
+}
67
+exports.registerHooks = registerHooks;

+ 2
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/lib/modules.d.ts View File

@@ -0,0 +1,2 @@
1
+import * as AppScriptsType from '@ionic/app-scripts';
2
+export declare function load(modulePath: '@ionic/app-scripts'): typeof AppScriptsType;

+ 6
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/lib/modules.js View File

@@ -0,0 +1,6 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+function load(modulePath) {
4
+    return require(modulePath);
5
+}
6
+exports.load = load;

+ 2
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/serve.d.ts View File

@@ -0,0 +1,2 @@
1
+import { CommandHookArgs, ServeCommandHookResponse } from '@ionic/cli-utils';
2
+export declare function serve(args: CommandHookArgs): Promise<ServeCommandHookResponse>;

+ 60
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/serve.js View File

@@ -0,0 +1,60 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const cli_utils_1 = require("@ionic/cli-utils");
6
+const modules_1 = require("./lib/modules");
7
+function serve(args) {
8
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+        const address = args.options['address'] || '0.0.0.0';
10
+        const locallyAccessible = ['0.0.0.0', 'localhost', '127.0.0.1'].includes(address);
11
+        let externalIP = address;
12
+        if (address === '0.0.0.0') {
13
+            const availableIPs = cli_utils_1.getAvailableIPAddress();
14
+            if (availableIPs.length === 0) {
15
+                throw new Error(`It appears that you do not have any external network interfaces. ` +
16
+                    `In order to use livereload with emulate you will need one.`);
17
+            }
18
+            externalIP = availableIPs[0].address;
19
+            if (availableIPs.length > 1) {
20
+                if (availableIPs.find(({ address }) => address === args.options.address)) {
21
+                    externalIP = args.options.address;
22
+                }
23
+                else {
24
+                    args.env.log.warn(`${chalk.bold('Multiple network interfaces detected!')}\n` +
25
+                        'You will be prompted to select an external-facing IP for the livereload server that your device or emulator has access to.\n' +
26
+                        `You may also use the ${chalk.green('--address')} option to skip this prompt.\n`);
27
+                    const promptedIp = yield args.env.prompt({
28
+                        type: 'list',
29
+                        name: 'promptedIp',
30
+                        message: 'Please select which IP to use:',
31
+                        choices: availableIPs.map(ip => ip.address)
32
+                    });
33
+                    externalIP = promptedIp;
34
+                }
35
+            }
36
+        }
37
+        const appScriptsArgs = cli_utils_1.minimistOptionsToArray(args.options, { useEquals: false, ignoreFalse: true, allowCamelCase: true });
38
+        process.argv = ['node', 'appscripts'].concat(appScriptsArgs);
39
+        const AppScripts = modules_1.load('@ionic/app-scripts');
40
+        const context = AppScripts.generateContext();
41
+        // using app-scripts and livereload is requested
42
+        // Also remove commandName from the rawArgs passed
43
+        args.env.log.info(`Starting app-scripts server: ${chalk.bold(appScriptsArgs.join(' '))} - Ctrl+C to cancel`);
44
+        const settings = yield AppScripts.serve(context);
45
+        if (!settings) {
46
+            throw new cli_utils_1.FatalException(`app-scripts serve unexpectedly failed.` +
47
+                `settings: ${settings}` +
48
+                `context: ${context}`);
49
+        }
50
+        const localAddress = 'http://localhost:' + settings.httpPort;
51
+        const externalAddress = 'http://' + externalIP + ':' + settings.httpPort;
52
+        const externallyAccessible = localAddress !== externalAddress;
53
+        args.env.log.info(`Development server running\n` +
54
+            (locallyAccessible ? `Local: ${chalk.bold(localAddress)}\n` : '') +
55
+            (externallyAccessible ? `External: ${chalk.bold(externalAddress)}` : ''));
56
+        return Object.assign({ publicIp: externalIP, protocol: 'http', localAddress: 'localhost', externalAddress: externalIP, port: settings.httpPort, locallyAccessible,
57
+            externallyAccessible }, settings);
58
+    });
59
+}
60
+exports.serve = serve;

+ 10
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/utils/generate.d.ts View File

@@ -0,0 +1,10 @@
1
+import { IonicEnvironment } from '@ionic/cli-utils';
2
+import * as AppScriptsType from '@ionic/app-scripts';
3
+export declare function getPages(context: AppScriptsType.BuildContext): Promise<{
4
+    fileName: string;
5
+    absolutePath: string;
6
+    relativePath: string;
7
+}[]>;
8
+export declare function prompt(context: AppScriptsType.BuildContext): Promise<string>;
9
+export declare function getModules(context: AppScriptsType.BuildContext, kind: string): Promise<string>;
10
+export declare function tabsPrompt(env: IonicEnvironment): Promise<string[]>;

+ 61
- 0
node_modules/@ionic/cli-plugin-ionic-angular/dist/utils/generate.js View File

@@ -0,0 +1,61 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const path = require("path");
5
+const cli_utils_1 = require("@ionic/cli-utils");
6
+const modules_1 = require("../lib/modules");
7
+function getPages(context) {
8
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+        const AppScripts = modules_1.load('@ionic/app-scripts');
10
+        const pages = yield AppScripts.getNgModules(context, ['page', 'component']);
11
+        const ngModuleSuffix = yield AppScripts.getStringPropertyValue('IONIC_NG_MODULE_FILENAME_SUFFIX');
12
+        return pages.map((page) => {
13
+            return {
14
+                fileName: path.basename(page.absolutePath, ngModuleSuffix),
15
+                absolutePath: page.absolutePath,
16
+                relativePath: path.relative(context.rootDir, page.absolutePath)
17
+            };
18
+        });
19
+    });
20
+}
21
+exports.getPages = getPages;
22
+function prompt(context) {
23
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+        return context.appNgModulePath;
25
+    });
26
+}
27
+exports.prompt = prompt;
28
+function getModules(context, kind) {
29
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
+        switch (kind) {
31
+            case 'component':
32
+                return context.componentsNgModulePath ? context.componentsNgModulePath : context.appNgModulePath;
33
+            case 'pipe':
34
+                return context.pipesNgModulePath ? context.pipesNgModulePath : context.appNgModulePath;
35
+            case 'directive':
36
+                return context.directivesNgModulePath ? context.directivesNgModulePath : context.appNgModulePath;
37
+        }
38
+    });
39
+}
40
+exports.getModules = getModules;
41
+function tabsPrompt(env) {
42
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+        const tabNames = [];
44
+        const howMany = yield env.prompt({
45
+            type: 'input',
46
+            name: 'howMany',
47
+            message: 'How many tabs?',
48
+            validate: v => cli_utils_1.validators.numeric(v),
49
+        });
50
+        for (let i = 0; i < parseInt(howMany, 10); i++) {
51
+            const tabName = yield env.prompt({
52
+                type: 'input',
53
+                name: 'tabName',
54
+                message: 'Name of this tab:'
55
+            });
56
+            tabNames.push(tabName);
57
+        }
58
+        return tabNames;
59
+    });
60
+}
61
+exports.tabsPrompt = tabsPrompt;

+ 90
- 0
node_modules/@ionic/cli-plugin-ionic-angular/package.json View File

@@ -0,0 +1,90 @@
1
+{
2
+  "_from": "@ionic/cli-plugin-ionic-angular@latest",
3
+  "_id": "@ionic/cli-plugin-ionic-angular@1.4.1",
4
+  "_inBundle": false,
5
+  "_integrity": "sha512-GwGbDH+n6Qajw8faZBD3qq9xh4+DTBdwQqf6EpI4/DkHfzWzeq6asvRjrY1TPTDfMinQI5NTsrx0zup4qceGFA==",
6
+  "_location": "/@ionic/cli-plugin-ionic-angular",
7
+  "_phantomChildren": {},
8
+  "_requested": {
9
+    "type": "tag",
10
+    "registry": true,
11
+    "raw": "@ionic/cli-plugin-ionic-angular@latest",
12
+    "name": "@ionic/cli-plugin-ionic-angular",
13
+    "escapedName": "@ionic%2fcli-plugin-ionic-angular",
14
+    "scope": "@ionic",
15
+    "rawSpec": "latest",
16
+    "saveSpec": null,
17
+    "fetchSpec": "latest"
18
+  },
19
+  "_requiredBy": [
20
+    "#DEV:/",
21
+    "#USER"
22
+  ],
23
+  "_resolved": "https://registry.npmjs.org/@ionic/cli-plugin-ionic-angular/-/cli-plugin-ionic-angular-1.4.1.tgz",
24
+  "_shasum": "bb94b7ad61c2f79757b2dff041c0b7e2151777ec",
25
+  "_spec": "@ionic/cli-plugin-ionic-angular@latest",
26
+  "_where": "/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd",
27
+  "author": {
28
+    "name": "Ionic Team",
29
+    "email": "hi@ionic.io",
30
+    "url": "http://ionic.io"
31
+  },
32
+  "bugs": {
33
+    "url": "https://github.com/ionic-team/ionic-cli/issues"
34
+  },
35
+  "bundleDependencies": false,
36
+  "dependencies": {
37
+    "@ionic/cli-utils": "1.7.0",
38
+    "chalk": "^2.0.0",
39
+    "tslib": "^1.7.1"
40
+  },
41
+  "deprecated": "latest Ionic CLI no longer uses this plugin",
42
+  "description": "Ionic CLI build plugin for Ionic Angular projects",
43
+  "devDependencies": {
44
+    "@angular/compiler": "^4.3.2",
45
+    "@angular/compiler-cli": "^4.3.2",
46
+    "@angular/core": "^4.3.2",
47
+    "@ionic/app-scripts": "^2.1.0",
48
+    "@ionic/cli-scripts": "0.3.1",
49
+    "@types/chalk": "^0.4.31",
50
+    "@types/clean-css": "^3.4.30",
51
+    "rxjs": "^5.4.1"
52
+  },
53
+  "files": [
54
+    "dist/"
55
+  ],
56
+  "homepage": "https://ionic.io/",
57
+  "jest": {
58
+    "moduleFileExtensions": [
59
+      "ts",
60
+      "js"
61
+    ],
62
+    "transform": {
63
+      ".(ts)": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
64
+    },
65
+    "testRegex": "/__tests__/.*\\.(ts|js)$",
66
+    "setupFiles": []
67
+  },
68
+  "license": "MIT",
69
+  "main": "./dist/index.js",
70
+  "name": "@ionic/cli-plugin-ionic-angular",
71
+  "repository": {
72
+    "type": "git",
73
+    "url": "git+https://github.com/ionic-team/ionic-cli.git"
74
+  },
75
+  "scripts": {
76
+    "build": "npm run clean && npm run build-ts && npm run build-js",
77
+    "build-js": "npm run script-prepublish",
78
+    "build-ts": "tsc",
79
+    "clean": "rm -rf ./dist",
80
+    "lint": "tslint --config ../../tslint.js --project tsconfig.json --type-check",
81
+    "prepublish": "npm run build",
82
+    "script-prepublish": "cli-scripts-prepublish cli-plugin-ionic-angular",
83
+    "test": "jest",
84
+    "watch": "concurrently -p \"{name} \" -n \"TS,JS\" -c \"cyan.bold,yellow.dim\" \"npm run watch-ts\" \"npm run watch-js\"",
85
+    "watch-js": "cross-env-shell IONIC_PREPUBLISH_PLUGIN_VERSION=${npm_package_version}-local \"npm run watch-js-chokidar\"",
86
+    "watch-js-chokidar": "chokidar --silent \"dist/**/*.js\" -c \"npm run build-js\"",
87
+    "watch-ts": "tsc -w"
88
+  },
89
+  "version": "1.4.1"
90
+}

+ 2
- 0
node_modules/@ionic/cli-utils/.npmignore View File

@@ -0,0 +1,2 @@
1
+src
2
+tsconfig.json

+ 146
- 0
node_modules/@ionic/cli-utils/CHANGELOG.md View File

@@ -0,0 +1,146 @@
1
+# Change Log
2
+
3
+All notable changes to this project will be documented in this file.
4
+See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
5
+
6
+<a name="1.7.0"></a>
7
+# [1.7.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.6.0...@ionic/cli-utils@1.7.0) (2017-08-03)
8
+
9
+
10
+### Bug Fixes
11
+
12
+* **daemon:** fix occasional ENOENT error on windows ([1beb455](https://github.com/ionic-team/ionic-cli/commit/1beb455))
13
+* **help:** "undefined" slipped in to some help output ([1f885fa](https://github.com/ionic-team/ionic-cli/commit/1f885fa))
14
+* **plugins:** small fix for differing dist tags of plugins ([3adfcb6](https://github.com/ionic-team/ionic-cli/commit/3adfcb6))
15
+* **serve:** allow binding of localhost ([e8a74d0](https://github.com/ionic-team/ionic-cli/commit/e8a74d0))
16
+* **start:** disable yarn dedupe during start ([dd5c35f](https://github.com/ionic-team/ionic-cli/commit/dd5c35f))
17
+
18
+
19
+### Features
20
+
21
+* **build:** `ionic build` command ([3ad304c](https://github.com/ionic-team/ionic-cli/commit/3ad304c))
22
+
23
+
24
+
25
+
26
+<a name="1.6.0"></a>
27
+# [1.6.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.5.0...@ionic/cli-utils@1.6.0) (2017-07-27)
28
+
29
+
30
+### Bug Fixes
31
+
32
+* **timeouts:** rip out timeouts ([22dcd2f](https://github.com/ionic-team/ionic-cli/commit/22dcd2f))
33
+
34
+
35
+### Features
36
+
37
+* ionic pro ([36dc2f7](https://github.com/ionic-team/ionic-cli/commit/36dc2f7))
38
+
39
+
40
+
41
+
42
+<a name="1.5.0"></a>
43
+# [1.5.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.4.0...@ionic/cli-utils@1.5.0) (2017-07-11)
44
+
45
+
46
+### Bug Fixes
47
+
48
+* better icon support for windows ([47ea9ab](https://github.com/ionic-team/ionic-cli/commit/47ea9ab))
49
+* **link:** disable interpretation of scientific notation ([3874ca6](https://github.com/ionic-team/ionic-cli/commit/3874ca6))
50
+* **project:** warn users of ionic.project file ([965af07](https://github.com/ionic-team/ionic-cli/commit/965af07))
51
+* **start:** substitute invalid package.json name for MyApp ([ce6c129](https://github.com/ionic-team/ionic-cli/commit/ce6c129))
52
+
53
+
54
+### Features
55
+
56
+* **cloud:** add options for snapshot metadata ([75099e6](https://github.com/ionic-team/ionic-cli/commit/75099e6))
57
+
58
+
59
+
60
+
61
+<a name="1.4.0"></a>
62
+# [1.4.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.3.0...@ionic/cli-utils@1.4.0) (2017-06-12)
63
+
64
+
65
+### Bug Fixes
66
+
67
+* **cordova:** actually show platform/type of missing resources ([4e154ed](https://github.com/ionic-team/ionic-cli/commit/4e154ed))
68
+* **ionic1:** logger not logging changed files ([1b51529](https://github.com/ionic-team/ionic-cli/commit/1b51529))
69
+* **plugins:** catch npm errors during updates and continue ([316826d](https://github.com/ionic-team/ionic-cli/commit/316826d))
70
+* **serve:** running ionic serve in background ([883c21e](https://github.com/ionic-team/ionic-cli/commit/883c21e))
71
+
72
+
73
+### Features
74
+
75
+* **hooks:** call npm script hooks ([e34fc34](https://github.com/ionic-team/ionic-cli/commit/e34fc34))
76
+* **plugins:** warn about multiple installed project plugins ([88789d8](https://github.com/ionic-team/ionic-cli/commit/88789d8))
77
+
78
+
79
+
80
+
81
+<a name="1.3.0"></a>
82
+# [1.3.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.2.0...@ionic/cli-utils@1.3.0) (2017-05-31)
83
+
84
+
85
+### Bug Fixes
86
+
87
+* **cordova:** more arg parsing fixes... ([4a75255](https://github.com/ionic-team/ionic-cli/commit/4a75255))
88
+* **proxy:** use env load to ensure shared reference ([8552826](https://github.com/ionic-team/ionic-cli/commit/8552826))
89
+
90
+
91
+
92
+
93
+<a name="1.2.0"></a>
94
+# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.1.2...@ionic/cli-utils@1.2.0) (2017-05-23)
95
+
96
+
97
+### Bug Fixes
98
+
99
+* **cli-plugin-ionic1:** use documentRoot and watchPatterns from ionic.config.json ([a878a95](https://github.com/ionic-team/ionic-cli/commit/a878a95))
100
+* don't swallow subprocess stdout during --verbose ([d53d11a](https://github.com/ionic-team/ionic-cli/commit/d53d11a))
101
+* **config:** Handle empty file ([fbcfc76](https://github.com/ionic-team/ionic-cli/commit/fbcfc76))
102
+* **package:** dates not internationalized, use ISO ([0674bd9](https://github.com/ionic-team/ionic-cli/commit/0674bd9))
103
+
104
+
105
+### Features
106
+
107
+* **flags:** --no-interactive mode, with --confirm/--no-confirm ([1966a0c](https://github.com/ionic-team/ionic-cli/commit/1966a0c))
108
+* **flags:** add --quiet flag ([6268f0c](https://github.com/ionic-team/ionic-cli/commit/6268f0c))
109
+* **flags:** persistent "cli flags" ([72a9b45](https://github.com/ionic-team/ionic-cli/commit/72a9b45))
110
+* **logging:** disable interval spinner for non-interactive mode ([9e4ed33](https://github.com/ionic-team/ionic-cli/commit/9e4ed33))
111
+* **login:** automatic login via IONIC_EMAIL/IONIC_PASSWORD ([d8d26e4](https://github.com/ionic-team/ionic-cli/commit/d8d26e4))
112
+
113
+
114
+
115
+
116
+<a name="1.1.2"></a>
117
+## [1.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.1.1...@ionic/cli-utils@1.1.2) (2017-05-17)
118
+
119
+
120
+
121
+
122
+<a name="1.1.1"></a>
123
+## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.1.0...@ionic/cli-utils@1.1.1) (2017-05-16)
124
+
125
+
126
+### Bug Fixes
127
+
128
+* **plugins:** messaging about globally installed plugins ([def3891](https://github.com/ionic-team/ionic-cli/commit/def3891))
129
+
130
+
131
+
132
+
133
+<a name="1.1.0"></a>
134
+# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@1.0.0...@ionic/cli-utils@1.1.0) (2017-05-16)
135
+
136
+
137
+### Bug Fixes
138
+
139
+* prevent TypeError runtime error ([1283f49](https://github.com/ionic-team/ionic-cli/commit/1283f49))
140
+* **cordova:** give cordova options after -- separator (https://github.com/ionic-team/ionic-cli/issues/2254) ([256503e](https://github.com/ionic-team/ionic-cli/commit/256503e))
141
+* **upload:** rip out progress library (fixes https://github.com/ionic-team/ionic-cli/issues/2257) ([1559049](https://github.com/ionic-team/ionic-cli/commit/1559049))
142
+
143
+
144
+### Features
145
+
146
+* **proxy:** global proxy plugin for start/login ([be89cb1](https://github.com/ionic-team/ionic-cli/commit/be89cb1))

+ 1
- 0
node_modules/@ionic/cli-utils/README.md View File

@@ -0,0 +1 @@
1
+# `@ionic/cli-utils`

+ 1
- 0
node_modules/@ionic/cli-utils/bootstrap.d.ts View File

@@ -0,0 +1 @@
1
+export declare function detectLocalCLI(): Promise<string | undefined>;

+ 19
- 0
node_modules/@ionic/cli-utils/bootstrap.js View File

@@ -0,0 +1,19 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const fs = require("fs");
5
+const path = require("path");
6
+const fs_1 = require("./lib/utils/fs");
7
+function detectLocalCLI() {
8
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+        const dir = yield fs_1.findBaseDirectory(process.cwd(), 'package.json');
10
+        if (dir) {
11
+            const local = path.join(dir, 'node_modules', 'ionic');
12
+            const ok = yield fs_1.pathAccessible(local, fs.constants.R_OK);
13
+            if (ok) {
14
+                return local;
15
+            }
16
+        }
17
+    });
18
+}
19
+exports.detectLocalCLI = detectLocalCLI;

+ 556
- 0
node_modules/@ionic/cli-utils/definitions.d.ts View File

@@ -0,0 +1,556 @@
1
+/// <reference types="node" />
2
+import * as crossSpawnType from 'cross-spawn';
3
+import * as inquirerType from 'inquirer';
4
+import * as semverType from 'semver';
5
+import * as superagentType from 'superagent';
6
+import * as lodashType from 'lodash';
7
+import * as minimistType from 'minimist';
8
+import { EventEmitter } from 'events';
9
+export interface SuperAgentError extends Error {
10
+    response: superagentType.Response;
11
+}
12
+export declare type LogFn = (msg: string | (() => string)) => void;
13
+export declare type LogLevel = 'debug' | 'info' | 'ok' | 'warn' | 'error';
14
+export interface LoggerOptions {
15
+    level?: LogLevel;
16
+    prefix?: string | (() => string);
17
+    stream?: NodeJS.WritableStream;
18
+}
19
+export interface ILogger {
20
+    level: LogLevel;
21
+    prefix: string | (() => string);
22
+    stream: NodeJS.WritableStream;
23
+    debug: LogFn;
24
+    info: LogFn;
25
+    ok: LogFn;
26
+    warn: LogFn;
27
+    error: LogFn;
28
+    msg: LogFn;
29
+    nl(num?: number): void;
30
+    shouldLog(level: LogLevel): boolean;
31
+}
32
+export interface ITask {
33
+    msg: string;
34
+    running: boolean;
35
+    progressRatio: number;
36
+    start(): this;
37
+    progress(prog: number, total: number): this;
38
+    clear(): this;
39
+    succeed(): this;
40
+    fail(): this;
41
+    end(): this;
42
+}
43
+export interface ITaskChain {
44
+    next(msg: string): ITask;
45
+    updateMsg(msg: string): this;
46
+    end(): this;
47
+    fail(): this;
48
+    cleanup(): this;
49
+}
50
+export interface PackageJson {
51
+    name: string;
52
+    version?: string;
53
+    scripts?: {
54
+        [key: string]: string;
55
+    };
56
+    dependencies?: {
57
+        [key: string]: string;
58
+    };
59
+    devDependencies?: {
60
+        [key: string]: string;
61
+    };
62
+    peerDependencies?: {
63
+        [key: string]: string;
64
+    };
65
+}
66
+export interface BowerJson {
67
+    name: string;
68
+    dependencies?: {
69
+        [key: string]: string;
70
+    };
71
+    devDependencies?: {
72
+        [key: string]: string;
73
+    };
74
+}
75
+export interface ProjectFileProxy {
76
+    proxyUrl: string;
77
+    proxyNoAgent: boolean;
78
+    rejectUnauthorized: boolean;
79
+    path: string;
80
+}
81
+export declare type ProjectType = 'ionic-angular' | 'ionic1';
82
+export interface ProjectFile {
83
+    name: string;
84
+    type: ProjectType;
85
+    app_id: string;
86
+    gulpFile?: string;
87
+    documentRoot?: string;
88
+    watchPatterns?: string[];
89
+    proxies?: ProjectFileProxy[];
90
+}
91
+export interface Response<T> extends APIResponseSuccess {
92
+    data: T;
93
+}
94
+export interface AppDetails {
95
+    id: string;
96
+    name: string;
97
+    slug: string;
98
+    repo_url?: string;
99
+}
100
+export interface AuthToken {
101
+    token: string;
102
+    details: {
103
+        app_id: string;
104
+        type: 'app-user';
105
+        user_id: string;
106
+    };
107
+}
108
+export interface SSHKey {
109
+    id: string;
110
+    pubkey: string;
111
+    fingerprint: string;
112
+    annotation: string;
113
+    name: string;
114
+    created: string;
115
+    updated: string;
116
+}
117
+export interface DeploySnapshot {
118
+    uuid: string;
119
+    url: string;
120
+}
121
+export interface DeploySnapshotRequest extends DeploySnapshot {
122
+    presigned_post: {
123
+        url: string;
124
+        fields: Object;
125
+    };
126
+}
127
+export interface DeployChannel {
128
+    uuid: string;
129
+    tag: string;
130
+}
131
+export interface Deploy {
132
+    uuid: string;
133
+    snapshot: string;
134
+    channel: string;
135
+}
136
+export interface PackageProjectRequest {
137
+    id: number;
138
+    presigned_post: {
139
+        url: string;
140
+        fields: Object;
141
+    };
142
+}
143
+export interface PackageBuild {
144
+    id: number;
145
+    name: string | null;
146
+    created: string;
147
+    completed: string | null;
148
+    platform: 'android' | 'ios';
149
+    status: 'SUCCESS' | 'FAILED' | 'QUEUED' | 'BUILDING';
150
+    mode: 'debug' | 'release';
151
+    security_profile_tag: string | null;
152
+    url?: string | null;
153
+    output?: string | null;
154
+}
155
+export interface SecurityProfile {
156
+    name: string;
157
+    tag: string;
158
+    type: 'development' | 'production';
159
+    created: string;
160
+    credentials: {
161
+        android?: Object;
162
+        ios?: Object;
163
+    };
164
+}
165
+export interface IApp {
166
+    load(app_id?: string): Promise<AppDetails>;
167
+}
168
+export interface IProject extends IConfig<ProjectFile> {
169
+    directory: string;
170
+    formatType(input: ProjectType): string;
171
+    loadAppId(): Promise<string>;
172
+    loadPackageJson(): Promise<PackageJson>;
173
+    loadBowerJson(): Promise<BowerJson>;
174
+}
175
+export interface PackageVersions {
176
+    [key: string]: string;
177
+}
178
+export interface DaemonFile {
179
+    daemonVersion: string;
180
+    latestVersions: {
181
+        latest: PackageVersions;
182
+        [key: string]: PackageVersions;
183
+    };
184
+}
185
+export interface IDaemon extends IConfig<DaemonFile> {
186
+    pidFilePath: string;
187
+    logFilePath: string;
188
+    getPid(): Promise<number | undefined>;
189
+    setPid(pid: number): Promise<void>;
190
+    populateDistTag(distTag: DistTag): void;
191
+}
192
+export declare type CommandLineInput = string | boolean | null | undefined | string[];
193
+export declare type CommandLineInputs = string[];
194
+export interface CommandLineOptions extends minimistType.ParsedArgs {
195
+    [arg: string]: CommandLineInput;
196
+}
197
+export declare type CommandOptionType = StringConstructor | BooleanConstructor;
198
+export declare type CommandOptionTypeDefaults = Map<CommandOptionType, CommandLineInput>;
199
+export interface CommandOption {
200
+    name: string;
201
+    description: string;
202
+    backends?: BackendFlag[];
203
+    type?: CommandOptionType;
204
+    default?: CommandLineInput;
205
+    aliases?: string[];
206
+    private?: boolean;
207
+    intent?: string;
208
+    visible?: boolean;
209
+}
210
+export interface NormalizedCommandOption extends CommandOption {
211
+    type: CommandOptionType;
212
+    default: CommandLineInput;
213
+    aliases: string[];
214
+}
215
+export interface ExitCodeException extends Error {
216
+    exitCode: number;
217
+}
218
+export declare type Validator = (input?: string, key?: string) => true | string;
219
+export interface Validators {
220
+    required: Validator;
221
+    email: Validator;
222
+    numeric: Validator;
223
+}
224
+export interface ValidationError {
225
+    message: string;
226
+    inputName: string;
227
+}
228
+export interface CommandInput {
229
+    name: string;
230
+    description: string;
231
+    validators?: Validator[];
232
+    required?: boolean;
233
+    private?: boolean;
234
+}
235
+export interface NormalizedMinimistOpts extends minimistType.Opts {
236
+    string: string[];
237
+    boolean: string[];
238
+    alias: {
239
+        [key: string]: string[];
240
+    };
241
+    default: {
242
+        [key: string]: CommandLineInput;
243
+    };
244
+}
245
+export declare type BackendFlag = 'pro' | 'legacy';
246
+export interface CommandData {
247
+    name: string;
248
+    type: 'global' | 'project';
249
+    backends?: BackendFlag[];
250
+    description: string;
251
+    longDescription?: string;
252
+    exampleCommands?: string[];
253
+    aliases?: string[];
254
+    inputs?: CommandInput[];
255
+    options?: CommandOption[];
256
+    fullName?: string;
257
+    visible?: boolean;
258
+    source?: string;
259
+    minimistOpts?: minimistType.Opts;
260
+}
261
+export interface ISession {
262
+    login(email: string, password: string): Promise<void>;
263
+    logout(): Promise<void>;
264
+    isLoggedIn(): Promise<boolean>;
265
+    getUserToken(): Promise<string>;
266
+    getAppUserToken(app_id?: string): Promise<string>;
267
+}
268
+export interface IShellRunOptions extends crossSpawnType.SpawnOptions {
269
+    showCommand?: boolean;
270
+    showExecution?: boolean;
271
+    showError?: boolean;
272
+    fatalOnNotFound?: boolean;
273
+    fatalOnError?: boolean;
274
+    truncateErrorOutput?: number;
275
+}
276
+export interface IShell {
277
+    run(command: string, args: string[], options: IShellRunOptions): Promise<string>;
278
+}
279
+export interface ITelemetry {
280
+    sendCommand(command: string, args: string[]): Promise<void>;
281
+    sendError(error: any, type: string): Promise<void>;
282
+    resetToken(): Promise<void>;
283
+}
284
+export interface ConfigFile {
285
+    lastCommand: string;
286
+    daemon: {
287
+        updates?: boolean;
288
+    };
289
+    urls: {
290
+        api: string;
291
+        dash: string;
292
+    };
293
+    git: {
294
+        host: string;
295
+        port?: number;
296
+        setup?: boolean;
297
+    };
298
+    user: {
299
+        id?: string;
300
+        email?: string;
301
+    };
302
+    tokens: {
303
+        user?: string;
304
+        telemetry?: string;
305
+        appUser: {
306
+            [app_id: string]: string;
307
+        };
308
+    };
309
+    backend: BackendFlag;
310
+    telemetry: boolean;
311
+    yarn: boolean;
312
+}
313
+export interface IConfig<T extends {
314
+    [key: string]: any;
315
+}> {
316
+    directory: string;
317
+    fileName: string;
318
+    filePath: string;
319
+    load(options?: {
320
+        disk?: boolean;
321
+    }): Promise<T>;
322
+    save(configFile?: T): Promise<void>;
323
+}
324
+export declare type APIResponse = APIResponseSuccess | APIResponseError;
325
+export interface APIResponseMeta {
326
+    status: number;
327
+    version: string;
328
+    request_id: string;
329
+}
330
+export declare type APIResponseData = Object | Object[] | string;
331
+export interface APIResponseErrorDetails {
332
+    error_type: string;
333
+    parameter: string;
334
+    errors: string[];
335
+}
336
+export interface APIResponseError {
337
+    error: APIResponseErrorError;
338
+    meta: APIResponseMeta;
339
+}
340
+export interface APIResponseErrorError {
341
+    message: string;
342
+    link: string | null;
343
+    type: string;
344
+    details?: APIResponseErrorDetails[];
345
+}
346
+export interface APIResponseSuccess {
347
+    data: APIResponseData;
348
+    meta: APIResponseMeta;
349
+}
350
+export declare type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'PURGE' | 'HEAD' | 'OPTIONS';
351
+export interface IClient {
352
+    host: string;
353
+    make(method: HttpMethod, path: string): superagentType.SuperAgentRequest;
354
+    do(req: superagentType.SuperAgentRequest): Promise<APIResponseSuccess>;
355
+    paginate<T extends Response<Object[]>>(reqgen: () => superagentType.SuperAgentRequest, guard: (res: APIResponseSuccess) => res is T): IPaginator<T>;
356
+}
357
+export interface IPaginator<T extends Response<Object[]>> extends IterableIterator<Promise<T>> {
358
+}
359
+export interface EnvironmentHookArgs {
360
+    env: IonicEnvironment;
361
+}
362
+export interface CommandHookArgs extends EnvironmentHookArgs {
363
+    cmd: ICommand;
364
+    inputs: CommandLineInputs;
365
+    options: CommandLineOptions;
366
+}
367
+export interface InfoHookItem {
368
+    type: 'system' | 'global-packages' | 'local-packages' | 'cli-packages';
369
+    name: string;
370
+    version: string;
371
+    path?: string;
372
+}
373
+export interface ConfigSetCommandHookArgs extends CommandHookArgs {
374
+    valueChanged: boolean;
375
+}
376
+export interface ServeCommandHookResponse {
377
+    protocol: string;
378
+    localAddress: string;
379
+    externalAddress: string;
380
+    port: number;
381
+    /**
382
+     * Whether or not the server is accessible locally.
383
+     */
384
+    locallyAccessible: boolean;
385
+    /**
386
+     * Whether or not the server is accessible externally.
387
+     */
388
+    externallyAccessible: boolean;
389
+    /**
390
+     * @deprecated
391
+     */
392
+    httpPort?: number;
393
+    /**
394
+     * @deprecated
395
+     */
396
+    publicIp?: string;
397
+    [key: string]: any;
398
+}
399
+export interface CordovaProjectInfoHookResponse {
400
+    id: string;
401
+    name: string;
402
+    version: string;
403
+}
404
+export interface IHook<T, U> {
405
+    source: string;
406
+    name: string;
407
+    fire(args: T): Promise<U>;
408
+}
409
+export interface IHookEngine {
410
+    fire(hook: 'cordova:project:info', args: EnvironmentHookArgs): Promise<CordovaProjectInfoHookResponse[]>;
411
+    fire(hook: 'plugins:init', args: EnvironmentHookArgs): Promise<void[]>;
412
+    fire(hook: 'command:config:set', args: ConfigSetCommandHookArgs): Promise<void[]>;
413
+    fire(hook: 'command:docs', args: CommandHookArgs): Promise<string[]>;
414
+    fire(hook: 'command:generate', args: CommandHookArgs): Promise<void[]>;
415
+    fire(hook: 'command:info', args: CommandHookArgs): Promise<InfoHookItem[][]>;
416
+    fire(hook: 'command:build', args: CommandHookArgs): Promise<void[]>;
417
+    fire(hook: 'command:serve', args: CommandHookArgs): Promise<ServeCommandHookResponse[]>;
418
+    fire(hook: 'build:before', args: EnvironmentHookArgs): Promise<void[]>;
419
+    fire(hook: 'build:after', args: EnvironmentHookArgs): Promise<void[]>;
420
+    fire(hook: 'watch:before', args: EnvironmentHookArgs): Promise<void[]>;
421
+    fire(hook: 'backend:changed', args: EnvironmentHookArgs): Promise<void[]>;
422
+    register(source: string, hook: 'cordova:project:info', listener: (args: EnvironmentHookArgs) => Promise<CordovaProjectInfoHookResponse>): void;
423
+    register(source: string, hook: 'plugins:init', listener: (args: EnvironmentHookArgs) => Promise<void>): void;
424
+    register(source: string, hook: 'command:config:set', listener: (args: ConfigSetCommandHookArgs) => Promise<void>): void;
425
+    register(source: string, hook: 'command:docs', listener: (args: CommandHookArgs) => Promise<string>): void;
426
+    register(source: string, hook: 'command:generate', listener: (args: CommandHookArgs) => Promise<void>): void;
427
+    register(source: string, hook: 'command:info', listener: (args: CommandHookArgs) => Promise<InfoHookItem[]>): void;
428
+    register(source: string, hook: 'command:build', listener: (args: CommandHookArgs) => Promise<void>): void;
429
+    register(source: string, hook: 'command:serve', listener: (args: CommandHookArgs) => Promise<ServeCommandHookResponse>): void;
430
+    register(source: string, hook: 'build:before', listener: (args: EnvironmentHookArgs) => Promise<void>): void;
431
+    register(source: string, hook: 'build:after', listener: (args: EnvironmentHookArgs) => Promise<void>): void;
432
+    register(source: string, hook: 'watch:before', listener: (args: EnvironmentHookArgs) => Promise<void>): void;
433
+    register(source: string, hook: 'backend:changed', listener: (args: EnvironmentHookArgs) => Promise<void>): void;
434
+    getSources(hook: string): string[];
435
+    hasSources(hook: string, sources: string[]): boolean;
436
+    deleteSource(source: string): void;
437
+    getRegistered<T, U>(hook: string): IHook<T, U>[];
438
+}
439
+export interface ICLIEventEmitter extends EventEmitter {
440
+    on(event: 'watch:init', listener: () => void): this;
441
+    on(event: 'watch:change', listener: (path: string) => void): this;
442
+    emit(event: 'watch:init'): boolean;
443
+    emit(event: 'watch:change', path: string): boolean;
444
+}
445
+export interface PromptQuestion extends inquirerType.Question {
446
+    type: string;
447
+    message: string;
448
+    name: string;
449
+}
450
+export interface ConfirmPromptQuestion extends PromptQuestion {
451
+    type: 'confirm';
452
+    noninteractiveValue?: boolean;
453
+}
454
+export interface NonConfirmPromptQuestion extends PromptQuestion {
455
+    type: 'input' | 'password' | 'list';
456
+    noninteractiveValue?: string;
457
+}
458
+export interface PromptModule {
459
+    (question: ConfirmPromptQuestion): Promise<boolean>;
460
+    (question: NonConfirmPromptQuestion): Promise<string>;
461
+}
462
+export interface IonicEnvironment {
463
+    readonly flags: IonicEnvironmentFlags;
464
+    readonly hooks: IHookEngine;
465
+    readonly client: IClient;
466
+    readonly config: IConfig<ConfigFile>;
467
+    readonly daemon: IDaemon;
468
+    readonly events: ICLIEventEmitter;
469
+    readonly log: ILogger;
470
+    readonly prompt: PromptModule;
471
+    readonly meta: IonicEnvironmentMeta;
472
+    project: IProject;
473
+    readonly plugins: IonicEnvironmentPlugins;
474
+    session: ISession;
475
+    readonly shell: IShell;
476
+    readonly tasks: ITaskChain;
477
+    readonly telemetry: ITelemetry;
478
+    readonly namespace: IRootNamespace;
479
+    open(): Promise<void>;
480
+    close(): Promise<void>;
481
+    runcmd(pargv: string[], opts?: {
482
+        showExecution?: boolean;
483
+        showLogs?: boolean;
484
+    }): Promise<void>;
485
+    load(modulePath: 'semver'): typeof semverType;
486
+    load(modulePath: 'superagent'): typeof superagentType;
487
+    load(modulePath: 'lodash'): typeof lodashType;
488
+}
489
+export interface IonicEnvironmentFlags {
490
+    interactive: boolean;
491
+    confirm: boolean;
492
+}
493
+export interface IonicEnvironmentMeta {
494
+    cwd: string;
495
+    local: boolean;
496
+    binPath: string;
497
+    libPath: string;
498
+}
499
+export interface IonicEnvironmentPlugins {
500
+    ionic: Plugin;
501
+    [key: string]: Plugin;
502
+}
503
+export declare type DistTag = 'local' | 'canary' | 'beta' | 'latest';
504
+export interface PluginMeta {
505
+    filePath: string;
506
+}
507
+export interface Plugin {
508
+    name: string;
509
+    version: string;
510
+    namespace?: INamespace;
511
+    registerHooks?(hooks: IHookEngine): void;
512
+    meta?: PluginMeta;
513
+}
514
+export interface RootPlugin extends Plugin {
515
+    namespace: IRootNamespace;
516
+}
517
+export interface HydratedPlugin extends Plugin {
518
+    distTag: DistTag;
519
+    currentVersion: string;
520
+    latestVersion: string;
521
+    updateAvailable: boolean;
522
+    meta: PluginMeta;
523
+}
524
+export interface INamespace {
525
+    root: boolean;
526
+    name: string;
527
+    namespaces: INamespaceMap;
528
+    commands: ICommandMap;
529
+    source: string;
530
+    locate(argv: string[]): [number, string[], ICommand | INamespace];
531
+    getCommandMetadataList(): CommandData[];
532
+}
533
+export interface IRootNamespace extends INamespace {
534
+    root: true;
535
+    name: 'ionic';
536
+    source: 'ionic';
537
+    runCommand(env: IonicEnvironment, pargv: string[]): Promise<void | number>;
538
+}
539
+export interface ICommand {
540
+    env: IonicEnvironment;
541
+    metadata: CommandData;
542
+    validate(inputs: CommandLineInputs): Promise<void>;
543
+    run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number>;
544
+    execute(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void>;
545
+}
546
+export interface CommandPreRun extends ICommand {
547
+    preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number>;
548
+}
549
+export declare type NamespaceMapGetter = () => INamespace;
550
+export declare type CommandMapGetter = () => ICommand;
551
+export interface INamespaceMap extends Map<string, NamespaceMapGetter> {
552
+}
553
+export interface ICommandMap extends Map<string, string | CommandMapGetter> {
554
+    getAliases(): Map<string, string[]>;
555
+    resolveAliases(cmdName: string): undefined | CommandMapGetter;
556
+}

+ 2
- 0
node_modules/@ionic/cli-utils/definitions.js View File

@@ -0,0 +1,2 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });

+ 41
- 0
node_modules/@ionic/cli-utils/guards.d.ts View File

@@ -0,0 +1,41 @@
1
+import { APIResponse, APIResponseError, APIResponseSuccess, AppDetails, AuthToken, BowerJson, CommandPreRun, Deploy, DeployChannel, DeploySnapshot, DeploySnapshotRequest, ExitCodeException, ICommand, INamespace, LogLevel, PackageBuild, PackageJson, PackageProjectRequest, Plugin, Response, SSHKey, SecurityProfile, SuperAgentError, ValidationError } from './definitions';
2
+export declare const LOG_LEVELS: LogLevel[];
3
+export declare function isCommand(cmd: ICommand | INamespace): cmd is ICommand;
4
+export declare function isCommandPreRun(cmd: ICommand): cmd is CommandPreRun;
5
+export declare function isLogLevel(l: string): l is LogLevel;
6
+export declare function isPackageJson(o: Object): o is PackageJson;
7
+export declare function isBowerJson(o: Object): o is BowerJson;
8
+export declare function isExitCodeException(e: Error): e is ExitCodeException;
9
+export declare function isValidationErrorArray(e: Object[]): e is ValidationError[];
10
+export declare function isPlugin(p: any): p is Plugin;
11
+export declare function isSuperAgentError(e: Error): e is SuperAgentError;
12
+export declare function isAPIResponseSuccess(r: APIResponse): r is APIResponseSuccess;
13
+export declare function isAPIResponseError(r: APIResponse): r is APIResponseError;
14
+export declare function isAppDetails(d: Object): d is AppDetails;
15
+export declare function isAppResponse(r: APIResponse): r is Response<AppDetails>;
16
+export declare function isAppsResponse(r: APIResponse): r is Response<AppDetails[]>;
17
+export declare function isAuthTokensResponse(r: APIResponse): r is Response<AuthToken[]>;
18
+export declare function isLegacyLoginResponse(r: APIResponse): r is Response<{
19
+    user_id: string;
20
+    token: string;
21
+}>;
22
+export declare function isProLoginResponse(r: APIResponse): r is Response<{
23
+    user: {
24
+        id: number;
25
+        email: string;
26
+    };
27
+    token: string;
28
+}>;
29
+export declare function isSSHKeyListResponse(r: APIResponse): r is Response<SSHKey[]>;
30
+export declare function isSSHKeyResponse(r: APIResponse): r is Response<SSHKey>;
31
+export declare function isDeployResponse(r: APIResponse): r is Response<Deploy>;
32
+export declare function isPackageProjectRequestResponse(r: APIResponse): r is Response<PackageProjectRequest>;
33
+export declare function isPackageBuild(o: Object): o is PackageBuild;
34
+export declare function isSecurityProfile(o: Object): o is SecurityProfile;
35
+export declare function isSecurityProfileResponse(r: APIResponse): r is Response<SecurityProfile>;
36
+export declare function isSecurityProfilesResponse(r: APIResponse): r is Response<SecurityProfile[]>;
37
+export declare function isPackageBuildResponse(r: APIResponse): r is Response<PackageBuild>;
38
+export declare function isPackageBuildsResponse(r: APIResponse): r is Response<PackageBuild[]>;
39
+export declare function isDeployChannelResponse(r: APIResponse): r is Response<DeployChannel>;
40
+export declare function isDeploySnapshotResponse(r: APIResponse): r is Response<DeploySnapshot>;
41
+export declare function isDeploySnapshotRequestResponse(r: APIResponse): r is Response<DeploySnapshotRequest>;

+ 238
- 0
node_modules/@ionic/cli-utils/guards.js View File

@@ -0,0 +1,238 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+exports.LOG_LEVELS = ['debug', 'info', 'ok', 'warn', 'error'];
4
+function isCommand(cmd) {
5
+    return typeof cmd.run === 'function';
6
+}
7
+exports.isCommand = isCommand;
8
+function isCommandPreRun(cmd) {
9
+    return typeof cmd.preRun === 'function';
10
+}
11
+exports.isCommandPreRun = isCommandPreRun;
12
+function isLogLevel(l) {
13
+    const loglevel = l;
14
+    return exports.LOG_LEVELS.includes(loglevel);
15
+}
16
+exports.isLogLevel = isLogLevel;
17
+function isPackageJson(o) {
18
+    const obj = o;
19
+    return obj && typeof obj.name === 'string';
20
+}
21
+exports.isPackageJson = isPackageJson;
22
+function isBowerJson(o) {
23
+    const obj = o;
24
+    return obj && typeof obj.name === 'string';
25
+}
26
+exports.isBowerJson = isBowerJson;
27
+function isExitCodeException(e) {
28
+    const err = e;
29
+    return err && typeof err.exitCode === 'number' && err.exitCode >= 0 && err.exitCode <= 255;
30
+}
31
+exports.isExitCodeException = isExitCodeException;
32
+function isValidationErrorArray(e) {
33
+    const err = e;
34
+    return err && err[0]
35
+        && typeof err[0].message === 'string'
36
+        && typeof err[0].inputName === 'string';
37
+}
38
+exports.isValidationErrorArray = isValidationErrorArray;
39
+function isPlugin(p) {
40
+    const plugin = p;
41
+    return plugin
42
+        && typeof plugin.name === 'string'
43
+        && typeof plugin.version === 'string';
44
+}
45
+exports.isPlugin = isPlugin;
46
+function isSuperAgentError(e) {
47
+    const err = e;
48
+    return e && err.response && typeof err.response === 'object';
49
+}
50
+exports.isSuperAgentError = isSuperAgentError;
51
+function isAPIResponseSuccess(r) {
52
+    const res = r;
53
+    return res && (typeof res.data === 'object' || typeof res.data === 'string');
54
+}
55
+exports.isAPIResponseSuccess = isAPIResponseSuccess;
56
+function isAPIResponseError(r) {
57
+    const res = r;
58
+    return res && typeof res.error === 'object';
59
+}
60
+exports.isAPIResponseError = isAPIResponseError;
61
+function isAppDetails(d) {
62
+    const details = d;
63
+    return details && typeof details === 'object'
64
+        && typeof details.id === 'string'
65
+        && typeof details.name === 'string'
66
+        && typeof details.slug === 'string';
67
+}
68
+exports.isAppDetails = isAppDetails;
69
+function isAppResponse(r) {
70
+    const res = r;
71
+    return isAPIResponseSuccess(res) && isAppDetails(res.data);
72
+}
73
+exports.isAppResponse = isAppResponse;
74
+function isAppsResponse(r) {
75
+    let res = r;
76
+    if (!isAPIResponseSuccess(res) || !Array.isArray(res.data)) {
77
+        return false;
78
+    }
79
+    if (res.data.length > 0) {
80
+        return isAppDetails(res.data[0]);
81
+    }
82
+    return true;
83
+}
84
+exports.isAppsResponse = isAppsResponse;
85
+function isAuthTokensResponse(r) {
86
+    const res = r;
87
+    if (!isAPIResponseSuccess(res) || !Array.isArray(res.data)) {
88
+        return false;
89
+    }
90
+    if (res.data.length > 0) {
91
+        return typeof res.data[0].token === 'string'
92
+            && typeof res.data[0].details === 'object'
93
+            && typeof res.data[0].details.app_id === 'string'
94
+            && typeof res.data[0].details.type === 'string'
95
+            && typeof res.data[0].details.user_id === 'string';
96
+    }
97
+    return true;
98
+}
99
+exports.isAuthTokensResponse = isAuthTokensResponse;
100
+function isLegacyLoginResponse(r) {
101
+    const res = r;
102
+    return isAPIResponseSuccess(r) && typeof res.data.token === 'string';
103
+}
104
+exports.isLegacyLoginResponse = isLegacyLoginResponse;
105
+function isProLoginResponse(r) {
106
+    const res = r;
107
+    return isAPIResponseSuccess(r)
108
+        && typeof res.data.user === 'object'
109
+        && typeof res.data.user.id === 'number'
110
+        && typeof res.data.user.email === 'string'
111
+        && typeof res.data.token === 'string';
112
+}
113
+exports.isProLoginResponse = isProLoginResponse;
114
+function isSSHKeyListResponse(r) {
115
+    const res = r;
116
+    if (!isAPIResponseSuccess(r) || !Array.isArray(r.data)) {
117
+        return false;
118
+    }
119
+    if (typeof r.data[0] === 'object') {
120
+        return typeof res.data[0].id === 'string'
121
+            && typeof res.data[0].pubkey === 'string'
122
+            && typeof res.data[0].fingerprint === 'string'
123
+            && typeof res.data[0].annotation === 'string'
124
+            && typeof res.data[0].name === 'string'
125
+            && typeof res.data[0].created === 'string'
126
+            && typeof res.data[0].updated === 'string';
127
+    }
128
+    return true;
129
+}
130
+exports.isSSHKeyListResponse = isSSHKeyListResponse;
131
+function isSSHKeyResponse(r) {
132
+    const res = r;
133
+    return isAPIResponseSuccess(r)
134
+        && typeof res.data.id === 'string'
135
+        && typeof res.data.pubkey === 'string'
136
+        && typeof res.data.fingerprint === 'string'
137
+        && typeof res.data.annotation === 'string'
138
+        && typeof res.data.name === 'string'
139
+        && typeof res.data.created === 'string'
140
+        && typeof res.data.updated === 'string';
141
+}
142
+exports.isSSHKeyResponse = isSSHKeyResponse;
143
+function isDeployResponse(r) {
144
+    const res = r;
145
+    return isAPIResponseSuccess(res)
146
+        && typeof res.data.uuid === 'string'
147
+        && typeof res.data.snapshot === 'string'
148
+        && typeof res.data.channel === 'string';
149
+}
150
+exports.isDeployResponse = isDeployResponse;
151
+function isPackageProjectRequestResponse(r) {
152
+    const res = r;
153
+    return isAPIResponseSuccess(res)
154
+        && typeof res.data.id === 'number'
155
+        && typeof res.data.presigned_post === 'object'
156
+        && typeof res.data.presigned_post.url === 'string'
157
+        && res.data.presigned_post.fields && typeof res.data.presigned_post.fields === 'object';
158
+}
159
+exports.isPackageProjectRequestResponse = isPackageProjectRequestResponse;
160
+function isPackageBuild(o) {
161
+    const obj = o;
162
+    return obj && typeof obj === 'object'
163
+        && typeof obj.id === 'number'
164
+        && (!obj.name) || typeof obj.name === 'string'
165
+        && typeof obj.created === 'string'
166
+        && (!obj.completed || typeof obj.completed === 'string')
167
+        && typeof obj.platform === 'string'
168
+        && typeof obj.status === 'string'
169
+        && typeof obj.mode === 'string'
170
+        && (!obj.security_profile_tag || typeof obj.security_profile_tag === 'string')
171
+        && (!obj.url || typeof obj.url === 'string');
172
+}
173
+exports.isPackageBuild = isPackageBuild;
174
+function isSecurityProfile(o) {
175
+    const obj = o;
176
+    return obj && typeof obj === 'object'
177
+        && typeof obj.name === 'string'
178
+        && typeof obj.tag === 'string'
179
+        && typeof obj.type === 'string'
180
+        && typeof obj.created === 'string'
181
+        && typeof obj.credentials === 'object';
182
+}
183
+exports.isSecurityProfile = isSecurityProfile;
184
+function isSecurityProfileResponse(r) {
185
+    const res = r;
186
+    return isAPIResponseSuccess(res) && isSecurityProfile(res.data);
187
+}
188
+exports.isSecurityProfileResponse = isSecurityProfileResponse;
189
+function isSecurityProfilesResponse(r) {
190
+    const res = r;
191
+    if (!isAPIResponseSuccess(res) || !Array.isArray(res.data)) {
192
+        return false;
193
+    }
194
+    if (res.data.length > 0) {
195
+        return isSecurityProfile(res.data[0]);
196
+    }
197
+    return true;
198
+}
199
+exports.isSecurityProfilesResponse = isSecurityProfilesResponse;
200
+function isPackageBuildResponse(r) {
201
+    const res = r;
202
+    return isAPIResponseSuccess(res) && isPackageBuild(res.data);
203
+}
204
+exports.isPackageBuildResponse = isPackageBuildResponse;
205
+function isPackageBuildsResponse(r) {
206
+    const res = r;
207
+    if (!isAPIResponseSuccess(res) || !Array.isArray(res.data)) {
208
+        return false;
209
+    }
210
+    if (res.data.length > 0) {
211
+        return isPackageBuild(res.data[0]);
212
+    }
213
+    return true;
214
+}
215
+exports.isPackageBuildsResponse = isPackageBuildsResponse;
216
+function isDeployChannelResponse(r) {
217
+    const res = r;
218
+    return isAPIResponseSuccess(res)
219
+        && typeof res.data.uuid === 'string'
220
+        && typeof res.data.tag === 'string';
221
+}
222
+exports.isDeployChannelResponse = isDeployChannelResponse;
223
+function isDeploySnapshotResponse(r) {
224
+    const res = r;
225
+    return isAPIResponseSuccess(res)
226
+        && typeof res.data.uuid === 'string'
227
+        && typeof res.data.url === 'string';
228
+}
229
+exports.isDeploySnapshotResponse = isDeploySnapshotResponse;
230
+function isDeploySnapshotRequestResponse(r) {
231
+    const res = r;
232
+    return isAPIResponseSuccess(res)
233
+        && typeof res.data.uuid === 'string'
234
+        && typeof res.data.presigned_post === 'object'
235
+        && typeof res.data.presigned_post.url === 'string'
236
+        && res.data.presigned_post.fields && typeof res.data.presigned_post.fields === 'object';
237
+}
238
+exports.isDeploySnapshotRequestResponse = isDeploySnapshotRequestResponse;

+ 44
- 0
node_modules/@ionic/cli-utils/index.d.ts View File

@@ -0,0 +1,44 @@
1
+import { IHookEngine, IonicEnvironment, RootPlugin } from './definitions';
2
+export * from './definitions';
3
+export * from './guards';
4
+export * from './lib/app';
5
+export * from './lib/backends';
6
+export * from './lib/command';
7
+export * from './lib/command/command';
8
+export * from './lib/command/namespace';
9
+export * from './lib/command/utils';
10
+export * from './lib/config';
11
+export * from './lib/daemon';
12
+export * from './lib/deploy';
13
+export * from './lib/errors';
14
+export * from './lib/events';
15
+export * from './lib/help';
16
+export * from './lib/hooks';
17
+export * from './lib/http';
18
+export * from './lib/login';
19
+export * from './lib/package';
20
+export * from './lib/plugins';
21
+export * from './lib/project';
22
+export * from './lib/prompts';
23
+export * from './lib/security';
24
+export * from './lib/session';
25
+export * from './lib/shell';
26
+export * from './lib/telemetry';
27
+export * from './lib/utils/archive';
28
+export * from './lib/utils/array';
29
+export * from './lib/utils/environmentInfo';
30
+export * from './lib/utils/format';
31
+export * from './lib/utils/fs';
32
+export * from './lib/utils/logger';
33
+export * from './lib/utils/network';
34
+export * from './lib/utils/npm';
35
+export * from './lib/utils/promise';
36
+export * from './lib/utils/string';
37
+export * from './lib/utils/task';
38
+export * from './lib/validators';
39
+export declare const name = "__NAME__";
40
+export declare const version = "__VERSION__";
41
+export declare function registerHooks(hooks: IHookEngine): void;
42
+export declare function generateIonicEnvironment(plugin: RootPlugin, pargv: string[], env: {
43
+    [key: string]: string;
44
+}): Promise<IonicEnvironment>;

+ 197
- 0
node_modules/@ionic/cli-utils/index.js View File

@@ -0,0 +1,197 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const util = require("util");
5
+const path = require("path");
6
+const ci_info_1 = require("ci-info");
7
+const chalk = require("chalk");
8
+const minimist = require("minimist");
9
+const guards_1 = require("./guards");
10
+const backends_1 = require("./lib/backends");
11
+const config_1 = require("./lib/config");
12
+const daemon_1 = require("./lib/daemon");
13
+const http_1 = require("./lib/http");
14
+const events_1 = require("./lib/events");
15
+const environment_1 = require("./lib/environment");
16
+const hooks_1 = require("./lib/hooks");
17
+const project_1 = require("./lib/project");
18
+const logger_1 = require("./lib/utils/logger");
19
+const fs_1 = require("./lib/utils/fs");
20
+const task_1 = require("./lib/utils/task");
21
+const telemetry_1 = require("./lib/telemetry");
22
+const session_1 = require("./lib/session");
23
+const shell_1 = require("./lib/shell");
24
+const prompts_1 = require("./lib/prompts");
25
+tslib_1.__exportStar(require("./guards"), exports);
26
+tslib_1.__exportStar(require("./lib/app"), exports);
27
+tslib_1.__exportStar(require("./lib/backends"), exports);
28
+tslib_1.__exportStar(require("./lib/command"), exports);
29
+tslib_1.__exportStar(require("./lib/command/command"), exports);
30
+tslib_1.__exportStar(require("./lib/command/namespace"), exports);
31
+tslib_1.__exportStar(require("./lib/command/utils"), exports);
32
+tslib_1.__exportStar(require("./lib/config"), exports);
33
+tslib_1.__exportStar(require("./lib/daemon"), exports);
34
+tslib_1.__exportStar(require("./lib/deploy"), exports);
35
+tslib_1.__exportStar(require("./lib/errors"), exports);
36
+tslib_1.__exportStar(require("./lib/events"), exports);
37
+tslib_1.__exportStar(require("./lib/help"), exports);
38
+tslib_1.__exportStar(require("./lib/hooks"), exports);
39
+tslib_1.__exportStar(require("./lib/http"), exports);
40
+tslib_1.__exportStar(require("./lib/login"), exports);
41
+tslib_1.__exportStar(require("./lib/package"), exports);
42
+tslib_1.__exportStar(require("./lib/plugins"), exports);
43
+tslib_1.__exportStar(require("./lib/project"), exports);
44
+tslib_1.__exportStar(require("./lib/prompts"), exports);
45
+tslib_1.__exportStar(require("./lib/security"), exports);
46
+tslib_1.__exportStar(require("./lib/session"), exports);
47
+tslib_1.__exportStar(require("./lib/shell"), exports);
48
+tslib_1.__exportStar(require("./lib/telemetry"), exports);
49
+tslib_1.__exportStar(require("./lib/utils/archive"), exports);
50
+tslib_1.__exportStar(require("./lib/utils/array"), exports);
51
+tslib_1.__exportStar(require("./lib/utils/environmentInfo"), exports);
52
+tslib_1.__exportStar(require("./lib/utils/format"), exports);
53
+tslib_1.__exportStar(require("./lib/utils/fs"), exports);
54
+tslib_1.__exportStar(require("./lib/utils/logger"), exports);
55
+tslib_1.__exportStar(require("./lib/utils/network"), exports);
56
+tslib_1.__exportStar(require("./lib/utils/npm"), exports);
57
+tslib_1.__exportStar(require("./lib/utils/promise"), exports);
58
+tslib_1.__exportStar(require("./lib/utils/string"), exports);
59
+tslib_1.__exportStar(require("./lib/utils/task"), exports);
60
+tslib_1.__exportStar(require("./lib/validators"), exports);
61
+exports.name = '@ionic/cli-utils';
62
+exports.version = '1.7.0';
63
+function registerHooks(hooks) {
64
+    hooks.register(exports.name, 'command:info', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+        return [
66
+            { type: 'cli-packages', name: exports.name, version: exports.version, path: path.dirname(__filename) },
67
+        ];
68
+    }));
69
+    hooks.register(exports.name, 'command:config:set', ({ env, inputs, options, valueChanged }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+        let [p] = inputs;
71
+        const { global } = options;
72
+        if (global && p === 'backend' && valueChanged) {
73
+            yield hooks.fire('backend:changed', { env });
74
+        }
75
+    }));
76
+    hooks.register(exports.name, 'backend:changed', ({ env }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
77
+        const config = yield env.config.load();
78
+        if (config.backend === backends_1.BACKEND_PRO) {
79
+            config.urls.api = 'https://api.ionicjs.com';
80
+            config.urls.dash = 'https://dashboard.ionicjs.com';
81
+        }
82
+        else if (config.backend === backends_1.BACKEND_LEGACY) {
83
+            config.urls.api = 'https://api.ionic.io';
84
+            config.urls.dash = 'https://apps.ionic.io';
85
+        }
86
+        const wasLoggedIn = yield env.session.isLoggedIn();
87
+        yield env.session.logout();
88
+        env.client.host = config.urls.api;
89
+        env.session = yield getSession(env.config, env.project, env.client);
90
+        if (wasLoggedIn) {
91
+            env.log.info('You have been logged out.');
92
+        }
93
+    }));
94
+}
95
+exports.registerHooks = registerHooks;
96
+function getSession(config, project, client) {
97
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
98
+        const configData = yield config.load();
99
+        return configData.backend === backends_1.BACKEND_LEGACY ? new session_1.CloudSession(config, project, client) : new session_1.ProSession(config, project, client);
100
+    });
101
+}
102
+function generateIonicEnvironment(plugin, pargv, env) {
103
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
104
+        const cwd = process.cwd();
105
+        const argv = minimist(pargv, { boolean: true, string: '_' });
106
+        const config = new config_1.Config(env['IONIC_CONFIG_DIRECTORY'] || config_1.CONFIG_DIRECTORY, config_1.CONFIG_FILE);
107
+        const configData = yield config.load();
108
+        const flags = config_1.gatherFlags(argv);
109
+        let stream;
110
+        let tasks;
111
+        let bottomBar;
112
+        let log;
113
+        let level = 'info';
114
+        let levelInvalid = false;
115
+        let prefix = '';
116
+        if (ci_info_1.isCI) {
117
+            flags.interactive = false;
118
+        }
119
+        if (argv['log-level']) {
120
+            if (guards_1.isLogLevel(argv['log-level'])) {
121
+                level = argv['log-level'];
122
+            }
123
+            else {
124
+                levelInvalid = true;
125
+            }
126
+        }
127
+        if (argv['log-timestamps']) {
128
+            prefix = () => `${chalk.dim('[' + new Date().toISOString() + ']')}`;
129
+        }
130
+        if (flags.interactive) {
131
+            const inquirer = yield Promise.resolve().then(function () { return require('inquirer'); });
132
+            bottomBar = new inquirer.ui.BottomBar();
133
+            stream = bottomBar.log;
134
+            log = new logger_1.Logger({ level, prefix, stream });
135
+            tasks = new task_1.InteractiveTaskChain({ log, bottomBar });
136
+        }
137
+        else {
138
+            stream = process.stdout;
139
+            log = new logger_1.Logger({ level, prefix, stream });
140
+            tasks = new task_1.TaskChain({ log });
141
+        }
142
+        const projectDir = yield fs_1.findBaseDirectory(cwd, project_1.PROJECT_FILE);
143
+        env['IONIC_PROJECT_DIR'] = projectDir || '';
144
+        env['IONIC_PROJECT_FILE'] = project_1.PROJECT_FILE;
145
+        const project = new project_1.Project(env['IONIC_PROJECT_DIR'], project_1.PROJECT_FILE);
146
+        const client = new http_1.Client(configData.urls.api);
147
+        const session = yield getSession(config, project, client);
148
+        const hooks = new hooks_1.HookEngine();
149
+        const telemetry = new telemetry_1.Telemetry({ config, client, plugin, project, session });
150
+        const shell = new shell_1.Shell(tasks, log);
151
+        registerHooks(hooks);
152
+        const ienv = new environment_1.Environment({
153
+            bottomBar,
154
+            client,
155
+            config,
156
+            daemon: new daemon_1.Daemon(config_1.CONFIG_DIRECTORY, daemon_1.DAEMON_JSON_FILE),
157
+            events: new events_1.CLIEventEmitter(),
158
+            flags,
159
+            hooks,
160
+            log,
161
+            meta: {
162
+                cwd,
163
+                local: env['IONIC_CLI_LOCAL'] ? true : false,
164
+                binPath: env['IONIC_CLI_BIN'],
165
+                libPath: env['IONIC_CLI_LIB'],
166
+            },
167
+            namespace: plugin.namespace,
168
+            plugins: {
169
+                ionic: plugin,
170
+            },
171
+            prompt: yield prompts_1.createPromptModule({ confirm: flags.confirm, interactive: flags.interactive, log, config }),
172
+            project,
173
+            session,
174
+            shell,
175
+            tasks,
176
+            telemetry,
177
+        });
178
+        ienv.open();
179
+        if (levelInvalid) {
180
+            log.warn(`${chalk.green(argv['log-level'])} is an invalid log level--defaulting back to ${chalk.bold(level)}.\n` +
181
+                `You can choose from the following log levels: ${guards_1.LOG_LEVELS.map(l => chalk.bold(l)).join(', ')}.`);
182
+        }
183
+        log.debug(`CLI flags: ${util.inspect(flags, { breakLength: Infinity, colors: chalk.enabled })}`);
184
+        if (typeof argv['yarn'] === 'boolean') {
185
+            log.warn(`${chalk.green('--yarn')} / ${chalk.green('--no-yarn')} switch is deprecated. Use ${chalk.green('ionic config set -g yarn ' + String(argv['yarn']))}.`);
186
+            configData.yarn = argv['yarn'];
187
+        }
188
+        if (!projectDir) {
189
+            const foundDir = yield fs_1.findBaseDirectory(cwd, project_1.PROJECT_FILE_LEGACY);
190
+            if (foundDir) {
191
+                log.warn(`${chalk.bold(project_1.PROJECT_FILE_LEGACY)} file found in ${chalk.bold(foundDir)}--please rename it to ${chalk.bold(project_1.PROJECT_FILE)}, or your project directory will not be detected!`);
192
+            }
193
+        }
194
+        return ienv;
195
+    });
196
+}
197
+exports.generateIonicEnvironment = generateIonicEnvironment;

+ 7
- 0
node_modules/@ionic/cli-utils/lib/app.d.ts View File

@@ -0,0 +1,7 @@
1
+import { AppDetails, IApp, IClient } from '../definitions';
2
+export declare class App implements IApp {
3
+    protected appUserToken: string;
4
+    protected client: IClient;
5
+    constructor(appUserToken: string, client: IClient);
6
+    load(app_id: string): Promise<AppDetails>;
7
+}

+ 24
- 0
node_modules/@ionic/cli-utils/lib/app.js View File

@@ -0,0 +1,24 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const http_1 = require("./http");
5
+const guards_1 = require("../guards");
6
+class App {
7
+    constructor(appUserToken, client) {
8
+        this.appUserToken = appUserToken;
9
+        this.client = client;
10
+    }
11
+    load(app_id) {
12
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+            const req = this.client.make('GET', `/apps/${app_id}`)
14
+                .set('Authorization', `Bearer ${this.appUserToken}`)
15
+                .send({});
16
+            const res = yield this.client.do(req);
17
+            if (!guards_1.isAppResponse(res)) {
18
+                throw http_1.createFatalAPIFormat(req, res);
19
+            }
20
+            return res.data;
21
+        });
22
+    }
23
+}
24
+exports.App = App;

+ 3
- 0
node_modules/@ionic/cli-utils/lib/backends.d.ts View File

@@ -0,0 +1,3 @@
1
+import { BackendFlag } from '../definitions';
2
+export declare const BACKEND_LEGACY: BackendFlag;
3
+export declare const BACKEND_PRO: BackendFlag;

+ 4
- 0
node_modules/@ionic/cli-utils/lib/backends.js View File

@@ -0,0 +1,4 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+exports.BACKEND_LEGACY = 'legacy';
4
+exports.BACKEND_PRO = 'pro';

+ 18
- 0
node_modules/@ionic/cli-utils/lib/command/command.d.ts View File

@@ -0,0 +1,18 @@
1
+import { CommandData, CommandLineInputs, CommandLineOptions, ICommand, IonicEnvironment } from '../../definitions';
2
+import { FatalException } from '../errors';
3
+export declare class Command implements ICommand {
4
+    env: IonicEnvironment;
5
+    metadata: CommandData;
6
+    run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void | number>;
7
+    runwrap(fn: () => Promise<void | number>, opts?: {
8
+        exit0?: boolean;
9
+    }): Promise<void>;
10
+    runcmd(pargv: string[], opts?: {
11
+        showExecution?: boolean;
12
+        showLogs?: boolean;
13
+    }): Promise<void>;
14
+    validate(inputs: CommandLineInputs): Promise<void>;
15
+    execute(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void>;
16
+    exit(msg: string, code?: number): FatalException;
17
+    getCleanInputsForTelemetry(inputs: CommandLineInputs, options: CommandLineOptions): Promise<string[]>;
18
+}

+ 121
- 0
node_modules/@ionic/cli-utils/lib/command/command.js View File

@@ -0,0 +1,121 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../../guards");
6
+const errors_1 = require("../errors");
7
+const validators_1 = require("../validators");
8
+const utils_1 = require("./utils");
9
+class Command {
10
+    run(inputs, options) {
11
+        return tslib_1.__awaiter(this, void 0, void 0, function* () { });
12
+    }
13
+    runwrap(fn, opts = {}) {
14
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+            if (typeof opts.exit0 === 'undefined') {
16
+                opts.exit0 = true;
17
+            }
18
+            const r = yield fn();
19
+            if (typeof r === 'number' && (r > 0 || (r === 0 && opts.exit0))) {
20
+                throw this.exit('', r);
21
+            }
22
+        });
23
+    }
24
+    runcmd(pargv, opts = {}) {
25
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+            yield this.runwrap(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+                yield this.env.runcmd(pargv, opts);
28
+            }), { exit0: false });
29
+        });
30
+    }
31
+    validate(inputs) {
32
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+            utils_1.validateInputs(inputs, this.metadata);
34
+        });
35
+    }
36
+    execute(inputs, options) {
37
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+            const config = yield this.env.config.load();
39
+            yield this.runwrap(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+                if (guards_1.isCommandPreRun(this)) {
41
+                    return this.preRun(inputs, options);
42
+                }
43
+            }));
44
+            if (this.metadata.inputs) {
45
+                for (let input of this.metadata.inputs) {
46
+                    if (!input.validators) {
47
+                        input.validators = [];
48
+                    }
49
+                    if (input.required !== false) {
50
+                        input.validators.unshift(validators_1.validators.required);
51
+                    }
52
+                }
53
+                try {
54
+                    // Validate inputs again, this time with required validator (prompt input
55
+                    // should've happened in preRun)
56
+                    utils_1.validateInputs(inputs, this.metadata);
57
+                }
58
+                catch (e) {
59
+                    if (!this.env.flags.interactive) {
60
+                        this.env.log.warn(`Command ran non-interactively due to ${chalk.green('--no-interactive')} (or CI detected).`);
61
+                    }
62
+                    throw e;
63
+                }
64
+            }
65
+            const runPromise = (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
66
+                yield this.runwrap(() => this.run(inputs, options));
67
+            }))();
68
+            const telemetryPromise = (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
69
+                if (config.telemetry !== false) {
70
+                    let cmdInputs = [];
71
+                    if (this.metadata.name === 'login' || this.metadata.name === 'logout') {
72
+                        yield runPromise;
73
+                    }
74
+                    else if (this.metadata.name === 'help') {
75
+                        cmdInputs = inputs;
76
+                    }
77
+                    else {
78
+                        cmdInputs = yield this.getCleanInputsForTelemetry(inputs, options);
79
+                    }
80
+                    yield this.env.telemetry.sendCommand(`ionic ${this.metadata.fullName}`, cmdInputs);
81
+                }
82
+            }))();
83
+            yield Promise.all([runPromise, telemetryPromise]);
84
+        });
85
+    }
86
+    exit(msg, code = 1) {
87
+        return new errors_1.FatalException(msg, code);
88
+    }
89
+    getCleanInputsForTelemetry(inputs, options) {
90
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
+            const initialOptions = { _: [] };
92
+            const filteredInputs = inputs.filter((input, i) => !this.metadata.inputs || (this.metadata.inputs[i] && !this.metadata.inputs[i].private));
93
+            const filteredOptions = Object.keys(options)
94
+                .filter(optionName => {
95
+                const metadataOption = this.metadata.options && this.metadata.options.find((o) => {
96
+                    return o.name === optionName || (typeof o.aliases !== 'undefined' && o.aliases.includes(optionName));
97
+                });
98
+                if (metadataOption && metadataOption.aliases && metadataOption.aliases.includes(optionName)) {
99
+                    return false; // exclude aliases
100
+                }
101
+                if (!metadataOption) {
102
+                    return true; // include unknown options
103
+                }
104
+                if (metadataOption.private) {
105
+                    return false; // exclude private options
106
+                }
107
+                if (typeof metadataOption.default !== 'undefined' && metadataOption.default === options[optionName]) {
108
+                    return false; // exclude options that match their default value (means it wasn't supplied by user)
109
+                }
110
+                return true;
111
+            })
112
+                .reduce((allOptions, optionName) => {
113
+                allOptions[optionName] = options[optionName];
114
+                return allOptions;
115
+            }, initialOptions);
116
+            const optionInputs = utils_1.minimistOptionsToArray(filteredOptions, { useDoubleQuotes: true });
117
+            return filteredInputs.concat(optionInputs);
118
+        });
119
+    }
120
+}
121
+exports.Command = Command;

+ 2
- 0
node_modules/@ionic/cli-utils/lib/command/index.d.ts View File

@@ -0,0 +1,2 @@
1
+import { CommandData } from '../../definitions';
2
+export declare function CommandMetadata(metadata: CommandData): (target: Function) => void;

+ 8
- 0
node_modules/@ionic/cli-utils/lib/command/index.js View File

@@ -0,0 +1,8 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+function CommandMetadata(metadata) {
4
+    return function (target) {
5
+        target.prototype.metadata = metadata;
6
+    };
7
+}
8
+exports.CommandMetadata = CommandMetadata;

+ 24
- 0
node_modules/@ionic/cli-utils/lib/command/namespace.d.ts View File

@@ -0,0 +1,24 @@
1
+import { CommandData, CommandMapGetter, ICommand, INamespace, NamespaceMapGetter } from '../../definitions';
2
+export declare class CommandMap extends Map<string, string | CommandMapGetter> {
3
+    getAliases(): Map<string, string[]>;
4
+    resolveAliases(cmdName: string): undefined | CommandMapGetter;
5
+}
6
+export declare class NamespaceMap extends Map<string, NamespaceMapGetter> {
7
+}
8
+export declare class Namespace implements INamespace {
9
+    root: boolean;
10
+    name: string;
11
+    namespaces: NamespaceMap;
12
+    commands: CommandMap;
13
+    source: string;
14
+    /**
15
+     * Recursively inspect inputs supplied to walk down all the tree of
16
+     * namespaces available to find the command that we will execute or the
17
+     * right-most namespace matched if the command is not found.
18
+     */
19
+    locate(argv: string[]): [number, string[], ICommand | INamespace];
20
+    /**
21
+     * Get all command metadata in a flat structure.
22
+     */
23
+    getCommandMetadataList(): CommandData[];
24
+}

+ 95
- 0
node_modules/@ionic/cli-utils/lib/command/namespace.js View File

@@ -0,0 +1,95 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const string_1 = require("../utils/string");
4
+class CommandMap extends Map {
5
+    getAliases() {
6
+        const cmdAliases = new Map();
7
+        const cmdMapContents = Array.from(this.entries());
8
+        const aliasToCmd = cmdMapContents.filter((value) => typeof value[1] === 'string'); // TODO: typescript bug?
9
+        aliasToCmd.forEach(([alias, cmd]) => {
10
+            const aliases = cmdAliases.get(cmd) || [];
11
+            aliases.push(alias);
12
+            cmdAliases.set(cmd, aliases);
13
+        });
14
+        return cmdAliases;
15
+    }
16
+    resolveAliases(cmdName) {
17
+        const r = this.get(cmdName);
18
+        if (typeof r !== 'string') {
19
+            return r;
20
+        }
21
+        return this.resolveAliases(r);
22
+    }
23
+}
24
+exports.CommandMap = CommandMap;
25
+class NamespaceMap extends Map {
26
+}
27
+exports.NamespaceMap = NamespaceMap;
28
+class Namespace {
29
+    constructor() {
30
+        this.root = false;
31
+        this.name = '';
32
+        this.namespaces = new NamespaceMap();
33
+        this.commands = new CommandMap();
34
+        this.source = '';
35
+    }
36
+    /**
37
+     * Recursively inspect inputs supplied to walk down all the tree of
38
+     * namespaces available to find the command that we will execute or the
39
+     * right-most namespace matched if the command is not found.
40
+     */
41
+    locate(argv) {
42
+        function _locate(depth, inputs, ns, namespaceDepthList) {
43
+            const nsgetter = ns.namespaces.get(inputs[0]);
44
+            if (!nsgetter) {
45
+                const commands = ns.commands;
46
+                const cmdgetter = commands.resolveAliases(inputs[0]);
47
+                if (cmdgetter) {
48
+                    const cmd = cmdgetter();
49
+                    cmd.metadata.source = ns.source;
50
+                    cmd.metadata.fullName = [...namespaceDepthList.slice(1), cmd.metadata.name].join(' ');
51
+                    return [depth + 1, inputs.slice(1), cmd];
52
+                }
53
+                return [depth, inputs, ns];
54
+            }
55
+            const newNamespace = nsgetter();
56
+            return _locate(depth + 1, inputs.slice(1), newNamespace, [...namespaceDepthList, newNamespace.name]);
57
+        }
58
+        return _locate(0, argv, this, [this.name]);
59
+    }
60
+    /**
61
+     * Get all command metadata in a flat structure.
62
+     */
63
+    getCommandMetadataList() {
64
+        function _getCommandMetadataList(namespace, namespaceDepthList) {
65
+            const commandList = [];
66
+            const aliases = namespace.commands.getAliases();
67
+            // Gather all commands for a namespace and turn them into simple key value
68
+            // objects. Also keep a record of the namespace path.
69
+            namespace.commands.forEach((cmdgetter) => {
70
+                if (typeof cmdgetter === 'string') {
71
+                    return;
72
+                }
73
+                const cmd = cmdgetter();
74
+                cmd.metadata.source = namespace.source;
75
+                cmd.metadata.fullName = [...namespaceDepthList.slice(1), cmd.metadata.name].join(' ');
76
+                cmd.metadata.aliases = aliases.get(cmd.metadata.name) || [];
77
+                commandList.push(cmd.metadata);
78
+            });
79
+            commandList.sort((a, b) => string_1.strcmp(a.name, b.name));
80
+            let namespacedCommandList = [];
81
+            // If this namespace has children then get their commands
82
+            if (namespace.namespaces.size > 0) {
83
+                namespace.namespaces.forEach((nsgetter) => {
84
+                    const ns = nsgetter();
85
+                    const cmds = _getCommandMetadataList(ns, [...namespaceDepthList, ns.name]);
86
+                    namespacedCommandList = namespacedCommandList.concat(cmds);
87
+                });
88
+            }
89
+            namespacedCommandList.sort((a, b) => string_1.strcmp(a.fullName, b.fullName));
90
+            return commandList.concat(namespacedCommandList);
91
+        }
92
+        return _getCommandMetadataList(this, [this.name]);
93
+    }
94
+}
95
+exports.Namespace = Namespace;

+ 10
- 0
node_modules/@ionic/cli-utils/lib/command/utils.d.ts View File

@@ -0,0 +1,10 @@
1
+import * as dargsType from 'dargs';
2
+import * as minimistType from 'minimist';
3
+import { CommandData, CommandLineOptions } from '../../definitions';
4
+export interface MinimistOptionsToArrayOptions extends dargsType.Opts {
5
+    useDoubleQuotes?: boolean;
6
+}
7
+export declare function minimistOptionsToArray(options: CommandLineOptions, fnOptions?: MinimistOptionsToArrayOptions): string[];
8
+export declare function metadataToMinimistOptions(metadata: CommandData): minimistType.Opts;
9
+export declare function validateInputs(argv: string[], metadata: CommandData): void;
10
+export declare function filterOptionsByIntent(metadata: CommandData, options: CommandLineOptions, intentName?: string): CommandLineOptions;

+ 103
- 0
node_modules/@ionic/cli-utils/lib/command/utils.js View File

@@ -0,0 +1,103 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const validators_1 = require("../validators");
4
+const modules_1 = require("../modules");
5
+const typeDefaults = new Map()
6
+    .set(String, null)
7
+    .set(Boolean, false);
8
+function minimistOptionsToArray(options, fnOptions = {}) {
9
+    const dargs = modules_1.load('dargs');
10
+    if (typeof fnOptions.ignoreFalse === 'undefined') {
11
+        fnOptions.ignoreFalse = true;
12
+    }
13
+    if (fnOptions.useDoubleQuotes) {
14
+        fnOptions.useEquals = true;
15
+    }
16
+    let results = dargs(options, fnOptions);
17
+    results.splice(results.length - options._.length); // take out arguments
18
+    if (fnOptions.useDoubleQuotes) {
19
+        results = results.map(r => r.replace(/^(\-\-[A-Za-z0-9-]+)=(.+\s+.+)$/, '$1="$2"'));
20
+    }
21
+    return results;
22
+}
23
+exports.minimistOptionsToArray = minimistOptionsToArray;
24
+/**
25
+ * Takes a Minimist command option and normalizes its values.
26
+ */
27
+function normalizeOption(option) {
28
+    if (!option.type) {
29
+        option.type = String;
30
+    }
31
+    if (!option.default) {
32
+        option.default = typeDefaults.get(option.type);
33
+    }
34
+    if (!option.aliases) {
35
+        option.aliases = [];
36
+    }
37
+    return option;
38
+}
39
+function metadataToMinimistOptions(metadata) {
40
+    let options = {
41
+        string: ['_'],
42
+        boolean: [],
43
+        alias: {},
44
+        default: {}
45
+    };
46
+    if (!metadata.options) {
47
+        return { boolean: true, string: '_' };
48
+    }
49
+    for (let option of metadata.options.map(o => normalizeOption(o))) {
50
+        if (option.type === String) {
51
+            options.string.push(option.name);
52
+        }
53
+        else if (option.type === Boolean) {
54
+            options.boolean.push(option.name);
55
+        }
56
+        options.default[option.name] = option.default;
57
+        options.alias[option.name] = option.aliases;
58
+    }
59
+    return options;
60
+}
61
+exports.metadataToMinimistOptions = metadataToMinimistOptions;
62
+function validateInputs(argv, metadata) {
63
+    if (!metadata.inputs) {
64
+        return;
65
+    }
66
+    const errors = [];
67
+    for (let i in metadata.inputs) {
68
+        const input = metadata.inputs[i];
69
+        if (input.validators && input.validators.length > 0) {
70
+            const vnames = input.validators.map(v => v.name);
71
+            if (vnames.includes('required')) {
72
+                validators_1.validate(argv[i], input.name, [validators_1.validators.required], errors);
73
+            }
74
+            else {
75
+                if (argv[i]) {
76
+                    validators_1.validate(argv[i], input.name, input.validators, errors);
77
+                }
78
+            }
79
+        }
80
+    }
81
+    if (errors.length > 0) {
82
+        throw errors;
83
+    }
84
+}
85
+exports.validateInputs = validateInputs;
86
+function filterOptionsByIntent(metadata, options, intentName) {
87
+    const r = Object.keys(options).reduce((allOptions, optionName) => {
88
+        const metadataOptionFound = (metadata.options || []).find((mdOption) => (mdOption.name === optionName || (mdOption.aliases || []).includes(optionName)));
89
+        if (metadataOptionFound) {
90
+            if (intentName && metadataOptionFound.intent === intentName) {
91
+                allOptions[optionName] = options[optionName];
92
+            }
93
+            else if (!intentName && !metadataOptionFound.intent) {
94
+                allOptions[optionName] = options[optionName];
95
+            }
96
+        }
97
+        return allOptions;
98
+    }, {});
99
+    r._ = options._;
100
+    r['--'] = options['--'];
101
+    return r;
102
+}
103
+exports.filterOptionsByIntent = filterOptionsByIntent;

+ 27
- 0
node_modules/@ionic/cli-utils/lib/config.d.ts View File

@@ -0,0 +1,27 @@
1
+import * as minimistType from 'minimist';
2
+import { ConfigFile, IConfig, IonicEnvironment } from '../definitions';
3
+export declare abstract class BaseConfig<T> implements IConfig<T> {
4
+    fileName: string;
5
+    directory: string;
6
+    filePath: string;
7
+    protected configFile?: T;
8
+    protected originalConfigFile?: {
9
+        [key: string]: any;
10
+    };
11
+    constructor(directory: string, fileName: string);
12
+    abstract provideDefaults(o: {
13
+        [key: string]: any;
14
+    }): Promise<T>;
15
+    abstract is(o: any): o is T;
16
+    load(options?: {
17
+        disk?: boolean;
18
+    }): Promise<T>;
19
+    save(configFile?: T): Promise<void>;
20
+}
21
+export declare const CONFIG_FILE = "config.json";
22
+export declare const CONFIG_DIRECTORY: string;
23
+export declare class Config extends BaseConfig<ConfigFile> {
24
+    provideDefaults(o: any): Promise<ConfigFile>;
25
+    is(j: any): j is ConfigFile;
26
+}
27
+export declare function gatherFlags(argv: minimistType.ParsedArgs): IonicEnvironment['flags'];

+ 185
- 0
node_modules/@ionic/cli-utils/lib/config.js View File

@@ -0,0 +1,185 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const path = require("path");
5
+const os = require("os");
6
+const chalk = require("chalk");
7
+const backends_1 = require("./backends");
8
+const errors_1 = require("./errors");
9
+const format_1 = require("./utils/format");
10
+const fs_1 = require("./utils/fs");
11
+const modules_1 = require("./modules");
12
+class BaseConfig {
13
+    constructor(directory, fileName) {
14
+        this.fileName = fileName;
15
+        // TODO: better way to check if in project
16
+        if (directory) {
17
+            this.directory = path.resolve(directory);
18
+        }
19
+        else {
20
+            this.directory = '';
21
+        }
22
+        this.filePath = path.resolve(this.directory, fileName);
23
+    }
24
+    load(options = {}) {
25
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+            if (options.disk || !this.configFile) {
27
+                let o;
28
+                try {
29
+                    const stats = yield fs_1.fsStat(this.filePath);
30
+                    if (stats.size < 5) {
31
+                        o = {};
32
+                    }
33
+                }
34
+                catch (e) {
35
+                    if (e.code !== 'ENOENT') {
36
+                        throw e;
37
+                    }
38
+                    o = {};
39
+                }
40
+                if (typeof o === 'undefined') {
41
+                    try {
42
+                        o = yield fs_1.fsReadJsonFile(this.filePath);
43
+                    }
44
+                    catch (e) {
45
+                        if (e === fs_1.ERROR_FILE_INVALID_JSON) {
46
+                            throw new errors_1.FatalException(`The config file (${chalk.bold(format_1.prettyPath(this.filePath))}) is not valid JSON format.\n\n` +
47
+                                `Please fix any JSON errors in the file.`);
48
+                        }
49
+                        else {
50
+                            throw e;
51
+                        }
52
+                    }
53
+                }
54
+                const lodash = modules_1.load('lodash');
55
+                this.originalConfigFile = lodash.cloneDeep(o);
56
+                o = yield this.provideDefaults(o);
57
+                if (this.is(o)) {
58
+                    this.configFile = o;
59
+                }
60
+                else {
61
+                    throw new errors_1.FatalException(`The config file (${chalk.bold(format_1.prettyPath(this.filePath))}) has an unrecognized JSON format.\n\n` +
62
+                        `This usually means a key had an unexpected value. Please look through it and fix any issues.\n` +
63
+                        `If all else fails--the CLI will recreate the file if you delete it.`);
64
+                }
65
+            }
66
+            return this.configFile;
67
+        });
68
+    }
69
+    save(configFile) {
70
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
+            if (!configFile) {
72
+                configFile = this.configFile;
73
+            }
74
+            if (configFile) {
75
+                const lodash = modules_1.load('lodash');
76
+                if (!lodash.isEqual(configFile, this.originalConfigFile)) {
77
+                    const dirPath = path.dirname(this.filePath);
78
+                    try {
79
+                        const stats = yield fs_1.fsStat(dirPath);
80
+                        if (!stats.isDirectory()) {
81
+                            throw `${dirPath} must be a directory it is currently a file`;
82
+                        }
83
+                    }
84
+                    catch (e) {
85
+                        if (e.code !== 'ENOENT') {
86
+                            throw e;
87
+                        }
88
+                        yield fs_1.fsMkdirp(dirPath);
89
+                    }
90
+                    yield fs_1.fsWriteJsonFile(this.filePath, configFile, { encoding: 'utf8' });
91
+                    this.configFile = configFile;
92
+                    this.originalConfigFile = lodash.cloneDeep(configFile);
93
+                }
94
+            }
95
+        });
96
+    }
97
+}
98
+exports.BaseConfig = BaseConfig;
99
+exports.CONFIG_FILE = 'config.json';
100
+exports.CONFIG_DIRECTORY = path.resolve(os.homedir(), '.ionic');
101
+class Config extends BaseConfig {
102
+    provideDefaults(o) {
103
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
104
+            const lodash = modules_1.load('lodash');
105
+            const results = lodash.cloneDeep(o);
106
+            if (!results.lastCommand) {
107
+                results.lastCommand = new Date().toISOString();
108
+            }
109
+            if (!results.daemon) {
110
+                results.daemon = {};
111
+            }
112
+            if (!results.urls) {
113
+                results.urls = {};
114
+            }
115
+            if (!results.git) {
116
+                results.git = {};
117
+            }
118
+            if (!results.git.host) {
119
+                results.git.host = 'git.ionicjs.com';
120
+            }
121
+            if (!results.urls.api) {
122
+                results.urls.api = 'https://api.ionic.io';
123
+            }
124
+            if (!results.urls.dash) {
125
+                results.urls.dash = 'https://apps.ionic.io';
126
+            }
127
+            if (!results.user) {
128
+                results.user = {};
129
+            }
130
+            if (!results.tokens) {
131
+                results.tokens = {};
132
+            }
133
+            if (!results.tokens.appUser) {
134
+                results.tokens.appUser = {};
135
+            }
136
+            if (typeof results.backend !== 'string') {
137
+                results.backend = backends_1.BACKEND_LEGACY;
138
+            }
139
+            if (typeof results.telemetry === 'undefined') {
140
+                if (results.cliFlags && typeof results.cliFlags.enableTelemetry !== 'undefined') {
141
+                    results.telemetry = results.cliFlags.enableTelemetry;
142
+                }
143
+                else if (results.cliFlags && typeof results.cliFlags.telemetry !== 'undefined') {
144
+                    results.telemetry = results.cliFlags.telemetry;
145
+                }
146
+                else {
147
+                    results.telemetry = true;
148
+                }
149
+            }
150
+            if (typeof results.yarn === 'undefined') {
151
+                if (results.cliFlags && typeof results.cliFlags.yarn !== 'undefined') {
152
+                    results.yarn = results.cliFlags.yarn;
153
+                }
154
+                else {
155
+                    results.yarn = false;
156
+                }
157
+            }
158
+            delete results.lastUpdated;
159
+            results.cliFlags = {}; // TODO: this is temporary
160
+            return results;
161
+        });
162
+    }
163
+    is(j) {
164
+        return j
165
+            && typeof j.lastCommand === 'string'
166
+            && typeof j.daemon === 'object'
167
+            && typeof j.urls === 'object'
168
+            && typeof j.urls.api === 'string'
169
+            && typeof j.urls.dash === 'string'
170
+            && typeof j.user === 'object'
171
+            && typeof j.tokens === 'object'
172
+            && typeof j.tokens.appUser === 'object'
173
+            && typeof j.backend === 'string'
174
+            && typeof j.telemetry === 'boolean'
175
+            && typeof j.yarn === 'boolean';
176
+    }
177
+}
178
+exports.Config = Config;
179
+function gatherFlags(argv) {
180
+    return {
181
+        interactive: typeof argv['interactive'] === 'undefined' ? true : argv['interactive'],
182
+        confirm: typeof argv['confirm'] === 'undefined' ? false : argv['confirm'],
183
+    };
184
+}
185
+exports.gatherFlags = gatherFlags;

+ 16
- 0
node_modules/@ionic/cli-utils/lib/daemon.d.ts View File

@@ -0,0 +1,16 @@
1
+import { DaemonFile, DistTag, IonicEnvironment } from '../definitions';
2
+import { BaseConfig } from './config';
3
+export declare const DAEMON_PID_FILE = "daemon.pid";
4
+export declare const DAEMON_JSON_FILE = "daemon.json";
5
+export declare const DAEMON_LOG_FILE = "daemon.log";
6
+export declare class Daemon extends BaseConfig<DaemonFile> {
7
+    readonly pidFilePath: string;
8
+    readonly logFilePath: string;
9
+    getPid(): Promise<number | undefined>;
10
+    setPid(pid: number): Promise<void>;
11
+    provideDefaults(o: any): Promise<DaemonFile>;
12
+    populateDistTag(distTag: DistTag): void;
13
+    is(j: any): j is DaemonFile;
14
+}
15
+export declare function processRunning(pid: number): boolean;
16
+export declare function checkForDaemon(env: IonicEnvironment): Promise<number>;

+ 125
- 0
node_modules/@ionic/cli-utils/lib/daemon.js View File

@@ -0,0 +1,125 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const path = require("path");
5
+const chalk = require("chalk");
6
+const config_1 = require("./config");
7
+const fs_1 = require("./utils/fs");
8
+const plugins_1 = require("./plugins");
9
+const modules_1 = require("./modules");
10
+const KNOWN_PACKAGES = [
11
+    ...[].concat(plugins_1.KNOWN_COMMAND_PLUGINS, plugins_1.KNOWN_GLOBAL_PLUGINS, plugins_1.KNOWN_PROJECT_PLUGINS).map(plugins_1.formatFullPluginName),
12
+    '@ionic/cli-utils',
13
+    'ionic',
14
+];
15
+exports.DAEMON_PID_FILE = 'daemon.pid';
16
+exports.DAEMON_JSON_FILE = 'daemon.json';
17
+exports.DAEMON_LOG_FILE = 'daemon.log';
18
+class Daemon extends config_1.BaseConfig {
19
+    get pidFilePath() {
20
+        return path.join(this.directory, exports.DAEMON_PID_FILE);
21
+    }
22
+    get logFilePath() {
23
+        return path.join(this.directory, exports.DAEMON_LOG_FILE);
24
+    }
25
+    getPid() {
26
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+            try {
28
+                const f = yield fs_1.fsReadFile(this.pidFilePath, { encoding: 'utf8' });
29
+                return Number(f);
30
+            }
31
+            catch (e) {
32
+                if (e.code !== 'ENOENT') {
33
+                    throw e;
34
+                }
35
+            }
36
+        });
37
+    }
38
+    setPid(pid) {
39
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+            yield fs_1.fsWriteFile(this.pidFilePath, String(pid), { encoding: 'utf8' });
41
+        });
42
+    }
43
+    provideDefaults(o) {
44
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+            const lodash = modules_1.load('lodash');
46
+            const results = lodash.cloneDeep(o);
47
+            if (!results.daemonVersion) {
48
+                results.daemonVersion = '';
49
+            }
50
+            if (!results.latestVersions) {
51
+                results.latestVersions = {};
52
+            }
53
+            if (!results.latestVersions.latest) {
54
+                results.latestVersions.latest = {};
55
+            }
56
+            for (let pkg of KNOWN_PACKAGES) {
57
+                if (typeof results.latestVersions.latest[pkg] === 'undefined') {
58
+                    results.latestVersions.latest[pkg] = '';
59
+                }
60
+            }
61
+            return results;
62
+        });
63
+    }
64
+    populateDistTag(distTag) {
65
+        if (this.configFile) {
66
+            if (typeof this.configFile.latestVersions[distTag] === 'undefined') {
67
+                this.configFile.latestVersions[distTag] = {};
68
+            }
69
+            for (let pkg of KNOWN_PACKAGES) {
70
+                if (typeof this.configFile.latestVersions[distTag][pkg] === 'undefined') {
71
+                    this.configFile.latestVersions[distTag][pkg] = '';
72
+                }
73
+            }
74
+        }
75
+    }
76
+    is(j) {
77
+        return j
78
+            && typeof j.latestVersions === 'object'
79
+            && typeof j.latestVersions.latest === 'object';
80
+    }
81
+}
82
+exports.Daemon = Daemon;
83
+function processRunning(pid) {
84
+    try {
85
+        const r = process.kill(pid, 0);
86
+        if (typeof r === 'boolean') {
87
+            return r;
88
+        }
89
+        return true;
90
+    }
91
+    catch (e) {
92
+        return e.code === 'EPERM';
93
+    }
94
+}
95
+exports.processRunning = processRunning;
96
+function checkForDaemon(env) {
97
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
98
+        const config = yield env.config.load();
99
+        if (!config.daemon.updates) {
100
+            return 0;
101
+        }
102
+        const f = yield env.daemon.getPid();
103
+        if (f && processRunning(f)) {
104
+            env.log.debug(() => `Daemon found (pid: ${chalk.bold(String(f))})`);
105
+            return f;
106
+        }
107
+        const crossSpawn = modules_1.load('cross-spawn');
108
+        const fd = yield fs_1.fsOpen(env.daemon.logFilePath, 'a');
109
+        const crossSpawnOptions = {
110
+            cwd: env.config.directory,
111
+            stdio: ['ignore', fd, fd],
112
+        };
113
+        // TODO: should cross-spawn figure this stuff out? https://github.com/IndigoUnited/node-cross-spawn/issues/77
114
+        if (process.platform === 'win32') {
115
+            crossSpawnOptions.shell = true;
116
+            crossSpawnOptions.detached = false;
117
+        }
118
+        const crossSpawnArgs = [crossSpawnOptions.shell ? `"${env.meta.binPath}"` : env.meta.binPath, 'daemon', '--verbose', '--no-interactive', '--log-timestamps'];
119
+        const p = crossSpawn.spawn(crossSpawnOptions.shell ? `"${process.execPath}"` : process.execPath, crossSpawnArgs, crossSpawnOptions);
120
+        p.unref();
121
+        env.log.debug(`New daemon pid: ${chalk.bold(String(p.pid))}`);
122
+        return p.pid;
123
+    });
124
+}
125
+exports.checkForDaemon = checkForDaemon;

+ 18
- 0
node_modules/@ionic/cli-utils/lib/deploy.d.ts View File

@@ -0,0 +1,18 @@
1
+/// <reference types="node" />
2
+import { Deploy, DeployChannel, DeploySnapshot, DeploySnapshotRequest, IClient } from '../definitions';
3
+export declare class DeployClient {
4
+    protected appUserToken: string;
5
+    protected client: IClient;
6
+    constructor(appUserToken: string, client: IClient);
7
+    getChannel(uuidOrTag: string): Promise<DeployChannel>;
8
+    deploy(snapshot: string, channel: string): Promise<Deploy>;
9
+    getSnapshot(uuid: string, {fields}: {
10
+        fields?: string[];
11
+    }): Promise<DeploySnapshot>;
12
+    requestSnapshotUpload(options?: {
13
+        legacy_duplication?: string;
14
+        note?: string;
15
+        user_metadata?: Object;
16
+    }): Promise<DeploySnapshotRequest>;
17
+    uploadSnapshot(snapshot: DeploySnapshotRequest, zip: NodeJS.ReadableStream, progress?: (loaded: number, total: number) => void): Promise<void>;
18
+}

+ 78
- 0
node_modules/@ionic/cli-utils/lib/deploy.js View File

@@ -0,0 +1,78 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const guards_1 = require("../guards");
5
+const http_1 = require("./http");
6
+const aws_1 = require("./utils/aws");
7
+class DeployClient {
8
+    constructor(appUserToken, client) {
9
+        this.appUserToken = appUserToken;
10
+        this.client = client;
11
+    }
12
+    getChannel(uuidOrTag) {
13
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+            const req = this.client.make('GET', `/deploy/channels/${uuidOrTag}`)
15
+                .set('Authorization', `Bearer ${this.appUserToken}`)
16
+                .send();
17
+            const res = yield this.client.do(req);
18
+            if (!guards_1.isDeployChannelResponse(res)) {
19
+                throw http_1.createFatalAPIFormat(req, res);
20
+            }
21
+            return res.data;
22
+        });
23
+    }
24
+    deploy(snapshot, channel) {
25
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+            const req = this.client.make('POST', '/deploy/deploys')
27
+                .set('Authorization', `Bearer ${this.appUserToken}`)
28
+                .send({ snapshot, channel });
29
+            const res = yield this.client.do(req);
30
+            if (!guards_1.isDeployResponse(res)) {
31
+                throw http_1.createFatalAPIFormat(req, res);
32
+            }
33
+            return res.data;
34
+        });
35
+    }
36
+    getSnapshot(uuid, { fields = [] }) {
37
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+            if (fields.indexOf('url') === -1) {
39
+                fields.push('url');
40
+            }
41
+            const req = this.client.make('GET', `/deploy/snapshots/${uuid}`)
42
+                .set('Authorization', `Bearer ${this.appUserToken}`)
43
+                .query({ fields })
44
+                .send();
45
+            const res = yield this.client.do(req);
46
+            if (!guards_1.isDeploySnapshotResponse(res)) {
47
+                throw http_1.createFatalAPIFormat(req, res);
48
+            }
49
+            return res.data;
50
+        });
51
+    }
52
+    requestSnapshotUpload(options = {}) {
53
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
54
+            options.legacy_duplication = '1';
55
+            const req = this.client.make('POST', '/deploy/snapshots')
56
+                .set('Authorization', `Bearer ${this.appUserToken}`)
57
+                .send(options);
58
+            const res = yield this.client.do(req);
59
+            if (!guards_1.isDeploySnapshotRequestResponse(res)) {
60
+                throw http_1.createFatalAPIFormat(req, res);
61
+            }
62
+            // TODO: Remove updateMetaDataReq when POST -> deploy/snapshots accepts user_metadata
63
+            if (options.user_metadata) {
64
+                const updateMetaDataReq = this.client.make('PATCH', `/deploy/snapshots/${res.data.uuid}`)
65
+                    .set('Authorization', `Bearer ${this.appUserToken}`)
66
+                    .send({
67
+                    'user_metadata': options.user_metadata
68
+                });
69
+                yield this.client.do(updateMetaDataReq);
70
+            }
71
+            return res.data;
72
+        });
73
+    }
74
+    uploadSnapshot(snapshot, zip, progress) {
75
+        return aws_1.s3SignedUpload(snapshot.presigned_post, zip, { progress });
76
+    }
77
+}
78
+exports.DeployClient = DeployClient;

+ 47
- 0
node_modules/@ionic/cli-utils/lib/environment.d.ts View File

@@ -0,0 +1,47 @@
1
+import * as inquirerType from 'inquirer';
2
+import { ConfigFile, ICLIEventEmitter, IClient, IConfig, IDaemon, IHookEngine, ILogger, IProject, IRootNamespace, ISession, IShell, ITaskChain, ITelemetry, IonicEnvironment, IonicEnvironmentFlags, IonicEnvironmentMeta, IonicEnvironmentPlugins, PromptModule } from '../definitions';
3
+export declare class Environment implements IonicEnvironment {
4
+    readonly flags: IonicEnvironmentFlags;
5
+    readonly hooks: IHookEngine;
6
+    readonly client: IClient;
7
+    readonly config: IConfig<ConfigFile>;
8
+    readonly daemon: IDaemon;
9
+    readonly events: ICLIEventEmitter;
10
+    readonly log: ILogger;
11
+    readonly prompt: PromptModule;
12
+    readonly meta: IonicEnvironmentMeta;
13
+    project: IProject;
14
+    readonly plugins: IonicEnvironmentPlugins;
15
+    session: ISession;
16
+    readonly shell: IShell;
17
+    readonly tasks: ITaskChain;
18
+    readonly telemetry: ITelemetry;
19
+    readonly namespace: IRootNamespace;
20
+    private bottomBar?;
21
+    constructor({bottomBar, client, config, daemon, events, flags, hooks, log, meta, namespace, plugins, project, prompt, session, shell, tasks, telemetry}: {
22
+        bottomBar?: inquirerType.ui.BottomBar;
23
+        client: IClient;
24
+        config: IConfig<ConfigFile>;
25
+        daemon: IDaemon;
26
+        events: ICLIEventEmitter;
27
+        flags: IonicEnvironmentFlags;
28
+        hooks: IHookEngine;
29
+        log: ILogger;
30
+        meta: IonicEnvironmentMeta;
31
+        namespace: IRootNamespace;
32
+        plugins: IonicEnvironmentPlugins;
33
+        project: IProject;
34
+        prompt: PromptModule;
35
+        session: ISession;
36
+        shell: IShell;
37
+        tasks: ITaskChain;
38
+        telemetry: ITelemetry;
39
+    });
40
+    load(p: any): any;
41
+    open(): Promise<void>;
42
+    close(): Promise<void>;
43
+    runcmd(pargv: string[], opts?: {
44
+        showExecution?: boolean;
45
+        showLogs?: boolean;
46
+    }): Promise<void>;
47
+}

+ 85
- 0
node_modules/@ionic/cli-utils/lib/environment.js View File

@@ -0,0 +1,85 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const modules_1 = require("./modules");
6
+class Environment {
7
+    constructor({ bottomBar, client, config, daemon, events, flags, hooks, log, meta, namespace, plugins, project, prompt, session, shell, tasks, telemetry, }) {
8
+        this.bottomBar = bottomBar;
9
+        this.client = client;
10
+        this.config = config;
11
+        this.daemon = daemon;
12
+        this.events = events;
13
+        this.flags = flags;
14
+        this.hooks = hooks;
15
+        this.log = log;
16
+        this.meta = meta;
17
+        this.namespace = namespace;
18
+        this.plugins = plugins;
19
+        this.project = project;
20
+        this.prompt = prompt;
21
+        this.session = session;
22
+        this.shell = shell;
23
+        this.tasks = tasks;
24
+        this.telemetry = telemetry;
25
+    }
26
+    load(p) {
27
+        return modules_1.load(p);
28
+    }
29
+    open() {
30
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
+            if (this.flags.interactive) {
32
+                if (!this.bottomBar) {
33
+                    const inquirer = require('inquirer');
34
+                    this.bottomBar = new inquirer.ui.BottomBar();
35
+                }
36
+                try {
37
+                    // the mute() call appears to be necessary, otherwise when answering
38
+                    // inquirer prompts upon pressing enter, a copy of the prompt is
39
+                    // printed to the screen and looks gross
40
+                    const bottomBarHack = this.bottomBar;
41
+                    bottomBarHack.rl.output.mute();
42
+                }
43
+                catch (e) {
44
+                    console.error('EXCEPTION DURING BOTTOMBAR OUTPUT MUTE', e);
45
+                }
46
+            }
47
+            this.log.stream = typeof this.bottomBar === 'undefined' ? process.stdout : this.bottomBar.log;
48
+        });
49
+    }
50
+    close() {
51
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+            this.tasks.cleanup();
53
+            // instantiating inquirer.ui.BottomBar hangs, so when close() is called,
54
+            // we close BottomBar streams and replace the log stream with stdout.
55
+            // This means inquirer shouldn't be used after command execution finishes
56
+            // (which could happen during long-running processes like serve).
57
+            if (this.bottomBar) {
58
+                this.bottomBar.close();
59
+                this.bottomBar = undefined;
60
+                this.log.stream = process.stdout;
61
+            }
62
+        });
63
+    }
64
+    runcmd(pargv, opts = {}) {
65
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
+            const logstream = this.log.stream;
67
+            if (typeof opts.showExecution === 'undefined') {
68
+                opts.showExecution = true;
69
+            }
70
+            if (typeof opts.showLogs === 'undefined') {
71
+                opts.showLogs = true;
72
+            }
73
+            if (!opts.showLogs) {
74
+                const DevNull = require('dev-null'); // TODO
75
+                this.log.stream = new DevNull();
76
+            }
77
+            if (opts.showExecution) {
78
+                this.log.msg(`> ${chalk.green([this.namespace.name, ...pargv].map(a => a.includes(' ') ? `"${a}"` : a).join(' '))}`);
79
+            }
80
+            yield this.namespace.runCommand(this, pargv);
81
+            this.log.stream = logstream;
82
+        });
83
+    }
84
+}
85
+exports.Environment = Environment;

+ 18
- 0
node_modules/@ionic/cli-utils/lib/errors.d.ts View File

@@ -0,0 +1,18 @@
1
+export declare class Exception extends Error {
2
+    message: string;
3
+    name: string;
4
+    stack: string;
5
+    constructor(message: string);
6
+    toString(): string;
7
+}
8
+export declare class FatalException extends Exception {
9
+    message: string;
10
+    exitCode: number;
11
+    fatal: boolean;
12
+    constructor(message: string, exitCode?: number);
13
+}
14
+export declare class ShellException extends Exception {
15
+    message: string;
16
+    exitCode: number;
17
+    constructor(message: string, exitCode?: number);
18
+}

+ 31
- 0
node_modules/@ionic/cli-utils/lib/errors.js View File

@@ -0,0 +1,31 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+class Exception extends Error {
4
+    constructor(message) {
5
+        super(message);
6
+        this.name = 'Exception';
7
+        this.message = message;
8
+        this.stack = (new Error()).stack || '';
9
+    }
10
+    toString() {
11
+        return `${this.name}: ${this.message}`;
12
+    }
13
+}
14
+exports.Exception = Exception;
15
+class FatalException extends Exception {
16
+    constructor(message, exitCode = 1) {
17
+        super(message);
18
+        this.message = message;
19
+        this.exitCode = exitCode;
20
+        this.fatal = true;
21
+    }
22
+}
23
+exports.FatalException = FatalException;
24
+class ShellException extends Exception {
25
+    constructor(message, exitCode = 0) {
26
+        super(message);
27
+        this.message = message;
28
+        this.exitCode = exitCode;
29
+    }
30
+}
31
+exports.ShellException = ShellException;

+ 5
- 0
node_modules/@ionic/cli-utils/lib/events.d.ts View File

@@ -0,0 +1,5 @@
1
+/// <reference types="node" />
2
+import { EventEmitter } from 'events';
3
+import { ICLIEventEmitter } from '../definitions';
4
+export declare class CLIEventEmitter extends EventEmitter implements ICLIEventEmitter {
5
+}

+ 6
- 0
node_modules/@ionic/cli-utils/lib/events.js View File

@@ -0,0 +1,6 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const events_1 = require("events");
4
+class CLIEventEmitter extends events_1.EventEmitter {
5
+}
6
+exports.CLIEventEmitter = CLIEventEmitter;

+ 2
- 0
node_modules/@ionic/cli-utils/lib/help.d.ts View File

@@ -0,0 +1,2 @@
1
+import { IonicEnvironment } from '../definitions';
2
+export declare function showHelp(env: IonicEnvironment, inputs: string[]): Promise<void | number>;

+ 227
- 0
node_modules/@ionic/cli-utils/lib/help.js View File

@@ -0,0 +1,227 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const stringWidth = require("string-width");
6
+const guards_1 = require("../guards");
7
+const backends_1 = require("./backends");
8
+const format_1 = require("./utils/format");
9
+const HELP_DOTS_WIDTH = 25;
10
+function showHelp(env, inputs) {
11
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+        let code = 0;
13
+        // If there are no inputs then show global command details.
14
+        if (inputs.length === 0) {
15
+            return env.log.msg(yield getFormattedHelpDetails(env, env.namespace, inputs));
16
+        }
17
+        const [, slicedInputs, cmdOrNamespace] = env.namespace.locate(inputs);
18
+        if (!guards_1.isCommand(cmdOrNamespace)) {
19
+            let extra = '';
20
+            if (!env.project.directory) {
21
+                extra = '\nYou may need to be in an Ionic project directory.';
22
+            }
23
+            if (slicedInputs.length > 0) {
24
+                env.log.error(`Unable to find command: ${chalk.green(inputs.join(' '))}${extra}\n`);
25
+                code = 1;
26
+            }
27
+        }
28
+        env.log.msg(yield formatHelp(env, cmdOrNamespace, inputs));
29
+        return code;
30
+    });
31
+}
32
+exports.showHelp = showHelp;
33
+function formatHelp(env, cmdOrNamespace, inputs) {
34
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+        // If the command is located on the global namespace then show its help
36
+        if (!guards_1.isCommand(cmdOrNamespace)) {
37
+            return getFormattedHelpDetails(env, cmdOrNamespace, inputs);
38
+        }
39
+        const command = cmdOrNamespace;
40
+        return formatCommandHelp(env, command.metadata);
41
+    });
42
+}
43
+function getFormattedHelpDetails(env, ns, inputs) {
44
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+        const globalMetadata = ns.getCommandMetadataList();
46
+        const formatList = (details) => details.map(hd => `    ${hd}\n`).join('');
47
+        if (ns.root) {
48
+            const globalCommandDetails = yield getHelpDetails(env, globalMetadata, [cmd => cmd.type === 'global']);
49
+            const projectCommandDetails = yield getHelpDetails(env, globalMetadata, [cmd => cmd.type === 'project']);
50
+            return `${yield formatHeader(env)}\n\n` +
51
+                `  ${chalk.bold('Usage')}:\n\n` +
52
+                `${yield formatUsage(env)}\n` +
53
+                `  ${chalk.bold('Global Commands')}:\n\n` +
54
+                `${formatList(globalCommandDetails)}\n` +
55
+                `  ${chalk.bold('Project Commands')}:\n\n` +
56
+                `${env.project.directory ? formatList(projectCommandDetails) : '    You are not in a project directory.\n'}\n`;
57
+        }
58
+        else {
59
+            const commandDetails = yield getHelpDetails(env, globalMetadata, []);
60
+            return `\n  ${chalk.bold('Commands')}:\n\n` +
61
+                `${formatList(commandDetails)}\n`;
62
+        }
63
+    });
64
+}
65
+function formatUsage(env) {
66
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
+        const options = ['--help', '--verbose', '--quiet', '--no-interactive', '--confirm'];
68
+        const usageLines = [
69
+            `<command> ${chalk.dim('[<args>]')} ${options.map(opt => chalk.dim('[' + opt + ']')).join(' ')} ${chalk.dim('[options]')}`,
70
+        ];
71
+        return usageLines.map(u => `    ${chalk.dim('$')} ${chalk.green('ionic ' + u)}`).join('\n') + '\n';
72
+    });
73
+}
74
+function formatHeader(env) {
75
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
+        const config = yield env.config.load();
77
+        const isLoggedIn = yield env.session.isLoggedIn();
78
+        return `   _             _
79
+  (_)           (_)
80
+   _  ___  _ __  _  ___
81
+  | |/ _ \\| '_ \\| |/ __|
82
+  | | (_) | | | | | (__
83
+  |_|\\___/|_| |_|_|\\___|  CLI ${config.backend === backends_1.BACKEND_PRO && isLoggedIn ? chalk.blue('PRO') + ' ' : ''}${env.plugins.ionic.version}\n`;
84
+    });
85
+}
86
+function getHelpDetails(env, commandMetadataList, filters = []) {
87
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
88
+        const config = yield env.config.load();
89
+        for (let f of filters) {
90
+            commandMetadataList = commandMetadataList.filter(f);
91
+        }
92
+        const foundCommandList = commandMetadataList.filter((cmd) => cmd.visible !== false && (!cmd.backends || cmd.backends.includes(config.backend)));
93
+        return getListOfCommandDetails(foundCommandList);
94
+    });
95
+}
96
+function formatCommandHelp(env, cmdMetadata) {
97
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
98
+        if (!cmdMetadata.fullName) {
99
+            cmdMetadata.fullName = cmdMetadata.name;
100
+        }
101
+        const displayCmd = 'ionic ' + cmdMetadata.fullName;
102
+        const wrappedDescription = format_1.wordWrap(cmdMetadata.description, { indentation: displayCmd.length + 5 });
103
+        return `
104
+  ${chalk.bold(chalk.green(displayCmd) + ' - ' + wrappedDescription)}${formatLongDescription(cmdMetadata.longDescription)}
105
+  ` +
106
+            (yield formatCommandUsage(env, cmdMetadata)) +
107
+            (yield formatCommandInputs(env, cmdMetadata.inputs)) +
108
+            (yield formatCommandOptions(env, cmdMetadata.options)) +
109
+            (yield formatCommandExamples(env, cmdMetadata.exampleCommands, cmdMetadata.fullName));
110
+    });
111
+}
112
+function getListOfCommandDetails(cmdMetadataList) {
113
+    const fillStringArray = format_1.generateFillSpaceStringList(cmdMetadataList.map(cmdMd => cmdMd.fullName || cmdMd.name), HELP_DOTS_WIDTH, chalk.dim('.'));
114
+    return cmdMetadataList.map((cmdMd, index) => {
115
+        const description = cmdMd.description + `${cmdMd.aliases && cmdMd.aliases.length > 0 ? chalk.dim(' (alias' + (cmdMd.aliases.length === 1 ? '' : 'es') + ': ') + cmdMd.aliases.map((a) => chalk.green(a)).join(', ') + chalk.dim(')') : ''}`;
116
+        const wrappedDescription = format_1.wordWrap(description, { indentation: HELP_DOTS_WIDTH + 6 });
117
+        return `${chalk.green(cmdMd.fullName || '')} ${fillStringArray[index]} ${wrappedDescription}`;
118
+    });
119
+}
120
+function formatCommandUsage(env, cmdMetadata) {
121
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
122
+        const formatInput = (input) => {
123
+            if (!env.flags.interactive && input.required !== false) {
124
+                return '<' + input.name + '>';
125
+            }
126
+            return '[<' + input.name + '>]';
127
+        };
128
+        const options = yield filterOptionsForHelp(env, cmdMetadata.options);
129
+        const usageLine = `${chalk.dim('$')} ${chalk.green('ionic ' + cmdMetadata.name + (typeof cmdMetadata.inputs === 'undefined' ? '' : ' ' + cmdMetadata.inputs.map(formatInput).join(' ')))} ${options.length > 0 ? chalk.green('[options]') : ''}`;
130
+        return `
131
+  ${chalk.bold('Usage')}:
132
+
133
+    ${usageLine}
134
+  `;
135
+    });
136
+}
137
+function formatLongDescription(longDescription) {
138
+    if (!longDescription) {
139
+        return '';
140
+    }
141
+    longDescription = longDescription.trim();
142
+    longDescription = format_1.wordWrap(longDescription, { indentation: 4 });
143
+    return '\n\n    ' + longDescription;
144
+}
145
+function formatCommandInputs(env, inputs = []) {
146
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
147
+        if (inputs.length === 0) {
148
+            return '';
149
+        }
150
+        const fillStrings = format_1.generateFillSpaceStringList(inputs.map(input => input.name), HELP_DOTS_WIDTH, chalk.dim('.'));
151
+        function inputLineFn({ name, description }, index) {
152
+            const optionList = chalk.green(`${name}`);
153
+            const wrappedDescription = format_1.wordWrap(description, { indentation: HELP_DOTS_WIDTH + 6 });
154
+            return `${optionList} ${fillStrings[index]} ${wrappedDescription}`;
155
+        }
156
+        return `
157
+  ${chalk.bold('Inputs')}:
158
+
159
+    ${inputs.map(inputLineFn).join(`
160
+    `)}
161
+  `;
162
+    });
163
+}
164
+function formatOptionDefault(opt) {
165
+    if (typeof opt.default === 'string') {
166
+        return chalk.dim(' (default: ') + chalk.green(opt.default) + chalk.dim(')');
167
+    }
168
+    else {
169
+        return '';
170
+    }
171
+}
172
+function formatOptionLine(opt) {
173
+    const showInverse = opt.type === Boolean && opt.default === true && opt.name.length > 1;
174
+    const optionList = (showInverse ? chalk.green(`--no-${opt.name}`) : chalk.green(`-${opt.name.length > 1 ? '-' : ''}${opt.name}`)) +
175
+        (!showInverse && opt.aliases && opt.aliases.length > 0 ? ', ' +
176
+            opt.aliases
177
+                .map((alias) => chalk.green(`-${alias}`))
178
+                .join(', ') : '');
179
+    const optionListLength = stringWidth(optionList);
180
+    const fullLength = optionListLength > HELP_DOTS_WIDTH ? optionListLength + 1 : HELP_DOTS_WIDTH;
181
+    const wrappedDescription = format_1.wordWrap(opt.description + formatOptionDefault(opt), { indentation: HELP_DOTS_WIDTH + 6 });
182
+    return `${optionList} ${Array(fullLength - optionListLength).fill(chalk.dim('.')).join('')} ${wrappedDescription}`;
183
+}
184
+function filterOptionsForHelp(env, options = []) {
185
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
186
+        const config = yield env.config.load();
187
+        return options.filter(opt => opt.visible !== false && (!opt.backends || opt.backends.includes(config.backend)));
188
+    });
189
+}
190
+function formatCommandOptions(env, options = []) {
191
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
192
+        options = yield filterOptionsForHelp(env, options);
193
+        if (options.length === 0) {
194
+            return '';
195
+        }
196
+        return `
197
+  ${chalk.bold('Options')}:
198
+
199
+    ${options.map(formatOptionLine).join(`
200
+    `)}
201
+  `;
202
+    });
203
+}
204
+function formatCommandExamples(env, exampleCommands, commandName) {
205
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
206
+        if (!Array.isArray(exampleCommands)) {
207
+            return '';
208
+        }
209
+        const exampleLines = exampleCommands.map(cmd => {
210
+            const sepIndex = cmd.indexOf(' -- ');
211
+            if (sepIndex === -1) {
212
+                cmd = chalk.green(cmd);
213
+            }
214
+            else {
215
+                cmd = chalk.green(cmd.substring(0, sepIndex)) + cmd.substring(sepIndex);
216
+            }
217
+            const wrappedCmd = format_1.wordWrap(cmd, { indentation: 12, append: ' \\' });
218
+            return `${chalk.dim('$')} ${chalk.green('ionic ' + commandName)} ${wrappedCmd}`;
219
+        });
220
+        return `
221
+  ${chalk.bold('Examples')}:
222
+
223
+    ${exampleLines.join(`
224
+    `)}
225
+  `;
226
+    });
227
+}

+ 17
- 0
node_modules/@ionic/cli-utils/lib/hooks.d.ts View File

@@ -0,0 +1,17 @@
1
+import { IHook, IHookEngine } from '../definitions';
2
+export declare class Hook<T, U> implements IHook<T, U> {
3
+    source: string;
4
+    name: string;
5
+    protected callable: (args: T) => Promise<U>;
6
+    constructor(source: string, name: string, callable: (args: T) => Promise<U>);
7
+    fire(args: T): Promise<U>;
8
+}
9
+export declare class HookEngine implements IHookEngine {
10
+    private hooks;
11
+    register<T, U>(source: string, hook: string, listener: (args: T) => Promise<U>): void;
12
+    fire<T, U>(hook: string, args: T): Promise<U[]>;
13
+    getSources(hook: string): string[];
14
+    hasSources(hook: string, sources: string[]): boolean;
15
+    deleteSource(source: string): void;
16
+    getRegistered<T, U>(hook: string): IHook<T, U>[];
17
+}

+ 49
- 0
node_modules/@ionic/cli-utils/lib/hooks.js View File

@@ -0,0 +1,49 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+class Hook {
5
+    constructor(source, name, callable) {
6
+        this.source = source;
7
+        this.name = name;
8
+        this.callable = callable;
9
+    }
10
+    fire(args) {
11
+        return this.callable(args);
12
+    }
13
+}
14
+exports.Hook = Hook;
15
+class HookEngine {
16
+    constructor() {
17
+        this.hooks = new Map();
18
+    }
19
+    register(source, hook, listener) {
20
+        const h = new Hook(source, hook, listener);
21
+        this.getRegistered(hook).push(h);
22
+    }
23
+    fire(hook, args) {
24
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+            const registeredHooks = this.hooks.get(hook) || [];
26
+            return Promise.all(registeredHooks.map((h) => h.fire(args)));
27
+        });
28
+    }
29
+    getSources(hook) {
30
+        return [...new Set(this.getRegistered(hook).map(h => h.source))];
31
+    }
32
+    hasSources(hook, sources) {
33
+        return sources.filter(s => this.getSources(hook).includes(s)).length > 0;
34
+    }
35
+    deleteSource(source) {
36
+        for (let [hookName, hooks] of this.hooks.entries()) {
37
+            this.hooks.set(hookName, hooks.filter((h) => h.source !== source));
38
+        }
39
+    }
40
+    getRegistered(hook) {
41
+        let registeredHooks = this.hooks.get(hook);
42
+        if (!registeredHooks) {
43
+            registeredHooks = [];
44
+            this.hooks.set(hook, registeredHooks);
45
+        }
46
+        return registeredHooks;
47
+    }
48
+}
49
+exports.HookEngine = HookEngine;

+ 30
- 0
node_modules/@ionic/cli-utils/lib/http.d.ts View File

@@ -0,0 +1,30 @@
1
+import * as superagentType from 'superagent';
2
+import { APIResponse, APIResponseError, APIResponseSuccess, HttpMethod, IClient, IPaginator, Response, SuperAgentError } from '../definitions';
3
+import { FatalException } from './errors';
4
+export declare const ERROR_UNKNOWN_CONTENT_TYPE = "UNKNOWN_CONTENT_TYPE";
5
+export declare const ERROR_UNKNOWN_RESPONSE_FORMAT = "UNKNOWN_RESPONSE_FORMAT";
6
+export declare function getGlobalProxy(): [string, string] | [undefined, undefined];
7
+export declare function createRequest(method: string, url: string): superagentType.SuperAgentRequest;
8
+export declare class Client implements IClient {
9
+    host: string;
10
+    constructor(host: string);
11
+    make(method: HttpMethod, path: string): superagentType.SuperAgentRequest;
12
+    do(req: superagentType.SuperAgentRequest): Promise<APIResponseSuccess>;
13
+    paginate<T extends Response<Object[]>>(reqgen: () => superagentType.SuperAgentRequest, guard: (res: APIResponseSuccess) => res is T): Paginator<T>;
14
+}
15
+export declare class Paginator<T extends Response<Object[]>> implements IPaginator<T> {
16
+    protected client: IClient;
17
+    protected reqgen: () => superagentType.SuperAgentRequest;
18
+    protected guard: (res: APIResponseSuccess) => res is T;
19
+    protected previousReq?: superagentType.SuperAgentRequest;
20
+    protected done: boolean;
21
+    constructor(client: IClient, reqgen: () => superagentType.SuperAgentRequest, guard: (res: APIResponseSuccess) => res is T);
22
+    next(): IteratorResult<Promise<T>>;
23
+    [Symbol.iterator](): this;
24
+}
25
+export declare function transformAPIResponse(r: superagentType.Response): APIResponse;
26
+export declare function createFatalAPIFormat(req: superagentType.SuperAgentRequest, res: APIResponse): FatalException;
27
+export declare function formatSuperAgentError(e: SuperAgentError): string;
28
+export declare function formatAPIResponse(req: superagentType.SuperAgentRequest, r: APIResponse): string;
29
+export declare function formatAPISuccess(req: superagentType.SuperAgentRequest, r: APIResponseSuccess): string;
30
+export declare function formatAPIError(req: superagentType.SuperAgentRequest, r: APIResponseError): string;

+ 155
- 0
node_modules/@ionic/cli-utils/lib/http.js View File

@@ -0,0 +1,155 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const util = require("util");
5
+const chalk = require("chalk");
6
+const guards_1 = require("../guards");
7
+const modules_1 = require("./modules");
8
+const errors_1 = require("./errors");
9
+const FORMAT_ERROR_BODY_MAX_LENGTH = 1000;
10
+const CONTENT_TYPE_JSON = 'application/json';
11
+exports.ERROR_UNKNOWN_CONTENT_TYPE = 'UNKNOWN_CONTENT_TYPE';
12
+exports.ERROR_UNKNOWN_RESPONSE_FORMAT = 'UNKNOWN_RESPONSE_FORMAT';
13
+function getGlobalProxy() {
14
+    const envvars = ['IONIC_HTTP_PROXY', 'HTTPS_PROXY', 'HTTP_PROXY', 'PROXY', 'https_proxy', 'http_proxy', 'proxy'];
15
+    for (let envvar of envvars) {
16
+        if (process.env[envvar]) {
17
+            return [process.env[envvar], envvar];
18
+        }
19
+    }
20
+    return [undefined, undefined];
21
+}
22
+exports.getGlobalProxy = getGlobalProxy;
23
+function createRequest(method, url) {
24
+    const [proxy,] = getGlobalProxy();
25
+    const superagent = modules_1.load('superagent');
26
+    let req = superagent(method, url);
27
+    if (proxy && req.proxy) {
28
+        req = req.proxy(proxy);
29
+    }
30
+    return req;
31
+}
32
+exports.createRequest = createRequest;
33
+class Client {
34
+    constructor(host) {
35
+        this.host = host;
36
+    }
37
+    make(method, path) {
38
+        return createRequest(method, `${this.host}${path}`)
39
+            .set('Content-Type', CONTENT_TYPE_JSON)
40
+            .set('Accept', CONTENT_TYPE_JSON);
41
+    }
42
+    do(req) {
43
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
+            const res = yield req;
45
+            const r = transformAPIResponse(res);
46
+            if (guards_1.isAPIResponseError(r)) {
47
+                throw new errors_1.FatalException('API request was successful, but the response output format was that of an error.\n'
48
+                    + formatAPIError(req, r));
49
+            }
50
+            return r;
51
+        });
52
+    }
53
+    paginate(reqgen, guard) {
54
+        return new Paginator(this, reqgen, guard);
55
+    }
56
+}
57
+exports.Client = Client;
58
+class Paginator {
59
+    constructor(client, reqgen, guard) {
60
+        this.client = client;
61
+        this.reqgen = reqgen;
62
+        this.guard = guard;
63
+        this.done = false;
64
+    }
65
+    next() {
66
+        if (this.done) {
67
+            return { done: true }; // TODO: why can't I exclude value?
68
+        }
69
+        return {
70
+            done: false,
71
+            value: (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+                const req = this.reqgen();
73
+                if (!this.previousReq) {
74
+                    this.previousReq = req;
75
+                }
76
+                const page = this.previousReq.qs.page && !isNaN(Number(this.previousReq.qs.page)) ? this.previousReq.qs.page + 1 : 1;
77
+                const pageSize = this.previousReq.qs.page_size && !isNaN(Number(this.previousReq.qs.page_size)) ? this.previousReq.qs.page_size : 25;
78
+                req.query({ page, 'page_size': pageSize });
79
+                const res = yield this.client.do(req);
80
+                if (!this.guard(res)) {
81
+                    throw createFatalAPIFormat(req, res);
82
+                }
83
+                if (res.data.length === 0 || res.data.length < pageSize) {
84
+                    this.done = true;
85
+                }
86
+                this.previousReq = req;
87
+                return res;
88
+            }))(),
89
+        };
90
+    }
91
+    [Symbol.iterator]() {
92
+        return this;
93
+    }
94
+}
95
+exports.Paginator = Paginator;
96
+function transformAPIResponse(r) {
97
+    if (r.status === 204) {
98
+        r.body = { data: null, meta: { status: 204, version: '', request_id: '' } };
99
+    }
100
+    if (r.status !== 204 && r.type !== CONTENT_TYPE_JSON) {
101
+        throw exports.ERROR_UNKNOWN_CONTENT_TYPE;
102
+    }
103
+    let j = r.body;
104
+    if (!j.meta) {
105
+        throw exports.ERROR_UNKNOWN_RESPONSE_FORMAT;
106
+    }
107
+    return j;
108
+}
109
+exports.transformAPIResponse = transformAPIResponse;
110
+function createFatalAPIFormat(req, res) {
111
+    return new errors_1.FatalException('API request was successful, but the response format was unrecognized.\n'
112
+        + formatAPIResponse(req, res));
113
+}
114
+exports.createFatalAPIFormat = createFatalAPIFormat;
115
+function formatSuperAgentError(e) {
116
+    const res = e.response;
117
+    const req = res.request;
118
+    const statusCode = e.response.status;
119
+    let f = '';
120
+    try {
121
+        const r = transformAPIResponse(res);
122
+        f += formatAPIResponse(req, r);
123
+    }
124
+    catch (e) {
125
+        f += `HTTP Error ${statusCode}: ${req.method.toUpperCase()} ${req.url}\n`;
126
+        // TODO: do this only if verbose?
127
+        f += '\n' + res.text ? res.text.substring(0, FORMAT_ERROR_BODY_MAX_LENGTH) : '<no buffered body>';
128
+        if (res.text && res.text.length > FORMAT_ERROR_BODY_MAX_LENGTH) {
129
+            f += ` ...\n\n[ truncated ${res.text.length - FORMAT_ERROR_BODY_MAX_LENGTH} characters ]`;
130
+        }
131
+    }
132
+    return chalk.bold(chalk.red(f));
133
+}
134
+exports.formatSuperAgentError = formatSuperAgentError;
135
+function formatAPIResponse(req, r) {
136
+    if (guards_1.isAPIResponseSuccess(r)) {
137
+        return formatAPISuccess(req, r);
138
+    }
139
+    else {
140
+        return formatAPIError(req, r);
141
+    }
142
+}
143
+exports.formatAPIResponse = formatAPIResponse;
144
+function formatAPISuccess(req, r) {
145
+    return `Request: ${req.method} ${req.url}\n`
146
+        + `Response: ${r.meta.status}\n`
147
+        + `Body: \n${util.inspect(r.data, { colors: chalk.enabled })}`;
148
+}
149
+exports.formatAPISuccess = formatAPISuccess;
150
+function formatAPIError(req, r) {
151
+    return `Request: ${req.method} ${req.url}\n`
152
+        + `Response: ${r.meta.status}\n`
153
+        + `Body: \n${util.inspect(r.error, { colors: chalk.enabled })}`;
154
+}
155
+exports.formatAPIError = formatAPIError;

+ 2
- 0
node_modules/@ionic/cli-utils/lib/login.d.ts View File

@@ -0,0 +1,2 @@
1
+import { IonicEnvironment } from '../definitions';
2
+export declare function promptToLogin(env: IonicEnvironment): Promise<void>;

+ 23
- 0
node_modules/@ionic/cli-utils/lib/login.js View File

@@ -0,0 +1,23 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const validators_1 = require("./validators");
6
+function promptToLogin(env) {
7
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+        env.log.msg(`Log into your Ionic account\nIf you don't have one yet, create yours by running: ${chalk.green(`ionic signup`)}\n`);
9
+        const email = yield env.prompt({
10
+            type: 'input',
11
+            name: 'email',
12
+            message: 'Email:',
13
+            validate: v => validators_1.validators.email(v),
14
+        });
15
+        const password = yield env.prompt({
16
+            type: 'password',
17
+            name: 'password',
18
+            message: 'Password:'
19
+        });
20
+        yield env.session.login(email, password);
21
+    });
22
+}
23
+exports.promptToLogin = promptToLogin;

+ 23
- 0
node_modules/@ionic/cli-utils/lib/modules.d.ts View File

@@ -0,0 +1,23 @@
1
+/// <reference types="node" />
2
+import * as LeekType from 'leek';
3
+import * as archiverType from 'archiver';
4
+import * as crossSpawnType from 'cross-spawn';
5
+import * as dargsType from 'dargs';
6
+import * as lodashType from 'lodash';
7
+import * as semverType from 'semver';
8
+import * as sliceAnsiType from 'slice-ansi';
9
+import * as stripAnsiType from 'strip-ansi';
10
+import * as superagentType from 'superagent';
11
+import * as uuidType from 'uuid';
12
+import * as wrapAnsiType from 'wrap-ansi';
13
+export declare function load(modulePath: 'archiver'): typeof archiverType;
14
+export declare function load(modulePath: 'cross-spawn'): typeof crossSpawnType;
15
+export declare function load(modulePath: 'dargs'): typeof dargsType;
16
+export declare function load(modulePath: 'leek'): typeof LeekType;
17
+export declare function load(modulePath: 'lodash'): typeof lodashType;
18
+export declare function load(modulePath: 'semver'): typeof semverType;
19
+export declare function load(modulePath: 'slice-ansi'): typeof sliceAnsiType;
20
+export declare function load(modulePath: 'strip-ansi'): typeof stripAnsiType;
21
+export declare function load(modulePath: 'superagent'): typeof superagentType;
22
+export declare function load(modulePath: 'uuid'): typeof uuidType;
23
+export declare function load(modulePath: 'wrap-ansi'): typeof wrapAnsiType;

+ 6
- 0
node_modules/@ionic/cli-utils/lib/modules.js View File

@@ -0,0 +1,6 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+function load(modulePath) {
4
+    return require(modulePath);
5
+}
6
+exports.load = load;

+ 34
- 0
node_modules/@ionic/cli-utils/lib/package.d.ts View File

@@ -0,0 +1,34 @@
1
+/// <reference types="node" />
2
+import { IClient, PackageBuild, PackageProjectRequest } from '../definitions';
3
+export declare class PackageClient {
4
+    protected appUserToken: string;
5
+    protected client: IClient;
6
+    constructor(appUserToken: string, client: IClient);
7
+    getBuild(id: number, {fields}: {
8
+        fields?: string[];
9
+    }): Promise<PackageBuild>;
10
+    getBuilds({page, pageSize}: {
11
+        page?: number;
12
+        pageSize?: number;
13
+    }): Promise<PackageBuild[]>;
14
+    queueBuild({platform, mode, zipUrl, projectId, profileTag}: {
15
+        platform: PackageBuild['platform'];
16
+        mode: PackageBuild['mode'];
17
+        zipUrl: string;
18
+        projectId: number;
19
+        profileTag?: string;
20
+    }): Promise<PackageBuild>;
21
+    requestProjectUpload(): Promise<PackageProjectRequest>;
22
+    uploadProject(project: PackageProjectRequest, zip: NodeJS.ReadableStream, {progress}: {
23
+        progress?: (loaded: number, total: number) => void;
24
+    }): Promise<void>;
25
+    downloadBuild(build: PackageBuild, dest: NodeJS.WritableStream, {progress}: {
26
+        progress?: (loaded: number, total: number) => void;
27
+    }): Promise<void>;
28
+    colorStatus(s: PackageBuild['status']): string;
29
+    formatFilename(build: PackageBuild): string;
30
+    formatPlatform(p: PackageBuild['platform'] | string): string;
31
+    formatBuildValues(build: PackageBuild): {
32
+        [P in keyof PackageBuild]?: string;
33
+    };
34
+}

+ 142
- 0
node_modules/@ionic/cli-utils/lib/package.js View File

@@ -0,0 +1,142 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../guards");
6
+const http_1 = require("./http");
7
+const aws_1 = require("./utils/aws");
8
+class PackageClient {
9
+    constructor(appUserToken, client) {
10
+        this.appUserToken = appUserToken;
11
+        this.client = client;
12
+    }
13
+    getBuild(id, { fields = [] }) {
14
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+            if (fields.indexOf('url') === -1) {
16
+                fields.push('url');
17
+            }
18
+            const req = this.client.make('GET', `/package/builds/${id}`)
19
+                .set('Authorization', `Bearer ${this.appUserToken}`)
20
+                .query({ fields })
21
+                .send();
22
+            const res = yield this.client.do(req);
23
+            if (!guards_1.isPackageBuildResponse(res)) {
24
+                throw http_1.createFatalAPIFormat(req, res);
25
+            }
26
+            return res.data;
27
+        });
28
+    }
29
+    getBuilds({ page = 1, pageSize = 25 }) {
30
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
+            const req = this.client.make('GET', '/package/builds')
32
+                .set('Authorization', `Bearer ${this.appUserToken}`)
33
+                .query({ page, 'page_size': pageSize, })
34
+                .send();
35
+            const res = yield this.client.do(req);
36
+            if (!guards_1.isPackageBuildsResponse(res)) {
37
+                throw http_1.createFatalAPIFormat(req, res);
38
+            }
39
+            return res.data;
40
+        });
41
+    }
42
+    queueBuild({ platform, mode, zipUrl, projectId, profileTag }) {
43
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
+            const req = this.client.make('POST', '/package/builds')
45
+                .set('Authorization', `Bearer ${this.appUserToken}`)
46
+                .send({
47
+                platform,
48
+                build_mode: mode,
49
+                zip_url: zipUrl,
50
+                project_id: projectId,
51
+                security_profile_tag: profileTag,
52
+            });
53
+            const res = yield this.client.do(req);
54
+            if (!guards_1.isPackageBuildResponse(res)) {
55
+                throw http_1.createFatalAPIFormat(req, res);
56
+            }
57
+            return res.data;
58
+        });
59
+    }
60
+    requestProjectUpload() {
61
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+            const req = this.client.make('POST', '/package/projects')
63
+                .set('Authorization', `Bearer ${this.appUserToken}`)
64
+                .send({});
65
+            const res = yield this.client.do(req);
66
+            if (!guards_1.isPackageProjectRequestResponse(res)) {
67
+                throw http_1.createFatalAPIFormat(req, res);
68
+            }
69
+            return res.data;
70
+        });
71
+    }
72
+    uploadProject(project, zip, { progress }) {
73
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
74
+            return aws_1.s3SignedUpload(project.presigned_post, zip, { progress });
75
+        });
76
+    }
77
+    downloadBuild(build, dest, { progress }) {
78
+        return new Promise((resolve, reject) => {
79
+            if (build.status !== 'SUCCESS') {
80
+                return reject(new Error(`Build must be 'SUCCESS', not '${build.status}'.`));
81
+            }
82
+            if (!build.url) {
83
+                return reject(new Error('Build must have URL.'));
84
+            }
85
+            dest.on('error', (err) => {
86
+                reject(err);
87
+            });
88
+            dest.on('close', () => {
89
+                resolve();
90
+            });
91
+            http_1.createRequest('get', build.url)
92
+                .on('response', (res) => {
93
+                if (progress) {
94
+                    let loaded = 0;
95
+                    const total = Number(res.headers['content-length']);
96
+                    res.on('data', (chunk) => {
97
+                        loaded += chunk.length;
98
+                        progress(loaded, total);
99
+                    });
100
+                }
101
+            })
102
+                .on('error', (err) => {
103
+                reject(err);
104
+            })
105
+                .pipe(dest);
106
+        });
107
+    }
108
+    colorStatus(s) {
109
+        switch (s) {
110
+            case 'SUCCESS':
111
+                return chalk.green(s);
112
+            case 'FAILED':
113
+                return chalk.red(s);
114
+        }
115
+        return s;
116
+    }
117
+    formatFilename(build) {
118
+        const extension = build.platform === 'android' ? 'apk' : 'ipa';
119
+        return `${build.name}.${extension}`;
120
+    }
121
+    formatPlatform(p) {
122
+        switch (p) {
123
+            case 'ios':
124
+                return 'iOS';
125
+            case 'android':
126
+                return 'Android';
127
+        }
128
+        return p;
129
+    }
130
+    formatBuildValues(build) {
131
+        return {
132
+            id: String(build.id),
133
+            status: this.colorStatus(build.status),
134
+            platform: this.formatPlatform(build.platform),
135
+            mode: build.mode,
136
+            security_profile_tag: build.security_profile_tag || '',
137
+            created: new Date(build.created).toISOString(),
138
+            completed: build.completed ? new Date(build.completed).toISOString() : '',
139
+        };
140
+    }
141
+}
142
+exports.PackageClient = PackageClient;

+ 34
- 0
node_modules/@ionic/cli-utils/lib/plugins.d.ts View File

@@ -0,0 +1,34 @@
1
+import { DistTag, IonicEnvironment, Plugin } from '../definitions';
2
+import { PkgManagerOptions } from './utils/npm';
3
+export declare const KNOWN_COMMAND_PLUGINS: string[];
4
+export declare const KNOWN_GLOBAL_PLUGINS: string[];
5
+export declare const KNOWN_PROJECT_PLUGINS: string[];
6
+export declare const ORG_PREFIX = "@ionic";
7
+export declare const PLUGIN_PREFIX = "cli-plugin-";
8
+export declare const ERROR_PLUGIN_NOT_INSTALLED = "PLUGIN_NOT_INSTALLED";
9
+export declare const ERROR_PLUGIN_NOT_FOUND = "PLUGIN_NOT_FOUND";
10
+export declare const ERROR_PLUGIN_INVALID = "PLUGIN_INVALID";
11
+export declare function formatFullPluginName(name: string): string;
12
+export declare function promptToInstallProjectPlugin(env: IonicEnvironment, {message}: {
13
+    message?: string;
14
+}): Promise<Plugin | undefined>;
15
+export declare function promptToInstallPlugin(env: IonicEnvironment, pluginName: string, {message, global, reinstall}: {
16
+    message?: string;
17
+    global?: boolean;
18
+    reinstall?: boolean;
19
+}): Promise<Plugin | undefined>;
20
+export declare function registerPlugin(env: IonicEnvironment, plugin: Plugin): void;
21
+export declare function unregisterPlugin(env: IonicEnvironment, plugin: Plugin): void;
22
+export declare function loadPlugins(env: IonicEnvironment): Promise<void>;
23
+export declare function validatePlugins(env: IonicEnvironment): void;
24
+export interface LoadPluginOptions {
25
+    message?: string;
26
+    askToInstall?: boolean;
27
+    reinstall?: boolean;
28
+    global?: boolean;
29
+}
30
+export declare function loadPlugin(env: IonicEnvironment, pluginName: string, {message, askToInstall, reinstall, global}: LoadPluginOptions): Promise<Plugin>;
31
+export declare function pluginHasUpdate(currentVersion: string, latestVersion: string): Promise<boolean>;
32
+export declare function checkForUpdates(env: IonicEnvironment): Promise<string[]>;
33
+export declare function pkgInstallPluginArgs(env: IonicEnvironment, name: string, options?: PkgManagerOptions): Promise<string[]>;
34
+export declare function determineDistTag(version: string): DistTag;

+ 445
- 0
node_modules/@ionic/cli-utils/lib/plugins.js View File

@@ -0,0 +1,445 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const fs = require("fs");
5
+const path = require("path");
6
+const chalk = require("chalk");
7
+const guards_1 = require("../guards");
8
+const errors_1 = require("./errors");
9
+const format_1 = require("./utils/format");
10
+const fs_1 = require("./utils/fs");
11
+const http_1 = require("./http");
12
+const npm_1 = require("./utils/npm");
13
+exports.KNOWN_COMMAND_PLUGINS = ['cordova'];
14
+exports.KNOWN_GLOBAL_PLUGINS = ['proxy'];
15
+exports.KNOWN_PROJECT_PLUGINS = ['ionic1', 'ionic-angular'];
16
+exports.ORG_PREFIX = '@ionic';
17
+exports.PLUGIN_PREFIX = 'cli-plugin-';
18
+exports.ERROR_PLUGIN_NOT_INSTALLED = 'PLUGIN_NOT_INSTALLED';
19
+exports.ERROR_PLUGIN_NOT_FOUND = 'PLUGIN_NOT_FOUND';
20
+exports.ERROR_PLUGIN_INVALID = 'PLUGIN_INVALID';
21
+function formatFullPluginName(name) {
22
+    return `${exports.ORG_PREFIX}/${exports.PLUGIN_PREFIX}${name}`;
23
+}
24
+exports.formatFullPluginName = formatFullPluginName;
25
+function promptToInstallProjectPlugin(env, { message }) {
26
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+        const project = yield env.project.load();
28
+        const projectPlugin = formatFullPluginName(project.type);
29
+        if (!message) {
30
+            message = `Looks like this is an ${env.project.formatType(project.type)} project, would you like to install ${chalk.green(projectPlugin)} and continue?`;
31
+        }
32
+        return yield promptToInstallPlugin(env, projectPlugin, { message });
33
+    });
34
+}
35
+exports.promptToInstallProjectPlugin = promptToInstallProjectPlugin;
36
+function promptToInstallPlugin(env, pluginName, { message, global = false, reinstall = false }) {
37
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+        if (!global && !env.project.directory) {
39
+            return;
40
+        }
41
+        try {
42
+            return yield loadPlugin(env, pluginName, {
43
+                askToInstall: true,
44
+                global,
45
+                reinstall,
46
+                message,
47
+            });
48
+        }
49
+        catch (e) {
50
+            if (e !== exports.ERROR_PLUGIN_NOT_INSTALLED) {
51
+                throw e;
52
+            }
53
+        }
54
+    });
55
+}
56
+exports.promptToInstallPlugin = promptToInstallPlugin;
57
+function registerPlugin(env, plugin) {
58
+    const ns = plugin.namespace;
59
+    if (ns) {
60
+        env.namespace.namespaces.set(ns.name, () => ns);
61
+    }
62
+    if (plugin.registerHooks) {
63
+        plugin.registerHooks(env.hooks);
64
+    }
65
+    env.plugins[plugin.name] = plugin;
66
+}
67
+exports.registerPlugin = registerPlugin;
68
+function unregisterPlugin(env, plugin) {
69
+    if (plugin.namespace) {
70
+        env.namespace.namespaces.delete(plugin.namespace.name);
71
+    }
72
+    env.hooks.deleteSource(plugin.name);
73
+    delete env.plugins[plugin.name];
74
+}
75
+exports.unregisterPlugin = unregisterPlugin;
76
+function loadPlugins(env) {
77
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
+        // GLOBAL PLUGINS
79
+        const global = !env.meta || !env.meta.local;
80
+        const globalPluginPkgs = exports.KNOWN_GLOBAL_PLUGINS.map(formatFullPluginName);
81
+        const globalPluginPromises = globalPluginPkgs.map((pkgName) => tslib_1.__awaiter(this, void 0, void 0, function* () {
82
+            try {
83
+                return yield loadPlugin(env, pkgName, { askToInstall: false, global });
84
+            }
85
+            catch (e) {
86
+                if (e !== exports.ERROR_PLUGIN_NOT_INSTALLED) {
87
+                    throw e;
88
+                }
89
+            }
90
+        }));
91
+        for (let p of globalPluginPromises) {
92
+            const plugin = yield p;
93
+            if (plugin) {
94
+                registerPlugin(env, plugin);
95
+            }
96
+        }
97
+        const [, proxyVar] = http_1.getGlobalProxy();
98
+        if (!env.project.directory) {
99
+            return;
100
+        }
101
+        const project = yield env.project.load();
102
+        // LOCAL PLUGINS
103
+        const ionicModulePath = path.join(env.project.directory, 'node_modules', 'ionic');
104
+        const gulpFilePath = path.join(env.project.directory, project.gulpFile || 'gulpfile.js');
105
+        const mPath = path.join(env.project.directory, 'node_modules', '@ionic');
106
+        const [ionicModuleExists, gulpFileExists, ionicModules] = yield Promise.all([
107
+            fs_1.pathExists(ionicModulePath),
108
+            fs_1.pathExists(gulpFilePath),
109
+            fs_1.readDir(mPath),
110
+        ]);
111
+        if (!ionicModuleExists) {
112
+            // TODO: remove "starting with 3.6"
113
+            env.log.warn(chalk.yellow(chalk.bold('No local CLI detected.\n') +
114
+                'Starting with CLI 3.6, the CLI must be installed locally to use local CLI plugins.\n'));
115
+            const p = yield promptToInstallPlugin(env, 'ionic', {
116
+                message: 'Install now?',
117
+            });
118
+            if (p) {
119
+                env.log.ok('Installed Ionic CLI locally!');
120
+                env.log.nl();
121
+                throw new errors_1.FatalException(`${chalk.bold('Please re-run your command.')}`, 0);
122
+            }
123
+            else {
124
+                env.log.warn('Not loading local CLI plugins in global mode. CLI functionality may be limited.');
125
+                return;
126
+            }
127
+        }
128
+        if (proxyVar) {
129
+            const proxyPluginPkg = formatFullPluginName('proxy');
130
+            env.log.debug(() => `Detected ${chalk.green(proxyVar)} in environment`);
131
+            if (!(proxyPluginPkg in env.plugins)) {
132
+                const meta = env.plugins.ionic.meta;
133
+                if (!meta) {
134
+                    throw new errors_1.FatalException(`${chalk.green('ionic')} missing meta information`);
135
+                }
136
+                const canInstall = yield fs_1.pathAccessible(meta.filePath, fs.constants.W_OK);
137
+                const proxyInstallArgs = yield npm_1.pkgManagerArgs(env, { pkg: proxyPluginPkg, global });
138
+                const installMsg = `Detected ${chalk.green(proxyVar)} in environment, but to proxy CLI requests, you'll need ${chalk.green(proxyPluginPkg)} installed.`;
139
+                if (canInstall) {
140
+                    const p = yield promptToInstallPlugin(env, proxyPluginPkg, {
141
+                        message: `${installMsg} Install now?`,
142
+                        reinstall: true,
143
+                        global,
144
+                    });
145
+                    if (p) {
146
+                        registerPlugin(env, p);
147
+                    }
148
+                }
149
+                else {
150
+                    env.log.warn(`${installMsg}\nYou can install it manually:\n\n${chalk.green(proxyInstallArgs.join(' '))}\n`);
151
+                }
152
+            }
153
+        }
154
+        const plugins = [];
155
+        const pluginPkgs = ionicModules
156
+            .filter(pkgName => pkgName.indexOf(exports.PLUGIN_PREFIX) === 0)
157
+            .map(pkgName => `${exports.ORG_PREFIX}/${pkgName}`)
158
+            .filter(pkgName => !exports.KNOWN_GLOBAL_PLUGINS.map(formatFullPluginName).includes(pkgName)); // already loaded these in global section above
159
+        const gulpPluginPkg = formatFullPluginName('gulp');
160
+        if (gulpFileExists) {
161
+            env.log.debug(() => `Detected ${chalk.green(format_1.prettyPath(gulpFilePath))} in project directory`);
162
+            if (!pluginPkgs.includes(gulpPluginPkg)) {
163
+                const installMsg = `Detected ${chalk.green(format_1.prettyPath(gulpFilePath))} in project directory, but to integrate gulp with the CLI, you'll need to install ${chalk.green(gulpPluginPkg)}.`;
164
+                const p = yield promptToInstallPlugin(env, gulpPluginPkg, {
165
+                    message: `${installMsg} Install now?`,
166
+                    reinstall: true,
167
+                });
168
+                if (p) {
169
+                    plugins.push(p);
170
+                }
171
+            }
172
+        }
173
+        const pluginPromises = pluginPkgs.map(pkgName => {
174
+            return loadPlugin(env, pkgName, { askToInstall: false });
175
+        });
176
+        for (let p of pluginPromises) {
177
+            const plugin = yield p;
178
+            plugins.push(plugin);
179
+        }
180
+        // TODO: remember the responses of the requests below
181
+        const projectPlugin = formatFullPluginName(project.type);
182
+        if (!pluginPkgs.includes(projectPlugin)) {
183
+            const plugin = yield promptToInstallProjectPlugin(env, {});
184
+            if (plugin) {
185
+                plugins.push(plugin);
186
+            }
187
+        }
188
+        for (let plugin of plugins) {
189
+            registerPlugin(env, plugin);
190
+        }
191
+        validatePlugins(env);
192
+    });
193
+}
194
+exports.loadPlugins = loadPlugins;
195
+function validatePlugins(env) {
196
+    const projectPlugins = new Set(exports.KNOWN_PROJECT_PLUGINS.map(formatFullPluginName));
197
+    const installedPlugins = new Set(Object.keys(env.plugins));
198
+    const installedProjectPlugins = new Set([...projectPlugins].filter(p => installedPlugins.has(p)));
199
+    if (installedProjectPlugins.size === 0) {
200
+        env.log.warn('You have no CLI project plugins installed. CLI functionality may be limited.');
201
+    }
202
+    else if (installedProjectPlugins.size > 1) {
203
+        env.log.warn(`You have multiple CLI project plugins installed (${[...installedProjectPlugins].map(p => chalk.green(p)).join(', ')}). ${chalk.bold('Please make sure you have only one installed.')}`);
204
+    }
205
+}
206
+exports.validatePlugins = validatePlugins;
207
+function loadPlugin(env, pluginName, { message, askToInstall = true, reinstall = false, global = false }) {
208
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
209
+        const mPath = global ? pluginName : path.join(env.project.directory, 'node_modules', ...pluginName.split('/'));
210
+        let mResolvedPath;
211
+        let m;
212
+        if (!message) {
213
+            message = `The plugin ${chalk.green(pluginName)} is not installed. Would you like to install it and continue?`;
214
+        }
215
+        env.log.debug(() => `Loading ${global ? 'global' : 'local'} plugin ${chalk.green(pluginName)}`);
216
+        try {
217
+            mResolvedPath = require.resolve(mPath);
218
+            delete require.cache[mResolvedPath];
219
+            m = require(mResolvedPath);
220
+        }
221
+        catch (e) {
222
+            if (e.code !== 'MODULE_NOT_FOUND') {
223
+                throw e;
224
+            }
225
+            if (!askToInstall) {
226
+                env.log.debug(() => `Throwing ${chalk.red(exports.ERROR_PLUGIN_NOT_INSTALLED)} for ${global ? 'global' : 'local'} ${chalk.green(pluginName)}`);
227
+                throw exports.ERROR_PLUGIN_NOT_INSTALLED;
228
+            }
229
+        }
230
+        if (!m || reinstall) {
231
+            const confirm = yield env.prompt({
232
+                type: 'confirm',
233
+                name: 'confirm',
234
+                message,
235
+            });
236
+            if (confirm) {
237
+                const [installer, ...installerArgs] = yield pkgInstallPluginArgs(env, pluginName, { global });
238
+                yield env.shell.run(installer, installerArgs, {});
239
+                m = yield loadPlugin(env, pluginName, { askToInstall: false, global });
240
+                mResolvedPath = require.resolve(mPath);
241
+            }
242
+            else {
243
+                throw exports.ERROR_PLUGIN_NOT_INSTALLED;
244
+            }
245
+        }
246
+        if (!guards_1.isPlugin(m) || !mResolvedPath) {
247
+            env.log.debug(() => `Throwing ${chalk.red(exports.ERROR_PLUGIN_INVALID)} for ${global ? 'global' : 'local'} ${chalk.green(pluginName)}`);
248
+            throw exports.ERROR_PLUGIN_INVALID;
249
+        }
250
+        m.meta = {
251
+            filePath: mResolvedPath,
252
+        };
253
+        return m;
254
+    });
255
+}
256
+exports.loadPlugin = loadPlugin;
257
+function hydratePlugin(env, plugin) {
258
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
259
+        env.log.debug(() => `Getting plugin info for ${chalk.green(plugin.name)}`);
260
+        const currentVersion = plugin.version;
261
+        const latestVersion = yield getLatestPluginVersion(env, plugin);
262
+        const distTag = determineDistTag(currentVersion);
263
+        const meta = plugin.meta;
264
+        if (!meta) {
265
+            throw new errors_1.FatalException(`${chalk.green(plugin.name)} missing meta information`);
266
+        }
267
+        return Object.assign({}, plugin, { meta,
268
+            distTag,
269
+            currentVersion,
270
+            latestVersion, updateAvailable: yield pluginHasUpdate(currentVersion, latestVersion) });
271
+    });
272
+}
273
+function pluginHasUpdate(currentVersion, latestVersion) {
274
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
275
+        const semver = yield Promise.resolve().then(function () { return require('semver'); });
276
+        const distTag = determineDistTag(currentVersion);
277
+        return semver.gt(latestVersion, currentVersion) || ('canary' === distTag && latestVersion !== currentVersion);
278
+    });
279
+}
280
+exports.pluginHasUpdate = pluginHasUpdate;
281
+function facilitateIonicUpdate(env, ionicPlugin) {
282
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
283
+        const global = !env.meta || !env.meta.local;
284
+        const ionicInstallArgs = yield pkgInstallPluginArgs(env, 'ionic', { global });
285
+        const updateMsg = `The Ionic CLI ${global ? '' : '(local version) '}has an update available (${chalk.green(ionicPlugin.currentVersion)} => ${chalk.green(ionicPlugin.latestVersion)})!`;
286
+        const canInstall = global ? yield fs_1.pathAccessible(ionicPlugin.meta.filePath, fs.constants.W_OK) : true;
287
+        if (canInstall) {
288
+            const confirm = yield env.prompt({
289
+                name: 'confirm',
290
+                type: 'confirm',
291
+                message: `${updateMsg} Would you like to install it?`,
292
+            });
293
+            if (confirm) {
294
+                const [installer, ...installerArgs] = ionicInstallArgs;
295
+                yield env.shell.run(installer, installerArgs, {});
296
+                const revertArgs = yield npm_1.pkgManagerArgs(env, { pkg: `ionic@${ionicPlugin.currentVersion}`, global });
297
+                env.log.nl();
298
+                env.log.ok(`Updated Ionic CLI to ${chalk.green(ionicPlugin.latestVersion)}! 🎉`);
299
+                env.log.nl();
300
+                env.log.msg(chalk.bold('Please re-run your command.'));
301
+                env.log.nl();
302
+                throw new errors_1.FatalException(`${chalk.bold('Note')}: You can downgrade to your old version by running: ${chalk.green(revertArgs.join(' '))}`, 0);
303
+            }
304
+            else {
305
+                env.log.info(`Not automatically updating your CLI. You can update manually:\n\n${chalk.green(ionicInstallArgs.join(' '))}\n`);
306
+            }
307
+        }
308
+        else {
309
+            env.log.info(updateMsg);
310
+            env.log.nl();
311
+            env.log.warn(`No write permissions for ${global ? 'global' : 'local'} ${chalk.bold('node_modules')}--automatic CLI updates are disabled.\n` +
312
+                `To fix, see ${chalk.bold('https://docs.npmjs.com/getting-started/fixing-npm-permissions')}\n\n` +
313
+                `Or, install the CLI update manually:\n\n${chalk.green(ionicInstallArgs.join(' '))}\n`);
314
+        }
315
+    });
316
+}
317
+function facilitatePluginUpdate(env, ionicPlugin, plugin) {
318
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
319
+        const global = !env.meta || !env.meta.local;
320
+        const pluginInstallArgs = yield pkgInstallPluginArgs(env, plugin.name, { global });
321
+        const startMsg = `${global ? 'Global' : 'Local'} plugin ${chalk.green(plugin.name)}`;
322
+        const updateMsg = `${startMsg} has an update available (${chalk.green(plugin.currentVersion)} => ${chalk.green(plugin.latestVersion)})!`;
323
+        const canInstall = global ? yield fs_1.pathAccessible(plugin.meta.filePath, fs.constants.W_OK) : true;
324
+        if (canInstall) {
325
+            const message = ionicPlugin.distTag === plugin.distTag ?
326
+                `${updateMsg} Would you like to install it?` :
327
+                `${startMsg} has a different dist-tag (${chalk.green('@' + plugin.distTag)}) than the Ionic CLI (${chalk.green('@' + ionicPlugin.distTag)}). Would you like to install the appropriate plugin version?`;
328
+            const okmessage = ionicPlugin.distTag === plugin.distTag ?
329
+                `Updated ${chalk.green(plugin.name)} to ${chalk.green(plugin.latestVersion)}! 🎉` :
330
+                `Installed ${chalk.green(plugin.name + '@' + ionicPlugin.distTag)}`;
331
+            const p = yield promptToInstallPlugin(env, plugin.name, {
332
+                message,
333
+                reinstall: true,
334
+                global,
335
+            });
336
+            if (p) {
337
+                unregisterPlugin(env, plugin);
338
+                registerPlugin(env, p);
339
+                env.log.ok(okmessage);
340
+                return true;
341
+            }
342
+            env.log.info(`Not automatically updating ${chalk.green(plugin.name)}. You can update manually:\n\n${chalk.green(pluginInstallArgs.join(' '))}\n`);
343
+        }
344
+        else {
345
+            env.log.info(updateMsg);
346
+            env.log.nl();
347
+            env.log.warn(`No write permissions for ${global ? 'global' : 'local'}${chalk.bold('node_modules')}--automatic plugin updates are disabled.\n` +
348
+                `To fix, see ${chalk.bold('https://docs.npmjs.com/getting-started/fixing-npm-permissions')}\n`);
349
+        }
350
+        return false;
351
+    });
352
+}
353
+function checkForUpdates(env) {
354
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
355
+        const [config,] = yield Promise.all([env.config.load(), env.daemon.load()]);
356
+        if (!config.daemon.updates) {
357
+            return [];
358
+        }
359
+        const allPlugins = yield Promise.all(Object.keys(env.plugins).map(n => hydratePlugin(env, env.plugins[n])));
360
+        yield env.daemon.save();
361
+        const ionicPlugin = allPlugins.find(p => p.name === 'ionic');
362
+        if (!ionicPlugin) {
363
+            throw new errors_1.FatalException('Ionic plugin not initialized.');
364
+        }
365
+        if (ionicPlugin.updateAvailable) {
366
+            yield facilitateIonicUpdate(env, ionicPlugin);
367
+        }
368
+        const plugins = allPlugins.filter(p => p.name !== 'ionic');
369
+        const updates = [];
370
+        for (let plugin of plugins) {
371
+            if (plugin.updateAvailable || ionicPlugin.distTag !== plugin.distTag) {
372
+                const installed = yield facilitatePluginUpdate(env, ionicPlugin, plugin);
373
+                if (installed) {
374
+                    updates.push(plugin.name);
375
+                }
376
+            }
377
+        }
378
+        if (updates.length > 0) {
379
+            const [installer, ...dedupeArgs] = yield npm_1.pkgManagerArgs(env, { command: 'dedupe' });
380
+            if (dedupeArgs.length > 0) {
381
+                try {
382
+                    yield env.shell.run(installer, dedupeArgs, { fatalOnError: false });
383
+                }
384
+                catch (e) {
385
+                    env.log.warn('Error while deduping npm dependencies. Attempting to continue...');
386
+                }
387
+            }
388
+        }
389
+        return updates;
390
+    });
391
+}
392
+exports.checkForUpdates = checkForUpdates;
393
+function getLatestPluginVersion(env, plugin) {
394
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
395
+        const distTag = determineDistTag(plugin.version);
396
+        if (distTag === 'local') {
397
+            return plugin.version;
398
+        }
399
+        env.log.debug(() => `Checking for latest plugin version of ${chalk.green(plugin.name + '@' + distTag)}.`);
400
+        const daemon = yield env.daemon.load();
401
+        if (typeof daemon.latestVersions[distTag] === 'object') {
402
+            if (daemon.latestVersions[distTag][plugin.name]) {
403
+                return daemon.latestVersions[distTag][plugin.name];
404
+            }
405
+        }
406
+        else {
407
+            env.daemon.populateDistTag(distTag);
408
+        }
409
+        let latestVersion = yield npm_1.pkgLatestVersion(env, plugin.name, distTag);
410
+        if (!latestVersion) {
411
+            latestVersion = plugin.version;
412
+        }
413
+        latestVersion = latestVersion.trim();
414
+        env.log.debug(`Latest version of ${chalk.green(plugin.name + '@' + distTag)} is ${latestVersion}.`);
415
+        daemon.latestVersions[distTag][plugin.name] = latestVersion;
416
+        return latestVersion;
417
+    });
418
+}
419
+function pkgInstallPluginArgs(env, name, options = {}) {
420
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
421
+        const releaseChannelName = determineDistTag(env.plugins.ionic.version);
422
+        let pluginInstallVersion = `${name}@${releaseChannelName}`;
423
+        if (releaseChannelName === 'local') {
424
+            options.link = true;
425
+            pluginInstallVersion = name;
426
+        }
427
+        options.pkg = pluginInstallVersion;
428
+        options.saveDev = true;
429
+        return npm_1.pkgManagerArgs(env, options);
430
+    });
431
+}
432
+exports.pkgInstallPluginArgs = pkgInstallPluginArgs;
433
+function determineDistTag(version) {
434
+    if (version.includes('-local')) {
435
+        return 'local';
436
+    }
437
+    if (version.includes('-alpha')) {
438
+        return 'canary';
439
+    }
440
+    if (version.includes('-beta') || version.includes('-rc')) {
441
+        return 'beta';
442
+    }
443
+    return 'latest';
444
+}
445
+exports.determineDistTag = determineDistTag;

+ 17
- 0
node_modules/@ionic/cli-utils/lib/project.d.ts View File

@@ -0,0 +1,17 @@
1
+import { BowerJson, IProject, PackageJson, ProjectFile, ProjectType } from '../definitions';
2
+import { BaseConfig } from './config';
3
+export declare const PROJECT_FILE = "ionic.config.json";
4
+export declare const PROJECT_FILE_LEGACY = "ionic.project";
5
+export declare const PROJECT_TYPES: ProjectType[];
6
+export declare class Project extends BaseConfig<ProjectFile> implements IProject {
7
+    directory: string;
8
+    protected packageJsonFile?: PackageJson;
9
+    protected bowerJsonFile?: BowerJson;
10
+    loadAppId(): Promise<string>;
11
+    loadPackageJson(): Promise<PackageJson>;
12
+    loadBowerJson(): Promise<BowerJson>;
13
+    provideDefaults(o: any): Promise<any>;
14
+    determineType(): Promise<ProjectType>;
15
+    is(j: any): j is ProjectFile;
16
+    formatType(type: ProjectType): "Ionic Angular" | "Ionic 1";
17
+}

+ 128
- 0
node_modules/@ionic/cli-utils/lib/project.js View File

@@ -0,0 +1,128 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const path = require("path");
5
+const chalk = require("chalk");
6
+const config_1 = require("./config");
7
+const errors_1 = require("./errors");
8
+const fs_1 = require("./utils/fs");
9
+const npm_1 = require("./utils/npm");
10
+const format_1 = require("./utils/format");
11
+const modules_1 = require("./modules");
12
+exports.PROJECT_FILE = 'ionic.config.json';
13
+exports.PROJECT_FILE_LEGACY = 'ionic.project';
14
+exports.PROJECT_TYPES = ['ionic-angular', 'ionic1'];
15
+class Project extends config_1.BaseConfig {
16
+    loadAppId() {
17
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+            const p = yield this.load();
19
+            if (!p.app_id) {
20
+                throw new errors_1.FatalException(`Your project file (${chalk.bold(format_1.prettyPath(this.filePath))}) does not contain '${chalk.bold('app_id')}'. `
21
+                    + `Run ${chalk.green('ionic link')}.`);
22
+            }
23
+            return p.app_id;
24
+        });
25
+    }
26
+    loadPackageJson() {
27
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+            if (!this.packageJsonFile) {
29
+                const packageJsonPath = path.resolve(this.directory, 'package.json');
30
+                try {
31
+                    this.packageJsonFile = yield npm_1.readPackageJsonFile(packageJsonPath);
32
+                }
33
+                catch (e) {
34
+                    if (e === fs_1.ERROR_FILE_INVALID_JSON) {
35
+                        throw new errors_1.FatalException(`Could not parse ${chalk.bold('package.json')}. Is it a valid JSON file?`);
36
+                    }
37
+                    else if (e === npm_1.ERROR_INVALID_PACKAGE_JSON) {
38
+                        throw new errors_1.FatalException(`The ${chalk.bold('package.json')} file seems malformed.`);
39
+                    }
40
+                    throw e; // Probably file not found
41
+                }
42
+            }
43
+            return this.packageJsonFile;
44
+        });
45
+    }
46
+    loadBowerJson() {
47
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+            if (!this.bowerJsonFile) {
49
+                const bowerJsonPath = path.resolve(this.directory, 'bower.json');
50
+                try {
51
+                    this.bowerJsonFile = yield npm_1.readBowerJsonFile(bowerJsonPath);
52
+                }
53
+                catch (e) {
54
+                    if (e === fs_1.ERROR_FILE_INVALID_JSON) {
55
+                        throw new errors_1.FatalException(`Could not parse ${chalk.bold('bower.json')}. Is it a valid JSON file?`);
56
+                    }
57
+                    else if (e === npm_1.ERROR_INVALID_BOWER_JSON) {
58
+                        throw new errors_1.FatalException(`The ${chalk.bold('bower.json')} file seems malformed.`);
59
+                    }
60
+                    throw e; // Probably file not found
61
+                }
62
+            }
63
+            return this.bowerJsonFile;
64
+        });
65
+    }
66
+    provideDefaults(o) {
67
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+            const lodash = modules_1.load('lodash');
69
+            const results = lodash.cloneDeep(o);
70
+            if (!results.name) {
71
+                results.name = '';
72
+            }
73
+            if (!results.app_id) {
74
+                results.app_id = '';
75
+            }
76
+            if (!results.type) {
77
+                results.type = yield this.determineType();
78
+            }
79
+            delete results.projectTypeId;
80
+            delete results.typescript;
81
+            delete results.v2;
82
+            return results;
83
+        });
84
+    }
85
+    determineType() {
86
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
87
+            try {
88
+                const packageJson = yield this.loadPackageJson();
89
+                if (packageJson.dependencies && typeof packageJson.dependencies['ionic-angular'] === 'string') {
90
+                    return 'ionic-angular';
91
+                }
92
+            }
93
+            catch (e) {
94
+                if (e.fatal) {
95
+                    throw e;
96
+                }
97
+            }
98
+            try {
99
+                const bowerJson = yield this.loadBowerJson();
100
+                if ((bowerJson.dependencies && typeof bowerJson.dependencies['ionic'] === 'string') || (bowerJson.devDependencies && typeof bowerJson.devDependencies['ionic'] === 'string')) {
101
+                    return 'ionic1';
102
+                }
103
+            }
104
+            catch (e) {
105
+                if (e.fatal) {
106
+                    throw e;
107
+                }
108
+            }
109
+            throw new errors_1.FatalException(`Could not determine project type (project config: ${chalk.bold(format_1.prettyPath(this.filePath))}).\n\n`
110
+                + `For ${this.formatType('ionic-angular')} projects, make sure 'ionic-angular' exists in the ${chalk.bold('dependencies')} attribute of ${chalk.bold('package.json')}.\n`
111
+                + `For ${this.formatType('ionic1')} projects, make sure 'ionic' exists in the ${chalk.bold('devDependencies')} attribute of ${chalk.bold('bower.json')}.\n\n`
112
+                + `Alternatively, set ${chalk.bold('type')} attribute in ${chalk.bold('ionic.config.json')} to one of: ${exports.PROJECT_TYPES.map(v => '\'' + v + '\'').join(', ')}\n`);
113
+        });
114
+    }
115
+    is(j) {
116
+        return j && typeof j.name === 'string' && typeof j.app_id === 'string';
117
+    }
118
+    formatType(type) {
119
+        if (type === 'ionic-angular') {
120
+            return 'Ionic Angular';
121
+        }
122
+        else if (type === 'ionic1') {
123
+            return 'Ionic 1';
124
+        }
125
+        return type;
126
+    }
127
+}
128
+exports.Project = Project;

+ 7
- 0
node_modules/@ionic/cli-utils/lib/prompts.d.ts View File

@@ -0,0 +1,7 @@
1
+import { ConfigFile, IConfig, ILogger, PromptModule } from '../definitions';
2
+export declare function createPromptModule({interactive, confirm, log, config}: {
3
+    interactive: boolean;
4
+    confirm: boolean;
5
+    log: ILogger;
6
+    config: IConfig<ConfigFile>;
7
+}): Promise<PromptModule>;

+ 37
- 0
node_modules/@ionic/cli-utils/lib/prompts.js View File

@@ -0,0 +1,37 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+function createPromptModule({ interactive, confirm, log, config }) {
6
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
+        const inquirer = yield Promise.resolve().then(function () { return require('inquirer'); });
8
+        const inquirerPromptModule = inquirer.createPromptModule();
9
+        function createPrompter(question) {
10
+            return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+                if (interactive === false) {
12
+                    if (typeof question.noninteractiveValue !== 'undefined') {
13
+                        return question.noninteractiveValue;
14
+                    }
15
+                    if (question.type === 'confirm') {
16
+                        if (confirm) {
17
+                            log.info(`${chalk.green('--confirm')}: ${chalk.dim(question.message)} ${chalk.cyan('Yes')}`);
18
+                            return true;
19
+                        }
20
+                        else {
21
+                            log.info(`${chalk.green('--no-confirm')}: ${chalk.dim(question.message)} ${chalk.cyan('No')}`);
22
+                            return false;
23
+                        }
24
+                    }
25
+                    return '';
26
+                }
27
+                const result = (yield inquirerPromptModule(question))[question.name];
28
+                if (typeof result !== 'string' && typeof result !== 'boolean') {
29
+                    return String(result);
30
+                }
31
+                return result;
32
+            });
33
+        }
34
+        return createPrompter;
35
+    });
36
+}
37
+exports.createPromptModule = createPromptModule;

+ 11
- 0
node_modules/@ionic/cli-utils/lib/security.d.ts View File

@@ -0,0 +1,11 @@
1
+import { IClient, SecurityProfile } from '../definitions';
2
+export declare class SecurityClient {
3
+    protected appUserToken: string;
4
+    protected client: IClient;
5
+    constructor(appUserToken: string, client: IClient);
6
+    getProfile(tag: string): Promise<SecurityProfile>;
7
+    getProfiles({page, pageSize}: {
8
+        page?: number;
9
+        pageSize?: number;
10
+    }): Promise<SecurityProfile[]>;
11
+}

+ 38
- 0
node_modules/@ionic/cli-utils/lib/security.js View File

@@ -0,0 +1,38 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const guards_1 = require("../guards");
5
+const http_1 = require("./http");
6
+class SecurityClient {
7
+    constructor(appUserToken, client) {
8
+        this.appUserToken = appUserToken;
9
+        this.client = client;
10
+    }
11
+    getProfile(tag) {
12
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+            const req = this.client.make('GET', `/security/profiles/${tag}`)
14
+                .set('Authorization', `Bearer ${this.appUserToken}`)
15
+                .query({})
16
+                .send();
17
+            const res = yield this.client.do(req);
18
+            if (!guards_1.isSecurityProfileResponse(res)) {
19
+                throw http_1.createFatalAPIFormat(req, res);
20
+            }
21
+            return res.data;
22
+        });
23
+    }
24
+    getProfiles({ page = 1, pageSize = 25 }) {
25
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+            const req = this.client.make('GET', '/security/profiles')
27
+                .set('Authorization', `Bearer ${this.appUserToken}`)
28
+                .query({ page, 'page_size': pageSize, })
29
+                .send();
30
+            const res = yield this.client.do(req);
31
+            if (!guards_1.isSecurityProfilesResponse(res)) {
32
+                throw http_1.createFatalAPIFormat(req, res);
33
+            }
34
+            return res.data;
35
+        });
36
+    }
37
+}
38
+exports.SecurityClient = SecurityClient;

+ 18
- 0
node_modules/@ionic/cli-utils/lib/session.d.ts View File

@@ -0,0 +1,18 @@
1
+import { ConfigFile, IClient, IConfig, IProject, ISession } from '../definitions';
2
+export declare class BaseSession {
3
+    protected config: IConfig<ConfigFile>;
4
+    protected project: IProject;
5
+    protected client: IClient;
6
+    constructor(config: IConfig<ConfigFile>, project: IProject, client: IClient);
7
+    isLoggedIn(): Promise<boolean>;
8
+    logout(): Promise<void>;
9
+    getUserToken(): Promise<string>;
10
+}
11
+export declare class CloudSession extends BaseSession implements ISession {
12
+    login(email: string, password: string): Promise<void>;
13
+    getAppUserToken(app_id?: string): Promise<string>;
14
+}
15
+export declare class ProSession extends BaseSession implements ISession {
16
+    login(email: string, password: string): Promise<void>;
17
+    getAppUserToken(app_id?: string): Promise<string>;
18
+}

+ 128
- 0
node_modules/@ionic/cli-utils/lib/session.js View File

@@ -0,0 +1,128 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../guards");
6
+const errors_1 = require("./errors");
7
+const http_1 = require("./http");
8
+class BaseSession {
9
+    constructor(config, project, client) {
10
+        this.config = config;
11
+        this.project = project;
12
+        this.client = client;
13
+    }
14
+    isLoggedIn() {
15
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+            const c = yield this.config.load();
17
+            return typeof c.tokens.user === 'string';
18
+        });
19
+    }
20
+    logout() {
21
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+            const c = yield this.config.load();
23
+            c.user = {};
24
+            c.tokens.appUser = {};
25
+            delete c.tokens.user;
26
+            c.git.setup = false;
27
+        });
28
+    }
29
+    getUserToken() {
30
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
+            const c = yield this.config.load();
32
+            if (!c.tokens.user) {
33
+                throw new errors_1.FatalException(`Oops, sorry! You'll need to log in:\n\n    ${chalk.green('ionic login')}\n\n` +
34
+                    `You can create a new account by signing up:\n\n    ${chalk.green('ionic signup')}\n`);
35
+            }
36
+            return c.tokens.user;
37
+        });
38
+    }
39
+}
40
+exports.BaseSession = BaseSession;
41
+class CloudSession extends BaseSession {
42
+    login(email, password) {
43
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
44
+            const req = this.client.make('POST', '/login')
45
+                .send({ email, password });
46
+            try {
47
+                const res = yield this.client.do(req);
48
+                if (!guards_1.isLegacyLoginResponse(res)) {
49
+                    throw http_1.createFatalAPIFormat(req, res);
50
+                }
51
+                const { token, user_id } = res.data;
52
+                const c = yield this.config.load();
53
+                if (c.user.id !== user_id) {
54
+                    yield this.logout();
55
+                }
56
+                c.user.id = user_id;
57
+                c.user.email = email;
58
+                c.tokens.user = token;
59
+            }
60
+            catch (e) {
61
+                if (guards_1.isSuperAgentError(e) && e.response.status === 401) {
62
+                    throw new errors_1.FatalException(chalk.red('Incorrect email or password'));
63
+                }
64
+                throw e;
65
+            }
66
+        });
67
+    }
68
+    getAppUserToken(app_id) {
69
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+            if (!app_id) {
71
+                app_id = yield this.project.loadAppId();
72
+            }
73
+            const c = yield this.config.load();
74
+            if (!c.tokens.appUser[app_id]) {
75
+                const token = yield this.getUserToken();
76
+                const paginator = this.client.paginate(() => this.client.make('GET', '/auth/tokens').set('Authorization', `Bearer ${token}`).query({ 'page_size': 100, type: 'app-user' }), guards_1.isAuthTokensResponse);
77
+                for (let r of paginator) {
78
+                    const res = yield r;
79
+                    for (let token of res.data) {
80
+                        c.tokens.appUser[token.details.app_id] = token.token;
81
+                    }
82
+                }
83
+            }
84
+            // TODO: if this is a new app, an app-user token may not exist for the user
85
+            // TODO: if tokens are invalidated, what do (hint: app tokens)
86
+            if (!c.tokens.appUser[app_id]) {
87
+                throw new errors_1.FatalException(`A token does not exist for your account on app ${chalk.bold(app_id)}.`);
88
+            }
89
+            return c.tokens.appUser[app_id];
90
+        });
91
+    }
92
+}
93
+exports.CloudSession = CloudSession;
94
+class ProSession extends BaseSession {
95
+    login(email, password) {
96
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
97
+            const req = this.client.make('POST', '/login')
98
+                .send({ email, password, source: 'cli' });
99
+            try {
100
+                const res = yield this.client.do(req);
101
+                if (!guards_1.isProLoginResponse(res)) {
102
+                    throw http_1.createFatalAPIFormat(req, res);
103
+                }
104
+                const { token, user } = res.data;
105
+                const c = yield this.config.load();
106
+                const user_id = String(user.id);
107
+                if (c.user.id !== user_id) {
108
+                    yield this.logout();
109
+                }
110
+                c.user.id = user_id;
111
+                c.user.email = email;
112
+                c.tokens.user = token;
113
+            }
114
+            catch (e) {
115
+                if (guards_1.isSuperAgentError(e) && e.response.status === 401) {
116
+                    throw new errors_1.FatalException(chalk.red('Incorrect email or password'));
117
+                }
118
+                throw e;
119
+            }
120
+        });
121
+    }
122
+    getAppUserToken(app_id) {
123
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
124
+            return this.getUserToken();
125
+        });
126
+    }
127
+}
128
+exports.ProSession = ProSession;

+ 8
- 0
node_modules/@ionic/cli-utils/lib/shell.d.ts View File

@@ -0,0 +1,8 @@
1
+import { ILogger, IShell, IShellRunOptions, ITaskChain } from '../definitions';
2
+export declare const ERROR_SHELL_COMMAND_NOT_FOUND = "SHELL_COMMAND_NOT_FOUND";
3
+export declare class Shell implements IShell {
4
+    protected tasks: ITaskChain;
5
+    protected log: ILogger;
6
+    constructor(tasks: ITaskChain, log: ILogger);
7
+    run(command: string, args: string[], {showCommand, showError, fatalOnNotFound, fatalOnError, showExecution, truncateErrorOutput, ...crossSpawnOptions}: IShellRunOptions): Promise<string>;
8
+}

+ 87
- 0
node_modules/@ionic/cli-utils/lib/shell.js View File

@@ -0,0 +1,87 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../guards");
6
+const errors_1 = require("./errors");
7
+const shell_1 = require("./utils/shell");
8
+exports.ERROR_SHELL_COMMAND_NOT_FOUND = 'SHELL_COMMAND_NOT_FOUND';
9
+class Shell {
10
+    constructor(tasks, log) {
11
+        this.tasks = tasks;
12
+        this.log = log;
13
+    }
14
+    run(command, args, _a) {
15
+        var { showCommand = true, showError = true, fatalOnNotFound = true, fatalOnError = true, showExecution, truncateErrorOutput } = _a, crossSpawnOptions = tslib_1.__rest(_a, ["showCommand", "showError", "fatalOnNotFound", "fatalOnError", "showExecution", "truncateErrorOutput"]);
16
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
+            const fullCmd = command + ' ' + (args.length > 0 ? args.map(a => a.includes(' ') ? `"${a}"` : a).join(' ') : '');
18
+            const truncatedCmd = fullCmd.length > 80 ? fullCmd.substring(0, 80) + '...' : fullCmd;
19
+            const options = Object.assign({}, crossSpawnOptions);
20
+            if (showExecution) {
21
+                options.stdoutPipe = this.log.stream;
22
+                options.stderrPipe = this.log.stream;
23
+            }
24
+            if (showCommand) {
25
+                if (this.log.shouldLog('info')) {
26
+                    this.log.msg(`> ${chalk.green(fullCmd)}`);
27
+                }
28
+                if (!showExecution) {
29
+                    this.tasks.next('Running command');
30
+                }
31
+            }
32
+            try {
33
+                try {
34
+                    const out = yield shell_1.runcmd(command, args, options);
35
+                    if (showExecution) {
36
+                        this.log.nl();
37
+                    }
38
+                    if (showCommand && !showExecution) {
39
+                        this.tasks.end();
40
+                    }
41
+                    return out;
42
+                }
43
+                catch (e) {
44
+                    if (e.code === 'ENOENT') {
45
+                        if (fatalOnNotFound) {
46
+                            throw new errors_1.FatalException(`Command not found: ${chalk.green(command)}`, 127);
47
+                        }
48
+                        else {
49
+                            throw exports.ERROR_SHELL_COMMAND_NOT_FOUND;
50
+                        }
51
+                    }
52
+                    if (!guards_1.isExitCodeException(e)) {
53
+                        throw e;
54
+                    }
55
+                    let err = e.message || '';
56
+                    if (truncateErrorOutput && err.length > truncateErrorOutput) {
57
+                        err = `${chalk.bold('(truncated)')} ... ` + err.substring(err.length - truncateErrorOutput);
58
+                    }
59
+                    const helpLine = showExecution ? '.\n' : (err ? `:\n\n${err}` : ' with no output.\n');
60
+                    const publicErrorMsg = `An error occurred while running ${chalk.green(truncatedCmd)} (exit code ${e.exitCode})` + helpLine;
61
+                    const privateErrorMsg = `Subprocess (${chalk.green(command)}) encountered an error (exit code ${e.exitCode}).`;
62
+                    if (fatalOnError) {
63
+                        if (showError) {
64
+                            throw new errors_1.FatalException(publicErrorMsg, e.exitCode);
65
+                        }
66
+                        else {
67
+                            throw new errors_1.FatalException(privateErrorMsg, e.exitCode);
68
+                        }
69
+                    }
70
+                    else {
71
+                        if (showError) {
72
+                            this.log.error(publicErrorMsg);
73
+                        }
74
+                    }
75
+                    throw e;
76
+                }
77
+            }
78
+            catch (e) {
79
+                if (showCommand && !showExecution) {
80
+                    this.tasks.fail();
81
+                }
82
+                throw e;
83
+            }
84
+        });
85
+    }
86
+}
87
+exports.Shell = Shell;

+ 21
- 0
node_modules/@ionic/cli-utils/lib/telemetry.d.ts View File

@@ -0,0 +1,21 @@
1
+import * as leekType from 'leek';
2
+import { ConfigFile, IClient, IConfig, IProject, ISession, ITelemetry, RootPlugin } from '../definitions';
3
+export declare class Telemetry implements ITelemetry {
4
+    client: IClient;
5
+    protected config: IConfig<ConfigFile>;
6
+    protected plugin: RootPlugin;
7
+    protected session: ISession;
8
+    protected project: IProject;
9
+    protected gaTracker: leekType;
10
+    constructor({config, client, session, plugin, project}: {
11
+        config: IConfig<ConfigFile>;
12
+        client: IClient;
13
+        session: ISession;
14
+        plugin: RootPlugin;
15
+        project: IProject;
16
+    });
17
+    protected setupGATracker(): Promise<void>;
18
+    resetToken(): Promise<void>;
19
+    sendCommand(command: string, args: string[]): Promise<void>;
20
+    sendError(error: any, type: string): Promise<void>;
21
+}

+ 104
- 0
node_modules/@ionic/cli-utils/lib/telemetry.js View File

@@ -0,0 +1,104 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const backends_1 = require("./backends");
5
+const modules_1 = require("./modules");
6
+const uuid_1 = require("./uuid");
7
+const GA_CODE = 'UA-44023830-30';
8
+class Telemetry {
9
+    constructor({ config, client, session, plugin, project }) {
10
+        this.config = config;
11
+        this.plugin = plugin;
12
+        this.client = client;
13
+        this.session = session;
14
+        this.project = project;
15
+    }
16
+    setupGATracker() {
17
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+            const Leek = modules_1.load('leek'); // TODO: typescript bug? can't await import
19
+            const config = yield this.config.load();
20
+            if (!config.tokens.telemetry) {
21
+                config.tokens.telemetry = uuid_1.generateUUID();
22
+            }
23
+            this.gaTracker = new Leek({
24
+                name: config.tokens.telemetry,
25
+                trackingCode: GA_CODE,
26
+                globalName: 'ionic',
27
+                version: this.plugin.version,
28
+                silent: config.telemetry !== true,
29
+            });
30
+        });
31
+    }
32
+    resetToken() {
33
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
+            const config = yield this.config.load();
35
+            config.tokens.telemetry = uuid_1.generateUUID();
36
+        });
37
+    }
38
+    sendCommand(command, args) {
39
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+            if (!this.gaTracker) {
41
+                yield this.setupGATracker();
42
+            }
43
+            const messageList = [];
44
+            const name = 'command execution';
45
+            const prettyArgs = args.map(a => a.includes(' ') ? `"${a}"` : a);
46
+            const message = messageList.concat([command], prettyArgs).join(' ');
47
+            yield Promise.all([
48
+                (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+                    yield this.gaTracker.track({ name, message });
50
+                }))(),
51
+                (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+                    const config = yield this.config.load();
53
+                    if (config.backend === backends_1.BACKEND_PRO) {
54
+                        let appId;
55
+                        if (this.project.directory) {
56
+                            const project = yield this.project.load();
57
+                            appId = project.app_id;
58
+                        }
59
+                        const now = new Date().toISOString();
60
+                        const isLoggedIn = yield this.session.isLoggedIn();
61
+                        let req = this.client.make('POST', '/events/metrics');
62
+                        if (isLoggedIn) {
63
+                            const token = yield this.session.getUserToken();
64
+                            req = req.set('Authorization', `Bearer ${token}`);
65
+                        }
66
+                        req = req.send({
67
+                            'metrics': [
68
+                                {
69
+                                    'name': 'cli_command_metrics',
70
+                                    'timestamp': now,
71
+                                    'session_id': config.tokens.telemetry,
72
+                                    'source': 'cli',
73
+                                    'value': {
74
+                                        'command': command,
75
+                                        'arguments': prettyArgs.join(' '),
76
+                                        'version': this.plugin.version,
77
+                                        'node_version': process.version,
78
+                                        'app_id': appId,
79
+                                    },
80
+                                },
81
+                            ],
82
+                            'sent_at': now,
83
+                        });
84
+                        try {
85
+                            yield this.client.do(req);
86
+                        }
87
+                        catch (e) {
88
+                            // TODO
89
+                        }
90
+                    }
91
+                }))(),
92
+            ]);
93
+        });
94
+    }
95
+    sendError(error, type) {
96
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
97
+            yield this.gaTracker.trackError({
98
+                description: error.message + ' ' + error.stack,
99
+                isFatal: true,
100
+            });
101
+        });
102
+    }
103
+}
104
+exports.Telemetry = Telemetry;

+ 2
- 0
node_modules/@ionic/cli-utils/lib/utils/archive.d.ts View File

@@ -0,0 +1,2 @@
1
+import * as archiverType from 'archiver';
2
+export declare function createArchive(format: 'zip' | 'tar'): archiverType.Archiver;

+ 8
- 0
node_modules/@ionic/cli-utils/lib/utils/archive.js View File

@@ -0,0 +1,8 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const modules_1 = require("../modules");
4
+function createArchive(format) {
5
+    const archiver = modules_1.load('archiver');
6
+    return archiver(format);
7
+}
8
+exports.createArchive = createArchive;

+ 4
- 0
node_modules/@ionic/cli-utils/lib/utils/array.d.ts View File

@@ -0,0 +1,4 @@
1
+/**
2
+ * Recursively flatten an array.
3
+ */
4
+export declare function flattenArray(arr: any[]): any[];

+ 11
- 0
node_modules/@ionic/cli-utils/lib/utils/array.js View File

@@ -0,0 +1,11 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+/**
4
+ * Recursively flatten an array.
5
+ */
6
+function flattenArray(arr) {
7
+    return arr.reduce(function (flat, toFlatten) {
8
+        return flat.concat(Array.isArray(toFlatten) ? flattenArray(toFlatten) : toFlatten);
9
+    }, []);
10
+}
11
+exports.flattenArray = flattenArray;

+ 7
- 0
node_modules/@ionic/cli-utils/lib/utils/aws.d.ts View File

@@ -0,0 +1,7 @@
1
+/// <reference types="node" />
2
+export declare function s3SignedUpload(presignedPostParams: {
3
+    url: string;
4
+    fields: Object;
5
+}, zip: NodeJS.ReadableStream, {progress}: {
6
+    progress?: (loaded: number, total: number) => void;
7
+}): Promise<void>;

+ 36
- 0
node_modules/@ionic/cli-utils/lib/utils/aws.js View File

@@ -0,0 +1,36 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const http_1 = require("../http");
4
+function s3SignedUpload(presignedPostParams, zip, { progress }) {
5
+    return new Promise((resolve, reject) => {
6
+        zip.on('error', (err) => {
7
+            reject(err);
8
+        });
9
+        let bufs = [];
10
+        zip.on('data', (buf) => {
11
+            bufs.push(buf);
12
+        });
13
+        zip.on('end', () => {
14
+            http_1.createRequest('post', presignedPostParams.url)
15
+                .buffer()
16
+                .field(presignedPostParams.fields)
17
+                .field('file', Buffer.concat(bufs))
18
+                .on('progress', (event) => {
19
+                if (progress) {
20
+                    progress(event.loaded, event.total);
21
+                }
22
+            })
23
+                .end((err, res) => {
24
+                if (err) {
25
+                    return reject(err);
26
+                }
27
+                if (res.status !== 204) {
28
+                    // TODO: log body for debug purposes?
29
+                    return reject(new Error(`Unexpected status code from AWS: ${res.status}`));
30
+                }
31
+                resolve();
32
+            });
33
+        });
34
+    });
35
+}
36
+exports.s3SignedUpload = s3SignedUpload;

+ 1
- 0
node_modules/@ionic/cli-utils/lib/utils/environmentInfo.d.ts View File

@@ -0,0 +1 @@
1
+export declare function getCommandInfo(cmd: string, args?: string[]): Promise<string | undefined>;

+ 14
- 0
node_modules/@ionic/cli-utils/lib/utils/environmentInfo.js View File

@@ -0,0 +1,14 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const shell_1 = require("./shell");
5
+function getCommandInfo(cmd, args = []) {
6
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
+        try {
8
+            const out = yield shell_1.runcmd(cmd, args);
9
+            return out.split('\n').join(' ');
10
+        }
11
+        catch (e) { }
12
+    });
13
+}
14
+exports.getCommandInfo = getCommandInfo;

+ 17
- 0
node_modules/@ionic/cli-utils/lib/utils/format.d.ts View File

@@ -0,0 +1,17 @@
1
+export declare const ICON_ELLIPSIS: string;
2
+export declare const ICON_SUCCESS: string;
3
+export declare const ICON_FAILURE: string;
4
+export declare const SPINNER_FRAMES: string[];
5
+export declare const TTY_WIDTH: number;
6
+export declare function prettyPath(p: string): string;
7
+export declare function indent(n?: number): string;
8
+export declare function wordWrap(msg: string, {indentation, append}: {
9
+    indentation?: number;
10
+    append?: string;
11
+}): string;
12
+export declare function generateFillSpaceStringList(list: string[], optimalLength?: number, fillCharacter?: string): string[];
13
+export declare function columnar(rows: string[][], {hsep, vsep, columnHeaders}?: {
14
+    hsep?: string;
15
+    vsep?: string;
16
+    columnHeaders?: string[];
17
+}): string;

+ 98
- 0
node_modules/@ionic/cli-utils/lib/utils/format.js View File

@@ -0,0 +1,98 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const os = require("os");
4
+const path = require("path");
5
+const chalk = require("chalk");
6
+const stringWidth = require("string-width");
7
+const wrapAnsi = require("wrap-ansi");
8
+const modules_1 = require("../modules");
9
+const isWindows = process.platform === 'win32';
10
+exports.ICON_ELLIPSIS = isWindows ? '...' : '…';
11
+exports.ICON_SUCCESS = isWindows ? '√' : '✔';
12
+exports.ICON_FAILURE = isWindows ? '×' : '✖';
13
+exports.SPINNER_FRAMES = isWindows ?
14
+    ['-', '\\', '|', '/'] :
15
+    ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
16
+const MIN_TTY_WIDTH = 80;
17
+const MAX_TTY_WIDTH = 120;
18
+exports.TTY_WIDTH = process.stdout.columns ? Math.max(MIN_TTY_WIDTH, Math.min(process.stdout.columns, MAX_TTY_WIDTH)) : Infinity;
19
+function prettyPath(p) {
20
+    p = path.resolve(p);
21
+    const cwd = process.cwd();
22
+    const d = path.dirname(p);
23
+    const h = os.homedir();
24
+    const distanceFromCwd = Math.abs(d.split(path.sep).length - cwd.split(path.sep).length);
25
+    if (cwd === d) {
26
+        return '.' + path.sep + path.basename(p);
27
+    }
28
+    else if (d.startsWith(cwd)) {
29
+        return '.' + path.sep + p.substring(cwd.length + 1);
30
+    }
31
+    else if (distanceFromCwd <= 2) {
32
+        const rel = path.relative(cwd, p);
33
+        return rel ? rel : '.';
34
+    }
35
+    else if (p === h) {
36
+        return '~';
37
+    }
38
+    else if (p.indexOf(h) === 0) {
39
+        return '~' + path.sep + p.substring(h.length + 1);
40
+    }
41
+    return p;
42
+}
43
+exports.prettyPath = prettyPath;
44
+function indent(n = 4) {
45
+    return new Array(n).fill(' ').join('');
46
+}
47
+exports.indent = indent;
48
+function wordWrap(msg, { indentation = 0, append = '' }) {
49
+    return wrapAnsi(msg, exports.TTY_WIDTH - indentation - append.length).split('\n').join(`${append}\n${indent(indentation)}`);
50
+}
51
+exports.wordWrap = wordWrap;
52
+function generateFillSpaceStringList(list, optimalLength = 1, fillCharacter = ' ') {
53
+    const sliceAnsi = modules_1.load('slice-ansi');
54
+    const longestItem = Math.max(...list.map((item) => stringWidth(item)));
55
+    const fullLength = longestItem > optimalLength ? longestItem + 1 : optimalLength;
56
+    const fullLengthString = Array(fullLength).fill(fillCharacter).join('');
57
+    return list.map(item => sliceAnsi(fullLengthString, 0, fullLength - stringWidth(item)));
58
+}
59
+exports.generateFillSpaceStringList = generateFillSpaceStringList;
60
+function columnar(rows, { hsep = chalk.dim('-'), vsep = chalk.dim('|'), columnHeaders } = {}) {
61
+    const includeHeaders = columnHeaders ? true : false;
62
+    if (!rows[0]) {
63
+        return '';
64
+    }
65
+    const columnCount = columnHeaders ? columnHeaders.length : rows[0].length;
66
+    const columns = columnHeaders ?
67
+        columnHeaders.map(header => [chalk.bold(header)]) :
68
+        new Array(columnCount).fill([]).map(() => []);
69
+    for (let row of rows) {
70
+        for (let i in row) {
71
+            if (columns[i]) {
72
+                columns[i].push(row[i]);
73
+            }
74
+        }
75
+    }
76
+    const paddedColumns = columns.map((col, i) => {
77
+        if (i < columnCount - 1) {
78
+            const spaceCol = generateFillSpaceStringList(col);
79
+            return col.map((cell, i) => `${cell}${spaceCol[i]}${vsep} `);
80
+        }
81
+        else {
82
+            return col;
83
+        }
84
+    });
85
+    let longestRowLength = 0;
86
+    const singleColumn = paddedColumns.reduce((a, b) => {
87
+        return a.map((_, i) => {
88
+            const r = a[i] + b[i];
89
+            longestRowLength = Math.max(longestRowLength, stringWidth(r));
90
+            return r;
91
+        });
92
+    });
93
+    if (includeHeaders) {
94
+        singleColumn.splice(1, 0, hsep.repeat(longestRowLength));
95
+    }
96
+    return singleColumn.join('\n');
97
+}
98
+exports.columnar = columnar;

+ 41
- 0
node_modules/@ionic/cli-utils/lib/utils/fs.d.ts View File

@@ -0,0 +1,41 @@
1
+/// <reference types="node" />
2
+import * as fs from 'fs';
3
+export declare const ERROR_FILE_NOT_FOUND = "FILE_NOT_FOUND";
4
+export declare const ERROR_FILE_INVALID_JSON = "FILE_INVALID_JSON";
5
+export declare const ERROR_OVERWRITE_DENIED = "OVERWRITE_DENIED";
6
+export interface FSReadFileOptions {
7
+    encoding: string;
8
+    flag?: string;
9
+}
10
+export interface FSWriteFileOptions {
11
+    encoding: string;
12
+    mode?: number;
13
+    flag?: string;
14
+}
15
+export declare const fsAccess: (arg1: string, arg2: number) => Promise<void>;
16
+export declare const fsMkdir: (arg1: string, arg2: number | undefined) => Promise<void>;
17
+export declare const fsOpen: (arg1: string, arg2: string) => Promise<number>;
18
+export declare const fsStat: (arg1: string) => Promise<fs.Stats>;
19
+export declare const fsUnlink: (arg1: string) => Promise<void>;
20
+export declare const fsReadFile: (arg1: string, arg2: FSReadFileOptions) => Promise<string>;
21
+export declare const fsWriteFile: (arg1: string, arg2: any, arg3: FSWriteFileOptions) => Promise<void>;
22
+export declare const fsReadDir: (arg1: string) => Promise<string[]>;
23
+export declare function readDir(filePath: string): Promise<string[]>;
24
+export declare function fsReadJsonFile(filePath: string, options?: FSReadFileOptions): Promise<{
25
+    [key: string]: any;
26
+}>;
27
+export declare function fsWriteJsonFile(filePath: string, json: {
28
+    [key: string]: any;
29
+}, options: FSWriteFileOptions): Promise<void>;
30
+export declare function fileToString(filepath: string): Promise<string>;
31
+export declare function fsMkdirp(p: string, mode?: number): Promise<void>;
32
+export declare function getFileChecksum(filePath: string): Promise<string>;
33
+export declare function writeStreamToFile(stream: NodeJS.ReadableStream, destination: string): Promise<any>;
34
+export declare function copyDirectory(source: string, destination: string): Promise<void>;
35
+export declare function copyFile(fileName: string, target: string, mode?: number): Promise<{}>;
36
+export declare function pathAccessible(filePath: string, mode: number): Promise<boolean>;
37
+export declare function pathExists(filePath: string): Promise<boolean>;
38
+/**
39
+ * Find the base directory based on the path given and a marker file to look for.
40
+ */
41
+export declare function findBaseDirectory(dir: string, file: string): Promise<string | undefined>;

+ 184
- 0
node_modules/@ionic/cli-utils/lib/utils/fs.js View File

@@ -0,0 +1,184 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const fs = require("fs");
5
+const path = require("path");
6
+const promise_1 = require("./promise");
7
+exports.ERROR_FILE_NOT_FOUND = 'FILE_NOT_FOUND';
8
+exports.ERROR_FILE_INVALID_JSON = 'FILE_INVALID_JSON';
9
+exports.ERROR_OVERWRITE_DENIED = 'OVERWRITE_DENIED';
10
+exports.fsAccess = promise_1.promisify(fs.access);
11
+exports.fsMkdir = promise_1.promisify(fs.mkdir);
12
+exports.fsOpen = promise_1.promisify(fs.open);
13
+exports.fsStat = promise_1.promisify(fs.stat);
14
+exports.fsUnlink = promise_1.promisify(fs.unlink);
15
+exports.fsReadFile = promise_1.promisify(fs.readFile);
16
+exports.fsWriteFile = promise_1.promisify(fs.writeFile);
17
+exports.fsReadDir = promise_1.promisify(fs.readdir);
18
+function readDir(filePath) {
19
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+        try {
21
+            return yield exports.fsReadDir(filePath);
22
+        }
23
+        catch (e) {
24
+            if (e.code === 'ENOENT') {
25
+                return [];
26
+            }
27
+            throw e;
28
+        }
29
+    });
30
+}
31
+exports.readDir = readDir;
32
+function fsReadJsonFile(filePath, options = { encoding: 'utf8' }) {
33
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
+        try {
35
+            const f = yield exports.fsReadFile(filePath, options);
36
+            return JSON.parse(f);
37
+        }
38
+        catch (e) {
39
+            if (e.code === 'ENOENT') {
40
+                throw exports.ERROR_FILE_NOT_FOUND;
41
+            }
42
+            else if (e instanceof SyntaxError) {
43
+                throw exports.ERROR_FILE_INVALID_JSON;
44
+            }
45
+            throw e;
46
+        }
47
+    });
48
+}
49
+exports.fsReadJsonFile = fsReadJsonFile;
50
+function fsWriteJsonFile(filePath, json, options) {
51
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+        return exports.fsWriteFile(filePath, JSON.stringify(json, null, 2) + '\n', options);
53
+    });
54
+}
55
+exports.fsWriteJsonFile = fsWriteJsonFile;
56
+function fileToString(filepath) {
57
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+        try {
59
+            return yield exports.fsReadFile(filepath, { encoding: 'utf8' });
60
+        }
61
+        catch (e) {
62
+            if (e.code === 'ENOENT') {
63
+                return '';
64
+            }
65
+            throw e;
66
+        }
67
+    });
68
+}
69
+exports.fileToString = fileToString;
70
+function fsMkdirp(p, mode) {
71
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+        const absPath = path.resolve(p);
73
+        const pathObj = path.parse(absPath);
74
+        const dirnames = absPath.split(path.sep).splice(1);
75
+        const dirs = dirnames.map((v, i) => path.resolve(pathObj.root, ...dirnames.slice(0, i), v));
76
+        for (let dir of dirs) {
77
+            try {
78
+                yield exports.fsMkdir(dir, mode);
79
+            }
80
+            catch (e) {
81
+                if (e.code !== 'EEXIST') {
82
+                    throw e;
83
+                }
84
+            }
85
+        }
86
+    });
87
+}
88
+exports.fsMkdirp = fsMkdirp;
89
+function getFileChecksum(filePath) {
90
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
+        const crypto = yield Promise.resolve().then(function () { return require('crypto'); });
92
+        return new Promise((resolve, reject) => {
93
+            const hash = crypto.createHash('md5');
94
+            const input = fs.createReadStream(filePath);
95
+            input.on('error', (err) => {
96
+                reject(err);
97
+            });
98
+            hash.once('readable', () => {
99
+                const fullChecksum = hash.read().toString('hex');
100
+                resolve(fullChecksum);
101
+            });
102
+            input.pipe(hash);
103
+        });
104
+    });
105
+}
106
+exports.getFileChecksum = getFileChecksum;
107
+function writeStreamToFile(stream, destination) {
108
+    return new Promise((resolve, reject) => {
109
+        const dest = fs.createWriteStream(destination);
110
+        stream.pipe(dest);
111
+        dest.on('error', reject);
112
+        dest.on('finish', resolve);
113
+    });
114
+}
115
+exports.writeStreamToFile = writeStreamToFile;
116
+function copyDirectory(source, destination) {
117
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
118
+        const ncp = yield Promise.resolve().then(function () { return require('ncp'); });
119
+        return new Promise((resolve, reject) => {
120
+            ncp.ncp(source, destination, (err) => {
121
+                if (err) {
122
+                    reject(err);
123
+                }
124
+                resolve();
125
+            });
126
+        });
127
+    });
128
+}
129
+exports.copyDirectory = copyDirectory;
130
+function copyFile(fileName, target, mode = 0o777) {
131
+    return new Promise((resolve, reject) => {
132
+        const rs = fs.createReadStream(fileName);
133
+        const ws = fs.createWriteStream(target, { mode: mode });
134
+        rs.on('error', reject);
135
+        ws.on('error', reject);
136
+        ws.on('open', function () {
137
+            rs.pipe(ws);
138
+        });
139
+        ws.once('finish', resolve);
140
+    });
141
+}
142
+exports.copyFile = copyFile;
143
+function pathAccessible(filePath, mode) {
144
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
145
+        try {
146
+            yield exports.fsAccess(filePath, mode);
147
+        }
148
+        catch (e) {
149
+            return false;
150
+        }
151
+        return true;
152
+    });
153
+}
154
+exports.pathAccessible = pathAccessible;
155
+function pathExists(filePath) {
156
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
157
+        return pathAccessible(filePath, fs.constants.F_OK);
158
+    });
159
+}
160
+exports.pathExists = pathExists;
161
+/**
162
+ * Find the base directory based on the path given and a marker file to look for.
163
+ */
164
+function findBaseDirectory(dir, file) {
165
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
166
+        dir = path.normalize(dir);
167
+        const dirInfo = path.parse(dir);
168
+        const directoriesToCheck = dirInfo.dir
169
+            .slice(dirInfo.root.length)
170
+            .split(path.sep)
171
+            .concat(dirInfo.base)
172
+            .map((segment, index, array) => {
173
+            let pathSegments = array.slice(0, (array.length - index));
174
+            return dirInfo.root + path.join(...pathSegments);
175
+        });
176
+        for (let i = 0; i < directoriesToCheck.length; i++) {
177
+            const results = yield exports.fsReadDir(directoriesToCheck[i]);
178
+            if (results.includes(file)) {
179
+                return directoriesToCheck[i];
180
+            }
181
+        }
182
+    });
183
+}
184
+exports.findBaseDirectory = findBaseDirectory;

+ 21
- 0
node_modules/@ionic/cli-utils/lib/utils/logger.d.ts View File

@@ -0,0 +1,21 @@
1
+/// <reference types="node" />
2
+import * as chalk from 'chalk';
3
+import { ILogger, LogLevel, LoggerOptions } from '../../definitions';
4
+export declare const LOGGER_STATUS_COLORS: Map<LogLevel, chalk.ChalkStyle>;
5
+export declare class Logger implements ILogger {
6
+    readonly level: LogLevel;
7
+    readonly prefix: string | (() => string);
8
+    stream: NodeJS.WritableStream;
9
+    constructor({level, prefix, stream}: LoggerOptions);
10
+    debug(msg: string | (() => string)): void;
11
+    info(msg: string | (() => string)): void;
12
+    ok(msg: string | (() => string)): void;
13
+    warn(msg: string | (() => string)): void;
14
+    error(msg: string | (() => string)): void;
15
+    msg(msg: string | (() => string)): void;
16
+    nl(num?: number): void;
17
+    shouldLog(level: LogLevel): boolean;
18
+    private enforceLF(str);
19
+    private getStatusColor(level);
20
+    private log(level, msg);
21
+}

+ 78
- 0
node_modules/@ionic/cli-utils/lib/utils/logger.js View File

@@ -0,0 +1,78 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const util = require("util");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../../guards");
6
+const format_1 = require("./format");
7
+exports.LOGGER_STATUS_COLORS = new Map([
8
+    ['debug', chalk.magenta.dim],
9
+    ['info', chalk.gray],
10
+    ['ok', chalk.green],
11
+    ['warn', chalk.yellow],
12
+    ['error', chalk.red],
13
+]);
14
+class Logger {
15
+    constructor({ level = 'info', prefix = '', stream = process.stdout }) {
16
+        this.level = level;
17
+        this.prefix = prefix;
18
+        this.stream = stream;
19
+    }
20
+    debug(msg) {
21
+        this.log('debug', msg);
22
+    }
23
+    info(msg) {
24
+        this.log('info', msg);
25
+    }
26
+    ok(msg) {
27
+        this.log('ok', msg);
28
+    }
29
+    warn(msg) {
30
+        this.log('warn', msg);
31
+    }
32
+    error(msg) {
33
+        this.log('error', msg);
34
+    }
35
+    msg(msg) {
36
+        if (typeof msg === 'function') {
37
+            msg = msg();
38
+        }
39
+        this.stream.write(this.enforceLF(msg));
40
+    }
41
+    nl(num = 1) {
42
+        this.stream.write(this.enforceLF('\n'.repeat(num)));
43
+    }
44
+    shouldLog(level) {
45
+        return guards_1.LOG_LEVELS.indexOf(level) >= guards_1.LOG_LEVELS.indexOf(this.level);
46
+    }
47
+    enforceLF(str) {
48
+        return str.match(/[\r\n]$/) ? str : str + '\n';
49
+    }
50
+    getStatusColor(level) {
51
+        const color = exports.LOGGER_STATUS_COLORS.get(level);
52
+        if (!color) {
53
+            return chalk;
54
+        }
55
+        return color;
56
+    }
57
+    log(level, msg) {
58
+        if (this.shouldLog(level)) {
59
+            let prefix = this.prefix;
60
+            if (typeof msg === 'function') {
61
+                msg = msg();
62
+            }
63
+            if (prefix) {
64
+                if (typeof prefix === 'function') {
65
+                    prefix = prefix();
66
+                }
67
+                msg = util.format(prefix, msg);
68
+            }
69
+            msg = format_1.wordWrap(msg, { indentation: level.length + 3 }).split('\n').join('\n');
70
+            msg = this.enforceLF(msg);
71
+            const color = this.getStatusColor(level);
72
+            const status = color.bold.bgBlack;
73
+            const b = chalk.dim;
74
+            this.stream.write(util.format.apply(util, [b('[') + status(level.toUpperCase()) + b(']'), msg]));
75
+        }
76
+    }
77
+}
78
+exports.Logger = Logger;

+ 4
- 0
node_modules/@ionic/cli-utils/lib/utils/network.d.ts View File

@@ -0,0 +1,4 @@
1
+export declare const ERROR_NETWORK_ADDRESS_NOT_AVAIL = "NETWORK_ADDRESS_NOT_AVAIL";
2
+export declare function getAvailableIPAddress(): any[];
3
+export declare function findClosestOpenPort(host: string, port: number): Promise<number>;
4
+export declare function isPortTaken(host: string, port: number): Promise<boolean>;

+ 60
- 0
node_modules/@ionic/cli-utils/lib/utils/network.js View File

@@ -0,0 +1,60 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const os = require("os");
5
+const array_1 = require("./array");
6
+exports.ERROR_NETWORK_ADDRESS_NOT_AVAIL = 'NETWORK_ADDRESS_NOT_AVAIL';
7
+function getAvailableIPAddress() {
8
+    let interfaces = os.networkInterfaces();
9
+    return array_1.flattenArray(Object.keys(interfaces).map(deviceName => (interfaces[deviceName].map(item => ({
10
+        address: item.address,
11
+        deviceName,
12
+        family: item.family,
13
+        internal: item.internal
14
+    })))))
15
+        .filter(item => !item.internal && item.family === 'IPv4');
16
+}
17
+exports.getAvailableIPAddress = getAvailableIPAddress;
18
+function findClosestOpenPort(host, port) {
19
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+        function t(portToCheck) {
21
+            return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+                const isTaken = yield isPortTaken(host, portToCheck);
23
+                if (!isTaken) {
24
+                    return portToCheck;
25
+                }
26
+                return t(portToCheck + 1);
27
+            });
28
+        }
29
+        return t(port);
30
+    });
31
+}
32
+exports.findClosestOpenPort = findClosestOpenPort;
33
+function isPortTaken(host, port) {
34
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+        const net = yield Promise.resolve().then(function () { return require('net'); });
36
+        return new Promise((resolve, reject) => {
37
+            const tester = net.createServer()
38
+                .once('error', (err) => {
39
+                if (err.code === 'EADDRNOTAVAIL') {
40
+                    reject(exports.ERROR_NETWORK_ADDRESS_NOT_AVAIL);
41
+                }
42
+                if (err.code !== 'EADDRINUSE') {
43
+                    return resolve(true);
44
+                }
45
+                resolve(true);
46
+            })
47
+                .once('listening', () => {
48
+                tester.once('close', () => {
49
+                    resolve(false);
50
+                })
51
+                    .close();
52
+            })
53
+                .on('error', (err) => {
54
+                reject(err);
55
+            })
56
+                .listen(port, host);
57
+        });
58
+    });
59
+}
60
+exports.isPortTaken = isPortTaken;

+ 25
- 0
node_modules/@ionic/cli-utils/lib/utils/npm.d.ts View File

@@ -0,0 +1,25 @@
1
+import { BowerJson, DistTag, IShellRunOptions, IonicEnvironment, PackageJson } from '../../definitions';
2
+export declare const ERROR_INVALID_PACKAGE_JSON = "INVALID_PACKAGE_JSON";
3
+export declare const ERROR_INVALID_BOWER_JSON = "INVALID_BOWER_JSON";
4
+/**
5
+ * Lightweight version of https://github.com/npm/validate-npm-package-name
6
+ */
7
+export declare function isValidPackageName(name: string): boolean;
8
+export declare function readPackageJsonFile(path: string): Promise<PackageJson>;
9
+export declare function readBowerJsonFile(path: string): Promise<BowerJson>;
10
+export interface PkgManagerOptions extends IShellRunOptions {
11
+    command?: 'dedupe' | 'install' | 'uninstall';
12
+    pkg?: string;
13
+    global?: boolean;
14
+    link?: boolean;
15
+    save?: boolean;
16
+    saveDev?: boolean;
17
+    saveExact?: boolean;
18
+}
19
+/**
20
+ * Resolves pkg manager intent with command args.
21
+ *
22
+ * @return Promise<args> If the args is an empty array, it means the pkg manager doesn't have that command.
23
+ */
24
+export declare function pkgManagerArgs(env: IonicEnvironment, options?: PkgManagerOptions): Promise<string[]>;
25
+export declare function pkgLatestVersion(env: IonicEnvironment, pkg: string, distTag?: DistTag): Promise<string | undefined>;

+ 184
- 0
node_modules/@ionic/cli-utils/lib/utils/npm.js View File

@@ -0,0 +1,184 @@
1
+"use strict";
2
+Object.defineProperty(exports, "__esModule", { value: true });
3
+const tslib_1 = require("tslib");
4
+const chalk = require("chalk");
5
+const guards_1 = require("../../guards");
6
+const shell_1 = require("../shell");
7
+const fs_1 = require("./fs");
8
+exports.ERROR_INVALID_PACKAGE_JSON = 'INVALID_PACKAGE_JSON';
9
+exports.ERROR_INVALID_BOWER_JSON = 'INVALID_BOWER_JSON';
10
+let installer;
11
+/**
12
+ * Lightweight version of https://github.com/npm/validate-npm-package-name
13
+ */
14
+function isValidPackageName(name) {
15
+    return encodeURIComponent(name) === name;
16
+}
17
+exports.isValidPackageName = isValidPackageName;
18
+function readPackageJsonFile(path) {
19
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+        const packageJson = yield fs_1.fsReadJsonFile(path);
21
+        if (!guards_1.isPackageJson(packageJson)) {
22
+            throw exports.ERROR_INVALID_PACKAGE_JSON;
23
+        }
24
+        return packageJson;
25
+    });
26
+}
27
+exports.readPackageJsonFile = readPackageJsonFile;
28
+function readBowerJsonFile(path) {
29
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
+        const bowerJson = yield fs_1.fsReadJsonFile(path);
31
+        if (!guards_1.isBowerJson(bowerJson)) {
32
+            throw exports.ERROR_INVALID_BOWER_JSON;
33
+        }
34
+        return bowerJson;
35
+    });
36
+}
37
+exports.readBowerJsonFile = readBowerJsonFile;
38
+/**
39
+ * Resolves pkg manager intent with command args.
40
+ *
41
+ * @return Promise<args> If the args is an empty array, it means the pkg manager doesn't have that command.
42
+ */
43
+function pkgManagerArgs(env, options = {}) {
44
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+        let vocab;
46
+        const config = yield env.config.load();
47
+        if (!options.command) {
48
+            options.command = 'install';
49
+        }
50
+        let command = options.command;
51
+        if (command === 'dedupe') {
52
+            delete options.pkg;
53
+            delete options.global;
54
+            delete options.link;
55
+            delete options.save;
56
+            delete options.saveDev;
57
+            delete options.saveExact;
58
+        }
59
+        else if (command === 'install' || command === 'uninstall') {
60
+            if (options.link) {
61
+                options.global = false;
62
+                if (command === 'install') {
63
+                    command = 'link';
64
+                }
65
+                else if (command === 'uninstall') {
66
+                    command = 'unlink';
67
+                }
68
+            }
69
+            if (options.global || options.link) {
70
+                options.save = false;
71
+                options.saveDev = false;
72
+                options.saveExact = false;
73
+            }
74
+            else if (options.pkg && typeof options.save === 'undefined' && typeof options.saveDev === 'undefined') {
75
+                options.save = true;
76
+            }
77
+            if (options.pkg && typeof options.saveExact === 'undefined') {
78
+                options.saveExact = true;
79
+            }
80
+        }
81
+        if (config.yarn) {
82
+            if (!installer) {
83
+                try {
84
+                    yield env.shell.run('yarn', ['--version'], { fatalOnNotFound: false, showCommand: false });
85
+                    installer = 'yarn';
86
+                }
87
+                catch (e) {
88
+                    if (e === shell_1.ERROR_SHELL_COMMAND_NOT_FOUND) {
89
+                        env.log.warn(`You have opted into yarn, but ${chalk.green('yarn')} was not found in PATH`);
90
+                    }
91
+                    else {
92
+                        env.log.debug(() => `Error running yarn: ${e}`);
93
+                    }
94
+                    installer = 'npm';
95
+                }
96
+            }
97
+        }
98
+        else {
99
+            installer = 'npm';
100
+        }
101
+        const installerArgs = [];
102
+        if (installer === 'npm') {
103
+            vocab = { install: 'install', bareInstall: 'install', uninstall: 'uninstall', dedupe: 'dedupe', global: '-g', save: '--save', saveDev: '--save-dev', saveExact: '--save-exact', nonInteractive: '' };
104
+        }
105
+        else if (installer === 'yarn') {
106
+            vocab = { install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', global: '', save: '', saveDev: '--dev', saveExact: '--exact', nonInteractive: '--non-interactive' };
107
+            if (options.global) {
108
+                installerArgs.push('global');
109
+            }
110
+        }
111
+        else {
112
+            throw new Error(`unknown installer: ${installer}`);
113
+        }
114
+        if (command === 'install') {
115
+            if (options.pkg) {
116
+                installerArgs.push(vocab.install);
117
+            }
118
+            else {
119
+                installerArgs.push(vocab.bareInstall);
120
+            }
121
+        }
122
+        else if (command === 'uninstall') {
123
+            installerArgs.push(vocab.uninstall);
124
+        }
125
+        else if (command === 'dedupe') {
126
+            if (vocab.dedupe) {
127
+                installerArgs.push(vocab.dedupe);
128
+            }
129
+            else {
130
+                return [];
131
+            }
132
+        }
133
+        else {
134
+            installerArgs.push(command);
135
+        }
136
+        if (options.global && vocab.global) {
137
+            installerArgs.push(vocab.global);
138
+        }
139
+        if (options.save && vocab.save) {
140
+            installerArgs.push(vocab.save);
141
+        }
142
+        if (options.saveDev && vocab.saveDev) {
143
+            installerArgs.push(vocab.saveDev);
144
+        }
145
+        if (options.saveExact && vocab.saveExact) {
146
+            installerArgs.push(vocab.saveExact);
147
+        }
148
+        if (vocab.nonInteractive) {
149
+            installerArgs.push(vocab.nonInteractive);
150
+        }
151
+        if (options.pkg) {
152
+            if (options.link) {
153
+                options.pkg = options.pkg.replace(/(.+)@.+/, '$1'); // Removes any dist tags in the pkg name, which link/unlink hate
154
+            }
155
+            installerArgs.push(options.pkg);
156
+        }
157
+        return [installer, ...installerArgs];
158
+    });
159
+}
160
+exports.pkgManagerArgs = pkgManagerArgs;
161
+function pkgLatestVersion(env, pkg, distTag = 'latest') {
162
+    return tslib_1.__awaiter(this, void 0, void 0, function* () {
163
+        const config = yield env.config.load();
164
+        const shellOptions = { fatalOnError: false, showCommand: false };
165
+        try {
166
+            if (config.yarn) {
167
+                const cmdResult = yield env.shell.run('yarn', ['info', pkg, `dist-tags.${distTag}`, '--json'], shellOptions);
168
+                return JSON.parse(cmdResult).data;
169
+            }
170
+            else {
171
+                const cmdResult = yield env.shell.run('npm', ['view', pkg, `dist-tags.${distTag}`, '--json'], shellOptions);
172
+                if (cmdResult) {
173
+                    return JSON.parse(cmdResult);
174
+                }
175
+            }
176
+        }
177
+        catch (e) {
178
+            if (e.fatal || !guards_1.isExitCodeException(e)) {
179
+                throw e;
180
+            }
181
+        }
182
+    });
183
+}
184
+exports.pkgLatestVersion = pkgLatestVersion;

+ 12
- 0
node_modules/@ionic/cli-utils/lib/utils/promise.d.ts View File

@@ -0,0 +1,12 @@
1
+export interface Promisify {
2
+    <T>(func: (callback: (err: any, result?: T) => void) => void): () => Promise<T>;
3
+    <T, A1>(func: (arg1: A1, callback: (err: any, result?: T) => void) => void): (arg1: A1) => Promise<T>;
4
+    <T, A1, A2>(func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void): (arg1: A1, arg2: A2) => Promise<T>;
5
+    <T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void): (arg1: A1, arg2: A2, arg3: A3) => Promise<T>;
6
+    <T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise<T>;
7
+    <T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise<T>;
8
+}
9
+/**
10
+ * @example: const rReadFile = promisify<Buffer, string>(fs.readFile);
11
+ */
12
+export declare const promisify: Promisify;

+ 0
- 0
node_modules/@ionic/cli-utils/lib/utils/promise.js View File


Some files were not shown because too many files changed in this diff