@capacitor/cli 3.4.2 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.5.1](https://github.com/ionic-team/capacitor/compare/3.5.0...3.5.1) (2022-05-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **android:** move initialFocus on webview into config ([#5579](https://github.com/ionic-team/capacitor/issues/5579)) ([8b4e861](https://github.com/ionic-team/capacitor/commit/8b4e861514b0fbe08e9296f49c280234f54742e1))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.5.0](https://github.com/ionic-team/capacitor/compare/3.4.3...3.5.0) (2022-04-22)
18
+
19
+
20
+ ### Features
21
+
22
+ * **cli:** support capacitor portals plugin changes needed ([#5558](https://github.com/ionic-team/capacitor/issues/5558)) ([6810a19](https://github.com/ionic-team/capacitor/commit/6810a19ae2bbda1f4b2afad61d37ca822ca157f5))
23
+
24
+
25
+
26
+
27
+
28
+ ## [3.4.3](https://github.com/ionic-team/capacitor/compare/3.4.2...3.4.3) (2022-03-04)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **cli:** avoid srcFiles is not iterable on kotlinNeededCheck ([#5481](https://github.com/ionic-team/capacitor/issues/5481)) ([3c2b579](https://github.com/ionic-team/capacitor/commit/3c2b579c6edb1fc69d85689b268eb92067b7821b))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [3.4.2](https://github.com/ionic-team/capacitor/compare/3.4.1...3.4.2) (2022-03-03)
7
40
 
8
41
 
Binary file
Binary file
@@ -232,10 +232,12 @@ async function kotlinNeededCheck(config, cordovaPlugins) {
232
232
  'true') {
233
233
  for (const plugin of cordovaPlugins) {
234
234
  const androidPlatform = plugin_1.getPluginPlatform(plugin, platform);
235
- const srcFiles = androidPlatform['source-file'];
236
- for (const srcFile of srcFiles) {
237
- if (/^.*\.kt$/.test(srcFile['$'].src)) {
238
- return true;
235
+ const sourceFiles = androidPlatform['source-file'];
236
+ if (sourceFiles) {
237
+ for (const srcFile of sourceFiles) {
238
+ if (/^.*\.kt$/.test(srcFile['$'].src)) {
239
+ return true;
240
+ }
239
241
  }
240
242
  }
241
243
  }
@@ -184,6 +184,13 @@ export interface CapacitorConfig {
184
184
  * @since 3.1.0
185
185
  */
186
186
  flavor?: string;
187
+ /**
188
+ * Whether to give the webview initial focus.
189
+ *
190
+ * @since 3.5.1
191
+ * @default true
192
+ */
193
+ initialFocus?: boolean;
187
194
  };
188
195
  ios?: {
189
196
  /**
@@ -432,6 +439,11 @@ export interface CapacitorConfig {
432
439
  */
433
440
  includePlugins?: string[];
434
441
  }
442
+ export interface Portal {
443
+ name: string;
444
+ webDir: string;
445
+ appId?: string;
446
+ }
435
447
  export interface PluginsConfig {
436
448
  /**
437
449
  * Plugin configuration by class name.
@@ -441,4 +453,13 @@ export interface PluginsConfig {
441
453
  [key: string]: {
442
454
  [key: string]: any;
443
455
  } | undefined;
456
+ /**
457
+ * Capacitor Portals plugin configuration
458
+ *
459
+ * @since 3.5.0
460
+ */
461
+ Portals?: {
462
+ shell: Portal;
463
+ apps: Portal[];
464
+ };
444
465
  }
@@ -9,6 +9,7 @@ const common_1 = require("../common");
9
9
  const cordova_1 = require("../cordova");
10
10
  const errors_1 = require("../errors");
11
11
  const log_1 = require("../log");
12
+ const plugin_1 = require("../plugin");
12
13
  const promise_1 = require("../util/promise");
13
14
  const copy_1 = require("../web/copy");
14
15
  async function copyCommand(config, selectedPlatformName) {
@@ -43,21 +44,41 @@ async function copy(config, platformName) {
43
44
  throw result;
44
45
  }
45
46
  await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:copy:before');
47
+ const allPlugins = await plugin_1.getPlugins(config, platformName);
48
+ let usesCapacitorPortals = false;
49
+ if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor-portals').length > 0) {
50
+ usesCapacitorPortals = true;
51
+ }
46
52
  if (platformName === config.ios.name) {
47
- await copyWebDir(config, await config.ios.webDirAbs);
53
+ if (usesCapacitorPortals) {
54
+ await copyFederatedWebDirs(config, await config.ios.webDirAbs);
55
+ }
56
+ else {
57
+ await copyWebDir(config, await config.ios.webDirAbs, config.app.webDirAbs);
58
+ }
48
59
  await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs);
49
60
  const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
50
61
  await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
51
62
  }
52
63
  else if (platformName === config.android.name) {
53
- await copyWebDir(config, config.android.webDirAbs);
64
+ if (usesCapacitorPortals) {
65
+ await copyFederatedWebDirs(config, config.android.webDirAbs);
66
+ }
67
+ else {
68
+ await copyWebDir(config, config.android.webDirAbs, config.app.webDirAbs);
69
+ }
54
70
  await copyCapacitorConfig(config, config.android.assetsDirAbs);
55
71
  const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
56
72
  await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
57
73
  await cordova_1.writeCordovaAndroidManifest(cordovaPlugins, config, platformName);
58
74
  }
59
75
  else if (platformName === config.web.name) {
60
- await copy_1.copyWeb(config);
76
+ if (usesCapacitorPortals) {
77
+ log_1.logger.info('Capacitor Portals Plugin installed, skipping web bundling...');
78
+ }
79
+ else {
80
+ await copy_1.copyWeb(config);
81
+ }
61
82
  }
62
83
  else {
63
84
  throw `Platform ${platformName} is not valid.`;
@@ -76,9 +97,8 @@ async function copyCapacitorConfig(config, nativeAbsDir) {
76
97
  });
77
98
  });
78
99
  }
79
- async function copyWebDir(config, nativeAbsDir) {
100
+ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
80
101
  var _a;
81
- const webAbsDir = config.app.webDirAbs;
82
102
  const webRelDir = path_1.basename(webAbsDir);
83
103
  const nativeRelDir = path_1.relative(config.app.rootDir, nativeAbsDir);
84
104
  if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await utils_fs_1.pathExists(webAbsDir))) {
@@ -91,3 +111,25 @@ async function copyWebDir(config, nativeAbsDir) {
91
111
  return utils_fs_1.copy(webAbsDir, nativeAbsDir);
92
112
  });
93
113
  }
114
+ async function copyFederatedWebDirs(config, nativeAbsDir) {
115
+ var _a, _b;
116
+ log_1.logger.info('Capacitor Portals Plugin Loaded - Copying Web Assets');
117
+ if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.Portals)) {
118
+ throw `Capacitor Portals plugin is present but no valid config is defined.`;
119
+ }
120
+ const portalsConfig = config.app.extConfig.plugins.Portals;
121
+ if (!isPortal(portalsConfig.shell)) {
122
+ throw `Capacitor Portals plugin is present but no valid Shell application is defined in the config.`;
123
+ }
124
+ if (!portalsConfig.apps.every(isPortal)) {
125
+ throw `Capacitor Portals plugin is present but there is a problem with the apps defined in the config.`;
126
+ }
127
+ await Promise.all([...portalsConfig.apps, portalsConfig.shell].map(app => {
128
+ const appDir = path_1.resolve(config.app.rootDir, app.webDir);
129
+ return copyWebDir(config, path_1.resolve(nativeAbsDir, app.name), appDir);
130
+ }));
131
+ }
132
+ function isPortal(config) {
133
+ return (config.webDir !== undefined &&
134
+ config.name !== undefined);
135
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "3.4.2",
3
+ "version": "3.5.1",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "2e4a06b34d664c538ea96dde6be2abea99acb468"
88
+ "gitHead": "009064dbf01cbc5900bbc16053b6d7535ad4c2b4"
89
89
  }