nativescript 8.8.0 → 8.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/test-deps-versions-generated.json +1 -1
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +11 -1
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +17 -1
- package/lib/color.js +3 -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 +4 -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 +3 -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 +12 -2
- 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/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/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 +30 -1
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
- 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 +4 -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 +91 -3
- 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/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 +10 -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 +143 -118
- 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 +6 -1
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +33 -1
- 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/assets-generation/assets-generation-service.js +16 -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/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 +8 -0
- 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 +9 -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 +1 -0
- 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 +94 -2
- 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 +20 -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 +22 -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 +1 -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/webpack/webpack-compiler-service.js +42 -1
- 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/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +2 -2
|
@@ -36,12 +36,14 @@ class ProjectDataService {
|
|
|
36
36
|
this.$injector = $injector;
|
|
37
37
|
this.projectDataCache = {};
|
|
38
38
|
try {
|
|
39
|
+
// add the ProjectData of the default projectDir to the projectData cache
|
|
39
40
|
const projectData = this.$injector.resolve("projectData");
|
|
40
41
|
projectData.initializeProjectData();
|
|
41
42
|
this.defaultProjectDir = projectData.projectDir;
|
|
42
43
|
this.projectDataCache[this.defaultProjectDir] = projectData;
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
46
|
+
// the CLI is required as a lib from a non-project folder
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
get $pluginsService() {
|
|
@@ -70,6 +72,8 @@ class ProjectDataService {
|
|
|
70
72
|
delete projectFileInfo.projectData[ProjectDataService.DEPENDENCIES_KEY_NAME][dependencyName];
|
|
71
73
|
this.$fs.writeJson(projectFileInfo.projectFilePath, projectFileInfo.projectData);
|
|
72
74
|
}
|
|
75
|
+
// TODO: Add tests
|
|
76
|
+
// TODO: Remove $projectData and replace it with $projectDataService.getProjectData
|
|
73
77
|
getProjectData(projectDir) {
|
|
74
78
|
projectDir = projectDir || this.defaultProjectDir;
|
|
75
79
|
this.projectDataCache[projectDir] =
|
|
@@ -126,6 +130,10 @@ class ProjectDataService {
|
|
|
126
130
|
}
|
|
127
131
|
getAndroidAssetsStructure(opts) {
|
|
128
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
// TODO: Use image-size package to get the width and height of an image.
|
|
134
|
+
// TODO: Parse the splash_screen.xml in nodpi directory and get from it the names of the background and center image.
|
|
135
|
+
// TODO: Parse the AndroidManifest.xml to get the name of the icon.
|
|
136
|
+
// This way we'll not use the image-definitions.json and the method will return the real android structure.
|
|
129
137
|
const projectDir = opts.projectDir;
|
|
130
138
|
const projectData = this.getProjectData(projectDir);
|
|
131
139
|
const pathToAndroidDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android);
|
|
@@ -139,6 +147,7 @@ class ProjectDataService {
|
|
|
139
147
|
useLegacy = !manifest.includes(`android:icon="@mipmap/ic_launcher"`);
|
|
140
148
|
}
|
|
141
149
|
catch (err) {
|
|
150
|
+
// ignore
|
|
142
151
|
}
|
|
143
152
|
const content = this.getImageDefinitions()[useLegacy ? "android_legacy" : "android"];
|
|
144
153
|
return {
|
|
@@ -163,6 +172,8 @@ class ProjectDataService {
|
|
|
163
172
|
}
|
|
164
173
|
if (fstat.isDirectory()) {
|
|
165
174
|
if (filePath === pathToProjectNodeModules) {
|
|
175
|
+
// we do not want to get the files from node_modules directory of the project.
|
|
176
|
+
// We'll get here only when you have nativescript.config with appDirectoryPath set to "."
|
|
166
177
|
return false;
|
|
167
178
|
}
|
|
168
179
|
return true;
|
|
@@ -177,6 +188,9 @@ class ProjectDataService {
|
|
|
177
188
|
}
|
|
178
189
|
}
|
|
179
190
|
updateNsConfigValue(projectDir, updateObject, propertiesToRemove) {
|
|
191
|
+
// todo: figure out a way to update js/ts configs
|
|
192
|
+
// most likely needs an ast parser/writer
|
|
193
|
+
// should be delegated to the config service
|
|
180
194
|
const nsConfigPath = path.join(projectDir, constants.CONFIG_FILE_NAME_JS);
|
|
181
195
|
const currentNsConfig = this.getNsConfig(nsConfigPath);
|
|
182
196
|
let newNsConfig = currentNsConfig;
|
|
@@ -218,10 +232,14 @@ class ProjectDataService {
|
|
|
218
232
|
const imageDefinitions = this.getImageDefinitions().ios;
|
|
219
233
|
_.each(content && content.images, (image) => {
|
|
220
234
|
let foundMatchingDefinition = false;
|
|
235
|
+
// In some cases the image may not be available, it will just be described.
|
|
236
|
+
// When this happens, the filename will be empty.
|
|
237
|
+
// So we'll keep the path empty as well.
|
|
221
238
|
if (image.filename) {
|
|
222
239
|
image.path = path.join(dirPath, image.filename);
|
|
223
240
|
}
|
|
224
241
|
if (image.size) {
|
|
242
|
+
// size is basically <width>x<height>
|
|
225
243
|
const [width, height] = image.size
|
|
226
244
|
.toString()
|
|
227
245
|
.split(constants_1.AssetConstants.sizeDelimiter);
|
|
@@ -230,6 +248,7 @@ class ProjectDataService {
|
|
|
230
248
|
image.height = +height;
|
|
231
249
|
}
|
|
232
250
|
}
|
|
251
|
+
// Find the image size based on the hardcoded values in the image-definitions.json
|
|
233
252
|
_.each(imageDefinitions, (assetSubGroup) => {
|
|
234
253
|
const assetItem = _.find(assetSubGroup, (assetElement) => assetElement.filename === image.filename &&
|
|
235
254
|
path.basename(assetElement.directory) === path.basename(dirPath));
|
|
@@ -249,6 +268,7 @@ class ProjectDataService {
|
|
|
249
268
|
image.scale = image.scale || assetItem.scale;
|
|
250
269
|
image.rgba = assetItem.rgba;
|
|
251
270
|
finalContent.images.push(image);
|
|
271
|
+
// break each
|
|
252
272
|
return false;
|
|
253
273
|
}
|
|
254
274
|
});
|
|
@@ -352,13 +372,16 @@ class ProjectDataService {
|
|
|
352
372
|
getRuntimePackage(projectDir, platform) {
|
|
353
373
|
platform = platform.toLowerCase();
|
|
354
374
|
const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
|
|
355
|
-
const runtimeName = platform === "android"
|
|
375
|
+
const runtimeName = platform === "android" /* PlatformTypes.android */
|
|
356
376
|
? constants.TNS_ANDROID_RUNTIME_NAME
|
|
357
377
|
: constants.TNS_IOS_RUNTIME_NAME;
|
|
358
378
|
if (packageJson &&
|
|
359
379
|
packageJson.nativescript &&
|
|
360
380
|
packageJson.nativescript[runtimeName] &&
|
|
361
381
|
packageJson.nativescript[runtimeName].version) {
|
|
382
|
+
// if we have a nativescript key with a runtime version in package.json
|
|
383
|
+
// that means we are dealing with a legacy project, and should respect
|
|
384
|
+
// that information
|
|
362
385
|
return {
|
|
363
386
|
name: runtimeName,
|
|
364
387
|
version: packageJson.nativescript[runtimeName].version,
|
|
@@ -370,19 +393,19 @@ class ProjectDataService {
|
|
|
370
393
|
const runtimePackage = this.$pluginsService
|
|
371
394
|
.getDependenciesFromPackageJson(projectDir)
|
|
372
395
|
.devDependencies.find((d) => {
|
|
373
|
-
if (platform === "ios") {
|
|
396
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
374
397
|
return [
|
|
375
398
|
constants.SCOPED_IOS_RUNTIME_NAME,
|
|
376
399
|
constants.TNS_IOS_RUNTIME_NAME,
|
|
377
400
|
].includes(d.name);
|
|
378
401
|
}
|
|
379
|
-
else if (platform === "android") {
|
|
402
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
380
403
|
return [
|
|
381
404
|
constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
382
405
|
constants.TNS_ANDROID_RUNTIME_NAME,
|
|
383
406
|
].includes(d.name);
|
|
384
407
|
}
|
|
385
|
-
else if (platform === "visionos") {
|
|
408
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
386
409
|
return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
|
|
387
410
|
}
|
|
388
411
|
});
|
|
@@ -390,12 +413,14 @@ class ProjectDataService {
|
|
|
390
413
|
const coerced = semver.coerce(runtimePackage.version);
|
|
391
414
|
const isRange = !!coerced && coerced.version !== runtimePackage.version;
|
|
392
415
|
const isTag = !coerced;
|
|
416
|
+
// in case we are using a local tgz for the runtime or a range like ~8.0.0, ^8.0.0 etc. or a tag like JSC
|
|
393
417
|
if (runtimePackage.version.includes("tgz") || isRange || isTag) {
|
|
394
418
|
try {
|
|
395
419
|
const runtimePackageJsonPath = (0, package_path_helper_1.resolvePackageJSONPath)(runtimePackage.name, {
|
|
396
420
|
paths: [projectDir],
|
|
397
421
|
});
|
|
398
422
|
if (!runtimePackageJsonPath) {
|
|
423
|
+
// caught below
|
|
399
424
|
throw new Error("Runtime package.json not found.");
|
|
400
425
|
}
|
|
401
426
|
runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
|
|
@@ -412,20 +437,21 @@ class ProjectDataService {
|
|
|
412
437
|
}
|
|
413
438
|
return runtimePackage;
|
|
414
439
|
}
|
|
440
|
+
// default to the scoped runtimes
|
|
415
441
|
this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
|
|
416
|
-
if (platform === "ios") {
|
|
442
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
417
443
|
return {
|
|
418
444
|
name: constants.SCOPED_IOS_RUNTIME_NAME,
|
|
419
445
|
version: null,
|
|
420
446
|
};
|
|
421
447
|
}
|
|
422
|
-
else if (platform === "android") {
|
|
448
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
423
449
|
return {
|
|
424
450
|
name: constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
425
451
|
version: null,
|
|
426
452
|
};
|
|
427
453
|
}
|
|
428
|
-
else if (platform === "visionos") {
|
|
454
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
429
455
|
return {
|
|
430
456
|
name: constants.SCOPED_VISIONOS_RUNTIME_NAME,
|
|
431
457
|
version: null,
|
|
@@ -459,9 +485,11 @@ __decorate([
|
|
|
459
485
|
return projectDir + ":" + platform;
|
|
460
486
|
},
|
|
461
487
|
shouldCache(result) {
|
|
488
|
+
// don't cache coerced versions
|
|
462
489
|
if (result._coerced) {
|
|
463
490
|
return false;
|
|
464
491
|
}
|
|
492
|
+
// only cache if version is defined
|
|
465
493
|
return !!result.version;
|
|
466
494
|
},
|
|
467
495
|
})
|
|
@@ -471,3 +499,4 @@ __decorate([
|
|
|
471
499
|
], ProjectDataService.prototype, "getNsConfigDefaultContent", null);
|
|
472
500
|
exports.ProjectDataService = ProjectDataService;
|
|
473
501
|
yok_1.injector.register("projectDataService", ProjectDataService);
|
|
502
|
+
//# sourceMappingURL=project-data-service.js.map
|
|
@@ -76,11 +76,15 @@ class ProjectService {
|
|
|
76
76
|
appId: appId,
|
|
77
77
|
projectName,
|
|
78
78
|
});
|
|
79
|
+
// can pass --no-git to skip creating a git repo
|
|
80
|
+
// useful in monorepos where we're creating
|
|
81
|
+
// sub projects in an existing git repo.
|
|
79
82
|
if (this.$options.git) {
|
|
80
83
|
try {
|
|
81
84
|
if (!this.$options.force) {
|
|
82
85
|
const git = (0, simple_git_1.default)(projectDir);
|
|
83
86
|
if (yield git.checkIsRepo()) {
|
|
87
|
+
// throwing here since we're catching below.
|
|
84
88
|
throw new Error("Already part of a git repository.");
|
|
85
89
|
}
|
|
86
90
|
}
|
|
@@ -122,6 +126,7 @@ class ProjectService {
|
|
|
122
126
|
this.alterPackageJsonData(projectCreationSettings);
|
|
123
127
|
this.$projectConfigService.writeDefaultConfig(projectDir, appId);
|
|
124
128
|
yield this.ensureAppResourcesExist(projectDir);
|
|
129
|
+
// Install devDependencies and execute all scripts:
|
|
125
130
|
yield this.$packageManager.install(projectDir, projectDir, {
|
|
126
131
|
disableNpmInstall: false,
|
|
127
132
|
frameworkPath: null,
|
|
@@ -155,6 +160,7 @@ class ProjectService {
|
|
|
155
160
|
this.$logger.trace("Project does not have App_Resources - fetching from default template.");
|
|
156
161
|
this.$fs.createDirectory(appResourcesDestinationPath);
|
|
157
162
|
const tempDir = yield this.$tempService.mkdirSync("ns-default-template");
|
|
163
|
+
// the template installed doesn't have App_Resources -> get from a default template
|
|
158
164
|
yield this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], tempDir);
|
|
159
165
|
const templateProjectData = this.$projectDataService.getProjectData(tempDir);
|
|
160
166
|
const templateAppResourcesDir = templateProjectData.getAppResourcesDirectoryPath(tempDir);
|
|
@@ -166,12 +172,14 @@ class ProjectService {
|
|
|
166
172
|
const { projectDir, projectName } = projectCreationSettings;
|
|
167
173
|
const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
|
|
168
174
|
let packageJsonData = this.$fs.readJson(projectFilePath);
|
|
175
|
+
// clean up keys from the template package.json that we don't care about.
|
|
169
176
|
Object.keys(packageJsonData).forEach((key) => {
|
|
170
177
|
if (key.startsWith("_") ||
|
|
171
178
|
constants.TemplatesV2PackageJsonKeysToRemove.includes(key)) {
|
|
172
179
|
delete packageJsonData[key];
|
|
173
180
|
}
|
|
174
181
|
});
|
|
182
|
+
// this is used to ensure the order of keys is consistent, the blanks are filled in from the template
|
|
175
183
|
const packageJsonSchema = {
|
|
176
184
|
name: projectName,
|
|
177
185
|
main: "",
|
|
@@ -179,6 +187,7 @@ class ProjectService {
|
|
|
179
187
|
private: true,
|
|
180
188
|
dependencies: {},
|
|
181
189
|
devDependencies: {},
|
|
190
|
+
// anythign else would go below
|
|
182
191
|
};
|
|
183
192
|
packageJsonData = Object.assign(packageJsonSchema, packageJsonData);
|
|
184
193
|
this.$fs.writeJson(projectFilePath, packageJsonData);
|
|
@@ -202,3 +211,4 @@ __decorate([
|
|
|
202
211
|
], ProjectService.prototype, "alterPackageJsonData", null);
|
|
203
212
|
exports.ProjectService = ProjectService;
|
|
204
213
|
yok_1.injector.register("projectService", ProjectService);
|
|
214
|
+
//# sourceMappingURL=project-service.js.map
|
|
@@ -50,12 +50,12 @@ class ProjectTemplatesService {
|
|
|
50
50
|
const templateNameToBeTracked = this.getTemplateNameToBeTracked(templateValue, templatePackageJsonContent);
|
|
51
51
|
if (templateNameToBeTracked) {
|
|
52
52
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
53
|
-
action: "Create project"
|
|
53
|
+
action: "Create project" /* constants.TrackActionNames.CreateProject */,
|
|
54
54
|
isForDevice: null,
|
|
55
55
|
additionalData: templateNameToBeTracked,
|
|
56
56
|
});
|
|
57
57
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
58
|
-
action: "Using Template"
|
|
58
|
+
action: "Using Template" /* constants.TrackActionNames.UsingTemplate */,
|
|
59
59
|
additionalData: templateNameToBeTracked,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -112,3 +112,4 @@ __decorate([
|
|
|
112
112
|
], ProjectTemplatesService.prototype, "prepareTemplate", null);
|
|
113
113
|
exports.ProjectTemplatesService = ProjectTemplatesService;
|
|
114
114
|
yok_1.injector.register("projectTemplatesService", ProjectTemplatesService);
|
|
115
|
+
//# sourceMappingURL=project-templates-service.js.map
|
|
@@ -14,6 +14,7 @@ const ora = require("ora");
|
|
|
14
14
|
const yok_1 = require("../common/yok");
|
|
15
15
|
class TerminalSpinnerService {
|
|
16
16
|
createSpinner(spinnerOptions = {}) {
|
|
17
|
+
// @ts-expect-error - options are readonly, however we still want to override them before passing them on...
|
|
17
18
|
spinnerOptions.stream = spinnerOptions.stream || process.stdout;
|
|
18
19
|
return ora(spinnerOptions);
|
|
19
20
|
}
|
|
@@ -36,3 +37,4 @@ class TerminalSpinnerService {
|
|
|
36
37
|
}
|
|
37
38
|
exports.TerminalSpinnerService = TerminalSpinnerService;
|
|
38
39
|
yok_1.injector.register("terminalSpinnerService", TerminalSpinnerService);
|
|
40
|
+
//# sourceMappingURL=terminal-spinner-service.js.map
|
|
@@ -34,8 +34,10 @@ class TestExecutionService {
|
|
|
34
34
|
platform = platform.toLowerCase();
|
|
35
35
|
this.platform = platform;
|
|
36
36
|
const projectData = this.$projectDataService.getProjectData(liveSyncInfo.projectDir);
|
|
37
|
+
// We need the dependencies installed here, so we can start the Karma server.
|
|
37
38
|
yield this.$pluginsService.ensureAllDependenciesAreInstalled(projectData);
|
|
38
39
|
const karmaConfig = this.getKarmaConfiguration(platform, projectData);
|
|
40
|
+
// In case you want to debug the unit test runner, add "--inspect-brk=<port>" as a first element in the array of args.
|
|
39
41
|
const karmaRunner = this.$childProcess.spawn(process.execPath, [path.join(__dirname, "karma-execution.js")], { stdio: ["inherit", "inherit", "inherit", "ipc"] });
|
|
40
42
|
const launchKarmaTests = (karmaData) => __awaiter(this, void 0, void 0, function* () {
|
|
41
43
|
this.$logger.trace("## Unit-testing: Parent process received message", karmaData);
|
|
@@ -52,6 +54,8 @@ class TestExecutionService {
|
|
|
52
54
|
const configJs = this.generateConfig(port, configOptions);
|
|
53
55
|
this.$fs.writeFile(path.join(liveSyncInfo.projectDir, TestExecutionService.CONFIG_FILE_NAME), configJs);
|
|
54
56
|
}
|
|
57
|
+
// Prepare the project AFTER the TestExecutionService.CONFIG_FILE_NAME file is created in node_modules
|
|
58
|
+
// so it will be sent to device.
|
|
55
59
|
yield this.$runController.run({
|
|
56
60
|
liveSyncInfo,
|
|
57
61
|
deviceDescriptors,
|
|
@@ -64,12 +68,13 @@ class TestExecutionService {
|
|
|
64
68
|
}
|
|
65
69
|
launchKarmaTests(karmaData).catch((result) => {
|
|
66
70
|
this.$logger.error(result);
|
|
67
|
-
process.exit(130);
|
|
71
|
+
process.exit(130 /* ErrorCodes.KARMA_FAIL */);
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
return new Promise((resolve, reject) => {
|
|
71
75
|
karmaRunner.on("exit", (exitCode) => {
|
|
72
76
|
if (exitCode !== 0) {
|
|
77
|
+
//End our process with a non-zero exit code
|
|
73
78
|
const testError = new Error("Test run failed.");
|
|
74
79
|
reject(testError);
|
|
75
80
|
}
|
|
@@ -84,7 +89,7 @@ class TestExecutionService {
|
|
|
84
89
|
canStartKarmaServer(projectData) {
|
|
85
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
91
|
let canStartKarmaServer = true;
|
|
87
|
-
const requiredDependencies = ["@nativescript/unit-test-runner"];
|
|
92
|
+
const requiredDependencies = ["@nativescript/unit-test-runner"]; // we need @nativescript/unit-test-runner at the local level because of hooks!
|
|
88
93
|
_.each(requiredDependencies, (dep) => {
|
|
89
94
|
if (!projectData.dependencies[dep] && !projectData.devDependencies[dep]) {
|
|
90
95
|
canStartKarmaServer = false;
|
|
@@ -134,6 +139,7 @@ class TestExecutionService {
|
|
|
134
139
|
karmaConfig.logLevel = "DEBUG";
|
|
135
140
|
}
|
|
136
141
|
if (!this.$options.watch) {
|
|
142
|
+
// Setting singleRun to true will automatically start the tests when new browser (device in our case) is registered in karma.
|
|
137
143
|
karmaConfig.singleRun = true;
|
|
138
144
|
}
|
|
139
145
|
if (this.$options.debugBrk) {
|
|
@@ -152,3 +158,4 @@ TestExecutionService.CONFIG_FILE_NAME = `node_modules/${constants.TEST_RUNNER_NA
|
|
|
152
158
|
TestExecutionService.SOCKETIO_JS_FILE_NAME = `node_modules/${constants.TEST_RUNNER_NAME}/socket.io.js`;
|
|
153
159
|
exports.TestExecutionService = TestExecutionService;
|
|
154
160
|
yok_1.injector.register("testExecutionService", TestExecutionService);
|
|
161
|
+
//# sourceMappingURL=test-execution-service.js.map
|
|
@@ -34,6 +34,9 @@ class TestInitializationService {
|
|
|
34
34
|
});
|
|
35
35
|
return targetFrameworkDependencies;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* This method is used from test-init.md file so it is not allowed to use "this" inside the method's body.
|
|
39
|
+
*/
|
|
37
40
|
getFrameworkNames() {
|
|
38
41
|
const configsPath = path.join(__dirname, "..", "..", "config");
|
|
39
42
|
const dependenciesPath = path.join(configsPath, "test-dependencies.json");
|
|
@@ -52,3 +55,4 @@ __decorate([
|
|
|
52
55
|
], TestInitializationService.prototype, "getFrameworkNames", null);
|
|
53
56
|
exports.TestInitializationService = TestInitializationService;
|
|
54
57
|
yok_1.injector.register("testInitializationService", TestInitializationService);
|
|
58
|
+
//# sourceMappingURL=test-initialization-service.js.map
|
|
@@ -98,3 +98,4 @@ __decorate([
|
|
|
98
98
|
], TimelineProfilerService.prototype, "isEnabled", null);
|
|
99
99
|
exports.TimelineProfilerService = TimelineProfilerService;
|
|
100
100
|
yok_1.injector.register("timelineProfilerService", TimelineProfilerService);
|
|
101
|
+
//# sourceMappingURL=timeline-profiler-service.js.map
|
|
@@ -59,6 +59,7 @@ class VersionsService {
|
|
|
59
59
|
const tnsCoreModulesPath = path.join(nodeModulesPath, constants.TNS_CORE_MODULES_NAME);
|
|
60
60
|
const dependsOnNonScopedPackage = !!this.projectData.dependencies[constants.TNS_CORE_MODULES_NAME];
|
|
61
61
|
const dependsOnScopedPackage = !!this.projectData.dependencies[constants.SCOPED_TNS_CORE_MODULES];
|
|
62
|
+
// ensure the dependencies are installed, so we can get their actual versions from node_modules
|
|
62
63
|
if (!this.$fs.exists(nodeModulesPath) ||
|
|
63
64
|
(dependsOnNonScopedPackage && !this.$fs.exists(tnsCoreModulesPath)) ||
|
|
64
65
|
(dependsOnScopedPackage && !this.$fs.exists(scopedPackagePath))) {
|
|
@@ -87,16 +88,16 @@ class VersionsService {
|
|
|
87
88
|
}
|
|
88
89
|
getRuntimesVersions(platform) {
|
|
89
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios");
|
|
91
|
-
const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android");
|
|
91
|
+
const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios" /* constants.PlatformTypes.ios */);
|
|
92
|
+
const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android" /* constants.PlatformTypes.android */);
|
|
92
93
|
let runtimes = [];
|
|
93
94
|
if (!platform) {
|
|
94
95
|
runtimes = [iosRuntime, androidRuntime];
|
|
95
96
|
}
|
|
96
|
-
else if (platform === "ios") {
|
|
97
|
+
else if (platform === "ios" /* PlatformTypes.ios */) {
|
|
97
98
|
runtimes.push(iosRuntime);
|
|
98
99
|
}
|
|
99
|
-
else if (platform === "android") {
|
|
100
|
+
else if (platform === "android" /* PlatformTypes.android */) {
|
|
100
101
|
runtimes.push(androidRuntime);
|
|
101
102
|
}
|
|
102
103
|
const runtimesVersions = yield Promise.all(runtimes.map((runtime) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -194,3 +195,4 @@ VersionsService.UP_TO_DATE_MESSAGE = "up to date";
|
|
|
194
195
|
VersionsService.UPDATE_AVAILABLE_MESSAGE = "Update available";
|
|
195
196
|
VersionsService.NOT_INSTALLED_MESSAGE = "not installed";
|
|
196
197
|
yok_1.injector.register("versionsService", VersionsService);
|
|
198
|
+
//# sourceMappingURL=versions-service.js.map
|
|
@@ -25,7 +25,8 @@ const constants_1 = require("../../constants");
|
|
|
25
25
|
const yok_1 = require("../../common/yok");
|
|
26
26
|
const package_path_helper_1 = require("../../helpers/package-path-helper");
|
|
27
27
|
class WebpackCompilerService extends events_1.EventEmitter {
|
|
28
|
-
constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager
|
|
28
|
+
constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager // private $sharedEventBus: ISharedEventBus
|
|
29
|
+
) {
|
|
29
30
|
super();
|
|
30
31
|
this.$options = $options;
|
|
31
32
|
this.$errors = $errors;
|
|
@@ -60,14 +61,23 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
60
61
|
});
|
|
61
62
|
childProcess.on("message", (message) => {
|
|
62
63
|
this.$logger.trace("Message from webpack", message);
|
|
64
|
+
// if we are on webpack5 - we handle HMR in a slightly different way
|
|
63
65
|
if (typeof message === "object" &&
|
|
64
66
|
"version" in message &&
|
|
65
67
|
"type" in message) {
|
|
68
|
+
// first compilation can be ignored because it will be synced regardless
|
|
69
|
+
// handling it here would trigger 2 syncs
|
|
66
70
|
if (isFirstWebpackWatchCompilation) {
|
|
67
71
|
isFirstWebpackWatchCompilation = false;
|
|
68
72
|
resolve(childProcess);
|
|
69
73
|
return;
|
|
70
74
|
}
|
|
75
|
+
// if ((message as IWebpackMessage).type === "hmr-status") {
|
|
76
|
+
// // we pass message through our event-bus to be handled wherever needed
|
|
77
|
+
// // in this case webpack-hmr-status-service listens for this event
|
|
78
|
+
// this.$sharedEventBus.emit("webpack:hmr-status", message);
|
|
79
|
+
// return;
|
|
80
|
+
// }
|
|
71
81
|
return this.handleHMRMessage(message, platformData, projectData, prepareData);
|
|
72
82
|
}
|
|
73
83
|
if (message === "Webpack compilation complete.") {
|
|
@@ -82,6 +92,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
82
92
|
prepareData.hmr ? message.hash : "";
|
|
83
93
|
return;
|
|
84
94
|
}
|
|
95
|
+
// Persist the previousHash value before calling `this.getUpdatedEmittedFiles` as it will modify the expectedHashes object with the current hash
|
|
85
96
|
const previousHash = this.expectedHashes[platformData.platformNameLowerCase];
|
|
86
97
|
let result;
|
|
87
98
|
if (prepareData.hmr) {
|
|
@@ -106,6 +117,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
106
117
|
platform: platformData.platformNameLowerCase,
|
|
107
118
|
};
|
|
108
119
|
this.$logger.trace("Generated data from webpack message:", data);
|
|
120
|
+
// the hash of the compilation is the same as the previous one and there are only hot updates produced
|
|
109
121
|
if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
|
|
110
122
|
return;
|
|
111
123
|
}
|
|
@@ -184,6 +196,9 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
184
196
|
}
|
|
185
197
|
shouldUsePreserveSymlinksOption() {
|
|
186
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
// pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
|
|
200
|
+
// and it also does not work in some cases.
|
|
201
|
+
// Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
|
|
187
202
|
const currentPackageManager = yield this.$packageManager.getPackageManagerName();
|
|
188
203
|
const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
|
|
189
204
|
return res;
|
|
@@ -243,16 +258,28 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
243
258
|
});
|
|
244
259
|
envData.verbose = envData.verbose || this.$logger.isVerbose();
|
|
245
260
|
envData.production = envData.production || prepareData.release;
|
|
261
|
+
// add the config file name to the env data so the webpack process can read the
|
|
262
|
+
// correct config file when resolving the CLI lib and the config service
|
|
263
|
+
// we are explicitly setting it to false to force using the defaults
|
|
246
264
|
envData.config =
|
|
247
265
|
(_b = (_a = process.env.NATIVESCRIPT_CONFIG_NAME) !== null && _a !== void 0 ? _a : this.$options.config) !== null && _b !== void 0 ? _b : "false";
|
|
266
|
+
// explicitly set the env variable
|
|
248
267
|
process.env.NATIVESCRIPT_CONFIG_NAME = envData.config;
|
|
268
|
+
// The snapshot generation is wrongly located in the Webpack plugin.
|
|
269
|
+
// It should be moved in the Native Prepare of the CLI or a Gradle task in the Runtime.
|
|
270
|
+
// As a workaround, we skip the mksnapshot, xxd and android-ndk calls based on skipNativePrepare.
|
|
271
|
+
// In this way the plugin will prepare only the snapshot JS entry without any native prepare and
|
|
272
|
+
// we will able to execute cloud builds with snapshot without having any local snapshot or Docker setup.
|
|
273
|
+
// TODO: Remove this flag when we remove the native part from the plugin.
|
|
249
274
|
envData.skipSnapshotTools =
|
|
250
275
|
prepareData.nativePrepare && prepareData.nativePrepare.skipNativePrepare;
|
|
276
|
+
// only set sourceMap if not explicitly set through a flag
|
|
251
277
|
if (typeof ((_c = prepareData === null || prepareData === void 0 ? void 0 : prepareData.env) === null || _c === void 0 ? void 0 : _c.sourceMap) === "undefined") {
|
|
252
278
|
if (!prepareData.release) {
|
|
253
279
|
envData.sourceMap = true;
|
|
254
280
|
}
|
|
255
281
|
}
|
|
282
|
+
// convert string to boolean
|
|
256
283
|
if (envData.sourceMap === "true" || envData.sourceMap === "false") {
|
|
257
284
|
envData.sourceMap = envData.sourceMap === "true";
|
|
258
285
|
}
|
|
@@ -303,6 +330,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
303
330
|
}
|
|
304
331
|
getUpdatedEmittedFiles(allEmittedFiles, chunkFiles, nextHash, platform) {
|
|
305
332
|
const currentHash = this.getCurrentHotUpdateHash(allEmittedFiles);
|
|
333
|
+
// This logic is needed as there are already cases when webpack doesn't emit any files physically.
|
|
334
|
+
// We've set noEmitOnErrors in webpack.config.js based on noEmitOnError from tsconfig.json,
|
|
335
|
+
// so webpack doesn't emit any files when noEmitOnErrors: true is set in webpack.config.js and
|
|
336
|
+
// there is a compilation error in the source code. On the other side, hmr generates new hot-update files
|
|
337
|
+
// on every change and the hash of the next hmr update is written inside hot-update.json file.
|
|
338
|
+
// Although webpack doesn't emit any files, hmr hash is still generated. The hash is generated per compilation no matter
|
|
339
|
+
// if files will be emitted or not. This way, the first successful compilation after fixing the compilation error generates
|
|
340
|
+
// a hash that is not the same as the one expected in the latest emitted hot-update.json file.
|
|
341
|
+
// As a result, the hmr chain is broken and the changes are not applied.
|
|
306
342
|
const isHashValid = nextHash
|
|
307
343
|
? this.expectedHashes[platform] === currentHash
|
|
308
344
|
: true;
|
|
@@ -321,6 +357,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
321
357
|
let hotHash;
|
|
322
358
|
const hotUpdateScripts = emittedFiles.filter((x) => x.endsWith(".hot-update.js"));
|
|
323
359
|
if (hotUpdateScripts && hotUpdateScripts.length) {
|
|
360
|
+
// the hash is the same for each hot update in the current compilation
|
|
324
361
|
const hotUpdateName = hotUpdateScripts[0];
|
|
325
362
|
const matcher = /^(.+)\.(.+)\.hot-update/gm;
|
|
326
363
|
const matches = matcher.exec(hotUpdateName);
|
|
@@ -340,6 +377,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
340
377
|
});
|
|
341
378
|
}
|
|
342
379
|
handleHMRMessage(message, platformData, projectData, prepareData) {
|
|
380
|
+
// handle new webpack hmr packets
|
|
343
381
|
this.$logger.trace("Received message from webpack process:", message);
|
|
344
382
|
if (message.type !== "compilation") {
|
|
345
383
|
return;
|
|
@@ -347,6 +385,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
347
385
|
this.$logger.trace("Webpack build done!");
|
|
348
386
|
const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
|
|
349
387
|
const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
|
|
388
|
+
// extract last hash from emitted filenames
|
|
350
389
|
const lastHash = (() => {
|
|
351
390
|
const absoluteFileNameWithLastHash = files.find((fileName) => fileName.endsWith("hot-update.js"));
|
|
352
391
|
if (!absoluteFileNameWithLastHash) {
|
|
@@ -359,6 +398,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
|
|
|
359
398
|
}
|
|
360
399
|
})();
|
|
361
400
|
if (!files.length) {
|
|
401
|
+
// ignore compilations if no new files are emitted
|
|
362
402
|
return;
|
|
363
403
|
}
|
|
364
404
|
this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, {
|
|
@@ -408,3 +448,4 @@ __decorate([
|
|
|
408
448
|
], WebpackCompilerService.prototype, "startWebpackProcess", null);
|
|
409
449
|
exports.WebpackCompilerService = WebpackCompilerService;
|
|
410
450
|
yok_1.injector.register("webpackCompilerService", WebpackCompilerService);
|
|
451
|
+
//# sourceMappingURL=webpack-compiler-service.js.map
|
|
@@ -66,6 +66,7 @@ class XcconfigService {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
if (isPropertyParsed) {
|
|
69
|
+
// property can be an empty string, so we don't check for that.
|
|
69
70
|
return property;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -74,3 +75,4 @@ class XcconfigService {
|
|
|
74
75
|
}
|
|
75
76
|
exports.XcconfigService = XcconfigService;
|
|
76
77
|
yok_1.injector.register("xcconfigService", XcconfigService);
|
|
78
|
+
//# sourceMappingURL=xcconfig-service.js.map
|
package/lib/shared-event-bus.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const events_1 = require("events");
|
|
4
4
|
const yok_1 = require("./common/yok");
|
|
5
|
+
/**
|
|
6
|
+
* Event Bus used by different services to emit state changes and
|
|
7
|
+
* allow listening for these state changes without needing a reference
|
|
8
|
+
* to the emitting service.
|
|
9
|
+
*/
|
|
5
10
|
class SharedEventBus extends events_1.EventEmitter {
|
|
6
11
|
}
|
|
7
12
|
yok_1.injector.register("sharedEventBus", SharedEventBus);
|
|
13
|
+
//# sourceMappingURL=shared-event-bus.js.map
|
package/lib/sys-info.js
CHANGED
|
@@ -93,7 +93,7 @@ class SysInfo {
|
|
|
93
93
|
if (macOSVersion && macOSVersion < constants_1.MacOSVersions.HighSierra) {
|
|
94
94
|
return {
|
|
95
95
|
message: (0, util_1.format)(constants_1.MacOSDeprecationStringFormat, macOSVersion),
|
|
96
|
-
severity: "high"
|
|
96
|
+
severity: "high" /* SystemWarningsSeverity.high */,
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
return null;
|
|
@@ -118,3 +118,4 @@ __decorate([
|
|
|
118
118
|
], SysInfo.prototype, "getSupportedNodeVersionRange", null);
|
|
119
119
|
exports.SysInfo = SysInfo;
|
|
120
120
|
yok_1.injector.register("sysInfo", SysInfo);
|
|
121
|
+
//# sourceMappingURL=sys-info.js.map
|