@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,44 +1,42 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.TSCONFIG_JSON = exports.README = exports.PACKAGE_JSON = exports.GITIGNORE = void 0;
5
- exports.starterWorker = starterWorker;
6
- var _constants = require("./constants");
7
- var _project = require("../../project");
8
2
  /**
9
3
  * The files written into a scaffolded AssemblyScript project. Kept out of the
10
4
  * toolchain logic so the scaffold steps read cleanly; the dynamic bits (SDK
11
5
  * package name, workers dir, default entry) interpolate from shared constants so
12
6
  * there's a single source of truth.
13
7
  */
14
-
15
- const PACKAGE_JSON = exports.PACKAGE_JSON = {
16
- name: 'edge-workers',
17
- version: '0.0.0',
18
- private: true,
19
- description: 'VIP edge workers',
20
- type: 'module',
21
- scripts: {
22
- build: 'vip edge-workers build --all'
23
- },
24
- dependencies: {
25
- [_constants.SDK_PACKAGE]: _constants.SDK_VERSION
26
- },
27
- devDependencies: {
28
- assemblyscript: _constants.ASSEMBLYSCRIPT_VERSION
29
- }
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.README = exports.GITIGNORE = exports.TSCONFIG_JSON = exports.PACKAGE_JSON = void 0;
10
+ exports.starterWorker = starterWorker;
11
+ const constants_1 = require("./constants");
12
+ const project_1 = require("../../project");
13
+ exports.PACKAGE_JSON = {
14
+ name: 'edge-workers',
15
+ version: '0.0.0',
16
+ private: true,
17
+ description: 'VIP edge workers',
18
+ type: 'module',
19
+ scripts: {
20
+ build: 'vip edge-workers build --all',
21
+ },
22
+ dependencies: {
23
+ [constants_1.SDK_PACKAGE]: constants_1.SDK_VERSION,
24
+ },
25
+ devDependencies: {
26
+ assemblyscript: constants_1.ASSEMBLYSCRIPT_VERSION,
27
+ },
30
28
  };
31
- const TSCONFIG_JSON = exports.TSCONFIG_JSON = {
32
- extends: 'assemblyscript/std/assembly.json',
33
- include: ['./**/*.ts']
29
+ exports.TSCONFIG_JSON = {
30
+ extends: 'assemblyscript/std/assembly.json',
31
+ include: ['./**/*.ts'],
34
32
  };
35
- const GITIGNORE = exports.GITIGNORE = `node_modules/
36
- ${_project.BUILD_DIR}/
33
+ exports.GITIGNORE = `node_modules/
34
+ ${project_1.BUILD_DIR}/
37
35
  `;
38
- const README = exports.README = `# Edge workers
36
+ exports.README = `# Edge workers
39
37
 
40
38
  AssemblyScript edge workers for your VIP environment. Each worker lives in its
41
- own folder under \`${_project.WORKERS_DIR}/\` and is compiled to a \`.wasm\` binary that
39
+ own folder under \`${project_1.WORKERS_DIR}/\` and is compiled to a \`.wasm\` binary that
42
40
  runs at the edge.
43
41
 
44
42
  ## Getting started
@@ -46,7 +44,7 @@ runs at the edge.
46
44
  \`\`\`sh
47
45
  npm install # install the SDK + compiler
48
46
  vip edge-workers new my-worker # scaffold a new worker
49
- # edit ${_project.WORKERS_DIR}/my-worker/${_constants.DEFAULT_ENTRY}
47
+ # edit ${project_1.WORKERS_DIR}/my-worker/${constants_1.DEFAULT_ENTRY}
50
48
  vip @my-site.develop edge-workers deploy my-worker
51
49
  \`\`\`
52
50
 
@@ -62,9 +60,9 @@ To work with JSON in a worker, install [json-as](https://www.npmjs.com/package/j
62
60
  transform automatically when the package is present.
63
61
  `;
64
62
  function starterWorker() {
65
- return `import { Response, onClientResponse } from '${_constants.SDK_PACKAGE}';
63
+ return `import { Response, onClientResponse } from '${constants_1.SDK_PACKAGE}';
66
64
 
67
- export { alloc, on_client_response } from '${_constants.SDK_PACKAGE}/assembly/index';
65
+ export { alloc, on_client_response } from '${constants_1.SDK_PACKAGE}/assembly/index';
68
66
 
69
67
  // Client response: runs before the response reaches the client.
70
68
  onClientResponse( ( response: Response ): void => {} );
@@ -82,4 +80,4 @@ onClientResponse( ( response: Response ): void => {} );
82
80
  // Origin response: Response, onOriginResponse, on_origin_response
83
81
  // onOriginResponse( ( response: Response ): void => {} );
84
82
  `;
85
- }
83
+ }
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.getToolchain = getToolchain;
5
- var _userError = _interopRequireDefault(require("../../user-error"));
6
- var _types = require("../types");
7
- var _assemblyscript = _interopRequireDefault(require("./assemblyscript"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
2
  /**
10
3
  * Toolchain registry.
11
4
  *
@@ -17,14 +10,21 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
10
  * is language-neutral, so adding a new language (e.g. Rust) means implementing
18
11
  * one Toolchain and registering it here — nothing in the command layer changes.
19
12
  */
20
-
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getToolchain = getToolchain;
18
+ const user_error_1 = __importDefault(require("../../user-error"));
19
+ const types_1 = require("../types");
20
+ const assemblyscript_1 = __importDefault(require("./assemblyscript"));
21
21
  const TOOLCHAINS = {
22
- assemblyscript: _assemblyscript.default
22
+ assemblyscript: assemblyscript_1.default,
23
23
  };
24
24
  function getToolchain(type) {
25
- const toolchain = TOOLCHAINS[type];
26
- if (!toolchain) {
27
- throw new _userError.default(`Unknown edge worker type "${type}". Supported types: ${_types.SUPPORTED_EDGE_WORKER_TYPES.join(', ')}.`);
28
- }
29
- return toolchain;
30
- }
25
+ const toolchain = TOOLCHAINS[type];
26
+ if (!toolchain) {
27
+ throw new user_error_1.default(`Unknown edge worker type "${type}". Supported types: ${types_1.SUPPORTED_EDGE_WORKER_TYPES.join(', ')}.`);
28
+ }
29
+ return toolchain;
30
+ }
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.SUPPORTED_EDGE_WORKER_TYPES = exports.EDGE_WORKER_LOCATION_OPERATORS = exports.DEFAULT_EDGE_WORKER_TYPE = void 0;
5
2
  /**
6
3
  * Shared types for the edge-workers commands.
7
4
  *
@@ -9,38 +6,13 @@ exports.SUPPORTED_EDGE_WORKER_TYPES = exports.EDGE_WORKER_LOCATION_OPERATORS = e
9
6
  * lives behind the Toolchain abstraction; the remote half (upload, list, toggle)
10
7
  * is language-neutral because the deployable artifact is always a `.wasm` binary.
11
8
  */
12
-
13
- /**
14
- * The languages/SDKs an edge-workers project can be scaffolded with. Only
15
- * AssemblyScript is implemented today; new toolchains slot in via the registry
16
- * in `./toolchains` without touching the command layer.
17
- */
18
-
19
- const SUPPORTED_EDGE_WORKER_TYPES = exports.SUPPORTED_EDGE_WORKER_TYPES = ['assemblyscript'];
20
- const DEFAULT_EDGE_WORKER_TYPE = exports.DEFAULT_EDGE_WORKER_TYPE = 'assemblyscript';
21
-
22
- /** The behavior to apply when a worker errors at runtime (mirrors the API enum). */
23
-
24
- /** The request/response phases a worker hooks into, derived from its wasm exports (mirrors the API enum). */
25
-
26
- /** The operators available for matching an edge worker's location (mirrors the API enum). */
27
-
28
- const EDGE_WORKER_LOCATION_OPERATORS = exports.EDGE_WORKER_LOCATION_OPERATORS = ['contains', 'equals', 'starts_with', 'ends_with'];
29
-
30
- /** A rule scoping which requests a worker runs on. Runs on all requests when absent. */
31
-
32
- /**
33
- * The project descriptor written once at `init` to the project root
34
- * (`edge-workers.json`). It records which toolchain the project uses so that
35
- * `new`/`build`/`deploy` can dispatch without re-asking. It is intentionally NOT
36
- * a registry of workers — workers are discovered by scanning for `worker.json`.
37
- */
38
-
39
- /**
40
- * The per-worker manifest (`worker.json`) co-located with each worker's code.
41
- * Holds exactly the metadata the create/update API needs, keyed by `name`.
42
- */
43
-
44
- /** A worker discovered on disk: its directory plus parsed manifest. */
45
-
46
- /** A deployed edge worker as returned by the API. */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EDGE_WORKER_LOCATION_OPERATORS = exports.DEFAULT_EDGE_WORKER_TYPE = exports.SUPPORTED_EDGE_WORKER_TYPES = void 0;
11
+ exports.SUPPORTED_EDGE_WORKER_TYPES = ['assemblyscript'];
12
+ exports.DEFAULT_EDGE_WORKER_TYPE = 'assemblyscript';
13
+ exports.EDGE_WORKER_LOCATION_OPERATORS = [
14
+ 'contains',
15
+ 'equals',
16
+ 'starts_with',
17
+ 'ends_with',
18
+ ];
@@ -1,191 +1,202 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.parseProjectDescriptor = parseProjectDescriptor;
5
- exports.parseWorkerManifest = parseWorkerManifest;
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
+ exports.validateWorkerName = validateWorkerName;
7
+ exports.resolvePathWithin = resolvePathWithin;
6
8
  exports.resolveExistingPathWithin = resolveExistingPathWithin;
7
9
  exports.resolveOutputPathWithin = resolveOutputPathWithin;
8
- exports.resolvePathWithin = resolvePathWithin;
9
- exports.validateWorkerName = validateWorkerName;
10
- var _nodeFs = _interopRequireDefault(require("node:fs"));
11
- var _nodePath = _interopRequireDefault(require("node:path"));
12
- var _userError = _interopRequireDefault(require("../user-error"));
13
- var _output = require("./output");
14
- var _types = require("./types");
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ exports.parseProjectDescriptor = parseProjectDescriptor;
11
+ exports.parseWorkerManifest = parseWorkerManifest;
12
+ const node_fs_1 = __importDefault(require("node:fs"));
13
+ const node_path_1 = __importDefault(require("node:path"));
14
+ const user_error_1 = __importDefault(require("../user-error"));
15
+ const output_1 = require("./output");
16
+ const types_1 = require("./types");
16
17
  // eslint-disable-next-line security/detect-unsafe-regex
17
18
  const WINDOWS_RESERVED_NAME = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i;
18
19
  // This range deliberately rejects every Windows-disallowed control character.
19
20
  // eslint-disable-next-line no-control-regex
20
21
  const INVALID_PATH_CHARACTER = /[<>:"/\\|?*\u0000-\u001f]/;
21
22
  function validateWorkerName(name, label = 'worker name') {
22
- if (typeof name !== 'string' || name.length === 0 || name.length > 64 || name === '.' || name === '..' || INVALID_PATH_CHARACTER.test(name) || /[. ]$/.test(name) || WINDOWS_RESERVED_NAME.test(name)) {
23
- throw new _userError.default(`Invalid ${label} "${String(name)}".`);
24
- }
25
- return name;
23
+ if (typeof name !== 'string' ||
24
+ name.length === 0 ||
25
+ name.length > 64 ||
26
+ name === '.' ||
27
+ name === '..' ||
28
+ INVALID_PATH_CHARACTER.test(name) ||
29
+ /[. ]$/.test(name) ||
30
+ WINDOWS_RESERVED_NAME.test(name)) {
31
+ throw new user_error_1.default(`Invalid ${label} "${String(name)}".`);
32
+ }
33
+ return name;
26
34
  }
27
35
  function resolvePathWithin(root, relativePath, label) {
28
- if (typeof relativePath !== 'string' || relativePath.length === 0 || _nodePath.default.isAbsolute(relativePath)) {
29
- throw new _userError.default(`${label} must be a non-empty relative path.`);
30
- }
31
- const resolvedRoot = _nodePath.default.resolve(root);
32
- const resolvedPath = _nodePath.default.resolve(resolvedRoot, relativePath);
33
- const relative = _nodePath.default.relative(resolvedRoot, resolvedPath);
34
- if (relative === '..' || relative.startsWith(`..${_nodePath.default.sep}`) || _nodePath.default.isAbsolute(relative)) {
35
- throw new _userError.default(`${label} must stay within "${resolvedRoot}".`);
36
- }
37
- return resolvedPath;
36
+ if (typeof relativePath !== 'string' ||
37
+ relativePath.length === 0 ||
38
+ node_path_1.default.isAbsolute(relativePath)) {
39
+ throw new user_error_1.default(`${label} must be a non-empty relative path.`);
40
+ }
41
+ const resolvedRoot = node_path_1.default.resolve(root);
42
+ const resolvedPath = node_path_1.default.resolve(resolvedRoot, relativePath);
43
+ const relative = node_path_1.default.relative(resolvedRoot, resolvedPath);
44
+ if (relative === '..' ||
45
+ relative.startsWith(`..${node_path_1.default.sep}`) ||
46
+ node_path_1.default.isAbsolute(relative)) {
47
+ throw new user_error_1.default(`${label} must stay within "${resolvedRoot}".`);
48
+ }
49
+ return resolvedPath;
38
50
  }
39
51
  function isPathWithin(root, candidate) {
40
- const relative = _nodePath.default.relative(root, candidate);
41
- return relative === '' || relative !== '..' && !relative.startsWith(`..${_nodePath.default.sep}`) && !_nodePath.default.isAbsolute(relative);
52
+ const relative = node_path_1.default.relative(root, candidate);
53
+ return (relative === '' ||
54
+ (relative !== '..' &&
55
+ !relative.startsWith(`..${node_path_1.default.sep}`) &&
56
+ !node_path_1.default.isAbsolute(relative)));
42
57
  }
43
58
  function realpath(target, label) {
44
- try {
45
- return _nodeFs.default.realpathSync.native(target);
46
- } catch {
47
- throw new _userError.default(`${label} could not be resolved at "${target}".`);
48
- }
59
+ try {
60
+ return node_fs_1.default.realpathSync.native(target);
61
+ }
62
+ catch {
63
+ throw new user_error_1.default(`${label} could not be resolved at "${target}".`);
64
+ }
49
65
  }
50
66
  function lstatIfExists(target) {
51
- try {
52
- return _nodeFs.default.lstatSync(target);
53
- } catch (error) {
54
- if (error.code === 'ENOENT') {
55
- return undefined;
56
- }
57
- throw error;
58
- }
67
+ try {
68
+ return node_fs_1.default.lstatSync(target);
69
+ }
70
+ catch (error) {
71
+ if (error.code === 'ENOENT') {
72
+ return undefined;
73
+ }
74
+ throw error;
75
+ }
59
76
  }
60
77
  function assertCanonicalPathWithin(root, candidate, label) {
61
- if (!isPathWithin(root, candidate)) {
62
- throw new _userError.default(`${label} must stay within "${root}".`);
63
- }
78
+ if (!isPathWithin(root, candidate)) {
79
+ throw new user_error_1.default(`${label} must stay within "${root}".`);
80
+ }
64
81
  }
65
82
  function ensureOutputDirectory(target, label) {
66
- const stat = lstatIfExists(target);
67
- if (!stat) {
68
- _nodeFs.default.mkdirSync(target);
69
- return;
70
- }
71
- if (stat.isSymbolicLink()) {
72
- throw new _userError.default(`${label} must not be a symbolic link.`);
73
- }
74
- if (!stat.isDirectory()) {
75
- throw new _userError.default(`${label} must be a directory.`);
76
- }
83
+ const stat = lstatIfExists(target);
84
+ if (!stat) {
85
+ node_fs_1.default.mkdirSync(target);
86
+ return;
87
+ }
88
+ if (stat.isSymbolicLink()) {
89
+ throw new user_error_1.default(`${label} must not be a symbolic link.`);
90
+ }
91
+ if (!stat.isDirectory()) {
92
+ throw new user_error_1.default(`${label} must be a directory.`);
93
+ }
77
94
  }
78
95
  function validateExistingOutput(outputPath, canonicalRoot, label) {
79
- const stat = lstatIfExists(outputPath);
80
- if (!stat) {
81
- return;
82
- }
83
- if (stat.isSymbolicLink()) {
84
- throw new _userError.default(`${label} must not be a symbolic link.`);
85
- }
86
- if (!stat.isFile()) {
87
- throw new _userError.default(`${label} must be a regular file.`);
88
- }
89
- assertCanonicalPathWithin(canonicalRoot, realpath(outputPath, label), label);
96
+ const stat = lstatIfExists(outputPath);
97
+ if (!stat) {
98
+ return;
99
+ }
100
+ if (stat.isSymbolicLink()) {
101
+ throw new user_error_1.default(`${label} must not be a symbolic link.`);
102
+ }
103
+ if (!stat.isFile()) {
104
+ throw new user_error_1.default(`${label} must be a regular file.`);
105
+ }
106
+ assertCanonicalPathWithin(canonicalRoot, realpath(outputPath, label), label);
90
107
  }
91
-
92
108
  /** Resolve an existing input and require its canonical target to remain below the canonical root. */
93
109
  function resolveExistingPathWithin(root, relativePath, label) {
94
- const resolvedPath = resolvePathWithin(root, relativePath, label);
95
- const canonicalRoot = realpath(_nodePath.default.resolve(root), `${label} root`);
96
- const canonicalPath = realpath(resolvedPath, label);
97
- if (!isPathWithin(canonicalRoot, canonicalPath)) {
98
- throw new _userError.default(`${label} must stay within "${canonicalRoot}".`);
99
- }
100
- return canonicalPath;
110
+ const resolvedPath = resolvePathWithin(root, relativePath, label);
111
+ const canonicalRoot = realpath(node_path_1.default.resolve(root), `${label} root`);
112
+ const canonicalPath = realpath(resolvedPath, label);
113
+ if (!isPathWithin(canonicalRoot, canonicalPath)) {
114
+ throw new user_error_1.default(`${label} must stay within "${canonicalRoot}".`);
115
+ }
116
+ return canonicalPath;
101
117
  }
102
-
103
118
  /**
104
119
  * Prepare an output path below an existing root. Existing parent components and
105
120
  * the output itself must not be symlinks. Missing parents are created one at a
106
121
  * time and then canonicalized below the root before the path is returned.
107
122
  */
108
123
  function resolveOutputPathWithin(root, relativePath, label, directoryLabel) {
109
- const resolvedRoot = _nodePath.default.resolve(root);
110
- const resolvedPath = resolvePathWithin(resolvedRoot, relativePath, label);
111
- const canonicalRoot = realpath(resolvedRoot, `${label} root`);
112
- const relativeParent = _nodePath.default.relative(resolvedRoot, _nodePath.default.dirname(resolvedPath));
113
- const components = relativeParent === '' ? [] : relativeParent.split(_nodePath.default.sep);
114
- let current = resolvedRoot;
115
- for (const component of components) {
116
- current = _nodePath.default.join(current, component);
117
- ensureOutputDirectory(current, directoryLabel);
118
- assertCanonicalPathWithin(canonicalRoot, realpath(current, directoryLabel), directoryLabel);
119
- }
120
- const canonicalParent = realpath(_nodePath.default.dirname(resolvedPath), directoryLabel);
121
- const outputPath = _nodePath.default.join(canonicalParent, _nodePath.default.basename(resolvedPath));
122
- validateExistingOutput(outputPath, canonicalRoot, label);
123
- return outputPath;
124
+ const resolvedRoot = node_path_1.default.resolve(root);
125
+ const resolvedPath = resolvePathWithin(resolvedRoot, relativePath, label);
126
+ const canonicalRoot = realpath(resolvedRoot, `${label} root`);
127
+ const relativeParent = node_path_1.default.relative(resolvedRoot, node_path_1.default.dirname(resolvedPath));
128
+ const components = relativeParent === '' ? [] : relativeParent.split(node_path_1.default.sep);
129
+ let current = resolvedRoot;
130
+ for (const component of components) {
131
+ current = node_path_1.default.join(current, component);
132
+ ensureOutputDirectory(current, directoryLabel);
133
+ assertCanonicalPathWithin(canonicalRoot, realpath(current, directoryLabel), directoryLabel);
134
+ }
135
+ const canonicalParent = realpath(node_path_1.default.dirname(resolvedPath), directoryLabel);
136
+ const outputPath = node_path_1.default.join(canonicalParent, node_path_1.default.basename(resolvedPath));
137
+ validateExistingOutput(outputPath, canonicalRoot, label);
138
+ return outputPath;
124
139
  }
125
140
  function isPlainObject(value) {
126
- return typeof value === 'object' && value !== null && !Array.isArray(value);
141
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
127
142
  }
128
143
  function parseProjectDescriptor(value, file) {
129
- if (!isPlainObject(value)) {
130
- throw new _userError.default(`Project descriptor at "${file}" has an invalid "type" field.`);
131
- }
132
- if (value.type === undefined) {
133
- throw new _userError.default(`Project descriptor at "${file}" is missing a "type" field.`);
134
- }
135
- if (!_types.SUPPORTED_EDGE_WORKER_TYPES.includes(value.type)) {
136
- throw new _userError.default(`Project descriptor at "${file}" has an invalid "type" field.`);
137
- }
138
- if (value.sdk !== undefined && typeof value.sdk !== 'string') {
139
- throw new _userError.default(`Project descriptor at "${file}" has an invalid "sdk" field.`);
140
- }
141
- const descriptor = {
142
- type: value.type
143
- };
144
- if (value.sdk !== undefined) {
145
- descriptor.sdk = value.sdk;
146
- }
147
- return descriptor;
144
+ if (!isPlainObject(value)) {
145
+ throw new user_error_1.default(`Project descriptor at "${file}" has an invalid "type" field.`);
146
+ }
147
+ if (value.type === undefined) {
148
+ throw new user_error_1.default(`Project descriptor at "${file}" is missing a "type" field.`);
149
+ }
150
+ if (!types_1.SUPPORTED_EDGE_WORKER_TYPES.includes(value.type)) {
151
+ throw new user_error_1.default(`Project descriptor at "${file}" has an invalid "type" field.`);
152
+ }
153
+ if (value.sdk !== undefined && typeof value.sdk !== 'string') {
154
+ throw new user_error_1.default(`Project descriptor at "${file}" has an invalid "sdk" field.`);
155
+ }
156
+ const descriptor = { type: value.type };
157
+ if (value.sdk !== undefined) {
158
+ descriptor.sdk = value.sdk;
159
+ }
160
+ return descriptor;
148
161
  }
149
162
  function parseLocation(value, file) {
150
- if (value === undefined || value === null) {
151
- return value;
152
- }
153
- if (!isPlainObject(value)) {
154
- throw new _userError.default(`Worker manifest at "${file}" has an invalid location.`);
155
- }
156
- if (!_types.EDGE_WORKER_LOCATION_OPERATORS.includes(value.operator)) {
157
- throw new _userError.default(`Worker manifest at "${file}" has an invalid location operator.`);
158
- }
159
- if (typeof value.value !== 'string' || value.value.length === 0 || (0, _output.hasTerminalControlCharacters)(value.value)) {
160
- throw new _userError.default(`Worker manifest at "${file}" has an invalid location value.`);
161
- }
162
- return {
163
- operator: value.operator,
164
- value: value.value
165
- };
163
+ if (value === undefined || value === null) {
164
+ return value;
165
+ }
166
+ if (!isPlainObject(value)) {
167
+ throw new user_error_1.default(`Worker manifest at "${file}" has an invalid location.`);
168
+ }
169
+ if (!types_1.EDGE_WORKER_LOCATION_OPERATORS.includes(value.operator)) {
170
+ throw new user_error_1.default(`Worker manifest at "${file}" has an invalid location operator.`);
171
+ }
172
+ if (typeof value.value !== 'string' ||
173
+ value.value.length === 0 ||
174
+ (0, output_1.hasTerminalControlCharacters)(value.value)) {
175
+ throw new user_error_1.default(`Worker manifest at "${file}" has an invalid location value.`);
176
+ }
177
+ return { operator: value.operator, value: value.value };
166
178
  }
167
179
  function parseWorkerManifest(value, file) {
168
- if (!isPlainObject(value)) {
169
- throw new _userError.default(`Worker manifest at "${file}" must be an object.`);
170
- }
171
- const name = validateWorkerName(value.name, 'worker name');
172
- if (typeof value.entry !== 'string' || value.entry.length === 0) {
173
- throw new _userError.default(`Worker manifest at "${file}" is missing an "entry" field.`);
174
- }
175
- resolvePathWithin(_nodePath.default.dirname(file), value.entry, 'Worker entry');
176
- if (value.on_failure !== undefined && value.on_failure !== 'continue' && value.on_failure !== 'error') {
177
- throw new _userError.default(`Worker manifest at "${file}" has an invalid "on_failure" field.`);
178
- }
179
- const manifest = {
180
- name,
181
- entry: value.entry
182
- };
183
- const location = parseLocation(value.location, file);
184
- if (location !== undefined) {
185
- manifest.location = location;
186
- }
187
- if (value.on_failure !== undefined) {
188
- manifest.on_failure = value.on_failure;
189
- }
190
- return manifest;
191
- }
180
+ if (!isPlainObject(value)) {
181
+ throw new user_error_1.default(`Worker manifest at "${file}" must be an object.`);
182
+ }
183
+ const name = validateWorkerName(value.name, 'worker name');
184
+ if (typeof value.entry !== 'string' || value.entry.length === 0) {
185
+ throw new user_error_1.default(`Worker manifest at "${file}" is missing an "entry" field.`);
186
+ }
187
+ resolvePathWithin(node_path_1.default.dirname(file), value.entry, 'Worker entry');
188
+ if (value.on_failure !== undefined &&
189
+ value.on_failure !== 'continue' &&
190
+ value.on_failure !== 'error') {
191
+ throw new user_error_1.default(`Worker manifest at "${file}" has an invalid "on_failure" field.`);
192
+ }
193
+ const manifest = { name, entry: value.entry };
194
+ const location = parseLocation(value.location, file);
195
+ if (location !== undefined) {
196
+ manifest.location = location;
197
+ }
198
+ if (value.on_failure !== undefined) {
199
+ manifest.on_failure = value.on_failure;
200
+ }
201
+ return manifest;
202
+ }
package/dist/lib/env.js CHANGED
@@ -1,26 +1,25 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _nodeOs = require("node:os");
6
- var _package = _interopRequireDefault(require("../../package.json"));
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
+ const node_os_1 = require("node:os");
7
+ const package_json_1 = __importDefault(require("../../package.json"));
8
8
  const app = {
9
- name: _package.default.name,
10
- version: _package.default.version
9
+ version: package_json_1.default.version,
11
10
  };
12
11
  const os = {
13
- name: (0, _nodeOs.platform)(),
14
- version: (0, _nodeOs.release)(),
15
- arch: (0, _nodeOs.arch)()
12
+ name: (0, node_os_1.platform)(),
13
+ version: (0, node_os_1.release)(),
14
+ arch: (0, node_os_1.arch)(),
16
15
  };
17
16
  const node = {
18
- version: process.version
17
+ version: process.version,
19
18
  };
20
19
  const env = {
21
- app,
22
- os,
23
- node,
24
- userAgent: `vip-cli/${app.version} (node/${node.version}; ${os.name}/${os.version}; +https://wpvip.com)`
20
+ app,
21
+ os,
22
+ node,
23
+ userAgent: `vip-cli/${app.version} (node/${node.version}; ${os.name}/${os.version}; +https://wpvip.com)`,
25
24
  };
26
- var _default = exports.default = env;
25
+ exports.default = env;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
-
3
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
4
6
  exports.default = deleteEnvVar;
5
- var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
6
- var _api = _interopRequireDefault(require("../../lib/api"));
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
- const mutation = (0, _graphqlTag.default)`
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ const api_1 = __importDefault(require("../../lib/api"));
9
+ const mutation = (0, graphql_tag_1.default) `
9
10
  mutation DeleteEnvironmentVariable(
10
11
  $appId: Int!
11
12
  $envId: Int!
@@ -31,15 +32,12 @@ const mutation = (0, _graphqlTag.default)`
31
32
  }
32
33
  `;
33
34
  async function deleteEnvVar(appId, envId, name, reloadManifest = false) {
34
- const api = (0, _api.default)();
35
- const variables = {
36
- appId,
37
- envId,
38
- name,
39
- reloadManifest
40
- };
41
- return api.mutate({
42
- mutation,
43
- variables
44
- });
45
- }
35
+ const api = (0, api_1.default)();
36
+ const variables = {
37
+ appId,
38
+ envId,
39
+ name,
40
+ reloadManifest,
41
+ };
42
+ return api.mutate({ mutation, variables });
43
+ }