@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,15 +1,13 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitca = splitca;
4
4
  exports.getDockerSocket = getDockerSocket;
5
5
  exports.getEngineConfig = getEngineConfig;
6
- exports.splitca = splitca;
7
- var _nodeFs = require("node:fs");
8
- var _promises = require("node:fs/promises");
9
- var _nodeOs = require("node:os");
10
- var _nodePath = require("node:path");
11
6
  /* eslint-disable no-await-in-loop */
12
-
7
+ const node_fs_1 = require("node:fs");
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = require("node:path");
13
11
  /**
14
12
  * Reads a Certificate Authority file and returns it as an array of certificates
15
13
  *
@@ -17,95 +15,103 @@ var _nodePath = require("node:path");
17
15
  * @return {string[]} Array of certificates
18
16
  */
19
17
  async function splitca(filepath) {
20
- const ca = [];
21
- const data = await (0, _promises.readFile)(filepath, 'utf-8');
22
- if (!data.includes('-END CERTIFICATE-') || !data.includes('-BEGIN CERTIFICATE-')) {
23
- throw new Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");
24
- }
25
- const chain = data.split('\n');
26
- let cert = [];
27
- for (const line of chain) {
28
- if (line) {
29
- cert.push(line);
30
- if (/-END CERTIFICATE-/.exec(line)) {
31
- ca.push(cert.join('\n'));
32
- cert = [];
33
- }
18
+ const ca = [];
19
+ const data = await (0, promises_1.readFile)(filepath, 'utf-8');
20
+ if (!data.includes('-END CERTIFICATE-') || !data.includes('-BEGIN CERTIFICATE-')) {
21
+ throw new Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");
34
22
  }
35
- }
36
- return ca;
23
+ const chain = data.split('\n');
24
+ let cert = [];
25
+ for (const line of chain) {
26
+ if (line) {
27
+ cert.push(line);
28
+ if (/-END CERTIFICATE-/.exec(line)) {
29
+ ca.push(cert.join('\n'));
30
+ cert = [];
31
+ }
32
+ }
33
+ }
34
+ return ca;
37
35
  }
38
36
  async function canReadWrite(what) {
39
- try {
40
- // eslint-disable-next-line no-bitwise
41
- await (0, _promises.access)(what, _nodeFs.constants.R_OK | _nodeFs.constants.W_OK);
42
- return true;
43
- } catch {
44
- return false;
45
- }
46
- }
47
- async function getDockerSocket() {
48
- if ((0, _nodeOs.platform)() !== 'win32') {
49
- const possibleSocket = process.env.DOCKER_HOST ?? '';
50
- // If `DOCKER_HOST` is set and not empty, and if it does not point to a unix socket, return - not much that we can do here.
51
- if (possibleSocket && !possibleSocket.startsWith('unix://')) {
52
- return possibleSocket;
37
+ try {
38
+ // eslint-disable-next-line no-bitwise
39
+ await (0, promises_1.access)(what, node_fs_1.constants.R_OK | node_fs_1.constants.W_OK);
40
+ return true;
53
41
  }
54
- const paths = [];
55
- if (possibleSocket) {
56
- // This is a UNIX socket, strip the leading `unix://` prefix and make sure the path starts with a slash.
57
- // (there are cases when the path is prefixed with two or three slashes)
58
- paths.push(possibleSocket.replace(/^unix:\/+/, '/'));
42
+ catch {
43
+ return false;
59
44
  }
60
-
61
- // Try the default location
62
- paths.push('/var/run/docker.sock');
63
- // Try alternative locations
64
- paths.push('/run/docker.sock');
65
- paths.push((0, _nodePath.join)((0, _nodeOs.homedir)(), '.docker', 'run', 'docker.sock'));
66
- paths.push((0, _nodePath.join)((0, _nodeOs.homedir)(), '.colima', 'default', 'docker.sock'));
67
- paths.push((0, _nodePath.join)((0, _nodeOs.homedir)(), '.orbstack', 'run', 'docker.sock'));
68
- for (const socketPath of paths) {
69
- try {
70
- const stats = await (0, _promises.stat)(socketPath);
71
- if (stats.isSocket() && (await canReadWrite(socketPath))) {
72
- process.env.DOCKER_HOST = `unix://${socketPath}`;
73
- return socketPath;
45
+ }
46
+ async function getDockerSocket() {
47
+ if ((0, node_os_1.platform)() !== 'win32') {
48
+ const possibleSocket = process.env.DOCKER_HOST ?? '';
49
+ // If `DOCKER_HOST` is set and not empty, and if it does not point to a unix socket, return - not much that we can do here.
50
+ if (possibleSocket && !possibleSocket.startsWith('unix://')) {
51
+ return possibleSocket;
52
+ }
53
+ const paths = [];
54
+ if (possibleSocket) {
55
+ // This is a UNIX socket, strip the leading `unix://` prefix and make sure the path starts with a slash.
56
+ // (there are cases when the path is prefixed with two or three slashes)
57
+ paths.push(possibleSocket.replace(/^unix:\/+/, '/'));
58
+ }
59
+ // Try the default location
60
+ paths.push('/var/run/docker.sock');
61
+ // Try alternative locations
62
+ paths.push('/run/docker.sock');
63
+ paths.push((0, node_path_1.join)((0, node_os_1.homedir)(), '.docker', 'run', 'docker.sock'));
64
+ paths.push((0, node_path_1.join)((0, node_os_1.homedir)(), '.colima', 'default', 'docker.sock'));
65
+ paths.push((0, node_path_1.join)((0, node_os_1.homedir)(), '.orbstack', 'run', 'docker.sock'));
66
+ for (const socketPath of paths) {
67
+ try {
68
+ const stats = await (0, promises_1.stat)(socketPath);
69
+ if (stats.isSocket() && (await canReadWrite(socketPath))) {
70
+ process.env.DOCKER_HOST = `unix://${socketPath}`;
71
+ return socketPath;
72
+ }
73
+ }
74
+ catch {
75
+ // Do nothing
76
+ }
74
77
  }
75
- } catch {
76
- // Do nothing
77
- }
78
78
  }
79
- }
80
- return null;
79
+ return null;
81
80
  }
82
81
  async function getEngineConfig(dockerHost) {
83
- const opts = {};
84
- if (dockerHost.startsWith('tcp://')) {
85
- const split = /^(?:tcp:\/\/)([^:]+):(\d+)/g.exec(dockerHost);
86
- if (split && split.length === 3) {
87
- opts.host = split[1];
88
- opts.port = split[2];
89
- } else {
90
- throw new Error('Invalid DOCKER_HOST format');
82
+ const opts = {};
83
+ if (dockerHost.startsWith('tcp://')) {
84
+ const split = /^(?:tcp:\/\/)([^:]+):(\d+)/g.exec(dockerHost);
85
+ if (split && split.length === 3) {
86
+ opts.host = split[1];
87
+ opts.port = split[2];
88
+ }
89
+ else {
90
+ throw new Error('Invalid DOCKER_HOST format');
91
+ }
92
+ }
93
+ else {
94
+ opts.socketPath = dockerHost;
95
+ }
96
+ if (process.env.DOCKER_TLS_VERIFY === '1' || opts.port === '2376') {
97
+ opts.protocol = 'https';
91
98
  }
92
- } else {
93
- opts.socketPath = dockerHost;
94
- }
95
- if (process.env.DOCKER_TLS_VERIFY === '1' || opts.port === '2376') {
96
- opts.protocol = 'https';
97
- } else {
98
- opts.protocol = 'http';
99
- }
100
- const certPath = process.env.DOCKER_CERT_PATH;
101
- if (certPath) {
102
- const [ca, cert, key] = await Promise.all([splitca((0, _nodePath.join)(certPath, 'ca.pem')), (0, _promises.readFile)((0, _nodePath.join)(certPath, 'cert.pem'), 'utf-8'), (0, _promises.readFile)((0, _nodePath.join)(certPath, 'key.pem'), 'utf-8')]);
103
- opts.ca = ca;
104
- opts.cert = cert;
105
- opts.key = key;
106
- }
107
- if (process.env.DOCKER_CLIENT_TIMEOUT) {
108
- opts.timeout = parseInt(process.env.DOCKER_CLIENT_TIMEOUT, 10);
109
- }
110
- return opts;
111
- }
99
+ else {
100
+ opts.protocol = 'http';
101
+ }
102
+ const certPath = process.env.DOCKER_CERT_PATH;
103
+ if (certPath) {
104
+ const [ca, cert, key] = await Promise.all([
105
+ splitca((0, node_path_1.join)(certPath, 'ca.pem')),
106
+ (0, promises_1.readFile)((0, node_path_1.join)(certPath, 'cert.pem'), 'utf-8'),
107
+ (0, promises_1.readFile)((0, node_path_1.join)(certPath, 'key.pem'), 'utf-8'),
108
+ ]);
109
+ opts.ca = ca;
110
+ opts.cert = cert;
111
+ opts.key = key;
112
+ }
113
+ if (process.env.DOCKER_CLIENT_TIMEOUT) {
114
+ opts.timeout = parseInt(process.env.DOCKER_CLIENT_TIMEOUT, 10);
115
+ }
116
+ return opts;
117
+ }
@@ -1,75 +1,77 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.getEnvFilePath = getEnvFilePath;
5
- exports.parseEnvValue = parseEnvValue;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.preparseEnvData = preparseEnvData;
4
+ exports.parseEnvValue = parseEnvValue;
7
5
  exports.quoteEnvValue = quoteEnvValue;
6
+ exports.getEnvFilePath = getEnvFilePath;
8
7
  exports.readEnvFile = readEnvFile;
9
8
  exports.updateEnvFile = updateEnvFile;
10
- var _promises = require("node:fs/promises");
11
- var _nodePath = require("node:path");
12
- var _devEnvironmentCore = require("./dev-environment-core");
13
- var _devEnvironment = require("../constants/dev-environment");
9
+ const promises_1 = require("node:fs/promises");
10
+ const node_path_1 = require("node:path");
11
+ const dev_environment_core_1 = require("./dev-environment-core");
12
+ const dev_environment_1 = require("../constants/dev-environment");
14
13
  function preparseEnvData(data) {
15
- return data.split(/\r?\n/).map(line => line.trim()).filter(line => line && !line.startsWith('#'));
14
+ return data
15
+ .split(/\r?\n/)
16
+ .map(line => line.trim())
17
+ .filter(line => line && !line.startsWith('#'));
16
18
  }
17
19
  function parseEnvValue(value) {
18
- if (value.startsWith('"') && value.endsWith('"')) {
19
- return value.slice(1, -1).replace(/\\(["$\\nrt])/g, (match, char) => {
20
- switch (char) {
21
- case '"':
22
- case '$':
23
- case '\\':
24
- return char;
25
- case 'n':
26
- return '\n';
27
- case 'r':
28
- return '\r';
29
- case 't':
30
- return '\t';
31
- default:
32
- return match;
33
- }
34
- });
35
- }
36
- if (value.startsWith("'") && value.endsWith("'")) {
37
- return value.slice(1, -1).replace(/\\'/g, "'");
38
- }
39
- return value;
20
+ if (value.startsWith('"') && value.endsWith('"')) {
21
+ return value.slice(1, -1).replace(/\\(["$\\nrt])/g, (match, char) => {
22
+ switch (char) {
23
+ case '"':
24
+ case '$':
25
+ case '\\':
26
+ return char;
27
+ case 'n':
28
+ return '\n';
29
+ case 'r':
30
+ return '\r';
31
+ case 't':
32
+ return '\t';
33
+ default:
34
+ return match;
35
+ }
36
+ });
37
+ }
38
+ if (value.startsWith("'") && value.endsWith("'")) {
39
+ return value.slice(1, -1).replace(/\\'/g, "'");
40
+ }
41
+ return value;
40
42
  }
41
43
  function quoteEnvValue(value) {
42
- return `"${value.replace(/[\\"$\n\r\t]/g, match => {
43
- switch (match) {
44
- case '\\':
45
- case '"':
46
- case '$':
47
- return '\\' + match;
48
- case '\n':
49
- return '\\n';
50
- case '\r':
51
- return '\\r';
52
- case '\t':
53
- return '\\t';
54
- default:
55
- return match;
56
- }
57
- })}"`;
44
+ return `"${value.replace(/[\\"$\n\r\t]/g, match => {
45
+ switch (match) {
46
+ case '\\':
47
+ case '"':
48
+ case '$':
49
+ return '\\' + match;
50
+ case '\n':
51
+ return '\\n';
52
+ case '\r':
53
+ return '\\r';
54
+ case '\t':
55
+ return '\\t';
56
+ default:
57
+ return match;
58
+ }
59
+ })}"`;
58
60
  }
59
61
  async function getEnvFilePath(slug, checkEnvExists = true) {
60
- const environmentPath = (0, _devEnvironmentCore.getEnvironmentPath)(slug);
61
- if (checkEnvExists && !(await (0, _devEnvironmentCore.doesEnvironmentExist)(environmentPath))) {
62
- throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
63
- }
64
- return (0, _nodePath.join)(environmentPath, '.env');
62
+ const environmentPath = (0, dev_environment_core_1.getEnvironmentPath)(slug);
63
+ if (checkEnvExists && !(await (0, dev_environment_core_1.doesEnvironmentExist)(environmentPath))) {
64
+ throw new Error(dev_environment_1.DEV_ENVIRONMENT_NOT_FOUND);
65
+ }
66
+ return (0, node_path_1.join)(environmentPath, '.env');
65
67
  }
66
68
  async function readEnvFile(slug) {
67
- const name = await getEnvFilePath(slug);
68
- const content = await (0, _promises.readFile)(name, 'utf-8');
69
- return preparseEnvData(content);
69
+ const name = await getEnvFilePath(slug);
70
+ const content = await (0, promises_1.readFile)(name, 'utf-8');
71
+ return preparseEnvData(content);
70
72
  }
71
73
  async function updateEnvFile(slug, content) {
72
- const name = await getEnvFilePath(slug, false);
73
- await (0, _promises.writeFile)(`${name}.tmp`, content, 'utf-8');
74
- await (0, _promises.rename)(`${name}.tmp`, name);
75
- }
74
+ const name = await getEnvFilePath(slug, false);
75
+ await (0, promises_1.writeFile)(`${name}.tmp`, content, 'utf-8');
76
+ await (0, promises_1.rename)(`${name}.tmp`, name);
77
+ }
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.loadLandoModule = loadLandoModule;
5
4
  exports.resolveLandoModule = resolveLandoModule;
6
- var _nodeModule = require("node:module");
7
- const baseRequire = (0, _nodeModule.createRequire)(__filename);
5
+ const node_module_1 = require("node:module");
6
+ const baseRequire = (0, node_module_1.createRequire)(__filename);
8
7
  function loadLandoModule(request) {
9
- return baseRequire(request);
8
+ return baseRequire(request);
10
9
  }
11
10
  function resolveLandoModule(request) {
12
- return baseRequire.resolve(request);
13
- }
11
+ return baseRequire.resolve(request);
12
+ }
@@ -1 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,45 +1,51 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.confirmEdgeWorkerDeletion = confirmEdgeWorkerDeletion;
5
- exports.confirmProductionEdgeWorkerMutation = confirmProductionEdgeWorkerMutation;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.isInteractiveEdgeWorkers = isInteractiveEdgeWorkers;
7
- var _userError = _interopRequireDefault(require("../user-error"));
8
- var _output = require("./output");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ exports.confirmProductionEdgeWorkerMutation = confirmProductionEdgeWorkerMutation;
8
+ exports.confirmEdgeWorkerDeletion = confirmEdgeWorkerDeletion;
9
+ const user_error_1 = __importDefault(require("../user-error"));
10
+ const output_1 = require("./output");
10
11
  function isInteractiveEdgeWorkers(options) {
11
- return process.env.VIP_NON_INTERACTIVE !== '1' && !options.nonInteractive && Boolean(process.stdout.isTTY);
12
+ return (process.env.VIP_NON_INTERACTIVE !== '1' &&
13
+ !options.nonInteractive &&
14
+ Boolean(process.stdout.isTTY));
12
15
  }
13
16
  function productionMutationConfirmationMessage(request) {
14
- const target = `${(0, _output.escapeTerminalText)(request.appName)}.${(0, _output.escapeTerminalText)(request.envType)}`;
15
- if (request.action === 'enable') {
16
- return `Enable edge worker "${(0, _output.escapeTerminalText)(request.workerNames[0])}" on ${target}?`;
17
- }
18
- const action = request.enableAfterDeploy ? 'Deploy and enable' : 'Deploy';
19
- const workerLabel = request.workerNames.length === 1 ? 'edge worker' : 'edge workers';
20
- const preposition = request.enableAfterDeploy ? 'on' : 'to';
21
- const workerNames = request.workerNames.map(_output.escapeTerminalText).join(', ');
22
- return `${action} ${request.workerNames.length} ${workerLabel} (${workerNames}) ${preposition} ${target}?`;
17
+ const target = `${(0, output_1.escapeTerminalText)(request.appName)}.${(0, output_1.escapeTerminalText)(request.envType)}`;
18
+ if (request.action === 'enable') {
19
+ return `Enable edge worker "${(0, output_1.escapeTerminalText)(request.workerNames[0])}" on ${target}?`;
20
+ }
21
+ const action = request.enableAfterDeploy ? 'Deploy and enable' : 'Deploy';
22
+ const workerLabel = request.workerNames.length === 1 ? 'edge worker' : 'edge workers';
23
+ const preposition = request.enableAfterDeploy ? 'on' : 'to';
24
+ const workerNames = request.workerNames.map(output_1.escapeTerminalText).join(', ');
25
+ return `${action} ${request.workerNames.length} ${workerLabel} (${workerNames}) ${preposition} ${target}?`;
23
26
  }
24
27
  async function confirmProductionEdgeWorkerMutation(request, confirmFn) {
25
- if (request.envType !== 'production' || request.skipConfirmation) {
26
- return;
27
- }
28
- if (request.nonInteractive) {
29
- const action = request.action === 'deploy' && request.enableAfterDeploy ? 'deploy and enable' : request.action;
30
- throw new _userError.default(`Refusing to ${action} edge workers in production without confirmation. ` + 'Pass --skip-confirmation to proceed non-interactively.');
31
- }
32
- const message = productionMutationConfirmationMessage(request);
33
- if (!(await confirmFn(message))) {
34
- throw new _userError.default('Command cancelled by user.');
35
- }
28
+ if (request.envType !== 'production' || request.skipConfirmation) {
29
+ return;
30
+ }
31
+ if (request.nonInteractive) {
32
+ const action = request.action === 'deploy' && request.enableAfterDeploy
33
+ ? 'deploy and enable'
34
+ : request.action;
35
+ throw new user_error_1.default(`Refusing to ${action} edge workers in production without confirmation. ` +
36
+ 'Pass --skip-confirmation to proceed non-interactively.');
37
+ }
38
+ const message = productionMutationConfirmationMessage(request);
39
+ if (!(await confirmFn(message))) {
40
+ throw new user_error_1.default('Command cancelled by user.');
41
+ }
36
42
  }
37
43
  async function confirmEdgeWorkerDeletion(request, confirmFn) {
38
- if (request.force) {
39
- return;
40
- }
41
- const confirmed = await confirmFn(`Permanently delete edge worker "${(0, _output.escapeTerminalText)(request.workerName)}" from ${(0, _output.escapeTerminalText)(request.appName)}.${(0, _output.escapeTerminalText)(request.envType)}?`);
42
- if (!confirmed) {
43
- throw new _userError.default('Command cancelled by user.');
44
- }
45
- }
44
+ if (request.force) {
45
+ return;
46
+ }
47
+ const confirmed = await confirmFn(`Permanently delete edge worker "${(0, output_1.escapeTerminalText)(request.workerName)}" from ${(0, output_1.escapeTerminalText)(request.appName)}.${(0, output_1.escapeTerminalText)(request.envType)}?`);
48
+ if (!confirmed) {
49
+ throw new user_error_1.default('Command cancelled by user.');
50
+ }
51
+ }