nativescript 9.1.0-alpha.0 → 9.1.0-alpha.10
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/README.md +49 -0
- package/config/test-deps-versions-generated.json +3 -3
- package/lib/.d.ts +1 -0
- package/lib/bootstrap.js +0 -2
- package/lib/commands/build.js +1 -30
- package/lib/commands/prepare.js +5 -0
- package/lib/commands/run.js +1 -39
- package/lib/commands/widget.js +1 -2
- package/lib/common/definitions/mobile.d.ts +15 -13
- package/lib/common/file-system.js +11 -15
- package/lib/common/mobile/android/android-emulator-services.js +11 -3
- package/lib/common/mobile/device-platforms-constants.js +0 -4
- package/lib/common/mobile/emulator-helper.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +29 -1
- package/lib/common/mobile/mobile-helper.js +1 -12
- package/lib/constants.js +7 -2
- package/lib/controllers/prepare-controller.js +53 -39
- package/lib/controllers/run-controller.js +200 -13
- package/lib/data/prepare-data.js +4 -0
- package/lib/declarations.d.ts +38 -42
- package/lib/definitions/nativescript-dev-xcode.d.ts +25 -1
- package/lib/definitions/project.d.ts +51 -6
- package/lib/key-commands/bootstrap.js +0 -1
- package/lib/key-commands/index.js +1 -53
- package/lib/options.js +1 -0
- package/lib/project-data.js +0 -6
- package/lib/services/android-plugin-build-service.js +20 -12
- package/lib/services/bundler/bundler-compiler-service.js +182 -13
- package/lib/services/debug-service-base.js +1 -1
- package/lib/services/ios/ios-signing-service.js +10 -3
- package/lib/services/ios/spm-service.js +1 -8
- package/lib/services/ios/xcodebuild-args-service.js +36 -29
- package/lib/services/ios-entitlements-service.js +3 -1
- package/lib/services/ios-project-service.js +55 -78
- package/lib/services/ios-watch-app-service.js +663 -16
- package/lib/services/livesync/ios-livesync-service.js +113 -2
- package/lib/services/platforms-data-service.js +0 -1
- package/lib/services/plugins-service.js +16 -28
- package/lib/services/project-changes-service.js +4 -15
- package/lib/services/project-data-service.js +16 -31
- package/lib/services/versions-service.js +0 -4
- package/lib/tools/config-manipulation/config-transformer.js +55 -3
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/universal-analytics/.travis.yml +11 -0
- package/node_modules/universal-analytics/AcceptableParams.md +757 -0
- package/node_modules/universal-analytics/HISTORY.md +170 -0
- package/node_modules/universal-analytics/Makefile +5 -0
- package/node_modules/universal-analytics/README.md +651 -0
- package/node_modules/universal-analytics/index.js +2 -0
- package/node_modules/universal-analytics/lib/config.js +171 -0
- package/node_modules/universal-analytics/lib/index.js +563 -0
- package/node_modules/universal-analytics/lib/request.js +73 -0
- package/node_modules/universal-analytics/lib/utils.js +29 -0
- package/node_modules/universal-analytics/package.json +33 -0
- package/node_modules/universal-analytics/test/_enqueue.js +144 -0
- package/node_modules/universal-analytics/test/event.js +346 -0
- package/node_modules/universal-analytics/test/exception.js +233 -0
- package/node_modules/universal-analytics/test/index.js +141 -0
- package/node_modules/universal-analytics/test/item.js +550 -0
- package/node_modules/universal-analytics/test/middleware.js +119 -0
- package/node_modules/universal-analytics/test/mocha.opts +3 -0
- package/node_modules/universal-analytics/test/pageview.js +286 -0
- package/node_modules/universal-analytics/test/send.js +232 -0
- package/node_modules/universal-analytics/test/set.js +68 -0
- package/node_modules/universal-analytics/test/timing.js +363 -0
- package/node_modules/universal-analytics/test/transaction.js +371 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +510 -0
- package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs/index.js +31 -0
- package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/max.js +3 -0
- package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/md5.js +13 -0
- package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
- package/node_modules/uuid/dist/cjs/native.js +4 -0
- package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/nil.js +3 -0
- package/node_modules/uuid/dist/cjs/package.json +1 -0
- package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/parse.js +11 -0
- package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/regex.js +3 -0
- package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/rng.js +13 -0
- package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/sha1.js +13 -0
- package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs/types.js +2 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs/v1.js +87 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v3.js +14 -0
- package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs/v35.js +41 -0
- package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v4.js +29 -0
- package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v5.js +14 -0
- package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v6.js +19 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v7.js +69 -0
- package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/validate.js +7 -0
- package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/version.js +10 -0
- package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
- package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
- package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
- package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
- package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
- package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs-browser/v35.js +41 -0
- package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
- package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v6.js +19 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
- package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
- package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
- package/node_modules/uuid/dist/esm/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm/index.js +14 -0
- package/node_modules/uuid/dist/esm/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm/max.js +1 -0
- package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
- package/node_modules/uuid/dist/esm/md5.js +11 -0
- package/node_modules/uuid/dist/esm/native.d.ts +6 -0
- package/node_modules/uuid/dist/esm/native.js +2 -0
- package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm/nil.js +1 -0
- package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm/parse.js +9 -0
- package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm/regex.js +1 -0
- package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm/rng.js +10 -0
- package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/esm/sha1.js +11 -0
- package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm/stringify.js +35 -0
- package/node_modules/uuid/dist/esm/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm/types.js +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm/v1.js +83 -0
- package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v3.js +9 -0
- package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm/v35.js +36 -0
- package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v4.js +27 -0
- package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v5.js +9 -0
- package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v6.js +17 -0
- package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v7.js +65 -0
- package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm/validate.js +5 -0
- package/node_modules/uuid/dist/esm/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm/version.js +8 -0
- package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm-browser/index.js +14 -0
- package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/max.js +1 -0
- package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +135 -0
- package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +9 -0
- package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +11 -0
- package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +70 -0
- package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +35 -0
- package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm-browser/types.js +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +83 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v3.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +36 -0
- package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
- package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v6.js +17 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
- package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +5 -0
- package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/version.js +8 -0
- package/node_modules/uuid/package.json +132 -0
- package/package.json +29 -14
|
@@ -11,6 +11,7 @@ const path = require("path");
|
|
|
11
11
|
const ios_device_livesync_service_1 = require("./ios-device-livesync-service");
|
|
12
12
|
const platform_livesync_service_base_1 = require("./platform-livesync-service-base");
|
|
13
13
|
const constants_1 = require("../../constants");
|
|
14
|
+
const constants_2 = require("../../common/constants");
|
|
14
15
|
const decorators_1 = require("../../common/decorators");
|
|
15
16
|
const yok_1 = require("../../common/yok");
|
|
16
17
|
class IOSLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSyncServiceBase {
|
|
@@ -40,14 +41,124 @@ class IOSLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSy
|
|
|
40
41
|
await this.$fs.zipFiles(tempZip, filesToTransfer, (res) => {
|
|
41
42
|
return path.join(constants_1.APP_FOLDER_NAME, path.relative(projectFilesPath, res));
|
|
42
43
|
});
|
|
43
|
-
await
|
|
44
|
+
const deviceProjectRootPath = await deviceAppData.getDeviceProjectRootPath();
|
|
45
|
+
const transferSyncZip = () => device.fileSystem.transferFiles(deviceAppData, [
|
|
44
46
|
{
|
|
45
47
|
getLocalPath: () => tempZip,
|
|
46
48
|
getDevicePath: () => deviceAppData.deviceSyncZipPath,
|
|
47
49
|
getRelativeToProjectBasePath: () => "../sync.zip",
|
|
48
|
-
deviceProjectRootPath
|
|
50
|
+
deviceProjectRootPath,
|
|
49
51
|
},
|
|
50
52
|
]);
|
|
53
|
+
// ── Fail-closed delivery verification ──────────────────────────
|
|
54
|
+
//
|
|
55
|
+
// The AFC transfer has been observed to fail without surfacing an
|
|
56
|
+
// error, leaving the app to boot the stale JavaScript baked into
|
|
57
|
+
// the installed .app payload with no indication anywhere that the
|
|
58
|
+
// sync was lost. After the transfer we therefore confirm the zip
|
|
59
|
+
// is actually present in the app sandbox; one retry covers
|
|
60
|
+
// transient AFC hiccups, and an unconfirmed delivery fails the
|
|
61
|
+
// sync loudly instead of printing "Successfully synced" over
|
|
62
|
+
// stale code (the run-controller surfaces the error; --clean
|
|
63
|
+
// reinstalls the full package).
|
|
64
|
+
//
|
|
65
|
+
// Presence alone is NOT sufficient evidence: a previous run that
|
|
66
|
+
// transferred the zip but aborted before the app restarted leaves
|
|
67
|
+
// a LEFTOVER sync.zip behind (the runtime only consumes it at
|
|
68
|
+
// boot), which would satisfy the check even when THIS upload
|
|
69
|
+
// failed. So any pre-existing zip is deleted up front — after
|
|
70
|
+
// that, post-transfer presence can only be produced by this run's
|
|
71
|
+
// upload.
|
|
72
|
+
//
|
|
73
|
+
// NOTE: deviceProjectRootPath is `.../LiveSync/app` (the extracted
|
|
74
|
+
// app folder); the zip is uploaded one level up, at the LiveSync
|
|
75
|
+
// root — the listing targets THAT directory.
|
|
76
|
+
//
|
|
77
|
+
// Escape hatch: NS_SKIP_IOS_SYNC_VERIFICATION=1 disables the
|
|
78
|
+
// whole verification for exotic setups where directory listing
|
|
79
|
+
// misbehaves but uploads are known-good.
|
|
80
|
+
const syncZipDevicePath = deviceAppData.deviceSyncZipPath;
|
|
81
|
+
const verificationSupported = !!device.fileSystem.getDirectoryEntries &&
|
|
82
|
+
process.env.NS_SKIP_IOS_SYNC_VERIFICATION !== "1";
|
|
83
|
+
const listLiveSyncRoot = () => device.fileSystem.getDirectoryEntries(constants_2.LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH, deviceAppData.appIdentifier);
|
|
84
|
+
// Entry shape: ios-device-lib's native `read_dir` recursively joins
|
|
85
|
+
// `<requested dir>/<entry>` and returns FULL paths rooted at the
|
|
86
|
+
// requested directory (verified against IOSDeviceLib.cpp and live
|
|
87
|
+
// device output), so the canonical match is exact equality with
|
|
88
|
+
// `Library/Application Support/LiveSync/sync.zip`. The bare
|
|
89
|
+
// `"sync.zip"` equality is defensive cover for listing
|
|
90
|
+
// implementations that return root-relative names. Deliberately NO
|
|
91
|
+
// suffix matching — `endsWith("/sync.zip")` would false-positively
|
|
92
|
+
// accept a nested app asset like `.../LiveSync/app/sync.zip`.
|
|
93
|
+
const containsSyncZip = (entries) => entries.some((entry) => entry === syncZipDevicePath || entry === "sync.zip");
|
|
94
|
+
// "delivered" / "missing" are definitive listings; "unknown" means
|
|
95
|
+
// the listing itself could not be read (after one retry).
|
|
96
|
+
const checkDelivery = async () => {
|
|
97
|
+
let entries = await listLiveSyncRoot();
|
|
98
|
+
if (entries === null) {
|
|
99
|
+
entries = await listLiveSyncRoot();
|
|
100
|
+
}
|
|
101
|
+
if (entries === null) {
|
|
102
|
+
return "unknown";
|
|
103
|
+
}
|
|
104
|
+
return containsSyncZip(entries) ? "delivered" : "missing";
|
|
105
|
+
};
|
|
106
|
+
let preListingAvailable = false;
|
|
107
|
+
let leftoverZipPresent = false;
|
|
108
|
+
if (verificationSupported) {
|
|
109
|
+
// Clear any leftover zip so the post-transfer check attributes
|
|
110
|
+
// presence to this run. Best-effort: AFC "file not found" is
|
|
111
|
+
// tolerated inside deleteFile.
|
|
112
|
+
await device.fileSystem.deleteFile(syncZipDevicePath, deviceAppData.appIdentifier);
|
|
113
|
+
const preEntries = await listLiveSyncRoot();
|
|
114
|
+
preListingAvailable = Array.isArray(preEntries);
|
|
115
|
+
leftoverZipPresent = preListingAvailable && containsSyncZip(preEntries);
|
|
116
|
+
}
|
|
117
|
+
await transferSyncZip();
|
|
118
|
+
if (verificationSupported) {
|
|
119
|
+
if (leftoverZipPresent) {
|
|
120
|
+
// The pre-transfer delete did not take effect, so presence
|
|
121
|
+
// can no longer be attributed to this run. Most likely the
|
|
122
|
+
// upload succeeded too, but say so explicitly rather than
|
|
123
|
+
// claim verification.
|
|
124
|
+
this.$logger.warn("A leftover sync.zip from a previous run could not be removed — delivery verification for this sync is inconclusive. " +
|
|
125
|
+
"If the app runs stale code, re-run the command or use a clean rebuild (--clean).");
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
let state = await checkDelivery();
|
|
129
|
+
if (state === "missing") {
|
|
130
|
+
this.$logger.warn("sync.zip was not found on the device after transfer — retrying once...");
|
|
131
|
+
await transferSyncZip();
|
|
132
|
+
state = await checkDelivery();
|
|
133
|
+
if (state === "delivered") {
|
|
134
|
+
this.$logger.info("sync.zip delivered on retry.");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (state === "missing") {
|
|
138
|
+
throw new Error(`Unable to deliver the application payload (sync.zip) to device ${device.deviceInfo.identifier}. ` +
|
|
139
|
+
`The app would run stale JavaScript without it. ` +
|
|
140
|
+
`Re-run the command, or use a clean rebuild (--clean) to reinstall the full application package.`);
|
|
141
|
+
}
|
|
142
|
+
if (state === "unknown") {
|
|
143
|
+
if (preListingAvailable) {
|
|
144
|
+
// The listing worked moments before the upload and
|
|
145
|
+
// broke right after it — the AFC session is
|
|
146
|
+
// misbehaving at exactly the point where the upload
|
|
147
|
+
// itself is suspect. Fail closed.
|
|
148
|
+
throw new Error(`Unable to confirm delivery of the application payload (sync.zip) to device ${device.deviceInfo.identifier}: ` +
|
|
149
|
+
`the device directory listing failed right after the transfer. ` +
|
|
150
|
+
`Re-run the command, or use a clean rebuild (--clean) to reinstall the full application package. ` +
|
|
151
|
+
`(Set NS_SKIP_IOS_SYNC_VERIFICATION=1 to bypass delivery verification.)`);
|
|
152
|
+
}
|
|
153
|
+
// Listing was unavailable both before and after the
|
|
154
|
+
// transfer — verification is unsupported for this
|
|
155
|
+
// device/session. This is the single fail-open path,
|
|
156
|
+
// and it is loud rather than silent.
|
|
157
|
+
this.$logger.warn("Could not verify sync.zip delivery (device directory listing unavailable). " +
|
|
158
|
+
"If the transfer failed, the app will run stale JavaScript — re-run the command or use a clean rebuild (--clean).");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
51
162
|
await deviceAppData.device.applicationManager.setTransferredAppFiles(filesToTransfer);
|
|
52
163
|
return {
|
|
53
164
|
deviceAppData,
|
|
@@ -107,18 +107,20 @@ class PluginsService {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
async preparePluginNativeCode({ pluginData, platform, projectData, }) {
|
|
110
|
+
var _a, _b, _c;
|
|
110
111
|
const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
|
|
111
112
|
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(platform);
|
|
112
|
-
|
|
113
|
-
if (pluginNativeFilesPath) {
|
|
113
|
+
if (this.$fs.exists(pluginPlatformsFolderPath)) {
|
|
114
114
|
const pathToPluginsBuildFile = path.join(platformData.projectRoot, constants.PLUGINS_BUILD_DATA_FILENAME);
|
|
115
115
|
const allPluginsNativeHashes = this.getAllPluginsNativeHashes(pathToPluginsBuildFile);
|
|
116
116
|
const oldPluginNativeHashes = allPluginsNativeHashes[pluginData.name];
|
|
117
|
-
const currentPluginNativeHashes = await this.getPluginNativeHashes(
|
|
118
|
-
|
|
119
|
-
this.$filesHashService.hasChangesInShasums(oldPluginNativeHashes, currentPluginNativeHashes)
|
|
117
|
+
const currentPluginNativeHashes = await this.getPluginNativeHashes(pluginPlatformsFolderPath);
|
|
118
|
+
const needsReprepare = !oldPluginNativeHashes ||
|
|
119
|
+
this.$filesHashService.hasChangesInShasums(oldPluginNativeHashes, currentPluginNativeHashes) ||
|
|
120
|
+
((_c = (_b = (_a = platformData.platformProjectService).shouldRepreparePlugin) === null || _b === void 0 ? void 0 : _b.call(_a, pluginData, projectData)) !== null && _c !== void 0 ? _c : false);
|
|
121
|
+
if (needsReprepare) {
|
|
120
122
|
await platformData.platformProjectService.preparePluginNativeCode(pluginData, projectData);
|
|
121
|
-
const updatedPluginNativeHashes = await this.getPluginNativeHashes(
|
|
123
|
+
const updatedPluginNativeHashes = await this.getPluginNativeHashes(pluginPlatformsFolderPath);
|
|
122
124
|
this.setPluginNativeHashes({
|
|
123
125
|
pathToPluginsBuildFile,
|
|
124
126
|
pluginData,
|
|
@@ -128,20 +130,6 @@ class PluginsService {
|
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
|
-
getPluginNativeFilesPath(pluginData, platform, pluginPlatformsFolderPath) {
|
|
132
|
-
if (this.$fs.exists(pluginPlatformsFolderPath)) {
|
|
133
|
-
return pluginPlatformsFolderPath;
|
|
134
|
-
}
|
|
135
|
-
if (this.$mobileHelper.ismacOSPlatform(platform)) {
|
|
136
|
-
const iosSourcePath = path.join(pluginData.pluginPlatformsFolderPath("ios" /* constants.PlatformTypes.ios */), "src");
|
|
137
|
-
if (this.$fs.exists(iosSourcePath)) {
|
|
138
|
-
// For macOS, allow iOS native source fallback only.
|
|
139
|
-
// Binary framework/static library discovery remains strict to `platforms/macos`.
|
|
140
|
-
return iosSourcePath;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
133
|
async ensureAllDependenciesAreInstalled(projectData) {
|
|
146
134
|
const packageJsonContent = this.$fs.readJson(this.getPackageJsonFilePath(projectData.projectDir));
|
|
147
135
|
const allDependencies = _.keys(packageJsonContent.dependencies).concat(_.keys(packageJsonContent.devDependencies));
|
|
@@ -381,7 +369,12 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
381
369
|
getNodeModuleData(module, projectDir) {
|
|
382
370
|
// module can be modulePath or moduleName
|
|
383
371
|
if (!this.$fs.exists(module) || path.basename(module) !== "package.json") {
|
|
384
|
-
|
|
372
|
+
const resolvedPath = this.getPackageJsonFilePathForModule(module, projectDir);
|
|
373
|
+
if (!resolvedPath) {
|
|
374
|
+
this.$logger.warn(`Could not find module ${color_1.color.yellow(module)}. It may have been removed or is not installed. Skipping.`);
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
module = resolvedPath;
|
|
385
378
|
}
|
|
386
379
|
const data = this.$fs.readJson(module);
|
|
387
380
|
return {
|
|
@@ -399,7 +392,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
399
392
|
async getAllInstalledModules(projectData) {
|
|
400
393
|
await this.ensure(projectData);
|
|
401
394
|
const nodeModules = this.getDependencies(projectData.projectDir);
|
|
402
|
-
return _.map(nodeModules, (nodeModuleName) => this.getNodeModuleData(nodeModuleName, projectData.projectDir));
|
|
395
|
+
return _.map(nodeModules, (nodeModuleName) => this.getNodeModuleData(nodeModuleName, projectData.projectDir)).filter(Boolean);
|
|
403
396
|
}
|
|
404
397
|
async executeNpmCommand(npmCommandName, npmCommandArguments, projectData) {
|
|
405
398
|
if (npmCommandName === PluginsService.INSTALL_COMMAND_NAME) {
|
|
@@ -435,12 +428,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
435
428
|
const installedFrameworkVersion = this.getInstalledFrameworkVersion(platform, projectData);
|
|
436
429
|
const pluginPlatformsData = pluginData.platformsData;
|
|
437
430
|
if (pluginPlatformsData) {
|
|
438
|
-
|
|
439
|
-
if (!versionRequiredByPlugin &&
|
|
440
|
-
this.$mobileHelper.ismacOSPlatform(platform)) {
|
|
441
|
-
// Keep macOS compatible with existing iOS plugin declarations.
|
|
442
|
-
versionRequiredByPlugin = pluginPlatformsData["ios" /* constants.PlatformTypes.ios */];
|
|
443
|
-
}
|
|
431
|
+
const versionRequiredByPlugin = pluginPlatformsData[platform];
|
|
444
432
|
if (!versionRequiredByPlugin) {
|
|
445
433
|
this.$logger.warn(`${pluginData.name} is not supported for ${platform}.`);
|
|
446
434
|
isValid = false;
|
|
@@ -44,23 +44,12 @@ class ProjectChangesService {
|
|
|
44
44
|
const isNewPrepareInfo = await this.ensurePrepareInfo(platformData, projectData, prepareData);
|
|
45
45
|
if (!isNewPrepareInfo) {
|
|
46
46
|
let platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, platformData.normalizedPlatformName);
|
|
47
|
-
const visionOSPlatformName = this.$devicePlatformsConstants.visionOS &&
|
|
48
|
-
this.$devicePlatformsConstants.visionOS.toLowerCase();
|
|
49
|
-
const macOSPlatformName = this.$devicePlatformsConstants.macOS &&
|
|
50
|
-
this.$devicePlatformsConstants.macOS.toLowerCase();
|
|
51
|
-
const iOSPlatformName = this.$devicePlatformsConstants.iOS || "iOS";
|
|
52
47
|
if (!this.$fs.exists(platformResourcesDir) &&
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
platformResourcesDir = path.join(projectData.appResourcesDirectoryPath,
|
|
56
|
-
}
|
|
57
|
-
if (this.$fs.exists(platformResourcesDir)) {
|
|
58
|
-
this._changesInfo.appResourcesChanged = this.containsNewerFiles(platformResourcesDir, projectData);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this.$logger.trace(`App resources path does not exist: ${platformResourcesDir}`);
|
|
62
|
-
this._changesInfo.appResourcesChanged = false;
|
|
48
|
+
platformData.platformNameLowerCase ===
|
|
49
|
+
this.$devicePlatformsConstants.visionOS.toLowerCase()) {
|
|
50
|
+
platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS);
|
|
63
51
|
}
|
|
52
|
+
this._changesInfo.appResourcesChanged = this.containsNewerFiles(platformResourcesDir, projectData);
|
|
64
53
|
this.$nodeModulesDependenciesBuilder
|
|
65
54
|
.getProductionDependencies(projectData.projectDir, projectData.ignoredDependencies)
|
|
66
55
|
.filter((dep) => dep.nativescript &&
|
|
@@ -18,10 +18,11 @@ const yok_1 = require("../common/yok");
|
|
|
18
18
|
const semver = require("semver");
|
|
19
19
|
const package_path_helper_1 = require("../helpers/package-path-helper");
|
|
20
20
|
class ProjectDataService {
|
|
21
|
-
constructor($fs, $staticConfig, $logger, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
|
|
21
|
+
constructor($fs, $staticConfig, $logger, $projectData, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
|
|
22
22
|
this.$fs = $fs;
|
|
23
23
|
this.$staticConfig = $staticConfig;
|
|
24
24
|
this.$logger = $logger;
|
|
25
|
+
this.$projectData = $projectData;
|
|
25
26
|
this.$devicePlatformsConstants = $devicePlatformsConstants;
|
|
26
27
|
this.$androidResourcesMigrationService = $androidResourcesMigrationService;
|
|
27
28
|
this.$injector = $injector;
|
|
@@ -357,9 +358,7 @@ class ProjectDataService {
|
|
|
357
358
|
const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
|
|
358
359
|
const runtimeName = platform === "android" /* PlatformTypes.android */
|
|
359
360
|
? constants.TNS_ANDROID_RUNTIME_NAME
|
|
360
|
-
:
|
|
361
|
-
? constants.SCOPED_MACOS_RUNTIME_NAME
|
|
362
|
-
: constants.TNS_IOS_RUNTIME_NAME;
|
|
361
|
+
: constants.TNS_IOS_RUNTIME_NAME;
|
|
363
362
|
if (packageJson &&
|
|
364
363
|
packageJson.nativescript &&
|
|
365
364
|
packageJson.nativescript[runtimeName] &&
|
|
@@ -375,30 +374,26 @@ class ProjectDataService {
|
|
|
375
374
|
return this.getInstalledRuntimePackage(projectDir, platform);
|
|
376
375
|
}
|
|
377
376
|
getInstalledRuntimePackage(projectDir, platform) {
|
|
377
|
+
var _a, _b, _c, _d;
|
|
378
378
|
const runtimePackage = this.$pluginsService
|
|
379
379
|
.getDependenciesFromPackageJson(projectDir)
|
|
380
380
|
.devDependencies.find((d) => {
|
|
381
|
+
var _a, _b, _c, _d;
|
|
381
382
|
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
382
|
-
|
|
383
|
-
constants.SCOPED_IOS_RUNTIME_NAME
|
|
384
|
-
|
|
385
|
-
].includes(d.name);
|
|
383
|
+
const packageName = ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
|
|
384
|
+
constants.SCOPED_IOS_RUNTIME_NAME;
|
|
385
|
+
return [packageName, constants.TNS_IOS_RUNTIME_NAME].includes(d.name);
|
|
386
386
|
}
|
|
387
387
|
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
388
|
-
|
|
389
|
-
constants.SCOPED_ANDROID_RUNTIME_NAME
|
|
390
|
-
|
|
391
|
-
].includes(d.name);
|
|
388
|
+
const packageName = ((_d = (_c = this.$projectData.nsConfig) === null || _c === void 0 ? void 0 : _c.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) ||
|
|
389
|
+
constants.SCOPED_ANDROID_RUNTIME_NAME;
|
|
390
|
+
return [packageName, constants.TNS_ANDROID_RUNTIME_NAME].includes(d.name);
|
|
392
391
|
}
|
|
393
392
|
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
394
393
|
return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
|
|
395
394
|
}
|
|
396
|
-
else if (platform === "macos" /* constants.PlatformTypes.macos */) {
|
|
397
|
-
return d.name === constants.SCOPED_MACOS_RUNTIME_NAME;
|
|
398
|
-
}
|
|
399
395
|
});
|
|
400
396
|
if (runtimePackage) {
|
|
401
|
-
const originalVersion = runtimePackage.version;
|
|
402
397
|
const coerced = semver.coerce(runtimePackage.version);
|
|
403
398
|
const isRange = !!coerced && coerced.version !== runtimePackage.version;
|
|
404
399
|
const isTag = !coerced;
|
|
@@ -415,13 +410,7 @@ class ProjectDataService {
|
|
|
415
410
|
runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
|
|
416
411
|
}
|
|
417
412
|
catch (err) {
|
|
418
|
-
|
|
419
|
-
// installed in node_modules. `npm install <name>@<file:...>` works.
|
|
420
|
-
if ((originalVersion === null || originalVersion === void 0 ? void 0 : originalVersion.startsWith("file:")) ||
|
|
421
|
-
(originalVersion === null || originalVersion === void 0 ? void 0 : originalVersion.includes("tgz"))) {
|
|
422
|
-
runtimePackage.version = originalVersion;
|
|
423
|
-
}
|
|
424
|
-
else if (isRange) {
|
|
413
|
+
if (isRange) {
|
|
425
414
|
runtimePackage.version = semver.coerce(runtimePackage.version).version;
|
|
426
415
|
runtimePackage._coerced = true;
|
|
427
416
|
}
|
|
@@ -436,13 +425,15 @@ class ProjectDataService {
|
|
|
436
425
|
this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
|
|
437
426
|
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
438
427
|
return {
|
|
439
|
-
name:
|
|
428
|
+
name: ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
|
|
429
|
+
constants.SCOPED_IOS_RUNTIME_NAME,
|
|
440
430
|
version: null,
|
|
441
431
|
};
|
|
442
432
|
}
|
|
443
433
|
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
444
434
|
return {
|
|
445
|
-
name:
|
|
435
|
+
name: ((_d = (_c = this.$projectData.nsConfig) === null || _c === void 0 ? void 0 : _c.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) ||
|
|
436
|
+
constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
446
437
|
version: null,
|
|
447
438
|
};
|
|
448
439
|
}
|
|
@@ -452,12 +443,6 @@ class ProjectDataService {
|
|
|
452
443
|
version: null,
|
|
453
444
|
};
|
|
454
445
|
}
|
|
455
|
-
else if (platform === "macos" /* constants.PlatformTypes.macos */) {
|
|
456
|
-
return {
|
|
457
|
-
name: constants.SCOPED_MACOS_RUNTIME_NAME,
|
|
458
|
-
version: null,
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
446
|
}
|
|
462
447
|
getNsConfigDefaultContent(data) {
|
|
463
448
|
const config = this.getNsConfigDefaultObject(data);
|
|
@@ -76,7 +76,6 @@ class VersionsService {
|
|
|
76
76
|
async getRuntimesVersions(platform) {
|
|
77
77
|
const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios" /* constants.PlatformTypes.ios */);
|
|
78
78
|
const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android" /* constants.PlatformTypes.android */);
|
|
79
|
-
const macOSRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "macos" /* constants.PlatformTypes.macos */);
|
|
80
79
|
let runtimes = [];
|
|
81
80
|
if (!platform) {
|
|
82
81
|
runtimes = [iosRuntime, androidRuntime];
|
|
@@ -87,9 +86,6 @@ class VersionsService {
|
|
|
87
86
|
else if (platform === "android" /* PlatformTypes.android */) {
|
|
88
87
|
runtimes.push(androidRuntime);
|
|
89
88
|
}
|
|
90
|
-
else if (platform === "macos" /* PlatformTypes.macos */) {
|
|
91
|
-
runtimes.push(macOSRuntime);
|
|
92
|
-
}
|
|
93
89
|
const runtimesVersions = await Promise.all(runtimes.map(async (runtime) => {
|
|
94
90
|
const latestVersion = await this.$packageInstallationManager.getLatestVersion(runtime.name);
|
|
95
91
|
const runtimeInformation = {
|
|
@@ -117,16 +117,36 @@ class ConfigTransformer {
|
|
|
117
117
|
}
|
|
118
118
|
return `{}`;
|
|
119
119
|
}
|
|
120
|
+
isBooleanLiteralNode(initializer) {
|
|
121
|
+
return ((initializer === null || initializer === void 0 ? void 0 : initializer.getKind()) === ts_morph_1.SyntaxKind.TrueKeyword ||
|
|
122
|
+
(initializer === null || initializer === void 0 ? void 0 : initializer.getKind()) === ts_morph_1.SyntaxKind.FalseKeyword);
|
|
123
|
+
}
|
|
124
|
+
replaceInitializer(initializer, newValue) {
|
|
125
|
+
return initializer.replaceWithText(this.createInitializer(newValue));
|
|
126
|
+
}
|
|
120
127
|
setInitializerValue(initializer, newValue) {
|
|
121
128
|
if (ts_morph_1.Node.isStringLiteral(initializer)) {
|
|
129
|
+
if (typeof newValue !== "string") {
|
|
130
|
+
return this.replaceInitializer(initializer, newValue);
|
|
131
|
+
}
|
|
122
132
|
return initializer.setLiteralValue(newValue);
|
|
123
133
|
}
|
|
124
134
|
if (ts_morph_1.Node.isNumericLiteral(initializer)) {
|
|
135
|
+
if (typeof newValue !== "number") {
|
|
136
|
+
return this.replaceInitializer(initializer, newValue);
|
|
137
|
+
}
|
|
125
138
|
return initializer.setLiteralValue(newValue);
|
|
126
139
|
}
|
|
127
|
-
if (
|
|
140
|
+
if (this.isBooleanLiteralNode(initializer)) {
|
|
141
|
+
if (typeof newValue !== "boolean") {
|
|
142
|
+
return this.replaceInitializer(initializer, newValue);
|
|
143
|
+
}
|
|
128
144
|
return initializer.setLiteralValue(newValue);
|
|
129
145
|
}
|
|
146
|
+
if (ts_morph_1.Node.isArrayLiteralExpression(initializer) ||
|
|
147
|
+
ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
|
|
148
|
+
return this.replaceInitializer(initializer, newValue);
|
|
149
|
+
}
|
|
130
150
|
if (ts_morph_1.Node.isIdentifier(initializer)) {
|
|
131
151
|
return this.setIdentifierValue(initializer, newValue);
|
|
132
152
|
}
|
|
@@ -139,9 +159,25 @@ class ConfigTransformer {
|
|
|
139
159
|
if (ts_morph_1.Node.isNumericLiteral(initializer)) {
|
|
140
160
|
return initializer.getLiteralValue();
|
|
141
161
|
}
|
|
142
|
-
if (
|
|
162
|
+
if (this.isBooleanLiteralNode(initializer)) {
|
|
143
163
|
return initializer.getLiteralValue();
|
|
144
164
|
}
|
|
165
|
+
if (ts_morph_1.Node.isArrayLiteralExpression(initializer)) {
|
|
166
|
+
return initializer
|
|
167
|
+
.getElements()
|
|
168
|
+
.map((element) => this.getInitializerValue(element));
|
|
169
|
+
}
|
|
170
|
+
if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
|
|
171
|
+
const result = {};
|
|
172
|
+
for (const property of initializer.getProperties()) {
|
|
173
|
+
if (!ts_morph_1.Node.isPropertyAssignment(property)) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const name = property.getNameNode().getText().replace(/['\"]/g, "");
|
|
177
|
+
result[name] = this.getInitializerValue(property.getInitializerOrThrow());
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
145
181
|
if (ts_morph_1.Node.isIdentifier(initializer)) {
|
|
146
182
|
return this.getIdentifierValue(initializer);
|
|
147
183
|
}
|
|
@@ -176,9 +212,25 @@ class ConfigTransformer {
|
|
|
176
212
|
if (ts_morph_1.Node.isNumericLiteral(initializer)) {
|
|
177
213
|
return initializer.getLiteralValue();
|
|
178
214
|
}
|
|
179
|
-
if (
|
|
215
|
+
if (this.isBooleanLiteralNode(initializer)) {
|
|
180
216
|
return initializer.getLiteralValue();
|
|
181
217
|
}
|
|
218
|
+
if (ts_morph_1.Node.isArrayLiteralExpression(initializer)) {
|
|
219
|
+
return initializer
|
|
220
|
+
.getElements()
|
|
221
|
+
.map((element) => this.getInitializerValue(element));
|
|
222
|
+
}
|
|
223
|
+
if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
|
|
224
|
+
const result = {};
|
|
225
|
+
for (const property of initializer.getProperties()) {
|
|
226
|
+
if (!ts_morph_1.Node.isPropertyAssignment(property)) {
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const name = property.getNameNode().getText().replace(/['\"]/g, "");
|
|
230
|
+
result[name] = this.getInitializerValue(property.getInitializerOrThrow());
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
182
234
|
if (ts_morph_1.Node.isIdentifier(initializer)) {
|
|
183
235
|
return this.getIdentifierValue(initializer);
|
|
184
236
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
|
4
|
+
Copyright (c) 2018-2021 Josh Junon
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
7
|
+
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
|
8
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
9
|
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
13
|
+
portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
16
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
19
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
+
|