@automattic/vip 4.1.6 → 4.1.8

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 (311) hide show
  1. package/assets/dev-env.lando.template.yml.ejs +1 -1
  2. package/dist/bin/vip-app-deploy-token-generate.js +110 -78
  3. package/dist/bin/vip-app-deploy-token.js +24 -16
  4. package/dist/bin/vip-app-deploy-validate.js +45 -41
  5. package/dist/bin/vip-app-deploy.js +222 -215
  6. package/dist/bin/vip-app-list.js +59 -43
  7. package/dist/bin/vip-app.js +97 -66
  8. package/dist/bin/vip-backup-db.js +36 -29
  9. package/dist/bin/vip-backup.js +16 -9
  10. package/dist/bin/vip-cache-purge-url.js +93 -55
  11. package/dist/bin/vip-cache.js +23 -14
  12. package/dist/bin/vip-config-envvar-delete.js +74 -73
  13. package/dist/bin/vip-config-envvar-get-all.js +68 -68
  14. package/dist/bin/vip-config-envvar-get.js +46 -46
  15. package/dist/bin/vip-config-envvar-list.js +54 -57
  16. package/dist/bin/vip-config-envvar-set.js +102 -96
  17. package/dist/bin/vip-config-envvar.js +38 -24
  18. package/dist/bin/vip-config-software-get.js +88 -75
  19. package/dist/bin/vip-config-software-update.js +116 -120
  20. package/dist/bin/vip-config-software.js +31 -21
  21. package/dist/bin/vip-config.js +25 -17
  22. package/dist/bin/vip-db-phpmyadmin.js +40 -39
  23. package/dist/bin/vip-db.js +13 -12
  24. package/dist/bin/vip-defensive-mode-configure.js +197 -197
  25. package/dist/bin/vip-defensive-mode-disable.js +43 -35
  26. package/dist/bin/vip-defensive-mode-enable.js +47 -38
  27. package/dist/bin/vip-defensive-mode.js +28 -17
  28. package/dist/bin/vip-dev-env-create.js +147 -104
  29. package/dist/bin/vip-dev-env-destroy.js +48 -39
  30. package/dist/bin/vip-dev-env-envvar-delete.js +60 -49
  31. package/dist/bin/vip-dev-env-envvar-get-all.js +52 -45
  32. package/dist/bin/vip-dev-env-envvar-get.js +48 -37
  33. package/dist/bin/vip-dev-env-envvar-list.js +48 -41
  34. package/dist/bin/vip-dev-env-envvar-set.js +83 -70
  35. package/dist/bin/vip-dev-env-envvar.js +38 -23
  36. package/dist/bin/vip-dev-env-exec.js +81 -74
  37. package/dist/bin/vip-dev-env-import-media.js +34 -26
  38. package/dist/bin/vip-dev-env-import-sql.js +65 -51
  39. package/dist/bin/vip-dev-env-import.js +23 -14
  40. package/dist/bin/vip-dev-env-info.js +59 -50
  41. package/dist/bin/vip-dev-env-list.js +34 -31
  42. package/dist/bin/vip-dev-env-logs.js +59 -49
  43. package/dist/bin/vip-dev-env-purge.js +71 -63
  44. package/dist/bin/vip-dev-env-shell.js +82 -71
  45. package/dist/bin/vip-dev-env-start.js +77 -65
  46. package/dist/bin/vip-dev-env-stop.js +80 -74
  47. package/dist/bin/vip-dev-env-sync-sql.js +80 -72
  48. package/dist/bin/vip-dev-env-sync.js +18 -11
  49. package/dist/bin/vip-dev-env-update.js +93 -84
  50. package/dist/bin/vip-dev-env.js +25 -8
  51. package/dist/bin/vip-edge-workers-build.js +82 -54
  52. package/dist/bin/vip-edge-workers-delete.js +84 -52
  53. package/dist/bin/vip-edge-workers-deploy.js +186 -126
  54. package/dist/bin/vip-edge-workers-disable.js +75 -44
  55. package/dist/bin/vip-edge-workers-enable.js +86 -54
  56. package/dist/bin/vip-edge-workers-get.js +108 -88
  57. package/dist/bin/vip-edge-workers-init.js +83 -53
  58. package/dist/bin/vip-edge-workers-list.js +89 -54
  59. package/dist/bin/vip-edge-workers-new.js +98 -69
  60. package/dist/bin/vip-edge-workers-validate.js +123 -82
  61. package/dist/bin/vip-edge-workers.js +19 -6
  62. package/dist/bin/vip-export-sql.js +75 -69
  63. package/dist/bin/vip-export.js +12 -7
  64. package/dist/bin/vip-import-media-abort.js +99 -73
  65. package/dist/bin/vip-import-media-status.js +83 -51
  66. package/dist/bin/vip-import-media.js +165 -166
  67. package/dist/bin/vip-import-sql-status.js +75 -45
  68. package/dist/bin/vip-import-sql.js +536 -596
  69. package/dist/bin/vip-import-validate-files.js +122 -141
  70. package/dist/bin/vip-import-validate-sql.js +52 -16
  71. package/dist/bin/vip-import.js +16 -7
  72. package/dist/bin/vip-logout.js +17 -13
  73. package/dist/bin/vip-logs.js +209 -183
  74. package/dist/bin/vip-search-replace.js +85 -53
  75. package/dist/bin/vip-slowlogs.js +168 -147
  76. package/dist/bin/vip-sync.js +163 -133
  77. package/dist/bin/vip-whoami.js +71 -35
  78. package/dist/bin/vip-wp.js +506 -549
  79. package/dist/bin/vip.js +161 -116
  80. package/dist/commands/backup-db.js +183 -149
  81. package/dist/commands/dev-env-import-sql.js +162 -117
  82. package/dist/commands/dev-env-sync-sql.js +372 -330
  83. package/dist/commands/export-sql.js +441 -425
  84. package/dist/commands/phpmyadmin.js +232 -212
  85. package/dist/commands/wp-ssh.js +218 -187
  86. package/dist/lib/analytics/clients/tracks.js +84 -91
  87. package/dist/lib/analytics/index.js +27 -27
  88. package/dist/lib/api/app.js +37 -36
  89. package/dist/lib/api/cache-purge.js +17 -20
  90. package/dist/lib/api/constants.js +5 -6
  91. package/dist/lib/api/edge-workers.js +84 -135
  92. package/dist/lib/api/error-debug.js +10 -13
  93. package/dist/lib/api/feature-flags.js +16 -17
  94. package/dist/lib/api/http.js +47 -48
  95. package/dist/lib/api/user.js +17 -18
  96. package/dist/lib/api.js +107 -116
  97. package/dist/lib/app-logs/app-logs.js +24 -25
  98. package/dist/lib/app-slowlogs/app-slowlogs.js +23 -24
  99. package/dist/lib/app-slowlogs/types.js +2 -1
  100. package/dist/lib/app.js +6 -8
  101. package/dist/lib/backup-storage-availability/backup-storage-availability.js +119 -119
  102. package/dist/lib/backup-storage-availability/docker-machine-not-found-error.js +5 -6
  103. package/dist/lib/cli/apiConfig.js +71 -41
  104. package/dist/lib/cli/command.js +1120 -873
  105. package/dist/lib/cli/config.js +29 -29
  106. package/dist/lib/cli/envAlias.js +35 -50
  107. package/dist/lib/cli/exit.js +19 -19
  108. package/dist/lib/cli/format.js +172 -172
  109. package/dist/lib/cli/progress.js +193 -236
  110. package/dist/lib/cli/prompt.js +14 -15
  111. package/dist/lib/cli/runtime-mode.js +5 -6
  112. package/dist/lib/client-file-uploader.js +489 -641
  113. package/dist/lib/config/software.js +206 -212
  114. package/dist/lib/constants/dev-environment.js +40 -37
  115. package/dist/lib/constants/file-size.js +6 -7
  116. package/dist/lib/constants/vipgo.js +24 -12
  117. package/dist/lib/custom-deploy/custom-deploy.js +138 -120
  118. package/dist/lib/database.js +88 -85
  119. package/dist/lib/defensive-mode/api.js +41 -46
  120. package/dist/lib/defensive-mode/cli-helpers.js +40 -40
  121. package/dist/lib/dev-environment/dev-environment-cli.js +776 -735
  122. package/dist/lib/dev-environment/dev-environment-configuration-file.js +224 -191
  123. package/dist/lib/dev-environment/dev-environment-core.js +697 -732
  124. package/dist/lib/dev-environment/dev-environment-database.js +57 -41
  125. package/dist/lib/dev-environment/dev-environment-lando.js +734 -666
  126. package/dist/lib/dev-environment/docker-utils.js +96 -90
  127. package/dist/lib/dev-environment/env-vars.js +61 -59
  128. package/dist/lib/dev-environment/lando-loader.js +6 -7
  129. package/dist/lib/dev-environment/types.js +2 -1
  130. package/dist/lib/edge-workers/confirmation.js +42 -36
  131. package/dist/lib/edge-workers/deployment.js +150 -159
  132. package/dist/lib/edge-workers/index.js +68 -85
  133. package/dist/lib/edge-workers/location.js +26 -26
  134. package/dist/lib/edge-workers/output.js +14 -15
  135. package/dist/lib/edge-workers/project.js +123 -132
  136. package/dist/lib/edge-workers/toolchains/assemblyscript/constants.js +6 -8
  137. package/dist/lib/edge-workers/toolchains/assemblyscript/index.js +100 -101
  138. package/dist/lib/edge-workers/toolchains/assemblyscript/templates.js +31 -33
  139. package/dist/lib/edge-workers/toolchains/index.js +15 -15
  140. package/dist/lib/edge-workers/types.js +10 -38
  141. package/dist/lib/edge-workers/validation.js +161 -150
  142. package/dist/lib/env.js +16 -17
  143. package/dist/lib/envvar/api-delete.js +16 -18
  144. package/dist/lib/envvar/api-get-all.js +15 -19
  145. package/dist/lib/envvar/api-get.js +8 -9
  146. package/dist/lib/envvar/api-list.js +16 -21
  147. package/dist/lib/envvar/api-set.js +20 -19
  148. package/dist/lib/envvar/api.js +34 -29
  149. package/dist/lib/envvar/input.js +29 -34
  150. package/dist/lib/envvar/logging.js +9 -11
  151. package/dist/lib/envvar/read-file.js +6 -7
  152. package/dist/lib/http/download-file.js +76 -44
  153. package/dist/lib/http/proxy-agent.js +37 -40
  154. package/dist/lib/http/proxy-dispatcher.js +69 -71
  155. package/dist/lib/keychain/insecure.js +40 -36
  156. package/dist/lib/keychain/keychain.js +2 -1
  157. package/dist/lib/keychain/secure.js +16 -15
  158. package/dist/lib/keychain.js +22 -22
  159. package/dist/lib/live-backup-copy.js +117 -115
  160. package/dist/lib/logout.js +17 -19
  161. package/dist/lib/media-import/config.js +15 -14
  162. package/dist/lib/media-import/media-file-import.js +9 -13
  163. package/dist/lib/media-import/progress.js +53 -65
  164. package/dist/lib/media-import/status.js +241 -256
  165. package/dist/lib/media-import/utils.js +15 -15
  166. package/dist/lib/node-version-check.js +16 -16
  167. package/dist/lib/promise.js +16 -17
  168. package/dist/lib/read-file.js +48 -16
  169. package/dist/lib/rechallenge/client.js +37 -43
  170. package/dist/lib/rechallenge/errors.js +38 -37
  171. package/dist/lib/rechallenge/flow.js +148 -123
  172. package/dist/lib/rechallenge/index.js +23 -24
  173. package/dist/lib/rechallenge/link.js +153 -151
  174. package/dist/lib/rechallenge/open-browser.js +14 -17
  175. package/dist/lib/rechallenge/token-cache.js +83 -86
  176. package/dist/lib/rechallenge/types.js +5 -14
  177. package/dist/lib/retry.js +93 -129
  178. package/dist/lib/search-and-replace.js +164 -148
  179. package/dist/lib/site-import/db-file-import.js +12 -16
  180. package/dist/lib/site-import/status.js +291 -291
  181. package/dist/lib/token.js +86 -87
  182. package/dist/lib/tracker.js +51 -62
  183. package/dist/lib/types/graphql/rate-limit-exceeded-error.js +2 -1
  184. package/dist/lib/types.js +2 -1
  185. package/dist/lib/user-error.js +6 -8
  186. package/dist/lib/utils.js +81 -87
  187. package/dist/lib/validations/custom-deploy.js +218 -186
  188. package/dist/lib/validations/is-multi-site-sql-dump.js +6 -6
  189. package/dist/lib/validations/is-multi-site.js +83 -50
  190. package/dist/lib/validations/is-multisite-domain-mapped.js +92 -62
  191. package/dist/lib/validations/line-by-line.js +78 -46
  192. package/dist/lib/validations/site-type.js +59 -63
  193. package/dist/lib/validations/sql-insert-parser.js +415 -0
  194. package/dist/lib/validations/sql.js +551 -431
  195. package/dist/lib/validations/utils.js +27 -29
  196. package/dist/lib/vip-import-validate-files.js +481 -490
  197. package/dist/lib/wp/helpers.js +41 -45
  198. package/dist/lib/wp/readline.js +21 -57
  199. package/dist/lib/xdg-data.js +11 -12
  200. package/helpers/mark-cli-executable.js +9 -0
  201. package/node_modules/@apollo/client/CHANGELOG.md +10 -0
  202. package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs +5 -0
  203. package/node_modules/@apollo/client/__cjs/cache/inmemory/helpers.cjs.map +1 -1
  204. package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs +2 -1
  205. package/node_modules/@apollo/client/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  206. package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs +14 -2
  207. package/node_modules/@apollo/client/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  208. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs +16 -0
  209. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.cjs.map +1 -1
  210. package/node_modules/@apollo/client/__cjs/cache/inmemory/policies.d.cts +2 -0
  211. package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs +3 -2
  212. package/node_modules/@apollo/client/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
  213. package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs +9 -1
  214. package/node_modules/@apollo/client/__cjs/core/QueryInfo.cjs.map +1 -1
  215. package/node_modules/@apollo/client/__cjs/core/QueryInfo.d.cts +1 -1
  216. package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs +10 -3
  217. package/node_modules/@apollo/client/__cjs/core/QueryManager.cjs.map +1 -1
  218. package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.cjs.map +1 -1
  219. package/node_modules/@apollo/client/__cjs/react/hooks/useFragment.d.cts +42 -43
  220. package/node_modules/@apollo/client/__cjs/version.cjs +1 -1
  221. package/node_modules/@apollo/client/cache/inmemory/helpers.js +5 -0
  222. package/node_modules/@apollo/client/cache/inmemory/helpers.js.map +1 -1
  223. package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js +2 -1
  224. package/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map +1 -1
  225. package/node_modules/@apollo/client/cache/inmemory/key-extractor.js +14 -2
  226. package/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map +1 -1
  227. package/node_modules/@apollo/client/cache/inmemory/policies.d.ts +2 -0
  228. package/node_modules/@apollo/client/cache/inmemory/policies.js +17 -1
  229. package/node_modules/@apollo/client/cache/inmemory/policies.js.map +1 -1
  230. package/node_modules/@apollo/client/cache/inmemory/writeToStore.js +3 -2
  231. package/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map +1 -1
  232. package/node_modules/@apollo/client/core/QueryInfo.d.ts +1 -1
  233. package/node_modules/@apollo/client/core/QueryInfo.js +10 -2
  234. package/node_modules/@apollo/client/core/QueryInfo.js.map +1 -1
  235. package/node_modules/@apollo/client/core/QueryManager.js +10 -3
  236. package/node_modules/@apollo/client/core/QueryManager.js.map +1 -1
  237. package/node_modules/@apollo/client/package.json +1 -1
  238. package/node_modules/@apollo/client/react/hooks/useFragment.d.ts +42 -43
  239. package/node_modules/@apollo/client/react/hooks/useFragment.js.map +1 -1
  240. package/node_modules/@apollo/client/react/hooks-compiled/useFragment.d.ts +42 -43
  241. package/node_modules/@apollo/client/react/hooks-compiled/useFragment.js.map +1 -1
  242. package/node_modules/@apollo/client/version.js +1 -1
  243. package/node_modules/@automattic/vip-search-replace/README.md +6 -1
  244. package/node_modules/@automattic/vip-search-replace/lib/index.js +46 -14
  245. package/node_modules/@automattic/vip-search-replace/package.json +1 -1
  246. package/node_modules/@types/node/README.md +1 -1
  247. package/node_modules/@types/node/package.json +2 -2
  248. package/node_modules/@types/node/zlib.d.ts +752 -0
  249. package/node_modules/check-disk-space/README.md +92 -32
  250. package/node_modules/check-disk-space/dist/check-disk-space.d.mts +58 -0
  251. package/node_modules/check-disk-space/dist/check-disk-space.mjs +170 -190
  252. package/node_modules/check-disk-space/package.json +43 -71
  253. package/node_modules/cpu-features/build/Makefile +2 -2
  254. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o.d +1 -1
  255. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o.d +1 -1
  256. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.o.d +1 -1
  257. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_windows.o.d +1 -1
  258. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o.d +1 -1
  259. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o.d +1 -1
  260. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o.d +1 -1
  261. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o.d +1 -1
  262. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o.d +1 -1
  263. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o.d +1 -1
  264. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o.d +1 -1
  265. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o.d +1 -1
  266. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o.d +1 -1
  267. package/node_modules/cpu-features/build/Release/.deps/Release/obj.target/cpufeatures/src/binding.o.d +157 -145
  268. package/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
  269. package/node_modules/cpu-features/build/Release/obj.target/cpufeatures/src/binding.o +0 -0
  270. package/node_modules/cpu-features/build/Release/obj.target/cpufeatures.node +0 -0
  271. package/node_modules/cpu-features/build/config.gypi +100 -31
  272. package/node_modules/cpu-features/build/cpufeatures.target.mk +14 -14
  273. package/node_modules/cpu-features/build/deps/cpu_features/cpu_features.target.mk +14 -14
  274. package/node_modules/ssh2/lib/protocol/crypto/build/Makefile +2 -2
  275. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d.raw +136 -0
  276. package/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk +14 -14
  277. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  278. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  279. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  280. package/node_modules/undici/package.json +3 -3
  281. package/node_modules/undici/types/api.d.ts +1 -1
  282. package/node_modules/undici/types/utility.d.ts +4 -4
  283. package/package.json +44 -13
  284. package/dist/lib/analytics/clients/client.js +0 -1
  285. package/dist/lib/analytics/clients/pendo.js +0 -78
  286. package/helpers/check-version.js +0 -16
  287. package/node_modules/check-disk-space/dist/check-disk-space.cjs +0 -210
  288. package/node_modules/check-disk-space/dist/check-disk-space.d.ts +0 -53
  289. package/node_modules/fetch-retry/.eslintignore +0 -1
  290. package/node_modules/fetch-retry/.eslintrc.yml +0 -20
  291. package/node_modules/fetch-retry/.github/workflows/node.js.yml +0 -32
  292. package/node_modules/fetch-retry/.husky/pre-commit +0 -6
  293. package/node_modules/fetch-retry/.nycrc.json +0 -24
  294. package/node_modules/fetch-retry/.travis.yml +0 -3
  295. package/node_modules/fetch-retry/LICENSE +0 -21
  296. package/node_modules/fetch-retry/README.md +0 -128
  297. package/node_modules/fetch-retry/dist/fetch-retry.umd.js +0 -151
  298. package/node_modules/fetch-retry/index.d.ts +0 -29
  299. package/node_modules/fetch-retry/index.js +0 -143
  300. package/node_modules/fetch-retry/package.json +0 -41
  301. package/node_modules/fetch-retry/rollup.config.js +0 -12
  302. package/node_modules/fetch-retry/test/.eslintrc.yml +0 -7
  303. package/node_modules/fetch-retry/test/integration/index.js +0 -212
  304. package/node_modules/fetch-retry/test/integration/mock-api/index.js +0 -42
  305. package/node_modules/fetch-retry/test/unit/index.js +0 -1169
  306. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d +0 -265
  307. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d +0 -1
  308. package/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d +0 -1
  309. package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o +0 -0
  310. package/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node +0 -0
  311. package/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
@@ -1,87 +1,124 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
4
39
  exports.LARGE_ARCHIVE_FILE_SIZE_LIMIT = void 0;
5
40
  exports.findLargeArchiveFilesInDeployArchive = findLargeArchiveFilesInDeployArchive;
6
41
  exports.validateDeployFileExt = validateDeployFileExt;
7
42
  exports.validateFilename = validateFilename;
8
43
  exports.validateName = validateName;
9
- exports.validateTarFile = validateTarFile;
10
44
  exports.validateZipFile = validateZipFile;
11
- var _nodeStreamZip = _interopRequireDefault(require("node-stream-zip"));
12
- var _nodeFs = require("node:fs");
13
- var _path = _interopRequireDefault(require("path"));
14
- var tar = _interopRequireWildcard(require("tar"));
15
- var exit = _interopRequireWildcard(require("../../lib/cli/exit"));
16
- var _fileSize = require("../../lib/constants/file-size");
17
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
45
+ exports.validateTarFile = validateTarFile;
46
+ const node_stream_zip_1 = __importDefault(require("node-stream-zip"));
47
+ const node_fs_1 = require("node:fs");
48
+ const path_1 = __importDefault(require("path"));
49
+ const tar = __importStar(require("tar"));
50
+ const exit = __importStar(require("../../lib/cli/exit"));
51
+ const file_size_1 = require("../../lib/constants/file-size");
19
52
  const errorMessages = {
20
- missingThemes: 'Missing `themes` directory from root folder.',
21
- symlink: 'Symlink detected: ',
22
- singleRootDir: 'The compressed file must contain a single root directory.',
23
- invalidExt: 'Invalid file extension. Please provide a .zip, .tar.gz, or a .tgz file.',
24
- invalidChars: (filename, invalidChars) => `Filename ${filename} contains disallowed characters: ${invalidChars}`
53
+ missingThemes: 'Missing `themes` directory from root folder.',
54
+ symlink: 'Symlink detected: ',
55
+ singleRootDir: 'The compressed file must contain a single root directory.',
56
+ invalidExt: 'Invalid file extension. Please provide a .zip, .tar.gz, or a .tgz file.',
57
+ invalidChars: (filename, invalidChars) => `Filename ${filename} contains disallowed characters: ${invalidChars}`,
25
58
  };
26
59
  const symlinkIgnorePattern = /\/node_modules\/[^/]+\/\.bin\//;
27
60
  const macosxDir = '__MACOSX';
28
- const LARGE_ARCHIVE_FILE_SIZE_LIMIT = exports.LARGE_ARCHIVE_FILE_SIZE_LIMIT = 20 * _fileSize.MB_IN_BYTES;
61
+ exports.LARGE_ARCHIVE_FILE_SIZE_LIMIT = 20 * file_size_1.MB_IN_BYTES;
29
62
  function getDeployFileExt(filename) {
30
- const lower = filename.toLowerCase();
31
- if (lower.endsWith('.tar.gz')) {
32
- return '.tar.gz';
33
- }
34
- if (lower.endsWith('.tgz')) {
35
- return '.tgz';
36
- }
37
- if (lower.endsWith('.zip')) {
38
- return '.zip';
39
- }
40
- return _path.default.extname(lower);
63
+ const lower = filename.toLowerCase();
64
+ if (lower.endsWith('.tar.gz')) {
65
+ return '.tar.gz';
66
+ }
67
+ if (lower.endsWith('.tgz')) {
68
+ return '.tgz';
69
+ }
70
+ if (lower.endsWith('.zip')) {
71
+ return '.zip';
72
+ }
73
+ return path_1.default.extname(lower);
41
74
  }
42
75
  function isDeployArchiveFile(filename) {
43
- return ['.zip', '.tar.gz', '.tgz'].includes(getDeployFileExt(filename));
76
+ return ['.zip', '.tar.gz', '.tgz'].includes(getDeployFileExt(filename));
44
77
  }
45
78
  async function findLargeArchiveFilesInZipArchive(filePath) {
46
- const zipFile = new _nodeStreamZip.default.async({
47
- file: filePath
48
- });
49
- try {
50
- const zipEntries = await zipFile.entries();
51
- return Object.values(zipEntries).filter(entry => !entry.isDirectory && isDeployArchiveFile(entry.name) && entry.size > LARGE_ARCHIVE_FILE_SIZE_LIMIT).map(entry => ({
52
- path: entry.name,
53
- size: entry.size
54
- }));
55
- } finally {
56
- await zipFile.close();
57
- }
79
+ const zipFile = new node_stream_zip_1.default.async({ file: filePath });
80
+ try {
81
+ const zipEntries = await zipFile.entries();
82
+ return Object.values(zipEntries)
83
+ .filter(entry => !entry.isDirectory &&
84
+ isDeployArchiveFile(entry.name) &&
85
+ entry.size > exports.LARGE_ARCHIVE_FILE_SIZE_LIMIT)
86
+ .map(entry => ({
87
+ path: entry.name,
88
+ size: entry.size,
89
+ }));
90
+ }
91
+ finally {
92
+ await zipFile.close();
93
+ }
58
94
  }
59
95
  async function findLargeArchiveFilesInTarArchive(filePath) {
60
- const largeArchiveFiles = [];
61
- await tar.list({
62
- file: filePath,
63
- onReadEntry: entry => {
64
- if (entry.type === 'File' && isDeployArchiveFile(entry.path) && entry.size > LARGE_ARCHIVE_FILE_SIZE_LIMIT) {
65
- largeArchiveFiles.push({
66
- path: entry.path,
67
- size: entry.size
68
- });
69
- }
70
- }
71
- });
72
- return largeArchiveFiles;
96
+ const largeArchiveFiles = [];
97
+ await tar.list({
98
+ file: filePath,
99
+ onReadEntry: entry => {
100
+ if (entry.type === 'File' &&
101
+ isDeployArchiveFile(entry.path) &&
102
+ entry.size > exports.LARGE_ARCHIVE_FILE_SIZE_LIMIT) {
103
+ largeArchiveFiles.push({
104
+ path: entry.path,
105
+ size: entry.size,
106
+ });
107
+ }
108
+ },
109
+ });
110
+ return largeArchiveFiles;
73
111
  }
74
112
  async function findLargeArchiveFilesInDeployArchive(filePath) {
75
- const ext = getDeployFileExt(filePath);
76
- if (ext === '.zip') {
77
- return findLargeArchiveFilesInZipArchive(filePath);
78
- }
79
- if (ext === '.tar.gz' || ext === '.tgz') {
80
- return findLargeArchiveFilesInTarArchive(filePath);
81
- }
82
- return [];
113
+ const ext = getDeployFileExt(filePath);
114
+ if (ext === '.zip') {
115
+ return findLargeArchiveFilesInZipArchive(filePath);
116
+ }
117
+ if (ext === '.tar.gz' || ext === '.tgz') {
118
+ return findLargeArchiveFilesInTarArchive(filePath);
119
+ }
120
+ return [];
83
121
  }
84
-
85
122
  /**
86
123
  * Check if a file has a valid extension
87
124
  *
@@ -89,24 +126,22 @@ async function findLargeArchiveFilesInDeployArchive(filePath) {
89
126
  * @returns {boolean} True if the extension is valid
90
127
  */
91
128
  function validateDeployFileExt(filename) {
92
- const ext = getDeployFileExt(filename);
93
- if (!['.zip', '.tar.gz', '.tgz'].includes(ext)) {
94
- exit.withError(errorMessages.invalidExt);
95
- }
129
+ const ext = getDeployFileExt(filename);
130
+ if (!['.zip', '.tar.gz', '.tgz'].includes(ext)) {
131
+ exit.withError(errorMessages.invalidExt);
132
+ }
96
133
  }
97
-
98
134
  /**
99
135
  * Check if a file has a valid name
100
136
  * @param {string} filename The file name
101
137
  * @returns {boolean} True if the filename is valid
102
138
  */
103
139
  function validateFilename(filename) {
104
- const re = /^[a-z0-9\-_.]+$/i;
105
- if (!re.test(filename)) {
106
- exit.withError(errorMessages.invalidChars(filename, '[0-9,a-z,A-Z,-,_,.]'));
107
- }
140
+ const re = /^[a-z0-9\-_.]+$/i;
141
+ if (!re.test(filename)) {
142
+ exit.withError(errorMessages.invalidChars(filename, '[0-9,a-z,A-Z,-,_,.]'));
143
+ }
108
144
  }
109
-
110
145
  /**
111
146
  * Validate the name of a file for disallowed characters
112
147
  *
@@ -114,41 +149,37 @@ function validateFilename(filename) {
114
149
  * @param {bool} isDirectory Whether the file is a directory
115
150
  */
116
151
  function validateName(name, isDirectory) {
117
- if (name.startsWith('._')) {
118
- return;
119
- }
120
- const invalidCharsPattern = isDirectory ? /[!:*?"<>|']|^\.\..*$/ : /[!/:*?"<>|']|^\.\..*$/;
121
- const errorMessage = errorMessages.invalidChars(name, isDirectory ? '[!:*?"<>|\'/^..]+' : '[!/:*?"<>|\'/^..]+');
122
- if (invalidCharsPattern.test(name)) {
123
- exit.withError(errorMessage);
124
- }
152
+ if (name.startsWith('._')) {
153
+ return;
154
+ }
155
+ const invalidCharsPattern = isDirectory ? /[!:*?"<>|']|^\.\..*$/ : /[!/:*?"<>|']|^\.\..*$/;
156
+ const errorMessage = errorMessages.invalidChars(name, isDirectory ? '[!:*?"<>|\'/^..]+' : '[!/:*?"<>|\'/^..]+');
157
+ if (invalidCharsPattern.test(name)) {
158
+ exit.withError(errorMessage);
159
+ }
125
160
  }
126
-
127
161
  /**
128
162
  * Validate the existence of a symlink in a zip file. Ignores symlinks in node_modules/.bin/
129
163
  *
130
164
  * @param {ZipEntry} entry The zip entry to validate
131
165
  */
132
166
  function validateZipSymlink(entry) {
133
- if (symlinkIgnorePattern.test(entry.name)) {
134
- return;
135
- }
136
- const madeBy = entry.verMade >> 8; // eslint-disable-line no-bitwise
137
- const errorMsg = errorMessages.symlink + entry.name;
138
-
139
- // DOS
140
- /* eslint-disable no-bitwise */
141
- if (madeBy === 0 && (entry.attr & 0x0400) === 0x0400) {
142
- exit.withError(errorMsg);
143
- }
144
-
145
- // Unix
146
- if (madeBy === 3 && (entry.attr >>> 16 & _nodeFs.constants.S_IFLNK) === _nodeFs.constants.S_IFLNK) {
147
- /* eslint-enable no-bitwise */
148
- exit.withError(errorMsg);
149
- }
167
+ if (symlinkIgnorePattern.test(entry.name)) {
168
+ return;
169
+ }
170
+ const madeBy = entry.verMade >> 8; // eslint-disable-line no-bitwise
171
+ const errorMsg = errorMessages.symlink + entry.name;
172
+ // DOS
173
+ /* eslint-disable no-bitwise */
174
+ if (madeBy === 0 && (entry.attr & 0x0400) === 0x0400) {
175
+ exit.withError(errorMsg);
176
+ }
177
+ // Unix
178
+ if (madeBy === 3 && ((entry.attr >>> 16) & node_fs_1.constants.S_IFLNK) === node_fs_1.constants.S_IFLNK) {
179
+ /* eslint-enable no-bitwise */
180
+ exit.withError(errorMsg);
181
+ }
150
182
  }
151
-
152
183
  /**
153
184
  * Validate a zip entry for disallowed characters and symlinks.
154
185
  * Ignores __MACOSX directories.
@@ -156,13 +187,12 @@ function validateZipSymlink(entry) {
156
187
  * @param {ZipEntry} entry The zip entry to validate
157
188
  */
158
189
  function validateZipEntry(entry) {
159
- if (entry.name.startsWith(macosxDir)) {
160
- return;
161
- }
162
- validateName(entry.isDirectory ? entry.name : _path.default.basename(entry.name), entry.isDirectory);
163
- validateZipSymlink(entry);
190
+ if (entry.name.startsWith(macosxDir)) {
191
+ return;
192
+ }
193
+ validateName(entry.isDirectory ? entry.name : path_1.default.basename(entry.name), entry.isDirectory);
194
+ validateZipSymlink(entry);
164
195
  }
165
-
166
196
  /**
167
197
  * Validate the existence of a themes directory in the root folder.
168
198
  *
@@ -170,41 +200,40 @@ function validateZipEntry(entry) {
170
200
  * @param {ZipEntry[]} zipEntries The zip entries to validate
171
201
  */
172
202
  function validateZipThemes(rootFolder, zipEntries) {
173
- const hasThemesDir = zipEntries.some(entry => {
174
- // Convert win32 path separators to posix path separators
175
- const posixPath = entry.name.replace(/\\/g, '/');
176
- const requiredPosixPath = _path.default.join(rootFolder, 'themes/').replace(/\\/g, '/');
177
- return entry.isDirectory && posixPath.startsWith(requiredPosixPath);
178
- });
179
- if (!hasThemesDir) {
180
- exit.withError(errorMessages.missingThemes);
181
- }
203
+ const hasThemesDir = zipEntries.some(entry => {
204
+ // Convert win32 path separators to posix path separators
205
+ const posixPath = entry.name.replace(/\\/g, '/');
206
+ const requiredPosixPath = path_1.default.join(rootFolder, 'themes/').replace(/\\/g, '/');
207
+ return entry.isDirectory && posixPath.startsWith(requiredPosixPath);
208
+ });
209
+ if (!hasThemesDir) {
210
+ exit.withError(errorMessages.missingThemes);
211
+ }
182
212
  }
183
-
184
213
  /**
185
214
  * Validate a zip file for Custom Deployments.
186
215
  *
187
216
  * @param {string} filePath The path to the zip file
188
217
  */
189
218
  async function validateZipFile(filePath) {
190
- try {
191
- const zipFile = new _nodeStreamZip.default.async({
192
- file: filePath
193
- });
194
- const zipEntries = await zipFile.entries();
195
- const rootDirs = Object.values(zipEntries).filter(entry => entry.isDirectory && !entry.name.startsWith(macosxDir) && (entry.name.match(/\//g) || []).length === 1);
196
- if (rootDirs.length !== 1) {
197
- exit.withError(errorMessages.singleRootDir);
219
+ try {
220
+ const zipFile = new node_stream_zip_1.default.async({ file: filePath });
221
+ const zipEntries = await zipFile.entries();
222
+ const rootDirs = Object.values(zipEntries).filter(entry => entry.isDirectory &&
223
+ !entry.name.startsWith(macosxDir) &&
224
+ (entry.name.match(/\//g) || []).length === 1);
225
+ if (rootDirs.length !== 1) {
226
+ exit.withError(errorMessages.singleRootDir);
227
+ }
228
+ const rootFolder = rootDirs[0].name;
229
+ validateZipThemes(rootFolder, Object.values(zipEntries));
230
+ Object.values(zipEntries).forEach(entry => validateZipEntry(entry));
231
+ }
232
+ catch (error) {
233
+ const err = error;
234
+ exit.withError(`Error reading file: ${err.message}`);
198
235
  }
199
- const rootFolder = rootDirs[0].name;
200
- validateZipThemes(rootFolder, Object.values(zipEntries));
201
- Object.values(zipEntries).forEach(entry => validateZipEntry(entry));
202
- } catch (error) {
203
- const err = error;
204
- exit.withError(`Error reading file: ${err.message}`);
205
- }
206
236
  }
207
-
208
237
  /**
209
238
  * Validate the existence of a themes directory in the root folder in a tar file.
210
239
  *
@@ -212,81 +241,84 @@ async function validateZipFile(filePath) {
212
241
  * @param {TarEntry[]} tarEntries The list of tar entries
213
242
  */
214
243
  function validateTarThemes(rootFolder, tarEntries) {
215
- const themesFolderPath = _path.default.join(rootFolder, 'themes/');
216
- const themesFolderExists = tarEntries.some(entry => entry.path === themesFolderPath && entry.type === 'Directory');
217
- if (!themesFolderExists) {
218
- exit.withError(errorMessages.missingThemes);
219
- }
244
+ const themesFolderPath = path_1.default.join(rootFolder, 'themes/');
245
+ const themesFolderExists = tarEntries.some(entry => entry.path === themesFolderPath && entry.type === 'Directory');
246
+ if (!themesFolderExists) {
247
+ exit.withError(errorMessages.missingThemes);
248
+ }
220
249
  }
221
-
222
250
  /**
223
251
  * Validate a tar entry for disallowed characters and symlinks.
224
252
  *
225
253
  * @param {TarEntry} entry The tar entry to validate
226
254
  */
227
255
  function validateTarEntry(entry) {
228
- if (entry.path.startsWith(macosxDir)) {
229
- return;
230
- }
231
- validateTarSymlink(entry);
232
- validateName(_path.default.basename(entry.path), entry.type === 'Directory');
256
+ if (entry.path.startsWith(macosxDir)) {
257
+ return;
258
+ }
259
+ validateTarSymlink(entry);
260
+ validateName(path_1.default.basename(entry.path), entry.type === 'Directory');
233
261
  }
234
-
235
262
  /**
236
263
  * Validate the existence of a symlink in a tar file. Ignores symlinks in node_modules/.bin/
237
264
  *
238
265
  * @param {TarEntry} entry The tar entry to validate for symlinks
239
266
  */
240
267
  function validateTarSymlink(entry) {
241
- if (symlinkIgnorePattern.test(entry.path)) {
242
- return;
243
- }
244
- if (entry.type === 'SymbolicLink') {
245
- exit.withError(errorMessages.symlink + entry.path);
246
- }
268
+ if (symlinkIgnorePattern.test(entry.path)) {
269
+ return;
270
+ }
271
+ if (entry.type === 'SymbolicLink') {
272
+ exit.withError(errorMessages.symlink + entry.path);
273
+ }
247
274
  }
248
-
249
275
  /**
250
276
  * Validate a tar file for Custom Deployments.
251
277
  *
252
278
  * @param {string} filePath The path to the tar file
253
279
  */
254
280
  async function validateTarFile(filePath) {
255
- const tarEntries = [];
256
- let rootFolder = null;
257
- try {
258
- await tar.list({
259
- file: filePath,
260
- onReadEntry: entry => {
261
- if (entry.path.startsWith(macosxDir)) {
262
- return;
263
- }
264
- if (entry.type !== 'File' && entry.type !== 'Directory' && entry.type !== 'SymbolicLink') {
265
- return;
266
- }
267
- const isRootFolder = entry.type === 'Directory' && entry.path.endsWith('/') && (entry.path.match(/\//g) || []).length === 1;
268
- if (isRootFolder) {
269
- if (rootFolder === null) {
270
- rootFolder = entry.path;
271
- } else if (rootFolder !== entry.path) {
281
+ const tarEntries = [];
282
+ let rootFolder = null;
283
+ try {
284
+ await tar.list({
285
+ file: filePath,
286
+ onReadEntry: entry => {
287
+ if (entry.path.startsWith(macosxDir)) {
288
+ return;
289
+ }
290
+ if (entry.type !== 'File' &&
291
+ entry.type !== 'Directory' &&
292
+ entry.type !== 'SymbolicLink') {
293
+ return;
294
+ }
295
+ const isRootFolder = entry.type === 'Directory' &&
296
+ entry.path.endsWith('/') &&
297
+ (entry.path.match(/\//g) || []).length === 1;
298
+ if (isRootFolder) {
299
+ if (rootFolder === null) {
300
+ rootFolder = entry.path;
301
+ }
302
+ else if (rootFolder !== entry.path) {
303
+ exit.withError(errorMessages.singleRootDir);
304
+ }
305
+ }
306
+ const entryInfo = {
307
+ path: entry.path,
308
+ type: entry.type,
309
+ mode: entry.mode,
310
+ };
311
+ validateTarEntry(entryInfo);
312
+ tarEntries.push(entryInfo);
313
+ },
314
+ });
315
+ if (!rootFolder) {
272
316
  exit.withError(errorMessages.singleRootDir);
273
- }
274
317
  }
275
- const entryInfo = {
276
- path: entry.path,
277
- type: entry.type,
278
- mode: entry.mode
279
- };
280
- validateTarEntry(entryInfo);
281
- tarEntries.push(entryInfo);
282
- }
283
- });
284
- if (!rootFolder) {
285
- exit.withError(errorMessages.singleRootDir);
318
+ validateTarThemes(rootFolder, tarEntries);
286
319
  }
287
- validateTarThemes(rootFolder, tarEntries);
288
- } catch (error) {
289
- const err = error;
290
- exit.withError(err.message);
291
- }
292
- }
320
+ catch (error) {
321
+ const err = error;
322
+ exit.withError(err.message);
323
+ }
324
+ }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.sqlDumpLineIsMultiSite = sqlDumpLineIsMultiSite;
5
4
  const SQL_CREATE_TABLE_IS_MULTISITE_REGEX = /^CREATE TABLE(?: IF NOT EXISTS)? `?(wp_\d+_[a-z0-9_]*|wp_blogs)/i;
6
5
  const SQL_CONTAINS_MULTISITE_WP_USERS_REGEX = /`spam` tinyint\(2\)|`deleted` tinyint\(2\)/i;
7
6
  function sqlDumpLineIsMultiSite(line) {
8
- // determine if we're on a CREATE TABLE statement line what has eg. wp_\d_options OR wp_blogs
9
- // also check if we're on a line that defines the additional two columns found on the wp_users table for multisites
10
- return SQL_CREATE_TABLE_IS_MULTISITE_REGEX.test(line) || SQL_CONTAINS_MULTISITE_WP_USERS_REGEX.test(line);
11
- }
7
+ // determine if we're on a CREATE TABLE statement line what has eg. wp_\d_options OR wp_blogs
8
+ // also check if we're on a line that defines the additional two columns found on the wp_users table for multisites
9
+ return (SQL_CREATE_TABLE_IS_MULTISITE_REGEX.test(line) ||
10
+ SQL_CONTAINS_MULTISITE_WP_USERS_REGEX.test(line));
11
+ }