@algocare/react-native-code-push 12.6.3 → 13.0.0-rc.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.
Files changed (292) hide show
  1. package/CodePush.podspec +6 -8
  2. package/README.md +343 -586
  3. package/android/app/build.gradle +2 -1
  4. package/android/app/proguard-rules.pro +14 -0
  5. package/android/app/src/debug/AndroidManifest.xml +9 -0
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
  12. package/android/build.gradle +3 -0
  13. package/app.plugin.js +1 -0
  14. package/bin/code-push.js +6 -0
  15. package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
  16. package/cli/commands/bundleCommand/index.ts +34 -0
  17. package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
  18. package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
  19. package/cli/commands/createHistoryCommand/index.ts +44 -0
  20. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
  21. package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
  22. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
  23. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
  24. package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
  25. package/cli/commands/getPackageHashCommand/index.ts +45 -0
  26. package/cli/commands/initCommand/index.ts +14 -0
  27. package/cli/commands/initCommand/initAndroid.ts +91 -0
  28. package/cli/commands/initCommand/initIos.ts +123 -0
  29. package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
  30. package/cli/commands/initCommand/test/initIos.test.ts +99 -0
  31. package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
  32. package/cli/commands/releaseCommand/index.ts +90 -0
  33. package/cli/commands/releaseCommand/release.ts +105 -0
  34. package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
  35. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
  36. package/cli/commands/showHistoryCommand/index.ts +31 -0
  37. package/cli/commands/updateHistoryCommand/index.ts +55 -0
  38. package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
  39. package/cli/constant.ts +4 -0
  40. package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
  41. package/cli/dist/commands/bundleCommand/index.js +15 -0
  42. package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
  43. package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
  44. package/cli/dist/commands/createHistoryCommand/index.js +20 -0
  45. package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
  46. package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
  47. package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
  48. package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
  49. package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
  50. package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
  51. package/cli/dist/commands/initCommand/index.js +12 -0
  52. package/cli/dist/commands/initCommand/initAndroid.js +73 -0
  53. package/cli/dist/commands/initCommand/initIos.js +108 -0
  54. package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
  55. package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
  56. package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
  57. package/cli/dist/commands/releaseCommand/index.js +45 -0
  58. package/cli/dist/commands/releaseCommand/release.js +62 -0
  59. package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
  60. package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
  61. package/cli/dist/commands/showHistoryCommand/index.js +15 -0
  62. package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
  63. package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
  64. package/cli/dist/constant.js +4 -0
  65. package/cli/dist/functions/getReactTempDir.js +10 -0
  66. package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
  67. package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
  68. package/cli/dist/functions/runExpoBundleCommand.js +35 -0
  69. package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
  70. package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
  71. package/cli/dist/index.js +54 -0
  72. package/cli/dist/utils/datetime.js +17 -0
  73. package/cli/dist/utils/file-utils.js +19 -0
  74. package/cli/dist/utils/fsUtils.js +44 -0
  75. package/cli/{utils → dist/utils}/hash-utils.js +19 -130
  76. package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
  77. package/cli/dist/utils/showLogo.js +21 -0
  78. package/cli/dist/utils/unzip.js +41 -0
  79. package/cli/{utils → dist/utils}/zip.js +15 -51
  80. package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
  81. package/cli/functions/makeCodePushBundle.ts +26 -0
  82. package/cli/functions/prepareToBundleJS.ts +10 -0
  83. package/cli/functions/runExpoBundleCommand.ts +45 -0
  84. package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
  85. package/cli/functions/runReactNativeBundleCommand.ts +67 -0
  86. package/cli/index.ts +68 -0
  87. package/cli/package.json +35 -0
  88. package/cli/utils/datetime.ts +19 -0
  89. package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
  90. package/cli/utils/fsUtils.ts +50 -0
  91. package/cli/utils/hash-utils.ts +143 -0
  92. package/cli/utils/promisfied-fs.ts +19 -0
  93. package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
  94. package/cli/utils/unzip.ts +46 -0
  95. package/cli/utils/zip.ts +65 -0
  96. package/expo/plugin/withCodePush.js +14 -0
  97. package/expo/plugin/withCodePushAndroid.js +92 -0
  98. package/expo/plugin/withCodePushIos.js +143 -0
  99. package/ios/CodePush/CodePush.h +0 -16
  100. package/ios/CodePush/CodePush.m +30 -20
  101. package/ios/CodePush/CodePushConfig.m +1 -11
  102. package/ios/CodePush/CodePushPackage.m +12 -69
  103. package/ios/CodePush/CodePushUpdateUtils.m +1 -91
  104. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  105. package/ios/CodePush/SSZipArchive/README.md +1 -1
  106. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  107. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  108. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  109. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  110. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  111. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  141. package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
  142. package/ios/PrivacyInfo.xcprivacy +31 -0
  143. package/package.json +67 -41
  144. package/react-native.config.js +1 -1
  145. package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
  146. package/src/CodePush.js +947 -0
  147. package/{package-mixins.js → src/package-mixins.js} +1 -1
  148. package/{versioning → src/versioning}/BaseVersioning.js +12 -1
  149. package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
  150. package/typings/react-native-code-push.d.ts +559 -495
  151. package/CONTRIBUTING.md +0 -134
  152. package/CodePush.js +0 -972
  153. package/SECURITY.md +0 -41
  154. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  155. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  156. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  157. package/android/codepush.gradle +0 -162
  158. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  160. package/android/gradlew +0 -164
  161. package/android/gradlew.bat +0 -90
  162. package/babel.config.js +0 -3
  163. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  164. package/cli/commands/bundleCommand/index.js +0 -55
  165. package/cli/commands/common.js +0 -245
  166. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  167. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  168. package/cli/commands/createHistoryCommand/index.js +0 -95
  169. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  170. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  171. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  172. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  173. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  174. package/cli/commands/getPackageHashCommand/index.js +0 -42
  175. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  176. package/cli/commands/releaseCommand/index.js +0 -151
  177. package/cli/commands/releaseCommand/release.js +0 -121
  178. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  179. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  180. package/cli/commands/showHistoryCommand/index.js +0 -88
  181. package/cli/commands/updateHistoryCommand/index.js +0 -123
  182. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  183. package/cli/constant.js +0 -8
  184. package/cli/index.js +0 -63
  185. package/cli/utils/datetime.js +0 -22
  186. package/cli/utils/fsUtils.js +0 -64
  187. package/cli/utils/version.js +0 -26
  188. package/code-push.config.example.supabase.ts +0 -114
  189. package/code-push.config.js +0 -229
  190. package/code-push.config.ts +0 -175
  191. package/docs/api-android.md +0 -83
  192. package/docs/api-ios.md +0 -31
  193. package/docs/api-js.md +0 -592
  194. package/docs/multi-deployment-testing-android.md +0 -148
  195. package/docs/multi-deployment-testing-ios.md +0 -59
  196. package/docs/setup-android.md +0 -482
  197. package/docs/setup-ios.md +0 -280
  198. package/eslint.config.mjs +0 -32
  199. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  200. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  201. package/ios/CodePush/Base64/README.md +0 -47
  202. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  203. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  204. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  207. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  208. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  209. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  210. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  211. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  212. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  213. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  215. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  216. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  217. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  224. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  225. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  226. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  232. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  233. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  234. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  242. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  243. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  244. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  245. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  246. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  247. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  248. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  249. package/ios/CodePush/JWT/LICENSE +0 -19
  250. package/ios/CodePush/JWT/README.md +0 -489
  251. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  252. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  253. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  254. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  255. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  256. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  257. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  258. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  259. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  260. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  261. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  262. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  263. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  264. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  265. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  266. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  267. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  268. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  269. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  271. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  272. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  273. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  274. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  275. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  276. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  277. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  278. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  279. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  280. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  281. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  282. package/scripts/generateBundledResourcesHash.js +0 -125
  283. package/scripts/getFilesInFolder.js +0 -19
  284. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  285. package/tsconfig.json +0 -20
  286. package/tslint.json +0 -32
  287. /package/{logging.js → src/logging.js} +0 -0
  288. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  289. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  290. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  291. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  292. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,284 +0,0 @@
1
- /*
2
- Additional tools for Minizip
3
- Code: Xavier Roche '2004
4
- License: Same as ZLIB (www.gzip.org)
5
- */
6
-
7
- /* Code */
8
- #include <stdio.h>
9
- #include <stdlib.h>
10
- #include <string.h>
11
- #include "zlib.h"
12
- #include "unzip.h"
13
- #include "mztools.h"
14
-
15
- #define READ_8(adr) ((unsigned char)*(adr))
16
- #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
17
- #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
18
-
19
- #define WRITE_8(buff, n) do { \
20
- *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
21
- } while(0)
22
- #define WRITE_16(buff, n) do { \
23
- WRITE_8((unsigned char*)(buff), n); \
24
- WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
25
- } while(0)
26
- #define WRITE_32(buff, n) do { \
27
- WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
28
- WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
29
- } while(0)
30
-
31
- extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
32
- const char* file;
33
- const char* fileOut;
34
- const char* fileOutTmp;
35
- uLong* nRecovered;
36
- uLong* bytesRecovered;
37
- {
38
- int err = Z_OK;
39
- FILE* fpZip = fopen(file, "rb");
40
- FILE* fpOut = fopen(fileOut, "wb");
41
- FILE* fpOutCD = fopen(fileOutTmp, "wb");
42
- if (fpZip != NULL && fpOut != NULL) {
43
- int entries = 0;
44
- uLong totalBytes = 0;
45
- char header[30];
46
- char filename[256];
47
- char extra[1024];
48
- int offset = 0;
49
- int offsetCD = 0;
50
- while ( fread(header, 1, 30, fpZip) == 30 ) {
51
- int currentOffset = offset;
52
-
53
- /* File entry */
54
- if (READ_32(header) == 0x04034b50) {
55
- unsigned int version = READ_16(header + 4);
56
- unsigned int gpflag = READ_16(header + 6);
57
- unsigned int method = READ_16(header + 8);
58
- unsigned int filetime = READ_16(header + 10);
59
- unsigned int filedate = READ_16(header + 12);
60
- unsigned int crc = READ_32(header + 14); /* crc */
61
- unsigned int cpsize = READ_32(header + 18); /* compressed size */
62
- unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
63
- unsigned int fnsize = READ_16(header + 26); /* file name length */
64
- unsigned int extsize = READ_16(header + 28); /* extra field length */
65
- filename[0] = extra[0] = '\0';
66
-
67
- /* Header */
68
- if (fwrite(header, 1, 30, fpOut) == 30) {
69
- offset += 30;
70
- } else {
71
- err = Z_ERRNO;
72
- break;
73
- }
74
-
75
- /* Filename */
76
- if (fnsize > 0) {
77
- if (fread(filename, 1, fnsize, fpZip) == fnsize) {
78
- if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
79
- offset += fnsize;
80
- } else {
81
- err = Z_ERRNO;
82
- break;
83
- }
84
- } else {
85
- err = Z_ERRNO;
86
- break;
87
- }
88
- } else {
89
- err = Z_STREAM_ERROR;
90
- break;
91
- }
92
-
93
- /* Extra field */
94
- if (extsize > 0) {
95
- if (fread(extra, 1, extsize, fpZip) == extsize) {
96
- if (fwrite(extra, 1, extsize, fpOut) == extsize) {
97
- offset += extsize;
98
- } else {
99
- err = Z_ERRNO;
100
- break;
101
- }
102
- } else {
103
- err = Z_ERRNO;
104
- break;
105
- }
106
- }
107
-
108
- /* Data */
109
- {
110
- int dataSize = cpsize;
111
- if (dataSize == 0) {
112
- dataSize = uncpsize;
113
- }
114
- if (dataSize > 0) {
115
- char* data = malloc(dataSize);
116
- if (data != NULL) {
117
- if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
118
- if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
119
- offset += dataSize;
120
- totalBytes += dataSize;
121
- } else {
122
- err = Z_ERRNO;
123
- }
124
- } else {
125
- err = Z_ERRNO;
126
- }
127
- free(data);
128
- if (err != Z_OK) {
129
- break;
130
- }
131
- } else {
132
- err = Z_MEM_ERROR;
133
- break;
134
- }
135
- }
136
- }
137
-
138
- /* Central directory entry */
139
- {
140
- char centralDirectoryEntryHeader[46];
141
- //char* comment = "";
142
- //int comsize = (int) strlen(comment);
143
- WRITE_32(centralDirectoryEntryHeader, 0x02014b50);
144
- WRITE_16(centralDirectoryEntryHeader + 4, version);
145
- WRITE_16(centralDirectoryEntryHeader + 6, version);
146
- WRITE_16(centralDirectoryEntryHeader + 8, gpflag);
147
- WRITE_16(centralDirectoryEntryHeader + 10, method);
148
- WRITE_16(centralDirectoryEntryHeader + 12, filetime);
149
- WRITE_16(centralDirectoryEntryHeader + 14, filedate);
150
- WRITE_32(centralDirectoryEntryHeader + 16, crc);
151
- WRITE_32(centralDirectoryEntryHeader + 20, cpsize);
152
- WRITE_32(centralDirectoryEntryHeader + 24, uncpsize);
153
- WRITE_16(centralDirectoryEntryHeader + 28, fnsize);
154
- WRITE_16(centralDirectoryEntryHeader + 30, extsize);
155
- WRITE_16(centralDirectoryEntryHeader + 32, 0 /*comsize*/);
156
- WRITE_16(centralDirectoryEntryHeader + 34, 0); /* disk # */
157
- WRITE_16(centralDirectoryEntryHeader + 36, 0); /* int attrb */
158
- WRITE_32(centralDirectoryEntryHeader + 38, 0); /* ext attrb */
159
- WRITE_32(centralDirectoryEntryHeader + 42, currentOffset);
160
- /* Header */
161
- if (fwrite(centralDirectoryEntryHeader, 1, 46, fpOutCD) == 46) {
162
- offsetCD += 46;
163
-
164
- /* Filename */
165
- if (fnsize > 0) {
166
- if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
167
- offsetCD += fnsize;
168
- } else {
169
- err = Z_ERRNO;
170
- break;
171
- }
172
- } else {
173
- err = Z_STREAM_ERROR;
174
- break;
175
- }
176
-
177
- /* Extra field */
178
- if (extsize > 0) {
179
- if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
180
- offsetCD += extsize;
181
- } else {
182
- err = Z_ERRNO;
183
- break;
184
- }
185
- }
186
-
187
- /* Comment field */
188
- /*
189
- if (comsize > 0) {
190
- if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
191
- offsetCD += comsize;
192
- } else {
193
- err = Z_ERRNO;
194
- break;
195
- }
196
- }
197
- */
198
-
199
- } else {
200
- err = Z_ERRNO;
201
- break;
202
- }
203
- }
204
-
205
- /* Success */
206
- entries++;
207
-
208
- } else {
209
- break;
210
- }
211
- }
212
-
213
- /* Final central directory */
214
- {
215
- int entriesZip = entries;
216
- char finalCentralDirectoryHeader[22];
217
- //char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
218
- //int comsize = (int) strlen(comment);
219
- if (entriesZip > 0xffff) {
220
- entriesZip = 0xffff;
221
- }
222
- WRITE_32(finalCentralDirectoryHeader, 0x06054b50);
223
- WRITE_16(finalCentralDirectoryHeader + 4, 0); /* disk # */
224
- WRITE_16(finalCentralDirectoryHeader + 6, 0); /* disk # */
225
- WRITE_16(finalCentralDirectoryHeader + 8, entriesZip); /* hack */
226
- WRITE_16(finalCentralDirectoryHeader + 10, entriesZip); /* hack */
227
- WRITE_32(finalCentralDirectoryHeader + 12, offsetCD); /* size of CD */
228
- WRITE_32(finalCentralDirectoryHeader + 16, offset); /* offset to CD */
229
- WRITE_16(finalCentralDirectoryHeader + 20, 0 /*comsize*/); /* comment */
230
-
231
- /* Header */
232
- if (fwrite(finalCentralDirectoryHeader, 1, 22, fpOutCD) == 22) {
233
-
234
- /* Comment field */
235
- /*
236
- if (comsize > 0) {
237
- if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
238
- err = Z_ERRNO;
239
- }
240
- }
241
- */
242
- } else {
243
- err = Z_ERRNO;
244
- }
245
- }
246
-
247
- /* Final merge (file + central directory) */
248
- fclose(fpOutCD);
249
- if (err == Z_OK) {
250
- fpOutCD = fopen(fileOutTmp, "rb");
251
- if (fpOutCD != NULL) {
252
- int nRead;
253
- char buffer[8192];
254
- while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
255
- if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
256
- err = Z_ERRNO;
257
- break;
258
- }
259
- }
260
- fclose(fpOutCD);
261
- }
262
- }
263
-
264
- /* Close */
265
- fclose(fpZip);
266
- fclose(fpOut);
267
-
268
- /* Wipe temporary file */
269
- (void)remove(fileOutTmp);
270
-
271
- /* Number of recovered entries */
272
- if (err == Z_OK) {
273
- if (nRecovered != NULL) {
274
- *nRecovered = entries;
275
- }
276
- if (bytesRecovered != NULL) {
277
- *bytesRecovered = totalBytes;
278
- }
279
- }
280
- } else {
281
- err = Z_STREAM_ERROR;
282
- }
283
- return err;
284
- }
@@ -1,31 +0,0 @@
1
- /*
2
- Additional tools for Minizip
3
- Code: Xavier Roche '2004
4
- License: Same as ZLIB (www.gzip.org)
5
- */
6
-
7
- #ifndef _zip_tools_H
8
- #define _zip_tools_H
9
-
10
- #ifdef __cplusplus
11
- extern "C" {
12
- #endif
13
-
14
- #ifndef _ZLIB_H
15
- #include "zlib.h"
16
- #endif
17
-
18
- #include "unzip.h"
19
-
20
- /* Repair a ZIP file (missing central directory)
21
- file: file to recover
22
- fileOut: output file after recovery
23
- fileOutTmp: temporary file name used for recovery
24
- */
25
- extern int ZEXPORT unzRepair(const char* file,
26
- const char* fileOut,
27
- const char* fileOutTmp,
28
- uLong* nRecovered,
29
- uLong* bytesRecovered);
30
-
31
- #endif