nativescript 9.1.0-alpha.0 → 9.1.0-alpha.2

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.
Files changed (33) hide show
  1. package/README.md +49 -0
  2. package/config/test-deps-versions-generated.json +3 -3
  3. package/lib/.d.ts +1 -0
  4. package/lib/bootstrap.js +0 -2
  5. package/lib/commands/build.js +1 -30
  6. package/lib/commands/run.js +1 -39
  7. package/lib/commands/widget.js +1 -2
  8. package/lib/common/definitions/mobile.d.ts +0 -3
  9. package/lib/common/file-system.js +11 -15
  10. package/lib/common/mobile/device-platforms-constants.js +0 -4
  11. package/lib/common/mobile/mobile-helper.js +1 -12
  12. package/lib/constants.js +7 -2
  13. package/lib/controllers/prepare-controller.js +0 -28
  14. package/lib/definitions/nativescript-dev-xcode.d.ts +25 -1
  15. package/lib/definitions/project.d.ts +35 -6
  16. package/lib/key-commands/bootstrap.js +0 -1
  17. package/lib/key-commands/index.js +1 -53
  18. package/lib/project-data.js +0 -6
  19. package/lib/services/bundler/bundler-compiler-service.js +27 -13
  20. package/lib/services/debug-service-base.js +1 -1
  21. package/lib/services/ios/ios-signing-service.js +10 -3
  22. package/lib/services/ios/spm-service.js +1 -8
  23. package/lib/services/ios/xcodebuild-args-service.js +10 -29
  24. package/lib/services/ios-entitlements-service.js +3 -1
  25. package/lib/services/ios-project-service.js +27 -74
  26. package/lib/services/ios-watch-app-service.js +663 -16
  27. package/lib/services/platforms-data-service.js +0 -1
  28. package/lib/services/plugins-service.js +4 -24
  29. package/lib/services/project-changes-service.js +4 -15
  30. package/lib/services/project-data-service.js +2 -20
  31. package/lib/services/versions-service.js +0 -4
  32. package/lib/tools/config-manipulation/config-transformer.js +55 -3
  33. package/package.json +23 -12
@@ -11,7 +11,6 @@ class PlatformsDataService {
11
11
  ios: $iOSProjectService,
12
12
  android: $androidProjectService,
13
13
  visionos: $iOSProjectService,
14
- macos: $iOSProjectService,
15
14
  };
16
15
  }
17
16
  getPlatformData(platform, projectData) {
@@ -109,16 +109,15 @@ class PluginsService {
109
109
  async preparePluginNativeCode({ pluginData, platform, projectData, }) {
110
110
  const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
111
111
  const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(platform);
112
- const pluginNativeFilesPath = this.getPluginNativeFilesPath(pluginData, platform, pluginPlatformsFolderPath);
113
- if (pluginNativeFilesPath) {
112
+ if (this.$fs.exists(pluginPlatformsFolderPath)) {
114
113
  const pathToPluginsBuildFile = path.join(platformData.projectRoot, constants.PLUGINS_BUILD_DATA_FILENAME);
115
114
  const allPluginsNativeHashes = this.getAllPluginsNativeHashes(pathToPluginsBuildFile);
116
115
  const oldPluginNativeHashes = allPluginsNativeHashes[pluginData.name];
117
- const currentPluginNativeHashes = await this.getPluginNativeHashes(pluginNativeFilesPath);
116
+ const currentPluginNativeHashes = await this.getPluginNativeHashes(pluginPlatformsFolderPath);
118
117
  if (!oldPluginNativeHashes ||
119
118
  this.$filesHashService.hasChangesInShasums(oldPluginNativeHashes, currentPluginNativeHashes)) {
120
119
  await platformData.platformProjectService.preparePluginNativeCode(pluginData, projectData);
121
- const updatedPluginNativeHashes = await this.getPluginNativeHashes(pluginNativeFilesPath);
120
+ const updatedPluginNativeHashes = await this.getPluginNativeHashes(pluginPlatformsFolderPath);
122
121
  this.setPluginNativeHashes({
123
122
  pathToPluginsBuildFile,
124
123
  pluginData,
@@ -128,20 +127,6 @@ class PluginsService {
128
127
  }
129
128
  }
130
129
  }
131
- getPluginNativeFilesPath(pluginData, platform, pluginPlatformsFolderPath) {
132
- if (this.$fs.exists(pluginPlatformsFolderPath)) {
133
- return pluginPlatformsFolderPath;
134
- }
135
- if (this.$mobileHelper.ismacOSPlatform(platform)) {
136
- const iosSourcePath = path.join(pluginData.pluginPlatformsFolderPath("ios" /* constants.PlatformTypes.ios */), "src");
137
- if (this.$fs.exists(iosSourcePath)) {
138
- // For macOS, allow iOS native source fallback only.
139
- // Binary framework/static library discovery remains strict to `platforms/macos`.
140
- return iosSourcePath;
141
- }
142
- }
143
- return null;
144
- }
145
130
  async ensureAllDependenciesAreInstalled(projectData) {
146
131
  const packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath(projectData.projectDir));
147
132
  const allDependencies = _.keys(packageJsonContent.dependencies).concat(_.keys(packageJsonContent.devDependencies));
@@ -435,12 +420,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
435
420
  const installedFrameworkVersion = this.getInstalledFrameworkVersion(platform, projectData);
436
421
  const pluginPlatformsData = pluginData.platformsData;
437
422
  if (pluginPlatformsData) {
438
- let versionRequiredByPlugin = pluginPlatformsData[platform];
439
- if (!versionRequiredByPlugin &&
440
- this.$mobileHelper.ismacOSPlatform(platform)) {
441
- // Keep macOS compatible with existing iOS plugin declarations.
442
- versionRequiredByPlugin = pluginPlatformsData["ios" /* constants.PlatformTypes.ios */];
443
- }
423
+ const versionRequiredByPlugin = pluginPlatformsData[platform];
444
424
  if (!versionRequiredByPlugin) {
445
425
  this.$logger.warn(`${pluginData.name} is not supported for ${platform}.`);
446
426
  isValid = false;
@@ -44,23 +44,12 @@ class ProjectChangesService {
44
44
  const isNewPrepareInfo = await this.ensurePrepareInfo(platformData, projectData, prepareData);
45
45
  if (!isNewPrepareInfo) {
46
46
  let platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, platformData.normalizedPlatformName);
47
- const visionOSPlatformName = this.$devicePlatformsConstants.visionOS &&
48
- this.$devicePlatformsConstants.visionOS.toLowerCase();
49
- const macOSPlatformName = this.$devicePlatformsConstants.macOS &&
50
- this.$devicePlatformsConstants.macOS.toLowerCase();
51
- const iOSPlatformName = this.$devicePlatformsConstants.iOS || "iOS";
52
47
  if (!this.$fs.exists(platformResourcesDir) &&
53
- (platformData.platformNameLowerCase === visionOSPlatformName ||
54
- platformData.platformNameLowerCase === macOSPlatformName)) {
55
- platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, iOSPlatformName);
56
- }
57
- if (this.$fs.exists(platformResourcesDir)) {
58
- this._changesInfo.appResourcesChanged = this.containsNewerFiles(platformResourcesDir, projectData);
59
- }
60
- else {
61
- this.$logger.trace(`App resources path does not exist: ${platformResourcesDir}`);
62
- this._changesInfo.appResourcesChanged = false;
48
+ platformData.platformNameLowerCase ===
49
+ this.$devicePlatformsConstants.visionOS.toLowerCase()) {
50
+ platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS);
63
51
  }
52
+ this._changesInfo.appResourcesChanged = this.containsNewerFiles(platformResourcesDir, projectData);
64
53
  this.$nodeModulesDependenciesBuilder
65
54
  .getProductionDependencies(projectData.projectDir, projectData.ignoredDependencies)
66
55
  .filter((dep) => dep.nativescript &&
@@ -357,9 +357,7 @@ class ProjectDataService {
357
357
  const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
358
358
  const runtimeName = platform === "android" /* PlatformTypes.android */
359
359
  ? constants.TNS_ANDROID_RUNTIME_NAME
360
- : platform === "macos" /* PlatformTypes.macos */
361
- ? constants.SCOPED_MACOS_RUNTIME_NAME
362
- : constants.TNS_IOS_RUNTIME_NAME;
360
+ : constants.TNS_IOS_RUNTIME_NAME;
363
361
  if (packageJson &&
364
362
  packageJson.nativescript &&
365
363
  packageJson.nativescript[runtimeName] &&
@@ -393,12 +391,8 @@ class ProjectDataService {
393
391
  else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
394
392
  return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
395
393
  }
396
- else if (platform === "macos" /* constants.PlatformTypes.macos */) {
397
- return d.name === constants.SCOPED_MACOS_RUNTIME_NAME;
398
- }
399
394
  });
400
395
  if (runtimePackage) {
401
- const originalVersion = runtimePackage.version;
402
396
  const coerced = semver.coerce(runtimePackage.version);
403
397
  const isRange = !!coerced && coerced.version !== runtimePackage.version;
404
398
  const isTag = !coerced;
@@ -415,13 +409,7 @@ class ProjectDataService {
415
409
  runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
416
410
  }
417
411
  catch (err) {
418
- // Keep local file/tgz runtime specs even if the package is not yet
419
- // installed in node_modules. `npm install <name>@<file:...>` works.
420
- if ((originalVersion === null || originalVersion === void 0 ? void 0 : originalVersion.startsWith("file:")) ||
421
- (originalVersion === null || originalVersion === void 0 ? void 0 : originalVersion.includes("tgz"))) {
422
- runtimePackage.version = originalVersion;
423
- }
424
- else if (isRange) {
412
+ if (isRange) {
425
413
  runtimePackage.version = semver.coerce(runtimePackage.version).version;
426
414
  runtimePackage._coerced = true;
427
415
  }
@@ -452,12 +440,6 @@ class ProjectDataService {
452
440
  version: null,
453
441
  };
454
442
  }
455
- else if (platform === "macos" /* constants.PlatformTypes.macos */) {
456
- return {
457
- name: constants.SCOPED_MACOS_RUNTIME_NAME,
458
- version: null,
459
- };
460
- }
461
443
  }
462
444
  getNsConfigDefaultContent(data) {
463
445
  const config = this.getNsConfigDefaultObject(data);
@@ -76,7 +76,6 @@ class VersionsService {
76
76
  async getRuntimesVersions(platform) {
77
77
  const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios" /* constants.PlatformTypes.ios */);
78
78
  const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android" /* constants.PlatformTypes.android */);
79
- const macOSRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "macos" /* constants.PlatformTypes.macos */);
80
79
  let runtimes = [];
81
80
  if (!platform) {
82
81
  runtimes = [iosRuntime, androidRuntime];
@@ -87,9 +86,6 @@ class VersionsService {
87
86
  else if (platform === "android" /* PlatformTypes.android */) {
88
87
  runtimes.push(androidRuntime);
89
88
  }
90
- else if (platform === "macos" /* PlatformTypes.macos */) {
91
- runtimes.push(macOSRuntime);
92
- }
93
89
  const runtimesVersions = await Promise.all(runtimes.map(async (runtime) => {
94
90
  const latestVersion = await this.$packageInstallationManager.getLatestVersion(runtime.name);
95
91
  const runtimeInformation = {
@@ -117,16 +117,36 @@ class ConfigTransformer {
117
117
  }
118
118
  return `{}`;
119
119
  }
120
+ isBooleanLiteralNode(initializer) {
121
+ return ((initializer === null || initializer === void 0 ? void 0 : initializer.getKind()) === ts_morph_1.SyntaxKind.TrueKeyword ||
122
+ (initializer === null || initializer === void 0 ? void 0 : initializer.getKind()) === ts_morph_1.SyntaxKind.FalseKeyword);
123
+ }
124
+ replaceInitializer(initializer, newValue) {
125
+ return initializer.replaceWithText(this.createInitializer(newValue));
126
+ }
120
127
  setInitializerValue(initializer, newValue) {
121
128
  if (ts_morph_1.Node.isStringLiteral(initializer)) {
129
+ if (typeof newValue !== "string") {
130
+ return this.replaceInitializer(initializer, newValue);
131
+ }
122
132
  return initializer.setLiteralValue(newValue);
123
133
  }
124
134
  if (ts_morph_1.Node.isNumericLiteral(initializer)) {
135
+ if (typeof newValue !== "number") {
136
+ return this.replaceInitializer(initializer, newValue);
137
+ }
125
138
  return initializer.setLiteralValue(newValue);
126
139
  }
127
- if (ts_morph_1.Node.isBooleanKeyword(initializer)) {
140
+ if (this.isBooleanLiteralNode(initializer)) {
141
+ if (typeof newValue !== "boolean") {
142
+ return this.replaceInitializer(initializer, newValue);
143
+ }
128
144
  return initializer.setLiteralValue(newValue);
129
145
  }
146
+ if (ts_morph_1.Node.isArrayLiteralExpression(initializer) ||
147
+ ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
148
+ return this.replaceInitializer(initializer, newValue);
149
+ }
130
150
  if (ts_morph_1.Node.isIdentifier(initializer)) {
131
151
  return this.setIdentifierValue(initializer, newValue);
132
152
  }
@@ -139,9 +159,25 @@ class ConfigTransformer {
139
159
  if (ts_morph_1.Node.isNumericLiteral(initializer)) {
140
160
  return initializer.getLiteralValue();
141
161
  }
142
- if (ts_morph_1.Node.isBooleanKeyword(initializer)) {
162
+ if (this.isBooleanLiteralNode(initializer)) {
143
163
  return initializer.getLiteralValue();
144
164
  }
165
+ if (ts_morph_1.Node.isArrayLiteralExpression(initializer)) {
166
+ return initializer
167
+ .getElements()
168
+ .map((element) => this.getInitializerValue(element));
169
+ }
170
+ if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
171
+ const result = {};
172
+ for (const property of initializer.getProperties()) {
173
+ if (!ts_morph_1.Node.isPropertyAssignment(property)) {
174
+ continue;
175
+ }
176
+ const name = property.getNameNode().getText().replace(/['\"]/g, "");
177
+ result[name] = this.getInitializerValue(property.getInitializerOrThrow());
178
+ }
179
+ return result;
180
+ }
145
181
  if (ts_morph_1.Node.isIdentifier(initializer)) {
146
182
  return this.getIdentifierValue(initializer);
147
183
  }
@@ -176,9 +212,25 @@ class ConfigTransformer {
176
212
  if (ts_morph_1.Node.isNumericLiteral(initializer)) {
177
213
  return initializer.getLiteralValue();
178
214
  }
179
- if (ts_morph_1.Node.isBooleanKeyword(initializer)) {
215
+ if (this.isBooleanLiteralNode(initializer)) {
180
216
  return initializer.getLiteralValue();
181
217
  }
218
+ if (ts_morph_1.Node.isArrayLiteralExpression(initializer)) {
219
+ return initializer
220
+ .getElements()
221
+ .map((element) => this.getInitializerValue(element));
222
+ }
223
+ if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
224
+ const result = {};
225
+ for (const property of initializer.getProperties()) {
226
+ if (!ts_morph_1.Node.isPropertyAssignment(property)) {
227
+ continue;
228
+ }
229
+ const name = property.getNameNode().getText().replace(/['\"]/g, "");
230
+ result[name] = this.getInitializerValue(property.getInitializerOrThrow());
231
+ }
232
+ return result;
233
+ }
182
234
  if (ts_morph_1.Node.isIdentifier(initializer)) {
183
235
  return this.getIdentifierValue(initializer);
184
236
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativescript",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "9.1.0-alpha.0",
4
+ "version": "9.1.0-alpha.2",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
@@ -56,14 +56,13 @@
56
56
  "dependencies": {
57
57
  "@foxt/js-srp": "0.0.3-patch2",
58
58
  "@nativescript/doctor": "2.0.17",
59
- "@nativescript/hook": "3.0.4",
59
+ "@nativescript/hook": "3.0.5",
60
60
  "@npmcli/arborist": "9.1.8",
61
- "@rigor789/resolve-package-path": "1.0.7",
62
61
  "@nstudio/trapezedev-project": "7.2.3",
63
- "archiver": "7.0.1",
64
- "axios": "1.13.2",
62
+ "@rigor789/resolve-package-path": "1.0.7",
63
+ "axios": "1.13.5",
65
64
  "byline": "5.0.0",
66
- "chokidar": "4.0.3",
65
+ "chokidar": "^3.6.0",
67
66
  "cli-table3": "0.6.5",
68
67
  "color": "4.2.3",
69
68
  "convert-source-map": "2.0.0",
@@ -75,11 +74,11 @@
75
74
  "ios-mobileprovision-finder": "1.2.1",
76
75
  "ios-sim-portable": "4.5.1",
77
76
  "jimp": "1.6.0",
78
- "lodash": "4.17.21",
77
+ "lodash": "4.17.23",
79
78
  "log4js": "6.9.1",
80
79
  "marked": "15.0.12",
81
80
  "marked-terminal": "7.3.0",
82
- "minimatch": "10.1.1",
81
+ "minimatch": "10.2.4",
83
82
  "mkdirp": "3.0.1",
84
83
  "mute-stream": "2.0.0",
85
84
  "nativescript-dev-xcode": "0.8.1",
@@ -100,7 +99,7 @@
100
99
  "simple-git": "3.30.0",
101
100
  "simple-plist": "1.4.0",
102
101
  "source-map": "0.7.6",
103
- "tar": "7.5.2",
102
+ "tar": "7.5.9",
104
103
  "ts-morph": "25.0.1",
105
104
  "tunnel": "0.0.6",
106
105
  "typescript": "5.7.3",
@@ -109,16 +108,16 @@
109
108
  "winreg": "1.2.5",
110
109
  "ws": "8.18.3",
111
110
  "xml2js": "0.6.2",
112
- "yargs": "17.7.2"
111
+ "yargs": "17.7.2",
112
+ "yazl": "^3.3.1"
113
113
  },
114
114
  "devDependencies": {
115
- "@types/archiver": "^6.0.3",
116
115
  "@types/byline": "^4.2.36",
117
116
  "@types/chai": "5.2.2",
118
117
  "@types/chai-as-promised": "8.0.2",
119
118
  "@types/color": "4.2.0",
120
119
  "@types/convert-source-map": "2.0.3",
121
- "@types/lodash": "4.17.21",
120
+ "@types/lodash": "4.17.23",
122
121
  "@types/marked-terminal": "^6.1.1",
123
122
  "@types/node": "^22.0.0",
124
123
  "@types/npmcli__arborist": "^6.3.0",
@@ -139,10 +138,12 @@
139
138
  "@types/ws": "8.18.1",
140
139
  "@types/xml2js": "0.4.14",
141
140
  "@types/yargs": "17.0.33",
141
+ "@types/yazl": "^3.3.0",
142
142
  "braces": ">=3.0.3",
143
143
  "chai": "5.3.3",
144
144
  "chai-as-promised": "8.0.2",
145
145
  "conventional-changelog-cli": "^5.0.0",
146
+ "fast-check": "3.23.2",
146
147
  "grunt": "1.6.1",
147
148
  "grunt-contrib-clean": "2.0.1",
148
149
  "grunt-contrib-copy": "1.0.0",
@@ -162,11 +163,21 @@
162
163
  "fsevents": "*"
163
164
  },
164
165
  "overrides": {
166
+ "@conventional-changelog/git-client": "2.5.1",
165
167
  "jimp": {
166
168
  "xml2js": "0.6.2"
167
169
  },
168
170
  "npm-watch": {
169
171
  "nodemon": "3.0.3"
172
+ },
173
+ "grunt": {
174
+ "minimatch": "3.1.5"
175
+ },
176
+ "globule": {
177
+ "minimatch": "3.1.5"
178
+ },
179
+ "replace": {
180
+ "minimatch": "3.1.5"
170
181
  }
171
182
  },
172
183
  "analyze": true,