zcw-shared 1.46.2 → 1.47.2
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/dist/functions/async/sleep.d.ts +5 -0
- package/dist/functions/async/sleep.js +6 -0
- package/dist/functions/async/sleep.js.map +1 -0
- package/dist/functions/async/timeout.d.ts +6 -0
- package/dist/functions/async/timeout.js +12 -0
- package/dist/functions/async/timeout.js.map +1 -0
- package/dist/functions/browser/computePosition.d.ts +6 -0
- package/dist/functions/browser/computePosition.js +49 -0
- package/dist/functions/browser/computePosition.js.map +1 -0
- package/dist/functions/browser/createSharedKeyboardCenter.d.ts +18 -0
- package/dist/functions/browser/createSharedKeyboardCenter.js +58 -0
- package/dist/functions/browser/createSharedKeyboardCenter.js.map +1 -0
- package/dist/functions/browser/createThrottledEventListener.d.ts +11 -0
- package/dist/functions/browser/createThrottledEventListener.js +51 -0
- package/dist/functions/browser/createThrottledEventListener.js.map +1 -0
- package/dist/functions/browser/demonstrateResourceLoading.d.ts +32 -0
- package/dist/functions/browser/demonstrateResourceLoading.js +169 -0
- package/dist/functions/browser/demonstrateResourceLoading.js.map +1 -0
- package/dist/functions/browser/detectOverflow.d.ts +12 -0
- package/dist/functions/browser/detectOverflow.js +17 -0
- package/dist/functions/browser/detectOverflow.js.map +1 -0
- package/dist/functions/browser/getAlignment.d.ts +2 -0
- package/dist/functions/browser/getAlignment.js +5 -0
- package/dist/functions/browser/getAlignment.js.map +1 -0
- package/dist/functions/browser/getBasePlacement.d.ts +2 -0
- package/dist/functions/browser/getBasePlacement.js +4 -0
- package/dist/functions/browser/getBasePlacement.js.map +1 -0
- package/dist/functions/browser/getCrossAxisFlip.d.ts +2 -0
- package/dist/functions/browser/getCrossAxisFlip.js +11 -0
- package/dist/functions/browser/getCrossAxisFlip.js.map +1 -0
- package/dist/functions/browser/getElementRect.d.ts +3 -0
- package/dist/functions/browser/getElementRect.js +14 -0
- package/dist/functions/browser/getElementRect.js.map +1 -0
- package/dist/functions/browser/getFlipPlacements.d.ts +2 -0
- package/dist/functions/browser/getFlipPlacements.js +13 -0
- package/dist/functions/browser/getFlipPlacements.js.map +1 -0
- package/dist/functions/browser/getMainAxisFlip.d.ts +2 -0
- package/dist/functions/browser/getMainAxisFlip.js +17 -0
- package/dist/functions/browser/getMainAxisFlip.js.map +1 -0
- package/dist/functions/browser/getRelativePosition.d.ts +3 -0
- package/dist/functions/browser/getRelativePosition.js +14 -0
- package/dist/functions/browser/getRelativePosition.js.map +1 -0
- package/dist/functions/browser/getViewportRect.d.ts +7 -0
- package/dist/functions/browser/getViewportRect.js +15 -0
- package/dist/functions/browser/getViewportRect.js.map +1 -0
- package/dist/functions/browser/isValidPlacement.d.ts +2 -0
- package/dist/functions/browser/isValidPlacement.js +16 -0
- package/dist/functions/browser/isValidPlacement.js.map +1 -0
- package/dist/functions/browser/pickFile.d.ts +15 -0
- package/dist/functions/browser/pickFile.js +48 -0
- package/dist/functions/browser/pickFile.js.map +1 -0
- package/dist/functions/build/generateExports.d.ts +26 -0
- package/dist/functions/build/generateExports.js +34 -0
- package/dist/functions/build/generateExports.js.map +1 -0
- package/dist/functions/core/diff/diff.d.ts +25 -0
- package/dist/functions/core/diff/diff.js +316 -0
- package/dist/functions/core/diff/diff.js.map +1 -0
- package/dist/functions/core/diff/vueDiff.d.ts +38 -0
- package/dist/functions/core/diff/vueDiff.js +333 -0
- package/dist/functions/core/diff/vueDiff.js.map +1 -0
- package/dist/functions/core/generator/generatorUtils.d.ts +16 -0
- package/dist/functions/core/generator/generatorUtils.js +139 -0
- package/dist/functions/core/generator/generatorUtils.js.map +1 -0
- package/dist/functions/core/type/isType.d.ts +11 -0
- package/dist/functions/core/type/isType.js +30 -0
- package/dist/functions/core/type/isType.js.map +1 -0
- package/dist/functions/data/array-object/chunk.d.ts +1 -0
- package/dist/functions/data/array-object/chunk.js +11 -0
- package/dist/functions/data/array-object/chunk.js.map +1 -0
- package/dist/functions/data/array-object/deepClone.d.ts +12 -0
- package/dist/functions/data/array-object/deepClone.js +131 -0
- package/dist/functions/data/array-object/deepClone.js.map +1 -0
- package/dist/functions/data/array-object/evolve.d.ts +3 -0
- package/dist/functions/data/array-object/evolve.js +15 -0
- package/dist/functions/data/array-object/evolve.js.map +1 -0
- package/dist/functions/data/array-object/flatten.d.ts +7 -0
- package/dist/functions/data/array-object/flatten.js +60 -0
- package/dist/functions/data/array-object/flatten.js.map +1 -0
- package/dist/functions/data/array-object/flattenObject.d.ts +5 -0
- package/dist/functions/data/array-object/flattenObject.js +102 -0
- package/dist/functions/data/array-object/flattenObject.js.map +1 -0
- package/dist/functions/data/array-object/groupBy.d.ts +1 -0
- package/dist/functions/data/array-object/groupBy.js +14 -0
- package/dist/functions/data/array-object/groupBy.js.map +1 -0
- package/dist/functions/data/array-object/omit.d.ts +1 -0
- package/dist/functions/data/array-object/omit.js +8 -0
- package/dist/functions/data/array-object/omit.js.map +1 -0
- package/dist/functions/data/array-object/pick.d.ts +1 -0
- package/dist/functions/data/array-object/pick.js +10 -0
- package/dist/functions/data/array-object/pick.js.map +1 -0
- package/dist/functions/data/array-object/shuffle.d.ts +1 -0
- package/dist/functions/data/array-object/shuffle.js +9 -0
- package/dist/functions/data/array-object/shuffle.js.map +1 -0
- package/dist/functions/data/array-object/sortBy.d.ts +1 -0
- package/dist/functions/data/array-object/sortBy.js +13 -0
- package/dist/functions/data/array-object/sortBy.js.map +1 -0
- package/dist/functions/data/array-object/unique.d.ts +10 -0
- package/dist/functions/data/array-object/unique.js +85 -0
- package/dist/functions/data/array-object/unique.js.map +1 -0
- package/dist/functions/data/date/dateRange.d.ts +1 -0
- package/dist/functions/data/date/dateRange.js +18 -0
- package/dist/functions/data/date/dateRange.js.map +1 -0
- package/dist/functions/data/date/formatDate.d.ts +1 -0
- package/dist/functions/data/date/formatDate.js +21 -0
- package/dist/functions/data/date/formatDate.js.map +1 -0
- package/dist/functions/data/date/timeAgo.d.ts +1 -0
- package/dist/functions/data/date/timeAgo.js +49 -0
- package/dist/functions/data/date/timeAgo.js.map +1 -0
- package/dist/functions/data/number/average.d.ts +1 -0
- package/dist/functions/data/number/average.js +8 -0
- package/dist/functions/data/number/average.js.map +1 -0
- package/dist/functions/data/number/clamp.d.ts +1 -0
- package/dist/functions/data/number/clamp.js +7 -0
- package/dist/functions/data/number/clamp.js.map +1 -0
- package/dist/functions/data/number/formatNumber.d.ts +8 -0
- package/dist/functions/data/number/formatNumber.js +16 -0
- package/dist/functions/data/number/formatNumber.js.map +1 -0
- package/dist/functions/data/number/median.d.ts +1 -0
- package/dist/functions/data/number/median.js +14 -0
- package/dist/functions/data/number/median.js.map +1 -0
- package/dist/functions/data/number/percentile.d.ts +1 -0
- package/dist/functions/data/number/percentile.js +18 -0
- package/dist/functions/data/number/percentile.js.map +1 -0
- package/dist/functions/data/number/random.d.ts +4 -0
- package/dist/functions/data/number/random.js +9 -0
- package/dist/functions/data/number/random.js.map +1 -0
- package/dist/functions/data/number/range.d.ts +1 -0
- package/dist/functions/data/number/range.js +18 -0
- package/dist/functions/data/number/range.js.map +1 -0
- package/dist/functions/data/number/sum.d.ts +1 -0
- package/dist/functions/data/number/sum.js +4 -0
- package/dist/functions/data/number/sum.js.map +1 -0
- package/dist/functions/data/randomRegion.d.ts +24 -0
- package/dist/functions/data/randomRegion.js +74 -0
- package/dist/functions/data/randomRegion.js.map +1 -0
- package/dist/functions/data/string/base64.d.ts +5 -0
- package/dist/functions/data/string/base64.js +6 -0
- package/dist/functions/data/string/base64.js.map +1 -0
- package/dist/functions/data/string/capitalize.d.ts +1 -0
- package/dist/functions/data/string/capitalize.js +6 -0
- package/dist/functions/data/string/capitalize.js.map +1 -0
- package/dist/functions/data/string/caseConverter.d.ts +19 -0
- package/dist/functions/data/string/caseConverter.js +94 -0
- package/dist/functions/data/string/caseConverter.js.map +1 -0
- package/dist/functions/data/string/desensitize.d.ts +13 -0
- package/dist/functions/data/string/desensitize.js +107 -0
- package/dist/functions/data/string/desensitize.js.map +1 -0
- package/dist/functions/data/string/htmlEscape.d.ts +20 -0
- package/dist/functions/data/string/htmlEscape.js +80 -0
- package/dist/functions/data/string/htmlEscape.js.map +1 -0
- package/dist/functions/data/string/levenshtein.d.ts +1 -0
- package/dist/functions/data/string/levenshtein.js +27 -0
- package/dist/functions/data/string/levenshtein.js.map +1 -0
- package/dist/functions/data/string/normalize.d.ts +8 -0
- package/dist/functions/data/string/normalize.js +37 -0
- package/dist/functions/data/string/normalize.js.map +1 -0
- package/dist/functions/data/string/pad.d.ts +13 -0
- package/dist/functions/data/string/pad.js +50 -0
- package/dist/functions/data/string/pad.js.map +1 -0
- package/dist/functions/data/string/palindrome.d.ts +3 -0
- package/dist/functions/data/string/palindrome.js +15 -0
- package/dist/functions/data/string/palindrome.js.map +1 -0
- package/dist/functions/data/string/similarity.d.ts +1 -0
- package/dist/functions/data/string/similarity.js +13 -0
- package/dist/functions/data/string/similarity.js.map +1 -0
- package/dist/functions/data/string/template.d.ts +4 -0
- package/dist/functions/data/string/template.js +21 -0
- package/dist/functions/data/string/template.js.map +1 -0
- package/dist/functions/data/string/testRegex.d.ts +20 -0
- package/dist/functions/data/string/testRegex.js +300 -0
- package/dist/functions/data/string/testRegex.js.map +1 -0
- package/dist/functions/data/string/wordCount.d.ts +5 -0
- package/dist/functions/data/string/wordCount.js +11 -0
- package/dist/functions/data/string/wordCount.js.map +1 -0
- package/dist/functions/data/tree/buildTree.d.ts +7 -0
- package/dist/functions/data/tree/buildTree.js +27 -0
- package/dist/functions/data/tree/buildTree.js.map +1 -0
- package/dist/functions/data/tree/filterTree.d.ts +4 -0
- package/dist/functions/data/tree/filterTree.js +21 -0
- package/dist/functions/data/tree/filterTree.js.map +1 -0
- package/dist/functions/data/tree/findNode.d.ts +4 -0
- package/dist/functions/data/tree/findNode.js +21 -0
- package/dist/functions/data/tree/findNode.js.map +1 -0
- package/dist/functions/data/tree/flattenTree.d.ts +6 -0
- package/dist/functions/data/tree/flattenTree.js +21 -0
- package/dist/functions/data/tree/flattenTree.js.map +1 -0
- package/dist/functions/file/walk.d.ts +18 -0
- package/dist/functions/file/walk.js +58 -0
- package/dist/functions/file/walk.js.map +1 -0
- package/dist/functions/integrations/ag-grid/generateLicense.d.ts +7 -0
- package/dist/functions/integrations/ag-grid/generateLicense.js +12 -0
- package/dist/functions/integrations/ag-grid/generateLicense.js.map +1 -0
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.d.ts +30 -0
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js +884 -0
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js.map +1 -0
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.d.ts +31 -0
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js +900 -0
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js.map +1 -0
- package/dist/functions/integrations/uniapp/build.d.ts +21 -0
- package/dist/functions/integrations/uniapp/build.js +83 -0
- package/dist/functions/integrations/uniapp/build.js.map +1 -0
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.d.ts +11 -0
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js +30 -0
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js.map +1 -0
- package/dist/functions/integrations/uniapp/detectProjectType.d.ts +20 -0
- package/dist/functions/integrations/uniapp/detectProjectType.js +68 -0
- package/dist/functions/integrations/uniapp/detectProjectType.js.map +1 -0
- package/dist/functions/integrations/uniapp/parseManifest.d.ts +20 -0
- package/dist/functions/integrations/uniapp/parseManifest.js +51 -0
- package/dist/functions/integrations/uniapp/parseManifest.js.map +1 -0
- package/dist/functions/integrations/uniapp/waitForPages.d.ts +7 -0
- package/dist/functions/integrations/uniapp/waitForPages.js +20 -0
- package/dist/functions/integrations/uniapp/waitForPages.js.map +1 -0
- package/dist/functions/integrations/vue/dynamicMount.d.ts +18 -0
- package/dist/functions/integrations/vue/dynamicMount.js +25 -0
- package/dist/functions/integrations/vue/dynamicMount.js.map +1 -0
- package/dist/functions/integrations/vue/extractColorsFromVueFile.d.ts +3 -0
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js +18 -0
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js.map +1 -0
- package/dist/functions/integrations/vue/extractColorsFromVueSection.d.ts +3 -0
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js +53 -0
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js.map +1 -0
- package/dist/functions/integrations/vue/filterSections.d.ts +2 -0
- package/dist/functions/integrations/vue/filterSections.js +11 -0
- package/dist/functions/integrations/vue/filterSections.js.map +1 -0
- package/dist/functions/integrations/vue/isVNode.d.ts +2 -0
- package/dist/functions/integrations/vue/isVNode.js +6 -0
- package/dist/functions/integrations/vue/isVNode.js.map +1 -0
- package/dist/functions/integrations/vue/isVueComponent.d.ts +2 -0
- package/dist/functions/integrations/vue/isVueComponent.js +6 -0
- package/dist/functions/integrations/vue/isVueComponent.js.map +1 -0
- package/dist/functions/integrations/vue/parseVueFile.d.ts +2 -0
- package/dist/functions/integrations/vue/parseVueFile.js +53 -0
- package/dist/functions/integrations/vue/parseVueFile.js.map +1 -0
- package/dist/functions/integrations/wechat/miniapp/downloadFile.d.ts +6 -0
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js +39 -0
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js.map +1 -0
- package/dist/functions/ios/integrateCameraGallery.d.ts +16 -0
- package/dist/functions/ios/integrateCameraGallery.js +95 -0
- package/dist/functions/ios/integrateCameraGallery.js.map +1 -0
- package/dist/functions/ios/integrateThirdPartyModule.d.ts +5 -0
- package/dist/functions/ios/integrateThirdPartyModule.js +99 -0
- package/dist/functions/ios/integrateThirdPartyModule.js.map +1 -1
- package/dist/functions/patterns/MyPromise.d.ts +32 -0
- package/dist/functions/patterns/MyPromise.js +254 -0
- package/dist/functions/patterns/MyPromise.js.map +1 -0
- package/dist/functions/patterns/functionBind.d.ts +4 -0
- package/dist/functions/patterns/functionBind.js +33 -0
- package/dist/functions/patterns/functionBind.js.map +1 -0
- package/dist/functions/patterns/myInstanceof.d.ts +5 -0
- package/dist/functions/patterns/myInstanceof.js +56 -0
- package/dist/functions/patterns/myInstanceof.js.map +1 -0
- package/dist/functions/patterns/myNew.d.ts +3 -0
- package/dist/functions/patterns/myNew.js +19 -0
- package/dist/functions/patterns/myNew.js.map +1 -0
- package/dist/functions/platform/android/buildProject.d.ts +13 -0
- package/dist/functions/platform/android/buildProject.js +122 -0
- package/dist/functions/platform/android/buildProject.js.map +1 -0
- package/dist/functions/platform/android/configureAppIcon.d.ts +17 -0
- package/dist/functions/platform/android/configureAppIcon.js +106 -0
- package/dist/functions/platform/android/configureAppIcon.js.map +1 -0
- package/dist/functions/platform/android/configureLaunchScreen.d.ts +21 -0
- package/dist/functions/platform/android/configureLaunchScreen.js +328 -0
- package/dist/functions/platform/android/configureLaunchScreen.js.map +1 -0
- package/dist/functions/platform/android/detectAndroidModules.d.ts +8 -0
- package/dist/functions/platform/android/detectAndroidModules.js +21 -0
- package/dist/functions/platform/android/detectAndroidModules.js.map +1 -0
- package/dist/functions/platform/android/integrateFacebookLogin.d.ts +12 -0
- package/dist/functions/platform/android/integrateFacebookLogin.js +91 -0
- package/dist/functions/platform/android/integrateFacebookLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateGoogleLogin.d.ts +10 -0
- package/dist/functions/platform/android/integrateGoogleLogin.js +199 -0
- package/dist/functions/platform/android/integrateGoogleLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateMiuiLogin.d.ts +13 -0
- package/dist/functions/platform/android/integrateMiuiLogin.js +115 -0
- package/dist/functions/platform/android/integrateMiuiLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateQQLogin.d.ts +12 -0
- package/dist/functions/platform/android/integrateQQLogin.js +130 -0
- package/dist/functions/platform/android/integrateQQLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateShareTrace.d.ts +10 -0
- package/dist/functions/platform/android/integrateShareTrace.js +181 -0
- package/dist/functions/platform/android/integrateShareTrace.js.map +1 -0
- package/dist/functions/platform/android/integrateSinaLogin.d.ts +13 -0
- package/dist/functions/platform/android/integrateSinaLogin.js +85 -0
- package/dist/functions/platform/android/integrateSinaLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateThirdPartyModule.d.ts +46 -0
- package/dist/functions/platform/android/integrateThirdPartyModule.js +251 -0
- package/dist/functions/platform/android/integrateThirdPartyModule.js.map +1 -0
- package/dist/functions/platform/android/integrateUniAppNativePlugin.d.ts +22 -0
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js +631 -0
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js.map +1 -0
- package/dist/functions/platform/android/integrateUniverifyLogin.d.ts +11 -0
- package/dist/functions/platform/android/integrateUniverifyLogin.js +314 -0
- package/dist/functions/platform/android/integrateUniverifyLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateWechatLogin.d.ts +13 -0
- package/dist/functions/platform/android/integrateWechatLogin.js +154 -0
- package/dist/functions/platform/android/integrateWechatLogin.js.map +1 -0
- package/dist/functions/platform/android/integrateWechatShare.d.ts +13 -0
- package/dist/functions/platform/android/integrateWechatShare.js +154 -0
- package/dist/functions/platform/android/integrateWechatShare.js.map +1 -0
- package/dist/functions/platform/android/modifyGradle.d.ts +28 -0
- package/dist/functions/platform/android/modifyGradle.js +119 -0
- package/dist/functions/platform/android/modifyGradle.js.map +1 -0
- package/dist/functions/platform/android/modifyManifest.d.ts +39 -0
- package/dist/functions/platform/android/modifyManifest.js +225 -0
- package/dist/functions/platform/android/modifyManifest.js.map +1 -0
- package/dist/functions/platform/android/permission.d.ts +54 -0
- package/dist/functions/platform/android/permission.js +85 -0
- package/dist/functions/platform/android/permission.js.map +1 -0
- package/dist/functions/platform/ios/configureAppIcon.d.ts +17 -0
- package/dist/functions/platform/ios/configureAppIcon.js +149 -0
- package/dist/functions/platform/ios/configureAppIcon.js.map +1 -0
- package/dist/functions/platform/ios/configureLaunchScreen.d.ts +17 -0
- package/dist/functions/platform/ios/configureLaunchScreen.js +150 -0
- package/dist/functions/platform/ios/configureLaunchScreen.js.map +1 -0
- package/dist/functions/platform/ios/configurePermissions.d.ts +19 -0
- package/dist/functions/platform/ios/configurePermissions.js +120 -0
- package/dist/functions/platform/ios/configurePermissions.js.map +1 -0
- package/dist/functions/platform/ios/integrateNativePlugin.d.ts +35 -0
- package/dist/functions/platform/ios/integrateNativePlugin.js +994 -0
- package/dist/functions/platform/ios/integrateNativePlugin.js.map +1 -0
- package/dist/functions/platform/ios/integrateQQShare.d.ts +14 -0
- package/dist/functions/platform/ios/integrateQQShare.js +132 -0
- package/dist/functions/platform/ios/integrateQQShare.js.map +1 -0
- package/dist/functions/platform/ios/integrateSinaShare.d.ts +16 -0
- package/dist/functions/platform/ios/integrateSinaShare.js +108 -0
- package/dist/functions/platform/ios/integrateSinaShare.js.map +1 -0
- package/dist/functions/platform/ios/integrateThirdPartyModule.d.ts +62 -0
- package/dist/functions/platform/ios/integrateThirdPartyModule.js +883 -0
- package/dist/functions/platform/ios/integrateThirdPartyModule.js.map +1 -0
- package/dist/functions/platform/ios/integrateWechatOauth.d.ts +14 -0
- package/dist/functions/platform/ios/integrateWechatOauth.js +107 -0
- package/dist/functions/platform/ios/integrateWechatOauth.js.map +1 -0
- package/dist/functions/platform/ios/integrateWechatShare.d.ts +14 -0
- package/dist/functions/platform/ios/integrateWechatShare.js +101 -0
- package/dist/functions/platform/ios/integrateWechatShare.js.map +1 -0
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.d.ts +2 -0
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js +45 -0
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js.map +1 -0
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.d.ts +16 -0
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js +136 -0
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js.map +1 -0
- package/dist/functions/platform/ios/useAltool.d.ts +39 -0
- package/dist/functions/platform/ios/useAltool.js +350 -0
- package/dist/functions/platform/ios/useAltool.js.map +1 -0
- package/dist/functions/style/buildTokens.d.ts +76 -0
- package/dist/functions/style/buildTokens.js +183 -0
- package/dist/functions/style/buildTokens.js.map +1 -0
- package/dist/functions/style/extractCssVariables.d.ts +16 -0
- package/dist/functions/style/extractCssVariables.js +256 -0
- package/dist/functions/style/extractCssVariables.js.map +1 -0
- package/dist/functions/style/generateVariables.d.ts +7 -0
- package/dist/functions/style/generateVariables.js +135 -0
- package/dist/functions/style/generateVariables.js.map +1 -0
- package/dist/functions/style/mixColors.d.ts +1 -0
- package/dist/functions/style/mixColors.js +38 -0
- package/dist/functions/style/mixColors.js.map +1 -0
- package/dist/functions/style/parseDesignTokens.d.ts +10 -0
- package/dist/functions/style/parseDesignTokens.js +216 -0
- package/dist/functions/style/parseDesignTokens.js.map +1 -0
- package/dist/functions/uniapp/app-plus/buildIOSApp.js +36 -0
- package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
- package/dist/functions/uniapp/camera/showCamera.d.ts +11 -0
- package/dist/functions/uniapp/camera/showCamera.js +22 -0
- package/dist/functions/uniapp/camera/showCamera.js.map +1 -0
- package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.d.ts +23 -0
- package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.js +69 -0
- package/dist/functions/uniapp/customer-service/adapters/openCustomerServiceInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/customer-service/showWxCustomerService.d.ts +28 -0
- package/dist/functions/uniapp/customer-service/showWxCustomerService.js +25 -0
- package/dist/functions/uniapp/customer-service/showWxCustomerService.js.map +1 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInApp.d.ts +10 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInApp.js +97 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInApp.js.map +1 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInH5.d.ts +30 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInH5.js +83 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInH5.js.map +1 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.d.ts +10 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.js +97 -0
- package/dist/functions/uniapp/file/adapters/readWriteFileInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/file/showFile.d.ts +35 -0
- package/dist/functions/uniapp/file/showFile.js +66 -0
- package/dist/functions/uniapp/file/showFile.js.map +1 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInApp.d.ts +9 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInApp.js +52 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInApp.js.map +1 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInH5.d.ts +9 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInH5.js +52 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInH5.js.map +1 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.d.ts +9 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.js +52 -0
- package/dist/functions/uniapp/image/adapters/chooseImageInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/image/showImage.d.ts +11 -0
- package/dist/functions/uniapp/image/showImage.js +23 -0
- package/dist/functions/uniapp/image/showImage.js.map +1 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInApp.d.ts +10 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInApp.js +49 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInApp.js.map +1 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.d.ts +9 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.js +27 -0
- package/dist/functions/uniapp/login/adapters/wechatLoginInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/login/showLogin.d.ts +13 -0
- package/dist/functions/uniapp/login/showLogin.js +43 -0
- package/dist/functions/uniapp/login/showLogin.js.map +1 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInApp.d.ts +8 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInApp.js +36 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInApp.js.map +1 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInH5.d.ts +13 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInH5.js +44 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInH5.js.map +1 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.d.ts +8 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.js +37 -0
- package/dist/functions/uniapp/pay/adapters/wechatPayInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/pay/showPay.d.ts +18 -0
- package/dist/functions/uniapp/pay/showPay.js +60 -0
- package/dist/functions/uniapp/pay/showPay.js.map +1 -0
- package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.d.ts +6 -0
- package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.js +41 -0
- package/dist/functions/uniapp/phone/adapters/getPhoneInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/phone/showWxPhone.d.ts +8 -0
- package/dist/functions/uniapp/phone/showWxPhone.js +25 -0
- package/dist/functions/uniapp/phone/showWxPhone.js.map +1 -0
- package/dist/functions/uniapp/record/adapters/recordInApp.d.ts +12 -0
- package/dist/functions/uniapp/record/adapters/recordInApp.js +64 -0
- package/dist/functions/uniapp/record/adapters/recordInApp.js.map +1 -0
- package/dist/functions/uniapp/record/adapters/recordInH5.d.ts +21 -0
- package/dist/functions/uniapp/record/adapters/recordInH5.js +82 -0
- package/dist/functions/uniapp/record/adapters/recordInH5.js.map +1 -0
- package/dist/functions/uniapp/record/adapters/recordInMiniapp.d.ts +12 -0
- package/dist/functions/uniapp/record/adapters/recordInMiniapp.js +64 -0
- package/dist/functions/uniapp/record/adapters/recordInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/record/showRecord.d.ts +23 -0
- package/dist/functions/uniapp/record/showRecord.js +95 -0
- package/dist/functions/uniapp/record/showRecord.js.map +1 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.d.ts +9 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.js +30 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInApp.js.map +1 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.d.ts +9 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.js +30 -0
- package/dist/functions/uniapp/scan-code/adapters/scanCodeInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/scan-code/showScanCode.d.ts +12 -0
- package/dist/functions/uniapp/scan-code/showScanCode.js +28 -0
- package/dist/functions/uniapp/scan-code/showScanCode.js.map +1 -0
- package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.d.ts +9 -0
- package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.js +41 -0
- package/dist/functions/uniapp/subscribe-message/adapters/wechatSubscribeMessageInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.d.ts +11 -0
- package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.js +25 -0
- package/dist/functions/uniapp/subscribe-message/showWxSubscribeMessage.js.map +1 -0
- package/dist/functions/uniapp/user-info/wxGetUserInfo.d.ts +43 -0
- package/dist/functions/uniapp/user-info/wxGetUserInfo.js +55 -0
- package/dist/functions/uniapp/user-info/wxGetUserInfo.js.map +1 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInApp.d.ts +9 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInApp.js +31 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInApp.js.map +1 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInH5.d.ts +9 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInH5.js +30 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInH5.js.map +1 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.d.ts +9 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.js +31 -0
- package/dist/functions/uniapp/video/adapters/chooseVideoInMiniapp.js.map +1 -0
- package/dist/functions/uniapp/video/showVideo.d.ts +11 -0
- package/dist/functions/uniapp/video/showVideo.js +23 -0
- package/dist/functions/uniapp/video/showVideo.js.map +1 -0
- package/dist/functions/validation/parseJwtPayload.d.ts +7 -0
- package/dist/functions/validation/parseJwtPayload.js +33 -0
- package/dist/functions/validation/parseJwtPayload.js.map +1 -0
- package/dist/functions/validation/validate.d.ts +11 -0
- package/dist/functions/validation/validate.js +44 -0
- package/dist/functions/validation/validate.js.map +1 -0
- package/dist/vue-hooks/browser/useBridgeMessage.d.ts +2 -1
- package/dist/vue-hooks/browser/useBridgeMessage.js +13 -11
- package/dist/vue-hooks/browser/useBridgeMessage.js.map +1 -1
- package/package.json +37 -2
- package/references/blob.d.ts +2 -0
- package/references/device.d.ts +46 -0
- package/references/dom.d.ts +6 -0
- package/references/uniapp.d.ts +221 -8
- package/types/uniapp-ios-build.d.ts +22 -0
- package/types/uniapp.d.ts +298 -0
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
import { modifyInfoPlistKeyValue } from './modifyInfoPlistKeyValue';
|
|
2
|
+
function addURLSchemeToInfoPlist(xmlDoc, urlScheme) {
|
|
3
|
+
const dictElement = xmlDoc.getElementsByTagName('dict')[0];
|
|
4
|
+
if (!dictElement)
|
|
5
|
+
return false;
|
|
6
|
+
let urlTypesKey = null;
|
|
7
|
+
let urlTypesArray = null;
|
|
8
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
9
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
10
|
+
const node = childNodes[i];
|
|
11
|
+
if (node.nodeName === 'key' && node.textContent === 'CFBundleURLTypes') {
|
|
12
|
+
urlTypesKey = node;
|
|
13
|
+
if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
|
|
14
|
+
urlTypesArray = childNodes[i + 1];
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!urlTypesArray) {
|
|
20
|
+
if (!urlTypesKey) {
|
|
21
|
+
urlTypesKey = xmlDoc.createElement('key');
|
|
22
|
+
urlTypesKey.textContent = 'CFBundleURLTypes';
|
|
23
|
+
dictElement.appendChild(urlTypesKey);
|
|
24
|
+
}
|
|
25
|
+
urlTypesArray = xmlDoc.createElement('array');
|
|
26
|
+
dictElement.appendChild(urlTypesArray);
|
|
27
|
+
}
|
|
28
|
+
let targetIdentifier = 'weixin';
|
|
29
|
+
if (urlScheme.startsWith('wx')) {
|
|
30
|
+
targetIdentifier = 'weixin';
|
|
31
|
+
}
|
|
32
|
+
else if (urlScheme.startsWith('wb')) {
|
|
33
|
+
targetIdentifier = 'sinaweibo';
|
|
34
|
+
}
|
|
35
|
+
else if (urlScheme.startsWith('tencent')) {
|
|
36
|
+
targetIdentifier = 'qq';
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
targetIdentifier = urlScheme;
|
|
40
|
+
}
|
|
41
|
+
const arrayChildNodes = Array.from(urlTypesArray.childNodes || []).filter((node) => node.nodeType === 1);
|
|
42
|
+
for (let i = 0; i < arrayChildNodes.length; i++) {
|
|
43
|
+
const dictNode = arrayChildNodes[i];
|
|
44
|
+
if (dictNode.nodeName === 'dict') {
|
|
45
|
+
const dictChildren = Array.from(dictNode.childNodes || []).filter((node) => node.nodeType === 1);
|
|
46
|
+
let urlNameValue = null;
|
|
47
|
+
let schemesArrayElement = null;
|
|
48
|
+
for (let j = 0; j < dictChildren.length; j++) {
|
|
49
|
+
if (dictChildren[j].nodeName === 'key' && dictChildren[j].textContent === 'CFBundleURLName') {
|
|
50
|
+
if (j + 1 < dictChildren.length && dictChildren[j + 1].nodeName === 'string') {
|
|
51
|
+
urlNameValue = dictChildren[j + 1].textContent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (dictChildren[j].nodeName === 'key' && dictChildren[j].textContent === 'CFBundleURLSchemes') {
|
|
55
|
+
if (j + 1 < dictChildren.length && dictChildren[j + 1].nodeName === 'array') {
|
|
56
|
+
schemesArrayElement = dictChildren[j + 1];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (urlNameValue === targetIdentifier && schemesArrayElement) {
|
|
61
|
+
const schemes = Array.from(schemesArrayElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
62
|
+
for (const schemeNode of schemes) {
|
|
63
|
+
if (schemeNode.nodeName === 'string' && schemeNode.textContent === urlScheme) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const existingSchemes = Array.from(schemesArrayElement.childNodes || []);
|
|
68
|
+
for (const child of existingSchemes) {
|
|
69
|
+
schemesArrayElement.removeChild(child);
|
|
70
|
+
}
|
|
71
|
+
const stringElement = xmlDoc.createElement('string');
|
|
72
|
+
stringElement.textContent = urlScheme;
|
|
73
|
+
schemesArrayElement.appendChild(stringElement);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const urlTypeDict = xmlDoc.createElement('dict');
|
|
79
|
+
let identifier = 'weixin';
|
|
80
|
+
if (urlScheme.startsWith('wx')) {
|
|
81
|
+
identifier = 'weixin';
|
|
82
|
+
}
|
|
83
|
+
else if (urlScheme.startsWith('wb')) {
|
|
84
|
+
identifier = 'sinaweibo';
|
|
85
|
+
}
|
|
86
|
+
else if (urlScheme.startsWith('tencent')) {
|
|
87
|
+
identifier = 'qq';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
identifier = urlScheme;
|
|
91
|
+
}
|
|
92
|
+
const identifierKey = xmlDoc.createElement('key');
|
|
93
|
+
identifierKey.textContent = 'CFBundleURLName';
|
|
94
|
+
const identifierValue = xmlDoc.createElement('string');
|
|
95
|
+
identifierValue.textContent = identifier;
|
|
96
|
+
urlTypeDict.appendChild(identifierKey);
|
|
97
|
+
urlTypeDict.appendChild(identifierValue);
|
|
98
|
+
const schemesKey = xmlDoc.createElement('key');
|
|
99
|
+
schemesKey.textContent = 'CFBundleURLSchemes';
|
|
100
|
+
const schemesArray = xmlDoc.createElement('array');
|
|
101
|
+
const schemeString = xmlDoc.createElement('string');
|
|
102
|
+
schemeString.textContent = urlScheme;
|
|
103
|
+
schemesArray.appendChild(schemeString);
|
|
104
|
+
urlTypeDict.appendChild(schemesKey);
|
|
105
|
+
urlTypeDict.appendChild(schemesArray);
|
|
106
|
+
urlTypesArray.appendChild(urlTypeDict);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
function findEntitlementsFile(projectPath, projectName, deps) {
|
|
110
|
+
const possiblePaths = [
|
|
111
|
+
deps.join(projectPath, projectName, `${projectName}.entitlements`),
|
|
112
|
+
deps.join(projectPath, projectName, `${projectName}-Debug.entitlements`),
|
|
113
|
+
deps.join(projectPath, projectName, `${projectName}-Release.entitlements`),
|
|
114
|
+
deps.join(projectPath, `${projectName}.entitlements`),
|
|
115
|
+
deps.join(projectPath, `${projectName}-Debug.entitlements`),
|
|
116
|
+
deps.join(projectPath, `${projectName}-Release.entitlements`),
|
|
117
|
+
deps.join(projectPath, projectName, `${projectName.split('-')[0]}.entitlements`),
|
|
118
|
+
deps.join(projectPath, projectName, `${projectName.split('-')[0]}-Debug.entitlements`),
|
|
119
|
+
deps.join(projectPath, projectName, `${projectName.split('-')[0]}-Release.entitlements`),
|
|
120
|
+
deps.join(projectPath, `${projectName.split('-')[0]}.entitlements`),
|
|
121
|
+
deps.join(projectPath, `${projectName.split('-')[0]}-Debug.entitlements`),
|
|
122
|
+
deps.join(projectPath, `${projectName.split('-')[0]}-Release.entitlements`)
|
|
123
|
+
];
|
|
124
|
+
for (const path of possiblePaths) {
|
|
125
|
+
if (deps.existsSync(path)) {
|
|
126
|
+
return path;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const searchInDirectory = (dir, depth = 0) => {
|
|
130
|
+
if (depth > 3) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
if (!deps.existsSync(dir)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const files = deps.readdirSync(dir);
|
|
138
|
+
const entitlementsFile = files.find(f => f.endsWith('.entitlements'));
|
|
139
|
+
if (entitlementsFile) {
|
|
140
|
+
return deps.join(dir, entitlementsFile);
|
|
141
|
+
}
|
|
142
|
+
for (const file of files) {
|
|
143
|
+
const fullPath = deps.join(dir, file);
|
|
144
|
+
try {
|
|
145
|
+
const stat = deps.statSync(fullPath);
|
|
146
|
+
if (stat.isDirectory() && !file.startsWith('.') && file !== 'DerivedData' && file !== 'build') {
|
|
147
|
+
const found = searchInDirectory(fullPath, depth + 1);
|
|
148
|
+
if (found) {
|
|
149
|
+
return found;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
};
|
|
162
|
+
const searchPaths = [
|
|
163
|
+
deps.join(projectPath, projectName),
|
|
164
|
+
projectPath
|
|
165
|
+
];
|
|
166
|
+
for (const searchPath of searchPaths) {
|
|
167
|
+
if (deps.existsSync(searchPath)) {
|
|
168
|
+
const found = searchInDirectory(searchPath);
|
|
169
|
+
if (found) {
|
|
170
|
+
return found;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function addAssociatedDomainToEntitlements(entitlementsPath, domain, deps) {
|
|
177
|
+
try {
|
|
178
|
+
let xmlContent;
|
|
179
|
+
let xmlDoc;
|
|
180
|
+
if (deps.existsSync(entitlementsPath)) {
|
|
181
|
+
xmlContent = deps.readFileSync(entitlementsPath, 'utf8');
|
|
182
|
+
const parser = new deps.xmlParser();
|
|
183
|
+
xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const parser = new deps.xmlParser();
|
|
187
|
+
xmlContent = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n</dict>\n</plist>';
|
|
188
|
+
xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
189
|
+
}
|
|
190
|
+
const dictElement = xmlDoc.getElementsByTagName('dict')[0];
|
|
191
|
+
if (!dictElement)
|
|
192
|
+
return false;
|
|
193
|
+
let found = false;
|
|
194
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
195
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
196
|
+
const node = childNodes[i];
|
|
197
|
+
if (node.nodeName === 'key' && node.textContent === 'com.apple.developer.associated-domains') {
|
|
198
|
+
if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
|
|
199
|
+
const arrayElement = childNodes[i + 1];
|
|
200
|
+
const arrayChildren = Array.from(arrayElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
201
|
+
for (const child of arrayChildren) {
|
|
202
|
+
if (child.nodeName === 'string' && child.textContent === domain) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const stringElement = xmlDoc.createElement('string');
|
|
207
|
+
stringElement.textContent = domain;
|
|
208
|
+
arrayElement.appendChild(stringElement);
|
|
209
|
+
found = true;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (!found) {
|
|
215
|
+
const keyElement = xmlDoc.createElement('key');
|
|
216
|
+
keyElement.textContent = 'com.apple.developer.associated-domains';
|
|
217
|
+
const arrayElement = xmlDoc.createElement('array');
|
|
218
|
+
const stringElement = xmlDoc.createElement('string');
|
|
219
|
+
stringElement.textContent = domain;
|
|
220
|
+
arrayElement.appendChild(stringElement);
|
|
221
|
+
dictElement.appendChild(keyElement);
|
|
222
|
+
dictElement.appendChild(arrayElement);
|
|
223
|
+
}
|
|
224
|
+
const serializer = new deps.xmlSerializer();
|
|
225
|
+
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
226
|
+
deps.writeFileSync(entitlementsPath, newXmlContent, 'utf8');
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function addDictKeyValueToInfoPlist(xmlDoc, keyName, dictValue) {
|
|
234
|
+
const dictElement = xmlDoc.getElementsByTagName('dict')[0];
|
|
235
|
+
if (!dictElement)
|
|
236
|
+
return false;
|
|
237
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
238
|
+
let found = false;
|
|
239
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
240
|
+
const node = childNodes[i];
|
|
241
|
+
if (node.nodeName === 'key' && node.textContent === keyName) {
|
|
242
|
+
if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'dict') {
|
|
243
|
+
const existingDict = childNodes[i + 1];
|
|
244
|
+
const dictChildren = Array.from(existingDict.childNodes || []);
|
|
245
|
+
for (const child of dictChildren) {
|
|
246
|
+
existingDict.removeChild(child);
|
|
247
|
+
}
|
|
248
|
+
for (const [k, v] of Object.entries(dictValue)) {
|
|
249
|
+
const keyElement = xmlDoc.createElement('key');
|
|
250
|
+
keyElement.textContent = k;
|
|
251
|
+
const valueElement = xmlDoc.createElement('string');
|
|
252
|
+
valueElement.textContent = v;
|
|
253
|
+
existingDict.appendChild(keyElement);
|
|
254
|
+
existingDict.appendChild(valueElement);
|
|
255
|
+
}
|
|
256
|
+
found = true;
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (!found) {
|
|
262
|
+
const keyElement = xmlDoc.createElement('key');
|
|
263
|
+
keyElement.textContent = keyName;
|
|
264
|
+
const dictValueElement = xmlDoc.createElement('dict');
|
|
265
|
+
for (const [k, v] of Object.entries(dictValue)) {
|
|
266
|
+
const subKeyElement = xmlDoc.createElement('key');
|
|
267
|
+
subKeyElement.textContent = k;
|
|
268
|
+
const subValueElement = xmlDoc.createElement('string');
|
|
269
|
+
subValueElement.textContent = v;
|
|
270
|
+
dictValueElement.appendChild(subKeyElement);
|
|
271
|
+
dictValueElement.appendChild(subValueElement);
|
|
272
|
+
}
|
|
273
|
+
dictElement.appendChild(keyElement);
|
|
274
|
+
dictElement.appendChild(dictValueElement);
|
|
275
|
+
found = true;
|
|
276
|
+
}
|
|
277
|
+
return found;
|
|
278
|
+
}
|
|
279
|
+
function addLSApplicationQueriesSchemesToInfoPlist(xmlDoc, scheme) {
|
|
280
|
+
const dictElement = xmlDoc.getElementsByTagName('dict')[0];
|
|
281
|
+
if (!dictElement)
|
|
282
|
+
return false;
|
|
283
|
+
let queriesSchemesKey = null;
|
|
284
|
+
let queriesSchemesArray = null;
|
|
285
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
286
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
287
|
+
const node = childNodes[i];
|
|
288
|
+
if (node.nodeName === 'key' && node.textContent === 'LSApplicationQueriesSchemes') {
|
|
289
|
+
queriesSchemesKey = node;
|
|
290
|
+
if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === 'array') {
|
|
291
|
+
queriesSchemesArray = childNodes[i + 1];
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (!queriesSchemesArray) {
|
|
297
|
+
if (!queriesSchemesKey) {
|
|
298
|
+
queriesSchemesKey = xmlDoc.createElement('key');
|
|
299
|
+
queriesSchemesKey.textContent = 'LSApplicationQueriesSchemes';
|
|
300
|
+
dictElement.appendChild(queriesSchemesKey);
|
|
301
|
+
}
|
|
302
|
+
queriesSchemesArray = xmlDoc.createElement('array');
|
|
303
|
+
dictElement.appendChild(queriesSchemesArray);
|
|
304
|
+
}
|
|
305
|
+
const arrayChildNodes = Array.from(queriesSchemesArray.childNodes || []).filter((node) => node.nodeType === 1);
|
|
306
|
+
for (const child of arrayChildNodes) {
|
|
307
|
+
if (child.nodeName === 'string' && child.textContent === scheme) {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const stringElement = xmlDoc.createElement('string');
|
|
312
|
+
stringElement.textContent = scheme;
|
|
313
|
+
queriesSchemesArray.appendChild(stringElement);
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
function generateXcodeUUID() {
|
|
317
|
+
const chars = '0123456789ABCDEF';
|
|
318
|
+
let uuid = '';
|
|
319
|
+
for (let i = 0; i < 24; i++) {
|
|
320
|
+
uuid += chars[Math.floor(Math.random() * chars.length)];
|
|
321
|
+
}
|
|
322
|
+
return uuid;
|
|
323
|
+
}
|
|
324
|
+
function getLastKnownFileType(filePath) {
|
|
325
|
+
const ext = filePath.toLowerCase();
|
|
326
|
+
if (ext.endsWith('.framework'))
|
|
327
|
+
return 'wrapper.framework';
|
|
328
|
+
if (ext.endsWith('.xcframework'))
|
|
329
|
+
return 'wrapper.xcframework';
|
|
330
|
+
if (ext.endsWith('.a'))
|
|
331
|
+
return 'archive.ar';
|
|
332
|
+
if (ext.endsWith('.bundle'))
|
|
333
|
+
return 'wrapper.plug-in';
|
|
334
|
+
if (ext.endsWith('.tbd'))
|
|
335
|
+
return 'sourcecode.text-based-dylib-definition';
|
|
336
|
+
return 'file';
|
|
337
|
+
}
|
|
338
|
+
export function addFileToEmbedFrameworks(projectPbxprojPath, filePath, deps) {
|
|
339
|
+
try {
|
|
340
|
+
if (!deps.existsSync(projectPbxprojPath)) {
|
|
341
|
+
return { success: false, error: `project.pbxproj 文件不存在: ${projectPbxprojPath}` };
|
|
342
|
+
}
|
|
343
|
+
let content = deps.readFileSync(projectPbxprojPath, 'utf8');
|
|
344
|
+
const fileName = filePath.split('/').pop() || filePath;
|
|
345
|
+
const relativePath = filePath;
|
|
346
|
+
const lastKnownFileType = getLastKnownFileType(fileName);
|
|
347
|
+
const existingFileRefRegex = new RegExp(`PBXFileReference.*name\\s*=\\s*${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*path\\s*=\\s*${relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'i');
|
|
348
|
+
let fileRefUUID = '';
|
|
349
|
+
let fileRefExists = false;
|
|
350
|
+
if (existingFileRefRegex.test(content)) {
|
|
351
|
+
const embedFrameworkRefRegex = new RegExp(`${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*in Embed Frameworks`, 'i');
|
|
352
|
+
if (embedFrameworkRefRegex.test(content)) {
|
|
353
|
+
return { success: true };
|
|
354
|
+
}
|
|
355
|
+
const escapedFileName = fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
356
|
+
const escapedPath = relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
357
|
+
const lines = content.split('\n');
|
|
358
|
+
for (const line of lines) {
|
|
359
|
+
if (line.includes('PBXFileReference') &&
|
|
360
|
+
line.includes(fileName) &&
|
|
361
|
+
line.includes(relativePath)) {
|
|
362
|
+
const uuidMatch = line.match(/^\s*([0-9A-F]{24})\s+/i);
|
|
363
|
+
if (uuidMatch && uuidMatch[1]) {
|
|
364
|
+
fileRefUUID = uuidMatch[1];
|
|
365
|
+
fileRefExists = true;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (!fileRefExists) {
|
|
372
|
+
fileRefUUID = generateXcodeUUID();
|
|
373
|
+
}
|
|
374
|
+
const buildFileUUID = generateXcodeUUID();
|
|
375
|
+
if (!fileRefExists) {
|
|
376
|
+
const fileRefSectionEndRegex = /(\/\* End PBXFileReference section \*\/)/;
|
|
377
|
+
if (fileRefSectionEndRegex.test(content)) {
|
|
378
|
+
const fileRefEntry = `\t\t${fileRefUUID} /* ${fileName} */ = {isa = PBXFileReference; lastKnownFileType = ${lastKnownFileType}; name = ${fileName}; path = ${relativePath}; sourceTree = "<group>"; };\n`;
|
|
379
|
+
content = content.replace(fileRefSectionEndRegex, `${fileRefEntry}$1`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const buildFileSectionEndRegex = /(\/\* End PBXBuildFile section \*\/)/;
|
|
383
|
+
if (buildFileSectionEndRegex.test(content)) {
|
|
384
|
+
const buildFileEntry = `\t\t${buildFileUUID} /* ${fileName} in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = ${fileRefUUID} /* ${fileName} */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n`;
|
|
385
|
+
content = content.replace(buildFileSectionEndRegex, `${buildFileEntry}$1`);
|
|
386
|
+
}
|
|
387
|
+
const embedFrameworksPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Embed Frameworks \*\/\s*=\s*\{\s*isa\s*=\s*PBXCopyFilesBuildPhase;[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*name\s*=\s*"Embed Frameworks";)/m;
|
|
388
|
+
let match = content.match(embedFrameworksPhaseRegex);
|
|
389
|
+
if (!match) {
|
|
390
|
+
const altRegex = /(PBXCopyFilesBuildPhase[^}]*?Embed Frameworks[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*name\s*=\s*"Embed Frameworks";)/m;
|
|
391
|
+
match = content.match(altRegex);
|
|
392
|
+
}
|
|
393
|
+
if (match) {
|
|
394
|
+
const filesContent = match[2];
|
|
395
|
+
const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Embed Frameworks */,\n`;
|
|
396
|
+
const alreadyExists = filesContent.includes(buildFileUUID) ||
|
|
397
|
+
filesContent.includes(`${fileName} in Embed Frameworks`);
|
|
398
|
+
if (!alreadyExists) {
|
|
399
|
+
const newContent = match[0].replace(/(\s*\);\s*name\s*=\s*"Embed Frameworks";)/, `${newFileEntry}$1`);
|
|
400
|
+
content = content.replace(match[0], newContent);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
const frameworksGroupRegex = new RegExp(`(\\t+[0-9A-F]{24}\\s+\\/\\*\\s+Frameworks\\s+\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*PBXGroup[^}]*children\\s*=\\s*\\(\\s*)([\\s\\S]*?)(\\s*\\);[^}]*name\\s*=\\s*Frameworks[^}]*\\};)`, 'i');
|
|
404
|
+
const groupMatch = content.match(frameworksGroupRegex);
|
|
405
|
+
if (groupMatch) {
|
|
406
|
+
const childrenContent = groupMatch[2];
|
|
407
|
+
const newGroupEntry = `\t\t\t\t${fileRefUUID} /* ${fileName} */,\n`;
|
|
408
|
+
if (!childrenContent.includes(fileRefUUID)) {
|
|
409
|
+
content = content.replace(frameworksGroupRegex, `$1${childrenContent}${newGroupEntry}$3`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
return {
|
|
414
|
+
success: false,
|
|
415
|
+
error: `未找到 Frameworks group,无法将文件引用添加到项目文件树中。这可能导致文件引用出现在 Recovered References 中。`
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
deps.writeFileSync(projectPbxprojPath, content, 'utf8');
|
|
419
|
+
return { success: true };
|
|
420
|
+
}
|
|
421
|
+
catch (error) {
|
|
422
|
+
return {
|
|
423
|
+
success: false,
|
|
424
|
+
error: `添加文件到 Embed Frameworks 失败: ${error instanceof Error ? error.message : String(error)}`
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
export function addFileToXcodeProject(projectPbxprojPath, filePath, fileType, deps) {
|
|
429
|
+
try {
|
|
430
|
+
if (!deps.existsSync(projectPbxprojPath)) {
|
|
431
|
+
return { success: false, error: `project.pbxproj 文件不存在: ${projectPbxprojPath}` };
|
|
432
|
+
}
|
|
433
|
+
let content = deps.readFileSync(projectPbxprojPath, 'utf8');
|
|
434
|
+
const fileName = filePath.split('/').pop() || filePath;
|
|
435
|
+
const relativePath = filePath;
|
|
436
|
+
const lastKnownFileType = getLastKnownFileType(fileName);
|
|
437
|
+
const existingFileRefRegex = new RegExp(`PBXFileReference.*name\\s*=\\s*${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*path\\s*=\\s*${relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'i');
|
|
438
|
+
let fileRefUUID = '';
|
|
439
|
+
let fileRefExists = false;
|
|
440
|
+
if (existingFileRefRegex.test(content)) {
|
|
441
|
+
const buildFileRefRegex = new RegExp(`${fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}.*in Frameworks`, 'i');
|
|
442
|
+
if (buildFileRefRegex.test(content)) {
|
|
443
|
+
return { success: true };
|
|
444
|
+
}
|
|
445
|
+
const escapedFileName = fileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
446
|
+
const escapedPath = relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
447
|
+
const lines = content.split('\n');
|
|
448
|
+
for (const line of lines) {
|
|
449
|
+
if (line.includes('PBXFileReference') &&
|
|
450
|
+
line.includes(fileName) &&
|
|
451
|
+
line.includes(relativePath)) {
|
|
452
|
+
const uuidMatch = line.match(/^\s*([0-9A-F]{24})\s+/i);
|
|
453
|
+
if (uuidMatch && uuidMatch[1]) {
|
|
454
|
+
fileRefUUID = uuidMatch[1];
|
|
455
|
+
fileRefExists = true;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (!fileRefExists) {
|
|
462
|
+
fileRefUUID = generateXcodeUUID();
|
|
463
|
+
}
|
|
464
|
+
const buildFileUUID = generateXcodeUUID();
|
|
465
|
+
if (!fileRefExists) {
|
|
466
|
+
const fileRefSectionEndRegex = /(\/\* End PBXFileReference section \*\/)/;
|
|
467
|
+
if (fileRefSectionEndRegex.test(content)) {
|
|
468
|
+
const fileRefEntry = `\t\t${fileRefUUID} /* ${fileName} */ = {isa = PBXFileReference; lastKnownFileType = ${lastKnownFileType}; name = ${fileName}; path = ${relativePath}; sourceTree = "<group>"; };\n`;
|
|
469
|
+
content = content.replace(fileRefSectionEndRegex, `${fileRefEntry}$1`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const buildFileSectionEndRegex = /(\/\* End PBXBuildFile section \*\/)/;
|
|
473
|
+
if (buildFileSectionEndRegex.test(content)) {
|
|
474
|
+
const phaseName = fileType === 'framework' || fileType === 'staticLibrary' ? 'Frameworks' : 'Resources';
|
|
475
|
+
const buildFileEntry = `\t\t${buildFileUUID} /* ${fileName} in ${phaseName} */ = {isa = PBXBuildFile; fileRef = ${fileRefUUID} /* ${fileName} */; };\n`;
|
|
476
|
+
content = content.replace(buildFileSectionEndRegex, `${buildFileEntry}$1`);
|
|
477
|
+
}
|
|
478
|
+
if (fileType === 'framework' || fileType === 'staticLibrary') {
|
|
479
|
+
const frameworksPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Frameworks \*\/\s*=\s*\{\s*isa\s*=\s*PBXFrameworksBuildPhase;\s*buildActionMask\s*=\s*\d+;\s*files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;\s*\};)/m;
|
|
480
|
+
let match = content.match(frameworksPhaseRegex);
|
|
481
|
+
if (!match) {
|
|
482
|
+
const altRegex = /(PBXFrameworksBuildPhase[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;)/m;
|
|
483
|
+
match = content.match(altRegex);
|
|
484
|
+
}
|
|
485
|
+
if (match) {
|
|
486
|
+
const filesContent = match[2];
|
|
487
|
+
const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Frameworks */,\n`;
|
|
488
|
+
const alreadyExists = filesContent.includes(buildFileUUID) ||
|
|
489
|
+
filesContent.includes(`${fileName} in Frameworks`);
|
|
490
|
+
if (!alreadyExists) {
|
|
491
|
+
const newContent = match[0].replace(/(\s*\);\s*runOnlyForDeploymentPostprocessing)/, `${newFileEntry}$1`);
|
|
492
|
+
content = content.replace(match[0], newContent);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
else if (fileType === 'bundle') {
|
|
497
|
+
const resourcesPhaseRegex = /(\t\t[0-9A-F]{24}\s+\/\* Resources \*\/\s*=\s*\{\s*isa\s*=\s*PBXResourcesBuildPhase;\s*buildActionMask\s*=\s*\d+;\s*files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;\s*\};)/m;
|
|
498
|
+
let match = content.match(resourcesPhaseRegex);
|
|
499
|
+
if (!match) {
|
|
500
|
+
const altRegex = /(PBXResourcesBuildPhase[^}]*?files\s*=\s*\(\s*)([\s\S]*?)(\s*\);\s*runOnlyForDeploymentPostprocessing\s*=\s*\d+;)/m;
|
|
501
|
+
match = content.match(altRegex);
|
|
502
|
+
}
|
|
503
|
+
if (match) {
|
|
504
|
+
const filesContent = match[2];
|
|
505
|
+
const newFileEntry = `\t\t\t\t${buildFileUUID} /* ${fileName} in Resources */,\n`;
|
|
506
|
+
const alreadyExists = filesContent.includes(buildFileUUID) ||
|
|
507
|
+
filesContent.includes(`${fileName} in Resources`);
|
|
508
|
+
if (!alreadyExists) {
|
|
509
|
+
const newContent = match[0].replace(/(\s*\);\s*runOnlyForDeploymentPostprocessing)/, `${newFileEntry}$1`);
|
|
510
|
+
content = content.replace(match[0], newContent);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
let groupName = 'Frameworks';
|
|
515
|
+
if (fileType === 'bundle') {
|
|
516
|
+
groupName = 'Resources';
|
|
517
|
+
}
|
|
518
|
+
const frameworksGroupRegex = new RegExp(`(\\t+[0-9A-F]{24}\\s+\\/\\*\\s+${groupName}\\s+\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*PBXGroup[^}]*children\\s*=\\s*\\(\\s*)([\\s\\S]*?)(\\s*\\);[^}]*name\\s*=\\s*${groupName}[^}]*\\};)`, 'i');
|
|
519
|
+
const groupMatch = content.match(frameworksGroupRegex);
|
|
520
|
+
if (groupMatch) {
|
|
521
|
+
const childrenContent = groupMatch[2];
|
|
522
|
+
const newGroupEntry = `\t\t\t\t${fileRefUUID} /* ${fileName} */,\n`;
|
|
523
|
+
if (!childrenContent.includes(fileRefUUID)) {
|
|
524
|
+
content = content.replace(frameworksGroupRegex, `$1${childrenContent}${newGroupEntry}$3`);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
return {
|
|
529
|
+
success: false,
|
|
530
|
+
error: `未找到 ${groupName} group,无法将文件引用添加到项目文件树中。这可能导致文件引用出现在 Recovered References 中。`
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
deps.writeFileSync(projectPbxprojPath, content, 'utf8');
|
|
534
|
+
return { success: true };
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
return {
|
|
538
|
+
success: false,
|
|
539
|
+
error: `添加文件到 Xcode 项目失败: ${error instanceof Error ? error.message : String(error)}`
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
export async function integrateIOSThirdPartyModule(projectPath, projectName, bundleId, config, deps) {
|
|
544
|
+
const logs = [];
|
|
545
|
+
try {
|
|
546
|
+
logs.push(`开始集成第三方模块: ${config.name}`);
|
|
547
|
+
const projectFiles = deps.readdirSync(projectPath).filter(file => file.endsWith('.xcodeproj'));
|
|
548
|
+
if (projectFiles.length === 0) {
|
|
549
|
+
return {
|
|
550
|
+
success: false,
|
|
551
|
+
error: `在 ${projectPath} 中未找到 Xcode 项目文件(.xcodeproj)`,
|
|
552
|
+
logs
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
const projectFile = projectFiles[0];
|
|
556
|
+
const projectPbxprojPath = deps.join(projectPath, projectFile, 'project.pbxproj');
|
|
557
|
+
if (!deps.existsSync(projectPbxprojPath)) {
|
|
558
|
+
return {
|
|
559
|
+
success: false,
|
|
560
|
+
error: `project.pbxproj 文件不存在: ${projectPbxprojPath}`,
|
|
561
|
+
logs
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
if (config.frameworks && config.frameworks.length > 0) {
|
|
565
|
+
logs.push('步骤 1: 拷贝框架文件并添加到 Xcode 项目');
|
|
566
|
+
const frameworksDir = deps.join(projectPath, 'Frameworks');
|
|
567
|
+
if (!deps.existsSync(frameworksDir)) {
|
|
568
|
+
deps.mkdirSync(frameworksDir, { recursive: true });
|
|
569
|
+
logs.push(`创建 Frameworks 目录: ${frameworksDir}`);
|
|
570
|
+
}
|
|
571
|
+
for (const framework of config.frameworks) {
|
|
572
|
+
const sourcePath = framework.source;
|
|
573
|
+
const targetFileName = framework.targetName || deps.basename(sourcePath);
|
|
574
|
+
const targetPath = deps.join(frameworksDir, targetFileName);
|
|
575
|
+
if (!deps.existsSync(sourcePath)) {
|
|
576
|
+
logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
const stat = deps.statSync(sourcePath);
|
|
580
|
+
if (stat.isDirectory()) {
|
|
581
|
+
await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
deps.copyFileSync(sourcePath, targetPath);
|
|
585
|
+
}
|
|
586
|
+
logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
|
|
587
|
+
const relativePath = `Frameworks/${targetFileName}`;
|
|
588
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'framework', {
|
|
589
|
+
existsSync: deps.existsSync,
|
|
590
|
+
readFileSync: deps.readFileSync,
|
|
591
|
+
writeFileSync: deps.writeFileSync
|
|
592
|
+
});
|
|
593
|
+
if (addResult.success) {
|
|
594
|
+
logs.push(`已添加到 Xcode 项目: ${targetFileName} (路径: ${relativePath})`);
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error || '未知错误'}`);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (config.staticLibraries && config.staticLibraries.length > 0) {
|
|
602
|
+
logs.push('步骤 2: 拷贝静态库文件并添加到 Xcode 项目');
|
|
603
|
+
const libsDir = deps.join(projectPath, 'libs');
|
|
604
|
+
if (!deps.existsSync(libsDir)) {
|
|
605
|
+
deps.mkdirSync(libsDir, { recursive: true });
|
|
606
|
+
logs.push(`创建 libs 目录: ${libsDir}`);
|
|
607
|
+
}
|
|
608
|
+
for (const lib of config.staticLibraries) {
|
|
609
|
+
const sourcePath = lib.source;
|
|
610
|
+
const targetFileName = lib.targetName || deps.basename(sourcePath);
|
|
611
|
+
const targetPath = deps.join(libsDir, targetFileName);
|
|
612
|
+
if (!deps.existsSync(sourcePath)) {
|
|
613
|
+
logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
deps.copyFileSync(sourcePath, targetPath);
|
|
617
|
+
logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
|
|
618
|
+
const relativePath = `libs/${targetFileName}`;
|
|
619
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'staticLibrary', {
|
|
620
|
+
existsSync: deps.existsSync,
|
|
621
|
+
readFileSync: deps.readFileSync,
|
|
622
|
+
writeFileSync: deps.writeFileSync
|
|
623
|
+
});
|
|
624
|
+
if (addResult.success) {
|
|
625
|
+
logs.push(`已添加到 Xcode 项目: ${targetFileName} (路径: ${relativePath})`);
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error || '未知错误'}`);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (config.bundles && config.bundles.length > 0) {
|
|
633
|
+
logs.push('步骤 3: 拷贝资源文件并添加到 Xcode 项目');
|
|
634
|
+
const resourcesDir = deps.join(projectPath, projectName, 'Resources');
|
|
635
|
+
if (!deps.existsSync(resourcesDir)) {
|
|
636
|
+
deps.mkdirSync(resourcesDir, { recursive: true });
|
|
637
|
+
logs.push(`创建 Resources 目录: ${resourcesDir}`);
|
|
638
|
+
}
|
|
639
|
+
for (const bundle of config.bundles) {
|
|
640
|
+
const sourcePath = bundle.source;
|
|
641
|
+
const targetFileName = bundle.targetName || deps.basename(sourcePath);
|
|
642
|
+
const targetPath = deps.join(resourcesDir, targetFileName);
|
|
643
|
+
if (!deps.existsSync(sourcePath)) {
|
|
644
|
+
logs.push(`警告: 源文件不存在,跳过: ${sourcePath}`);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
const stat = deps.statSync(sourcePath);
|
|
648
|
+
if (stat.isDirectory()) {
|
|
649
|
+
await deps.cp(sourcePath, targetPath, { recursive: true, force: true });
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
deps.copyFileSync(sourcePath, targetPath);
|
|
653
|
+
}
|
|
654
|
+
logs.push(`已拷贝: ${sourcePath} -> ${targetPath}`);
|
|
655
|
+
const relativePath = `${projectName}/Resources/${targetFileName}`;
|
|
656
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, 'bundle', {
|
|
657
|
+
existsSync: deps.existsSync,
|
|
658
|
+
readFileSync: deps.readFileSync,
|
|
659
|
+
writeFileSync: deps.writeFileSync
|
|
660
|
+
});
|
|
661
|
+
if (addResult.success) {
|
|
662
|
+
logs.push(`已添加到 Xcode 项目: ${targetFileName}`);
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
logs.push(`警告: 添加到 Xcode 项目失败: ${addResult.error}`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (config.infoPlistModifications && config.infoPlistModifications.length > 0) {
|
|
670
|
+
logs.push('步骤 4: 修改 Info.plist');
|
|
671
|
+
const infoPlistPath = deps.join(projectPath, projectName, `${projectName}-Info.plist`);
|
|
672
|
+
if (deps.existsSync(infoPlistPath)) {
|
|
673
|
+
try {
|
|
674
|
+
const xmlContent = deps.readFileSync(infoPlistPath, 'utf8');
|
|
675
|
+
const parser = new deps.xmlParser();
|
|
676
|
+
const xmlDoc = parser.parseFromString(xmlContent, 'text/xml');
|
|
677
|
+
for (const modification of config.infoPlistModifications) {
|
|
678
|
+
switch (modification.action) {
|
|
679
|
+
case 'addKeyValue':
|
|
680
|
+
case 'modifyKeyValue':
|
|
681
|
+
if (modification.key && modification.value !== undefined) {
|
|
682
|
+
const valueType = typeof modification.value === 'boolean'
|
|
683
|
+
? (modification.value ? 'true' : 'false')
|
|
684
|
+
: 'string';
|
|
685
|
+
modifyInfoPlistKeyValue(xmlDoc, modification.key, modification.value, valueType);
|
|
686
|
+
logs.push(`已${modification.action === 'addKeyValue' ? '添加' : '修改'} Info.plist 键值: ${modification.key}`);
|
|
687
|
+
}
|
|
688
|
+
break;
|
|
689
|
+
case 'addURLScheme':
|
|
690
|
+
if (modification.urlScheme) {
|
|
691
|
+
addURLSchemeToInfoPlist(xmlDoc, modification.urlScheme);
|
|
692
|
+
logs.push(`已添加 URL Scheme: ${modification.urlScheme}`);
|
|
693
|
+
}
|
|
694
|
+
break;
|
|
695
|
+
case 'addAssociatedDomain':
|
|
696
|
+
if (modification.associatedDomain) {
|
|
697
|
+
const entitlementsPath = findEntitlementsFile(projectPath, projectName, {
|
|
698
|
+
existsSync: deps.existsSync,
|
|
699
|
+
join: deps.join,
|
|
700
|
+
readdirSync: deps.readdirSync,
|
|
701
|
+
basename: deps.basename,
|
|
702
|
+
statSync: deps.statSync
|
|
703
|
+
});
|
|
704
|
+
if (entitlementsPath) {
|
|
705
|
+
const success = addAssociatedDomainToEntitlements(entitlementsPath, modification.associatedDomain, {
|
|
706
|
+
existsSync: deps.existsSync,
|
|
707
|
+
readFileSync: deps.readFileSync,
|
|
708
|
+
writeFileSync: deps.writeFileSync,
|
|
709
|
+
xmlParser: deps.xmlParser,
|
|
710
|
+
xmlSerializer: deps.xmlSerializer
|
|
711
|
+
});
|
|
712
|
+
if (success) {
|
|
713
|
+
logs.push(`已添加 Associated Domain 到 entitlements 文件: ${modification.associatedDomain}`);
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
logs.push(`警告: 添加 Associated Domain 到 entitlements 文件失败: ${entitlementsPath}`);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
const defaultEntitlementsPath = deps.join(projectPath, projectName, `${projectName}.entitlements`);
|
|
721
|
+
const success = addAssociatedDomainToEntitlements(defaultEntitlementsPath, modification.associatedDomain, {
|
|
722
|
+
existsSync: deps.existsSync,
|
|
723
|
+
readFileSync: deps.readFileSync,
|
|
724
|
+
writeFileSync: deps.writeFileSync,
|
|
725
|
+
xmlParser: deps.xmlParser,
|
|
726
|
+
xmlSerializer: deps.xmlSerializer
|
|
727
|
+
});
|
|
728
|
+
if (success) {
|
|
729
|
+
logs.push(`已创建 entitlements 文件并添加 Associated Domain: ${defaultEntitlementsPath}`);
|
|
730
|
+
logs.push(`注意: 需要在 Xcode 中将 ${deps.basename(defaultEntitlementsPath)} 添加到项目的 Code Signing Entitlements 中`);
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
logs.push(`警告: 创建 entitlements 文件失败: ${defaultEntitlementsPath}`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
logs.push(`已添加 Associated Domain 到 Info.plist: ${modification.associatedDomain}`);
|
|
737
|
+
}
|
|
738
|
+
break;
|
|
739
|
+
case 'addLSApplicationQueriesSchemes':
|
|
740
|
+
if (modification.queriesScheme) {
|
|
741
|
+
addLSApplicationQueriesSchemesToInfoPlist(xmlDoc, modification.queriesScheme);
|
|
742
|
+
logs.push(`已添加 LSApplicationQueriesSchemes: ${modification.queriesScheme}`);
|
|
743
|
+
}
|
|
744
|
+
break;
|
|
745
|
+
case 'addDictKeyValue':
|
|
746
|
+
if (modification.key && modification.dictValue) {
|
|
747
|
+
addDictKeyValueToInfoPlist(xmlDoc, modification.key, modification.dictValue);
|
|
748
|
+
logs.push(`已添加 Info.plist 字典键值: ${modification.key}`);
|
|
749
|
+
}
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const serializer = new deps.xmlSerializer();
|
|
754
|
+
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
755
|
+
deps.writeFileSync(infoPlistPath, newXmlContent, 'utf8');
|
|
756
|
+
logs.push('Info.plist 修改完成');
|
|
757
|
+
}
|
|
758
|
+
catch (error) {
|
|
759
|
+
logs.push(`修改 Info.plist 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
logs.push(`警告: Info.plist 文件不存在: ${infoPlistPath}`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (config.appDelegateMethods && config.appDelegateMethods.length > 0) {
|
|
767
|
+
logs.push('步骤 5: 修改 AppDelegate.m');
|
|
768
|
+
const appDelegatePath = deps.join(projectPath, projectName, 'AppDelegate.m');
|
|
769
|
+
if (deps.existsSync(appDelegatePath)) {
|
|
770
|
+
try {
|
|
771
|
+
let appDelegateContent = deps.readFileSync(appDelegatePath, 'utf8');
|
|
772
|
+
for (const method of config.appDelegateMethods) {
|
|
773
|
+
const methodCodeTrimmed = method.code.trim();
|
|
774
|
+
if (appDelegateContent.includes(methodCodeTrimmed)) {
|
|
775
|
+
logs.push(`方法已存在(完整匹配),跳过: ${method.code.substring(0, 50)}...`);
|
|
776
|
+
continue;
|
|
777
|
+
}
|
|
778
|
+
const methodLines = methodCodeTrimmed.split('\n');
|
|
779
|
+
const implementationIndex = appDelegateContent.indexOf('@implementation');
|
|
780
|
+
if (implementationIndex !== -1) {
|
|
781
|
+
const implementationBlock = appDelegateContent.substring(implementationIndex);
|
|
782
|
+
let allMethodsExist = true;
|
|
783
|
+
const foundMethods = [];
|
|
784
|
+
for (const line of methodLines) {
|
|
785
|
+
const trimmedLine = line.trim();
|
|
786
|
+
const methodDefMatch = trimmedLine.match(/^[-+]\s*\([^)]+\)\s*(\w+):/);
|
|
787
|
+
if (methodDefMatch) {
|
|
788
|
+
const methodName = methodDefMatch[1];
|
|
789
|
+
const escapedLine = trimmedLine.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
790
|
+
const methodPattern = new RegExp(escapedLine.replace(/\s+/g, '\\s+'), 'm');
|
|
791
|
+
if (methodPattern.test(implementationBlock)) {
|
|
792
|
+
foundMethods.push(methodName);
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
allMethodsExist = false;
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (allMethodsExist && foundMethods.length > 0) {
|
|
801
|
+
logs.push(`方法已存在(${foundMethods.join(', ')}),跳过`);
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (method.position && method.referenceMethod) {
|
|
806
|
+
let referenceIndex = -1;
|
|
807
|
+
if (method.referenceMethod === '@end') {
|
|
808
|
+
const implementationIndex = appDelegateContent.indexOf('@implementation');
|
|
809
|
+
if (implementationIndex !== -1) {
|
|
810
|
+
const endAfterImplementation = appDelegateContent.indexOf('@end', implementationIndex);
|
|
811
|
+
if (endAfterImplementation !== -1) {
|
|
812
|
+
referenceIndex = endAfterImplementation;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (referenceIndex === -1) {
|
|
816
|
+
referenceIndex = appDelegateContent.lastIndexOf('@end');
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
referenceIndex = appDelegateContent.indexOf(method.referenceMethod);
|
|
821
|
+
}
|
|
822
|
+
if (referenceIndex !== -1) {
|
|
823
|
+
if (method.position === 'before') {
|
|
824
|
+
appDelegateContent = appDelegateContent.slice(0, referenceIndex) +
|
|
825
|
+
method.code + '\n\n' +
|
|
826
|
+
appDelegateContent.slice(referenceIndex);
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
if (method.referenceMethod === '@end') {
|
|
830
|
+
appDelegateContent = appDelegateContent.slice(0, referenceIndex) +
|
|
831
|
+
'\n' + method.code + '\n' +
|
|
832
|
+
appDelegateContent.slice(referenceIndex);
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
const methodEnd = appDelegateContent.indexOf('}', referenceIndex);
|
|
836
|
+
if (methodEnd !== -1) {
|
|
837
|
+
appDelegateContent = appDelegateContent.slice(0, methodEnd + 1) +
|
|
838
|
+
'\n\n' + method.code + '\n' +
|
|
839
|
+
appDelegateContent.slice(methodEnd + 1);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
appDelegateContent += '\n\n' + method.code;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
appDelegateContent += '\n\n' + method.code;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
appDelegateContent += '\n\n' + method.code;
|
|
853
|
+
}
|
|
854
|
+
logs.push(`已添加 AppDelegate 方法`);
|
|
855
|
+
}
|
|
856
|
+
deps.writeFileSync(appDelegatePath, appDelegateContent, 'utf8');
|
|
857
|
+
logs.push('AppDelegate.m 修改完成');
|
|
858
|
+
}
|
|
859
|
+
catch (error) {
|
|
860
|
+
logs.push(`修改 AppDelegate.m 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
logs.push(`警告: AppDelegate.m 文件不存在: ${appDelegatePath}`);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
logs.push(`第三方模块集成完成: ${config.name}`);
|
|
868
|
+
logs.push('注意: 部分配置(如添加框架到 Xcode 项目)需要手动完成');
|
|
869
|
+
return {
|
|
870
|
+
success: true,
|
|
871
|
+
message: `成功集成第三方模块: ${config.name}`,
|
|
872
|
+
logs
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
catch (error) {
|
|
876
|
+
return {
|
|
877
|
+
success: false,
|
|
878
|
+
error: `集成第三方模块失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
879
|
+
logs
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
//# sourceMappingURL=integrateThirdPartyModule.js.map
|