nativescript 8.9.3-dev.2 → 9.0.0-alpha.0

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.
@@ -1 +1 @@
1
- {"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.4.4","karma-coverage":"2.2.1","karma-nativescript-launcher":"1.0.0","mocha":"11.1.0","karma-mocha":"2.0.1","karma-chai":"0.1.0","karma-jasmine":"4.0.2","karma-qunit":"4.2.1","@types/karma-chai":"0.1.7","@types/mocha":"10.0.10","@types/jasmine":"5.1.7","@types/qunit":"2.19.12","nyc":"17.1.0"}
1
+ {"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.4.4","karma-coverage":"2.2.1","karma-nativescript-launcher":"1.0.0","mocha":"11.7.1","karma-mocha":"2.0.1","karma-chai":"0.1.0","karma-jasmine":"4.0.2","karma-qunit":"4.2.1","@types/karma-chai":"0.1.7","@types/mocha":"10.0.10","@types/jasmine":"5.1.8","@types/qunit":"2.19.12","nyc":"17.1.0"}
package/lib/.d.ts CHANGED
@@ -344,8 +344,6 @@
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" />
349
347
  /// <reference path="services/cleanup-service.ts" />
350
348
  /// <reference path="services/cocoapods-platform-manager.ts" />
351
349
  /// <reference path="services/cocoapods-service.ts" />
@@ -421,6 +419,8 @@
421
419
  /// <reference path="services/user-settings-service.ts" />
422
420
  /// <reference path="services/versions-service.ts" />
423
421
  /// <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,7 +465,6 @@
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" />
469
468
  /// <reference path="../test/services/doctor-service.ts" />
470
469
  /// <reference path="../test/services/extensibility-service.ts" />
471
470
  /// <reference path="../test/services/ios-debugger-port-service.ts" />
@@ -488,6 +487,7 @@
488
487
  /// <reference path="../test/services/project-data-service.ts" />
489
488
  /// <reference path="../test/services/test-execution-service.ts" />
490
489
  /// <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("bundlerCompilerService", "./services/bundler/bundler-compiler-service");
188
+ yok_1.injector.require("webpackCompilerService", "./services/webpack/webpack-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");
@@ -102,7 +102,7 @@ class HooksService {
102
102
  let inProc = false;
103
103
  if (!command) {
104
104
  command = hook.fullPath;
105
- if (path.extname(hook.fullPath).toLowerCase() === ".js") {
105
+ if ([".mjs", ".js"].includes(path.extname(hook.fullPath).toLowerCase())) {
106
106
  command = process.argv[0];
107
107
  inProc = this.shouldExecuteInProcess(this.$fs.readText(hook.fullPath));
108
108
  }
package/lib/constants.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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;
6
6
  const path_1 = require("path");
7
7
  exports.APP_FOLDER_NAME = "app";
8
8
  exports.APP_RESOURCES_FOLDER_NAME = "App_Resources";
@@ -16,7 +16,6 @@ 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";
20
19
  exports.TNS_CORE_MODULES_WIDGETS_NAME = "tns-core-modules-widgets";
21
20
  exports.UI_MOBILE_BASE_NAME = "@nativescript/ui-mobile-base";
22
21
  exports.TNS_ANDROID_RUNTIME_NAME = "tns-android";
@@ -37,7 +36,6 @@ exports.XML_FILE_EXTENSION = ".xml";
37
36
  exports.PLATFORMS_DIR_NAME = "platforms";
38
37
  exports.HOOKS_DIR_NAME = "hooks";
39
38
  exports.WEBPACK_CONFIG_NAME = "webpack.config.js";
40
- exports.RSPACK_CONFIG_NAME = "rspack.config.js";
41
39
  exports.TSCCONFIG_TNS_JSON_NAME = "tsconfig.tns.json";
42
40
  exports.KARMA_CONFIG_NAME = "karma.conf.js";
43
41
  exports.LIB_DIR_NAME = "lib";
@@ -216,7 +214,7 @@ exports.CACACHE_DIRECTORY_NAME = "_cacache";
216
214
  exports.FILES_CHANGE_EVENT_NAME = "filesChangeEvent";
217
215
  exports.INITIAL_SYNC_EVENT_NAME = "initialSyncEvent";
218
216
  exports.PREPARE_READY_EVENT_NAME = "prepareReadyEvent";
219
- exports.BUNDLER_COMPILATION_COMPLETE = "bundlerCompilationComplete";
217
+ exports.WEBPACK_COMPILATION_COMPLETE = "webpackCompilationComplete";
220
218
  class DebugCommandErrors {
221
219
  }
222
220
  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, $bundlerCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
19
+ constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $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.$bundlerCompilerService = $bundlerCompilerService;
33
+ this.$webpackCompilerService = $webpackCompilerService;
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.$bundlerCompilerService.stopBundlerCompiler(platformLowerCase);
70
- this.$bundlerCompilerService.removeListener(constants_1.BUNDLER_COMPILATION_COMPLETE, this.webpackCompilerHandler);
69
+ await this.$webpackCompilerService.stopWebpackCompiler(platformLowerCase);
70
+ this.$webpackCompilerService.removeListener(constants_1.WEBPACK_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.$bundlerCompilerService.compileWithoutWatch(platformData, projectData, prepareData);
92
+ await this.$webpackCompilerService.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.$bundlerCompilerService.on(constants_1.BUNDLER_COMPILATION_COMPLETE, this.webpackCompilerHandler);
152
+ this.$webpackCompilerService.on(constants_1.WEBPACK_COMPILATION_COMPLETE, this.webpackCompilerHandler);
153
153
  this.watchersData[projectData.projectDir][platformData.platformNameLowerCase].hasWebpackCompilerProcess = true;
154
- await this.$bundlerCompilerService.compileWithWatch(platformData, projectData, prepareData);
154
+ await this.$webpackCompilerService.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.$bundlerCompilerService.stopBundlerCompiler(platform);
296
+ await this.$webpackCompilerService.stopWebpackCompiler(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.$bundlerCompilerService.compileWithWatch(args.platformData, args.projectData, args.prepareData);
306
+ await this.$webpackCompilerService.compileWithWatch(args.platformData, args.projectData, args.prepareData);
307
307
  }
308
308
  }
309
309
  }
@@ -121,7 +121,6 @@ export interface IOSLocalSPMPackage extends IOSSPMPackageBase {
121
121
  }
122
122
 
123
123
  export type IOSSPMPackage = IOSRemoteSPMPackage | IOSLocalSPMPackage;
124
- export type BundlerType = "webpack" | "rspack" | "vite";
125
124
 
126
125
  interface INsConfigIOS extends INsConfigPlaform {
127
126
  discardUncaughtJsExceptions?: boolean;
@@ -183,8 +182,6 @@ interface INsConfig {
183
182
  shared?: boolean;
184
183
  overridePods?: string;
185
184
  webpackConfigPath?: string;
186
- bundlerConfigPath?: string;
187
- bundler?: BundlerType;
188
185
  ios?: INsConfigIOS;
189
186
  android?: INsConfigAndroid;
190
187
  visionos?: INSConfigVisionOS;
@@ -218,28 +215,13 @@ interface IProjectData extends ICreateProjectData {
218
215
  * Value is true when project has nativescript.config and it has `shared: true` in it.
219
216
  */
220
217
  isShared: boolean;
218
+
221
219
  /**
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
233
220
  * Defines the path to the configuration file passed to webpack process.
234
221
  * By default this is the webpack.config.js at the root of the application.
235
222
  * The value can be changed by setting `webpackConfigPath` in nativescript.config.
236
223
  */
237
224
  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;
243
225
  projectName: string;
244
226
 
245
227
  /**
@@ -56,7 +56,6 @@ class ProjectData {
56
56
  this.errorInvalidProject(projectDir);
57
57
  }
58
58
  initializeProjectDataFromContent(packageJsonContent, projectDir) {
59
- var _a, _b;
60
59
  projectDir = projectDir || this.$projectHelper.projectDir || "";
61
60
  this.projectDir = projectDir;
62
61
  const projectFilePath = this.getProjectFilePath(projectDir);
@@ -93,15 +92,10 @@ class ProjectData {
93
92
  this.buildXcconfigPath = path.join(this.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.BUILD_XCCONFIG_FILE_NAME);
94
93
  this.podfilePath = path.join(this.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.PODFILE_NAME);
95
94
  this.isShared = !!(this.nsConfig && this.nsConfig.shared);
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";
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");
105
99
  return;
106
100
  }
107
101
  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.BundlerCompilerService = void 0;
9
+ exports.WebpackCompilerService = 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 BundlerCompilerService extends events_1.EventEmitter {
19
- constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, $projectConfigService) {
18
+ class WebpackCompilerService extends events_1.EventEmitter {
19
+ constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager) {
20
20
  super();
21
21
  this.$options = $options;
22
22
  this.$errors = $errors;
@@ -29,20 +29,19 @@ class BundlerCompilerService extends events_1.EventEmitter {
29
29
  this.$cleanupService = $cleanupService;
30
30
  this.$packageManager = $packageManager;
31
31
  this.$packageInstallationManager = $packageInstallationManager;
32
- this.$projectConfigService = $projectConfigService;
33
- this.bundlerProcesses = {};
32
+ this.webpackProcesses = {};
34
33
  this.expectedHashes = {};
35
34
  }
36
35
  async compileWithWatch(platformData, projectData, prepareData) {
37
36
  return new Promise(async (resolve, reject) => {
38
- if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
37
+ if (this.webpackProcesses[platformData.platformNameLowerCase]) {
39
38
  resolve(void 0);
40
39
  return;
41
40
  }
42
- let isFirstBundlerWatchCompilation = true;
41
+ let isFirstWebpackWatchCompilation = true;
43
42
  prepareData.watch = true;
44
43
  try {
45
- const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
44
+ const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
46
45
  childProcess.stdout.on("data", function (data) {
47
46
  process.stdout.write(data);
48
47
  });
@@ -50,26 +49,25 @@ class BundlerCompilerService extends events_1.EventEmitter {
50
49
  process.stderr.write(data);
51
50
  });
52
51
  childProcess.on("message", (message) => {
53
- this.$logger.trace(`Message from ${projectData.bundler}`, message);
52
+ this.$logger.trace("Message from webpack", message);
54
53
  if (typeof message === "object" &&
55
54
  "version" in message &&
56
55
  "type" in message) {
57
- if (isFirstBundlerWatchCompilation) {
58
- isFirstBundlerWatchCompilation = false;
56
+ if (isFirstWebpackWatchCompilation) {
57
+ isFirstWebpackWatchCompilation = false;
59
58
  resolve(childProcess);
60
59
  return;
61
60
  }
62
61
  return this.handleHMRMessage(message, platformData, projectData, prepareData);
63
62
  }
64
- if (message ===
65
- `${capitalizeFirstLetter(projectData.bundler)} compilation complete.`) {
66
- this.$logger.info(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
63
+ if (message === "Webpack compilation complete.") {
64
+ this.$logger.info("Webpack build done!");
67
65
  resolve(childProcess);
68
66
  }
69
67
  message = message;
70
68
  if (message.emittedFiles) {
71
- if (isFirstBundlerWatchCompilation) {
72
- isFirstBundlerWatchCompilation = false;
69
+ if (isFirstWebpackWatchCompilation) {
70
+ isFirstWebpackWatchCompilation = false;
73
71
  this.expectedHashes[platformData.platformNameLowerCase] =
74
72
  prepareData.hmr ? message.hash : "";
75
73
  return;
@@ -97,40 +95,27 @@ class BundlerCompilerService extends events_1.EventEmitter {
97
95
  },
98
96
  platform: platformData.platformNameLowerCase,
99
97
  };
100
- this.$logger.trace(`Generated data from ${projectData.bundler} message:`, data);
98
+ this.$logger.trace("Generated data from webpack message:", data);
101
99
  if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
102
100
  return;
103
101
  }
104
102
  if (data.files.length) {
105
- this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
103
+ this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, data);
106
104
  }
107
105
  }
108
106
  });
109
107
  childProcess.on("error", (err) => {
110
- this.$logger.trace(`Unable to start ${projectData.bundler} process in watch mode. Error is: ${err}`);
111
- delete this.bundlerProcesses[platformData.platformNameLowerCase];
108
+ this.$logger.trace(`Unable to start webpack process in watch mode. Error is: ${err}`);
109
+ delete this.webpackProcesses[platformData.platformNameLowerCase];
112
110
  reject(err);
113
111
  });
114
112
  childProcess.on("close", async (arg) => {
115
- const exitCode = typeof arg === "number" ? arg : arg && arg.code;
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
113
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
131
- const error = new Error(`Executing ${projectData.bundler} failed with exit code ${exitCode}.`);
114
+ 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}.`);
132
117
  error.code = exitCode;
133
- delete this.bundlerProcesses[platformData.platformNameLowerCase];
118
+ delete this.webpackProcesses[platformData.platformNameLowerCase];
134
119
  reject(error);
135
120
  });
136
121
  }
@@ -141,26 +126,26 @@ class BundlerCompilerService extends events_1.EventEmitter {
141
126
  }
142
127
  async compileWithoutWatch(platformData, projectData, prepareData) {
143
128
  return new Promise(async (resolve, reject) => {
144
- if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
129
+ if (this.webpackProcesses[platformData.platformNameLowerCase]) {
145
130
  resolve();
146
131
  return;
147
132
  }
148
133
  try {
149
- const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
134
+ const childProcess = await this.startWebpackProcess(platformData, projectData, prepareData);
150
135
  childProcess.on("error", (err) => {
151
- this.$logger.trace(`Unable to start ${projectData.bundler} process in non-watch mode. Error is: ${err}`);
152
- delete this.bundlerProcesses[platformData.platformNameLowerCase];
136
+ this.$logger.trace(`Unable to start webpack process in non-watch mode. Error is: ${err}`);
137
+ delete this.webpackProcesses[platformData.platformNameLowerCase];
153
138
  reject(err);
154
139
  });
155
140
  childProcess.on("close", async (arg) => {
156
141
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
157
- delete this.bundlerProcesses[platformData.platformNameLowerCase];
142
+ delete this.webpackProcesses[platformData.platformNameLowerCase];
158
143
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
159
144
  if (exitCode === 0) {
160
145
  resolve();
161
146
  }
162
147
  else {
163
- const error = new Error(`Executing ${projectData.bundler} failed with exit code ${exitCode}.`);
148
+ const error = new Error(`Executing webpack failed with exit code ${exitCode}.`);
164
149
  error.code = exitCode;
165
150
  reject(error);
166
151
  }
@@ -171,14 +156,14 @@ class BundlerCompilerService extends events_1.EventEmitter {
171
156
  }
172
157
  });
173
158
  }
174
- async stopBundlerCompiler(platform) {
159
+ async stopWebpackCompiler(platform) {
175
160
  if (platform) {
176
- await this.stopBundlerForPlatform(platform);
161
+ await this.stopWebpackForPlatform(platform);
177
162
  }
178
163
  else {
179
- const bundlerPlatforms = Object.keys(this.bundlerProcesses);
180
- for (let i = 0; i < bundlerPlatforms.length; i++) {
181
- await this.stopBundlerForPlatform(bundlerPlatforms[i]);
164
+ const webpackedPlatforms = Object.keys(this.webpackProcesses);
165
+ for (let i = 0; i < webpackedPlatforms.length; i++) {
166
+ await this.stopWebpackForPlatform(webpackedPlatforms[i]);
182
167
  }
183
168
  }
184
169
  }
@@ -187,22 +172,12 @@ class BundlerCompilerService extends events_1.EventEmitter {
187
172
  const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
188
173
  return res;
189
174
  }
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
- }
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}.`);
200
178
  }
201
179
  const envData = this.buildEnvData(platformData.platformNameLowerCase, projectData, prepareData);
202
- const isVite = this.getBundler() === "vite";
203
- const envParams = isVite
204
- ? [`--mode=${platformData.platformNameLowerCase}`]
205
- : await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
180
+ const envParams = await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
206
181
  const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
207
182
  if (await this.shouldUsePreserveSymlinksOption()) {
208
183
  additionalNodeArgs.push("--preserve-symlinks");
@@ -212,15 +187,13 @@ class BundlerCompilerService extends events_1.EventEmitter {
212
187
  }
213
188
  const args = [
214
189
  ...additionalNodeArgs,
215
- this.getBundlerExecutablePath(projectData),
216
- this.isModernBundler(projectData) ? `build` : null,
217
- `--config=${projectData.bundlerConfigPath}`,
190
+ this.getWebpackExecutablePath(projectData),
191
+ this.isWebpack5(projectData) ? `build` : null,
192
+ `--config=${projectData.webpackConfigPath}`,
218
193
  ...envParams,
219
194
  ].filter(Boolean);
220
- if (!isVite) {
221
- if (prepareData.watch) {
222
- args.push("--watch");
223
- }
195
+ if (prepareData.watch) {
196
+ args.push("--watch");
224
197
  }
225
198
  const stdio = prepareData.watch ? ["ipc"] : "inherit";
226
199
  const options = {
@@ -229,7 +202,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
229
202
  };
230
203
  options.env = {
231
204
  NATIVESCRIPT_WEBPACK_ENV: JSON.stringify(envData),
232
- NATIVESCRIPT_BUNDLER_ENV: JSON.stringify(envData),
233
205
  };
234
206
  if (this.$hostInfo.isWindows) {
235
207
  Object.assign(options.env, { APPDATA: process.env.appData });
@@ -241,9 +213,8 @@ class BundlerCompilerService extends events_1.EventEmitter {
241
213
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
242
214
  });
243
215
  }
244
- console.log("args:", args);
245
216
  const childProcess = this.$childProcess.spawn(process.execPath, args, options);
246
- this.bundlerProcesses[platformData.platformNameLowerCase] = childProcess;
217
+ this.webpackProcesses[platformData.platformNameLowerCase] = childProcess;
247
218
  await this.$cleanupService.addKillProcess(childProcess.pid.toString());
248
219
  return childProcess;
249
220
  }
@@ -288,15 +259,13 @@ class BundlerCompilerService extends events_1.EventEmitter {
288
259
  envFlagNames.splice(envFlagNames.indexOf("snapshot"), 1);
289
260
  }
290
261
  else if (this.$hostInfo.isWindows) {
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
- }
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).`);
300
269
  }
301
270
  }
302
271
  }
@@ -347,21 +316,21 @@ class BundlerCompilerService extends events_1.EventEmitter {
347
316
  }
348
317
  return hotHash || "";
349
318
  }
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];
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];
357
326
  }
358
327
  }
359
328
  handleHMRMessage(message, platformData, projectData, prepareData) {
360
- this.$logger.trace(`Received message from ${projectData.bundler} process:`, message);
329
+ this.$logger.trace("Received message from webpack process:", message);
361
330
  if (message.type !== "compilation") {
362
331
  return;
363
332
  }
364
- this.$logger.trace(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
333
+ this.$logger.trace("Webpack build done!");
365
334
  const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
366
335
  const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
367
336
  const lastHash = (() => {
@@ -378,7 +347,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
378
347
  if (!files.length) {
379
348
  return;
380
349
  }
381
- this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, {
350
+ this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, {
382
351
  files,
383
352
  staleFiles,
384
353
  hasOnlyHotUpdateFiles: prepareData.hmr,
@@ -389,18 +358,9 @@ class BundlerCompilerService extends events_1.EventEmitter {
389
358
  platform: platformData.platformNameLowerCase,
390
359
  });
391
360
  }
392
- getBundlerExecutablePath(projectData) {
393
- const bundler = this.getBundler();
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)) {
403
- const packagePath = (0, package_path_helper_1.resolvePackagePath)(`@nativescript/${bundler}`, {
361
+ getWebpackExecutablePath(projectData) {
362
+ if (this.isWebpack5(projectData)) {
363
+ const packagePath = (0, package_path_helper_1.resolvePackagePath)("@nativescript/webpack", {
404
364
  paths: [projectData.projectDir],
405
365
  });
406
366
  if (packagePath) {
@@ -415,35 +375,22 @@ class BundlerCompilerService extends events_1.EventEmitter {
415
375
  }
416
376
  return path.resolve(packagePath, "bin", "webpack.js");
417
377
  }
418
- isModernBundler(projectData) {
419
- const bundler = this.getBundler();
420
- switch (bundler) {
421
- case "rspack":
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")) {
422
386
  return true;
423
- default:
424
- const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)(constants_1.WEBPACK_PLUGIN_NAME, {
425
- paths: [projectData.projectDir],
426
- });
427
- if (packageJSONPath) {
428
- const packageData = this.$fs.readJson(packageJSONPath);
429
- const ver = semver.coerce(packageData.version);
430
- if (semver.satisfies(ver, ">= 5.0.0")) {
431
- return true;
432
- }
433
- }
434
- break;
387
+ }
435
388
  }
436
389
  return false;
437
390
  }
438
- getBundler() {
439
- return this.$projectConfigService.getValue(`bundler`, "webpack");
440
- }
441
391
  }
442
- exports.BundlerCompilerService = BundlerCompilerService;
392
+ exports.WebpackCompilerService = WebpackCompilerService;
443
393
  __decorate([
444
394
  (0, decorators_1.performanceLog)()
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);
395
+ ], WebpackCompilerService.prototype, "startWebpackProcess", null);
396
+ yok_1.injector.register("webpackCompilerService", WebpackCompilerService);
@@ -0,0 +1,226 @@
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
+ }
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.2",
4
+ "version": "9.0.0-alpha.0",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "keywords": [
52
52
  "nativescript",
53
- "telerik",
53
+ "typescript",
54
54
  "mobile"
55
55
  ],
56
56
  "dependencies": {
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });