@pi-r/android 0.6.6 → 0.6.7

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.
@@ -28,6 +28,7 @@ function isUpgrade(version, pending) {
28
28
  return false;
29
29
  }
30
30
  module.exports = function finalize(instance) {
31
+ var _a, _b;
31
32
  const config = instance.config;
32
33
  const { profileable, dependencies, dataBinding, versionName, versionCode, namespace } = config;
33
34
  if (!profileable && !dependencies && !dataBinding && !versionName && !versionCode && !namespace) {
@@ -51,11 +52,12 @@ module.exports = function finalize(instance) {
51
52
  const snapshot = hasScope('snapshot');
52
53
  const getData = () => data || (data = instance.findData('google-maven' + (snapshot ? '-snapshot' : '') + '.json', 'json'));
53
54
  const items = dependencies.map(item => {
55
+ var _a;
54
56
  let [groupId, artifactId, version, type] = item.split(':');
55
57
  if (!version || version === 'maven') {
56
58
  const maven = getData();
57
59
  let artifact;
58
- if (maven && (artifact = maven[groupId]?.find(child => child.artifactId === artifactId))) {
60
+ if (maven && (artifact = (_a = maven[groupId]) === null || _a === void 0 ? void 0 : _a.find(child => child.artifactId === artifactId))) {
59
61
  version = artifact.version;
60
62
  }
61
63
  else {
@@ -68,7 +70,7 @@ module.exports = function finalize(instance) {
68
70
  const supplement = [];
69
71
  for (const item of items) {
70
72
  const [gId, id] = item;
71
- const target = data[gId]?.find(group => id === group.artifactId);
73
+ const target = (_a = data[gId]) === null || _a === void 0 ? void 0 : _a.find(group => id === group.artifactId);
72
74
  if (!target) {
73
75
  continue;
74
76
  }
@@ -198,7 +200,7 @@ module.exports = function finalize(instance) {
198
200
  let dependency;
199
201
  if (args || named) {
200
202
  const [group, name, version] = item;
201
- dependency = kotlin ? `(group = "${group}", name = "${name}", version = "${version}")` : ` group: '${group}', name: '${name}', version: '${version}'` + (args?.endsWith(',') ? ',' : '');
203
+ dependency = kotlin ? `(group = "${group}", name = "${name}", version = "${version}")` : ` group: '${group}', name: '${name}', version: '${version}'` + ((args === null || args === void 0 ? void 0 : args.endsWith(',')) ? ',' : '');
202
204
  }
203
205
  else {
204
206
  dependency = item.slice(0, 3).join(':');
@@ -317,7 +319,7 @@ module.exports = function finalize(instance) {
317
319
  output = Document.updateGradle(output, ['android'], kotlin ? `buildToolsVersion = "${version}"` : `buildToolsVersion "${version}"`, true);
318
320
  }
319
321
  }
320
- const applicationId = config.manifest?.package;
322
+ const applicationId = (_b = config.manifest) === null || _b === void 0 ? void 0 : _b.package;
321
323
  if (applicationId) {
322
324
  output = Document.updateGradle(output, ['android', 'defaultConfig'], (kotlin ? 'applicationId = ' : 'applicationId ') + `"${applicationId}"`, true);
323
325
  }
@@ -9,7 +9,7 @@ module.exports = function finalize(instance) {
9
9
  }
10
10
  let { localUri, source, existing, kotlin } = instance.findTemplate(this.baseDirectory, "settings.gradle", { detect: this.incremental !== 'staging', languageOf: 'gradle' });
11
11
  if (localUri && source && instance.canWrite(localUri, { ownPermissionOnly: true })) {
12
- const targetName = projectName?.replace(/"/g, '\\"');
12
+ const targetName = projectName === null || projectName === void 0 ? void 0 : projectName.replace(/"/g, '\\"');
13
13
  let modified;
14
14
  if (existing) {
15
15
  let match;
@@ -7,6 +7,7 @@ const types_1 = require("@e-mc/types");
7
7
  const Document = require("@e-mc/document");
8
8
  const checkWin32 = (value) => value === "gradlew" && process.platform === 'win32' ? value + '.bat' : value;
9
9
  module.exports = async function finalize(instance) {
10
+ var _a, _b;
10
11
  const commands = instance.config.commands;
11
12
  if (!commands || this.incremental === 'staging') {
12
13
  return;
@@ -26,7 +27,7 @@ module.exports = async function finalize(instance) {
26
27
  else {
27
28
  return;
28
29
  }
29
- const settings = instance.settings.extensions?.task || {};
30
+ const settings = ((_a = instance.settings.extensions) === null || _a === void 0 ? void 0 : _a.task) || {};
30
31
  const exec = settings.exec;
31
32
  let { broadcastId, baseDirectory } = this, command = settings.command, uid, gid, title, filename, altname, foundDir;
32
33
  if (command) {
@@ -34,7 +35,7 @@ module.exports = async function finalize(instance) {
34
35
  title = "maven";
35
36
  }
36
37
  else {
37
- title = /([^\\/]+?)(?:\.[a-z]+)?$/i.exec(command)?.[1] || 'spawn';
38
+ title = ((_b = /([^\\/]+?)(?:\.[a-z]+)?$/i.exec(command)) === null || _b === void 0 ? void 0 : _b[1]) || 'spawn';
38
39
  }
39
40
  if (!/[\\/]/.test(command = path.normalize(command))) {
40
41
  filename = checkWin32(command);
package/index.js CHANGED
@@ -165,13 +165,14 @@ class AndroidDocument extends Document {
165
165
  }
166
166
  }
167
167
  findTemplate(baseDir, filename, options) {
168
+ var _a;
168
169
  let detect, languageOf, subDir;
169
170
  if (options) {
170
171
  ({ detect, languageOf, subDir } = options);
171
172
  }
172
173
  let kotlin, language;
173
174
  if (languageOf) {
174
- kotlin = (language = this.settings.language?.[languageOf]) === 'kotlin';
175
+ kotlin = (language = (_a = this.settings.language) === null || _a === void 0 ? void 0 : _a[languageOf]) === 'kotlin';
175
176
  const isKts = this.detectKts(baseDir, filename);
176
177
  detect = isKts !== null && (kotlin && isKts || !kotlin && !isKts);
177
178
  if (kotlin) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/android",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Android document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -20,8 +20,8 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
22
  "dependencies": {
23
- "@e-mc/document": "^0.8.7",
24
- "@e-mc/types": "^0.8.7",
23
+ "@e-mc/document": "^0.8.8",
24
+ "@e-mc/types": "^0.8.8",
25
25
  "htmlparser2": "^9.1.0",
26
26
  "which": "^2.0.2"
27
27
  }