@servicetitan/startup 34.3.0-beta.2 → 35.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (549) hide show
  1. package/dist/cli/commands/build.d.ts +0 -16
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +2 -15
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-package.d.ts.map +1 -1
  6. package/dist/cli/commands/bundle-package.js +0 -1
  7. package/dist/cli/commands/bundle-package.js.map +1 -1
  8. package/dist/cli/commands/get-command.js +2 -2
  9. package/dist/cli/commands/get-command.js.map +1 -1
  10. package/dist/cli/commands/mfe-check.d.ts.map +1 -1
  11. package/dist/cli/commands/mfe-check.js +2 -2
  12. package/dist/cli/commands/mfe-check.js.map +1 -1
  13. package/dist/cli/commands/mfe-generate-metadata.js +2 -2
  14. package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
  15. package/dist/cli/commands/mfe-package-publish.d.ts +10 -0
  16. package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
  17. package/dist/cli/commands/mfe-package-publish.js +12 -0
  18. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  19. package/dist/cli/commands/mfe-package-rollback.d.ts +10 -1
  20. package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -1
  21. package/dist/cli/commands/mfe-package-rollback.js +15 -3
  22. package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
  23. package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
  24. package/dist/cli/commands/mfe-publish.js +10 -4
  25. package/dist/cli/commands/mfe-publish.js.map +1 -1
  26. package/dist/cli/commands/mfe-purge-cache.d.ts +57 -0
  27. package/dist/cli/commands/mfe-purge-cache.d.ts.map +1 -0
  28. package/dist/cli/commands/mfe-purge-cache.js +101 -0
  29. package/dist/cli/commands/mfe-purge-cache.js.map +1 -0
  30. package/dist/cli/commands/start.d.ts +0 -8
  31. package/dist/cli/commands/start.d.ts.map +1 -1
  32. package/dist/cli/commands/start.js +2 -8
  33. package/dist/cli/commands/start.js.map +1 -1
  34. package/dist/cli/commands/{utils.d.ts → utils/build-rollback-tag.d.ts} +1 -2
  35. package/dist/cli/commands/utils/build-rollback-tag.d.ts.map +1 -0
  36. package/dist/cli/commands/{utils.js → utils/build-rollback-tag.js} +1 -5
  37. package/dist/cli/commands/utils/build-rollback-tag.js.map +1 -0
  38. package/dist/cli/commands/utils/constants.d.ts +2 -0
  39. package/dist/cli/commands/utils/constants.d.ts.map +1 -0
  40. package/dist/cli/commands/utils/constants.js +13 -0
  41. package/dist/cli/commands/utils/constants.js.map +1 -0
  42. package/dist/cli/commands/utils/index.d.ts +4 -0
  43. package/dist/cli/commands/utils/index.d.ts.map +1 -0
  44. package/dist/{core → cli/commands/utils}/index.js +3 -7
  45. package/dist/cli/commands/utils/index.js.map +1 -0
  46. package/dist/cli/commands/utils/purge-cache.d.ts +6 -0
  47. package/dist/cli/commands/utils/purge-cache.d.ts.map +1 -0
  48. package/dist/cli/commands/utils/purge-cache.js +21 -0
  49. package/dist/cli/commands/utils/purge-cache.js.map +1 -0
  50. package/dist/cli/utils/bundle.d.ts +5 -2
  51. package/dist/cli/utils/bundle.d.ts.map +1 -1
  52. package/dist/cli/utils/bundle.js +98 -18
  53. package/dist/cli/utils/bundle.js.map +1 -1
  54. package/dist/cli/utils/cli-os.js +1 -1
  55. package/dist/cli/utils/cli-os.js.map +1 -1
  56. package/dist/index.d.ts +0 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +0 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/storybook-config/webpack-final.d.ts +1 -1
  61. package/dist/storybook-config/webpack-final.d.ts.map +1 -1
  62. package/dist/storybook-config/webpack-final.js +6 -18
  63. package/dist/storybook-config/webpack-final.js.map +1 -1
  64. package/dist/utils/get-configuration.d.ts +1 -28
  65. package/dist/utils/get-configuration.d.ts.map +1 -1
  66. package/dist/utils/get-configuration.js +2 -42
  67. package/dist/utils/get-configuration.js.map +1 -1
  68. package/dist/utils/get-package-data.d.ts.map +1 -1
  69. package/dist/utils/get-package-data.js +2 -3
  70. package/dist/utils/get-package-data.js.map +1 -1
  71. package/dist/webpack/configs/amd-config.d.ts +2 -3
  72. package/dist/webpack/configs/amd-config.d.ts.map +1 -1
  73. package/dist/webpack/configs/amd-config.js.map +1 -1
  74. package/dist/webpack/configs/cache-config.d.ts +2 -3
  75. package/dist/webpack/configs/cache-config.d.ts.map +1 -1
  76. package/dist/webpack/configs/cache-config.js +1 -1
  77. package/dist/webpack/configs/cache-config.js.map +1 -1
  78. package/dist/webpack/configs/dev-server-config.d.ts +2 -3
  79. package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
  80. package/dist/webpack/configs/dev-server-config.js +1 -1
  81. package/dist/webpack/configs/dev-server-config.js.map +1 -1
  82. package/dist/webpack/configs/devtool-config.d.ts +2 -3
  83. package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
  84. package/dist/webpack/configs/devtool-config.js +1 -1
  85. package/dist/webpack/configs/devtool-config.js.map +1 -1
  86. package/dist/webpack/configs/entry.config.d.ts +2 -3
  87. package/dist/webpack/configs/entry.config.d.ts.map +1 -1
  88. package/dist/webpack/configs/entry.config.js +5 -6
  89. package/dist/webpack/configs/entry.config.js.map +1 -1
  90. package/dist/webpack/configs/externals-config.d.ts +2 -3
  91. package/dist/webpack/configs/externals-config.d.ts.map +1 -1
  92. package/dist/webpack/configs/externals-config.js +14 -4
  93. package/dist/webpack/configs/externals-config.js.map +1 -1
  94. package/dist/webpack/configs/index.d.ts +1 -0
  95. package/dist/webpack/configs/index.d.ts.map +1 -1
  96. package/dist/webpack/configs/index.js.map +1 -1
  97. package/dist/webpack/configs/loaders/css-loader.d.ts +2 -2
  98. package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
  99. package/dist/webpack/configs/loaders/css-loader.js +1 -2
  100. package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
  101. package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
  102. package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
  103. package/dist/webpack/configs/loaders/style-loader.js +1 -4
  104. package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
  105. package/dist/webpack/configs/module-config.d.ts +2 -3
  106. package/dist/webpack/configs/module-config.d.ts.map +1 -1
  107. package/dist/webpack/configs/module-config.js.map +1 -1
  108. package/dist/webpack/configs/optimization-config.d.ts +2 -3
  109. package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
  110. package/dist/webpack/configs/optimization-config.js +7 -10
  111. package/dist/webpack/configs/optimization-config.js.map +1 -1
  112. package/dist/webpack/configs/output-config.d.ts +2 -3
  113. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  114. package/dist/webpack/configs/output-config.js +24 -15
  115. package/dist/webpack/configs/output-config.js.map +1 -1
  116. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +8 -3
  117. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  118. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +47 -10
  119. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  120. package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +2 -3
  121. package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
  122. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +6 -6
  123. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
  124. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +2 -3
  125. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
  126. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +13 -4
  127. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
  128. package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +2 -3
  129. package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
  130. package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +12 -4
  131. package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
  132. package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +2 -3
  133. package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
  134. package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +6 -4
  135. package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
  136. package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +2 -3
  137. package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
  138. package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
  139. package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
  140. package/dist/webpack/configs/plugins/html-plugin.d.ts +2 -3
  141. package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
  142. package/dist/webpack/configs/plugins/html-plugin.js +2 -5
  143. package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
  144. package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +2 -3
  145. package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
  146. package/dist/webpack/configs/plugins/html-tags-plugin.js +19 -8
  147. package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
  148. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +3 -0
  149. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +1 -0
  150. package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.js +2 -2
  151. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -0
  152. package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +1 -0
  153. package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.js +2 -2
  154. package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -0
  155. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +3 -17
  156. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
  157. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +6 -45
  158. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  159. package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +1 -0
  160. package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +1 -0
  161. package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
  162. package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +1 -0
  163. package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +2 -3
  164. package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
  165. package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +2 -4
  166. package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
  167. package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +2 -3
  168. package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
  169. package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
  170. package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +2 -3
  171. package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
  172. package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
  173. package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
  174. package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
  175. package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
  176. package/dist/webpack/configs/plugins/virtual-modules-plugin.js +56 -13
  177. package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
  178. package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +2 -3
  179. package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
  180. package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
  181. package/dist/webpack/configs/plugins-config.d.ts +2 -3
  182. package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
  183. package/dist/webpack/configs/plugins-config.js.map +1 -1
  184. package/dist/webpack/configs/resolve-config.d.ts +2 -3
  185. package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
  186. package/dist/webpack/configs/resolve-config.js.map +1 -1
  187. package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
  188. package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
  189. package/dist/webpack/configs/rules/css-rules.js +1 -2
  190. package/dist/webpack/configs/rules/css-rules.js.map +1 -1
  191. package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
  192. package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
  193. package/dist/webpack/configs/rules/font-rules.js.map +1 -1
  194. package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
  195. package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
  196. package/dist/webpack/configs/rules/image-rules.js.map +1 -1
  197. package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
  198. package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
  199. package/dist/webpack/configs/rules/js-rules.js +1 -3
  200. package/dist/webpack/configs/rules/js-rules.js.map +1 -1
  201. package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
  202. package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
  203. package/dist/webpack/configs/rules/less-rules.js.map +1 -1
  204. package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
  205. package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
  206. package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
  207. package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
  208. package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
  209. package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
  210. package/dist/webpack/configs/rules-config.d.ts +2 -3
  211. package/dist/webpack/configs/rules-config.d.ts.map +1 -1
  212. package/dist/webpack/configs/rules-config.js +2 -2
  213. package/dist/webpack/configs/rules-config.js.map +1 -1
  214. package/dist/webpack/configs/stats-config.d.ts +2 -3
  215. package/dist/webpack/configs/stats-config.d.ts.map +1 -1
  216. package/dist/webpack/configs/stats-config.js.map +1 -1
  217. package/dist/webpack/configs/types.d.ts +35 -0
  218. package/dist/webpack/configs/types.d.ts.map +1 -0
  219. package/dist/webpack/configs/types.js.map +1 -0
  220. package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
  221. package/dist/{core → webpack/configs}/utils/build-metadata.js +1 -1
  222. package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
  223. package/dist/webpack/configs/utils/generate-metadata.d.ts +3 -0
  224. package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -0
  225. package/dist/{core → webpack/configs}/utils/generate-metadata.js +4 -5
  226. package/dist/webpack/configs/utils/generate-metadata.js.map +1 -0
  227. package/dist/webpack/configs/utils/get-bundle-type.d.ts +3 -0
  228. package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +1 -0
  229. package/dist/{core → webpack/configs}/utils/get-bundle-type.js +2 -5
  230. package/dist/webpack/configs/utils/get-bundle-type.js.map +1 -0
  231. package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
  232. package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
  233. package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
  234. package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.js +1 -1
  235. package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -0
  236. package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +1 -0
  237. package/dist/{core → webpack/configs}/utils/get-web-components-version.js +1 -1
  238. package/dist/webpack/configs/utils/get-web-components-version.js.map +1 -0
  239. package/dist/webpack/configs/utils/index.d.ts +4 -0
  240. package/dist/webpack/configs/utils/index.d.ts.map +1 -0
  241. package/dist/{core → webpack/configs}/utils/index.js +0 -5
  242. package/dist/webpack/configs/utils/index.js.map +1 -0
  243. package/dist/webpack/configs/watch-options-config.d.ts +2 -2
  244. package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
  245. package/dist/webpack/configs/watch-options-config.js +2 -2
  246. package/dist/webpack/configs/watch-options-config.js.map +1 -1
  247. package/dist/webpack/create-webpack-config.d.ts +0 -10
  248. package/dist/webpack/create-webpack-config.d.ts.map +1 -1
  249. package/dist/webpack/create-webpack-config.js +41 -108
  250. package/dist/webpack/create-webpack-config.js.map +1 -1
  251. package/dist/webpack/types.d.ts +11 -4
  252. package/dist/webpack/types.d.ts.map +1 -1
  253. package/dist/webpack/utils/index.d.ts +1 -0
  254. package/dist/webpack/utils/index.d.ts.map +1 -1
  255. package/dist/webpack/utils/index.js +1 -0
  256. package/dist/webpack/utils/index.js.map +1 -1
  257. package/dist/webpack/utils/stringify-config.d.ts.map +1 -0
  258. package/dist/webpack/utils/stringify-config.js.map +1 -0
  259. package/package.json +16 -19
  260. package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +4 -3
  261. package/src/cli/commands/__tests__/mfe-package-publish.test.ts +27 -1
  262. package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +31 -0
  263. package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -2
  264. package/src/cli/commands/__tests__/mfe-purge-cache.test.ts +141 -0
  265. package/src/cli/commands/build.ts +2 -7
  266. package/src/cli/commands/bundle-package.ts +1 -3
  267. package/src/cli/commands/get-command.ts +2 -2
  268. package/src/cli/commands/mfe-check.ts +2 -1
  269. package/src/cli/commands/mfe-generate-metadata.ts +1 -1
  270. package/src/cli/commands/mfe-package-publish.ts +12 -2
  271. package/src/cli/commands/mfe-package-rollback.ts +15 -5
  272. package/src/cli/commands/mfe-publish.ts +14 -3
  273. package/src/cli/commands/mfe-purge-cache.ts +75 -0
  274. package/src/cli/commands/start.ts +2 -5
  275. package/src/cli/commands/utils/__tests__/purge-cache.test.ts +40 -0
  276. package/src/cli/commands/{utils.ts → utils/build-rollback-tag.ts} +0 -1
  277. package/src/cli/commands/utils/constants.ts +1 -0
  278. package/src/cli/commands/utils/index.ts +3 -0
  279. package/src/cli/commands/utils/purge-cache.ts +13 -0
  280. package/src/cli/utils/__tests__/bundle.test.ts +10 -19
  281. package/src/cli/utils/bundle.ts +101 -20
  282. package/src/cli/utils/cli-os.ts +1 -1
  283. package/src/index.ts +0 -1
  284. package/src/storybook-config/__tests__/webpack-final.test.ts +2 -5
  285. package/src/storybook-config/webpack-final.ts +10 -24
  286. package/src/utils/__tests__/get-configuration.test.ts +1 -99
  287. package/src/utils/__tests__/get-package-data.test.ts +1 -35
  288. package/src/utils/get-configuration.ts +2 -92
  289. package/src/utils/get-package-data.ts +1 -3
  290. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +2 -2
  291. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +11 -11
  292. package/src/webpack/__tests__/create-webpack-config.test.ts +2 -3
  293. package/src/webpack/configs/amd-config.ts +2 -3
  294. package/src/webpack/configs/cache-config.ts +3 -4
  295. package/src/webpack/configs/dev-server-config.ts +3 -8
  296. package/src/webpack/configs/devtool-config.ts +3 -4
  297. package/src/webpack/configs/entry.config.ts +7 -8
  298. package/src/webpack/configs/externals-config.ts +21 -5
  299. package/src/webpack/configs/index.ts +1 -0
  300. package/src/webpack/configs/loaders/css-loader.ts +2 -3
  301. package/src/webpack/configs/loaders/style-loader.ts +5 -5
  302. package/src/webpack/configs/module-config.ts +2 -3
  303. package/src/webpack/configs/optimization-config.ts +11 -16
  304. package/src/webpack/configs/output-config.ts +22 -16
  305. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +36 -9
  306. package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
  307. package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +15 -7
  308. package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +13 -7
  309. package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +8 -7
  310. package/src/webpack/configs/plugins/filter-warnings-plugin.ts +3 -4
  311. package/src/webpack/configs/plugins/html-plugin.ts +6 -7
  312. package/src/webpack/configs/plugins/html-tags-plugin.ts +16 -7
  313. package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/check-resource.test.ts +5 -18
  314. package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.ts +4 -4
  315. package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.ts +2 -2
  316. package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +6 -48
  317. package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +5 -10
  318. package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -3
  319. package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +3 -4
  320. package/src/webpack/configs/plugins/virtual-modules-plugin.ts +65 -13
  321. package/src/webpack/configs/plugins/watch-run-plugin.ts +2 -3
  322. package/src/webpack/configs/plugins-config.ts +2 -3
  323. package/src/webpack/configs/resolve-config.ts +2 -3
  324. package/src/webpack/configs/rules/css-rules.ts +3 -4
  325. package/src/webpack/configs/rules/font-rules.ts +2 -2
  326. package/src/webpack/configs/rules/image-rules.ts +2 -2
  327. package/src/webpack/configs/rules/js-rules.ts +2 -4
  328. package/src/webpack/configs/rules/less-rules.ts +2 -2
  329. package/src/webpack/configs/rules/scss-rules.ts +2 -2
  330. package/src/webpack/configs/rules/svg-rules.ts +2 -2
  331. package/src/webpack/configs/rules-config.ts +5 -9
  332. package/src/webpack/configs/stats-config.ts +2 -3
  333. package/src/webpack/configs/types.ts +38 -0
  334. package/src/{core → webpack/configs}/utils/__tests__/build-metadata.test.ts +2 -2
  335. package/src/{core → webpack/configs}/utils/__tests__/generate-metadata.test.ts +13 -27
  336. package/src/{core → webpack/configs}/utils/build-metadata.ts +1 -1
  337. package/src/{core → webpack/configs}/utils/generate-metadata.ts +6 -7
  338. package/src/webpack/configs/utils/get-bundle-type.ts +22 -0
  339. package/src/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.ts +1 -1
  340. package/src/{core → webpack/configs}/utils/get-web-components-version.ts +1 -1
  341. package/src/webpack/configs/utils/index.ts +3 -0
  342. package/src/webpack/configs/watch-options-config.ts +3 -3
  343. package/src/webpack/create-webpack-config.ts +43 -85
  344. package/src/webpack/types.ts +11 -7
  345. package/src/webpack/utils/index.ts +1 -0
  346. package/dist/cli/commands/bundle-vite.d.ts +0 -66
  347. package/dist/cli/commands/bundle-vite.d.ts.map +0 -1
  348. package/dist/cli/commands/bundle-vite.js +0 -184
  349. package/dist/cli/commands/bundle-vite.js.map +0 -1
  350. package/dist/cli/commands/utils.d.ts.map +0 -1
  351. package/dist/cli/commands/utils.js.map +0 -1
  352. package/dist/core/check-resource/check-resource.d.ts +0 -3
  353. package/dist/core/check-resource/check-resource.d.ts.map +0 -1
  354. package/dist/core/check-resource/check-resource.js.map +0 -1
  355. package/dist/core/check-resource/get-package-json.d.ts.map +0 -1
  356. package/dist/core/check-resource/get-package-json.js.map +0 -1
  357. package/dist/core/check-resource/index.d.ts +0 -2
  358. package/dist/core/check-resource/index.d.ts.map +0 -1
  359. package/dist/core/check-resource/index.js +0 -13
  360. package/dist/core/check-resource/index.js.map +0 -1
  361. package/dist/core/check-resource/is-optional-peer-dependency.d.ts.map +0 -1
  362. package/dist/core/check-resource/is-optional-peer-dependency.js.map +0 -1
  363. package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
  364. package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +0 -1
  365. package/dist/core/context.d.ts +0 -14
  366. package/dist/core/context.d.ts.map +0 -1
  367. package/dist/core/context.js +0 -62
  368. package/dist/core/context.js.map +0 -1
  369. package/dist/core/defines/exposed-dependencies.d.ts +0 -5
  370. package/dist/core/defines/exposed-dependencies.d.ts.map +0 -1
  371. package/dist/core/defines/exposed-dependencies.js +0 -26
  372. package/dist/core/defines/exposed-dependencies.js.map +0 -1
  373. package/dist/core/defines/exposed-instance-dependencies.d.ts +0 -5
  374. package/dist/core/defines/exposed-instance-dependencies.d.ts.map +0 -1
  375. package/dist/core/defines/exposed-instance-dependencies.js +0 -29
  376. package/dist/core/defines/exposed-instance-dependencies.js.map +0 -1
  377. package/dist/core/defines/index.d.ts +0 -4
  378. package/dist/core/defines/index.d.ts.map +0 -1
  379. package/dist/core/defines/index.js +0 -26
  380. package/dist/core/defines/index.js.map +0 -1
  381. package/dist/core/defines/web-component-name.d.ts +0 -5
  382. package/dist/core/defines/web-component-name.d.ts.map +0 -1
  383. package/dist/core/defines/web-component-name.js +0 -23
  384. package/dist/core/defines/web-component-name.js.map +0 -1
  385. package/dist/core/externals.d.ts +0 -3
  386. package/dist/core/externals.d.ts.map +0 -1
  387. package/dist/core/externals.js +0 -29
  388. package/dist/core/externals.js.map +0 -1
  389. package/dist/core/get-exposed-dependencies-entry-points.d.ts +0 -11
  390. package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +0 -1
  391. package/dist/core/get-exposed-dependencies-entry-points.js +0 -82
  392. package/dist/core/get-exposed-dependencies-entry-points.js.map +0 -1
  393. package/dist/core/index.d.ts +0 -9
  394. package/dist/core/index.d.ts.map +0 -1
  395. package/dist/core/index.js.map +0 -1
  396. package/dist/core/types.d.ts +0 -55
  397. package/dist/core/types.d.ts.map +0 -1
  398. package/dist/core/types.js.map +0 -1
  399. package/dist/core/utils/build-metadata.d.ts.map +0 -1
  400. package/dist/core/utils/build-metadata.js.map +0 -1
  401. package/dist/core/utils/generate-metadata.d.ts +0 -3
  402. package/dist/core/utils/generate-metadata.d.ts.map +0 -1
  403. package/dist/core/utils/generate-metadata.js.map +0 -1
  404. package/dist/core/utils/get-bundle-type.d.ts +0 -3
  405. package/dist/core/utils/get-bundle-type.d.ts.map +0 -1
  406. package/dist/core/utils/get-bundle-type.js.map +0 -1
  407. package/dist/core/utils/get-exposed-dependencies.d.ts.map +0 -1
  408. package/dist/core/utils/get-exposed-dependencies.js.map +0 -1
  409. package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
  410. package/dist/core/utils/get-launchdarkly-sdk-version.js.map +0 -1
  411. package/dist/core/utils/get-output-path.d.ts +0 -3
  412. package/dist/core/utils/get-output-path.d.ts.map +0 -1
  413. package/dist/core/utils/get-output-path.js +0 -32
  414. package/dist/core/utils/get-output-path.js.map +0 -1
  415. package/dist/core/utils/get-web-components-version.d.ts.map +0 -1
  416. package/dist/core/utils/get-web-components-version.js.map +0 -1
  417. package/dist/core/utils/index.d.ts +0 -9
  418. package/dist/core/utils/index.d.ts.map +0 -1
  419. package/dist/core/utils/index.js.map +0 -1
  420. package/dist/core/utils/stringify-config.d.ts.map +0 -1
  421. package/dist/core/utils/stringify-config.js.map +0 -1
  422. package/dist/core/virtual-modules.d.ts +0 -9
  423. package/dist/core/virtual-modules.d.ts.map +0 -1
  424. package/dist/core/virtual-modules.js +0 -84
  425. package/dist/core/virtual-modules.js.map +0 -1
  426. package/dist/vite/base-config.d.ts +0 -4
  427. package/dist/vite/base-config.d.ts.map +0 -1
  428. package/dist/vite/base-config.js +0 -76
  429. package/dist/vite/base-config.js.map +0 -1
  430. package/dist/vite/build-shared-deps.d.ts +0 -3
  431. package/dist/vite/build-shared-deps.d.ts.map +0 -1
  432. package/dist/vite/build-shared-deps.js +0 -310
  433. package/dist/vite/build-shared-deps.js.map +0 -1
  434. package/dist/vite/create-vite-config.d.ts +0 -3
  435. package/dist/vite/create-vite-config.d.ts.map +0 -1
  436. package/dist/vite/create-vite-config.js +0 -52
  437. package/dist/vite/create-vite-config.js.map +0 -1
  438. package/dist/vite/define-config.d.ts +0 -12
  439. package/dist/vite/define-config.d.ts.map +0 -1
  440. package/dist/vite/define-config.js +0 -15
  441. package/dist/vite/define-config.js.map +0 -1
  442. package/dist/vite/load-config-file.d.ts +0 -6
  443. package/dist/vite/load-config-file.d.ts.map +0 -1
  444. package/dist/vite/load-config-file.js +0 -107
  445. package/dist/vite/load-config-file.js.map +0 -1
  446. package/dist/vite/merge-config.d.ts +0 -6
  447. package/dist/vite/merge-config.d.ts.map +0 -1
  448. package/dist/vite/merge-config.js +0 -106
  449. package/dist/vite/merge-config.js.map +0 -1
  450. package/dist/vite/plugins/css-injector-plugin.d.ts +0 -15
  451. package/dist/vite/plugins/css-injector-plugin.d.ts.map +0 -1
  452. package/dist/vite/plugins/css-injector-plugin.js +0 -76
  453. package/dist/vite/plugins/css-injector-plugin.js.map +0 -1
  454. package/dist/vite/plugins/dev-server-routing-plugin.d.ts +0 -12
  455. package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +0 -1
  456. package/dist/vite/plugins/dev-server-routing-plugin.js +0 -85
  457. package/dist/vite/plugins/dev-server-routing-plugin.js.map +0 -1
  458. package/dist/vite/plugins/externals-plugin.d.ts +0 -4
  459. package/dist/vite/plugins/externals-plugin.d.ts.map +0 -1
  460. package/dist/vite/plugins/externals-plugin.js +0 -39
  461. package/dist/vite/plugins/externals-plugin.js.map +0 -1
  462. package/dist/vite/plugins/html-plugin.d.ts +0 -5
  463. package/dist/vite/plugins/html-plugin.d.ts.map +0 -1
  464. package/dist/vite/plugins/html-plugin.js +0 -74
  465. package/dist/vite/plugins/html-plugin.js.map +0 -1
  466. package/dist/vite/plugins/ignore-modules-plugin.d.ts +0 -4
  467. package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +0 -1
  468. package/dist/vite/plugins/ignore-modules-plugin.js +0 -30
  469. package/dist/vite/plugins/ignore-modules-plugin.js.map +0 -1
  470. package/dist/vite/plugins/index.d.ts +0 -10
  471. package/dist/vite/plugins/index.d.ts.map +0 -1
  472. package/dist/vite/plugins/index.js +0 -28
  473. package/dist/vite/plugins/index.js.map +0 -1
  474. package/dist/vite/plugins/metadata-plugin.d.ts +0 -4
  475. package/dist/vite/plugins/metadata-plugin.d.ts.map +0 -1
  476. package/dist/vite/plugins/metadata-plugin.js +0 -86
  477. package/dist/vite/plugins/metadata-plugin.js.map +0 -1
  478. package/dist/vite/plugins/style-urls-plugin.d.ts +0 -4
  479. package/dist/vite/plugins/style-urls-plugin.d.ts.map +0 -1
  480. package/dist/vite/plugins/style-urls-plugin.js +0 -29
  481. package/dist/vite/plugins/style-urls-plugin.js.map +0 -1
  482. package/dist/vite/plugins/svgr-plugin.d.ts +0 -4
  483. package/dist/vite/plugins/svgr-plugin.d.ts.map +0 -1
  484. package/dist/vite/plugins/svgr-plugin.js +0 -31
  485. package/dist/vite/plugins/svgr-plugin.js.map +0 -1
  486. package/dist/vite/plugins/virtual-modules-plugin.d.ts +0 -4
  487. package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +0 -1
  488. package/dist/vite/plugins/virtual-modules-plugin.js +0 -71
  489. package/dist/vite/plugins/virtual-modules-plugin.js.map +0 -1
  490. package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +0 -63
  491. package/src/cli/commands/bundle-vite.ts +0 -112
  492. package/src/core/check-resource/index.ts +0 -1
  493. package/src/core/context.ts +0 -65
  494. package/src/core/defines/exposed-dependencies.ts +0 -21
  495. package/src/core/defines/exposed-instance-dependencies.ts +0 -19
  496. package/src/core/defines/index.ts +0 -3
  497. package/src/core/defines/web-component-name.ts +0 -15
  498. package/src/core/externals.ts +0 -23
  499. package/src/core/get-exposed-dependencies-entry-points.ts +0 -59
  500. package/src/core/index.ts +0 -8
  501. package/src/core/types.ts +0 -59
  502. package/src/core/utils/get-bundle-type.ts +0 -20
  503. package/src/core/utils/get-output-path.ts +0 -18
  504. package/src/core/utils/index.ts +0 -8
  505. package/src/core/virtual-modules.ts +0 -76
  506. package/src/vite/__tests__/define-config.test.ts +0 -13
  507. package/src/vite/__tests__/load-config-file.test.ts +0 -115
  508. package/src/vite/__tests__/merge-config.test.ts +0 -173
  509. package/src/vite/base-config.ts +0 -79
  510. package/src/vite/build-shared-deps.ts +0 -320
  511. package/src/vite/create-vite-config.ts +0 -50
  512. package/src/vite/define-config.ts +0 -20
  513. package/src/vite/index.html +0 -29
  514. package/src/vite/load-config-file.ts +0 -54
  515. package/src/vite/merge-config.ts +0 -93
  516. package/src/vite/plugins/css-injector-plugin.ts +0 -85
  517. package/src/vite/plugins/dev-server-routing-plugin.ts +0 -89
  518. package/src/vite/plugins/externals-plugin.ts +0 -27
  519. package/src/vite/plugins/html-plugin.ts +0 -65
  520. package/src/vite/plugins/ignore-modules-plugin.ts +0 -22
  521. package/src/vite/plugins/index.ts +0 -9
  522. package/src/vite/plugins/metadata-plugin.ts +0 -78
  523. package/src/vite/plugins/style-urls-plugin.ts +0 -34
  524. package/src/vite/plugins/svgr-plugin.ts +0 -11
  525. package/src/vite/plugins/virtual-modules-plugin.ts +0 -74
  526. package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +0 -1
  527. /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.d.ts +0 -0
  528. /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.d.ts +0 -0
  529. /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.js +0 -0
  530. /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.d.ts +0 -0
  531. /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.js +0 -0
  532. /package/dist/{core → webpack/configs}/types.js +0 -0
  533. /package/dist/{core → webpack/configs}/utils/build-metadata.d.ts +0 -0
  534. /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.d.ts +0 -0
  535. /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.js +0 -0
  536. /package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
  537. /package/dist/{core → webpack/configs}/utils/get-web-components-version.d.ts +0 -0
  538. /package/dist/{core → webpack}/utils/stringify-config.d.ts +0 -0
  539. /package/dist/{core → webpack}/utils/stringify-config.js +0 -0
  540. /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/get-package-json.test.ts +0 -0
  541. /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-peer-dependency.test.ts +0 -0
  542. /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
  543. /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.ts +0 -0
  544. /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.ts +0 -0
  545. /package/src/{core → webpack/configs}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
  546. /package/src/{core → webpack/configs}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
  547. /package/src/{core → webpack/configs}/utils/__tests__/get-web-components-version.test.ts +0 -0
  548. /package/src/{core → webpack/configs}/utils/get-exposed-dependencies.ts +0 -0
  549. /package/src/{core → webpack}/utils/stringify-config.ts +0 -0
@@ -0,0 +1,141 @@
1
+ import { log } from '../../../utils';
2
+ import { MFEPurgeCache, PurgeResponse } from '../mfe-purge-cache';
3
+
4
+ jest.mock('../../../utils', () => ({
5
+ ...jest.requireActual('../../../utils'),
6
+ log: { debug: jest.fn(), info: jest.fn(), warning: jest.fn() },
7
+ }));
8
+
9
+ describe(`[startup] ${MFEPurgeCache.name}`, () => {
10
+ const host = 'https://unpkg.example.com';
11
+ const token = 'purge-token';
12
+ const tag = 'prod';
13
+ const packageName = '@servicetitan/foo';
14
+ const version = '0.0.0-master.abc1223';
15
+ const location = `/${packageName}@${version}/dist/metadata.json`;
16
+
17
+ let args: ConstructorParameters<typeof MFEPurgeCache>[0];
18
+ let fetchSpy: jest.SpyInstance;
19
+ let fetchResponse: any;
20
+ let responseJson: PurgeResponse;
21
+
22
+ beforeEach(() => {
23
+ process.env.UNPKG_PURGE_TOKEN = token;
24
+ args = { host, packageName, tag };
25
+ fetchResponse = {
26
+ ok: true,
27
+ json: jest.fn().mockImplementation(() => Promise.resolve(responseJson)),
28
+ };
29
+ responseJson = [{ pod: '10.36.110.200', status: 302, cache: 'BYPASS', location }];
30
+
31
+ jest.clearAllMocks();
32
+ jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress error output
33
+ fetchSpy = jest.spyOn(global, 'fetch').mockImplementation(() => fetchResponse);
34
+ });
35
+
36
+ afterEach(() => delete process.env.UNPKG_PURGE_TOKEN);
37
+
38
+ const subject = () => new MFEPurgeCache(args).execute();
39
+
40
+ test('sends POST request with X-Purge-Token header', async () => {
41
+ await subject();
42
+
43
+ expect(fetchSpy).toHaveBeenCalledWith(
44
+ `${host}/_purge/${packageName}@${tag}/dist/metadata.json`,
45
+ { method: 'POST', headers: { 'X-Purge-Token': token } }
46
+ );
47
+ });
48
+
49
+ test('logs progress', async () => {
50
+ await subject();
51
+
52
+ expect(log.info).toHaveBeenCalledWith(`Purging cache for ${packageName}@${tag}`);
53
+ });
54
+
55
+ test('logs the redirect location from the response', async () => {
56
+ await subject();
57
+
58
+ expect(log.info).toHaveBeenCalledWith(
59
+ `Cache purged: ${packageName}@${tag}/dist/metadata.json -> ${location.replace(/^\//, '')}`
60
+ );
61
+ });
62
+
63
+ describe('when request fails', () => {
64
+ beforeEach(() => {
65
+ fetchResponse = { ok: false, status: 403, statusText: 'Forbidden' };
66
+ });
67
+
68
+ test('throws error', () => {
69
+ expect(subject).rejects.toThrow(
70
+ `Purge request failed: ${fetchResponse.status} ${fetchResponse.statusText}`
71
+ );
72
+ });
73
+ });
74
+
75
+ function itLogsNullLocation() {
76
+ test('logs null location', async () => {
77
+ await subject();
78
+
79
+ expect(log.info).toHaveBeenCalledWith(expect.stringMatching(/-> null$/));
80
+ });
81
+ }
82
+
83
+ describe('when response location is null', () => {
84
+ beforeEach(() => (responseJson[0].location = null));
85
+
86
+ itLogsNullLocation();
87
+ });
88
+
89
+ describe('when response is empty', () => {
90
+ beforeEach(() => (responseJson = []));
91
+
92
+ itLogsNullLocation();
93
+ });
94
+
95
+ describe('when response is unexpected', () => {
96
+ beforeEach(() => (responseJson = {} as any));
97
+
98
+ itLogsNullLocation();
99
+ });
100
+
101
+ describe('when host has trailing slash', () => {
102
+ beforeEach(() => {
103
+ args.host = `${host}/`;
104
+ });
105
+
106
+ test('strips trailing slash from host', async () => {
107
+ await subject();
108
+
109
+ expect(fetchSpy).toHaveBeenCalledWith(
110
+ `${host}/_purge/${packageName}@${tag}/dist/metadata.json`,
111
+ expect.anything()
112
+ );
113
+ });
114
+ });
115
+
116
+ describe('with --token', () => {
117
+ const cliToken = 'cli-purge-token';
118
+
119
+ beforeEach(() => (args.token = cliToken));
120
+
121
+ test('uses specified token', async () => {
122
+ await subject();
123
+
124
+ expect(fetchSpy).toHaveBeenCalledWith(
125
+ expect.anything(),
126
+ expect.objectContaining({ headers: { 'X-Purge-Token': cliToken } })
127
+ );
128
+ });
129
+ });
130
+
131
+ describe('with no token', () => {
132
+ beforeEach(() => delete process.env.UNPKG_PURGE_TOKEN);
133
+
134
+ test('logs warning and does nothing', async () => {
135
+ await subject();
136
+
137
+ expect(log.warning).toHaveBeenCalledWith('Token is not defined, skipping purge');
138
+ expect(fetchSpy).not.toHaveBeenCalled();
139
+ });
140
+ });
141
+ });
@@ -8,11 +8,9 @@ const options = {
8
8
  codeCoverage: { boolean: true, description: 'Instrument code for coverage analysis?' },
9
9
  config: { string: true, hidden: true, description: 'Use specified configuration' },
10
10
  ignore: { array: true, string: true, description: 'Packages to skip' },
11
- preview: { boolean: true, description: 'Start preview server after build?' },
12
11
  scope: { array: true, string: true, description: 'Packages to build' },
13
12
  stat: { boolean: true, description: 'Generate bundle report?' },
14
13
  useTsc: { boolean: true, description: 'Use tsc to compile packages?' },
15
- useVite: { boolean: true, description: 'Use Vite to bundle packages?' },
16
14
  } satisfies CommandOptions;
17
15
 
18
16
  enum BuildProcesses {
@@ -35,8 +33,6 @@ export class Build extends Command<typeof options> {
35
33
  checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
36
34
 
37
35
  const useTsc = this.args.useTsc;
38
- const useVite = this.args.useVite;
39
- const cmd = useVite ? 'startup bundle-vite' : 'startup bundle-package';
40
36
 
41
37
  const packages = getPackages({
42
38
  scope: this.args.scope,
@@ -93,7 +89,7 @@ export class Build extends Command<typeof options> {
93
89
  return Promise.resolve();
94
90
  }
95
91
  return lernaExec({
96
- cmd,
92
+ 'cmd': 'startup bundle-package',
97
93
  'scope': webpackScope,
98
94
  'parallel': true,
99
95
  'stream': true,
@@ -116,14 +112,13 @@ export class Build extends Command<typeof options> {
116
112
  }
117
113
 
118
114
  return lernaExec({
119
- cmd,
115
+ 'cmd': 'startup bundle-package',
120
116
  'scope': webpackScope,
121
117
  'stream': true,
122
118
  '--': [
123
119
  ...[this.args.config ? `--config "${this.args.config}"` : undefined],
124
120
  ...[this.args.codeCoverage ? '--code-coverage' : undefined],
125
121
  ...[this.args.stat ? '--stat' : undefined],
126
- ...[useVite && this.args.preview ? '--preview' : undefined],
127
122
  ].filter(item => !!item) as string[],
128
123
  });
129
124
  },
@@ -1,4 +1,4 @@
1
- import { getTsConfig, log, logErrors, validateSharedDependenciesConsistency } from '../../utils';
1
+ import { getTsConfig, log, logErrors } from '../../utils';
2
2
  import { bundle, getModuleType } from '../utils';
3
3
  import { Command, CommandOptions } from './types';
4
4
 
@@ -15,8 +15,6 @@ export class BundlePackage extends Command<typeof options> {
15
15
  static readonly options = options;
16
16
  @logErrors
17
17
  async execute() {
18
- validateSharedDependenciesConsistency();
19
-
20
18
  const {
21
19
  config,
22
20
  codeCoverage,
@@ -1,7 +1,6 @@
1
1
  import { CommandName } from '../../utils';
2
2
  import { Build } from './build';
3
3
  import { BundlePackage } from './bundle-package';
4
- import { BundleVite } from './bundle-vite';
5
4
  import { Clean } from './clean';
6
5
  import { ConvertEslintConfig } from './convert-eslint-config';
7
6
  import { ESLintCommand } from './eslint';
@@ -16,6 +15,7 @@ import { MFEPackageClean } from './mfe-package-clean';
16
15
  import { MFEPackagePublish } from './mfe-package-publish';
17
16
  import { MFEPackageRollback } from './mfe-package-rollback';
18
17
  import { MFEPublish } from './mfe-publish';
18
+ import { MFEPurgeCache } from './mfe-purge-cache';
19
19
  import { PreparePackage } from './prepare-package';
20
20
  import { Review } from './review';
21
21
  import { RunTask } from './run-task';
@@ -29,7 +29,6 @@ import { UploadSourcemaps } from './upload-sourcemaps';
29
29
  const commands: Record<CommandName, Newable<Command>> = {
30
30
  [CommandName.build]: Build,
31
31
  [CommandName['bundle-package']]: BundlePackage,
32
- [CommandName['bundle-vite']]: BundleVite,
33
32
  [CommandName['convert-eslint-config']]: ConvertEslintConfig,
34
33
  [CommandName.clean]: Clean,
35
34
  [CommandName.eslint]: ESLintCommand,
@@ -44,6 +43,7 @@ const commands: Record<CommandName, Newable<Command>> = {
44
43
  [CommandName['mfe-package-publish']]: MFEPackagePublish,
45
44
  [CommandName['mfe-package-rollback']]: MFEPackageRollback,
46
45
  [CommandName['mfe-publish']]: MFEPublish,
46
+ [CommandName['mfe-purge-cache']]: MFEPurgeCache,
47
47
  [CommandName['prepare-package']]: PreparePackage,
48
48
  [CommandName.review]: Review,
49
49
  [CommandName.start]: Start,
@@ -1,6 +1,5 @@
1
1
  import { getVersionMismatches } from '@servicetitan/startup-utils';
2
2
  import path from 'node:path';
3
- import { getExposedDependencies, Metadata } from '../../core';
4
3
  import {
5
4
  isWebComponent,
6
5
  loadSharedDependencies,
@@ -9,6 +8,8 @@ import {
9
8
  readJson,
10
9
  toArray,
11
10
  } from '../../utils';
11
+ import { Metadata } from '../../webpack/configs/types';
12
+ import { getExposedDependencies } from '../../webpack/configs/utils';
12
13
  import { Command, CommandOptions } from './types';
13
14
 
14
15
  interface HostPackageJSON {
@@ -1,6 +1,5 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { buildMetadata } from '../../core';
4
3
  import {
5
4
  getFolders,
6
5
  getPackageData,
@@ -10,6 +9,7 @@ import {
10
9
  log,
11
10
  logErrors,
12
11
  } from '../../utils';
12
+ import { buildMetadata } from '../../webpack/configs/utils/build-metadata';
13
13
  import { Command, CommandOptions } from './types';
14
14
 
15
15
  const options = {
@@ -1,6 +1,5 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { EntryPoint, EntryPoints, Metadata } from '../../core';
4
3
  import {
5
4
  getBranchesConfigs,
6
5
  getFolders,
@@ -9,6 +8,7 @@ import {
9
8
  logErrors,
10
9
  readJson,
11
10
  } from '../../utils';
11
+ import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
12
12
  import {
13
13
  DRY_RUN_PREFIX,
14
14
  getDefaultBuildVersion,
@@ -22,7 +22,7 @@ import {
22
22
  runCommand,
23
23
  } from '../utils';
24
24
  import { Command, CommandOptions } from './types';
25
- import { buildRollbackTag, DEFAULT_MFE_REGISTRY } from './utils';
25
+ import { DEFAULT_MFE_REGISTRY, buildRollbackTag, purgeCache } from './utils';
26
26
 
27
27
  export const mfePackagePublishOptions = {
28
28
  branch: {
@@ -59,6 +59,11 @@ export const mfePackagePublishOptions = {
59
59
  description: 'Upload source maps to Datadog?',
60
60
  defaultDescription: 'true',
61
61
  },
62
+ purgeCache: {
63
+ boolean: true,
64
+ description: 'Purge unpkg cache after publishing?',
65
+ defaultDescription: 'true',
66
+ },
62
67
  } satisfies CommandOptions;
63
68
 
64
69
  interface PublishData {
@@ -100,6 +105,11 @@ export class MFEPackagePublish extends Command<typeof mfePackagePublishOptions>
100
105
 
101
106
  await this.maybePublishPackage(packageJson, data);
102
107
 
108
+ const { dry, tag } = data;
109
+ if (this.args.purgeCache !== false && !dry) {
110
+ purgeCache({ packageName: packageJson.name, tag });
111
+ }
112
+
103
113
  if (data.uploadSourcemaps) {
104
114
  this.uploadSourcemaps(data);
105
115
  }
@@ -1,7 +1,7 @@
1
1
  import { log, logErrors, readJson } from '../../utils';
2
2
  import { DRY_RUN_PREFIX, npmTagVersion, npmView } from '../utils';
3
3
  import { Command, CommandOptions } from './types';
4
- import { buildRollbackTag, DEFAULT_MFE_REGISTRY } from './utils';
4
+ import { DEFAULT_MFE_REGISTRY, buildRollbackTag, purgeCache } from './utils';
5
5
 
6
6
  export const mfePackageRollbackOptions = {
7
7
  dry: {
@@ -18,6 +18,11 @@ export const mfePackageRollbackOptions = {
18
18
  description: 'The tag to rollback to its previous version',
19
19
  required: true,
20
20
  },
21
+ purgeCache: {
22
+ boolean: true,
23
+ description: 'Purge unpkg cache after rolling back?',
24
+ defaultDescription: 'true',
25
+ },
21
26
  } satisfies CommandOptions;
22
27
 
23
28
  interface PackageJson {
@@ -25,8 +30,6 @@ interface PackageJson {
25
30
  }
26
31
 
27
32
  export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions> {
28
- static readonly description = 'Rollback a package to a previous tagged version';
29
-
30
33
  static readonly options = mfePackageRollbackOptions;
31
34
 
32
35
  private get dryRunPrefix() {
@@ -35,11 +38,16 @@ export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions
35
38
 
36
39
  @logErrors
37
40
  async execute() {
38
- if (this.args.dry) {
41
+ const { dry, tag } = this.args;
42
+ if (dry) {
39
43
  log.warning('DRY-RUN MODE ENABLED, WILL NOT PERFORM ROLLBACK');
40
44
  }
41
45
 
42
- await this.handleRollback();
46
+ const packageName = await this.handleRollback();
47
+
48
+ if (packageName && this.args.purgeCache !== false && !dry) {
49
+ purgeCache({ packageName, tag });
50
+ }
43
51
  }
44
52
 
45
53
  private async handleRollback() {
@@ -96,5 +104,7 @@ export class MFEPackageRollback extends Command<typeof mfePackageRollbackOptions
96
104
  tag,
97
105
  });
98
106
  }
107
+
108
+ return packageName;
99
109
  }
100
110
  }
@@ -111,17 +111,28 @@ export class MFEPublish extends Command<MFEPublishOptions> {
111
111
  }
112
112
 
113
113
  getPublishOptions() {
114
- const { build, branch, dry, force, registry, tag, uploadSourcemaps, trackHistory } =
115
- this.args;
114
+ const {
115
+ build,
116
+ branch,
117
+ dry,
118
+ force,
119
+ purgeCache,
120
+ registry,
121
+ tag,
122
+ uploadSourcemaps,
123
+ trackHistory,
124
+ } = this.args;
116
125
  return [
117
126
  ...[branch && `--branch ${branch}`],
118
127
  ...[build && `--build ${build}`],
119
128
  ...[dry && '--dry'],
120
129
  ...[force && '--force'],
130
+ ...[purgeCache === true && '--purge-cache'],
131
+ ...[purgeCache === false && '--no-purge-cache'],
121
132
  ...[registry && `--registry ${registry}`],
133
+ ...[typeof tag === 'string' && `--tag ${tag}`],
122
134
  ...[trackHistory === true && '--track-history'],
123
135
  ...[trackHistory === false && '--no-track-history'],
124
- ...[typeof tag === 'string' && `--tag ${tag}`],
125
136
  ...[uploadSourcemaps === true && `--upload-sourcemaps`],
126
137
  ...[uploadSourcemaps === false && `--no-upload-sourcemaps`],
127
138
  ].filter(item => !!item) as string[];
@@ -0,0 +1,75 @@
1
+ import { log, logErrors } from '../../utils';
2
+ import { Command, CommandOptions } from './types';
3
+
4
+ const mfePurgeCacheOptions = {
5
+ host: {
6
+ string: true,
7
+ description: 'Host URL to send purge requests to',
8
+ demandOption: true,
9
+ },
10
+ packageName: {
11
+ string: true,
12
+ description: 'Package name to purge',
13
+ demandOption: true,
14
+ },
15
+ tag: {
16
+ string: true,
17
+ description: 'Package tag to purge',
18
+ demandOption: true,
19
+ },
20
+ token: {
21
+ string: true,
22
+ description: 'X-Purge-Token header value',
23
+ defaultDescription: 'process.env.UNPKG_PURGE_TOKEN',
24
+ },
25
+ } satisfies CommandOptions;
26
+
27
+ export type PurgeResponse = {
28
+ pod: string;
29
+ status: number;
30
+ cache: string | null;
31
+ location: string | null;
32
+ }[];
33
+
34
+ export class MFEPurgeCache extends Command<typeof mfePurgeCacheOptions> {
35
+ static readonly options = mfePurgeCacheOptions;
36
+
37
+ @logErrors
38
+ async execute() {
39
+ const { host: rawHost, packageName, tag } = this.args;
40
+ const host = rawHost.replace(/\/$/, '');
41
+ const token = this.args.token ?? process.env.UNPKG_PURGE_TOKEN;
42
+ const packageNameAndTag = `${packageName}@${tag}`;
43
+ const path = `${packageNameAndTag}/dist/metadata.json`;
44
+
45
+ log.info(`Purging cache for ${packageNameAndTag}`);
46
+
47
+ if (!token) {
48
+ log.warning('Token is not defined, skipping purge');
49
+ return;
50
+ }
51
+
52
+ const response = await fetch(`${host}/_purge/${path}`, {
53
+ method: 'POST',
54
+ headers: { 'X-Purge-Token': token },
55
+ });
56
+
57
+ if (!response.ok) {
58
+ throw new Error(`Purge request failed: ${response.status} ${response.statusText}`);
59
+ }
60
+
61
+ const responseJson = await response.json();
62
+ /* istanbul ignore next: debug only */
63
+ log.debug('mfe-purge-cache', () => JSON.stringify(responseJson, null, 2));
64
+
65
+ log.info(`Cache purged: ${path} -> ${this.getLocation(responseJson)}`);
66
+ }
67
+
68
+ private getLocation(responseJson: PurgeResponse) {
69
+ let location: string | null = null;
70
+ if (Array.isArray(responseJson)) {
71
+ location = responseJson[0]?.location?.replace(/^\//, '') ?? null;
72
+ }
73
+ return location;
74
+ }
75
+ }
@@ -16,7 +16,6 @@ const options = {
16
16
  ignore: { array: true, string: true, description: 'Packages to skip' },
17
17
  scope: { array: true, string: true, description: 'Packages to run and watch' },
18
18
  useTsc: { boolean: true, description: 'Use tsc to compile packages?' },
19
- useVite: { boolean: true, description: 'Use Vite to bundle packages?' },
20
19
  } satisfies CommandOptions;
21
20
 
22
21
  enum StartProcesses {
@@ -40,8 +39,6 @@ export class Start extends Command<typeof options> {
40
39
  checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
41
40
 
42
41
  const useTsc = this.args.useTsc;
43
- const useVite = this.args.useVite;
44
- const cmd = useVite ? 'startup bundle-vite' : 'startup bundle-package';
45
42
 
46
43
  const packages = getPackages({
47
44
  scope: this.args.scope,
@@ -154,7 +151,7 @@ export class Start extends Command<typeof options> {
154
151
  return Promise.resolve();
155
152
  }
156
153
  return lernaExec({
157
- cmd,
154
+ 'cmd': 'startup bundle-package',
158
155
  'scope': webpackScope,
159
156
  'parallel': true,
160
157
  'stream': true,
@@ -170,7 +167,7 @@ export class Start extends Command<typeof options> {
170
167
  return Promise.resolve();
171
168
  }
172
169
  return lernaExec({
173
- cmd,
170
+ 'cmd': 'startup bundle-package',
174
171
  'scope': webpackScope,
175
172
  'parallel': true,
176
173
  'stream': true,
@@ -0,0 +1,40 @@
1
+ import { runCommandOutput } from '../../../utils';
2
+ import { purgeCache } from '../purge-cache';
3
+
4
+ jest.mock('../../../utils', () => ({
5
+ ...jest.requireActual('../../../utils'),
6
+ runCommandOutput: jest.fn(),
7
+ }));
8
+
9
+ describe(purgeCache.name, () => {
10
+ let args: Parameters<typeof purgeCache>[0];
11
+ const packageName = '@servicetitan/foo';
12
+ const tag = 'prod';
13
+
14
+ beforeEach(() => {
15
+ jest.clearAllMocks();
16
+ args = { packageName, tag };
17
+ });
18
+
19
+ const subject = () => purgeCache(args);
20
+
21
+ test('runs mfe-purge-cache with host "https://unpkg.servicetitan.com", package name and tag', () => {
22
+ subject();
23
+
24
+ expect(runCommandOutput).toHaveBeenCalledWith(
25
+ `npx startup mfe-purge-cache --host https://unpkg.servicetitan.com --package-name ${packageName} --tag ${tag}`
26
+ );
27
+ });
28
+
29
+ describe('when registry is "https://verdaccio.st.dev"', () => {
30
+ beforeEach(() => (args.registry = 'https://verdaccio.st.dev'));
31
+
32
+ test('runs mfe-purge-cache with host "https://unpkg.st.dev"', () => {
33
+ subject();
34
+
35
+ expect(runCommandOutput).toHaveBeenCalledWith(
36
+ expect.stringContaining(`--host https://unpkg.st.dev`)
37
+ );
38
+ });
39
+ });
40
+ });
@@ -1,4 +1,3 @@
1
- export const DEFAULT_MFE_REGISTRY = 'https://verdaccio.servicetitan.com';
2
1
  export const ROLLBACK_TAG_SUFFIX = '-rollback-1';
3
2
 
4
3
  export function buildRollbackTag(tag: string): string {
@@ -0,0 +1 @@
1
+ export const DEFAULT_MFE_REGISTRY = 'https://verdaccio.servicetitan.com';
@@ -0,0 +1,3 @@
1
+ export * from './build-rollback-tag';
2
+ export * from './constants';
3
+ export * from './purge-cache';
@@ -0,0 +1,13 @@
1
+ import { runCommandOutput } from '../../utils';
2
+
3
+ const DEV_MFE_REGISTRY = 'https://verdaccio.st.dev';
4
+ const DEFAULT_UNPKG_HOST = 'https://unpkg.servicetitan.com';
5
+ const DEV_UNPKG_HOST = 'https://unpkg.st.dev';
6
+
7
+ export function purgeCache(options: { packageName: string; registry?: string; tag: string }) {
8
+ const { packageName, registry, tag } = options;
9
+ const host = registry === DEV_MFE_REGISTRY ? DEV_UNPKG_HOST : DEFAULT_UNPKG_HOST;
10
+ runCommandOutput(
11
+ `npx startup mfe-purge-cache --host ${host} --package-name ${packageName} --tag ${tag}`
12
+ );
13
+ }
@@ -12,12 +12,8 @@ import {
12
12
  isExposeSharedDependencies,
13
13
  loadSharedDependencies,
14
14
  } from '../../../utils';
15
- import { createWebpackConfig, createWebpackConfigs } from '../../../webpack';
16
- import {
17
- webpackDevConfigFileName,
18
- webpackProdConfigFileName,
19
- } from '../../../webpack/create-webpack-config';
20
- import { bundle } from '../bundle';
15
+ import { createWebpackConfig } from '../../../webpack';
16
+ import { bundle, webpackDevConfigFileName, webpackProdConfigFileName } from '../bundle';
21
17
 
22
18
  jest.mock('fs', () => fs);
23
19
  jest.mock('portfinder');
@@ -28,16 +24,11 @@ jest.mock('../../../utils', () => ({
28
24
  getFolders: jest.fn(),
29
25
  getPackageData: jest.fn(),
30
26
  hasHeadlessBundle: jest.fn(),
31
- isDevServerDisabled: jest.fn(),
32
27
  isExposeSharedDependencies: jest.fn(),
33
- isWebComponent: jest.fn(),
34
28
  loadSharedDependencies: jest.fn(),
35
29
  log: { info: jest.fn(), debug: jest.fn() }, // suppress test output
36
30
  }));
37
- jest.mock('../../../webpack', () => ({
38
- createWebpackConfig: jest.fn(),
39
- createWebpackConfigs: jest.fn(),
40
- }));
31
+ jest.mock('../../../webpack', () => ({ createWebpackConfig: jest.fn() }));
41
32
 
42
33
  describe('[startup] Cli Utils', () => {
43
34
  const pkg = createPackage({});
@@ -46,7 +37,7 @@ describe('[startup] Cli Utils', () => {
46
37
 
47
38
  beforeEach(() => {
48
39
  jest.resetAllMocks();
49
- jest.mocked(createWebpackConfigs).mockReturnValue([createWebpackResult]);
40
+ jest.mocked(createWebpackConfig).mockReturnValue(createWebpackResult);
50
41
  jest.mocked(webpack).mockImplementation((): any => compiler);
51
42
  jest.mocked(getPortPromise).mockImplementation(options =>
52
43
  Promise.resolve(options?.port ?? 0)
@@ -302,7 +293,7 @@ describe('[startup] Cli Utils', () => {
302
293
  };
303
294
  });
304
295
 
305
- test('builds full and light packages', async () => {
296
+ test('builds full and "embed" packages', async () => {
306
297
  await subject();
307
298
 
308
299
  expect(createWebpackConfig).toHaveBeenCalledWith(
@@ -311,7 +302,7 @@ describe('[startup] Cli Utils', () => {
311
302
  );
312
303
  expect(createWebpackConfig).toHaveBeenCalledWith(defaultCreateOverrides, {
313
304
  ...defaultCreateOptions,
314
- light: true,
305
+ embed: true,
315
306
  });
316
307
  expect(compiler.run).toHaveBeenCalledTimes(2);
317
308
  });
@@ -348,7 +339,7 @@ describe('[startup] Cli Utils', () => {
348
339
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, createOptions);
349
340
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
350
341
  ...createOptions,
351
- light: true,
342
+ embed: true,
352
343
  });
353
344
  });
354
345
  }
@@ -535,7 +526,7 @@ describe('[startup] Cli Utils', () => {
535
526
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
536
527
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
537
528
  ...options,
538
- light: true,
529
+ embed: true,
539
530
  });
540
531
  expect(webpack).toHaveBeenNthCalledWith(1, createWebpackResult);
541
532
  expect(webpack).toHaveBeenNthCalledWith(2, createWebpackResult);
@@ -577,7 +568,7 @@ describe('[startup] Cli Utils', () => {
577
568
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
578
569
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
579
570
  ...options,
580
- light: true,
571
+ embed: true,
581
572
  });
582
573
  expect(WebpackDevServer).not.toHaveBeenCalled();
583
574
  });
@@ -597,7 +588,7 @@ describe('[startup] Cli Utils', () => {
597
588
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, options);
598
589
  expect(createWebpackConfig).toHaveBeenCalledWith(overrides, {
599
590
  ...options,
600
- light: true,
591
+ embed: true,
601
592
  });
602
593
  });
603
594
  }