@capacitor/cli 4.0.0-alpha.2 → 4.0.0-nightly-ffa328d2.0

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,29 @@
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
+ # [4.0.0-beta.0](https://github.com/ionic-team/capacitor/compare/3.6.0...4.0.0-beta.0) (2022-06-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **android:** Use java 11 ([#5552](https://github.com/ionic-team/capacitor/issues/5552)) ([e47959f](https://github.com/ionic-team/capacitor/commit/e47959fcbd6a89b97b1275a5814fdb4e7ce30672))
12
+ * **ios:** Add preferredContentMode configuration option ([#5583](https://github.com/ionic-team/capacitor/issues/5583)) ([5b6dfa3](https://github.com/ionic-team/capacitor/commit/5b6dfa3fe29c85632546b299f03cc04a77cf7475))
13
+
14
+
15
+
16
+
17
+
18
+ # [3.6.0](https://github.com/ionic-team/capacitor/compare/3.5.1...3.6.0) (2022-06-17)
19
+
20
+
21
+ ### Features
22
+
23
+ * **android:** update support for Portals for Capacitor to include Live Updates ([#5660](https://github.com/ionic-team/capacitor/issues/5660)) ([62f0a5e](https://github.com/ionic-team/capacitor/commit/62f0a5eaa40776aad79dbf8f8c0900037d3cc97e))
24
+
25
+
26
+
27
+
28
+
6
29
  # [4.0.0-alpha.2](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.2) (2022-05-12)
7
30
 
8
31
 
@@ -15,6 +38,28 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
15
38
 
16
39
 
17
40
 
41
+ ## [3.5.1](https://github.com/ionic-team/capacitor/compare/3.5.0...3.5.1) (2022-05-04)
42
+
43
+
44
+ ### Bug Fixes
45
+
46
+ * **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))
47
+
48
+
49
+
50
+
51
+
52
+ # [3.5.0](https://github.com/ionic-team/capacitor/compare/3.4.3...3.5.0) (2022-04-22)
53
+
54
+
55
+ ### Features
56
+
57
+ * **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))
58
+
59
+
60
+
61
+
62
+
18
63
  # [4.0.0-alpha.1](https://github.com/ionic-team/capacitor/compare/3.4.1...4.0.0-alpha.1) (2022-03-25)
19
64
 
20
65
  **Note:** Version bump only for package @capacitor/cli
@@ -23,6 +68,28 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
23
68
 
24
69
 
25
70
 
71
+
72
+ ## [3.4.3](https://github.com/ionic-team/capacitor/compare/3.4.2...3.4.3) (2022-03-04)
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * **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))
78
+
79
+
80
+
81
+
82
+
83
+ ## [3.4.2](https://github.com/ionic-team/capacitor/compare/3.4.1...3.4.2) (2022-03-03)
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * **android:** compatibility with cordova kotlin plugins ([#5438](https://github.com/ionic-team/capacitor/issues/5438)) ([55bf004](https://github.com/ionic-team/capacitor/commit/55bf004897b3feb280ab6b6575d2a2c1a0a183e2))
89
+
90
+
91
+
92
+
26
93
  ## [3.4.1](https://github.com/ionic-team/capacitor/compare/3.4.0...3.4.1) (2022-02-09)
27
94
 
28
95
 
Binary file
Binary file
@@ -15,7 +15,7 @@ async function openAndroid(config) {
15
15
  if (!(await utils_fs_1.pathExists(androidStudioPath))) {
16
16
  throw new Error(`Android Studio does not exist at: ${androidStudioPath}`);
17
17
  }
18
- await open_1.default(dir, { app: androidStudioPath, wait: false });
18
+ await open_1.default(dir, { app: { name: androidStudioPath }, wait: false });
19
19
  log_1.logger.info(`Opening Android project at: ${colors_1.default.strong(config.android.platformDir)}.`);
20
20
  }
21
21
  catch (e) {
@@ -166,7 +166,11 @@ if (hasProperty('postBuildExtras')) {
166
166
  }
167
167
  exports.installGradlePlugins = installGradlePlugins;
168
168
  async function handleCordovaPluginsGradle(config, cordovaPlugins) {
169
+ var _a, _b, _c;
169
170
  const pluginsGradlePath = path_1.join(config.android.cordovaPluginsDirAbs, 'build.gradle');
171
+ const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
172
+ const isKotlinVersionInVariablesGradle = (await getVariablesGradleFile(config)).includes('kotlin_version');
173
+ const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.4.32';
170
174
  const frameworksArray = [];
171
175
  let prefsArray = [];
172
176
  const applyArray = [];
@@ -193,10 +197,24 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
193
197
  })
194
198
  .join('\n');
195
199
  frameworkString = await replaceFrameworkVariables(config, prefsArray, frameworkString);
200
+ if (kotlinNeeded) {
201
+ frameworkString += `\n implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"`;
202
+ frameworkString += `\n implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"`;
203
+ }
196
204
  const applyString = applyArray.join('\n');
197
205
  let buildGradle = await utils_fs_1.readFile(pluginsGradlePath, { encoding: 'utf-8' });
198
206
  buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + frameworkString.concat('\n') + ' $2');
199
207
  buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + applyString.concat('\n') + '$2');
208
+ if (kotlinNeeded) {
209
+ buildGradle = buildGradle.replace(/(buildscript\s{\n(\t|\s{4})repositories\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})}\n(\t|\s{4})dependencies\s{\n(\t{2}|\s{8}).+)\n((\t|\s{4})}\n}\n)/, `$1\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:` +
210
+ (isKotlinVersionInVariablesGradle
211
+ ? '$kotlin_version'
212
+ : kotlinVersionString) +
213
+ `"\n$8`);
214
+ buildGradle = buildGradle.replace(/(ext\s{)/, `$1\n kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '${kotlinVersionString}'\n androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.6.0'`);
215
+ buildGradle = buildGradle.replace(/(apply\splugin:\s'com\.android\.library')/, `$1\napply plugin: 'kotlin-android'`);
216
+ buildGradle = buildGradle.replace(/(compileOptions\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})})\n(})/, `$1\n sourceSets {\n main.java.srcDirs += 'src/main/kotlin'\n }\n$5`);
217
+ }
200
218
  await utils_fs_1.writeFile(pluginsGradlePath, buildGradle);
201
219
  const cordovaVariables = `// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
202
220
  ext {
@@ -208,6 +226,27 @@ ext {
208
226
  await utils_fs_1.writeFile(path_1.join(config.android.cordovaPluginsDirAbs, 'cordova.variables.gradle'), cordovaVariables);
209
227
  }
210
228
  exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
229
+ async function kotlinNeededCheck(config, cordovaPlugins) {
230
+ var _a, _b;
231
+ if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !==
232
+ 'true') {
233
+ for (const plugin of cordovaPlugins) {
234
+ const androidPlatform = plugin_1.getPluginPlatform(plugin, platform);
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
+ }
241
+ }
242
+ }
243
+ }
244
+ return false;
245
+ }
246
+ else {
247
+ return true;
248
+ }
249
+ }
211
250
  async function copyPluginsNativeFiles(config, cordovaPlugins) {
212
251
  const pluginsPath = path_1.join(config.android.cordovaPluginsDirAbs, 'src', 'main');
213
252
  for (const p of cordovaPlugins) {
@@ -257,12 +296,16 @@ async function getPluginsTask(config) {
257
296
  return androidPlugins;
258
297
  });
259
298
  }
260
- async function replaceFrameworkVariables(config, prefsArray, frameworkString) {
299
+ async function getVariablesGradleFile(config) {
261
300
  const variablesFile = path_1.resolve(config.android.platformDirAbs, 'variables.gradle');
262
301
  let variablesGradle = '';
263
302
  if (await utils_fs_1.pathExists(variablesFile)) {
264
303
  variablesGradle = await utils_fs_1.readFile(variablesFile, { encoding: 'utf-8' });
265
304
  }
305
+ return variablesGradle;
306
+ }
307
+ async function replaceFrameworkVariables(config, prefsArray, frameworkString) {
308
+ const variablesGradle = await getVariablesGradleFile(config);
266
309
  prefsArray.map((preference) => {
267
310
  if (!variablesGradle.includes(preference.$.name)) {
268
311
  frameworkString = frameworkString.replace(new RegExp(('$' + preference.$.name).replace('$', '\\$&'), 'g'), preference.$.default);
@@ -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
  /**
@@ -443,6 +450,18 @@ export interface CapacitorConfig {
443
450
  */
444
451
  includePlugins?: string[];
445
452
  }
453
+ export interface Portal {
454
+ name: string;
455
+ webDir: string;
456
+ liveUpdateConfig?: LiveUpdateConfig;
457
+ }
458
+ export interface LiveUpdateConfig {
459
+ appId: string;
460
+ channel: string;
461
+ autoUpdateMethod: AutoUpdateMethod;
462
+ maxVersions?: number;
463
+ }
464
+ export declare type AutoUpdateMethod = 'none' | 'background';
446
465
  export interface PluginsConfig {
447
466
  /**
448
467
  * Plugin configuration by class name.
@@ -452,4 +471,13 @@ export interface PluginsConfig {
452
471
  [key: string]: {
453
472
  [key: string]: any;
454
473
  } | undefined;
474
+ /**
475
+ * Capacitor Portals plugin configuration
476
+ *
477
+ * @since 3.5.0
478
+ */
479
+ Portals?: {
480
+ shell: Portal;
481
+ apps: Portal[];
482
+ };
455
483
  }
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runProgram = exports.run = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const commander_1 = tslib_1.__importDefault(require("commander"));
5
+ const commander_1 = require("commander");
6
6
  const colors_1 = tslib_1.__importDefault(require("./colors"));
7
7
  const config_1 = require("./config");
8
8
  const errors_1 = require("./errors");
@@ -27,8 +27,8 @@ async function run() {
27
27
  }
28
28
  exports.run = run;
29
29
  function runProgram(config) {
30
- commander_1.default.version(config.cli.package.version);
31
- commander_1.default
30
+ commander_1.program.version(config.cli.package.version);
31
+ commander_1.program
32
32
  .command('config', { hidden: true })
33
33
  .description(`print evaluated Capacitor config`)
34
34
  .option('--json', 'Print in JSON format')
@@ -36,14 +36,14 @@ function runProgram(config) {
36
36
  const { configCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/config')));
37
37
  await configCommand(config, json);
38
38
  }));
39
- commander_1.default
39
+ commander_1.program
40
40
  .command('create [directory] [name] [id]', { hidden: true })
41
41
  .description('Creates a new Capacitor project')
42
42
  .action(cli_1.wrapAction(async () => {
43
43
  const { createCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/create')));
44
44
  await createCommand();
45
45
  }));
46
- commander_1.default
46
+ commander_1.program
47
47
  .command('init [appName] [appId]')
48
48
  .description(`Initialize Capacitor configuration`)
49
49
  .option('--web-dir <value>', 'Optional: Directory of your projects built web assets')
@@ -51,14 +51,14 @@ function runProgram(config) {
51
51
  const { initCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/init')));
52
52
  await initCommand(config, appName, appId, webDir);
53
53
  })));
54
- commander_1.default
54
+ commander_1.program
55
55
  .command('serve', { hidden: true })
56
56
  .description('Serves a Capacitor Progressive Web App in the browser')
57
57
  .action(cli_1.wrapAction(async () => {
58
58
  const { serveCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/serve')));
59
59
  await serveCommand();
60
60
  }));
61
- commander_1.default
61
+ commander_1.program
62
62
  .command('sync [platform]')
63
63
  .description(`${colors_1.default.input('copy')} + ${colors_1.default.input('update')}`)
64
64
  .option('--deployment', "Optional: if provided, Podfile.lock won't be deleted and pod install will use --deployment option")
@@ -67,7 +67,7 @@ function runProgram(config) {
67
67
  const { syncCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/sync')));
68
68
  await syncCommand(config, platform, deployment);
69
69
  })));
70
- commander_1.default
70
+ commander_1.program
71
71
  .command('update [platform]')
72
72
  .description(`updates the native plugins and dependencies based on ${colors_1.default.strong('package.json')}`)
73
73
  .option('--deployment', "Optional: if provided, Podfile.lock won't be deleted and pod install will use --deployment option")
@@ -76,7 +76,7 @@ function runProgram(config) {
76
76
  const { updateCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/update')));
77
77
  await updateCommand(config, platform, deployment);
78
78
  })));
79
- commander_1.default
79
+ commander_1.program
80
80
  .command('copy [platform]')
81
81
  .description('copies the web app build into the native app')
82
82
  .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
@@ -84,7 +84,7 @@ function runProgram(config) {
84
84
  const { copyCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/copy')));
85
85
  await copyCommand(config, platform);
86
86
  })));
87
- commander_1.default
87
+ commander_1.program
88
88
  .command(`run [platform]`)
89
89
  .description(`runs ${colors_1.default.input('sync')}, then builds and deploys the native app`)
90
90
  .option('--list', 'list targets, then quit')
@@ -96,14 +96,14 @@ function runProgram(config) {
96
96
  const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
97
97
  await runCommand(config, platform, { list, target, sync });
98
98
  })));
99
- commander_1.default
99
+ commander_1.program
100
100
  .command('open [platform]')
101
101
  .description('opens the native project workspace (Xcode for iOS)')
102
102
  .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
103
103
  const { openCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/open')));
104
104
  await openCommand(config, platform);
105
105
  })));
106
- commander_1.default
106
+ commander_1.program
107
107
  .command('add [platform]')
108
108
  .description('add a native platform project')
109
109
  .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
@@ -111,7 +111,7 @@ function runProgram(config) {
111
111
  const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
112
112
  await addCommand(config, platform);
113
113
  })));
114
- commander_1.default
114
+ commander_1.program
115
115
  .command('ls [platform]')
116
116
  .description('list installed Cordova and Capacitor plugins')
117
117
  .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
@@ -119,7 +119,7 @@ function runProgram(config) {
119
119
  const { listCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/list')));
120
120
  await listCommand(config, platform);
121
121
  })));
122
- commander_1.default
122
+ commander_1.program
123
123
  .command('doctor [platform]')
124
124
  .description('checks the current setup for common errors')
125
125
  .action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform) => {
@@ -127,35 +127,35 @@ function runProgram(config) {
127
127
  const { doctorCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/doctor')));
128
128
  await doctorCommand(config, platform);
129
129
  })));
130
- commander_1.default
130
+ commander_1.program
131
131
  .command('telemetry [on|off]', { hidden: true })
132
132
  .description('enable or disable telemetry')
133
133
  .action(cli_1.wrapAction(async (onOrOff) => {
134
134
  const { telemetryCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/telemetry')));
135
135
  await telemetryCommand(onOrOff);
136
136
  }));
137
- commander_1.default
137
+ commander_1.program
138
138
  .command('📡', { hidden: true })
139
139
  .description('IPC receiver command')
140
140
  .action(() => {
141
141
  // no-op: IPC messages are received via `process.on('message')`
142
142
  });
143
- commander_1.default
143
+ commander_1.program
144
144
  .command('plugin:generate', { hidden: true })
145
145
  .description('start a new Capacitor plugin')
146
146
  .action(cli_1.wrapAction(async () => {
147
147
  const { newPluginCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/new-plugin')));
148
148
  await newPluginCommand();
149
149
  }));
150
- commander_1.default.arguments('[command]').action(cli_1.wrapAction(async (cmd) => {
150
+ commander_1.program.arguments('[command]').action(cli_1.wrapAction(async (cmd) => {
151
151
  if (typeof cmd === 'undefined') {
152
152
  log_1.output.write(`\n ${emoji_1.emoji('⚡️', '--')} ${colors_1.default.strong('Capacitor - Cross-Platform apps with JavaScript and the Web')} ${emoji_1.emoji('⚡️', '--')}\n\n`);
153
- commander_1.default.outputHelp();
153
+ commander_1.program.outputHelp();
154
154
  }
155
155
  else {
156
156
  errors_1.fatal(`Unknown command: ${colors_1.default.input(cmd)}`);
157
157
  }
158
158
  }));
159
- commander_1.default.parse(process.argv);
159
+ commander_1.program.parse(process.argv);
160
160
  }
161
161
  exports.runProgram = runProgram;
@@ -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": "4.0.0-alpha.2",
3
+ "version": "4.0.0-nightly-ffa328d2.0",
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)",
@@ -44,16 +44,16 @@
44
44
  "watch": "npm run assets && tsc -w"
45
45
  },
46
46
  "dependencies": {
47
- "@ionic/cli-framework-output": "^2.2.4",
48
- "@ionic/utils-fs": "^3.1.5",
49
- "@ionic/utils-subprocess": "^2.1.10",
50
- "@ionic/utils-terminal": "^2.3.2",
51
- "commander": "^6.0.0",
47
+ "@ionic/cli-framework-output": "^2.2.5",
48
+ "@ionic/utils-fs": "^3.1.6",
49
+ "@ionic/utils-subprocess": "^2.1.11",
50
+ "@ionic/utils-terminal": "^2.3.3",
51
+ "commander": "^9.3.0",
52
52
  "debug": "^4.3.4",
53
53
  "env-paths": "^2.2.0",
54
54
  "kleur": "^4.1.4",
55
- "native-run": "^1.5.0",
56
- "open": "^7.4.2",
55
+ "native-run": "^1.6.0",
56
+ "open": "^8.4.0",
57
57
  "plist": "^3.0.5",
58
58
  "prompts": "^2.4.2",
59
59
  "semver": "^7.3.7",
@@ -62,16 +62,13 @@
62
62
  "xml2js": "^0.4.23"
63
63
  },
64
64
  "devDependencies": {
65
- "@types/debug": "^4.1.5",
66
- "@types/fs-extra": "^9.0.1",
65
+ "@types/debug": "^4.1.7",
67
66
  "@types/jest": "^26.0.4",
68
- "@types/open": "^6.1.0",
69
67
  "@types/plist": "^3.0.2",
70
- "@types/prompts": "^2.0.8",
71
- "@types/semver": "^7.3.1",
72
- "@types/slice-ansi": "^4.0.0",
73
- "@types/tar": "^4.0.4",
74
- "@types/tmp": "^0.2.0",
68
+ "@types/prompts": "^2.0.14",
69
+ "@types/semver": "^7.3.10",
70
+ "@types/tar": "^6.1.1",
71
+ "@types/tmp": "^0.2.3",
75
72
  "@types/xml2js": "0.4.5",
76
73
  "jest": "^26.1.0",
77
74
  "rimraf": "^3.0.2",
@@ -85,5 +82,5 @@
85
82
  "publishConfig": {
86
83
  "access": "public"
87
84
  },
88
- "gitHead": "5c588d5bd15b2b939c6efc25b7db9d6af29afae0"
85
+ "gitHead": "ffa328d2fbd047f6e1c37b2819c57f27739222fd"
89
86
  }