nativescript 9.0.0-alpha.0 → 9.0.0-alpha.1

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;
@@ -182,6 +183,8 @@ interface INsConfig {
182
183
  shared?: boolean;
183
184
  overridePods?: string;
184
185
  webpackConfigPath?: string;
186
+ bundlerConfigPath?: string;
187
+ bundler?: BundlerType;
185
188
  ios?: INsConfigIOS;
186
189
  android?: INsConfigAndroid;
187
190
  visionos?: INSConfigVisionOS;
@@ -215,13 +218,28 @@ interface IProjectData extends ICreateProjectData {
215
218
  * Value is true when project has nativescript.config and it has `shared: true` in it.
216
219
  */
217
220
  isShared: boolean;
218
-
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;
231
+ /**
232
+ * @deprecated Use bundlerConfigPath
220
233
  * Defines the path to the configuration file passed to webpack process.
221
234
  * By default this is the webpack.config.js at the root of the application.
222
235
  * The value can be changed by setting `webpackConfigPath` in nativescript.config.
223
236
  */
224
237
  webpackConfigPath: string;
238
+ /**
239
+ * Defines the path to the bundler configuration file passed to the compiler.
240
+ * The value can be changed by setting `bundlerConfigPath` in nativescript.config.
241
+ */
242
+ bundlerConfigPath: string;
225
243
  projectName: string;
226
244
 
227
245
  /**
@@ -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,10 +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;
100
+ this.bundlerConfigPath =
101
+ this.nsConfig && this.nsConfig.bundlerConfigPath
102
+ ? path.resolve(this.projectDir, this.nsConfig.bundlerConfigPath)
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";
99
105
  return;
100
106
  }
101
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,8 +15,8 @@ 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 {
19
- constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager) {
18
+ class BundlerCompilerService extends events_1.EventEmitter {
19
+ constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, $projectConfigService) {
20
20
  super();
21
21
  this.$options = $options;
22
22
  this.$errors = $errors;
@@ -29,19 +29,20 @@ class WebpackCompilerService extends events_1.EventEmitter {
29
29
  this.$cleanupService = $cleanupService;
30
30
  this.$packageManager = $packageManager;
31
31
  this.$packageInstallationManager = $packageInstallationManager;
32
- this.webpackProcesses = {};
32
+ this.$projectConfigService = $projectConfigService;
33
+ this.bundlerProcesses = {};
33
34
  this.expectedHashes = {};
34
35
  }
35
36
  async compileWithWatch(platformData, projectData, prepareData) {
36
37
  return new Promise(async (resolve, reject) => {
37
- if (this.webpackProcesses[platformData.platformNameLowerCase]) {
38
+ if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
38
39
  resolve(void 0);
39
40
  return;
40
41
  }
41
- let isFirstWebpackWatchCompilation = true;
42
+ let isFirstBundlerWatchCompilation = true;
42
43
  prepareData.watch = true;
43
44
  try {
44
- const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
45
+ const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
45
46
  childProcess.stdout.on("data", function (data) {
46
47
  process.stdout.write(data);
47
48
  });
@@ -49,25 +50,26 @@ class WebpackCompilerService extends events_1.EventEmitter {
49
50
  process.stderr.write(data);
50
51
  });
51
52
  childProcess.on("message", (message) => {
52
- this.$logger.trace("Message from webpack", message);
53
+ this.$logger.trace(`Message from ${projectData.bundler}`, message);
53
54
  if (typeof message === "object" &&
54
55
  "version" in message &&
55
56
  "type" in message) {
56
- if (isFirstWebpackWatchCompilation) {
57
- isFirstWebpackWatchCompilation = false;
57
+ if (isFirstBundlerWatchCompilation) {
58
+ isFirstBundlerWatchCompilation = false;
58
59
  resolve(childProcess);
59
60
  return;
60
61
  }
61
62
  return this.handleHMRMessage(message, platformData, projectData, prepareData);
62
63
  }
63
- if (message === "Webpack compilation complete.") {
64
- this.$logger.info("Webpack build done!");
64
+ if (message ===
65
+ `${capitalizeFirstLetter(projectData.bundler)} compilation complete.`) {
66
+ this.$logger.info(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
65
67
  resolve(childProcess);
66
68
  }
67
69
  message = message;
68
70
  if (message.emittedFiles) {
69
- if (isFirstWebpackWatchCompilation) {
70
- isFirstWebpackWatchCompilation = false;
71
+ if (isFirstBundlerWatchCompilation) {
72
+ isFirstBundlerWatchCompilation = false;
71
73
  this.expectedHashes[platformData.platformNameLowerCase] =
72
74
  prepareData.hmr ? message.hash : "";
73
75
  return;
@@ -95,27 +97,40 @@ class WebpackCompilerService extends events_1.EventEmitter {
95
97
  },
96
98
  platform: platformData.platformNameLowerCase,
97
99
  };
98
- this.$logger.trace("Generated data from webpack message:", data);
100
+ this.$logger.trace(`Generated data from ${projectData.bundler} message:`, data);
99
101
  if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
100
102
  return;
101
103
  }
102
104
  if (data.files.length) {
103
- this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, data);
105
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
104
106
  }
105
107
  }
106
108
  });
107
109
  childProcess.on("error", (err) => {
108
- this.$logger.trace(`Unable to start webpack process in watch mode. Error is: ${err}`);
109
- 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];
110
112
  reject(err);
111
113
  });
112
114
  childProcess.on("close", async (arg) => {
113
- await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
114
115
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
115
- this.$logger.trace(`Webpack process exited with code ${exitCode} when we expected it to be long living with watch.`);
116
- 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}.`);
117
132
  error.code = exitCode;
118
- delete this.webpackProcesses[platformData.platformNameLowerCase];
133
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
119
134
  reject(error);
120
135
  });
121
136
  }
@@ -126,26 +141,26 @@ class WebpackCompilerService extends events_1.EventEmitter {
126
141
  }
127
142
  async compileWithoutWatch(platformData, projectData, prepareData) {
128
143
  return new Promise(async (resolve, reject) => {
129
- if (this.webpackProcesses[platformData.platformNameLowerCase]) {
144
+ if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
130
145
  resolve();
131
146
  return;
132
147
  }
133
148
  try {
134
- const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
149
+ const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
135
150
  childProcess.on("error", (err) => {
136
- this.$logger.trace(`Unable to start webpack process in non-watch mode. Error is: ${err}`);
137
- 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];
138
153
  reject(err);
139
154
  });
140
155
  childProcess.on("close", async (arg) => {
141
156
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
142
- delete this.webpackProcesses[platformData.platformNameLowerCase];
157
+ delete this.bundlerProcesses[platformData.platformNameLowerCase];
143
158
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
144
159
  if (exitCode === 0) {
145
160
  resolve();
146
161
  }
147
162
  else {
148
- const error = new Error(`Executing webpack failed with exit code ${exitCode}.`);
163
+ const error = new Error(`Executing ${projectData.bundler} failed with exit code ${exitCode}.`);
149
164
  error.code = exitCode;
150
165
  reject(error);
151
166
  }
@@ -156,14 +171,14 @@ class WebpackCompilerService extends events_1.EventEmitter {
156
171
  }
157
172
  });
158
173
  }
159
- async stopWebpackCompiler(platform) {
174
+ async stopBundlerCompiler(platform) {
160
175
  if (platform) {
161
- await this.stopWebpackForPlatform(platform);
176
+ await this.stopBundlerForPlatform(platform);
162
177
  }
163
178
  else {
164
- const webpackedPlatforms = Object.keys(this.webpackProcesses);
165
- for (let i = 0; i < webpackedPlatforms.length; i++) {
166
- 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]);
167
182
  }
168
183
  }
169
184
  }
@@ -172,12 +187,22 @@ class WebpackCompilerService extends events_1.EventEmitter {
172
187
  const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
173
188
  return res;
174
189
  }
175
- async startWebpackProcess(platformData, projectData, prepareData) {
176
- if (!this.$fs.exists(projectData.webpackConfigPath)) {
177
- 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}.`);
190
+ async startBundleProcess(platformData, projectData, prepareData) {
191
+ if (projectData.bundlerConfigPath) {
192
+ if (!this.$fs.exists(projectData.bundlerConfigPath)) {
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}.`);
194
+ }
195
+ }
196
+ else {
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}.`);
199
+ }
178
200
  }
179
201
  const envData = this.buildEnvData(platformData.platformNameLowerCase, projectData, prepareData);
180
- 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);
181
206
  const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
182
207
  if (await this.shouldUsePreserveSymlinksOption()) {
183
208
  additionalNodeArgs.push("--preserve-symlinks");
@@ -187,13 +212,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
187
212
  }
188
213
  const args = [
189
214
  ...additionalNodeArgs,
190
- this.getWebpackExecutablePath(projectData),
191
- this.isWebpack5(projectData) ? `build` : null,
192
- `--config=${projectData.webpackConfigPath}`,
215
+ this.getBundlerExecutablePath(projectData),
216
+ this.isModernBundler(projectData) ? `build` : null,
217
+ `--config=${projectData.bundlerConfigPath}`,
193
218
  ...envParams,
194
219
  ].filter(Boolean);
195
- if (prepareData.watch) {
196
- args.push("--watch");
220
+ if (!isVite) {
221
+ if (prepareData.watch) {
222
+ args.push("--watch");
223
+ }
197
224
  }
198
225
  const stdio = prepareData.watch ? ["ipc"] : "inherit";
199
226
  const options = {
@@ -201,7 +228,9 @@ class WebpackCompilerService extends events_1.EventEmitter {
201
228
  stdio,
202
229
  };
203
230
  options.env = {
231
+ ...process.env,
204
232
  NATIVESCRIPT_WEBPACK_ENV: JSON.stringify(envData),
233
+ NATIVESCRIPT_BUNDLER_ENV: JSON.stringify(envData),
205
234
  };
206
235
  if (this.$hostInfo.isWindows) {
207
236
  Object.assign(options.env, { APPDATA: process.env.appData });
@@ -213,8 +242,9 @@ class WebpackCompilerService extends events_1.EventEmitter {
213
242
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
214
243
  });
215
244
  }
245
+ console.log("args:", args);
216
246
  const childProcess = this.$childProcess.spawn(process.execPath, args, options);
217
- this.webpackProcesses[platformData.platformNameLowerCase] = childProcess;
247
+ this.bundlerProcesses[platformData.platformNameLowerCase] = childProcess;
218
248
  await this.$cleanupService.addKillProcess(childProcess.pid.toString());
219
249
  return childProcess;
220
250
  }
@@ -259,13 +289,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
259
289
  envFlagNames.splice(envFlagNames.indexOf("snapshot"), 1);
260
290
  }
261
291
  else if (this.$hostInfo.isWindows) {
262
- const minWebpackPluginWithWinSnapshotsVersion = "1.3.0";
263
- const installedWebpackPluginVersion = await this.$packageInstallationManager.getInstalledDependencyVersion(constants_1.WEBPACK_PLUGIN_NAME, projectData.projectDir);
264
- const hasWebpackPluginWithWinSnapshotsSupport = !!installedWebpackPluginVersion
265
- ? semver.gte(semver.coerce(installedWebpackPluginVersion), minWebpackPluginWithWinSnapshotsVersion)
266
- : true;
267
- if (!hasWebpackPluginWithWinSnapshotsSupport) {
268
- this.$errors.fail(`In order to generate Snapshots on Windows, please upgrade your Webpack plugin version (npm i ${constants_1.WEBPACK_PLUGIN_NAME}@latest).`);
292
+ if (projectData.bundler === "webpack") {
293
+ const minWebpackPluginWithWinSnapshotsVersion = "1.3.0";
294
+ const installedWebpackPluginVersion = await this.$packageInstallationManager.getInstalledDependencyVersion(constants_1.WEBPACK_PLUGIN_NAME, projectData.projectDir);
295
+ const hasWebpackPluginWithWinSnapshotsSupport = !!installedWebpackPluginVersion
296
+ ? semver.gte(semver.coerce(installedWebpackPluginVersion), minWebpackPluginWithWinSnapshotsVersion)
297
+ : true;
298
+ if (!hasWebpackPluginWithWinSnapshotsSupport) {
299
+ this.$errors.fail(`In order to generate Snapshots on Windows, please upgrade your Webpack plugin version (npm i ${constants_1.WEBPACK_PLUGIN_NAME}@latest).`);
300
+ }
269
301
  }
270
302
  }
271
303
  }
@@ -316,21 +348,21 @@ class WebpackCompilerService extends events_1.EventEmitter {
316
348
  }
317
349
  return hotHash || "";
318
350
  }
319
- async stopWebpackForPlatform(platform) {
320
- this.$logger.trace(`Stopping webpack watch for platform ${platform}.`);
321
- const webpackProcess = this.webpackProcesses[platform];
322
- await this.$cleanupService.removeKillProcess(webpackProcess.pid.toString());
323
- if (webpackProcess) {
324
- webpackProcess.kill("SIGINT");
325
- delete this.webpackProcesses[platform];
351
+ async stopBundlerForPlatform(platform) {
352
+ this.$logger.trace(`Stopping ${this.getBundler()} watch for platform ${platform}.`);
353
+ const bundlerProcess = this.bundlerProcesses[platform];
354
+ await this.$cleanupService.removeKillProcess(bundlerProcess.pid.toString());
355
+ if (bundlerProcess) {
356
+ bundlerProcess.kill("SIGINT");
357
+ delete this.bundlerProcesses[platform];
326
358
  }
327
359
  }
328
360
  handleHMRMessage(message, platformData, projectData, prepareData) {
329
- this.$logger.trace("Received message from webpack process:", message);
361
+ this.$logger.trace(`Received message from ${projectData.bundler} process:`, message);
330
362
  if (message.type !== "compilation") {
331
363
  return;
332
364
  }
333
- this.$logger.trace("Webpack build done!");
365
+ this.$logger.trace(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
334
366
  const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
335
367
  const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
336
368
  const lastHash = (() => {
@@ -347,7 +379,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
347
379
  if (!files.length) {
348
380
  return;
349
381
  }
350
- this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, {
382
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, {
351
383
  files,
352
384
  staleFiles,
353
385
  hasOnlyHotUpdateFiles: prepareData.hmr,
@@ -358,9 +390,18 @@ class WebpackCompilerService extends events_1.EventEmitter {
358
390
  platform: platformData.platformNameLowerCase,
359
391
  });
360
392
  }
361
- getWebpackExecutablePath(projectData) {
362
- if (this.isWebpack5(projectData)) {
363
- const packagePath = (0, package_path_helper_1.resolvePackagePath)("@nativescript/webpack", {
393
+ getBundlerExecutablePath(projectData) {
394
+ const bundler = this.getBundler();
395
+ if (bundler === "vite") {
396
+ const packagePath = (0, package_path_helper_1.resolvePackagePath)(`vite`, {
397
+ paths: [projectData.projectDir],
398
+ });
399
+ if (packagePath) {
400
+ return path.resolve(packagePath, "bin", "vite.js");
401
+ }
402
+ }
403
+ else if (this.isModernBundler(projectData)) {
404
+ const packagePath = (0, package_path_helper_1.resolvePackagePath)(`@nativescript/${bundler}`, {
364
405
  paths: [projectData.projectDir],
365
406
  });
366
407
  if (packagePath) {
@@ -375,22 +416,35 @@ class WebpackCompilerService extends events_1.EventEmitter {
375
416
  }
376
417
  return path.resolve(packagePath, "bin", "webpack.js");
377
418
  }
378
- isWebpack5(projectData) {
379
- const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)("@nativescript/webpack", {
380
- paths: [projectData.projectDir],
381
- });
382
- if (packageJSONPath) {
383
- const packageData = this.$fs.readJson(packageJSONPath);
384
- const ver = semver.coerce(packageData.version);
385
- if (semver.satisfies(ver, ">= 5.0.0")) {
419
+ isModernBundler(projectData) {
420
+ const bundler = this.getBundler();
421
+ switch (bundler) {
422
+ case "rspack":
386
423
  return true;
387
- }
424
+ default:
425
+ const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)(constants_1.WEBPACK_PLUGIN_NAME, {
426
+ paths: [projectData.projectDir],
427
+ });
428
+ if (packageJSONPath) {
429
+ const packageData = this.$fs.readJson(packageJSONPath);
430
+ const ver = semver.coerce(packageData.version);
431
+ if (semver.satisfies(ver, ">= 5.0.0")) {
432
+ return true;
433
+ }
434
+ }
435
+ break;
388
436
  }
389
437
  return false;
390
438
  }
439
+ getBundler() {
440
+ return this.$projectConfigService.getValue(`bundler`, "webpack");
441
+ }
391
442
  }
392
- exports.WebpackCompilerService = WebpackCompilerService;
443
+ exports.BundlerCompilerService = BundlerCompilerService;
393
444
  __decorate([
394
445
  (0, decorators_1.performanceLog)()
395
- ], WebpackCompilerService.prototype, "startWebpackProcess", null);
396
- yok_1.injector.register("webpackCompilerService", WebpackCompilerService);
446
+ ], BundlerCompilerService.prototype, "startBundleProcess", null);
447
+ function capitalizeFirstLetter(val) {
448
+ return String(val).charAt(0).toUpperCase() + String(val).slice(1);
449
+ }
450
+ 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": "9.0.0-alpha.0",
4
+ "version": "9.0.0-alpha.1",
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
- }