ohos-router 1.1.7 → 1.1.8
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/package.json +1 -1
- package/router.ts +11 -6
package/package.json
CHANGED
package/router.ts
CHANGED
|
@@ -451,13 +451,18 @@ function printBuildProFile(buildProfileData: string, type: number) {
|
|
|
451
451
|
" ],\n"
|
|
452
452
|
buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
|
|
453
453
|
} else if (type == 3) {
|
|
454
|
-
let buildProfileBean = JSON.parse(buildProfileData)
|
|
455
|
-
buildProfileBean.buildOption.arkOptions.runtimeOnly.packages
|
|
456
|
-
|
|
454
|
+
let buildProfileBean = JSON.parse(buildProfileData);
|
|
455
|
+
let packages = buildProfileBean.buildOption.arkOptions.runtimeOnly.packages;
|
|
456
|
+
const mergedArray: number[] = [...dependenciesKey, ...packages].reduce(
|
|
457
|
+
(unique: number[], item: number) => {
|
|
458
|
+
return unique.includes(item) ? unique : [...unique, item];
|
|
459
|
+
},
|
|
460
|
+
[]
|
|
461
|
+
);
|
|
457
462
|
let buildProfileTag = "\"packages\": ["
|
|
458
|
-
let buildProfilePosition =
|
|
459
|
-
let buildProfileBuilder = "\n" +
|
|
460
|
-
buildProfileContent = insertString(
|
|
463
|
+
let buildProfilePosition = buildProfileData.indexOf(buildProfileTag) + buildProfileTag.length
|
|
464
|
+
let buildProfileBuilder = "\n" + mergedArray
|
|
465
|
+
buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
|
|
461
466
|
}
|
|
462
467
|
|
|
463
468
|
FileUtil.writeFileSync(buildProfilePath, buildProfileContent);
|