zcw-shared 1.46.1 → 1.47.0
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/android/integrateUniAppNativePlugin.js +36 -8
- package/dist/functions/android/integrateUniAppNativePlugin.js.map +1 -1
- 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 +93 -0
- package/dist/functions/ios/integrateCameraGallery.js.map +1 -0
- package/dist/functions/ios/integrateNativePlugin.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,994 @@
|
|
|
1
|
+
import { addFileToXcodeProject, addFileToEmbedFrameworks, } from "./integrateThirdPartyModule";
|
|
2
|
+
async function extractPlugin(pluginPath, extractDir, deps) {
|
|
3
|
+
try {
|
|
4
|
+
if (deps.existsSync(pluginPath)) {
|
|
5
|
+
const stat = deps.statSync(pluginPath);
|
|
6
|
+
if (stat.isDirectory()) {
|
|
7
|
+
deps.log?.("插件是目录,直接使用");
|
|
8
|
+
return {
|
|
9
|
+
success: true,
|
|
10
|
+
extractedPath: pluginPath,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (pluginPath.endsWith(".zip")) {
|
|
15
|
+
const pluginName = deps.basename(pluginPath, ".zip");
|
|
16
|
+
const targetDir = deps.join(extractDir, pluginName);
|
|
17
|
+
if (deps.existsSync(targetDir)) {
|
|
18
|
+
deps.log?.(`插件已解压过,使用现有目录: ${targetDir}`);
|
|
19
|
+
return {
|
|
20
|
+
success: true,
|
|
21
|
+
extractedPath: targetDir,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (!deps.existsSync(extractDir)) {
|
|
25
|
+
deps.mkdirSync(extractDir, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
deps.log?.(`开始解压插件: ${pluginPath}`);
|
|
28
|
+
deps.log?.(`解压到目录: ${extractDir}`);
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
let resolved = false;
|
|
31
|
+
let timeoutId;
|
|
32
|
+
const child = deps.exec(`unzip -q "${pluginPath}" -d "${extractDir}"`, (error, stdout, stderr) => {
|
|
33
|
+
if (resolved)
|
|
34
|
+
return;
|
|
35
|
+
resolved = true;
|
|
36
|
+
if (timeoutId !== undefined) {
|
|
37
|
+
deps.clearTimeout(timeoutId);
|
|
38
|
+
}
|
|
39
|
+
if (error) {
|
|
40
|
+
deps.log?.(`解压失败: ${error.message}`);
|
|
41
|
+
if (stderr)
|
|
42
|
+
deps.log?.(`错误输出: ${stderr}`);
|
|
43
|
+
resolve({
|
|
44
|
+
success: false,
|
|
45
|
+
error: `解压插件失败: ${error.message}`,
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
deps.log?.("解压完成,查找解压后的目录...");
|
|
50
|
+
const files = deps.readdirSync(extractDir);
|
|
51
|
+
if (files.length === 0) {
|
|
52
|
+
deps.log?.("解压后未找到任何文件");
|
|
53
|
+
resolve({
|
|
54
|
+
success: false,
|
|
55
|
+
error: "解压后未找到插件文件",
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const extractedPath = deps.join(extractDir, files[0]);
|
|
60
|
+
deps.log?.(`找到解压后的目录: ${extractedPath}`);
|
|
61
|
+
resolve({
|
|
62
|
+
success: true,
|
|
63
|
+
extractedPath,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
timeoutId = deps.setTimeout(() => {
|
|
67
|
+
if (resolved)
|
|
68
|
+
return;
|
|
69
|
+
resolved = true;
|
|
70
|
+
child.kill();
|
|
71
|
+
deps.log?.("解压超时(30秒)");
|
|
72
|
+
resolve({
|
|
73
|
+
success: false,
|
|
74
|
+
error: "解压插件超时",
|
|
75
|
+
});
|
|
76
|
+
}, 30000);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: `不支持的插件格式: ${pluginPath}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
error: `解压插件异常: ${error instanceof Error ? error.message : String(error)}`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function readPluginPackageJson(pluginDir, deps) {
|
|
92
|
+
try {
|
|
93
|
+
const packageJsonPath = deps.join(pluginDir, "package.json");
|
|
94
|
+
if (!deps.existsSync(packageJsonPath)) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
error: `插件 package.json 不存在: ${packageJsonPath}`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const content = deps.readFileSync(packageJsonPath, "utf8");
|
|
101
|
+
const packageJson = deps.parse(content);
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
packageJson,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return {
|
|
109
|
+
success: false,
|
|
110
|
+
error: `读取插件 package.json 失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function extractIOSPluginConfig(packageJson) {
|
|
115
|
+
try {
|
|
116
|
+
const iosConfig = packageJson._dp_nativeplugin?.ios;
|
|
117
|
+
if (!iosConfig) {
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: "package.json 中未找到 _dp_nativeplugin.ios 配置",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const plugins = iosConfig.plugins;
|
|
124
|
+
if (!plugins || !Array.isArray(plugins) || plugins.length === 0) {
|
|
125
|
+
return {
|
|
126
|
+
success: false,
|
|
127
|
+
error: "package.json 中未找到有效的 plugins 配置",
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const pluginItems = [];
|
|
131
|
+
for (const plugin of plugins) {
|
|
132
|
+
if (plugin.type && plugin.name && plugin.class) {
|
|
133
|
+
pluginItems.push({
|
|
134
|
+
type: plugin.type,
|
|
135
|
+
name: plugin.name,
|
|
136
|
+
class: plugin.class,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (pluginItems.length === 0) {
|
|
141
|
+
return {
|
|
142
|
+
success: false,
|
|
143
|
+
error: "package.json 中未找到有效的插件配置",
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const hooksClass = iosConfig.hooksClass || "";
|
|
147
|
+
const frameworks = iosConfig.frameworks || [];
|
|
148
|
+
const embedFrameworks = iosConfig.embedFrameworks || [];
|
|
149
|
+
const resources = iosConfig.resources || [];
|
|
150
|
+
const privacies = iosConfig.privacies || [];
|
|
151
|
+
let parameters = undefined;
|
|
152
|
+
if (iosConfig.parameters && typeof iosConfig.parameters === "object") {
|
|
153
|
+
parameters = {};
|
|
154
|
+
for (const [paramName, paramConfig] of Object.entries(iosConfig.parameters)) {
|
|
155
|
+
if (paramConfig &&
|
|
156
|
+
typeof paramConfig === "object" &&
|
|
157
|
+
"key" in paramConfig) {
|
|
158
|
+
parameters[paramName] = {
|
|
159
|
+
key: paramConfig.key,
|
|
160
|
+
des: paramConfig.des || "",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
success: true,
|
|
167
|
+
plugins: pluginItems,
|
|
168
|
+
hooksClass,
|
|
169
|
+
frameworks,
|
|
170
|
+
embedFrameworks,
|
|
171
|
+
resources,
|
|
172
|
+
privacies,
|
|
173
|
+
parameters,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
success: false,
|
|
179
|
+
error: `提取插件配置失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function addPluginToInfoPlist(xmlDoc, pluginItems, hooksClass) {
|
|
184
|
+
const dictElement = xmlDoc.getElementsByTagName("dict")[0];
|
|
185
|
+
if (!dictElement)
|
|
186
|
+
return false;
|
|
187
|
+
let unipluginsKey = null;
|
|
188
|
+
let unipluginsArray = null;
|
|
189
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
190
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
191
|
+
const node = childNodes[i];
|
|
192
|
+
if (node.nodeName === "key" && node.textContent === "dcloud_uniplugins") {
|
|
193
|
+
unipluginsKey = node;
|
|
194
|
+
if (i + 1 < childNodes.length && childNodes[i + 1].nodeName === "array") {
|
|
195
|
+
unipluginsArray = childNodes[i + 1];
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (!unipluginsArray) {
|
|
201
|
+
if (!unipluginsKey) {
|
|
202
|
+
unipluginsKey = xmlDoc.createElement("key");
|
|
203
|
+
unipluginsKey.textContent = "dcloud_uniplugins";
|
|
204
|
+
dictElement.appendChild(unipluginsKey);
|
|
205
|
+
}
|
|
206
|
+
unipluginsArray = xmlDoc.createElement("array");
|
|
207
|
+
dictElement.appendChild(unipluginsArray);
|
|
208
|
+
}
|
|
209
|
+
const pluginDict = xmlDoc.createElement("dict");
|
|
210
|
+
const hooksClassKey = xmlDoc.createElement("key");
|
|
211
|
+
hooksClassKey.textContent = "hooksClass";
|
|
212
|
+
const hooksClassValue = xmlDoc.createElement("string");
|
|
213
|
+
hooksClassValue.textContent = hooksClass;
|
|
214
|
+
pluginDict.appendChild(hooksClassKey);
|
|
215
|
+
pluginDict.appendChild(hooksClassValue);
|
|
216
|
+
const pluginsKey = xmlDoc.createElement("key");
|
|
217
|
+
pluginsKey.textContent = "plugins";
|
|
218
|
+
const pluginsArray = xmlDoc.createElement("array");
|
|
219
|
+
for (const plugin of pluginItems) {
|
|
220
|
+
const itemDict = xmlDoc.createElement("dict");
|
|
221
|
+
const typeKey = xmlDoc.createElement("key");
|
|
222
|
+
typeKey.textContent = "type";
|
|
223
|
+
const typeValue = xmlDoc.createElement("string");
|
|
224
|
+
typeValue.textContent = plugin.type;
|
|
225
|
+
itemDict.appendChild(typeKey);
|
|
226
|
+
itemDict.appendChild(typeValue);
|
|
227
|
+
const nameKey = xmlDoc.createElement("key");
|
|
228
|
+
nameKey.textContent = "name";
|
|
229
|
+
const nameValue = xmlDoc.createElement("string");
|
|
230
|
+
nameValue.textContent = plugin.name;
|
|
231
|
+
itemDict.appendChild(nameKey);
|
|
232
|
+
itemDict.appendChild(nameValue);
|
|
233
|
+
const classKey = xmlDoc.createElement("key");
|
|
234
|
+
classKey.textContent = "class";
|
|
235
|
+
const classValue = xmlDoc.createElement("string");
|
|
236
|
+
classValue.textContent = plugin.class;
|
|
237
|
+
itemDict.appendChild(classKey);
|
|
238
|
+
itemDict.appendChild(classValue);
|
|
239
|
+
pluginsArray.appendChild(itemDict);
|
|
240
|
+
}
|
|
241
|
+
pluginDict.appendChild(pluginsKey);
|
|
242
|
+
pluginDict.appendChild(pluginsArray);
|
|
243
|
+
unipluginsArray.appendChild(pluginDict);
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
function addPluginParametersToInfoPlist(xmlDoc, parameters, parameterValues) {
|
|
247
|
+
const dictElement = xmlDoc.getElementsByTagName("dict")[0];
|
|
248
|
+
if (!dictElement)
|
|
249
|
+
return false;
|
|
250
|
+
for (const [paramName, paramConfig] of Object.entries(parameters)) {
|
|
251
|
+
const value = parameterValues[paramName];
|
|
252
|
+
if (!value)
|
|
253
|
+
continue;
|
|
254
|
+
const key = paramConfig.key;
|
|
255
|
+
const keys = key.split(":");
|
|
256
|
+
if (keys.length === 1) {
|
|
257
|
+
const keyElement = xmlDoc.createElement("key");
|
|
258
|
+
keyElement.textContent = keys[0];
|
|
259
|
+
const valueElement = xmlDoc.createElement("string");
|
|
260
|
+
valueElement.textContent = value;
|
|
261
|
+
dictElement.appendChild(keyElement);
|
|
262
|
+
dictElement.appendChild(valueElement);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const parentKey = keys[0];
|
|
266
|
+
const childKey = keys[1];
|
|
267
|
+
let parentDict = null;
|
|
268
|
+
const childNodes = Array.from(dictElement.childNodes || []).filter((node) => node.nodeType === 1);
|
|
269
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
270
|
+
const node = childNodes[i];
|
|
271
|
+
if (node.nodeName === "key" && node.textContent === parentKey) {
|
|
272
|
+
if (i + 1 < childNodes.length &&
|
|
273
|
+
childNodes[i + 1].nodeName === "dict") {
|
|
274
|
+
parentDict = childNodes[i + 1];
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (!parentDict) {
|
|
280
|
+
const parentKeyElement = xmlDoc.createElement("key");
|
|
281
|
+
parentKeyElement.textContent = parentKey;
|
|
282
|
+
parentDict = xmlDoc.createElement("dict");
|
|
283
|
+
dictElement.appendChild(parentKeyElement);
|
|
284
|
+
dictElement.appendChild(parentDict);
|
|
285
|
+
}
|
|
286
|
+
const childKeyElement = xmlDoc.createElement("key");
|
|
287
|
+
childKeyElement.textContent = childKey;
|
|
288
|
+
const childValueElement = xmlDoc.createElement("string");
|
|
289
|
+
childValueElement.textContent = value;
|
|
290
|
+
parentDict.appendChild(childKeyElement);
|
|
291
|
+
parentDict.appendChild(childValueElement);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
function addPrivaciesToInfoPlist(xmlDoc, privacies) {
|
|
297
|
+
const dictElement = xmlDoc.getElementsByTagName("dict")[0];
|
|
298
|
+
if (!dictElement)
|
|
299
|
+
return false;
|
|
300
|
+
for (const privacy of privacies) {
|
|
301
|
+
const keyElements = xmlDoc.getElementsByTagName("key");
|
|
302
|
+
let found = false;
|
|
303
|
+
for (let i = 0; i < keyElements.length; i++) {
|
|
304
|
+
const keyElement = keyElements[i];
|
|
305
|
+
if (keyElement.textContent === privacy) {
|
|
306
|
+
found = true;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (!found) {
|
|
311
|
+
const keyElement = xmlDoc.createElement("key");
|
|
312
|
+
keyElement.textContent = privacy;
|
|
313
|
+
const valueElement = xmlDoc.createElement("string");
|
|
314
|
+
valueElement.textContent = "应用需要使用此功能";
|
|
315
|
+
dictElement.appendChild(keyElement);
|
|
316
|
+
dictElement.appendChild(valueElement);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
function findFilesRecursive(dir, extensions, deps, depth = 0) {
|
|
322
|
+
const result = [];
|
|
323
|
+
const maxDepth = 10;
|
|
324
|
+
if (!deps.existsSync(dir)) {
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
const bundleExtensions = [".framework", ".xcframework", ".app", ".bundle"];
|
|
328
|
+
if (depth > maxDepth) {
|
|
329
|
+
return result;
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
const files = deps.readdirSync(dir);
|
|
333
|
+
for (const file of files) {
|
|
334
|
+
const filePath = deps.join(dir, file);
|
|
335
|
+
try {
|
|
336
|
+
const stat = deps.statSync(filePath);
|
|
337
|
+
if (stat.isDirectory()) {
|
|
338
|
+
let matchesExtension = false;
|
|
339
|
+
let isBundle = false;
|
|
340
|
+
for (const ext of extensions) {
|
|
341
|
+
if (file.endsWith(ext)) {
|
|
342
|
+
matchesExtension = true;
|
|
343
|
+
isBundle = bundleExtensions.includes(ext);
|
|
344
|
+
result.push(filePath);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (!matchesExtension || !isBundle) {
|
|
349
|
+
if (!matchesExtension) {
|
|
350
|
+
result.push(...findFilesRecursive(filePath, extensions, deps, depth + 1));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
for (const ext of extensions) {
|
|
356
|
+
if (file.endsWith(ext)) {
|
|
357
|
+
result.push(filePath);
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
}
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
async function copyFrameworkUsingArchive(sourcePath, targetPath, deps, logFn) {
|
|
373
|
+
const log = (msg) => {
|
|
374
|
+
const message = `[copyFramework] ${msg}`;
|
|
375
|
+
if (logFn)
|
|
376
|
+
logFn(message);
|
|
377
|
+
};
|
|
378
|
+
try {
|
|
379
|
+
log(`开始复制 framework: ${deps.basename(sourcePath)}`);
|
|
380
|
+
log(` 源路径: ${sourcePath}`);
|
|
381
|
+
log(` 目标路径: ${targetPath}`);
|
|
382
|
+
const targetDir = deps.dirname(targetPath);
|
|
383
|
+
const tempDir = deps.join(targetDir, ".temp_framework_copy");
|
|
384
|
+
log(` 临时目录: ${tempDir}`);
|
|
385
|
+
if (deps.existsSync(tempDir)) {
|
|
386
|
+
log(` 清理已存在的临时目录...`);
|
|
387
|
+
await new Promise((resolve) => {
|
|
388
|
+
deps.exec(`rm -rf "${tempDir}"`, (error) => {
|
|
389
|
+
if (error) {
|
|
390
|
+
log(` 警告: 清理临时目录失败: ${error.message}`);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
log(` 临时目录已清理`);
|
|
394
|
+
}
|
|
395
|
+
resolve();
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
if (!deps.existsSync(tempDir)) {
|
|
400
|
+
log(` 创建临时目录...`);
|
|
401
|
+
deps.mkdirSync(tempDir, { recursive: true });
|
|
402
|
+
}
|
|
403
|
+
const frameworkName = deps.basename(sourcePath);
|
|
404
|
+
const archiveName = `${frameworkName}.tar.gz`;
|
|
405
|
+
const archivePath = deps.join(tempDir, archiveName);
|
|
406
|
+
log(` 压缩文件路径: ${archivePath}`);
|
|
407
|
+
const sourceDir = deps.dirname(sourcePath);
|
|
408
|
+
const sourceName = deps.basename(sourcePath);
|
|
409
|
+
log(` 开始压缩: ${sourceDir}/${sourceName} -> ${archivePath}`);
|
|
410
|
+
return new Promise((resolve) => {
|
|
411
|
+
const startTime = Date.now();
|
|
412
|
+
deps.exec(`cd "${sourceDir}" && tar -czf "${archivePath}" "${sourceName}"`, (error, stdout, stderr) => {
|
|
413
|
+
const compressTime = Date.now() - startTime;
|
|
414
|
+
log(` 压缩完成 (耗时: ${compressTime}ms)`);
|
|
415
|
+
if (error) {
|
|
416
|
+
log(` 压缩失败: ${error.message}`);
|
|
417
|
+
if (stderr)
|
|
418
|
+
log(` stderr: ${stderr}`);
|
|
419
|
+
resolve({
|
|
420
|
+
success: false,
|
|
421
|
+
error: `压缩 framework 失败: ${error.message}`,
|
|
422
|
+
});
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const targetArchivePath = deps.join(targetDir, archiveName);
|
|
426
|
+
log(` 开始复制压缩文件: ${archivePath} -> ${targetArchivePath}`);
|
|
427
|
+
const copyStartTime = Date.now();
|
|
428
|
+
try {
|
|
429
|
+
deps.copyFileSync(archivePath, targetArchivePath);
|
|
430
|
+
const copyTime = Date.now() - copyStartTime;
|
|
431
|
+
log(` 复制压缩文件完成 (耗时: ${copyTime}ms)`);
|
|
432
|
+
}
|
|
433
|
+
catch (copyError) {
|
|
434
|
+
log(` 复制压缩文件失败: ${copyError.message || String(copyError)}`);
|
|
435
|
+
resolve({
|
|
436
|
+
success: false,
|
|
437
|
+
error: `复制压缩文件失败: ${copyError.message || String(copyError)}`,
|
|
438
|
+
});
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
log(` 开始解压: ${targetArchivePath} -> ${targetDir}`);
|
|
442
|
+
const extractStartTime = Date.now();
|
|
443
|
+
deps.exec(`cd "${targetDir}" && tar -xzf "${targetArchivePath}" && rm -f "${targetArchivePath}"`, (extractError, extractStdout, extractStderr) => {
|
|
444
|
+
const extractTime = Date.now() - extractStartTime;
|
|
445
|
+
log(` 解压完成 (耗时: ${extractTime}ms)`);
|
|
446
|
+
try {
|
|
447
|
+
if (deps.existsSync(archivePath)) {
|
|
448
|
+
deps.exec(`rm -f "${archivePath}"`, () => { });
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
catch { }
|
|
452
|
+
if (extractError) {
|
|
453
|
+
log(` 解压失败: ${extractError.message}`);
|
|
454
|
+
if (extractStderr)
|
|
455
|
+
log(` stderr: ${extractStderr}`);
|
|
456
|
+
resolve({
|
|
457
|
+
success: false,
|
|
458
|
+
error: `解压 framework 失败: ${extractError.message}`,
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
const totalTime = Date.now() - startTime;
|
|
463
|
+
log(` framework 复制成功 (总耗时: ${totalTime}ms)`);
|
|
464
|
+
resolve({ success: true });
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
log(` 复制 framework 异常: ${error.message || String(error)}`);
|
|
472
|
+
return {
|
|
473
|
+
success: false,
|
|
474
|
+
error: `复制 framework 失败: ${error.message || String(error)}`,
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
export async function integrateNativePluginIOS(projectPath, projectName, pluginPath, deps, parameters) {
|
|
479
|
+
try {
|
|
480
|
+
deps.log?.(`开始集成 UniApp 原生插件: ${pluginPath}`);
|
|
481
|
+
deps.log?.("步骤 1: 解压插件");
|
|
482
|
+
const tempDir = deps.join(projectPath, ".temp");
|
|
483
|
+
if (deps.existsSync(tempDir)) {
|
|
484
|
+
deps.log?.("清理已存在的临时目录...");
|
|
485
|
+
await new Promise((resolve) => {
|
|
486
|
+
deps.exec(`rm -rf "${tempDir}"`, (error) => {
|
|
487
|
+
if (error) {
|
|
488
|
+
deps.log?.(`警告: 清理临时目录失败: ${error.message}`);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
deps.log?.("临时目录已清理");
|
|
492
|
+
}
|
|
493
|
+
resolve();
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
if (!deps.existsSync(tempDir)) {
|
|
498
|
+
deps.mkdirSync(tempDir, { recursive: true });
|
|
499
|
+
deps.log?.("已创建临时目录");
|
|
500
|
+
}
|
|
501
|
+
const extractResult = await extractPlugin(pluginPath, tempDir, {
|
|
502
|
+
existsSync: deps.existsSync,
|
|
503
|
+
readdirSync: deps.readdirSync,
|
|
504
|
+
statSync: deps.statSync,
|
|
505
|
+
join: deps.join,
|
|
506
|
+
exec: deps.exec,
|
|
507
|
+
basename: deps.basename,
|
|
508
|
+
dirname: deps.dirname,
|
|
509
|
+
mkdirSync: deps.mkdirSync,
|
|
510
|
+
log: deps.log,
|
|
511
|
+
setTimeout: deps.setTimeout,
|
|
512
|
+
clearTimeout: deps.clearTimeout,
|
|
513
|
+
});
|
|
514
|
+
if (!extractResult.success) {
|
|
515
|
+
return {
|
|
516
|
+
success: false,
|
|
517
|
+
error: extractResult.error,
|
|
518
|
+
logs: [],
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
const pluginDir = extractResult.extractedPath;
|
|
522
|
+
deps.log?.(`插件已解压到: ${pluginDir}`);
|
|
523
|
+
deps.log?.("步骤 2: 读取插件配置");
|
|
524
|
+
const packageJsonResult = readPluginPackageJson(pluginDir, {
|
|
525
|
+
existsSync: deps.existsSync,
|
|
526
|
+
readFileSync: deps.readFileSync,
|
|
527
|
+
join: deps.join,
|
|
528
|
+
parse: deps.parse,
|
|
529
|
+
});
|
|
530
|
+
if (!packageJsonResult.success) {
|
|
531
|
+
return {
|
|
532
|
+
success: false,
|
|
533
|
+
error: packageJsonResult.error,
|
|
534
|
+
logs: [],
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
const packageJson = packageJsonResult.packageJson;
|
|
538
|
+
deps.log?.(`插件名称: ${packageJson.name}`);
|
|
539
|
+
deps.log?.(`插件 ID: ${packageJson.id}`);
|
|
540
|
+
deps.log?.(`插件版本: ${packageJson.version}`);
|
|
541
|
+
deps.log?.("步骤 3: 提取 iOS 插件配置");
|
|
542
|
+
const configResult = extractIOSPluginConfig(packageJson);
|
|
543
|
+
if (!configResult.success) {
|
|
544
|
+
return {
|
|
545
|
+
success: false,
|
|
546
|
+
error: configResult.error,
|
|
547
|
+
logs: [],
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
const { plugins: pluginItems, hooksClass, frameworks, embedFrameworks, resources, privacies, parameters: pluginParameters, } = configResult;
|
|
551
|
+
deps.log?.(`找到 ${pluginItems.length} 个插件`);
|
|
552
|
+
if (hooksClass) {
|
|
553
|
+
deps.log?.(`Hooks 类: ${hooksClass}`);
|
|
554
|
+
}
|
|
555
|
+
deps.log?.("步骤 4: 复制插件文件");
|
|
556
|
+
const iosDir = deps.join(pluginDir, "ios");
|
|
557
|
+
deps.log?.(` iosDir: ${iosDir}`);
|
|
558
|
+
deps.log?.(` iosDir 存在: ${deps.existsSync(iosDir)}`);
|
|
559
|
+
if (!deps.existsSync(iosDir)) {
|
|
560
|
+
return {
|
|
561
|
+
success: false,
|
|
562
|
+
error: `插件 ios 目录不存在: ${iosDir}`,
|
|
563
|
+
logs: [],
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
deps.log?.("步骤 4.1: 查找静态库 (.a)");
|
|
567
|
+
const findLibStartTime = Date.now();
|
|
568
|
+
const staticLibs = findFilesRecursive(iosDir, [".a"], deps);
|
|
569
|
+
const findLibTime = Date.now() - findLibStartTime;
|
|
570
|
+
deps.log?.(` 找到 ${staticLibs.length} 个静态库 (查找耗时: ${findLibTime}ms)`);
|
|
571
|
+
const libsDir = deps.join(projectPath, "libs");
|
|
572
|
+
if (!deps.existsSync(libsDir)) {
|
|
573
|
+
deps.mkdirSync(libsDir, { recursive: true });
|
|
574
|
+
}
|
|
575
|
+
for (const libPath of staticLibs) {
|
|
576
|
+
const libName = deps.basename(libPath);
|
|
577
|
+
const targetPath = deps.join(libsDir, libName);
|
|
578
|
+
deps.copyFileSync(libPath, targetPath);
|
|
579
|
+
deps.log?.(`已复制静态库: ${libName}`);
|
|
580
|
+
}
|
|
581
|
+
deps.log?.("步骤 4.2: 查找 framework");
|
|
582
|
+
deps.log?.(` 搜索目录: ${iosDir}`);
|
|
583
|
+
const findFrameworkStartTime = Date.now();
|
|
584
|
+
const allFrameworks = findFilesRecursive(iosDir, [".framework"], deps);
|
|
585
|
+
const findFrameworkTime = Date.now() - findFrameworkStartTime;
|
|
586
|
+
deps.log?.(`找到 ${allFrameworks.length} 个 framework (查找耗时: ${findFrameworkTime}ms)`);
|
|
587
|
+
const frameworksDir = deps.join(projectPath, "Frameworks");
|
|
588
|
+
if (!deps.existsSync(frameworksDir)) {
|
|
589
|
+
deps.mkdirSync(frameworksDir, { recursive: true });
|
|
590
|
+
}
|
|
591
|
+
for (const frameworkPath of allFrameworks) {
|
|
592
|
+
const frameworkName = deps.basename(frameworkPath);
|
|
593
|
+
deps.log?.(`开始复制 framework: ${frameworkName}`);
|
|
594
|
+
const targetPath = deps.join(frameworksDir, frameworkName);
|
|
595
|
+
const copyResult = await copyFrameworkUsingArchive(frameworkPath, targetPath, {
|
|
596
|
+
existsSync: deps.existsSync,
|
|
597
|
+
readdirSync: deps.readdirSync,
|
|
598
|
+
join: deps.join,
|
|
599
|
+
dirname: deps.dirname,
|
|
600
|
+
exec: deps.exec,
|
|
601
|
+
basename: deps.basename,
|
|
602
|
+
mkdirSync: deps.mkdirSync,
|
|
603
|
+
copyFileSync: deps.copyFileSync,
|
|
604
|
+
}, deps.log);
|
|
605
|
+
if (copyResult.success) {
|
|
606
|
+
deps.log?.(`已复制 framework: ${frameworkName}`);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
deps.log?.(`警告: 复制 framework 失败 (${frameworkName}): ${copyResult.error}`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
deps.log?.("步骤 4.4: 查找 xcframework");
|
|
613
|
+
const findXcframeworkStartTime = Date.now();
|
|
614
|
+
const xcframeworks = findFilesRecursive(iosDir, [".xcframework"], deps);
|
|
615
|
+
const findXcframeworkTime = Date.now() - findXcframeworkStartTime;
|
|
616
|
+
deps.log?.(` 找到 ${xcframeworks.length} 个 xcframework (查找耗时: ${findXcframeworkTime}ms)`);
|
|
617
|
+
for (const xcframeworkPath of xcframeworks) {
|
|
618
|
+
const xcframeworkName = deps.basename(xcframeworkPath);
|
|
619
|
+
const targetPath = deps.join(frameworksDir, xcframeworkName);
|
|
620
|
+
deps.log?.(`开始复制 xcframework: ${xcframeworkName}`);
|
|
621
|
+
const copyResult = await copyFrameworkUsingArchive(xcframeworkPath, targetPath, {
|
|
622
|
+
existsSync: deps.existsSync,
|
|
623
|
+
readdirSync: deps.readdirSync,
|
|
624
|
+
join: deps.join,
|
|
625
|
+
dirname: deps.dirname,
|
|
626
|
+
exec: deps.exec,
|
|
627
|
+
basename: deps.basename,
|
|
628
|
+
mkdirSync: deps.mkdirSync,
|
|
629
|
+
copyFileSync: deps.copyFileSync,
|
|
630
|
+
}, deps.log);
|
|
631
|
+
if (copyResult.success) {
|
|
632
|
+
deps.log?.(`已复制 xcframework: ${xcframeworkName}`);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
deps.log?.(`警告: 复制 xcframework 失败 (${xcframeworkName}): ${copyResult.error}`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
deps.log?.("步骤 4.5: 复制资源文件");
|
|
639
|
+
if (resources && resources.length > 0) {
|
|
640
|
+
const resourcesTargetDir = deps.join(projectPath, projectName, "Resources");
|
|
641
|
+
if (!deps.existsSync(resourcesTargetDir)) {
|
|
642
|
+
deps.mkdirSync(resourcesTargetDir, { recursive: true });
|
|
643
|
+
}
|
|
644
|
+
for (const resourcePath of resources) {
|
|
645
|
+
const sourcePath = deps.join(iosDir, resourcePath);
|
|
646
|
+
if (deps.existsSync(sourcePath)) {
|
|
647
|
+
const resourceName = deps.basename(resourcePath);
|
|
648
|
+
const targetPath = deps.join(resourcesTargetDir, resourceName);
|
|
649
|
+
const stat = deps.statSync(sourcePath);
|
|
650
|
+
if (stat.isDirectory()) {
|
|
651
|
+
await deps.cp(sourcePath, targetPath, {
|
|
652
|
+
recursive: true,
|
|
653
|
+
force: true,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
deps.copyFileSync(sourcePath, targetPath);
|
|
658
|
+
}
|
|
659
|
+
deps.log?.(`已复制资源文件: ${resourceName}`);
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
deps.log?.(`警告: 资源文件不存在: ${sourcePath}`);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
deps.log?.("步骤 4.6: 查找头文件 (.h)");
|
|
667
|
+
const findHeaderStartTime = Date.now();
|
|
668
|
+
const headers = findFilesRecursive(iosDir, [".h"], deps);
|
|
669
|
+
const findHeaderTime = Date.now() - findHeaderStartTime;
|
|
670
|
+
deps.log?.(` 找到 ${headers.length} 个头文件 (查找耗时: ${findHeaderTime}ms)`);
|
|
671
|
+
const headersDir = deps.join(projectPath, projectName, "NativePlugins");
|
|
672
|
+
if (headers.length > 0) {
|
|
673
|
+
if (!deps.existsSync(headersDir)) {
|
|
674
|
+
deps.mkdirSync(headersDir, { recursive: true });
|
|
675
|
+
}
|
|
676
|
+
for (const headerPath of headers) {
|
|
677
|
+
const headerName = deps.basename(headerPath);
|
|
678
|
+
const targetPath = deps.join(headersDir, headerName);
|
|
679
|
+
deps.copyFileSync(headerPath, targetPath);
|
|
680
|
+
deps.log?.(`已复制头文件: ${headerName}`);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
deps.log?.("步骤 5: 修改 Info.plist");
|
|
684
|
+
const infoPlistPath = deps.join(projectPath, projectName, `${projectName}-Info.plist`);
|
|
685
|
+
if (deps.existsSync(infoPlistPath)) {
|
|
686
|
+
try {
|
|
687
|
+
const xmlContent = deps.readFileSync(infoPlistPath, "utf8");
|
|
688
|
+
const parser = new deps.xmlParser();
|
|
689
|
+
const xmlDoc = parser.parseFromString(xmlContent, "text/xml");
|
|
690
|
+
addPluginToInfoPlist(xmlDoc, pluginItems, hooksClass || "");
|
|
691
|
+
deps.log?.("已添加插件信息到 dcloud_uniplugins");
|
|
692
|
+
if (privacies && privacies.length > 0) {
|
|
693
|
+
addPrivaciesToInfoPlist(xmlDoc, privacies);
|
|
694
|
+
deps.log?.(`已添加 ${privacies.length} 个隐私权限描述`);
|
|
695
|
+
}
|
|
696
|
+
if (pluginParameters && parameters) {
|
|
697
|
+
addPluginParametersToInfoPlist(xmlDoc, pluginParameters, parameters);
|
|
698
|
+
deps.log?.("已添加插件参数配置");
|
|
699
|
+
}
|
|
700
|
+
const serializer = new deps.xmlSerializer();
|
|
701
|
+
const newXmlContent = serializer.serializeToString(xmlDoc);
|
|
702
|
+
deps.writeFileSync(infoPlistPath, newXmlContent, "utf8");
|
|
703
|
+
deps.log?.("Info.plist 修改完成");
|
|
704
|
+
}
|
|
705
|
+
catch (error) {
|
|
706
|
+
deps.log?.(`修改 Info.plist 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
deps.log?.("步骤 6: 添加文件到 Xcode 项目");
|
|
710
|
+
const projectFiles = deps
|
|
711
|
+
.readdirSync(projectPath)
|
|
712
|
+
.filter((file) => file.endsWith(".xcodeproj"));
|
|
713
|
+
if (projectFiles.length === 0) {
|
|
714
|
+
deps.log?.("警告: 未找到 .xcodeproj 文件,跳过 Xcode 项目配置");
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
const projectFile = projectFiles[0];
|
|
718
|
+
const projectPbxprojPath = deps.join(projectPath, projectFile, "project.pbxproj");
|
|
719
|
+
for (const libPath of staticLibs) {
|
|
720
|
+
const libName = deps.basename(libPath);
|
|
721
|
+
const relativePath = `libs/${libName}`;
|
|
722
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, "staticLibrary", {
|
|
723
|
+
existsSync: deps.existsSync,
|
|
724
|
+
readFileSync: deps.readFileSync,
|
|
725
|
+
writeFileSync: deps.writeFileSync,
|
|
726
|
+
});
|
|
727
|
+
if (addResult.success) {
|
|
728
|
+
deps.log?.(`已添加到 Xcode 项目: ${libName}`);
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
deps.log?.(`警告: 添加到 Xcode 项目失败: ${addResult.error}`);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
const embedFrameworkNames = new Set((embedFrameworks || []).map((name) => {
|
|
735
|
+
return name.endsWith(".framework") ? name : `${name}.framework`;
|
|
736
|
+
}));
|
|
737
|
+
const frameworksToEmbed = [];
|
|
738
|
+
const frameworksToLink = [];
|
|
739
|
+
for (const frameworkPath of allFrameworks) {
|
|
740
|
+
const frameworkName = deps.basename(frameworkPath);
|
|
741
|
+
if (embedFrameworkNames.has(frameworkName)) {
|
|
742
|
+
frameworksToEmbed.push(frameworkPath);
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
frameworksToLink.push(frameworkPath);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (frameworksToEmbed.length > 0) {
|
|
749
|
+
deps.log?.(`步骤 6.2.1: 添加 ${frameworksToEmbed.length} 个 framework 到 Link Binary With Libraries 和 Embed Frameworks`);
|
|
750
|
+
for (const frameworkPath of frameworksToEmbed) {
|
|
751
|
+
const frameworkName = deps.basename(frameworkPath);
|
|
752
|
+
const relativePath = `Frameworks/${frameworkName}`;
|
|
753
|
+
const linkResult = addFileToXcodeProject(projectPbxprojPath, relativePath, "framework", {
|
|
754
|
+
existsSync: deps.existsSync,
|
|
755
|
+
readFileSync: deps.readFileSync,
|
|
756
|
+
writeFileSync: deps.writeFileSync,
|
|
757
|
+
});
|
|
758
|
+
if (!linkResult.success) {
|
|
759
|
+
deps.log?.(`警告: 添加到 Link Binary With Libraries 失败: ${linkResult.error}`);
|
|
760
|
+
}
|
|
761
|
+
const embedResult = addFileToEmbedFrameworks(projectPbxprojPath, relativePath, {
|
|
762
|
+
existsSync: deps.existsSync,
|
|
763
|
+
readFileSync: deps.readFileSync,
|
|
764
|
+
writeFileSync: deps.writeFileSync,
|
|
765
|
+
});
|
|
766
|
+
if (embedResult.success) {
|
|
767
|
+
deps.log?.(`已添加到 Embed Frameworks: ${frameworkName}`);
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
deps.log?.(`警告: 添加到 Embed Frameworks 失败: ${embedResult.error}`);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (frameworksToLink.length > 0) {
|
|
775
|
+
deps.log?.(`步骤 6.2.2: 添加 ${frameworksToLink.length} 个 framework 到 Link Binary With Libraries`);
|
|
776
|
+
for (const frameworkPath of frameworksToLink) {
|
|
777
|
+
const frameworkName = deps.basename(frameworkPath);
|
|
778
|
+
const relativePath = `Frameworks/${frameworkName}`;
|
|
779
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, "framework", {
|
|
780
|
+
existsSync: deps.existsSync,
|
|
781
|
+
readFileSync: deps.readFileSync,
|
|
782
|
+
writeFileSync: deps.writeFileSync,
|
|
783
|
+
});
|
|
784
|
+
if (addResult.success) {
|
|
785
|
+
deps.log?.(`已添加到 Link Binary With Libraries: ${frameworkName}`);
|
|
786
|
+
}
|
|
787
|
+
else {
|
|
788
|
+
deps.log?.(`警告: 添加到 Link Binary With Libraries 失败: ${addResult.error}`);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
for (const xcframeworkPath of xcframeworks) {
|
|
793
|
+
const xcframeworkName = deps.basename(xcframeworkPath);
|
|
794
|
+
const relativePath = `Frameworks/${xcframeworkName}`;
|
|
795
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, "framework", {
|
|
796
|
+
existsSync: deps.existsSync,
|
|
797
|
+
readFileSync: deps.readFileSync,
|
|
798
|
+
writeFileSync: deps.writeFileSync,
|
|
799
|
+
});
|
|
800
|
+
if (addResult.success) {
|
|
801
|
+
deps.log?.(`已添加到 Xcode 项目: ${xcframeworkName}`);
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
deps.log?.(`警告: 添加到 Xcode 项目失败: ${addResult.error}`);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
if (resources && resources.length > 0) {
|
|
808
|
+
for (const resourcePath of resources) {
|
|
809
|
+
const resourceName = deps.basename(resourcePath);
|
|
810
|
+
const relativePath = `${projectName}/Resources/${resourceName}`;
|
|
811
|
+
const addResult = addFileToXcodeProject(projectPbxprojPath, relativePath, "bundle", {
|
|
812
|
+
existsSync: deps.existsSync,
|
|
813
|
+
readFileSync: deps.readFileSync,
|
|
814
|
+
writeFileSync: deps.writeFileSync,
|
|
815
|
+
});
|
|
816
|
+
if (addResult.success) {
|
|
817
|
+
deps.log?.(`已添加资源到 Xcode 项目: ${resourceName}`);
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
deps.log?.(`警告: 添加资源到 Xcode 项目失败: ${addResult.error}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (frameworks && frameworks.length > 0) {
|
|
825
|
+
deps.log?.("注意: 系统库需要手动在 Xcode 中添加到 Link Binary With Libraries:");
|
|
826
|
+
for (const framework of frameworks) {
|
|
827
|
+
deps.log?.(` - ${framework}`);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
deps.log?.("步骤 6.8: 检查插件依赖");
|
|
831
|
+
const pluginFrameworkDir = deps.join(pluginDir, "ios");
|
|
832
|
+
if (deps.existsSync(pluginFrameworkDir)) {
|
|
833
|
+
try {
|
|
834
|
+
const frameworkFiles = findFilesRecursive(pluginFrameworkDir, [".m", ".mm", ".swift"], deps);
|
|
835
|
+
let hasSVGKitImport = false;
|
|
836
|
+
for (const file of frameworkFiles) {
|
|
837
|
+
try {
|
|
838
|
+
const content = deps.readFileSync(file, "utf8");
|
|
839
|
+
if (content.includes("SVGKit") || content.includes("SVGKImage")) {
|
|
840
|
+
hasSVGKitImport = true;
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
catch {
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
if (hasSVGKitImport) {
|
|
848
|
+
deps.log?.("⚠️ 警告: 插件使用了 SVGKit 库,但主项目中可能未包含该库");
|
|
849
|
+
deps.log?.(" 解决方案 1: 在主项目中使用 CocoaPods 安装 SVGKit");
|
|
850
|
+
deps.log?.(' 1. 在主项目根目录创建 Podfile,添加: pod "SVGKit", "~> 3.0"');
|
|
851
|
+
deps.log?.(" 2. 运行: pod install");
|
|
852
|
+
deps.log?.(" 3. 使用 .xcworkspace 打开项目");
|
|
853
|
+
deps.log?.(" 解决方案 2: 手动下载 SVGKit.framework 并添加到项目中");
|
|
854
|
+
deps.log?.(" 解决方案 3: 如果不需要 SVG 支持,可以移除插件中的 SVG 相关代码");
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
catch (error) {
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
if (allFrameworks.length > 0 ||
|
|
861
|
+
xcframeworks.length > 0) {
|
|
862
|
+
deps.log?.("步骤 6.7: 更新 FRAMEWORK_SEARCH_PATHS");
|
|
863
|
+
try {
|
|
864
|
+
let content = deps.readFileSync(projectPbxprojPath, "utf8");
|
|
865
|
+
const frameworksSearchPath = '"$(PROJECT_DIR)/Frameworks"';
|
|
866
|
+
let modified = false;
|
|
867
|
+
const frameworkSearchPathsRegex = /(FRAMEWORK_SEARCH_PATHS\s*=\s*\()([\s\S]*?)(\t+\);)/g;
|
|
868
|
+
const matches = [];
|
|
869
|
+
let match;
|
|
870
|
+
while ((match = frameworkSearchPathsRegex.exec(content)) !== null) {
|
|
871
|
+
matches.push({
|
|
872
|
+
full: match[0],
|
|
873
|
+
start: match[1],
|
|
874
|
+
middle: match[2],
|
|
875
|
+
end: match[3],
|
|
876
|
+
index: match.index
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
for (let i = matches.length - 1; i >= 0; i--) {
|
|
880
|
+
const m = matches[i];
|
|
881
|
+
const currentPaths = m.middle.trim();
|
|
882
|
+
if (!currentPaths.includes("Frameworks") &&
|
|
883
|
+
!currentPaths.includes(frameworksSearchPath)) {
|
|
884
|
+
const indent = m.end.match(/^\t+/)?.[0] || '\t\t\t\t';
|
|
885
|
+
const newPathEntry = `${indent}${frameworksSearchPath},\n`;
|
|
886
|
+
const newMiddle = currentPaths
|
|
887
|
+
? `${currentPaths}\n${newPathEntry}`
|
|
888
|
+
: newPathEntry;
|
|
889
|
+
const newContent = `${m.start}${newMiddle}${m.end}`;
|
|
890
|
+
const before = content.substring(0, m.index);
|
|
891
|
+
const after = content.substring(m.index + m.full.length);
|
|
892
|
+
content = before + newContent + after;
|
|
893
|
+
modified = true;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
if (modified) {
|
|
897
|
+
deps.writeFileSync(projectPbxprojPath, content, "utf8");
|
|
898
|
+
deps.log?.(`已添加 Frameworks 目录到所有 FRAMEWORK_SEARCH_PATHS 配置`);
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
deps.log?.(`所有 FRAMEWORK_SEARCH_PATHS 已包含 Frameworks 目录`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
catch (error) {
|
|
905
|
+
deps.log?.(`警告: 更新 FRAMEWORK_SEARCH_PATHS 失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
deps.log?.("步骤 7: 清理临时文件");
|
|
910
|
+
try {
|
|
911
|
+
deps.log?.(` 检查临时目录: ${tempDir}`);
|
|
912
|
+
if (deps.existsSync(tempDir)) {
|
|
913
|
+
deps.log?.(` 开始清理临时目录: ${tempDir}`);
|
|
914
|
+
await new Promise((resolve) => {
|
|
915
|
+
const timeout = deps.setTimeout(() => {
|
|
916
|
+
deps.log?.(`警告: 清理临时目录超时: ${tempDir}`);
|
|
917
|
+
resolve();
|
|
918
|
+
}, 5000);
|
|
919
|
+
deps.exec(`rm -rf "${tempDir}"`, (error) => {
|
|
920
|
+
deps.clearTimeout(timeout);
|
|
921
|
+
if (error) {
|
|
922
|
+
deps.log?.(`警告: 清理临时目录失败: ${tempDir} (${error.message})`);
|
|
923
|
+
}
|
|
924
|
+
else {
|
|
925
|
+
deps.log?.(`✓ 已清理临时目录: ${tempDir}`);
|
|
926
|
+
}
|
|
927
|
+
resolve();
|
|
928
|
+
});
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
deps.log?.(` 临时目录不存在,跳过清理: ${tempDir}`);
|
|
933
|
+
}
|
|
934
|
+
const frameworksDir = deps.join(projectPath, "Frameworks");
|
|
935
|
+
const frameworkTempDir = deps.join(frameworksDir, ".temp_framework_copy");
|
|
936
|
+
deps.log?.(` 检查 framework 临时目录: ${frameworkTempDir}`);
|
|
937
|
+
if (deps.existsSync(frameworkTempDir)) {
|
|
938
|
+
deps.log?.(` 开始清理 framework 临时目录: ${frameworkTempDir}`);
|
|
939
|
+
await new Promise((resolve) => {
|
|
940
|
+
const timeout = deps.setTimeout(() => {
|
|
941
|
+
deps.log?.(`警告: 清理 framework 临时目录超时: ${frameworkTempDir}`);
|
|
942
|
+
resolve();
|
|
943
|
+
}, 5000);
|
|
944
|
+
deps.exec(`rm -rf "${frameworkTempDir}"`, (error) => {
|
|
945
|
+
deps.clearTimeout(timeout);
|
|
946
|
+
if (error) {
|
|
947
|
+
deps.log?.(`警告: 清理 framework 临时目录失败: ${frameworkTempDir} (${error.message})`);
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
deps.log?.(`✓ 已清理 framework 临时目录: ${frameworkTempDir}`);
|
|
951
|
+
}
|
|
952
|
+
resolve();
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
deps.log?.(` framework 临时目录不存在,跳过清理: ${frameworkTempDir}`);
|
|
958
|
+
}
|
|
959
|
+
deps.log?.("✓ 清理临时文件完成");
|
|
960
|
+
}
|
|
961
|
+
catch (cleanupError) {
|
|
962
|
+
deps.log?.(`警告: 清理临时文件时出错: ${cleanupError instanceof Error
|
|
963
|
+
? cleanupError.message
|
|
964
|
+
: String(cleanupError)}`);
|
|
965
|
+
}
|
|
966
|
+
deps.log?.("原生插件集成完成");
|
|
967
|
+
return {
|
|
968
|
+
success: true,
|
|
969
|
+
message: "原生插件集成成功",
|
|
970
|
+
logs: [],
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
catch (error) {
|
|
974
|
+
deps.log?.(`原生插件集成异常: ${error instanceof Error ? error.message : String(error)}`);
|
|
975
|
+
try {
|
|
976
|
+
const tempDir = deps.join(projectPath, ".temp");
|
|
977
|
+
if (deps.existsSync(tempDir)) {
|
|
978
|
+
deps.exec(`rm -rf "${tempDir}"`, () => { });
|
|
979
|
+
}
|
|
980
|
+
const frameworksDir = deps.join(projectPath, "Frameworks");
|
|
981
|
+
const frameworkTempDir = deps.join(frameworksDir, ".temp_framework_copy");
|
|
982
|
+
if (deps.existsSync(frameworkTempDir)) {
|
|
983
|
+
deps.exec(`rm -rf "${frameworkTempDir}"`, () => { });
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
catch { }
|
|
987
|
+
return {
|
|
988
|
+
success: false,
|
|
989
|
+
error: `原生插件集成异常: ${error instanceof Error ? error.message : String(error)}`,
|
|
990
|
+
logs: [],
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
//# sourceMappingURL=integrateNativePlugin.js.map
|