nativescript 8.9.3-dev.1 → 8.9.3-dev.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.
package/lib/.d.ts CHANGED
@@ -344,6 +344,8 @@
344
344
  /// <reference path="services/build-artifacts-service.ts" />
345
345
  /// <reference path="services/build-data-service.ts" />
346
346
  /// <reference path="services/build-info-file-service.ts" />
347
+ /// <reference path="services/bundler/bundler-compiler-service.ts" />
348
+ /// <reference path="services/bundler/bundler.ts" />
347
349
  /// <reference path="services/cleanup-service.ts" />
348
350
  /// <reference path="services/cocoapods-platform-manager.ts" />
349
351
  /// <reference path="services/cocoapods-service.ts" />
@@ -419,8 +421,6 @@
419
421
  /// <reference path="services/user-settings-service.ts" />
420
422
  /// <reference path="services/versions-service.ts" />
421
423
  /// <reference path="services/watch-ignore-list-service.ts" />
422
- /// <reference path="services/webpack/webpack-compiler-service.ts" />
423
- /// <reference path="services/webpack/webpack.d.ts" />
424
424
  /// <reference path="services/xcconfig-service.ts" />
425
425
  /// <reference path="services/xcproj-service.ts" />
426
426
  /// <reference path="shared-event-bus.ts" />
@@ -465,6 +465,7 @@
465
465
  /// <reference path="../test/services/android-plugin-build-service.ts" />
466
466
  /// <reference path="../test/services/android-project-service.ts" />
467
467
  /// <reference path="../test/services/android/gradle-build-args-service.ts" />
468
+ /// <reference path="../test/services/bundler/bundler-compiler-service.ts" />
468
469
  /// <reference path="../test/services/doctor-service.ts" />
469
470
  /// <reference path="../test/services/extensibility-service.ts" />
470
471
  /// <reference path="../test/services/ios-debugger-port-service.ts" />
@@ -487,7 +488,6 @@
487
488
  /// <reference path="../test/services/project-data-service.ts" />
488
489
  /// <reference path="../test/services/test-execution-service.ts" />
489
490
  /// <reference path="../test/services/user-settings-service.ts" />
490
- /// <reference path="../test/services/webpack/webpack-compiler-service.ts" />
491
491
  /// <reference path="../test/stubs.ts" />
492
492
  /// <reference path="../test/sys-info.ts" />
493
493
  /// <reference path="../test/test-bootstrap.ts" />
package/lib/bootstrap.js CHANGED
@@ -185,7 +185,7 @@ yok_1.injector.require("qrCodeTerminalService", "./services/qr-code-terminal-ser
185
185
  yok_1.injector.require("testInitializationService", "./services/test-initialization-service");
186
186
  yok_1.injector.require("networkConnectivityValidator", "./helpers/network-connectivity-validator");
187
187
  yok_1.injector.requirePublic("cleanupService", "./services/cleanup-service");
188
- yok_1.injector.require("webpackCompilerService", "./services/webpack/webpack-compiler-service");
188
+ yok_1.injector.require("bundlerCompilerService", "./services/bundler/bundler-compiler-service");
189
189
  yok_1.injector.require("applePortalSessionService", "./services/apple-portal/apple-portal-session-service");
190
190
  yok_1.injector.require("applePortalCookieService", "./services/apple-portal/apple-portal-cookie-service");
191
191
  yok_1.injector.require("applePortalApplicationService", "./services/apple-portal/apple-portal-application-service");
package/lib/constants.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OUTPUTS_DIR = exports.BUILD_DIR = exports.BUILD_XCCONFIG_FILE_NAME = exports.INCLUDE_GRADLE_NAME = exports.INFO_PLIST_FILE_NAME = exports.APP_GRADLE_FILE_NAME = exports.MANIFEST_FILE_NAME = exports.ANDROID_ANALYTICS_DATA_FILE = exports.ANDROID_ANALYTICS_DATA_DIR = exports.FONTS_DIR = exports.ASSETS_DIR = exports.MAIN_DIR = exports.SRC_DIR = exports.AWAIT_NOTIFICATION_TIMEOUT_SECONDS = exports.CODE_SIGN_ENTITLEMENTS = exports.LIB_DIR_NAME = exports.KARMA_CONFIG_NAME = exports.TSCCONFIG_TNS_JSON_NAME = exports.WEBPACK_CONFIG_NAME = exports.HOOKS_DIR_NAME = exports.PLATFORMS_DIR_NAME = exports.XML_FILE_EXTENSION = exports.LIVESYNC_EXCLUDED_FILE_PATTERNS = exports.TEST_RUNNER_NAME = exports.TESTING_FRAMEWORKS = exports.LIVESYNC_EXCLUDED_DIRECTORIES = exports.DEFAULT_APP_IDENTIFIER_PREFIX = exports.NODE_MODULE_CACHE_PATH_KEY_NAME = exports.ANDROID_DEVICE_APP_ROOT_TEMPLATE = exports.PACKAGE_LOCK_JSON_FILE_NAME = exports.PACKAGE_JSON_FILE_NAME = exports.SCOPED_VISIONOS_RUNTIME_NAME = exports.SCOPED_IOS_RUNTIME_NAME = exports.SCOPED_ANDROID_RUNTIME_NAME = exports.TNS_IOS_RUNTIME_NAME = exports.TNS_ANDROID_RUNTIME_NAME = exports.UI_MOBILE_BASE_NAME = exports.TNS_CORE_MODULES_WIDGETS_NAME = exports.WEBPACK_PLUGIN_NAME = exports.SCOPED_TNS_CORE_THEME_NAME = exports.TNS_CORE_THEME_NAME = exports.SCOPED_TNS_CORE_MODULES = exports.TNS_CORE_MODULES_NAME = exports.TNS_MODULES_FOLDER_NAME = exports.NODE_MODULES_FOLDER_NAME = exports.NATIVESCRIPT_KEY_NAME = exports.NS_BASE_PODFILE = exports.PROJECT_FRAMEWORK_FOLDER_NAME = exports.APP_RESOURCES_FOLDER_NAME = exports.APP_FOLDER_NAME = void 0;
4
- exports.CONNECTION_ERROR_EVENT_NAME = exports.BUILD_OUTPUT_EVENT_NAME = exports.ProjectTypes = exports.JsFlavorName = exports.TsFlavorName = exports.SvelteFlavorName = exports.SolidFlavorName = exports.ReactFlavorName = exports.VueFlavorName = exports.NgFlavorName = exports.SVELTE_NAME = exports.SOLID_NAME = exports.REACT_NAME = exports.TYPESCRIPT_NAME = exports.JAVASCRIPT_NAME = exports.ANGULAR_NAME = exports.VUE_NAME = exports.ItunesConnectApplicationTypes = exports.androidAppResourcesFolderName = exports.iOSAppResourcesFolderName = exports.ITMSConstants = exports.ANALYTICS_LOCAL_TEMPLATE_PREFIX = exports.RESERVED_TEMPLATE_NAMES = exports.ReleaseType = exports.SaveOptions = exports.TemplatesV2PackageJsonKeysToRemove = exports.PackageJsonKeysToKeep = exports.LiveSyncTrackActionNames = exports.PackageVersion = exports.MetadataFilteringConstants = exports.IOS_WATCHAPP_EXTENSION_FOLDER = exports.IOS_WATCHAPP_FOLDER = exports.NATIVE_EXTENSION_FOLDER = exports.APPLICATION_RESPONSE_TIMEOUT_SECONDS = exports.NATIVE_SOURCE_FOLDER = exports.TNS_NATIVE_SOURCE_GROUP_NAME = exports.HASHES_FILE_NAME = exports.APKS_EXTENSION_NAME = exports.AAB_EXTENSION_NAME = exports.APK_EXTENSION_NAME = exports.DEPENDENCIES_JSON_NAME = exports.CONFIG_FILE_NAME_TS = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_DISPLAY = exports.CONFIG_NS_APP_ENTRY = exports.CONFIG_NS_APP_RESOURCES_ENTRY = exports.CONFIG_NS_FILE_NAME = exports.RESOURCES_DIR = exports.BUNDLE_DIR = exports.APK_DIR = void 0;
5
- exports.PackageManagers = exports.EMIT_APPENDER_EVENT_NAME = exports.LoggerConfigData = exports.LoggerLevel = exports.DeviceConnectionType = exports.LoggerAppenders = exports.IOSNativeTargetTypes = exports.IOSNativeTargetProductTypes = exports.IOSDeviceTargets = exports.RunOnDeviceEvents = exports.AndroidAppBundleMessages = exports.AndroidBundleValidatorMessages = exports.BundleValidatorMessages = exports.IosProjectConstants = exports.EXTENSION_PROVISIONING_FILENAME = exports.PODFILE_NAME = exports.PLUGINS_BUILD_DATA_FILENAME = exports.PLUGIN_BUILD_DATA_FILENAME = exports.AddPlaformErrors = exports.PACKAGE_PLACEHOLDER_NAME = exports.AndroidBuildDefaults = exports.Hooks = exports.XcodeDeprecationStringFormat = exports.MacOSDeprecationStringFormat = exports.MacOSVersions = exports.AssetConstants = exports.CLI_RESOURCES_DIR_NAME = exports.NATIVESCRIPT_PROPS_INTERNAL_DELIMITER = exports.AnalyticsEventLabelDelimiter = exports.DebugCommandErrors = exports.WEBPACK_COMPILATION_COMPLETE = exports.PREPARE_READY_EVENT_NAME = exports.INITIAL_SYNC_EVENT_NAME = exports.FILES_CHANGE_EVENT_NAME = exports.CACACHE_DIRECTORY_NAME = exports.ANDROID_APP_BUNDLE_SIGNING_ERROR_MESSAGE = exports.ANDROID_RELEASE_BUILD_ERROR_MESSAGE = exports.POST_INSTALL_COMMAND_NAME = exports.INSPECTOR_CACHE_DIRNAME = exports.VERSION_STRING = exports.DEBUGGER_DETACHED_EVENT_NAME = exports.DEBUGGER_ATTACHED_EVENT_NAME = exports.USER_INTERACTION_NEEDED_EVENT_NAME = void 0;
3
+ exports.BUILD_XCCONFIG_FILE_NAME = exports.INCLUDE_GRADLE_NAME = exports.INFO_PLIST_FILE_NAME = exports.APP_GRADLE_FILE_NAME = exports.MANIFEST_FILE_NAME = exports.ANDROID_ANALYTICS_DATA_FILE = exports.ANDROID_ANALYTICS_DATA_DIR = exports.FONTS_DIR = exports.ASSETS_DIR = exports.MAIN_DIR = exports.SRC_DIR = exports.AWAIT_NOTIFICATION_TIMEOUT_SECONDS = exports.CODE_SIGN_ENTITLEMENTS = exports.LIB_DIR_NAME = exports.KARMA_CONFIG_NAME = exports.TSCCONFIG_TNS_JSON_NAME = exports.RSPACK_CONFIG_NAME = exports.WEBPACK_CONFIG_NAME = exports.HOOKS_DIR_NAME = exports.PLATFORMS_DIR_NAME = exports.XML_FILE_EXTENSION = exports.LIVESYNC_EXCLUDED_FILE_PATTERNS = exports.TEST_RUNNER_NAME = exports.TESTING_FRAMEWORKS = exports.LIVESYNC_EXCLUDED_DIRECTORIES = exports.DEFAULT_APP_IDENTIFIER_PREFIX = exports.NODE_MODULE_CACHE_PATH_KEY_NAME = exports.ANDROID_DEVICE_APP_ROOT_TEMPLATE = exports.PACKAGE_LOCK_JSON_FILE_NAME = exports.PACKAGE_JSON_FILE_NAME = exports.SCOPED_VISIONOS_RUNTIME_NAME = exports.SCOPED_IOS_RUNTIME_NAME = exports.SCOPED_ANDROID_RUNTIME_NAME = exports.TNS_IOS_RUNTIME_NAME = exports.TNS_ANDROID_RUNTIME_NAME = exports.UI_MOBILE_BASE_NAME = exports.TNS_CORE_MODULES_WIDGETS_NAME = exports.RSPACK_PLUGIN_NAME = exports.WEBPACK_PLUGIN_NAME = exports.SCOPED_TNS_CORE_THEME_NAME = exports.TNS_CORE_THEME_NAME = exports.SCOPED_TNS_CORE_MODULES = exports.TNS_CORE_MODULES_NAME = exports.TNS_MODULES_FOLDER_NAME = exports.NODE_MODULES_FOLDER_NAME = exports.NATIVESCRIPT_KEY_NAME = exports.NS_BASE_PODFILE = exports.PROJECT_FRAMEWORK_FOLDER_NAME = exports.APP_RESOURCES_FOLDER_NAME = exports.APP_FOLDER_NAME = void 0;
4
+ exports.ProjectTypes = exports.JsFlavorName = exports.TsFlavorName = exports.SvelteFlavorName = exports.SolidFlavorName = exports.ReactFlavorName = exports.VueFlavorName = exports.NgFlavorName = exports.SVELTE_NAME = exports.SOLID_NAME = exports.REACT_NAME = exports.TYPESCRIPT_NAME = exports.JAVASCRIPT_NAME = exports.ANGULAR_NAME = exports.VUE_NAME = exports.ItunesConnectApplicationTypes = exports.androidAppResourcesFolderName = exports.iOSAppResourcesFolderName = exports.ITMSConstants = exports.ANALYTICS_LOCAL_TEMPLATE_PREFIX = exports.RESERVED_TEMPLATE_NAMES = exports.ReleaseType = exports.SaveOptions = exports.TemplatesV2PackageJsonKeysToRemove = exports.PackageJsonKeysToKeep = exports.LiveSyncTrackActionNames = exports.PackageVersion = exports.MetadataFilteringConstants = exports.IOS_WATCHAPP_EXTENSION_FOLDER = exports.IOS_WATCHAPP_FOLDER = exports.NATIVE_EXTENSION_FOLDER = exports.APPLICATION_RESPONSE_TIMEOUT_SECONDS = exports.NATIVE_SOURCE_FOLDER = exports.TNS_NATIVE_SOURCE_GROUP_NAME = exports.HASHES_FILE_NAME = exports.APKS_EXTENSION_NAME = exports.AAB_EXTENSION_NAME = exports.APK_EXTENSION_NAME = exports.DEPENDENCIES_JSON_NAME = exports.CONFIG_FILE_NAME_TS = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_DISPLAY = exports.CONFIG_NS_APP_ENTRY = exports.CONFIG_NS_APP_RESOURCES_ENTRY = exports.CONFIG_NS_FILE_NAME = exports.RESOURCES_DIR = exports.BUNDLE_DIR = exports.APK_DIR = exports.OUTPUTS_DIR = exports.BUILD_DIR = void 0;
5
+ exports.PackageManagers = exports.EMIT_APPENDER_EVENT_NAME = exports.LoggerConfigData = exports.LoggerLevel = exports.DeviceConnectionType = exports.LoggerAppenders = exports.IOSNativeTargetTypes = exports.IOSNativeTargetProductTypes = exports.IOSDeviceTargets = exports.RunOnDeviceEvents = exports.AndroidAppBundleMessages = exports.AndroidBundleValidatorMessages = exports.BundleValidatorMessages = exports.IosProjectConstants = exports.EXTENSION_PROVISIONING_FILENAME = exports.PODFILE_NAME = exports.PLUGINS_BUILD_DATA_FILENAME = exports.PLUGIN_BUILD_DATA_FILENAME = exports.AddPlaformErrors = exports.PACKAGE_PLACEHOLDER_NAME = exports.AndroidBuildDefaults = exports.Hooks = exports.XcodeDeprecationStringFormat = exports.MacOSDeprecationStringFormat = exports.MacOSVersions = exports.AssetConstants = exports.CLI_RESOURCES_DIR_NAME = exports.NATIVESCRIPT_PROPS_INTERNAL_DELIMITER = exports.AnalyticsEventLabelDelimiter = exports.DebugCommandErrors = exports.BUNDLER_COMPILATION_COMPLETE = exports.PREPARE_READY_EVENT_NAME = exports.INITIAL_SYNC_EVENT_NAME = exports.FILES_CHANGE_EVENT_NAME = exports.CACACHE_DIRECTORY_NAME = exports.ANDROID_APP_BUNDLE_SIGNING_ERROR_MESSAGE = exports.ANDROID_RELEASE_BUILD_ERROR_MESSAGE = exports.POST_INSTALL_COMMAND_NAME = exports.INSPECTOR_CACHE_DIRNAME = exports.VERSION_STRING = exports.DEBUGGER_DETACHED_EVENT_NAME = exports.DEBUGGER_ATTACHED_EVENT_NAME = exports.USER_INTERACTION_NEEDED_EVENT_NAME = exports.CONNECTION_ERROR_EVENT_NAME = exports.BUILD_OUTPUT_EVENT_NAME = void 0;
6
6
  const path_1 = require("path");
7
7
  exports.APP_FOLDER_NAME = "app";
8
8
  exports.APP_RESOURCES_FOLDER_NAME = "App_Resources";
@@ -16,6 +16,7 @@ exports.SCOPED_TNS_CORE_MODULES = "@nativescript/core";
16
16
  exports.TNS_CORE_THEME_NAME = "nativescript-theme-core";
17
17
  exports.SCOPED_TNS_CORE_THEME_NAME = "@nativescript/theme";
18
18
  exports.WEBPACK_PLUGIN_NAME = "@nativescript/webpack";
19
+ exports.RSPACK_PLUGIN_NAME = "@nativescript/rspack";
19
20
  exports.TNS_CORE_MODULES_WIDGETS_NAME = "tns-core-modules-widgets";
20
21
  exports.UI_MOBILE_BASE_NAME = "@nativescript/ui-mobile-base";
21
22
  exports.TNS_ANDROID_RUNTIME_NAME = "tns-android";
@@ -36,6 +37,7 @@ exports.XML_FILE_EXTENSION = ".xml";
36
37
  exports.PLATFORMS_DIR_NAME = "platforms";
37
38
  exports.HOOKS_DIR_NAME = "hooks";
38
39
  exports.WEBPACK_CONFIG_NAME = "webpack.config.js";
40
+ exports.RSPACK_CONFIG_NAME = "rspack.config.js";
39
41
  exports.TSCCONFIG_TNS_JSON_NAME = "tsconfig.tns.json";
40
42
  exports.KARMA_CONFIG_NAME = "karma.conf.js";
41
43
  exports.LIB_DIR_NAME = "lib";
@@ -214,7 +216,7 @@ exports.CACACHE_DIRECTORY_NAME = "_cacache";
214
216
  exports.FILES_CHANGE_EVENT_NAME = "filesChangeEvent";
215
217
  exports.INITIAL_SYNC_EVENT_NAME = "initialSyncEvent";
216
218
  exports.PREPARE_READY_EVENT_NAME = "prepareReadyEvent";
217
- exports.WEBPACK_COMPILATION_COMPLETE = "webpackCompilationComplete";
219
+ exports.BUNDLER_COMPILATION_COMPLETE = "bundlerCompilationComplete";
218
220
  class DebugCommandErrors {
219
221
  }
220
222
  exports.DebugCommandErrors = DebugCommandErrors;
@@ -16,7 +16,7 @@ const helpers_1 = require("../common/helpers");
16
16
  const yok_1 = require("../common/yok");
17
17
  const constants_1 = require("../constants");
18
18
  class PrepareController extends events_1.EventEmitter {
19
- constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
19
+ constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $bundlerCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
20
20
  super();
21
21
  this.$platformController = $platformController;
22
22
  this.$hooksService = $hooksService;
@@ -30,7 +30,7 @@ class PrepareController extends events_1.EventEmitter {
30
30
  this.$prepareNativePlatformService = $prepareNativePlatformService;
31
31
  this.$projectChangesService = $projectChangesService;
32
32
  this.$projectDataService = $projectDataService;
33
- this.$webpackCompilerService = $webpackCompilerService;
33
+ this.$bundlerCompilerService = $bundlerCompilerService;
34
34
  this.$watchIgnoreListService = $watchIgnoreListService;
35
35
  this.$analyticsService = $analyticsService;
36
36
  this.$markingModeService = $markingModeService;
@@ -66,8 +66,8 @@ class PrepareController extends events_1.EventEmitter {
66
66
  this.watchersData[projectDir] &&
67
67
  this.watchersData[projectDir][platformLowerCase] &&
68
68
  this.watchersData[projectDir][platformLowerCase].hasWebpackCompilerProcess) {
69
- await this.$webpackCompilerService.stopWebpackCompiler(platformLowerCase);
70
- this.$webpackCompilerService.removeListener(constants_1.WEBPACK_COMPILATION_COMPLETE, this.webpackCompilerHandler);
69
+ await this.$bundlerCompilerService.stopBundlerCompiler(platformLowerCase);
70
+ this.$bundlerCompilerService.removeListener(constants_1.BUNDLER_COMPILATION_COMPLETE, this.webpackCompilerHandler);
71
71
  this.watchersData[projectDir][platformLowerCase].hasWebpackCompilerProcess = false;
72
72
  }
73
73
  }
@@ -89,7 +89,7 @@ class PrepareController extends events_1.EventEmitter {
89
89
  result = await this.startWatchersWithPrepare(platformData, projectData, prepareData);
90
90
  }
91
91
  else {
92
- await this.$webpackCompilerService.compileWithoutWatch(platformData, projectData, prepareData);
92
+ await this.$bundlerCompilerService.compileWithoutWatch(platformData, projectData, prepareData);
93
93
  const hasNativeChanges = await this.$prepareNativePlatformService.prepareNativePlatform(platformData, projectData, prepareData);
94
94
  result = {
95
95
  hasNativeChanges,
@@ -149,9 +149,9 @@ class PrepareController extends events_1.EventEmitter {
149
149
  }
150
150
  };
151
151
  this.webpackCompilerHandler = handler.bind(this);
152
- this.$webpackCompilerService.on(constants_1.WEBPACK_COMPILATION_COMPLETE, this.webpackCompilerHandler);
152
+ this.$bundlerCompilerService.on(constants_1.BUNDLER_COMPILATION_COMPLETE, this.webpackCompilerHandler);
153
153
  this.watchersData[projectData.projectDir][platformData.platformNameLowerCase].hasWebpackCompilerProcess = true;
154
- await this.$webpackCompilerService.compileWithWatch(platformData, projectData, prepareData);
154
+ await this.$bundlerCompilerService.compileWithWatch(platformData, projectData, prepareData);
155
155
  }
156
156
  }
157
157
  async startNativeWatcherWithPrepare(platformData, projectData, prepareData) {
@@ -293,7 +293,7 @@ class PrepareController extends events_1.EventEmitter {
293
293
  if (this.pausedFileWatch) {
294
294
  for (const watcher of watchers) {
295
295
  for (const platform in watcher) {
296
- await this.$webpackCompilerService.stopWebpackCompiler(platform);
296
+ await this.$bundlerCompilerService.stopBundlerCompiler(platform);
297
297
  watcher[platform].hasWebpackCompilerProcess = false;
298
298
  }
299
299
  }
@@ -303,7 +303,7 @@ class PrepareController extends events_1.EventEmitter {
303
303
  for (const platform in watcher) {
304
304
  const args = watcher[platform].prepareArguments;
305
305
  watcher[platform].hasWebpackCompilerProcess = true;
306
- await this.$webpackCompilerService.compileWithWatch(args.platformData, args.projectData, args.prepareData);
306
+ await this.$bundlerCompilerService.compileWithWatch(args.platformData, args.projectData, args.prepareData);
307
307
  }
308
308
  }
309
309
  }
@@ -121,6 +121,7 @@ export interface IOSLocalSPMPackage extends IOSSPMPackageBase {
121
121
  }
122
122
 
123
123
  export type IOSSPMPackage = IOSRemoteSPMPackage | IOSLocalSPMPackage;
124
+ export type BundlerType = "webpack" | "rspack" | "vite";
124
125
 
125
126
  interface INsConfigIOS extends INsConfigPlaform {
126
127
  discardUncaughtJsExceptions?: boolean;
@@ -183,6 +184,7 @@ interface INsConfig {
183
184
  overridePods?: string;
184
185
  webpackConfigPath?: string;
185
186
  bundlerConfigPath?: string;
187
+ bundler?: BundlerType;
186
188
  ios?: INsConfigIOS;
187
189
  android?: INsConfigAndroid;
188
190
  visionos?: INSConfigVisionOS;
@@ -216,7 +218,16 @@ interface IProjectData extends ICreateProjectData {
216
218
  * Value is true when project has nativescript.config and it has `shared: true` in it.
217
219
  */
218
220
  isShared: boolean;
219
-
221
+ /**
222
+ * Specifies the bundler used to build the application.
223
+ *
224
+ * - `"webpack"`: Uses Webpack for traditional bundling.
225
+ * - `"rspack"`: Uses Rspack for fast bundling.
226
+ * - `"vite"`: Uses Vite for fast bundling.
227
+ *
228
+ * @default "webpack"
229
+ */
230
+ bundler: BundlerType;
220
231
  /**
221
232
  * @deprecated Use bundlerConfigPath
222
233
  * Defines the path to the configuration file passed to webpack process.
@@ -56,6 +56,7 @@ class ProjectData {
56
56
  this.errorInvalidProject(projectDir);
57
57
  }
58
58
  initializeProjectDataFromContent(packageJsonContent, projectDir) {
59
+ var _a, _b;
59
60
  projectDir = projectDir || this.$projectHelper.projectDir || "";
60
61
  this.projectDir = projectDir;
61
62
  const projectFilePath = this.getProjectFilePath(projectDir);
@@ -92,14 +93,15 @@ class ProjectData {
92
93
  this.buildXcconfigPath = path.join(this.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.BUILD_XCCONFIG_FILE_NAME);
93
94
  this.podfilePath = path.join(this.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.PODFILE_NAME);
94
95
  this.isShared = !!(this.nsConfig && this.nsConfig.shared);
95
- this.webpackConfigPath =
96
- this.nsConfig && this.nsConfig.webpackConfigPath
97
- ? path.resolve(this.projectDir, this.nsConfig.webpackConfigPath)
98
- : path.join(this.projectDir, "webpack.config.js");
96
+ const webpackConfigPath = this.nsConfig && this.nsConfig.webpackConfigPath
97
+ ? path.resolve(this.projectDir, this.nsConfig.webpackConfigPath)
98
+ : path.join(this.projectDir, "webpack.config.js");
99
+ this.webpackConfigPath = webpackConfigPath;
99
100
  this.bundlerConfigPath =
100
101
  this.nsConfig && this.nsConfig.bundlerConfigPath
101
102
  ? path.resolve(this.projectDir, this.nsConfig.bundlerConfigPath)
102
- : null;
103
+ : webpackConfigPath;
104
+ this.bundler = (_b = (_a = this === null || this === void 0 ? void 0 : this.nsConfig) === null || _a === void 0 ? void 0 : _a.bundler) !== null && _b !== void 0 ? _b : "webpack";
103
105
  return;
104
106
  }
105
107
  this.errorInvalidProject(projectDir);
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.WebpackCompilerService = void 0;
9
+ exports.BundlerCompilerService = void 0;
10
10
  const path = require("path");
11
11
  const semver = require("semver");
12
12
  const _ = require("lodash");
@@ -15,7 +15,7 @@ const decorators_1 = require("../../common/decorators");
15
15
  const constants_1 = require("../../constants");
16
16
  const yok_1 = require("../../common/yok");
17
17
  const package_path_helper_1 = require("../../helpers/package-path-helper");
18
- class WebpackCompilerService extends events_1.EventEmitter {
18
+ class BundlerCompilerService extends events_1.EventEmitter {
19
19
  constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, $projectConfigService) {
20
20
  super();
21
21
  this.$options = $options;
@@ -30,19 +30,19 @@ class WebpackCompilerService extends events_1.EventEmitter {
30
30
  this.$packageManager = $packageManager;
31
31
  this.$packageInstallationManager = $packageInstallationManager;
32
32
  this.$projectConfigService = $projectConfigService;
33
- this.webpackProcesses = {};
33
+ this.bundlerProcesses = {};
34
34
  this.expectedHashes = {};
35
35
  }
36
36
  async compileWithWatch(platformData, projectData, prepareData) {
37
37
  return new Promise(async (resolve, reject) => {
38
- if (this.webpackProcesses[platformData.platformNameLowerCase]) {
38
+ if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
39
39
  resolve(void 0);
40
40
  return;
41
41
  }
42
- let isFirstWebpackWatchCompilation = true;
42
+ let isFirstBundlerWatchCompilation = true;
43
43
  prepareData.watch = true;
44
44
  try {
45
- const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
45
+ const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
46
46
  childProcess.stdout.on("data", function (data) {
47
47
  process.stdout.write(data);
48
48
  });
@@ -50,25 +50,26 @@ class WebpackCompilerService extends events_1.EventEmitter {
50
50
  process.stderr.write(data);
51
51
  });
52
52
  childProcess.on("message", (message) => {
53
- this.$logger.trace("Message from webpack", message);
53
+ this.$logger.trace(`Message from ${projectData.bundler}`, message);
54
54
  if (typeof message === "object" &&
55
55
  "version" in message &&
56
56
  "type" in message) {
57
- if (isFirstWebpackWatchCompilation) {
58
- isFirstWebpackWatchCompilation = false;
57
+ if (isFirstBundlerWatchCompilation) {
58
+ isFirstBundlerWatchCompilation = false;
59
59
  resolve(childProcess);
60
60
  return;
61
61
  }
62
62
  return this.handleHMRMessage(message, platformData, projectData, prepareData);
63
63
  }
64
- if (message === "Webpack compilation complete.") {
65
- this.$logger.info("Webpack build done!");
64
+ if (message ===
65
+ `${capitalizeFirstLetter(projectData.bundler)} compilation complete.`) {
66
+ this.$logger.info(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
66
67
  resolve(childProcess);
67
68
  }
68
69
  message = message;
69
70
  if (message.emittedFiles) {
70
- if (isFirstWebpackWatchCompilation) {
71
- isFirstWebpackWatchCompilation = false;
71
+ if (isFirstBundlerWatchCompilation) {
72
+ isFirstBundlerWatchCompilation = false;
72
73
  this.expectedHashes[platformData.platformNameLowerCase] =
73
74
  prepareData.hmr ? message.hash : "";
74
75
  return;
@@ -96,27 +97,40 @@ class WebpackCompilerService extends events_1.EventEmitter {
96
97
  },
97
98
  platform: platformData.platformNameLowerCase,
98
99
  };
99
- this.$logger.trace("Generated data from webpack message:", data);
100
+ this.$logger.trace(`Generated data from ${projectData.bundler} message:`, data);
100
101
  if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
101
102
  return;
102
103
  }
103
104
  if (data.files.length) {
104
- this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, data);
105
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
105
106
  }
106
107
  }
107
108
  });
108
109
  childProcess.on("error", (err) => {
109
- this.$logger.trace(`Unable to start webpack process in watch mode. Error is: ${err}`);
110
- delete this.webpackProcesses[platformData.platformNameLowerCase];
110
+ this.$logger.trace(`Unable to start ${projectData.bundler} process in watch mode. Error is: ${err}`);
111
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
111
112
  reject(err);
112
113
  });
113
114
  childProcess.on("close", async (arg) => {
114
- await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
115
115
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
116
- this.$logger.trace(`Webpack process exited with code ${exitCode} when we expected it to be long living with watch.`);
117
- const error = new Error(`Executing webpack failed with exit code ${exitCode}.`);
116
+ this.$logger.trace(`${capitalizeFirstLetter(projectData.bundler)} process exited with code ${exitCode} when we expected it to be long living with watch.`);
117
+ if (this.getBundler() === "vite" && exitCode === 0) {
118
+ const bundlePath = path.join(projectData.projectDir, "dist/bundle.js");
119
+ console.log("bundlePath:", bundlePath);
120
+ const data = {
121
+ files: [bundlePath],
122
+ hasOnlyHotUpdateFiles: false,
123
+ hmrData: {},
124
+ platform: platformData.platformNameLowerCase,
125
+ };
126
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
127
+ resolve(1);
128
+ return;
129
+ }
130
+ await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
131
+ const error = new Error(`Executing ${projectData.bundler} failed with exit code ${exitCode}.`);
118
132
  error.code = exitCode;
119
- delete this.webpackProcesses[platformData.platformNameLowerCase];
133
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
120
134
  reject(error);
121
135
  });
122
136
  }
@@ -127,26 +141,26 @@ class WebpackCompilerService extends events_1.EventEmitter {
127
141
  }
128
142
  async compileWithoutWatch(platformData, projectData, prepareData) {
129
143
  return new Promise(async (resolve, reject) => {
130
- if (this.webpackProcesses[platformData.platformNameLowerCase]) {
144
+ if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
131
145
  resolve();
132
146
  return;
133
147
  }
134
148
  try {
135
- const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
149
+ const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
136
150
  childProcess.on("error", (err) => {
137
- this.$logger.trace(`Unable to start webpack process in non-watch mode. Error is: ${err}`);
138
- delete this.webpackProcesses[platformData.platformNameLowerCase];
151
+ this.$logger.trace(`Unable to start ${projectData.bundler} process in non-watch mode. Error is: ${err}`);
152
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
139
153
  reject(err);
140
154
  });
141
155
  childProcess.on("close", async (arg) => {
142
156
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
143
- delete this.webpackProcesses[platformData.platformNameLowerCase];
157
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
144
158
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
145
159
  if (exitCode === 0) {
146
160
  resolve();
147
161
  }
148
162
  else {
149
- const error = new Error(`Executing webpack failed with exit code ${exitCode}.`);
163
+ const error = new Error(`Executing ${projectData.bundler} failed with exit code ${exitCode}.`);
150
164
  error.code = exitCode;
151
165
  reject(error);
152
166
  }
@@ -157,14 +171,14 @@ class WebpackCompilerService extends events_1.EventEmitter {
157
171
  }
158
172
  });
159
173
  }
160
- async stopWebpackCompiler(platform) {
174
+ async stopBundlerCompiler(platform) {
161
175
  if (platform) {
162
- await this.stopWebpackForPlatform(platform);
176
+ await this.stopBundlerForPlatform(platform);
163
177
  }
164
178
  else {
165
- const webpackedPlatforms = Object.keys(this.webpackProcesses);
166
- for (let i = 0; i < webpackedPlatforms.length; i++) {
167
- await this.stopWebpackForPlatform(webpackedPlatforms[i]);
179
+ const bundlerPlatforms = Object.keys(this.bundlerProcesses);
180
+ for (let i = 0; i < bundlerPlatforms.length; i++) {
181
+ await this.stopBundlerForPlatform(bundlerPlatforms[i]);
168
182
  }
169
183
  }
170
184
  }
@@ -173,19 +187,22 @@ class WebpackCompilerService extends events_1.EventEmitter {
173
187
  const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
174
188
  return res;
175
189
  }
176
- async startWebpackProcess(platformData, projectData, prepareData) {
190
+ async startBundleProcess(platformData, projectData, prepareData) {
177
191
  if (projectData.bundlerConfigPath) {
178
192
  if (!this.$fs.exists(projectData.bundlerConfigPath)) {
179
193
  this.$errors.fail(`The bundler configuration file ${projectData.bundlerConfigPath} does not exist. Ensure the file exists, or update the path in ${constants_1.CONFIG_FILE_NAME_DISPLAY}.`);
180
194
  }
181
195
  }
182
196
  else {
183
- if (!this.$fs.exists(projectData.webpackConfigPath)) {
184
- this.$errors.fail(`The webpack configuration file ${projectData.webpackConfigPath} does not exist. Ensure the file exists, or update the path in ${constants_1.CONFIG_FILE_NAME_DISPLAY}.`);
197
+ if (!this.$fs.exists(projectData.bundlerConfigPath)) {
198
+ this.$errors.fail(`The ${projectData.bundler} configuration file ${projectData.bundlerConfigPath} does not exist. Ensure the file exists, or update the path in ${constants_1.CONFIG_FILE_NAME_DISPLAY}.`);
185
199
  }
186
200
  }
187
201
  const envData = this.buildEnvData(platformData.platformNameLowerCase, projectData, prepareData);
188
- const envParams = await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
202
+ const isVite = this.getBundler() === "vite";
203
+ const envParams = isVite
204
+ ? [`--mode=${platformData.platformNameLowerCase}`]
205
+ : await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
189
206
  const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
190
207
  if (await this.shouldUsePreserveSymlinksOption()) {
191
208
  additionalNodeArgs.push("--preserve-symlinks");
@@ -195,13 +212,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
195
212
  }
196
213
  const args = [
197
214
  ...additionalNodeArgs,
198
- this.getWebpackExecutablePath(projectData),
215
+ this.getBundlerExecutablePath(projectData),
199
216
  this.isModernBundler(projectData) ? `build` : null,
200
- `--config=${projectData.bundlerConfigPath || projectData.webpackConfigPath}`,
217
+ `--config=${projectData.bundlerConfigPath}`,
201
218
  ...envParams,
202
219
  ].filter(Boolean);
203
- if (prepareData.watch) {
204
- args.push("--watch");
220
+ if (!isVite) {
221
+ if (prepareData.watch) {
222
+ args.push("--watch");
223
+ }
205
224
  }
206
225
  const stdio = prepareData.watch ? ["ipc"] : "inherit";
207
226
  const options = {
@@ -210,6 +229,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
210
229
  };
211
230
  options.env = {
212
231
  NATIVESCRIPT_WEBPACK_ENV: JSON.stringify(envData),
232
+ NATIVESCRIPT_BUNDLER_ENV: JSON.stringify(envData),
213
233
  };
214
234
  if (this.$hostInfo.isWindows) {
215
235
  Object.assign(options.env, { APPDATA: process.env.appData });
@@ -221,8 +241,9 @@ class WebpackCompilerService extends events_1.EventEmitter {
221
241
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
222
242
  });
223
243
  }
244
+ console.log("args:", args);
224
245
  const childProcess = this.$childProcess.spawn(process.execPath, args, options);
225
- this.webpackProcesses[platformData.platformNameLowerCase] = childProcess;
246
+ this.bundlerProcesses[platformData.platformNameLowerCase] = childProcess;
226
247
  await this.$cleanupService.addKillProcess(childProcess.pid.toString());
227
248
  return childProcess;
228
249
  }
@@ -267,13 +288,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
267
288
  envFlagNames.splice(envFlagNames.indexOf("snapshot"), 1);
268
289
  }
269
290
  else if (this.$hostInfo.isWindows) {
270
- const minWebpackPluginWithWinSnapshotsVersion = "1.3.0";
271
- const installedWebpackPluginVersion = await this.$packageInstallationManager.getInstalledDependencyVersion(constants_1.WEBPACK_PLUGIN_NAME, projectData.projectDir);
272
- const hasWebpackPluginWithWinSnapshotsSupport = !!installedWebpackPluginVersion
273
- ? semver.gte(semver.coerce(installedWebpackPluginVersion), minWebpackPluginWithWinSnapshotsVersion)
274
- : true;
275
- if (!hasWebpackPluginWithWinSnapshotsSupport) {
276
- this.$errors.fail(`In order to generate Snapshots on Windows, please upgrade your Webpack plugin version (npm i ${constants_1.WEBPACK_PLUGIN_NAME}@latest).`);
291
+ if (projectData.bundler === "webpack") {
292
+ const minWebpackPluginWithWinSnapshotsVersion = "1.3.0";
293
+ const installedWebpackPluginVersion = await this.$packageInstallationManager.getInstalledDependencyVersion(constants_1.WEBPACK_PLUGIN_NAME, projectData.projectDir);
294
+ const hasWebpackPluginWithWinSnapshotsSupport = !!installedWebpackPluginVersion
295
+ ? semver.gte(semver.coerce(installedWebpackPluginVersion), minWebpackPluginWithWinSnapshotsVersion)
296
+ : true;
297
+ if (!hasWebpackPluginWithWinSnapshotsSupport) {
298
+ this.$errors.fail(`In order to generate Snapshots on Windows, please upgrade your Webpack plugin version (npm i ${constants_1.WEBPACK_PLUGIN_NAME}@latest).`);
299
+ }
277
300
  }
278
301
  }
279
302
  }
@@ -324,21 +347,21 @@ class WebpackCompilerService extends events_1.EventEmitter {
324
347
  }
325
348
  return hotHash || "";
326
349
  }
327
- async stopWebpackForPlatform(platform) {
328
- this.$logger.trace(`Stopping webpack watch for platform ${platform}.`);
329
- const webpackProcess = this.webpackProcesses[platform];
330
- await this.$cleanupService.removeKillProcess(webpackProcess.pid.toString());
331
- if (webpackProcess) {
332
- webpackProcess.kill("SIGINT");
333
- delete this.webpackProcesses[platform];
350
+ async stopBundlerForPlatform(platform) {
351
+ this.$logger.trace(`Stopping ${this.getBundler()} watch for platform ${platform}.`);
352
+ const bundlerProcess = this.bundlerProcesses[platform];
353
+ await this.$cleanupService.removeKillProcess(bundlerProcess.pid.toString());
354
+ if (bundlerProcess) {
355
+ bundlerProcess.kill("SIGINT");
356
+ delete this.bundlerProcesses[platform];
334
357
  }
335
358
  }
336
359
  handleHMRMessage(message, platformData, projectData, prepareData) {
337
- this.$logger.trace("Received message from webpack process:", message);
360
+ this.$logger.trace(`Received message from ${projectData.bundler} process:`, message);
338
361
  if (message.type !== "compilation") {
339
362
  return;
340
363
  }
341
- this.$logger.trace("Webpack build done!");
364
+ this.$logger.trace(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
342
365
  const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
343
366
  const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
344
367
  const lastHash = (() => {
@@ -355,7 +378,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
355
378
  if (!files.length) {
356
379
  return;
357
380
  }
358
- this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, {
381
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, {
359
382
  files,
360
383
  staleFiles,
361
384
  hasOnlyHotUpdateFiles: prepareData.hmr,
@@ -366,9 +389,17 @@ class WebpackCompilerService extends events_1.EventEmitter {
366
389
  platform: platformData.platformNameLowerCase,
367
390
  });
368
391
  }
369
- getWebpackExecutablePath(projectData) {
392
+ getBundlerExecutablePath(projectData) {
370
393
  const bundler = this.getBundler();
371
- if (this.isModernBundler(projectData)) {
394
+ if (bundler === "vite") {
395
+ const packagePath = (0, package_path_helper_1.resolvePackagePath)(`vite`, {
396
+ paths: [projectData.projectDir],
397
+ });
398
+ if (packagePath) {
399
+ return path.resolve(packagePath, "bin", "vite.js");
400
+ }
401
+ }
402
+ else if (this.isModernBundler(projectData)) {
372
403
  const packagePath = (0, package_path_helper_1.resolvePackagePath)(`@nativescript/${bundler}`, {
373
404
  paths: [projectData.projectDir],
374
405
  });
@@ -390,7 +421,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
390
421
  case "rspack":
391
422
  return true;
392
423
  default:
393
- const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)("@nativescript/webpack", {
424
+ const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)(constants_1.WEBPACK_PLUGIN_NAME, {
394
425
  paths: [projectData.projectDir],
395
426
  });
396
427
  if (packageJSONPath) {
@@ -408,8 +439,11 @@ class WebpackCompilerService extends events_1.EventEmitter {
408
439
  return this.$projectConfigService.getValue(`bundler`, "webpack");
409
440
  }
410
441
  }
411
- exports.WebpackCompilerService = WebpackCompilerService;
442
+ exports.BundlerCompilerService = BundlerCompilerService;
412
443
  __decorate([
413
444
  (0, decorators_1.performanceLog)()
414
- ], WebpackCompilerService.prototype, "startWebpackProcess", null);
415
- yok_1.injector.register("webpackCompilerService", WebpackCompilerService);
445
+ ], BundlerCompilerService.prototype, "startBundleProcess", null);
446
+ function capitalizeFirstLetter(val) {
447
+ return String(val).charAt(0).toUpperCase() + String(val).slice(1);
448
+ }
449
+ yok_1.injector.register("bundlerCompilerService", BundlerCompilerService);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativescript",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "8.9.3-dev.1",
4
+ "version": "8.9.3-dev.2",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
@@ -1,226 +0,0 @@
1
- import { EventEmitter } from "events";
2
- import { BuildData } from "../../data/build-data";
3
- import { PrepareData } from "../../data/prepare-data";
4
- import {
5
- IPlatformProjectServiceBase,
6
- IProjectData,
7
- IValidatePlatformOutput,
8
- } from "../../definitions/project";
9
- import { IOptions, IDependencyData } from "../../declarations";
10
- import { IPlatformData } from "../../definitions/platform";
11
- import { IPluginData } from "../../definitions/plugins";
12
- import { IRelease, ISpawnResult } from "../../common/declarations";
13
- import {
14
- IProjectChangesInfo,
15
- IPrepareInfo,
16
- IAddedNativePlatform,
17
- } from "../../definitions/project-changes";
18
- import { INotConfiguredEnvOptions } from "../../common/definitions/commands";
19
-
20
- declare global {
21
- interface IWebpackCompilerService extends EventEmitter {
22
- compileWithWatch(
23
- platformData: IPlatformData,
24
- projectData: IProjectData,
25
- prepareData: IPrepareData
26
- ): Promise<any>;
27
- compileWithoutWatch(
28
- platformData: IPlatformData,
29
- projectData: IProjectData,
30
- prepareData: IPrepareData
31
- ): Promise<void>;
32
- stopWebpackCompiler(platform: string): Promise<void>;
33
- }
34
-
35
- interface IWebpackEnvOptions {
36
- sourceMap?: boolean;
37
- uglify?: boolean;
38
- production?: boolean;
39
- }
40
-
41
- interface IProjectChangesService {
42
- checkForChanges(
43
- platformData: IPlatformData,
44
- projectData: IProjectData,
45
- prepareData: IPrepareData
46
- ): Promise<IProjectChangesInfo>;
47
- getPrepareInfoFilePath(platformData: IPlatformData): string;
48
- getPrepareInfo(platformData: IPlatformData): IPrepareInfo;
49
- savePrepareInfo(
50
- platformData: IPlatformData,
51
- projectData: IProjectData,
52
- prepareData: IPrepareData
53
- ): Promise<void>;
54
- setNativePlatformStatus(
55
- platformData: IPlatformData,
56
- projectData: IProjectData,
57
- addedPlatform: IAddedNativePlatform
58
- ): void;
59
- currentChanges: IProjectChangesInfo;
60
- }
61
-
62
- interface IFilesChangeEventData {
63
- platform: string;
64
- files: string[];
65
- staleFiles: string[];
66
- hmrData: IPlatformHmrData;
67
- hasOnlyHotUpdateFiles: boolean;
68
- hasNativeChanges: boolean;
69
- }
70
-
71
- interface IWebpackEmitMessage {
72
- emittedFiles: string[];
73
- chunkFiles: string[];
74
- hash: string;
75
- }
76
-
77
- interface IPlatformProjectService
78
- extends NodeJS.EventEmitter,
79
- IPlatformProjectServiceBase {
80
- getPlatformData(projectData: IProjectData): IPlatformData;
81
- validate(
82
- projectData: IProjectData,
83
- options: IOptions,
84
- notConfiguredEnvOptions?: INotConfiguredEnvOptions
85
- ): Promise<IValidatePlatformOutput>;
86
- createProject(
87
- frameworkDir: string,
88
- frameworkVersion: string,
89
- projectData: IProjectData
90
- ): Promise<void>;
91
- interpolateData(projectData: IProjectData): Promise<void>;
92
- interpolateConfigurationFile(projectData: IProjectData): void;
93
-
94
- /**
95
- * Executes additional actions after native project is created.
96
- * @param {string} projectRoot Path to the real NativeScript project.
97
- * @param {IProjectData} projectData DTO with information about the project.
98
- * @returns {void}
99
- */
100
- afterCreateProject(projectRoot: string, projectData: IProjectData): void;
101
-
102
- /**
103
- * Gets first chance to validate the options provided as command line arguments.
104
- * @param {string} projectId Project identifier - for example org.nativescript.test.
105
- * @param {any} provision UUID of the provisioning profile used in iOS option validation.
106
- * @returns {void}
107
- */
108
- validateOptions(
109
- projectId?: string,
110
- provision?: true | string,
111
- teamId?: true | string
112
- ): Promise<boolean>;
113
-
114
- buildProject<T extends BuildData>(
115
- projectRoot: string,
116
- projectData: IProjectData,
117
- buildConfig: T
118
- ): Promise<void>;
119
-
120
- /**
121
- * Prepares images in Native project (for iOS).
122
- * @param {IProjectData} projectData DTO with information about the project.
123
- * @param {any} platformSpecificData Platform specific data required for project preparation.
124
- * @returns {void}
125
- */
126
- prepareProject<T extends PrepareData>(
127
- projectData: IProjectData,
128
- prepareData: T
129
- ): Promise<void>;
130
-
131
- /**
132
- * Prepares App_Resources in the native project by clearing data from other platform and applying platform specific rules.
133
- * @param {string} appResourcesDirectoryPath The place in the native project where the App_Resources are copied first.
134
- * @param {IProjectData} projectData DTO with information about the project.
135
- * @returns {void}
136
- */
137
- prepareAppResources(projectData: IProjectData): void;
138
-
139
- /**
140
- * Defines if current platform is prepared (i.e. if <project dir>/platforms/<platform> dir exists).
141
- * @param {string} projectRoot The project directory (path where root's package.json is located).
142
- * @param {IProjectData} projectData DTO with information about the project.
143
- * @returns {boolean} True in case platform is prepare (i.e. if <project dir>/platforms/<platform> dir exists), false otherwise.
144
- */
145
- isPlatformPrepared(projectRoot: string, projectData: IProjectData): boolean;
146
-
147
- preparePluginNativeCode(
148
- pluginData: IPluginData,
149
- options?: any
150
- ): Promise<void>;
151
-
152
- /**
153
- * Removes native code of a plugin (CocoaPods, jars, libs, src).
154
- * @param {IPluginData} Plugins data describing the plugin which should be cleaned.
155
- * @param {IProjectData} projectData DTO with information about the project.
156
- * @returns {void}
157
- */
158
- removePluginNativeCode(
159
- pluginData: IPluginData,
160
- projectData: IProjectData
161
- ): Promise<void>;
162
-
163
- beforePrepareAllPlugins(
164
- projectData: IProjectData,
165
- dependencies?: IDependencyData[]
166
- ): Promise<IDependencyData[]>;
167
-
168
- handleNativeDependenciesChange(
169
- projectData: IProjectData,
170
- opts: IRelease
171
- ): Promise<void>;
172
-
173
- /**
174
- * Gets the path wheren App_Resources should be copied.
175
- * @returns {string} Path to native project, where App_Resources should be copied.
176
- */
177
- getAppResourcesDestinationDirectoryPath(projectData: IProjectData): string;
178
-
179
- cleanDeviceTempFolder(
180
- deviceIdentifier: string,
181
- projectData: IProjectData
182
- ): Promise<void>;
183
- processConfigurationFilesFromAppResources(
184
- projectData: IProjectData,
185
- opts: { release: boolean }
186
- ): Promise<void>;
187
-
188
- /**
189
- * Ensures there is configuration file (AndroidManifest.xml, Info.plist) in app/App_Resources.
190
- * @param {IProjectData} projectData DTO with information about the project.
191
- * @returns {void}
192
- */
193
- ensureConfigurationFileInAppResources(projectData: IProjectData): void;
194
-
195
- /**
196
- * Stops all running processes that might hold a lock on the filesystem.
197
- * Android: Gradle daemon processes are terminated.
198
- * @param {IPlatformData} platformData The data for the specified platform.
199
- * @returns {void}
200
- */
201
- stopServices?(projectRoot: string): Promise<ISpawnResult>;
202
-
203
- /**
204
- * Removes build artifacts specific to the platform
205
- * @param {string} projectRoot The root directory of the native project.
206
- * @returns {void}
207
- */
208
- cleanProject?(projectRoot: string): Promise<void>;
209
-
210
- /**
211
- * Check the current state of the project, and validate against the options.
212
- * If there are parts in the project that are inconsistent with the desired options, marks them in the changeset flags.
213
- */
214
- checkForChanges<T extends PrepareData>(
215
- changeset: IProjectChangesInfo,
216
- prepareData: T,
217
- projectData: IProjectData
218
- ): Promise<void>;
219
-
220
- /**
221
- * Get the deployment target's version
222
- * Currently implemented only for iOS -> returns the value of IPHONEOS_DEPLOYMENT_TARGET property from xcconfig file
223
- */
224
- getDeploymentTarget?(projectData: IProjectData): any;
225
- }
226
- }