@pi-r/android 0.5.3 → 0.5.4

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Haruhi Suzumiya
1
+ Copyright 2024 An Pham
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
@@ -28,6 +28,7 @@ function isUpgrade(version, pending) {
28
28
  return false;
29
29
  }
30
30
  function finalize(instance) {
31
+ var _a;
31
32
  const config = instance.config;
32
33
  const { profileable, dependencies, dataBinding, versionName, versionCode } = config;
33
34
  if (!profileable && !dependencies && !dataBinding && !versionName && !versionCode && !config.namespace) {
@@ -50,11 +51,12 @@ function finalize(instance) {
50
51
  const snapshot = hasScope('snapshot');
51
52
  const getData = () => data || (data = instance.findData('google-maven' + (snapshot ? '-snapshot' : '') + '.json', 'json'));
52
53
  const items = dependencies.map(item => {
54
+ var _a;
53
55
  let [groupId, artifactId, version, type] = item.split(':');
54
56
  if (!version || version === 'maven') {
55
57
  const maven = getData();
56
58
  let artifact;
57
- if (maven && (artifact = maven[groupId]?.find(child => child.artifactId === artifactId))) {
59
+ if (maven && (artifact = (_a = maven[groupId]) === null || _a === void 0 ? void 0 : _a.find(child => child.artifactId === artifactId))) {
58
60
  version = artifact.version;
59
61
  }
60
62
  else {
@@ -203,7 +205,7 @@ function finalize(instance) {
203
205
  let dependency;
204
206
  if (args || named) {
205
207
  const [group, name, version] = item;
206
- dependency = kotlin ? `(group = "${group}", name = "${name}", version = "${version}")` : ` group: '${group}', name: '${name}', version: '${version}'` + (args?.endsWith(',') ? ',' : '');
208
+ dependency = kotlin ? `(group = "${group}", name = "${name}", version = "${version}")` : ` group: '${group}', name: '${name}', version: '${version}'` + ((args === null || args === void 0 ? void 0 : args.endsWith(',')) ? ',' : '');
207
209
  }
208
210
  else {
209
211
  dependency = item.slice(0, 3).join(':');
@@ -322,7 +324,7 @@ function finalize(instance) {
322
324
  output = Document.updateGradle(output, ['android'], kotlin ? `buildToolsVersion = "${version}"` : `buildToolsVersion "${version}"`, true);
323
325
  }
324
326
  }
325
- if (namespace || (namespace = config.manifest?.package)) {
327
+ if (namespace || (namespace = (_a = config.manifest) === null || _a === void 0 ? void 0 : _a.package)) {
326
328
  output = Document.updateGradle(output, ['android', 'defaultConfig'], (kotlin ? 'applicationId = ' : 'applicationId ') + `"${namespace}"`, true);
327
329
  }
328
330
  setModified(output);
@@ -9,7 +9,7 @@ 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
- let targetName = projectName?.replace(/"/g, '\\"'), modified;
12
+ let targetName = projectName === null || projectName === void 0 ? void 0 : projectName.replace(/"/g, '\\"'), modified;
13
13
  if (existing) {
14
14
  let match;
15
15
  if (dependencies) {
@@ -49,7 +49,7 @@ function finalize(instance) {
49
49
  }
50
50
  }
51
51
  else {
52
- if (!targetName && (targetName = manifest?.package)) {
52
+ if (!targetName && (targetName = manifest === null || manifest === void 0 ? void 0 : manifest.package)) {
53
53
  const index = targetName.lastIndexOf('.');
54
54
  targetName = index !== -1 ? targetName.substring(index + 1) : '';
55
55
  }
@@ -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
  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 @@ 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 @@ 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.5.3",
3
+ "version": "0.5.4",
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.7.3",
24
- "@e-mc/types": "^0.7.3",
23
+ "@e-mc/document": "^0.7.5",
24
+ "@e-mc/types": "^0.7.5",
25
25
  "htmlparser2": "^9.0.0",
26
26
  "which": "^2.0.2"
27
27
  }