nativescript 9.0.0-alpha.12 → 9.0.0-alpha.14
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/config/test-deps-versions-generated.json +2 -2
- package/docs/build-jekyll-md.sh +1 -1
- package/docs/man_pages/config/config-get.md +36 -0
- package/docs/man_pages/config/config-set.md +40 -0
- package/docs/man_pages/config/config.md +39 -0
- package/docs/man_pages/project/hooks/hooks.md +35 -0
- package/docs/man_pages/start.md +1 -0
- package/lib/.d.ts +4 -0
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +7 -0
- package/lib/bootstrap.js +7 -1
- package/lib/bun-package-manager.js +14 -1
- package/lib/color.js +4 -0
- package/lib/commands/add-platform.js +1 -0
- package/lib/commands/apple-login.js +1 -0
- package/lib/commands/appstore-list.js +1 -0
- package/lib/commands/appstore-upload.js +3 -0
- package/lib/commands/build.js +3 -2
- package/lib/commands/clean.js +22 -1
- package/lib/commands/command-base.js +1 -0
- package/lib/commands/config.js +5 -0
- package/lib/commands/create-project.js +6 -0
- package/lib/commands/debug.js +6 -1
- package/lib/commands/deploy.js +3 -2
- package/lib/commands/embedding/embed.js +7 -0
- package/lib/commands/extensibility/install-extension.js +1 -0
- package/lib/commands/extensibility/list-extensions.js +1 -0
- package/lib/commands/extensibility/uninstall-extension.js +1 -0
- package/lib/commands/fonts.js +1 -0
- package/lib/commands/generate-assets.js +1 -0
- package/lib/commands/generate-help.js +1 -0
- package/lib/commands/generate.js +48 -1
- package/lib/commands/hooks/common.js +80 -0
- package/lib/commands/hooks/hooks-lock.js +101 -0
- package/lib/commands/hooks/hooks.js +72 -0
- package/lib/commands/info.js +1 -0
- package/lib/commands/install.js +1 -0
- package/lib/commands/list-platforms.js +1 -0
- package/lib/commands/migrate.js +1 -0
- package/lib/commands/native-add.js +5 -0
- package/lib/commands/platform-clean.js +1 -0
- package/lib/commands/plugin/add-plugin.js +1 -0
- package/lib/commands/plugin/build-plugin.js +1 -0
- package/lib/commands/plugin/create-plugin.js +5 -0
- package/lib/commands/plugin/list-plugins.js +1 -0
- package/lib/commands/plugin/remove-plugin.js +2 -0
- package/lib/commands/plugin/update-plugin.js +1 -0
- package/lib/commands/post-install.js +6 -0
- package/lib/commands/prepare.js +4 -3
- package/lib/commands/preview.js +2 -0
- package/lib/commands/remove-platform.js +1 -0
- package/lib/commands/resources/resources-update.js +2 -0
- package/lib/commands/run.js +1 -0
- package/lib/commands/setup.js +1 -0
- package/lib/commands/start.js +1 -0
- package/lib/commands/test-init.js +4 -0
- package/lib/commands/test.js +9 -2
- package/lib/commands/typings.js +2 -1
- package/lib/commands/update-platform.js +5 -0
- package/lib/commands/update.js +2 -0
- package/lib/commands/widget.js +20 -1
- package/lib/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +3 -0
- package/lib/common/codeGeneration/code-entity.js +1 -0
- package/lib/common/codeGeneration/code-printer.js +1 -0
- package/lib/common/command-params.js +1 -0
- package/lib/common/commands/analytics.js +3 -0
- package/lib/common/commands/autocompletion.js +3 -0
- package/lib/common/commands/device/device-log-stream.js +1 -0
- package/lib/common/commands/device/get-file.js +2 -0
- package/lib/common/commands/device/list-applications.js +1 -0
- package/lib/common/commands/device/list-devices.js +3 -0
- package/lib/common/commands/device/list-files.js +2 -0
- package/lib/common/commands/device/put-file.js +2 -0
- package/lib/common/commands/device/run-application.js +1 -0
- package/lib/common/commands/device/stop-application.js +1 -0
- package/lib/common/commands/device/uninstall-application.js +1 -0
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +1 -0
- package/lib/common/commands/help.js +1 -0
- package/lib/common/commands/package-manager-get.js +1 -0
- package/lib/common/commands/package-manager-set.js +1 -0
- package/lib/common/commands/post-install.js +1 -0
- package/lib/common/commands/preuninstall.js +11 -2
- package/lib/common/commands/proxy/proxy-base.js +4 -0
- package/lib/common/commands/proxy/proxy-clear.js +1 -0
- package/lib/common/commands/proxy/proxy-get.js +1 -0
- package/lib/common/commands/proxy/proxy-set.js +1 -0
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/decorators.js +48 -0
- package/lib/common/definitions/extensibility.d.ts +2 -2
- package/lib/common/definitions/mobile.d.ts +72 -72
- package/lib/common/dispatchers.js +10 -1
- package/lib/common/errors.js +13 -3
- package/lib/common/file-system.js +13 -2
- package/lib/common/header.js +3 -0
- package/lib/common/helpers.js +89 -3
- package/lib/common/host-info.js +4 -0
- package/lib/common/http-client.js +20 -0
- package/lib/common/logger/appenders/cli-appender.js +4 -0
- package/lib/common/logger/appenders/emit-appender.js +4 -0
- package/lib/common/logger/layouts/cli-layout.js +1 -0
- package/lib/common/logger/logger.js +5 -0
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +20 -1
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
- package/lib/common/mobile/android/android-debug-bridge.js +6 -0
- package/lib/common/mobile/android/android-device-file-system.js +4 -0
- package/lib/common/mobile/android/android-device-hash-service.js +3 -0
- package/lib/common/mobile/android/android-device.js +8 -0
- package/lib/common/mobile/android/android-emulator-services.js +2 -1
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +4 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +6 -1
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
- package/lib/common/mobile/android/logcat-helper.js +13 -0
- package/lib/common/mobile/application-manager-base.js +6 -0
- package/lib/common/mobile/device-emitter.js +4 -0
- package/lib/common/mobile/device-log-emitter.js +1 -0
- package/lib/common/mobile/device-log-provider-base.js +1 -0
- package/lib/common/mobile/device-log-provider.js +23 -0
- package/lib/common/mobile/device-platforms-constants.js +1 -0
- package/lib/common/mobile/emulator-helper.js +3 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
- package/lib/common/mobile/ios/device/ios-device.js +4 -0
- package/lib/common/mobile/ios/ios-device-base.js +1 -0
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
- package/lib/common/mobile/ios/ios-log-filter.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
- package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
- package/lib/common/mobile/log-filter.js +2 -0
- package/lib/common/mobile/logging-levels.js +1 -0
- package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
- package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
- package/lib/common/mobile/mobile-core/devices-service.js +69 -0
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-helper.js +1 -0
- package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
- package/lib/common/opener.js +1 -0
- package/lib/common/os-info.js +1 -0
- package/lib/common/plist-parser.js +1 -0
- package/lib/common/project-helper.js +1 -0
- package/lib/common/prompter.js +9 -1
- package/lib/common/queue.js +1 -0
- package/lib/common/resource-loader.js +1 -0
- package/lib/common/services/auto-completion-service.js +13 -1
- package/lib/common/services/cancellation.js +2 -1
- package/lib/common/services/commands-service.js +17 -6
- package/lib/common/services/help-service.js +11 -3
- package/lib/common/services/hooks-service.js +13 -0
- package/lib/common/services/ios-notification-service.js +1 -0
- package/lib/common/services/json-file-settings-service.js +6 -0
- package/lib/common/services/lock-service.js +6 -0
- package/lib/common/services/message-contract-generator.js +1 -0
- package/lib/common/services/messages-service.js +1 -0
- package/lib/common/services/micro-templating-service.js +6 -0
- package/lib/common/services/net-service.js +3 -0
- package/lib/common/services/project-files-manager.js +5 -0
- package/lib/common/services/project-files-provider-base.js +1 -0
- package/lib/common/services/proxy-service.js +1 -0
- package/lib/common/services/qr.js +1 -0
- package/lib/common/services/settings-service.js +1 -0
- package/lib/common/services/xcode-select-service.js +1 -0
- package/lib/common/utils.js +1 -0
- package/lib/common/validators/project-name-validator.js +1 -0
- package/lib/common/validators/validation-result.js +1 -0
- package/lib/common/verify-node-version.js +8 -1
- package/lib/common/yok.js +32 -11
- package/lib/config.js +22 -1
- package/lib/constants-provider.js +1 -0
- package/lib/constants.js +53 -0
- package/lib/controllers/build-controller.js +4 -3
- package/lib/controllers/debug-controller.js +8 -3
- package/lib/controllers/deploy-controller.js +1 -0
- package/lib/controllers/migrate-controller.js +90 -4
- package/lib/controllers/platform-controller.js +9 -1
- package/lib/controllers/prepare-controller.js +17 -4
- package/lib/controllers/run-controller.js +17 -1
- package/lib/controllers/update-controller-base.js +1 -0
- package/lib/controllers/update-controller.js +11 -0
- package/lib/data/build-data.js +1 -0
- package/lib/data/controller-data-base.js +1 -0
- package/lib/data/debug-data.js +1 -0
- package/lib/data/platform-data.js +1 -0
- package/lib/data/prepare-data.js +1 -0
- package/lib/data/run-data.js +1 -0
- package/lib/definitions/hooks.d.ts +1 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
- package/lib/detached-processes/cleanup-process.js +18 -14
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +1 -0
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
- package/lib/device-sockets/ios/notification.js +3 -0
- package/lib/device-sockets/ios/socket-request-executor.js +3 -0
- package/lib/helpers/android-bundle-validator-helper.js +2 -1
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/helpers/key-command-helper.js +4 -2
- package/lib/helpers/livesync-command-helper.js +4 -1
- package/lib/helpers/network-connectivity-validator.js +1 -0
- package/lib/helpers/options-track-helper.js +3 -2
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +7 -2
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +5 -4
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +11 -1
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +11 -1
- package/lib/options.js +144 -119
- package/lib/package-installation-manager.js +8 -1
- package/lib/package-manager.js +2 -0
- package/lib/platform-command-param.js +1 -0
- package/lib/pnpm-package-manager.js +4 -1
- package/lib/project-data.js +12 -0
- package/lib/providers/project-files-provider.js +1 -0
- package/lib/resolvers/livesync-service-resolver.js +1 -0
- package/lib/services/analytics/analytics-broker-process.js +10 -6
- package/lib/services/analytics/analytics-broker.js +2 -1
- package/lib/services/analytics/analytics-service.js +29 -25
- package/lib/services/analytics/google-analytics-provider.js +13 -12
- package/lib/services/analytics-settings-service.js +5 -0
- package/lib/services/android/android-bundle-tool-service.js +1 -0
- package/lib/services/android/gradle-build-args-service.js +3 -0
- package/lib/services/android/gradle-build-service.js +1 -0
- package/lib/services/android/gradle-command-service.js +1 -0
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +31 -2
- package/lib/services/android-project-service.js +71 -4
- package/lib/services/android-resources-migration-service.js +7 -0
- package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
- package/lib/services/apple-portal/srp/srp-wrapper.js +4 -1
- package/lib/services/assets-generation/assets-generation-service.js +10 -5
- package/lib/services/build-artifacts-service.js +2 -1
- package/lib/services/build-data-service.js +1 -0
- package/lib/services/build-info-file-service.js +1 -0
- package/lib/services/bundler/bundler-compiler-service.js +116 -116
- package/lib/services/bundler/bundler.js +1 -0
- package/lib/services/cleanup-service.js +13 -9
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +21 -1
- package/lib/services/debug-data-service.js +1 -0
- package/lib/services/debug-service-base.js +7 -0
- package/lib/services/device/device-install-app-service.js +2 -1
- package/lib/services/doctor-service.js +21 -6
- package/lib/services/extensibility-service.js +9 -1
- package/lib/services/files-hash-service.js +1 -0
- package/lib/services/hmr-status-service.js +2 -0
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +5 -1
- package/lib/services/ios/export-options-plist-service.js +4 -0
- package/lib/services/ios/ios-signing-service.js +4 -0
- package/lib/services/ios/spm-service.js +11 -0
- package/lib/services/ios/xcodebuild-args-service.js +9 -0
- package/lib/services/ios/xcodebuild-command-service.js +1 -0
- package/lib/services/ios/xcodebuild-service.js +2 -1
- package/lib/services/ios-debugger-port-service.js +1 -0
- package/lib/services/ios-device-debug-service.js +1 -0
- package/lib/services/ios-entitlements-service.js +1 -0
- package/lib/services/ios-extensions-service.js +1 -0
- package/lib/services/ios-log-filter.js +20 -0
- package/lib/services/ios-native-target-service.js +6 -4
- package/lib/services/ios-project-service.js +91 -1
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +49 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +21 -2
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +14 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +21 -2
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +3 -0
- package/lib/services/terminal-spinner-service.js +2 -0
- package/lib/services/test-execution-service.js +9 -2
- package/lib/services/test-initialization-service.js +4 -0
- package/lib/services/timeline-profiler-service.js +1 -0
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +6 -4
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/xcconfig-service.js +2 -0
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +2 -1
- package/lib/tools/config-manipulation/config-transformer.js +12 -0
- package/lib/tools/node-modules/node-modules-builder.js +1 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +1 -0
- package/lib/yarn2-package-manager.js +3 -0
- package/package.json +11 -10
- package/vendor/aab-tool/README.txt +1 -1
- package/vendor/aab-tool/bundletool.jar +0 -0
- package/vendor/gradle-plugin/build.gradle +1 -1
|
@@ -10,14 +10,17 @@ exports.BundlerCompilerService = void 0;
|
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const semver = require("semver");
|
|
12
12
|
const _ = require("lodash");
|
|
13
|
+
// TODO: can switch to file-system service
|
|
13
14
|
const events_1 = require("events");
|
|
14
15
|
const decorators_1 = require("../../common/decorators");
|
|
15
16
|
const constants_1 = require("../../constants");
|
|
16
17
|
const yok_1 = require("../../common/yok");
|
|
17
18
|
const package_path_helper_1 = require("../../helpers/package-path-helper");
|
|
19
|
+
/* for specific bundling debugging separate from logger */
|
|
18
20
|
const debugLog = false;
|
|
19
21
|
class BundlerCompilerService extends events_1.EventEmitter {
|
|
20
|
-
constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, $
|
|
22
|
+
constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, // private $sharedEventBus: ISharedEventBus
|
|
23
|
+
$projectConfigService) {
|
|
21
24
|
super();
|
|
22
25
|
this.$options = $options;
|
|
23
26
|
this.$errors = $errors;
|
|
@@ -44,6 +47,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
44
47
|
prepareData.watch = true;
|
|
45
48
|
try {
|
|
46
49
|
const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
|
|
50
|
+
// Handle Vite differently from webpack
|
|
47
51
|
const isVite = this.getBundler() === "vite";
|
|
48
52
|
childProcess.stdout.on("data", function (data) {
|
|
49
53
|
process.stdout.write(data);
|
|
@@ -51,8 +55,11 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
51
55
|
childProcess.stderr.on("data", function (data) {
|
|
52
56
|
process.stderr.write(data);
|
|
53
57
|
});
|
|
58
|
+
// For both Vite and webpack, we wait for the first build to complete
|
|
59
|
+
// Don't resolve immediately for Vite - wait for first IPC message
|
|
54
60
|
childProcess.on("message", (message) => {
|
|
55
61
|
this.$logger.trace(`Message from ${projectData.bundler}`, message);
|
|
62
|
+
// Handle Vite messages
|
|
56
63
|
if (isVite &&
|
|
57
64
|
message &&
|
|
58
65
|
message.emittedFiles) {
|
|
@@ -60,53 +67,30 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
60
67
|
if (debugLog) {
|
|
61
68
|
console.log("Received Vite IPC message:", message);
|
|
62
69
|
}
|
|
63
|
-
|
|
70
|
+
// Copy Vite output files directly to platform destination
|
|
71
|
+
const distOutput = path.join(projectData.projectDir, ".ns-vite-build");
|
|
64
72
|
const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
|
|
65
73
|
if (debugLog) {
|
|
66
|
-
console.log(
|
|
74
|
+
console.log(`Copying from ${distOutput} to ${destDir}.`);
|
|
67
75
|
}
|
|
68
|
-
|
|
76
|
+
// Determine which files to copy based on build type and changes
|
|
77
|
+
if (message.buildType === "incremental" &&
|
|
78
|
+
message.emittedFiles &&
|
|
79
|
+
message.emittedFiles.length > 0) {
|
|
80
|
+
// Incremental builds: only copy files that are likely affected by the changes
|
|
81
|
+
const filesToCopy = this.getIncrementalFilesToCopy(message.emittedFiles);
|
|
69
82
|
if (debugLog) {
|
|
70
|
-
console.log("
|
|
71
|
-
}
|
|
72
|
-
let filesToCopy = message.emittedFiles;
|
|
73
|
-
const hasHTMLChanges = message.changedFiles.some((f) => f.endsWith(".html"));
|
|
74
|
-
if (hasHTMLChanges) {
|
|
75
|
-
filesToCopy = message.emittedFiles.filter((f) => f.includes(".component") ||
|
|
76
|
-
f === "bundle.mjs" ||
|
|
77
|
-
f === "bundle.mjs.map");
|
|
78
|
-
if (debugLog) {
|
|
79
|
-
console.log("🔥 HTML change detected - copying component files:", filesToCopy);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
this.copyViteBundleToNative(distOutput, destDir, filesToCopy);
|
|
83
|
-
}
|
|
84
|
-
else if (message.buildType === "incremental" &&
|
|
85
|
-
message.changedFiles &&
|
|
86
|
-
message.changedFiles.length > 0) {
|
|
87
|
-
if (debugLog) {
|
|
88
|
-
console.log("🔥 Incremental build - copying only relevant files for:", message.changedFiles);
|
|
89
|
-
}
|
|
90
|
-
const filesToCopy = this.getIncrementalFilesToCopy(message.emittedFiles, message.changedFiles);
|
|
91
|
-
if (debugLog) {
|
|
92
|
-
console.log("🔥 Incremental build - files to copy:", filesToCopy);
|
|
83
|
+
console.log("Incremental build - files to copy:", filesToCopy);
|
|
93
84
|
}
|
|
94
85
|
this.copyViteBundleToNative(distOutput, destDir, filesToCopy);
|
|
95
86
|
}
|
|
96
|
-
else if (message.buildType === "incremental" &&
|
|
97
|
-
message.changedFiles &&
|
|
98
|
-
message.changedFiles.length > 0) {
|
|
99
|
-
console.log("🔥 Incremental build - copying only relevant files for:", message.changedFiles);
|
|
100
|
-
const filesToCopy = this.getIncrementalFilesToCopy(message.emittedFiles, message.changedFiles);
|
|
101
|
-
console.log("🔥 Incremental build - files to copy:", filesToCopy);
|
|
102
|
-
this.copyViteBundleToNative(distOutput, destDir, filesToCopy);
|
|
103
|
-
}
|
|
104
87
|
else {
|
|
105
88
|
if (debugLog) {
|
|
106
|
-
console.log("
|
|
89
|
+
console.log("Full build - copying all files.");
|
|
107
90
|
}
|
|
108
91
|
this.copyViteBundleToNative(distOutput, destDir);
|
|
109
92
|
}
|
|
93
|
+
// Resolve the promise on first build completion
|
|
110
94
|
if (isFirstBundlerWatchCompilation) {
|
|
111
95
|
isFirstBundlerWatchCompilation = false;
|
|
112
96
|
if (debugLog) {
|
|
@@ -114,6 +98,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
114
98
|
}
|
|
115
99
|
resolve(childProcess);
|
|
116
100
|
}
|
|
101
|
+
// Transform Vite message to match webpack format
|
|
117
102
|
const files = message.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
|
|
118
103
|
const data = {
|
|
119
104
|
files,
|
|
@@ -125,34 +110,29 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
125
110
|
platform: platformData.platformNameLowerCase,
|
|
126
111
|
};
|
|
127
112
|
this.$logger.info(`Vite build completed! Files copied to native platform.`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
timestamp: Date.now(),
|
|
131
|
-
changedFiles: message.changedFiles || [],
|
|
132
|
-
buildType: message.buildType || "incremental",
|
|
133
|
-
isHMR: message.isHMR || false,
|
|
134
|
-
});
|
|
135
|
-
if (message.isHMR) {
|
|
136
|
-
if (debugLog) {
|
|
137
|
-
console.log("🔥 Skipping BUNDLER_COMPILATION_COMPLETE for HMR update - app will not restart");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
if (debugLog) {
|
|
142
|
-
console.log("🔥 Emitting BUNDLER_COMPILATION_COMPLETE for full build");
|
|
143
|
-
}
|
|
144
|
-
this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
|
|
113
|
+
if (debugLog) {
|
|
114
|
+
console.log("Emitting BUNDLER_COMPILATION_COMPLETE for full build.");
|
|
145
115
|
}
|
|
116
|
+
this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
|
|
146
117
|
return;
|
|
147
118
|
}
|
|
119
|
+
// if we are on webpack5 - we handle HMR in a slightly different way
|
|
148
120
|
if (typeof message === "object" &&
|
|
149
121
|
"version" in message &&
|
|
150
122
|
"type" in message) {
|
|
123
|
+
// first compilation can be ignored because it will be synced regardless
|
|
124
|
+
// handling it here would trigger 2 syncs
|
|
151
125
|
if (isFirstBundlerWatchCompilation) {
|
|
152
126
|
isFirstBundlerWatchCompilation = false;
|
|
153
127
|
resolve(childProcess);
|
|
154
128
|
return;
|
|
155
129
|
}
|
|
130
|
+
// if ((message as IWebpackMessage).type === "hmr-status") {
|
|
131
|
+
// // we pass message through our event-bus to be handled wherever needed
|
|
132
|
+
// // in this case webpack-hmr-status-service listens for this event
|
|
133
|
+
// this.$sharedEventBus.emit("webpack:hmr-status", message);
|
|
134
|
+
// return;
|
|
135
|
+
// }
|
|
156
136
|
return this.handleHMRMessage(message, platformData, projectData, prepareData);
|
|
157
137
|
}
|
|
158
138
|
if (message ===
|
|
@@ -168,6 +148,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
168
148
|
prepareData.hmr ? message.hash : "";
|
|
169
149
|
return;
|
|
170
150
|
}
|
|
151
|
+
// Persist the previousHash value before calling `this.getUpdatedEmittedFiles` as it will modify the expectedHashes object with the current hash
|
|
171
152
|
const previousHash = this.expectedHashes[platformData.platformNameLowerCase];
|
|
172
153
|
let result;
|
|
173
154
|
if (prepareData.hmr) {
|
|
@@ -192,6 +173,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
192
173
|
platform: platformData.platformNameLowerCase,
|
|
193
174
|
};
|
|
194
175
|
this.$logger.trace(`Generated data from ${projectData.bundler} message:`, data);
|
|
176
|
+
// the hash of the compilation is the same as the previous one and there are only hot updates produced
|
|
195
177
|
if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
|
|
196
178
|
return;
|
|
197
179
|
}
|
|
@@ -264,6 +246,9 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
264
246
|
}
|
|
265
247
|
}
|
|
266
248
|
async shouldUsePreserveSymlinksOption() {
|
|
249
|
+
// pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
|
|
250
|
+
// and it also does not work in some cases.
|
|
251
|
+
// Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
|
|
267
252
|
const currentPackageManager = await this.$packageManager.getPackageManagerName();
|
|
268
253
|
const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
|
|
269
254
|
return res;
|
|
@@ -282,6 +267,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
282
267
|
const envData = this.buildEnvData(platformData.platformNameLowerCase, projectData, prepareData);
|
|
283
268
|
const isVite = this.getBundler() === "vite";
|
|
284
269
|
const cliArgs = await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
|
|
270
|
+
// Note: With Vite, we need `--` to prevent vite cli from erroring on unknown options.
|
|
285
271
|
const envParams = isVite
|
|
286
272
|
? [
|
|
287
273
|
`--mode=${prepareData.release ? "production" : "development"}`,
|
|
@@ -300,7 +286,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
300
286
|
const args = [
|
|
301
287
|
...additionalNodeArgs,
|
|
302
288
|
this.getBundlerExecutablePath(projectData),
|
|
303
|
-
isVite
|
|
289
|
+
isVite || this.isModernBundler(projectData) ? "build" : null,
|
|
304
290
|
`--config=${projectData.bundlerConfigPath}`,
|
|
305
291
|
...envParams,
|
|
306
292
|
].filter(Boolean);
|
|
@@ -349,16 +335,28 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
349
335
|
});
|
|
350
336
|
envData.verbose = envData.verbose || this.$logger.isVerbose();
|
|
351
337
|
envData.production = envData.production || prepareData.release;
|
|
338
|
+
// add the config file name to the env data so the webpack process can read the
|
|
339
|
+
// correct config file when resolving the CLI lib and the config service
|
|
340
|
+
// we are explicitly setting it to false to force using the defaults
|
|
352
341
|
envData.config =
|
|
353
342
|
(_b = (_a = process.env.NATIVESCRIPT_CONFIG_NAME) !== null && _a !== void 0 ? _a : this.$options.config) !== null && _b !== void 0 ? _b : "false";
|
|
343
|
+
// explicitly set the env variable
|
|
354
344
|
process.env.NATIVESCRIPT_CONFIG_NAME = envData.config;
|
|
345
|
+
// The snapshot generation is wrongly located in the Webpack plugin.
|
|
346
|
+
// It should be moved in the Native Prepare of the CLI or a Gradle task in the Runtime.
|
|
347
|
+
// As a workaround, we skip the mksnapshot, xxd and android-ndk calls based on skipNativePrepare.
|
|
348
|
+
// In this way the plugin will prepare only the snapshot JS entry without any native prepare and
|
|
349
|
+
// we will able to execute cloud builds with snapshot without having any local snapshot or Docker setup.
|
|
350
|
+
// TODO: Remove this flag when we remove the native part from the plugin.
|
|
355
351
|
envData.skipSnapshotTools =
|
|
356
352
|
prepareData.nativePrepare && prepareData.nativePrepare.skipNativePrepare;
|
|
353
|
+
// only set sourceMap if not explicitly set through a flag
|
|
357
354
|
if (typeof ((_c = prepareData === null || prepareData === void 0 ? void 0 : prepareData.env) === null || _c === void 0 ? void 0 : _c.sourceMap) === "undefined") {
|
|
358
355
|
if (!prepareData.release) {
|
|
359
356
|
envData.sourceMap = true;
|
|
360
357
|
}
|
|
361
358
|
}
|
|
359
|
+
// convert string to boolean
|
|
362
360
|
if (envData.sourceMap === "true" || envData.sourceMap === "false") {
|
|
363
361
|
envData.sourceMap = envData.sourceMap === "true";
|
|
364
362
|
}
|
|
@@ -379,6 +377,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
379
377
|
}
|
|
380
378
|
else if (this.$hostInfo.isWindows) {
|
|
381
379
|
if (projectData.bundler === "webpack") {
|
|
380
|
+
//TODO: check this use case for webpack5 WEBPACK_PLUGIN_NAME
|
|
382
381
|
const minWebpackPluginWithWinSnapshotsVersion = "1.3.0";
|
|
383
382
|
const installedWebpackPluginVersion = await this.$packageInstallationManager.getInstalledDependencyVersion(constants_1.WEBPACK_PLUGIN_NAME, projectData.projectDir);
|
|
384
383
|
const hasWebpackPluginWithWinSnapshotsSupport = !!installedWebpackPluginVersion
|
|
@@ -412,6 +411,15 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
412
411
|
}
|
|
413
412
|
getUpdatedEmittedFiles(allEmittedFiles, chunkFiles, nextHash, platform) {
|
|
414
413
|
const currentHash = this.getCurrentHotUpdateHash(allEmittedFiles);
|
|
414
|
+
// This logic is needed as there are already cases when webpack doesn't emit any files physically.
|
|
415
|
+
// We've set noEmitOnErrors in webpack.config.js based on noEmitOnError from tsconfig.json,
|
|
416
|
+
// so webpack doesn't emit any files when noEmitOnErrors: true is set in webpack.config.js and
|
|
417
|
+
// there is a compilation error in the source code. On the other side, hmr generates new hot-update files
|
|
418
|
+
// on every change and the hash of the next hmr update is written inside hot-update.json file.
|
|
419
|
+
// Although webpack doesn't emit any files, hmr hash is still generated. The hash is generated per compilation no matter
|
|
420
|
+
// if files will be emitted or not. This way, the first successful compilation after fixing the compilation error generates
|
|
421
|
+
// a hash that is not the same as the one expected in the latest emitted hot-update.json file.
|
|
422
|
+
// As a result, the hmr chain is broken and the changes are not applied.
|
|
415
423
|
const isHashValid = nextHash
|
|
416
424
|
? this.expectedHashes[platform] === currentHash
|
|
417
425
|
: true;
|
|
@@ -430,6 +438,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
430
438
|
let hotHash;
|
|
431
439
|
const hotUpdateScripts = emittedFiles.filter((x) => x.endsWith(".hot-update.js"));
|
|
432
440
|
if (hotUpdateScripts && hotUpdateScripts.length) {
|
|
441
|
+
// the hash is the same for each hot update in the current compilation
|
|
433
442
|
const hotUpdateName = hotUpdateScripts[0];
|
|
434
443
|
const matcher = /^(.+)\.(.+)\.hot-update/gm;
|
|
435
444
|
const matches = matcher.exec(hotUpdateName);
|
|
@@ -447,6 +456,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
447
456
|
}
|
|
448
457
|
}
|
|
449
458
|
handleHMRMessage(message, platformData, projectData, prepareData) {
|
|
459
|
+
// handle new bundler hmr packets
|
|
450
460
|
this.$logger.trace(`Received message from ${projectData.bundler} process:`, message);
|
|
451
461
|
if (message.type !== "compilation") {
|
|
452
462
|
return;
|
|
@@ -454,6 +464,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
454
464
|
this.$logger.trace(`${capitalizeFirstLetter(projectData.bundler)} build done!`);
|
|
455
465
|
const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
|
|
456
466
|
const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
|
|
467
|
+
// extract last hash from emitted filenames
|
|
457
468
|
const lastHash = (() => {
|
|
458
469
|
const absoluteFileNameWithLastHash = files.find((fileName) => fileName.endsWith("hot-update.js"));
|
|
459
470
|
if (!absoluteFileNameWithLastHash) {
|
|
@@ -466,6 +477,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
466
477
|
}
|
|
467
478
|
})();
|
|
468
479
|
if (!files.length) {
|
|
480
|
+
// ignore compilations if no new files are emitted
|
|
469
481
|
return;
|
|
470
482
|
}
|
|
471
483
|
this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, {
|
|
@@ -529,38 +541,45 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
529
541
|
return this.$projectConfigService.getValue(`bundler`, "webpack");
|
|
530
542
|
}
|
|
531
543
|
copyViteBundleToNative(distOutput, destDir, specificFiles = null) {
|
|
544
|
+
// Clean and copy Vite output to native platform folder
|
|
532
545
|
if (debugLog) {
|
|
533
|
-
console.log(`Copying Vite bundle from "${distOutput}" to "${destDir}"
|
|
546
|
+
console.log(`Copying Vite bundle from "${distOutput}" to "${destDir}".`);
|
|
534
547
|
}
|
|
535
|
-
const fs = require("fs");
|
|
536
548
|
try {
|
|
537
549
|
if (specificFiles) {
|
|
550
|
+
// Selective mode: only copy specific files (incremental)
|
|
538
551
|
if (debugLog) {
|
|
539
|
-
console.log("
|
|
552
|
+
console.log("Selective copy - copying specific files:", specificFiles);
|
|
540
553
|
}
|
|
541
|
-
|
|
554
|
+
// Ensure destination directory exists
|
|
555
|
+
this.$fs.createDirectory(destDir);
|
|
556
|
+
// Copy only the specified files
|
|
542
557
|
for (const file of specificFiles) {
|
|
543
558
|
const srcPath = path.join(distOutput, file);
|
|
544
559
|
const destPath = path.join(destDir, file);
|
|
545
|
-
if (!fs.
|
|
560
|
+
if (!this.$fs.exists(srcPath))
|
|
546
561
|
continue;
|
|
547
|
-
|
|
548
|
-
fs.
|
|
562
|
+
// create parent dirs
|
|
563
|
+
this.$fs.createDirectory(path.dirname(destPath));
|
|
564
|
+
this.$fs.copyFile(srcPath, destPath);
|
|
549
565
|
if (debugLog) {
|
|
550
|
-
console.log(
|
|
566
|
+
console.log(`Copied ${file}`);
|
|
551
567
|
}
|
|
552
568
|
}
|
|
553
569
|
}
|
|
554
570
|
else {
|
|
571
|
+
// Full build mode: clean and copy everything
|
|
555
572
|
if (debugLog) {
|
|
556
|
-
console.log("
|
|
573
|
+
console.log("Full build: Copying all files.");
|
|
557
574
|
}
|
|
558
|
-
|
|
559
|
-
|
|
575
|
+
// Clean destination directory
|
|
576
|
+
if (this.$fs.exists(destDir)) {
|
|
577
|
+
this.$fs.deleteDirectory(destDir);
|
|
560
578
|
}
|
|
561
|
-
fs.
|
|
562
|
-
|
|
563
|
-
|
|
579
|
+
this.$fs.createDirectory(destDir);
|
|
580
|
+
// Copy all files from dist to platform destination
|
|
581
|
+
if (this.$fs.exists(distOutput)) {
|
|
582
|
+
this.copyRecursiveSync(distOutput, destDir);
|
|
564
583
|
}
|
|
565
584
|
else {
|
|
566
585
|
this.$logger.warn(`Vite output directory does not exist: ${distOutput}`);
|
|
@@ -571,62 +590,42 @@ class BundlerCompilerService extends events_1.EventEmitter {
|
|
|
571
590
|
this.$logger.warn(`Failed to copy Vite bundle: ${error.message}`);
|
|
572
591
|
}
|
|
573
592
|
}
|
|
574
|
-
getIncrementalFilesToCopy(emittedFiles
|
|
593
|
+
getIncrementalFilesToCopy(emittedFiles) {
|
|
594
|
+
// For incremental builds, we need to determine which emitted files are likely affected
|
|
595
|
+
// by the source file changes
|
|
575
596
|
const filesToCopy = [];
|
|
597
|
+
// default to ignoring vendor files as they are less likely to change during live reloads
|
|
576
598
|
const bundleFiles = emittedFiles.filter((file) => !file.includes("vendor") &&
|
|
577
|
-
(file.
|
|
578
|
-
file.
|
|
579
|
-
file.
|
|
580
|
-
file.endsWith(".mjs") ||
|
|
581
|
-
file.endsWith(".js")));
|
|
599
|
+
(file.endsWith(".mjs") ||
|
|
600
|
+
file.endsWith(".js") ||
|
|
601
|
+
file.endsWith(".map")));
|
|
582
602
|
filesToCopy.push(...bundleFiles);
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
file.includes("/
|
|
587
|
-
file.includes("/
|
|
588
|
-
if (
|
|
589
|
-
const assetFiles = emittedFiles.filter((file) => file.includes("assets/") ||
|
|
590
|
-
file.includes("static/") ||
|
|
591
|
-
file.includes("fonts/") ||
|
|
592
|
-
file.includes("images/"));
|
|
603
|
+
// Only copy assets if there are explicit asset-related changes
|
|
604
|
+
const assetFiles = emittedFiles.filter((file) => file.includes("assets/") ||
|
|
605
|
+
file.includes("static/") ||
|
|
606
|
+
file.includes("fonts/") ||
|
|
607
|
+
file.includes("images/"));
|
|
608
|
+
if (assetFiles.length > 0) {
|
|
593
609
|
filesToCopy.push(...assetFiles);
|
|
594
610
|
}
|
|
611
|
+
// Remove duplicates and return
|
|
595
612
|
return [...new Set(filesToCopy)];
|
|
596
613
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
});
|
|
608
|
-
ws.on("error", () => {
|
|
609
|
-
if (debugLog) {
|
|
610
|
-
console.log("🔥 HMR bridge not available (this is normal without HMR)");
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
catch (error) {
|
|
615
|
-
if (debugLog) {
|
|
616
|
-
console.log("🔥 WebSocket not available for HMR notifications");
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
copyRecursiveSync(src, dest, fs) {
|
|
621
|
-
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
622
|
-
const srcPath = path.join(src, entry.name);
|
|
623
|
-
const destPath = path.join(dest, entry.name);
|
|
624
|
-
if (entry.isDirectory()) {
|
|
625
|
-
fs.mkdirSync(destPath, { recursive: true });
|
|
626
|
-
this.copyRecursiveSync(srcPath, destPath, fs);
|
|
614
|
+
copyRecursiveSync(src, dest) {
|
|
615
|
+
// Ensure destination exists
|
|
616
|
+
this.$fs.createDirectory(dest);
|
|
617
|
+
const entries = this.$fs.readDirectory(src);
|
|
618
|
+
for (const name of entries) {
|
|
619
|
+
const srcPath = path.join(src, name);
|
|
620
|
+
const destPath = path.join(dest, name);
|
|
621
|
+
const lstats = this.$fs.getLsStats(srcPath);
|
|
622
|
+
if (lstats.isDirectory()) {
|
|
623
|
+
this.copyRecursiveSync(srcPath, destPath);
|
|
627
624
|
}
|
|
628
|
-
else if (
|
|
629
|
-
|
|
625
|
+
else if (lstats.isFile() || lstats.isSymbolicLink()) {
|
|
626
|
+
// create parent directory (copyFile will also ensure it, but keep explicit)
|
|
627
|
+
this.$fs.createDirectory(path.dirname(destPath));
|
|
628
|
+
this.$fs.copyFile(srcPath, destPath);
|
|
630
629
|
}
|
|
631
630
|
}
|
|
632
631
|
}
|
|
@@ -639,3 +638,4 @@ function capitalizeFirstLetter(val) {
|
|
|
639
638
|
return String(val).charAt(0).toUpperCase() + String(val).slice(1);
|
|
640
639
|
}
|
|
641
640
|
yok_1.injector.register("bundlerCompilerService", BundlerCompilerService);
|
|
641
|
+
//# sourceMappingURL=bundler-compiler-service.js.map
|
|
@@ -20,56 +20,56 @@ class CleanupService {
|
|
|
20
20
|
async addCleanupCommand(commandInfo) {
|
|
21
21
|
const cleanupProcess = await this.getCleanupProcess();
|
|
22
22
|
cleanupProcess.send({
|
|
23
|
-
messageType: "AddCleanCommand"
|
|
23
|
+
messageType: "AddCleanCommand" /* CleanupProcessMessage.AddCleanCommand */,
|
|
24
24
|
commandInfo,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
async removeCleanupCommand(commandInfo) {
|
|
28
28
|
const cleanupProcess = await this.getCleanupProcess();
|
|
29
29
|
cleanupProcess.send({
|
|
30
|
-
messageType: "RemoveCleanCommand"
|
|
30
|
+
messageType: "RemoveCleanCommand" /* CleanupProcessMessage.RemoveCleanCommand */,
|
|
31
31
|
commandInfo,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
async addRequest(requestInfo) {
|
|
35
35
|
const cleanupProcess = await this.getCleanupProcess();
|
|
36
36
|
cleanupProcess.send({
|
|
37
|
-
messageType: "AddRequest"
|
|
37
|
+
messageType: "AddRequest" /* CleanupProcessMessage.AddRequest */,
|
|
38
38
|
requestInfo,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
async removeRequest(requestInfo) {
|
|
42
42
|
const cleanupProcess = await this.getCleanupProcess();
|
|
43
43
|
cleanupProcess.send({
|
|
44
|
-
messageType: "RemoveRequest"
|
|
44
|
+
messageType: "RemoveRequest" /* CleanupProcessMessage.RemoveRequest */,
|
|
45
45
|
requestInfo,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
async addCleanupDeleteAction(filePath) {
|
|
49
49
|
const cleanupProcess = await this.getCleanupProcess();
|
|
50
50
|
cleanupProcess.send({
|
|
51
|
-
messageType: "AddDeleteFileAction"
|
|
51
|
+
messageType: "AddDeleteFileAction" /* CleanupProcessMessage.AddDeleteFileAction */,
|
|
52
52
|
filePath,
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
async removeCleanupDeleteAction(filePath) {
|
|
56
56
|
const cleanupProcess = await this.getCleanupProcess();
|
|
57
57
|
cleanupProcess.send({
|
|
58
|
-
messageType: "RemoveDeleteFileAction"
|
|
58
|
+
messageType: "RemoveDeleteFileAction" /* CleanupProcessMessage.RemoveDeleteFileAction */,
|
|
59
59
|
filePath,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
async addCleanupJS(jsCommand) {
|
|
63
63
|
const cleanupProcess = await this.getCleanupProcess();
|
|
64
64
|
cleanupProcess.send({
|
|
65
|
-
messageType: "AddJSFileToRequire"
|
|
65
|
+
messageType: "AddJSFileToRequire" /* CleanupProcessMessage.AddJSFileToRequire */,
|
|
66
66
|
jsCommand,
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
async removeCleanupJS(jsCommand) {
|
|
70
70
|
const cleanupProcess = await this.getCleanupProcess();
|
|
71
71
|
cleanupProcess.send({
|
|
72
|
-
messageType: "RemoveJSFileToRequire"
|
|
72
|
+
messageType: "RemoveJSFileToRequire" /* CleanupProcessMessage.RemoveJSFileToRequire */,
|
|
73
73
|
jsCommand,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -92,6 +92,8 @@ class CleanupService {
|
|
|
92
92
|
setShouldDispose(shouldDispose) {
|
|
93
93
|
this.shouldDispose = shouldDispose;
|
|
94
94
|
}
|
|
95
|
+
// TODO: Consider extracting this method to a separate service
|
|
96
|
+
// as it has the same logic as the one used in analytics-service
|
|
95
97
|
getCleanupProcess() {
|
|
96
98
|
return new Promise((resolve, reject) => {
|
|
97
99
|
const cleanupProcessArgs = this.getCleanupProcessArgs();
|
|
@@ -110,11 +112,12 @@ class CleanupService {
|
|
|
110
112
|
clearTimeout(timeoutId);
|
|
111
113
|
if (!isSettled) {
|
|
112
114
|
isSettled = true;
|
|
115
|
+
// In case we throw error here, CLI will break its execution.
|
|
113
116
|
reject(err);
|
|
114
117
|
}
|
|
115
118
|
});
|
|
116
119
|
cleanupProcess.on("message", (data) => {
|
|
117
|
-
if (data === "ProcessReadyToReceive") {
|
|
120
|
+
if (data === "ProcessReadyToReceive" /* DetachedProcessMessages.ProcessReadyToReceive */) {
|
|
118
121
|
clearTimeout(timeoutId);
|
|
119
122
|
if (!isSettled) {
|
|
120
123
|
isSettled = true;
|
|
@@ -163,3 +166,4 @@ __decorate([
|
|
|
163
166
|
(0, decorators_1.cache)()
|
|
164
167
|
], CleanupService.prototype, "getCleanupProcess", null);
|
|
165
168
|
yok_1.injector.register("cleanupService", CleanupService);
|
|
169
|
+
//# sourceMappingURL=cleanup-service.js.map
|
|
@@ -82,6 +82,7 @@ class CocoaPodsPlatformManager {
|
|
|
82
82
|
_.each(allPodfiles, (podfileContent) => {
|
|
83
83
|
const platformMatch = platformRowRegExp.exec(podfileContent);
|
|
84
84
|
const podfilePathMatch = podfilePathRegExp.exec(podfileContent) || [];
|
|
85
|
+
// platform without version -> select it with highest priority
|
|
85
86
|
if (platformMatch && platformMatch[0] && !platformMatch[2]) {
|
|
86
87
|
selectedPlatformData = {
|
|
87
88
|
version: null,
|
|
@@ -90,6 +91,7 @@ class CocoaPodsPlatformManager {
|
|
|
90
91
|
};
|
|
91
92
|
return false;
|
|
92
93
|
}
|
|
94
|
+
// platform with version
|
|
93
95
|
if (platformMatch && platformMatch[0] && platformMatch[2]) {
|
|
94
96
|
if (!selectedPlatformData ||
|
|
95
97
|
semver.gt(semver.coerce(platformMatch[2]), semver.coerce(selectedPlatformData.version))) {
|
|
@@ -104,6 +106,12 @@ class CocoaPodsPlatformManager {
|
|
|
104
106
|
return selectedPlatformData;
|
|
105
107
|
}
|
|
106
108
|
shouldReplacePlatformSection(projectData, oldPodfilePlatformData, currentPodfilePlatformData) {
|
|
109
|
+
// The selected platform should be replaced in the following cases:
|
|
110
|
+
// 1. When the pod file is from App_Resources and the selected platform is not from App_Resources
|
|
111
|
+
// 2. When the pod file is from App_Resources, the selected platform is also from App_Resources
|
|
112
|
+
// and the pod's version is greater than the selected one
|
|
113
|
+
// 3. When the pod file doesn't have platform's version -> `platform :ios`
|
|
114
|
+
// 4. When the pod file has a version greater than the selected platform's version
|
|
107
115
|
const appResourcesPodfilePath = path.join(projectData.getAppResourcesDirectoryPath(), "iOS", constants_1.PODFILE_NAME);
|
|
108
116
|
const isFromAppResources = oldPodfilePlatformData.path !== appResourcesPodfilePath &&
|
|
109
117
|
currentPodfilePlatformData.path === appResourcesPodfilePath;
|
|
@@ -135,3 +143,4 @@ class CocoaPodsPlatformManager {
|
|
|
135
143
|
}
|
|
136
144
|
exports.CocoaPodsPlatformManager = CocoaPodsPlatformManager;
|
|
137
145
|
yok_1.injector.register("cocoaPodsPlatformManager", CocoaPodsPlatformManager);
|
|
146
|
+
//# sourceMappingURL=cocoapods-platform-manager.js.map
|