zcw-shared 2.4.0 → 2.8.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/integrateThirdPartyModule.d.ts +5 -0
- package/dist/functions/android/integrateThirdPartyModule.js +70 -0
- package/dist/functions/android/integrateThirdPartyModule.js.map +1 -1
- package/dist/functions/android/integrateUniPushAndroid.d.ts +23 -0
- package/dist/functions/android/integrateUniPushAndroid.js +266 -0
- package/dist/functions/android/integrateUniPushAndroid.js.map +1 -0
- package/dist/functions/api/auth.d.ts +14 -0
- package/dist/functions/api/auth.js +109 -0
- package/dist/functions/api/auth.js.map +1 -0
- package/dist/functions/api/schemas/auth.schema.d.ts +363 -0
- package/dist/functions/api/schemas/auth.schema.js +39 -0
- package/dist/functions/api/schemas/auth.schema.js.map +1 -0
- package/dist/functions/api/schemas/video.schema.d.ts +391 -0
- package/dist/functions/api/schemas/video.schema.js +55 -0
- package/dist/functions/api/schemas/video.schema.js.map +1 -0
- package/dist/functions/api/video.d.ts +62 -0
- package/dist/functions/api/video.js +243 -0
- package/dist/functions/api/video.js.map +1 -0
- package/dist/functions/browser/isElectron.d.ts +5 -0
- package/dist/functions/browser/isElectron.js +4 -0
- package/dist/functions/browser/isElectron.js.map +1 -0
- package/dist/functions/dom/isTextTruncated.d.ts +4 -0
- package/dist/functions/dom/isTextTruncated.js +16 -0
- package/dist/functions/dom/isTextTruncated.js.map +1 -0
- package/dist/functions/dom/localFileInput.d.ts +14 -0
- package/dist/functions/dom/localFileInput.js +27 -0
- package/dist/functions/dom/localFileInput.js.map +1 -0
- package/dist/functions/file/getIconfontNameByExtension.js +53 -56
- package/dist/functions/file/getIconfontNameByExtension.js.map +1 -1
- package/dist/functions/im/parseImMentionSegments.d.ts +15 -0
- package/dist/functions/im/parseImMentionSegments.js +56 -0
- package/dist/functions/im/parseImMentionSegments.js.map +1 -0
- package/dist/functions/ios/integrateThirdPartyModule.d.ts +9 -1
- package/dist/functions/ios/integrateThirdPartyModule.js +112 -2
- package/dist/functions/ios/integrateThirdPartyModule.js.map +1 -1
- package/dist/functions/ios/integrateUniPushIOS.d.ts +18 -0
- package/dist/functions/ios/integrateUniPushIOS.js +200 -0
- package/dist/functions/ios/integrateUniPushIOS.js.map +1 -0
- package/dist/functions/oss/uploadViaSignedPut.d.ts +35 -0
- package/dist/functions/oss/uploadViaSignedPut.js +86 -0
- package/dist/functions/oss/uploadViaSignedPut.js.map +1 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +38 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
- package/dist/functions/uniapp/app-plus/buildIOSApp.js +38 -0
- package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
- package/dist/vue-hooks/dom/useAppendToBody.d.ts +25 -0
- package/dist/vue-hooks/dom/useAppendToBody.js +31 -0
- package/dist/vue-hooks/dom/useAppendToBody.js.map +1 -0
- package/dist/vue-hooks/dom/useDraggable.d.ts +8 -3
- package/dist/vue-hooks/dom/useDraggable.js +57 -19
- package/dist/vue-hooks/dom/useDraggable.js.map +1 -1
- package/package.json +11 -1
- package/references/dom.d.ts +8 -3
- package/types/im-api.d.ts +26 -2
- package/types/im-chat.d.ts +42 -1
- package/types/im-message-display.d.ts +89 -0
- package/types/uniapp-android-build.d.ts +31 -0
- package/types/uniapp-ios-build.d.ts +26 -0
- package/types/user.d.ts +2 -1
- package/dist/functions/async/sleep.d.ts +0 -5
- package/dist/functions/async/sleep.js +0 -6
- package/dist/functions/async/sleep.js.map +0 -1
- package/dist/functions/async/timeout.d.ts +0 -6
- package/dist/functions/async/timeout.js +0 -12
- package/dist/functions/async/timeout.js.map +0 -1
- package/dist/functions/browser/computePosition.d.ts +0 -6
- package/dist/functions/browser/computePosition.js +0 -49
- package/dist/functions/browser/computePosition.js.map +0 -1
- package/dist/functions/browser/createSharedKeyboardCenter.d.ts +0 -18
- package/dist/functions/browser/createSharedKeyboardCenter.js +0 -58
- package/dist/functions/browser/createSharedKeyboardCenter.js.map +0 -1
- package/dist/functions/browser/createThrottledEventListener.d.ts +0 -11
- package/dist/functions/browser/createThrottledEventListener.js +0 -51
- package/dist/functions/browser/createThrottledEventListener.js.map +0 -1
- package/dist/functions/browser/demonstrateResourceLoading.d.ts +0 -32
- package/dist/functions/browser/demonstrateResourceLoading.js +0 -169
- package/dist/functions/browser/demonstrateResourceLoading.js.map +0 -1
- package/dist/functions/browser/detectOverflow.d.ts +0 -12
- package/dist/functions/browser/detectOverflow.js +0 -17
- package/dist/functions/browser/detectOverflow.js.map +0 -1
- package/dist/functions/browser/getAlignment.d.ts +0 -2
- package/dist/functions/browser/getAlignment.js +0 -5
- package/dist/functions/browser/getAlignment.js.map +0 -1
- package/dist/functions/browser/getBasePlacement.d.ts +0 -2
- package/dist/functions/browser/getBasePlacement.js +0 -4
- package/dist/functions/browser/getBasePlacement.js.map +0 -1
- package/dist/functions/browser/getCrossAxisFlip.d.ts +0 -2
- package/dist/functions/browser/getCrossAxisFlip.js +0 -11
- package/dist/functions/browser/getCrossAxisFlip.js.map +0 -1
- package/dist/functions/browser/getElementRect.d.ts +0 -3
- package/dist/functions/browser/getElementRect.js +0 -14
- package/dist/functions/browser/getElementRect.js.map +0 -1
- package/dist/functions/browser/getFlipPlacements.d.ts +0 -2
- package/dist/functions/browser/getFlipPlacements.js +0 -13
- package/dist/functions/browser/getFlipPlacements.js.map +0 -1
- package/dist/functions/browser/getMainAxisFlip.d.ts +0 -2
- package/dist/functions/browser/getMainAxisFlip.js +0 -17
- package/dist/functions/browser/getMainAxisFlip.js.map +0 -1
- package/dist/functions/browser/getRelativePosition.d.ts +0 -3
- package/dist/functions/browser/getRelativePosition.js +0 -14
- package/dist/functions/browser/getRelativePosition.js.map +0 -1
- package/dist/functions/browser/getViewportRect.d.ts +0 -7
- package/dist/functions/browser/getViewportRect.js +0 -15
- package/dist/functions/browser/getViewportRect.js.map +0 -1
- package/dist/functions/browser/isValidPlacement.d.ts +0 -2
- package/dist/functions/browser/isValidPlacement.js +0 -16
- package/dist/functions/browser/isValidPlacement.js.map +0 -1
- package/dist/functions/browser/pickFile.d.ts +0 -15
- package/dist/functions/browser/pickFile.js +0 -48
- package/dist/functions/browser/pickFile.js.map +0 -1
- package/dist/functions/build/generateExports.d.ts +0 -26
- package/dist/functions/build/generateExports.js +0 -34
- package/dist/functions/build/generateExports.js.map +0 -1
- package/dist/functions/core/diff/diff.d.ts +0 -25
- package/dist/functions/core/diff/diff.js +0 -316
- package/dist/functions/core/diff/diff.js.map +0 -1
- package/dist/functions/core/diff/vueDiff.d.ts +0 -38
- package/dist/functions/core/diff/vueDiff.js +0 -333
- package/dist/functions/core/diff/vueDiff.js.map +0 -1
- package/dist/functions/core/generator/generatorUtils.d.ts +0 -16
- package/dist/functions/core/generator/generatorUtils.js +0 -139
- package/dist/functions/core/generator/generatorUtils.js.map +0 -1
- package/dist/functions/core/type/isType.d.ts +0 -11
- package/dist/functions/core/type/isType.js +0 -30
- package/dist/functions/core/type/isType.js.map +0 -1
- package/dist/functions/data/array-object/chunk.d.ts +0 -1
- package/dist/functions/data/array-object/chunk.js +0 -11
- package/dist/functions/data/array-object/chunk.js.map +0 -1
- package/dist/functions/data/array-object/deepClone.d.ts +0 -12
- package/dist/functions/data/array-object/deepClone.js +0 -131
- package/dist/functions/data/array-object/deepClone.js.map +0 -1
- package/dist/functions/data/array-object/evolve.d.ts +0 -3
- package/dist/functions/data/array-object/evolve.js +0 -15
- package/dist/functions/data/array-object/evolve.js.map +0 -1
- package/dist/functions/data/array-object/flatten.d.ts +0 -7
- package/dist/functions/data/array-object/flatten.js +0 -60
- package/dist/functions/data/array-object/flatten.js.map +0 -1
- package/dist/functions/data/array-object/flattenObject.d.ts +0 -5
- package/dist/functions/data/array-object/flattenObject.js +0 -102
- package/dist/functions/data/array-object/flattenObject.js.map +0 -1
- package/dist/functions/data/array-object/groupBy.d.ts +0 -1
- package/dist/functions/data/array-object/groupBy.js +0 -14
- package/dist/functions/data/array-object/groupBy.js.map +0 -1
- package/dist/functions/data/array-object/omit.d.ts +0 -1
- package/dist/functions/data/array-object/omit.js +0 -8
- package/dist/functions/data/array-object/omit.js.map +0 -1
- package/dist/functions/data/array-object/pick.d.ts +0 -1
- package/dist/functions/data/array-object/pick.js +0 -10
- package/dist/functions/data/array-object/pick.js.map +0 -1
- package/dist/functions/data/array-object/shuffle.d.ts +0 -1
- package/dist/functions/data/array-object/shuffle.js +0 -9
- package/dist/functions/data/array-object/shuffle.js.map +0 -1
- package/dist/functions/data/array-object/sortBy.d.ts +0 -1
- package/dist/functions/data/array-object/sortBy.js +0 -13
- package/dist/functions/data/array-object/sortBy.js.map +0 -1
- package/dist/functions/data/array-object/unique.d.ts +0 -10
- package/dist/functions/data/array-object/unique.js +0 -85
- package/dist/functions/data/array-object/unique.js.map +0 -1
- package/dist/functions/data/date/dateRange.d.ts +0 -1
- package/dist/functions/data/date/dateRange.js +0 -18
- package/dist/functions/data/date/dateRange.js.map +0 -1
- package/dist/functions/data/date/formatDate.d.ts +0 -1
- package/dist/functions/data/date/formatDate.js +0 -21
- package/dist/functions/data/date/formatDate.js.map +0 -1
- package/dist/functions/data/date/timeAgo.d.ts +0 -1
- package/dist/functions/data/date/timeAgo.js +0 -49
- package/dist/functions/data/date/timeAgo.js.map +0 -1
- package/dist/functions/data/number/average.d.ts +0 -1
- package/dist/functions/data/number/average.js +0 -8
- package/dist/functions/data/number/average.js.map +0 -1
- package/dist/functions/data/number/clamp.d.ts +0 -1
- package/dist/functions/data/number/clamp.js +0 -7
- package/dist/functions/data/number/clamp.js.map +0 -1
- package/dist/functions/data/number/formatNumber.d.ts +0 -8
- package/dist/functions/data/number/formatNumber.js +0 -16
- package/dist/functions/data/number/formatNumber.js.map +0 -1
- package/dist/functions/data/number/median.d.ts +0 -1
- package/dist/functions/data/number/median.js +0 -14
- package/dist/functions/data/number/median.js.map +0 -1
- package/dist/functions/data/number/percentile.d.ts +0 -1
- package/dist/functions/data/number/percentile.js +0 -18
- package/dist/functions/data/number/percentile.js.map +0 -1
- package/dist/functions/data/number/random.d.ts +0 -4
- package/dist/functions/data/number/random.js +0 -9
- package/dist/functions/data/number/random.js.map +0 -1
- package/dist/functions/data/number/range.d.ts +0 -1
- package/dist/functions/data/number/range.js +0 -18
- package/dist/functions/data/number/range.js.map +0 -1
- package/dist/functions/data/number/sum.d.ts +0 -1
- package/dist/functions/data/number/sum.js +0 -4
- package/dist/functions/data/number/sum.js.map +0 -1
- package/dist/functions/data/randomRegion.d.ts +0 -24
- package/dist/functions/data/randomRegion.js +0 -74
- package/dist/functions/data/randomRegion.js.map +0 -1
- package/dist/functions/data/string/base64.d.ts +0 -5
- package/dist/functions/data/string/base64.js +0 -6
- package/dist/functions/data/string/base64.js.map +0 -1
- package/dist/functions/data/string/capitalize.d.ts +0 -1
- package/dist/functions/data/string/capitalize.js +0 -6
- package/dist/functions/data/string/capitalize.js.map +0 -1
- package/dist/functions/data/string/caseConverter.d.ts +0 -19
- package/dist/functions/data/string/caseConverter.js +0 -94
- package/dist/functions/data/string/caseConverter.js.map +0 -1
- package/dist/functions/data/string/desensitize.d.ts +0 -13
- package/dist/functions/data/string/desensitize.js +0 -107
- package/dist/functions/data/string/desensitize.js.map +0 -1
- package/dist/functions/data/string/htmlEscape.d.ts +0 -20
- package/dist/functions/data/string/htmlEscape.js +0 -80
- package/dist/functions/data/string/htmlEscape.js.map +0 -1
- package/dist/functions/data/string/levenshtein.d.ts +0 -1
- package/dist/functions/data/string/levenshtein.js +0 -27
- package/dist/functions/data/string/levenshtein.js.map +0 -1
- package/dist/functions/data/string/normalize.d.ts +0 -8
- package/dist/functions/data/string/normalize.js +0 -37
- package/dist/functions/data/string/normalize.js.map +0 -1
- package/dist/functions/data/string/pad.d.ts +0 -13
- package/dist/functions/data/string/pad.js +0 -50
- package/dist/functions/data/string/pad.js.map +0 -1
- package/dist/functions/data/string/palindrome.d.ts +0 -3
- package/dist/functions/data/string/palindrome.js +0 -15
- package/dist/functions/data/string/palindrome.js.map +0 -1
- package/dist/functions/data/string/similarity.d.ts +0 -1
- package/dist/functions/data/string/similarity.js +0 -13
- package/dist/functions/data/string/similarity.js.map +0 -1
- package/dist/functions/data/string/template.d.ts +0 -4
- package/dist/functions/data/string/template.js +0 -21
- package/dist/functions/data/string/template.js.map +0 -1
- package/dist/functions/data/string/testRegex.d.ts +0 -20
- package/dist/functions/data/string/testRegex.js +0 -300
- package/dist/functions/data/string/testRegex.js.map +0 -1
- package/dist/functions/data/string/wordCount.d.ts +0 -5
- package/dist/functions/data/string/wordCount.js +0 -11
- package/dist/functions/data/string/wordCount.js.map +0 -1
- package/dist/functions/data/tree/buildTree.d.ts +0 -7
- package/dist/functions/data/tree/buildTree.js +0 -27
- package/dist/functions/data/tree/buildTree.js.map +0 -1
- package/dist/functions/data/tree/filterTree.d.ts +0 -4
- package/dist/functions/data/tree/filterTree.js +0 -21
- package/dist/functions/data/tree/filterTree.js.map +0 -1
- package/dist/functions/data/tree/findNode.d.ts +0 -4
- package/dist/functions/data/tree/findNode.js +0 -21
- package/dist/functions/data/tree/findNode.js.map +0 -1
- package/dist/functions/data/tree/flattenTree.d.ts +0 -6
- package/dist/functions/data/tree/flattenTree.js +0 -21
- package/dist/functions/data/tree/flattenTree.js.map +0 -1
- package/dist/functions/file/walk.d.ts +0 -18
- package/dist/functions/file/walk.js +0 -58
- package/dist/functions/file/walk.js.map +0 -1
- package/dist/functions/hybrid/detectBridgeEnvironment.d.ts +0 -11
- package/dist/functions/hybrid/detectBridgeEnvironment.js +0 -26
- package/dist/functions/hybrid/detectBridgeEnvironment.js.map +0 -1
- package/dist/functions/integrations/ag-grid/generateLicense.d.ts +0 -7
- package/dist/functions/integrations/ag-grid/generateLicense.js +0 -12
- package/dist/functions/integrations/ag-grid/generateLicense.js.map +0 -1
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.d.ts +0 -30
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js +0 -884
- package/dist/functions/integrations/uniapp/app-plus/buildAndroidApp.js.map +0 -1
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.d.ts +0 -31
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js +0 -900
- package/dist/functions/integrations/uniapp/app-plus/buildIOSApp.js.map +0 -1
- package/dist/functions/integrations/uniapp/build.d.ts +0 -21
- package/dist/functions/integrations/uniapp/build.js +0 -83
- package/dist/functions/integrations/uniapp/build.js.map +0 -1
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.d.ts +0 -11
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js +0 -30
- package/dist/functions/integrations/uniapp/detectAndroidProjectStructure.js.map +0 -1
- package/dist/functions/integrations/uniapp/detectProjectType.d.ts +0 -20
- package/dist/functions/integrations/uniapp/detectProjectType.js +0 -68
- package/dist/functions/integrations/uniapp/detectProjectType.js.map +0 -1
- package/dist/functions/integrations/uniapp/parseManifest.d.ts +0 -20
- package/dist/functions/integrations/uniapp/parseManifest.js +0 -51
- package/dist/functions/integrations/uniapp/parseManifest.js.map +0 -1
- package/dist/functions/integrations/uniapp/waitForPages.d.ts +0 -7
- package/dist/functions/integrations/uniapp/waitForPages.js +0 -20
- package/dist/functions/integrations/uniapp/waitForPages.js.map +0 -1
- package/dist/functions/integrations/vue/dynamicMount.d.ts +0 -18
- package/dist/functions/integrations/vue/dynamicMount.js +0 -25
- package/dist/functions/integrations/vue/dynamicMount.js.map +0 -1
- package/dist/functions/integrations/vue/extractColorsFromVueFile.d.ts +0 -3
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js +0 -18
- package/dist/functions/integrations/vue/extractColorsFromVueFile.js.map +0 -1
- package/dist/functions/integrations/vue/extractColorsFromVueSection.d.ts +0 -3
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js +0 -53
- package/dist/functions/integrations/vue/extractColorsFromVueSection.js.map +0 -1
- package/dist/functions/integrations/vue/filterSections.d.ts +0 -2
- package/dist/functions/integrations/vue/filterSections.js +0 -11
- package/dist/functions/integrations/vue/filterSections.js.map +0 -1
- package/dist/functions/integrations/vue/isVNode.d.ts +0 -2
- package/dist/functions/integrations/vue/isVNode.js +0 -6
- package/dist/functions/integrations/vue/isVNode.js.map +0 -1
- package/dist/functions/integrations/vue/isVueComponent.d.ts +0 -2
- package/dist/functions/integrations/vue/isVueComponent.js +0 -6
- package/dist/functions/integrations/vue/isVueComponent.js.map +0 -1
- package/dist/functions/integrations/vue/parseVueFile.d.ts +0 -2
- package/dist/functions/integrations/vue/parseVueFile.js +0 -53
- package/dist/functions/integrations/vue/parseVueFile.js.map +0 -1
- package/dist/functions/integrations/wechat/miniapp/downloadFile.d.ts +0 -6
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js +0 -39
- package/dist/functions/integrations/wechat/miniapp/downloadFile.js.map +0 -1
- package/dist/functions/patterns/MyPromise.d.ts +0 -32
- package/dist/functions/patterns/MyPromise.js +0 -254
- package/dist/functions/patterns/MyPromise.js.map +0 -1
- package/dist/functions/patterns/functionBind.d.ts +0 -4
- package/dist/functions/patterns/functionBind.js +0 -33
- package/dist/functions/patterns/functionBind.js.map +0 -1
- package/dist/functions/patterns/myInstanceof.d.ts +0 -5
- package/dist/functions/patterns/myInstanceof.js +0 -56
- package/dist/functions/patterns/myInstanceof.js.map +0 -1
- package/dist/functions/patterns/myNew.d.ts +0 -3
- package/dist/functions/patterns/myNew.js +0 -19
- package/dist/functions/patterns/myNew.js.map +0 -1
- package/dist/functions/platform/android/buildProject.d.ts +0 -13
- package/dist/functions/platform/android/buildProject.js +0 -122
- package/dist/functions/platform/android/buildProject.js.map +0 -1
- package/dist/functions/platform/android/configureAppIcon.d.ts +0 -17
- package/dist/functions/platform/android/configureAppIcon.js +0 -106
- package/dist/functions/platform/android/configureAppIcon.js.map +0 -1
- package/dist/functions/platform/android/configureLaunchScreen.d.ts +0 -21
- package/dist/functions/platform/android/configureLaunchScreen.js +0 -328
- package/dist/functions/platform/android/configureLaunchScreen.js.map +0 -1
- package/dist/functions/platform/android/detectAndroidModules.d.ts +0 -8
- package/dist/functions/platform/android/detectAndroidModules.js +0 -21
- package/dist/functions/platform/android/detectAndroidModules.js.map +0 -1
- package/dist/functions/platform/android/integrateFacebookLogin.d.ts +0 -12
- package/dist/functions/platform/android/integrateFacebookLogin.js +0 -91
- package/dist/functions/platform/android/integrateFacebookLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateGoogleLogin.d.ts +0 -10
- package/dist/functions/platform/android/integrateGoogleLogin.js +0 -199
- package/dist/functions/platform/android/integrateGoogleLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateMiuiLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateMiuiLogin.js +0 -115
- package/dist/functions/platform/android/integrateMiuiLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateQQLogin.d.ts +0 -12
- package/dist/functions/platform/android/integrateQQLogin.js +0 -130
- package/dist/functions/platform/android/integrateQQLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateShareTrace.d.ts +0 -10
- package/dist/functions/platform/android/integrateShareTrace.js +0 -181
- package/dist/functions/platform/android/integrateShareTrace.js.map +0 -1
- package/dist/functions/platform/android/integrateSinaLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateSinaLogin.js +0 -85
- package/dist/functions/platform/android/integrateSinaLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateThirdPartyModule.d.ts +0 -46
- package/dist/functions/platform/android/integrateThirdPartyModule.js +0 -251
- package/dist/functions/platform/android/integrateThirdPartyModule.js.map +0 -1
- package/dist/functions/platform/android/integrateUniAppNativePlugin.d.ts +0 -22
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js +0 -631
- package/dist/functions/platform/android/integrateUniAppNativePlugin.js.map +0 -1
- package/dist/functions/platform/android/integrateUniverifyLogin.d.ts +0 -11
- package/dist/functions/platform/android/integrateUniverifyLogin.js +0 -314
- package/dist/functions/platform/android/integrateUniverifyLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateWechatLogin.d.ts +0 -13
- package/dist/functions/platform/android/integrateWechatLogin.js +0 -154
- package/dist/functions/platform/android/integrateWechatLogin.js.map +0 -1
- package/dist/functions/platform/android/integrateWechatShare.d.ts +0 -13
- package/dist/functions/platform/android/integrateWechatShare.js +0 -154
- package/dist/functions/platform/android/integrateWechatShare.js.map +0 -1
- package/dist/functions/platform/android/modifyGradle.d.ts +0 -28
- package/dist/functions/platform/android/modifyGradle.js +0 -119
- package/dist/functions/platform/android/modifyGradle.js.map +0 -1
- package/dist/functions/platform/android/modifyManifest.d.ts +0 -39
- package/dist/functions/platform/android/modifyManifest.js +0 -225
- package/dist/functions/platform/android/modifyManifest.js.map +0 -1
- package/dist/functions/platform/android/permission.d.ts +0 -54
- package/dist/functions/platform/android/permission.js +0 -85
- package/dist/functions/platform/android/permission.js.map +0 -1
- package/dist/functions/platform/ios/configureAppIcon.d.ts +0 -17
- package/dist/functions/platform/ios/configureAppIcon.js +0 -149
- package/dist/functions/platform/ios/configureAppIcon.js.map +0 -1
- package/dist/functions/platform/ios/configureLaunchScreen.d.ts +0 -17
- package/dist/functions/platform/ios/configureLaunchScreen.js +0 -150
- package/dist/functions/platform/ios/configureLaunchScreen.js.map +0 -1
- package/dist/functions/platform/ios/configurePermissions.d.ts +0 -19
- package/dist/functions/platform/ios/configurePermissions.js +0 -120
- package/dist/functions/platform/ios/configurePermissions.js.map +0 -1
- package/dist/functions/platform/ios/integrateNativePlugin.d.ts +0 -35
- package/dist/functions/platform/ios/integrateNativePlugin.js +0 -994
- package/dist/functions/platform/ios/integrateNativePlugin.js.map +0 -1
- package/dist/functions/platform/ios/integrateQQShare.d.ts +0 -14
- package/dist/functions/platform/ios/integrateQQShare.js +0 -132
- package/dist/functions/platform/ios/integrateQQShare.js.map +0 -1
- package/dist/functions/platform/ios/integrateSinaShare.d.ts +0 -16
- package/dist/functions/platform/ios/integrateSinaShare.js +0 -108
- package/dist/functions/platform/ios/integrateSinaShare.js.map +0 -1
- package/dist/functions/platform/ios/integrateThirdPartyModule.d.ts +0 -62
- package/dist/functions/platform/ios/integrateThirdPartyModule.js +0 -883
- package/dist/functions/platform/ios/integrateThirdPartyModule.js.map +0 -1
- package/dist/functions/platform/ios/integrateWechatOauth.d.ts +0 -14
- package/dist/functions/platform/ios/integrateWechatOauth.js +0 -107
- package/dist/functions/platform/ios/integrateWechatOauth.js.map +0 -1
- package/dist/functions/platform/ios/integrateWechatShare.d.ts +0 -14
- package/dist/functions/platform/ios/integrateWechatShare.js +0 -101
- package/dist/functions/platform/ios/integrateWechatShare.js.map +0 -1
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.d.ts +0 -2
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js +0 -45
- package/dist/functions/platform/ios/modifyInfoPlistKeyValue.js.map +0 -1
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.d.ts +0 -16
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js +0 -136
- package/dist/functions/platform/ios/safelyModifyProjectPbxproj.js.map +0 -1
- package/dist/functions/platform/ios/useAltool.d.ts +0 -39
- package/dist/functions/platform/ios/useAltool.js +0 -350
- package/dist/functions/platform/ios/useAltool.js.map +0 -1
- package/dist/functions/style/buildTokens.d.ts +0 -76
- package/dist/functions/style/buildTokens.js +0 -183
- package/dist/functions/style/buildTokens.js.map +0 -1
- package/dist/functions/style/extractCssVariables.d.ts +0 -16
- package/dist/functions/style/extractCssVariables.js +0 -256
- package/dist/functions/style/extractCssVariables.js.map +0 -1
- package/dist/functions/style/generateVariables.d.ts +0 -7
- package/dist/functions/style/generateVariables.js +0 -135
- package/dist/functions/style/generateVariables.js.map +0 -1
- package/dist/functions/style/mixColors.d.ts +0 -1
- package/dist/functions/style/mixColors.js +0 -38
- package/dist/functions/style/mixColors.js.map +0 -1
- package/dist/functions/style/parseDesignTokens.d.ts +0 -10
- package/dist/functions/style/parseDesignTokens.js +0 -216
- package/dist/functions/style/parseDesignTokens.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js +0 -509
- package/dist/functions/uniapp/app-plus/buildAndroidPlugin.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.js +0 -406
- package/dist/functions/uniapp/app-plus/buildIOSPlugin.js.map +0 -1
- package/dist/functions/validation/parseJwtPayload.d.ts +0 -7
- package/dist/functions/validation/parseJwtPayload.js +0 -33
- package/dist/functions/validation/parseJwtPayload.js.map +0 -1
- package/dist/functions/validation/validate.d.ts +0 -11
- package/dist/functions/validation/validate.js +0 -44
- package/dist/functions/validation/validate.js.map +0 -1
|
@@ -1,883 +0,0 @@
|
|
|
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
|