zcw-shared 1.4.0 → 1.7.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/README.md +513 -610
- package/assets/logo-colorful.svg +18 -18
- package/assets/logo-name.svg +7 -7
- package/assets/logo-transparent.svg +14 -14
- package/assets/logo.svg +8 -8
- package/dist/constants/colorPatterns.d.ts +8 -0
- package/dist/{functions/color-converter/COLOR_PATTERNS.js → constants/colorPatterns.js} +1 -1
- package/dist/constants/colorPatterns.js.map +1 -0
- package/dist/constants/namedColors.d.ts +16 -0
- package/dist/constants/namedColors.js +17 -0
- package/dist/constants/namedColors.js.map +1 -0
- package/dist/functions/android/buildProject.d.ts +11 -0
- package/dist/functions/android/buildProject.js +97 -0
- package/dist/functions/android/buildProject.js.map +1 -0
- package/dist/functions/android/modifyGradle.d.ts +17 -0
- package/dist/functions/android/modifyGradle.js +69 -0
- package/dist/functions/android/modifyGradle.js.map +1 -0
- package/dist/functions/android/modifyManifest.d.ts +23 -0
- package/dist/functions/android/modifyManifest.js +198 -0
- package/dist/functions/android/modifyManifest.js.map +1 -0
- package/dist/functions/android/permission.d.ts +30 -0
- package/dist/functions/android/permission.js +65 -0
- package/dist/functions/android/permission.js.map +1 -0
- package/dist/functions/color/colorValidation.d.ts +11 -0
- package/dist/functions/color/colorValidation.js +35 -0
- package/dist/functions/color/colorValidation.js.map +1 -0
- package/dist/functions/{color-converter → color}/convertColor.d.ts +0 -1
- package/dist/functions/color/convertColor.js +277 -0
- package/dist/functions/color/convertColor.js.map +1 -0
- package/dist/functions/color/deduplicateColors.d.ts +4 -0
- package/dist/functions/color/deduplicateColors.js +40 -0
- package/dist/functions/color/deduplicateColors.js.map +1 -0
- package/dist/functions/color/detectColorFormat.d.ts +8 -0
- package/dist/functions/color/detectColorFormat.js +110 -0
- package/dist/functions/color/detectColorFormat.js.map +1 -0
- package/dist/functions/color/extractColors.d.ts +4 -0
- package/dist/functions/color/extractColors.js +128 -0
- package/dist/functions/color/extractColors.js.map +1 -0
- package/dist/functions/css/extractCssVariables.d.ts +12 -0
- package/dist/functions/css/extractCssVariables.js +53 -0
- package/dist/functions/css/extractCssVariables.js.map +1 -0
- package/dist/functions/debug/createDebugger.d.ts +8 -7
- package/dist/functions/debug/createDebugger.js +49 -39
- package/dist/functions/debug/createDebugger.js.map +1 -1
- package/dist/functions/dom/detectOverflow.d.ts +3 -3
- package/dist/functions/dom/detectOverflow.js +3 -3
- package/dist/functions/dom/detectOverflow.js.map +1 -1
- package/dist/functions/dom/getElementRect.d.ts +1 -1
- package/dist/functions/dom/getElementRect.js.map +1 -1
- package/dist/functions/dom/getRelativePosition.d.ts +1 -1
- package/dist/functions/dom/getRelativePosition.js.map +1 -1
- package/dist/functions/dom/getViewportRect.d.ts +2 -2
- package/dist/functions/dom/getViewportRect.js +2 -2
- package/dist/functions/dom/getViewportRect.js.map +1 -1
- package/dist/functions/image/generateMacIcons.d.ts +3 -3
- package/dist/functions/image/generateMacIcons.js.map +1 -1
- package/dist/functions/image/generateMacTrayIcon.d.ts +3 -3
- package/dist/functions/image/generateMacTrayIcon.js.map +1 -1
- package/dist/functions/image/generatePaddedImage.d.ts +2 -2
- package/dist/functions/image/generatePaddedImage.js.map +1 -1
- package/dist/functions/image/generatePwaIcons.d.ts +3 -3
- package/dist/functions/image/generatePwaIcons.js.map +1 -1
- package/dist/functions/image/generateRoundedImage.d.ts +2 -2
- package/dist/functions/image/generateRoundedImage.js.map +1 -1
- package/dist/functions/ipc/dispatchIpcRequest.d.ts +2 -2
- package/dist/functions/ipc/dispatchIpcRequest.js +1 -1
- package/dist/functions/ipc/dispatchIpcRequest.js.map +1 -1
- package/dist/functions/software/findSoftware.d.ts +4 -5
- package/dist/functions/software/findSoftware.js +32 -20
- package/dist/functions/software/findSoftware.js.map +1 -1
- package/dist/functions/uniapp/app-plus/buildAndroidApp.d.ts +2 -2
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +97 -24
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
- package/dist/functions/uniapp/build.d.ts +20 -0
- package/dist/functions/uniapp/build.js +84 -0
- package/dist/functions/uniapp/build.js.map +1 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.d.ts +7 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.js +30 -0
- package/dist/functions/uniapp/detectAndroidProjectStructure.js.map +1 -0
- package/dist/functions/uniapp/detectProjectType.d.ts +16 -0
- package/dist/functions/uniapp/detectProjectType.js +68 -0
- package/dist/functions/uniapp/detectProjectType.js.map +1 -0
- package/dist/functions/uniapp/parseManifest.d.ts +12 -0
- package/dist/functions/uniapp/{app-plus/parseManifest.js → parseManifest.js} +9 -7
- package/dist/functions/uniapp/parseManifest.js.map +1 -0
- package/dist/functions/utils/generateExports.d.ts +16 -0
- package/dist/functions/utils/generateExports.js +34 -0
- package/dist/functions/utils/generateExports.js.map +1 -0
- package/dist/functions/vue/extractColorsFromVueFile.d.ts +3 -0
- package/dist/functions/vue/extractColorsFromVueFile.js +18 -0
- package/dist/functions/vue/extractColorsFromVueFile.js.map +1 -0
- package/dist/functions/vue/extractColorsFromVueSection.d.ts +3 -0
- package/dist/functions/vue/extractColorsFromVueSection.js +53 -0
- package/dist/functions/vue/extractColorsFromVueSection.js.map +1 -0
- package/dist/functions/vue/filterSections.d.ts +2 -0
- package/dist/functions/vue/parseVueFile.d.ts +2 -0
- package/dist/functions/xml/modifyXml.d.ts +11 -0
- package/dist/functions/xml/modifyXml.js +46 -0
- package/dist/functions/xml/modifyXml.js.map +1 -0
- package/dist/hooks/useAltool.d.ts +39 -0
- package/dist/hooks/useAltool.js +350 -0
- package/dist/hooks/useAltool.js.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +4 -4
- package/dist/hooks/useLocalStorage.js +51 -18
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useSessionStorage.d.ts +4 -4
- package/dist/hooks/useSessionStorage.js +51 -18
- package/dist/hooks/useSessionStorage.js.map +1 -1
- package/dist/hooks/useStorage.d.ts +10 -3
- package/dist/hooks/useStorage.js +33 -35
- package/dist/hooks/useStorage.js.map +1 -1
- package/dist/hooks/useStorageWithIndexedDB.d.ts +3 -4
- package/dist/hooks/useStorageWithIndexedDB.js +39 -29
- package/dist/hooks/useStorageWithIndexedDB.js.map +1 -1
- package/dist/hooks/useWebWorker.d.ts +25 -4
- package/dist/hooks/useWebWorker.js.map +1 -1
- package/dist/hooks/useWorkerFunction.d.ts +22 -4
- package/dist/hooks/useWorkerFunction.js +28 -28
- package/dist/hooks/useWorkerFunction.js.map +1 -1
- package/dist/hooks/useWorkerPool.d.ts +30 -4
- package/dist/hooks/useWorkerPool.js.map +1 -1
- package/package.json +39 -63
- package/references/arraybuffer.d.ts +109 -0
- package/references/blob.d.ts +37 -0
- package/references/browser.d.ts +69 -174
- package/references/chrome.extension.d.ts +83 -0
- package/references/console.d.ts +25 -164
- package/references/{crypto.d.ts → crypto-js.d.ts} +57 -57
- package/references/dom.d.ts +41 -0
- package/references/encoding.d.ts +24 -0
- package/references/fetch.d.ts +124 -269
- package/references/indexeddb.d.ts +49 -0
- package/references/json5.d.ts +21 -28
- package/references/location.d.ts +16 -0
- package/references/node.d.ts +116 -111
- package/references/sharp.d.ts +18 -18
- package/references/storage.d.ts +17 -111
- package/references/timer.d.ts +45 -46
- package/references/uniapp.d.ts +51 -9
- package/references/url.d.ts +55 -160
- package/references/vue.d.ts +86 -113
- package/references/webassembly.d.ts +101 -127
- package/references/wechat.d.ts +48 -48
- package/references/worker.d.ts +152 -206
- package/references/xml.d.ts +88 -55
- package/types/altool.d.ts +49 -17
- package/types/android-build.d.ts +60 -85
- package/types/color.d.ts +72 -135
- package/types/geometry.d.ts +28 -63
- package/types/platform.d.ts +4 -0
- package/types/software.d.ts +15 -0
- package/types/storage.d.ts +50 -48
- package/types/uniapp-android-build.d.ts +49 -0
- package/types/vue.d.ts +30 -0
- package/types/worker.d.ts +178 -364
- package/dist/functions/ag-grid/generateLicense.d.ts +0 -4
- package/dist/functions/ag-grid/generateLicense.js +0 -12
- package/dist/functions/ag-grid/generateLicense.js.map +0 -1
- package/dist/functions/altool/createAltoolClient.d.ts +0 -21
- package/dist/functions/altool/createAltoolClient.js +0 -59
- package/dist/functions/altool/createAltoolClient.js.map +0 -1
- package/dist/functions/altool/getAppInfo.d.ts +0 -13
- package/dist/functions/altool/getAppInfo.js +0 -92
- package/dist/functions/altool/getAppInfo.js.map +0 -1
- package/dist/functions/altool/index.d.ts +0 -10
- package/dist/functions/altool/index.js +0 -6
- package/dist/functions/altool/index.js.map +0 -1
- package/dist/functions/altool/isApiKeyAuth.d.ts +0 -2
- package/dist/functions/altool/isApiKeyAuth.js +0 -4
- package/dist/functions/altool/isApiKeyAuth.js.map +0 -1
- package/dist/functions/altool/isCredentialsAuth.d.ts +0 -2
- package/dist/functions/altool/isCredentialsAuth.js +0 -4
- package/dist/functions/altool/isCredentialsAuth.js.map +0 -1
- package/dist/functions/altool/types.d.ts +0 -26
- package/dist/functions/altool/types.js +0 -7
- package/dist/functions/altool/types.js.map +0 -1
- package/dist/functions/altool/uploadApp.d.ts +0 -6
- package/dist/functions/altool/uploadApp.js +0 -36
- package/dist/functions/altool/uploadApp.js.map +0 -1
- package/dist/functions/altool/validateApp.d.ts +0 -17
- package/dist/functions/altool/validateApp.js +0 -59
- package/dist/functions/altool/validateApp.js.map +0 -1
- package/dist/functions/base64/strToBase64.d.ts +0 -2
- package/dist/functions/base64/strToBase64.js +0 -6
- package/dist/functions/base64/strToBase64.js.map +0 -1
- package/dist/functions/color-converter/COLOR_PATTERNS.d.ts +0 -2
- package/dist/functions/color-converter/COLOR_PATTERNS.js.map +0 -1
- package/dist/functions/color-converter/colorPatterns.d.ts +0 -4
- package/dist/functions/color-converter/colorPatterns.js +0 -41
- package/dist/functions/color-converter/colorPatterns.js.map +0 -1
- package/dist/functions/color-converter/convertColor.js +0 -238
- package/dist/functions/color-converter/convertColor.js.map +0 -1
- package/dist/functions/color-converter/detectColorFormat.d.ts +0 -2
- package/dist/functions/color-converter/detectColorFormat.js +0 -19
- package/dist/functions/color-converter/detectColorFormat.js.map +0 -1
- package/dist/functions/color-converter/extractColors.d.ts +0 -16
- package/dist/functions/color-converter/extractColors.js +0 -111
- package/dist/functions/color-converter/extractColors.js.map +0 -1
- package/dist/functions/color-converter/getColorPatterns.d.ts +0 -2
- package/dist/functions/color-converter/getColorPatterns.js +0 -11
- package/dist/functions/color-converter/getColorPatterns.js.map +0 -1
- package/dist/functions/color-converter/getNamedColorMap.d.ts +0 -2
- package/dist/functions/color-converter/getNamedColorMap.js +0 -19
- package/dist/functions/color-converter/getNamedColorMap.js.map +0 -1
- package/dist/functions/color-converter/hexToRgb.d.ts +0 -2
- package/dist/functions/color-converter/hexToRgb.js +0 -42
- package/dist/functions/color-converter/hexToRgb.js.map +0 -1
- package/dist/functions/color-converter/hslToRgb.d.ts +0 -2
- package/dist/functions/color-converter/hslToRgb.js +0 -78
- package/dist/functions/color-converter/hslToRgb.js.map +0 -1
- package/dist/functions/color-converter/hueToRgb.d.ts +0 -1
- package/dist/functions/color-converter/hueToRgb.js +0 -14
- package/dist/functions/color-converter/hueToRgb.js.map +0 -1
- package/dist/functions/color-converter/isColorValue.d.ts +0 -2
- package/dist/functions/color-converter/isColorValue.js +0 -79
- package/dist/functions/color-converter/isColorValue.js.map +0 -1
- package/dist/functions/color-converter/normalizeColor.d.ts +0 -1
- package/dist/functions/color-converter/normalizeColor.js +0 -49
- package/dist/functions/color-converter/normalizeColor.js.map +0 -1
- package/dist/functions/color-converter/parseColorString.d.ts +0 -15
- package/dist/functions/color-converter/parseColorString.js +0 -116
- package/dist/functions/color-converter/parseColorString.js.map +0 -1
- package/dist/functions/color-converter/rgbToHex.d.ts +0 -2
- package/dist/functions/color-converter/rgbToHex.js +0 -65
- package/dist/functions/color-converter/rgbToHex.js.map +0 -1
- package/dist/functions/color-converter/standardizeColor.d.ts +0 -1
- package/dist/functions/color-converter/standardizeColor.js +0 -147
- package/dist/functions/color-converter/standardizeColor.js.map +0 -1
- package/dist/functions/desensitize/desensitizeName.d.ts +0 -1
- package/dist/functions/desensitize/desensitizeName.js +0 -8
- package/dist/functions/desensitize/desensitizeName.js.map +0 -1
- package/dist/functions/desensitize/desensitizePhone.d.ts +0 -1
- package/dist/functions/desensitize/desensitizePhone.js +0 -8
- package/dist/functions/desensitize/desensitizePhone.js.map +0 -1
- package/dist/functions/dom/getViewportSize.d.ts +0 -5
- package/dist/functions/dom/getViewportSize.js +0 -7
- package/dist/functions/dom/getViewportSize.js.map +0 -1
- package/dist/functions/software/buildPathExecutables.d.ts +0 -1
- package/dist/functions/software/buildPathExecutables.js +0 -4
- package/dist/functions/software/buildPathExecutables.js.map +0 -1
- package/dist/functions/software/buildSoftwarePaths.d.ts +0 -2
- package/dist/functions/software/buildSoftwarePaths.js +0 -22
- package/dist/functions/software/buildSoftwarePaths.js.map +0 -1
- package/dist/functions/software/createConfigGenerator.d.ts +0 -8
- package/dist/functions/software/createConfigGenerator.js +0 -13
- package/dist/functions/software/createConfigGenerator.js.map +0 -1
- package/dist/functions/software/detectPlatform.d.ts +0 -2
- package/dist/functions/software/detectPlatform.js +0 -4
- package/dist/functions/software/detectPlatform.js.map +0 -1
- package/dist/functions/software/find.d.ts +0 -2
- package/dist/functions/software/find.js +0 -12
- package/dist/functions/software/find.js.map +0 -1
- package/dist/functions/software/findSoftwareWithGenerator.d.ts +0 -3
- package/dist/functions/software/findSoftwareWithGenerator.js +0 -8
- package/dist/functions/software/findSoftwareWithGenerator.js.map +0 -1
- package/dist/functions/software/getConfigGenerator.d.ts +0 -2
- package/dist/functions/software/getConfigGenerator.js +0 -10
- package/dist/functions/software/getConfigGenerator.js.map +0 -1
- package/dist/functions/software/getEnvironmentSoftwarePath.d.ts +0 -1
- package/dist/functions/software/getEnvironmentSoftwarePath.js +0 -4
- package/dist/functions/software/getEnvironmentSoftwarePath.js.map +0 -1
- package/dist/functions/software/getSupportedSoftware.d.ts +0 -1
- package/dist/functions/software/getSupportedSoftware.js +0 -5
- package/dist/functions/software/getSupportedSoftware.js.map +0 -1
- package/dist/functions/software/parseEnvironmentPaths.d.ts +0 -1
- package/dist/functions/software/parseEnvironmentPaths.js +0 -7
- package/dist/functions/software/parseEnvironmentPaths.js.map +0 -1
- package/dist/functions/software/softwareConfigs.d.ts +0 -2
- package/dist/functions/software/softwareConfigs.js +0 -148
- package/dist/functions/software/softwareConfigs.js.map +0 -1
- package/dist/functions/software/softwareNameMap.d.ts +0 -1
- package/dist/functions/software/softwareNameMap.js +0 -9
- package/dist/functions/software/softwareNameMap.js.map +0 -1
- package/dist/functions/software/types.d.ts +0 -11
- package/dist/functions/software/types.js +0 -2
- package/dist/functions/software/types.js.map +0 -1
- package/dist/functions/string/camelCase.d.ts +0 -1
- package/dist/functions/string/camelCase.js +0 -8
- package/dist/functions/string/camelCase.js.map +0 -1
- package/dist/functions/string/capitalize.d.ts +0 -1
- package/dist/functions/string/capitalize.js +0 -6
- package/dist/functions/string/capitalize.js.map +0 -1
- package/dist/functions/string/escape.d.ts +0 -1
- package/dist/functions/string/escape.js +0 -13
- package/dist/functions/string/escape.js.map +0 -1
- package/dist/functions/string/kebabCase.d.ts +0 -1
- package/dist/functions/string/kebabCase.js +0 -10
- package/dist/functions/string/kebabCase.js.map +0 -1
- package/dist/functions/string/levenshtein.d.ts +0 -1
- package/dist/functions/string/levenshtein.js +0 -27
- package/dist/functions/string/levenshtein.js.map +0 -1
- package/dist/functions/string/mask.d.ts +0 -1
- package/dist/functions/string/mask.js +0 -40
- package/dist/functions/string/mask.js.map +0 -1
- package/dist/functions/string/normalize.d.ts +0 -8
- package/dist/functions/string/normalize.js +0 -37
- package/dist/functions/string/normalize.js.map +0 -1
- package/dist/functions/string/padEnd.d.ts +0 -1
- package/dist/functions/string/padEnd.js +0 -8
- package/dist/functions/string/padEnd.js.map +0 -1
- package/dist/functions/string/padStart.d.ts +0 -1
- package/dist/functions/string/padStart.js +0 -8
- package/dist/functions/string/padStart.js.map +0 -1
- package/dist/functions/string/palindrome.d.ts +0 -3
- package/dist/functions/string/palindrome.js +0 -15
- package/dist/functions/string/palindrome.js.map +0 -1
- package/dist/functions/string/pascalCase.d.ts +0 -1
- package/dist/functions/string/pascalCase.js +0 -8
- package/dist/functions/string/pascalCase.js.map +0 -1
- package/dist/functions/string/similarity.d.ts +0 -1
- package/dist/functions/string/similarity.js +0 -38
- package/dist/functions/string/similarity.js.map +0 -1
- package/dist/functions/string/snakeCase.d.ts +0 -1
- package/dist/functions/string/snakeCase.js +0 -10
- package/dist/functions/string/snakeCase.js.map +0 -1
- package/dist/functions/string/template.d.ts +0 -4
- package/dist/functions/string/template.js +0 -21
- package/dist/functions/string/template.js.map +0 -1
- package/dist/functions/string/unescape.d.ts +0 -1
- package/dist/functions/string/unescape.js +0 -13
- package/dist/functions/string/unescape.js.map +0 -1
- package/dist/functions/string/wordCount.d.ts +0 -5
- package/dist/functions/string/wordCount.js +0 -11
- package/dist/functions/string/wordCount.js.map +0 -1
- package/dist/functions/tencent-cloud/getSecret.d.ts +0 -7
- package/dist/functions/tencent-cloud/getSecret.js +0 -19
- package/dist/functions/tencent-cloud/getSecret.js.map +0 -1
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.d.ts +0 -13
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js +0 -175
- package/dist/functions/uniapp/app-plus/androidProjectConfigSteps.js.map +0 -1
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.d.ts +0 -33
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.js +0 -60
- package/dist/functions/uniapp/app-plus/androidProjectStrategy.js.map +0 -1
- package/dist/functions/uniapp/app-plus/buildAndroidProject.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/buildAndroidProject.js +0 -60
- package/dist/functions/uniapp/app-plus/buildAndroidProject.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.js +0 -51
- package/dist/functions/uniapp/app-plus/configureAndroidManifest.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureAndroidProject.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/configureAndroidProject.js +0 -63
- package/dist/functions/uniapp/app-plus/configureAndroidProject.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureBuildGradle.d.ts +0 -9
- package/dist/functions/uniapp/app-plus/configureBuildGradle.js +0 -57
- package/dist/functions/uniapp/app-plus/configureBuildGradle.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureDcloudControl.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureDcloudControl.js +0 -34
- package/dist/functions/uniapp/app-plus/configureDcloudControl.js.map +0 -1
- package/dist/functions/uniapp/app-plus/configureStrings.d.ts +0 -5
- package/dist/functions/uniapp/app-plus/configureStrings.js +0 -42
- package/dist/functions/uniapp/app-plus/configureStrings.js.map +0 -1
- package/dist/functions/uniapp/app-plus/copyAppResources.d.ts +0 -8
- package/dist/functions/uniapp/app-plus/copyAppResources.js +0 -25
- package/dist/functions/uniapp/app-plus/copyAppResources.js.map +0 -1
- package/dist/functions/uniapp/app-plus/copyDirectory.d.ts +0 -2
- package/dist/functions/uniapp/app-plus/copyDirectory.js +0 -18
- package/dist/functions/uniapp/app-plus/copyDirectory.js.map +0 -1
- package/dist/functions/uniapp/app-plus/generateUniAppResources.d.ts +0 -2
- package/dist/functions/uniapp/app-plus/generateUniAppResources.js +0 -35
- package/dist/functions/uniapp/app-plus/generateUniAppResources.js.map +0 -1
- package/dist/functions/uniapp/app-plus/parseManifest.d.ts +0 -14
- package/dist/functions/uniapp/app-plus/parseManifest.js.map +0 -1
- package/dist/functions/uniapp/app-plus/validateOptions.d.ts +0 -3
- package/dist/functions/uniapp/app-plus/validateOptions.js +0 -10
- package/dist/functions/uniapp/app-plus/validateOptions.js.map +0 -1
- package/dist/functions/uniapp/waitForPages.d.ts +0 -2
- package/dist/functions/uniapp/waitForPages.js +0 -19
- package/dist/functions/uniapp/waitForPages.js.map +0 -1
- package/dist/functions/utils/compose.d.ts +0 -1
- package/dist/functions/utils/compose.js +0 -10
- package/dist/functions/utils/compose.js.map +0 -1
- package/dist/functions/utils/cond.d.ts +0 -1
- package/dist/functions/utils/cond.js +0 -15
- package/dist/functions/utils/cond.js.map +0 -1
- package/dist/functions/utils/curry.d.ts +0 -1
- package/dist/functions/utils/curry.js +0 -13
- package/dist/functions/utils/curry.js.map +0 -1
- package/dist/functions/utils/debounce.d.ts +0 -1
- package/dist/functions/utils/debounce.js +0 -13
- package/dist/functions/utils/debounce.js.map +0 -1
- package/dist/functions/utils/evolve.d.ts +0 -3
- package/dist/functions/utils/evolve.js +0 -15
- package/dist/functions/utils/evolve.js.map +0 -1
- package/dist/functions/utils/flow.d.ts +0 -1
- package/dist/functions/utils/flow.js +0 -10
- package/dist/functions/utils/flow.js.map +0 -1
- package/dist/functions/utils/isType.d.ts +0 -11
- package/dist/functions/utils/isType.js +0 -30
- package/dist/functions/utils/isType.js.map +0 -1
- package/dist/functions/utils/memoize.d.ts +0 -1
- package/dist/functions/utils/memoize.js +0 -13
- package/dist/functions/utils/memoize.js.map +0 -1
- package/dist/functions/utils/once.d.ts +0 -1
- package/dist/functions/utils/once.js +0 -13
- package/dist/functions/utils/once.js.map +0 -1
- package/dist/functions/utils/partial.d.ts +0 -1
- package/dist/functions/utils/partial.js +0 -13
- package/dist/functions/utils/partial.js.map +0 -1
- package/dist/functions/utils/pipe.d.ts +0 -1
- package/dist/functions/utils/pipe.js +0 -10
- package/dist/functions/utils/pipe.js.map +0 -1
- package/dist/functions/utils/retryWithBackoff.d.ts +0 -9
- package/dist/functions/utils/retryWithBackoff.js +0 -30
- package/dist/functions/utils/retryWithBackoff.js.map +0 -1
- package/dist/functions/utils/tap.d.ts +0 -1
- package/dist/functions/utils/tap.js +0 -14
- package/dist/functions/utils/tap.js.map +0 -1
- package/dist/functions/utils/throttle.d.ts +0 -1
- package/dist/functions/utils/throttle.js +0 -11
- package/dist/functions/utils/throttle.js.map +0 -1
- package/dist/functions/utils/until.d.ts +0 -1
- package/dist/functions/utils/until.js +0 -10
- package/dist/functions/utils/until.js.map +0 -1
- package/dist/functions/utils/validate.d.ts +0 -8
- package/dist/functions/utils/validate.js +0 -45
- package/dist/functions/utils/validate.js.map +0 -1
- package/dist/functions/vue/dynamicMount.d.ts +0 -15
- package/dist/functions/vue/dynamicMount.js +0 -23
- package/dist/functions/vue/dynamicMount.js.map +0 -1
- package/dist/functions/vue/isVNode.d.ts +0 -2
- package/dist/functions/vue/isVNode.js +0 -4
- package/dist/functions/vue/isVNode.js.map +0 -1
- package/dist/functions/vue/isVueComponent.d.ts +0 -2
- package/dist/functions/vue/isVueComponent.js +0 -6
- package/dist/functions/vue/isVueComponent.js.map +0 -1
- package/dist/functions/vue/processVueFile.d.ts +0 -20
- package/dist/functions/vue/processVueFile.js +0 -98
- package/dist/functions/vue/processVueFile.js.map +0 -1
- package/dist/functions/wechat/miniapp/downloadFile.d.ts +0 -2
- package/dist/functions/wechat/miniapp/downloadFile.js +0 -39
- package/dist/functions/wechat/miniapp/downloadFile.js.map +0 -1
- package/dist/hooks/useAi.d.ts +0 -27
- package/dist/hooks/useAi.js +0 -163
- package/dist/hooks/useAi.js.map +0 -1
- package/dist/hooks/useCache.d.ts +0 -18
- package/dist/hooks/useCache.js +0 -82
- package/dist/hooks/useCache.js.map +0 -1
- package/dist/hooks/useFetch.d.ts +0 -3
- package/dist/hooks/useFetch.js +0 -154
- package/dist/hooks/useFetch.js.map +0 -1
- package/dist/hooks/usePluginSystem.d.ts +0 -11
- package/dist/hooks/usePluginSystem.js +0 -34
- package/dist/hooks/usePluginSystem.js.map +0 -1
- package/dist/hooks/useRequest.d.ts +0 -3
- package/dist/hooks/useRequest.js +0 -139
- package/dist/hooks/useRequest.js.map +0 -1
- package/dist/hooks/useWASM.d.ts +0 -4
- package/dist/hooks/useWASM.js +0 -267
- package/dist/hooks/useWASM.js.map +0 -1
- package/references/browser.extension.d.ts +0 -14
- package/types/network.d.ts +0 -184
- package/types/util.d.ts +0 -27
- package/types/wasm.d.ts +0 -217
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { isApiKeyAuth } from './isApiKeyAuth';
|
|
2
|
-
function parseAppInfoOutput(output, outputFormat) {
|
|
3
|
-
const apps = [];
|
|
4
|
-
if (outputFormat === 'xml') {
|
|
5
|
-
const appMatches = output.match(/<dict[^>]*>[\s\S]*?<\/dict>/g) || [];
|
|
6
|
-
for (const appMatch of appMatches) {
|
|
7
|
-
const bundleIdMatch = appMatch.match(/<key>CFBundleIdentifier<\/key>\s*<string>([^<]+)<\/string>/);
|
|
8
|
-
const nameMatch = appMatch.match(/<key>CFBundleDisplayName<\/key>\s*<string>([^<]+)<\/string>/);
|
|
9
|
-
const versionMatch = appMatch.match(/<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/string>/);
|
|
10
|
-
const buildMatch = appMatch.match(/<key>CFBundleVersion<\/key>\s*<string>([^<]+)<\/string>/);
|
|
11
|
-
if (bundleIdMatch) {
|
|
12
|
-
apps.push({
|
|
13
|
-
bundleId: bundleIdMatch[1],
|
|
14
|
-
name: nameMatch?.[1] || '',
|
|
15
|
-
version: versionMatch?.[1] || '',
|
|
16
|
-
buildNumber: buildMatch?.[1] || '',
|
|
17
|
-
status: 'Unknown'
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
const lines = output.split('\n');
|
|
24
|
-
let currentApp = {};
|
|
25
|
-
for (const line of lines) {
|
|
26
|
-
const trimmedLine = line.trim();
|
|
27
|
-
if (trimmedLine.includes('Bundle ID:')) {
|
|
28
|
-
currentApp.bundleId = trimmedLine.split('Bundle ID:')[1]?.trim();
|
|
29
|
-
}
|
|
30
|
-
else if (trimmedLine.includes('Name:')) {
|
|
31
|
-
currentApp.name = trimmedLine.split('Name:')[1]?.trim();
|
|
32
|
-
}
|
|
33
|
-
else if (trimmedLine.includes('Version:')) {
|
|
34
|
-
currentApp.version = trimmedLine.split('Version:')[1]?.trim();
|
|
35
|
-
}
|
|
36
|
-
else if (trimmedLine.includes('Build:')) {
|
|
37
|
-
currentApp.buildNumber = trimmedLine.split('Build:')[1]?.trim();
|
|
38
|
-
}
|
|
39
|
-
else if (trimmedLine.includes('Status:')) {
|
|
40
|
-
currentApp.status = trimmedLine.split('Status:')[1]?.trim();
|
|
41
|
-
if (currentApp.bundleId) {
|
|
42
|
-
apps.push({
|
|
43
|
-
bundleId: currentApp.bundleId,
|
|
44
|
-
name: currentApp.name || '',
|
|
45
|
-
version: currentApp.version || '',
|
|
46
|
-
buildNumber: currentApp.buildNumber || '',
|
|
47
|
-
status: currentApp.status || 'Unknown'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
currentApp = {};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return apps;
|
|
55
|
-
}
|
|
56
|
-
export async function getAppInfo(altoolPath, options, childProcess) {
|
|
57
|
-
const { type, auth, outputFormat = 'normal' } = options;
|
|
58
|
-
const args = [
|
|
59
|
-
'--list-apps',
|
|
60
|
-
'--type', type,
|
|
61
|
-
'--output-format', outputFormat
|
|
62
|
-
];
|
|
63
|
-
if (isApiKeyAuth(auth)) {
|
|
64
|
-
args.push('--apiKey', auth.apiKey);
|
|
65
|
-
args.push('--apiIssuer', auth.apiIssuer);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
args.push('--username', auth.username);
|
|
69
|
-
args.push('--password', auth.password);
|
|
70
|
-
}
|
|
71
|
-
const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
|
|
72
|
-
return new Promise((resolve, reject) => {
|
|
73
|
-
childProcess.exec(command, (error, stdout, stderr) => {
|
|
74
|
-
const output = stdout || '';
|
|
75
|
-
const errorOutput = stderr || '';
|
|
76
|
-
if (error) {
|
|
77
|
-
const errorMessage = errorOutput || error.message;
|
|
78
|
-
reject(new Error(errorMessage));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
try {
|
|
82
|
-
const apps = parseAppInfoOutput(output, outputFormat);
|
|
83
|
-
resolve(apps);
|
|
84
|
-
}
|
|
85
|
-
catch (parseError) {
|
|
86
|
-
reject(new Error(`Failed to parse app info: ${parseError}`));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=getAppInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAppInfo.js","sourceRoot":"","sources":["../../../src/functions/altool/getAppInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmC7C,SAAS,kBAAkB,CAAC,MAAc,EAAE,YAAoB;IAC9D,MAAM,IAAI,GAAc,EAAE,CAAA;IAE1B,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;QAE3B,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAA;QAErE,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAA;YAClG,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAC/F,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAA;YACzG,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAA;YAE5F,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,CAAC;oBACR,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;oBAC1B,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;oBAC1B,OAAO,EAAE,YAAY,EAAE,CAAC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,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IAE1E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACnD,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAA;YAC3B,MAAM,WAAW,GAAG,MAAM,IAAI,EAAE,CAAA;YAEhC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,YAAY,GAAG,WAAW,IAAI,KAAK,CAAC,OAAO,CAAA;gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;YACjC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC;oBACH,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;oBACrD,OAAO,CAAC,IAAI,CAAC,CAAA;gBACf,CAAC;gBAAC,OAAO,UAAU,EAAE,CAAC;oBACpB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAC,CAAA;gBAC9D,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type { AltoolAppType, AltoolOutputFormat, AltoolAuthCredentials, AltoolAuthApiKey, AltoolAuth, AltoolBaseOptions, AltoolCommand, AltoolBaseResult } from './types';
|
|
2
|
-
export { isApiKeyAuth, isCredentialsAuth } from './types';
|
|
3
|
-
export type { AltoolUploadOptions, AltoolUploadResult } from './uploadApp';
|
|
4
|
-
export { uploadApp } from './uploadApp';
|
|
5
|
-
export type { AltoolValidateOptions, AltoolValidateResult } from './validateApp';
|
|
6
|
-
export { validateApp } from './validateApp';
|
|
7
|
-
export type { AltoolAppInfoOptions, AppInfo, AltoolAppInfoResult } from './getAppInfo';
|
|
8
|
-
export { getAppInfo } from './getAppInfo';
|
|
9
|
-
export type { AltoolClientConfig, AltoolClient } from './createAltoolClient';
|
|
10
|
-
export { createAltoolClient } from './createAltoolClient';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { isApiKeyAuth, isCredentialsAuth } from './types';
|
|
2
|
-
export { uploadApp } from './uploadApp';
|
|
3
|
-
export { validateApp } from './validateApp';
|
|
4
|
-
export { getAppInfo } from './getAppInfo';
|
|
5
|
-
export { createAltoolClient } from './createAltoolClient';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/altool/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,YAAY,EACZ,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAQhB,OAAO,EACL,SAAS,EACV,MAAM,aAAa,CAAA;AAQpB,OAAO,EACL,WAAW,EACZ,MAAM,eAAe,CAAA;AAStB,OAAO,EACL,UAAU,EACX,MAAM,cAAc,CAAA;AAQrB,OAAO,EACL,kBAAkB,EACnB,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isApiKeyAuth.js","sourceRoot":"","sources":["../../../src/functions/altool/isApiKeyAuth.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,QAAQ,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAA;AAChD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isCredentialsAuth.js","sourceRoot":"","sources":["../../../src/functions/altool/isCredentialsAuth.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAA;AACjD,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export type AltoolAppType = 'ios-app' | 'osx-app' | 'appletvos-app';
|
|
2
|
-
export type AltoolOutputFormat = 'xml' | 'normal';
|
|
3
|
-
export interface AltoolAuthCredentials {
|
|
4
|
-
username: string;
|
|
5
|
-
password: string;
|
|
6
|
-
}
|
|
7
|
-
export interface AltoolAuthApiKey {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
apiIssuer: string;
|
|
10
|
-
}
|
|
11
|
-
export type AltoolAuth = AltoolAuthCredentials | AltoolAuthApiKey;
|
|
12
|
-
export interface AltoolBaseOptions {
|
|
13
|
-
type: AltoolAppType;
|
|
14
|
-
outputFormat?: AltoolOutputFormat;
|
|
15
|
-
auth: AltoolAuth;
|
|
16
|
-
}
|
|
17
|
-
export type AltoolCommand = 'upload-app' | 'validate-app' | 'list-apps';
|
|
18
|
-
export interface AltoolBaseResult {
|
|
19
|
-
success: boolean;
|
|
20
|
-
output: string;
|
|
21
|
-
error?: string;
|
|
22
|
-
exitCode: number;
|
|
23
|
-
command: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function isApiKeyAuth(auth: AltoolAuth): auth is AltoolAuthApiKey;
|
|
26
|
-
export declare function isCredentialsAuth(auth: AltoolAuth): auth is AltoolAuthCredentials;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/functions/altool/types.ts"],"names":[],"mappings":"AAuEA,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,QAAQ,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAA;AAChD,CAAC;AAOD,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAA;AACjD,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { NodeChildProcess } from '../../../references/node.d';
|
|
2
|
-
import type { AltoolBaseOptions } from '../../../types/altool.d';
|
|
3
|
-
export interface AltoolUploadOptions extends AltoolBaseOptions {
|
|
4
|
-
file: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function uploadApp(altoolPath: string, options: AltoolUploadOptions, childProcess: NodeChildProcess): Promise<string>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { isApiKeyAuth } from './isApiKeyAuth';
|
|
2
|
-
export async function uploadApp(altoolPath, options, childProcess) {
|
|
3
|
-
const { file, type, auth, outputFormat = 'normal' } = options;
|
|
4
|
-
const args = [
|
|
5
|
-
'--upload-app',
|
|
6
|
-
'--file', file,
|
|
7
|
-
'--type', type,
|
|
8
|
-
'--output-format', outputFormat
|
|
9
|
-
];
|
|
10
|
-
if (isApiKeyAuth(auth)) {
|
|
11
|
-
args.push('--apiKey', auth.apiKey);
|
|
12
|
-
args.push('--apiIssuer', auth.apiIssuer);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
args.push('--username', auth.username);
|
|
16
|
-
args.push('--password', auth.password);
|
|
17
|
-
}
|
|
18
|
-
const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
childProcess.exec(command, (error, stdout, stderr) => {
|
|
21
|
-
const output = stdout || '';
|
|
22
|
-
const errorOutput = stderr || '';
|
|
23
|
-
if (error) {
|
|
24
|
-
const errorMessage = errorOutput || error.message;
|
|
25
|
-
reject(new Error(`altool上传失败: ${errorMessage}`));
|
|
26
|
-
}
|
|
27
|
-
else if (errorOutput && errorOutput.includes('error')) {
|
|
28
|
-
reject(new Error(`altool上传过程中出现错误: ${errorOutput}`));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
resolve(output);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=uploadApp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uploadApp.js","sourceRoot":"","sources":["../../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AW,IAAI,KAAK,CAAC,OAAO,CAAA;gBACjD,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,YAAY,EAAE,CAAC,CAAC,CAAA;YAClD,CAAC;iBAAM,IAAI,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxD,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC,CAAA;YACtD,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NodeChildProcess } from '../../../references/node.d';
|
|
2
|
-
import type { AltoolBaseOptions } from '../../../types/altool.d';
|
|
3
|
-
export interface AltoolValidateOptions extends AltoolBaseOptions {
|
|
4
|
-
file: string;
|
|
5
|
-
}
|
|
6
|
-
export interface AltoolValidateResult {
|
|
7
|
-
hasWarnings: boolean;
|
|
8
|
-
hasErrors: boolean;
|
|
9
|
-
warnings: string[];
|
|
10
|
-
errors: string[];
|
|
11
|
-
}
|
|
12
|
-
export declare function validateApp(altoolPath: string, options: AltoolValidateOptions, childProcess: NodeChildProcess): Promise<{
|
|
13
|
-
hasWarnings: boolean;
|
|
14
|
-
hasErrors: boolean;
|
|
15
|
-
warnings: string[];
|
|
16
|
-
errors: string[];
|
|
17
|
-
}>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { isApiKeyAuth } from './isApiKeyAuth';
|
|
2
|
-
function parseValidationOutput(output) {
|
|
3
|
-
const warnings = [];
|
|
4
|
-
const errors = [];
|
|
5
|
-
const lines = output.split('\n');
|
|
6
|
-
for (const line of lines) {
|
|
7
|
-
const trimmedLine = line.trim();
|
|
8
|
-
if (trimmedLine.includes('WARNING:') || trimmedLine.includes('Warning:')) {
|
|
9
|
-
warnings.push(trimmedLine);
|
|
10
|
-
}
|
|
11
|
-
else if (trimmedLine.includes('ERROR:') || trimmedLine.includes('Error:')) {
|
|
12
|
-
errors.push(trimmedLine);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
hasWarnings: warnings.length > 0,
|
|
17
|
-
hasErrors: errors.length > 0,
|
|
18
|
-
warnings,
|
|
19
|
-
errors
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export async function validateApp(altoolPath, options, childProcess) {
|
|
23
|
-
const { file, type, auth, outputFormat = 'normal' } = options;
|
|
24
|
-
const args = [
|
|
25
|
-
'--validate-app',
|
|
26
|
-
'--file', file,
|
|
27
|
-
'--type', type,
|
|
28
|
-
'--output-format', outputFormat
|
|
29
|
-
];
|
|
30
|
-
if (isApiKeyAuth(auth)) {
|
|
31
|
-
args.push('--apiKey', auth.apiKey);
|
|
32
|
-
args.push('--apiIssuer', auth.apiIssuer);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
args.push('--username', auth.username);
|
|
36
|
-
args.push('--password', auth.password);
|
|
37
|
-
}
|
|
38
|
-
const command = `"${altoolPath}" ${args.map(arg => `"${arg}"`).join(' ')}`;
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
childProcess.exec(command, (error, stdout, stderr) => {
|
|
41
|
-
const output = stdout || '';
|
|
42
|
-
const errorOutput = stderr || '';
|
|
43
|
-
const validationDetails = parseValidationOutput(output + errorOutput);
|
|
44
|
-
if (error) {
|
|
45
|
-
const errorMessage = errorOutput || error.message;
|
|
46
|
-
reject(new Error(errorMessage));
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
if (validationDetails.hasErrors) {
|
|
50
|
-
reject(new Error('Validation failed with errors: ' + validationDetails.errors.join(', ')));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
resolve(validationDetails);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//#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AAA;gBAC5F,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,iBAAiB,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strToBase64.js","sourceRoot":"","sources":["../../../src/functions/base64/strToBase64.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,aAA4B,EAAU,EAAE;IAC/E,OAAO,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACzF,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"COLOR_PATTERNS.js","sourceRoot":"","sources":["../../../src/functions/color-converter/COLOR_PATTERNS.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,MAAM,cAAc,GAAkB;IAE3C,GAAG,EAAE,kEAAkE;IAGvE,GAAG,EAAE,8CAA8C;IAGnD,IAAI,EAAE,8DAA8D;IAGpE,GAAG,EAAE,gDAAgD;IAGrD,IAAI,EAAE,gEAAgE;IAGtE,WAAW,EAAE,wFAAwF;CACtG,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ColorPatterns, NamedColorMap } from '../../../types/color.d';
|
|
2
|
-
export declare const COLOR_PATTERNS: ColorPatterns;
|
|
3
|
-
export declare const NAMED_COLOR_MAP: NamedColorMap;
|
|
4
|
-
export declare function detectColorFormat(color: string): keyof ColorPatterns | undefined;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const COLOR_PATTERNS = {
|
|
2
|
-
hex: /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,
|
|
3
|
-
rgb: /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,
|
|
4
|
-
rgba: /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/,
|
|
5
|
-
hsl: /^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$/,
|
|
6
|
-
hsla: /^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d.]+)\s*\)$/,
|
|
7
|
-
namedColors: /^(red|green|blue|yellow|orange|purple|pink|brown|black|white|gray|grey|cyan|magenta)$/i
|
|
8
|
-
};
|
|
9
|
-
export const NAMED_COLOR_MAP = {
|
|
10
|
-
'red': '#ff0000',
|
|
11
|
-
'green': '#00ff00',
|
|
12
|
-
'blue': '#0000ff',
|
|
13
|
-
'yellow': '#ffff00',
|
|
14
|
-
'orange': '#ffa500',
|
|
15
|
-
'purple': '#800080',
|
|
16
|
-
'pink': '#ffc0cb',
|
|
17
|
-
'brown': '#a52a2a',
|
|
18
|
-
'black': '#000000',
|
|
19
|
-
'white': '#ffffff',
|
|
20
|
-
'gray': '#808080',
|
|
21
|
-
'grey': '#808080',
|
|
22
|
-
'cyan': '#00ffff',
|
|
23
|
-
'magenta': '#ff00ff'
|
|
24
|
-
};
|
|
25
|
-
export function detectColorFormat(color) {
|
|
26
|
-
const trimmedColor = color.trim();
|
|
27
|
-
if (COLOR_PATTERNS.hex.test(trimmedColor))
|
|
28
|
-
return 'hex';
|
|
29
|
-
if (COLOR_PATTERNS.rgba.test(trimmedColor))
|
|
30
|
-
return 'rgba';
|
|
31
|
-
if (COLOR_PATTERNS.rgb.test(trimmedColor))
|
|
32
|
-
return 'rgb';
|
|
33
|
-
if (COLOR_PATTERNS.hsla.test(trimmedColor))
|
|
34
|
-
return 'hsla';
|
|
35
|
-
if (COLOR_PATTERNS.hsl.test(trimmedColor))
|
|
36
|
-
return 'hsl';
|
|
37
|
-
if (COLOR_PATTERNS.namedColors.test(trimmedColor))
|
|
38
|
-
return 'namedColors';
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=colorPatterns.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colorPatterns.js","sourceRoot":"","sources":["../../../src/functions/color-converter/colorPatterns.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,cAAc,GAAkB;IAE3C,GAAG,EAAE,kEAAkE;IAGvE,GAAG,EAAE,8CAA8C;IAGnD,IAAI,EAAE,8DAA8D;IAGpE,GAAG,EAAE,gDAAgD;IAGrD,IAAI,EAAE,gEAAgE;IAGtE,WAAW,EAAE,wFAAwF;CACtG,CAAA;AAKD,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;CACrB,CAAA;AAOD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAEjC,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,MAAM,CAAA;IACzD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,MAAM,CAAA;IACzD,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,aAAa,CAAA;IAEvE,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { parseColorString, isValidRgbColor, isValidHslColor } from './parseColorString';
|
|
2
|
-
import { hueToRgb } from './hueToRgb';
|
|
3
|
-
import { getNamedColorMap } from './getNamedColorMap';
|
|
4
|
-
import { detectColorFormat } from './detectColorFormat';
|
|
5
|
-
export function convertColor(input, targetFormat, options = {}) {
|
|
6
|
-
const { includeAlpha = false, precision = 0 } = options;
|
|
7
|
-
function normalizeInput(input) {
|
|
8
|
-
if (Array.isArray(input)) {
|
|
9
|
-
if (input.length >= 3) {
|
|
10
|
-
const [r, g, b, a = 1] = input;
|
|
11
|
-
if (typeof r === 'number' && typeof g === 'number' && typeof b === 'number') {
|
|
12
|
-
const rgb = { r: Math.round(r), g: Math.round(g), b: Math.round(b) };
|
|
13
|
-
if (isValidRgbColor(rgb)) {
|
|
14
|
-
return { rgb, alpha: typeof a === 'number' ? a : 1, originalFormat: 'rgb' };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
if (typeof input === 'object' && input !== null) {
|
|
21
|
-
if ('r' in input && 'g' in input && 'b' in input) {
|
|
22
|
-
const rgb = input;
|
|
23
|
-
if (isValidRgbColor(rgb)) {
|
|
24
|
-
const alpha = 'a' in input ? input.a : 1;
|
|
25
|
-
return { rgb, alpha, originalFormat: 'a' in input ? 'rgba' : 'rgb' };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if ('h' in input && 's' in input && 'l' in input) {
|
|
29
|
-
const hsl = input;
|
|
30
|
-
if (isValidHslColor(hsl)) {
|
|
31
|
-
const rgb = hslToRgbInternal(hsl);
|
|
32
|
-
if (rgb) {
|
|
33
|
-
const alpha = 'a' in input ? input.a : 1;
|
|
34
|
-
return { rgb, alpha, originalFormat: 'a' in input ? 'hsla' : 'hsl' };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
if (typeof input === 'string') {
|
|
41
|
-
const trimmed = input.trim();
|
|
42
|
-
const format = detectColorFormat(trimmed);
|
|
43
|
-
if (!format) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
switch (format) {
|
|
47
|
-
case 'hex':
|
|
48
|
-
return parseHexColor(trimmed);
|
|
49
|
-
case 'rgb':
|
|
50
|
-
case 'rgba': {
|
|
51
|
-
const parseResult = parseColorString(trimmed);
|
|
52
|
-
if (parseResult.isValid && (parseResult.type === 'rgb' || parseResult.type === 'rgba')) {
|
|
53
|
-
const value = parseResult.value;
|
|
54
|
-
return {
|
|
55
|
-
rgb: { r: value.r, g: value.g, b: value.b },
|
|
56
|
-
alpha: value.a ?? 1,
|
|
57
|
-
originalFormat: parseResult.type
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case 'hsl':
|
|
63
|
-
case 'hsla': {
|
|
64
|
-
const parseResult = parseColorString(trimmed);
|
|
65
|
-
if (parseResult.isValid && (parseResult.type === 'hsl' || parseResult.type === 'hsla')) {
|
|
66
|
-
const value = parseResult.value;
|
|
67
|
-
const rgb = hslToRgbInternal(value);
|
|
68
|
-
if (rgb) {
|
|
69
|
-
return {
|
|
70
|
-
rgb,
|
|
71
|
-
alpha: value.a ?? 1,
|
|
72
|
-
originalFormat: parseResult.type
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case 'named': {
|
|
79
|
-
const namedColorMap = getNamedColorMap();
|
|
80
|
-
const hexValue = namedColorMap[trimmed.toLowerCase()];
|
|
81
|
-
if (hexValue) {
|
|
82
|
-
const result = parseHexColor(hexValue);
|
|
83
|
-
if (result) {
|
|
84
|
-
return { ...result, originalFormat: 'named' };
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
function parseHexColor(hex) {
|
|
94
|
-
const cleanHex = hex.replace(/^#/, '');
|
|
95
|
-
if (!/^[0-9a-fA-F]+$/.test(cleanHex)) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
let r, g, b, alpha = 1;
|
|
99
|
-
switch (cleanHex.length) {
|
|
100
|
-
case 3:
|
|
101
|
-
r = parseInt(cleanHex[0] + cleanHex[0], 16);
|
|
102
|
-
g = parseInt(cleanHex[1] + cleanHex[1], 16);
|
|
103
|
-
b = parseInt(cleanHex[2] + cleanHex[2], 16);
|
|
104
|
-
break;
|
|
105
|
-
case 4:
|
|
106
|
-
r = parseInt(cleanHex[0] + cleanHex[0], 16);
|
|
107
|
-
g = parseInt(cleanHex[1] + cleanHex[1], 16);
|
|
108
|
-
b = parseInt(cleanHex[2] + cleanHex[2], 16);
|
|
109
|
-
alpha = parseInt(cleanHex[3] + cleanHex[3], 16) / 255;
|
|
110
|
-
break;
|
|
111
|
-
case 6:
|
|
112
|
-
r = parseInt(cleanHex.substring(0, 2), 16);
|
|
113
|
-
g = parseInt(cleanHex.substring(2, 4), 16);
|
|
114
|
-
b = parseInt(cleanHex.substring(4, 6), 16);
|
|
115
|
-
break;
|
|
116
|
-
case 8:
|
|
117
|
-
r = parseInt(cleanHex.substring(0, 2), 16);
|
|
118
|
-
g = parseInt(cleanHex.substring(2, 4), 16);
|
|
119
|
-
b = parseInt(cleanHex.substring(4, 6), 16);
|
|
120
|
-
alpha = parseInt(cleanHex.substring(6, 8), 16) / 255;
|
|
121
|
-
break;
|
|
122
|
-
default:
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(alpha)) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
rgb: { r, g, b },
|
|
130
|
-
alpha,
|
|
131
|
-
originalFormat: 'hex'
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function hslToRgbInternal(hsl) {
|
|
135
|
-
let h = hsl.h % 360;
|
|
136
|
-
if (h < 0)
|
|
137
|
-
h += 360;
|
|
138
|
-
const s = Math.max(0, Math.min(100, hsl.s)) / 100;
|
|
139
|
-
const l = Math.max(0, Math.min(100, hsl.l)) / 100;
|
|
140
|
-
if (s === 0) {
|
|
141
|
-
const gray = Math.round(l * 255);
|
|
142
|
-
return { r: gray, g: gray, b: gray };
|
|
143
|
-
}
|
|
144
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
145
|
-
const p = 2 * l - q;
|
|
146
|
-
const hNormalized = h / 360;
|
|
147
|
-
const r = hueToRgb(p, q, hNormalized + 1 / 3);
|
|
148
|
-
const g = hueToRgb(p, q, hNormalized);
|
|
149
|
-
const b = hueToRgb(p, q, hNormalized - 1 / 3);
|
|
150
|
-
return {
|
|
151
|
-
r: Math.round(r * 255),
|
|
152
|
-
g: Math.round(g * 255),
|
|
153
|
-
b: Math.round(b * 255)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function rgbToHslInternal(rgb) {
|
|
157
|
-
const r = rgb.r / 255;
|
|
158
|
-
const g = rgb.g / 255;
|
|
159
|
-
const b = rgb.b / 255;
|
|
160
|
-
const max = Math.max(r, g, b);
|
|
161
|
-
const min = Math.min(r, g, b);
|
|
162
|
-
const diff = max - min;
|
|
163
|
-
let h = 0;
|
|
164
|
-
let s = 0;
|
|
165
|
-
const l = (max + min) / 2;
|
|
166
|
-
if (diff !== 0) {
|
|
167
|
-
s = l > 0.5 ? diff / (2 - max - min) : diff / (max + min);
|
|
168
|
-
switch (max) {
|
|
169
|
-
case r:
|
|
170
|
-
h = ((g - b) / diff + (g < b ? 6 : 0)) / 6;
|
|
171
|
-
break;
|
|
172
|
-
case g:
|
|
173
|
-
h = ((b - r) / diff + 2) / 6;
|
|
174
|
-
break;
|
|
175
|
-
case b:
|
|
176
|
-
h = ((r - g) / diff + 4) / 6;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return {
|
|
181
|
-
h: Math.round(h * 360),
|
|
182
|
-
s: Math.round(s * 100),
|
|
183
|
-
l: Math.round(l * 100)
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function formatOutput(rgb, alpha, targetFormat, options) {
|
|
187
|
-
const { includeAlpha = false, precision = 0 } = options;
|
|
188
|
-
const r = Math.max(0, Math.min(255, Math.round(rgb.r)));
|
|
189
|
-
const g = Math.max(0, Math.min(255, Math.round(rgb.g)));
|
|
190
|
-
const b = Math.max(0, Math.min(255, Math.round(rgb.b)));
|
|
191
|
-
const a = Math.max(0, Math.min(1, alpha));
|
|
192
|
-
switch (targetFormat) {
|
|
193
|
-
case 'hex': {
|
|
194
|
-
const toHex = (value) => {
|
|
195
|
-
const hex = value.toString(16);
|
|
196
|
-
return hex.length === 1 ? '0' + hex : hex;
|
|
197
|
-
};
|
|
198
|
-
let result = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
199
|
-
if (includeAlpha || a < 1) {
|
|
200
|
-
const alphaHex = Math.round(a * 255);
|
|
201
|
-
result += toHex(alphaHex);
|
|
202
|
-
}
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
case 'rgb':
|
|
206
|
-
return `rgb(${r}, ${g}, ${b})`;
|
|
207
|
-
case 'rgba':
|
|
208
|
-
return `rgba(${r}, ${g}, ${b}, ${a.toFixed(precision)})`;
|
|
209
|
-
case 'hsl': {
|
|
210
|
-
const hsl = rgbToHslInternal({ r, g, b });
|
|
211
|
-
return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;
|
|
212
|
-
}
|
|
213
|
-
case 'hsla': {
|
|
214
|
-
const hsl = rgbToHslInternal({ r, g, b });
|
|
215
|
-
return `hsla(${hsl.h}, ${hsl.s}%, ${hsl.l}%, ${a.toFixed(precision)})`;
|
|
216
|
-
}
|
|
217
|
-
case 'named': {
|
|
218
|
-
const namedColorMap = getNamedColorMap();
|
|
219
|
-
const targetHex = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
|
|
220
|
-
for (const [name, hex] of Object.entries(namedColorMap)) {
|
|
221
|
-
if (hex.toLowerCase() === targetHex.toLowerCase()) {
|
|
222
|
-
return name;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return targetHex;
|
|
226
|
-
}
|
|
227
|
-
default:
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
const normalizedInput = normalizeInput(input);
|
|
232
|
-
if (!normalizedInput) {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
const { rgb, alpha } = normalizedInput;
|
|
236
|
-
return formatOutput(rgb, alpha, targetFormat, { includeAlpha, precision });
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=convertColor.js.map
|