@servicetitan/startup 36.4.0 → 37.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 (442) hide show
  1. package/bin/analyze.js +3 -0
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +4 -5
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-vite.d.ts.map +1 -1
  6. package/dist/cli/commands/bundle-vite.js +18 -1
  7. package/dist/cli/commands/bundle-vite.js.map +1 -1
  8. package/dist/cli/commands/registry/build.d.ts +6 -0
  9. package/dist/cli/commands/registry/build.d.ts.map +1 -1
  10. package/dist/cli/commands/registry/build.js +10 -1
  11. package/dist/cli/commands/registry/build.js.map +1 -1
  12. package/dist/cli/commands/registry/command-registry.d.ts +12 -28
  13. package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
  14. package/dist/cli/commands/registry/command-registry.js +0 -3
  15. package/dist/cli/commands/registry/command-registry.js.map +1 -1
  16. package/dist/cli/commands/registry/start.d.ts +6 -0
  17. package/dist/cli/commands/registry/start.d.ts.map +1 -1
  18. package/dist/cli/commands/registry/start.js +10 -1
  19. package/dist/cli/commands/registry/start.js.map +1 -1
  20. package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
  21. package/dist/cli/commands/review/rules/index.js +2 -0
  22. package/dist/cli/commands/review/rules/index.js.map +1 -1
  23. package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts +13 -0
  24. package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts.map +1 -0
  25. package/dist/cli/commands/review/rules/require-compatible-typescript.js +72 -0
  26. package/dist/cli/commands/review/rules/require-compatible-typescript.js.map +1 -0
  27. package/dist/cli/commands/start.d.ts.map +1 -1
  28. package/dist/cli/commands/start.js +3 -4
  29. package/dist/cli/commands/start.js.map +1 -1
  30. package/dist/cli/index.js +1 -1
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/cli/utils/get-bundle-command.d.ts +3 -0
  33. package/dist/cli/utils/get-bundle-command.d.ts.map +1 -0
  34. package/dist/cli/utils/get-bundle-command.js +16 -0
  35. package/dist/cli/utils/get-bundle-command.js.map +1 -0
  36. package/dist/cli/utils/get-exit-code.d.ts +12 -0
  37. package/dist/cli/utils/get-exit-code.d.ts.map +1 -0
  38. package/dist/cli/utils/get-exit-code.js +26 -0
  39. package/dist/cli/utils/get-exit-code.js.map +1 -0
  40. package/dist/cli/utils/index.d.ts +3 -0
  41. package/dist/cli/utils/index.d.ts.map +1 -1
  42. package/dist/cli/utils/index.js +3 -0
  43. package/dist/cli/utils/index.js.map +1 -1
  44. package/dist/cli/utils/resolve-bundler.d.ts +8 -0
  45. package/dist/cli/utils/resolve-bundler.d.ts.map +1 -0
  46. package/dist/cli/utils/resolve-bundler.js +24 -0
  47. package/dist/cli/utils/resolve-bundler.js.map +1 -0
  48. package/dist/core/bundle-report.d.ts +4 -0
  49. package/dist/core/bundle-report.d.ts.map +1 -0
  50. package/dist/core/bundle-report.js +43 -0
  51. package/dist/core/bundle-report.js.map +1 -0
  52. package/dist/core/check-resource/check-resource.d.ts +2 -2
  53. package/dist/core/check-resource/check-resource.d.ts.map +1 -1
  54. package/dist/core/check-resource/check-resource.js +20 -13
  55. package/dist/core/check-resource/check-resource.js.map +1 -1
  56. package/dist/core/check-resource/get-peer-dependency-meta.d.ts +11 -1
  57. package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -1
  58. package/dist/core/check-resource/get-peer-dependency-meta.js +58 -2
  59. package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -1
  60. package/dist/core/check-resource/index.d.ts +1 -1
  61. package/dist/core/check-resource/index.d.ts.map +1 -1
  62. package/dist/core/check-resource/index.js.map +1 -1
  63. package/dist/core/check-resource/is-resolvable.d.ts +7 -0
  64. package/dist/core/check-resource/is-resolvable.d.ts.map +1 -0
  65. package/dist/core/check-resource/is-resolvable.js +31 -0
  66. package/dist/core/check-resource/is-resolvable.js.map +1 -0
  67. package/dist/core/check-resource/types.d.ts +1 -0
  68. package/dist/core/check-resource/types.d.ts.map +1 -1
  69. package/dist/core/chunk-patterns.d.ts +7 -0
  70. package/dist/core/chunk-patterns.d.ts.map +1 -0
  71. package/dist/core/chunk-patterns.js +37 -0
  72. package/dist/core/chunk-patterns.js.map +1 -0
  73. package/dist/core/create-build-context.d.ts +0 -1
  74. package/dist/core/create-build-context.d.ts.map +1 -1
  75. package/dist/core/create-build-context.js +2 -2
  76. package/dist/core/create-build-context.js.map +1 -1
  77. package/dist/core/create-extension-regexp.d.ts +5 -0
  78. package/dist/core/create-extension-regexp.d.ts.map +1 -0
  79. package/dist/core/create-extension-regexp.js +45 -0
  80. package/dist/core/create-extension-regexp.js.map +1 -0
  81. package/dist/core/get-process-env.d.ts +3 -0
  82. package/dist/core/get-process-env.d.ts.map +1 -0
  83. package/dist/core/get-process-env.js +25 -0
  84. package/dist/core/get-process-env.js.map +1 -0
  85. package/dist/core/index.d.ts +8 -1
  86. package/dist/core/index.d.ts.map +1 -1
  87. package/dist/core/index.js +8 -1
  88. package/dist/core/index.js.map +1 -1
  89. package/dist/core/moment-locales.d.ts +2 -0
  90. package/dist/core/moment-locales.d.ts.map +1 -0
  91. package/dist/core/moment-locales.js +21 -0
  92. package/dist/core/moment-locales.js.map +1 -0
  93. package/dist/core/resolve-output-path.d.ts +3 -0
  94. package/dist/core/resolve-output-path.d.ts.map +1 -0
  95. package/dist/core/resolve-output-path.js +25 -0
  96. package/dist/core/resolve-output-path.js.map +1 -0
  97. package/dist/core/resolve-output-root.d.ts +3 -0
  98. package/dist/core/resolve-output-root.d.ts.map +1 -0
  99. package/dist/core/resolve-output-root.js +23 -0
  100. package/dist/core/resolve-output-root.js.map +1 -0
  101. package/dist/core/sort-shared-css.d.ts +2 -0
  102. package/dist/core/sort-shared-css.d.ts.map +1 -0
  103. package/dist/core/sort-shared-css.js +20 -0
  104. package/dist/core/sort-shared-css.js.map +1 -0
  105. package/dist/core/types.d.ts +1 -1
  106. package/dist/core/types.d.ts.map +1 -1
  107. package/dist/cypress/config/index.d.ts +1 -0
  108. package/dist/cypress/config/index.d.ts.map +1 -1
  109. package/dist/cypress/config/index.js +1 -0
  110. package/dist/cypress/config/index.js.map +1 -1
  111. package/dist/cypress/config/vite-config.d.ts +3 -0
  112. package/dist/cypress/config/vite-config.d.ts.map +1 -0
  113. package/dist/cypress/config/vite-config.js +58 -0
  114. package/dist/cypress/config/vite-config.js.map +1 -0
  115. package/dist/storybook-config/index.d.ts +1 -0
  116. package/dist/storybook-config/index.d.ts.map +1 -1
  117. package/dist/storybook-config/index.js +1 -0
  118. package/dist/storybook-config/index.js.map +1 -1
  119. package/dist/storybook-config/vite-final.d.ts +7 -0
  120. package/dist/storybook-config/vite-final.d.ts.map +1 -0
  121. package/dist/storybook-config/vite-final.js +86 -0
  122. package/dist/storybook-config/vite-final.js.map +1 -0
  123. package/dist/utils/get-configuration.d.ts +15 -10
  124. package/dist/utils/get-configuration.d.ts.map +1 -1
  125. package/dist/utils/get-configuration.js +32 -2
  126. package/dist/utils/get-configuration.js.map +1 -1
  127. package/dist/utils/get-package-name.d.ts +2 -1
  128. package/dist/utils/get-package-name.d.ts.map +1 -1
  129. package/dist/utils/get-package-name.js +4 -2
  130. package/dist/utils/get-package-name.js.map +1 -1
  131. package/dist/utils/index.d.ts +1 -0
  132. package/dist/utils/index.d.ts.map +1 -1
  133. package/dist/utils/index.js.map +1 -1
  134. package/dist/utils/types.d.ts +2 -0
  135. package/dist/utils/types.d.ts.map +1 -0
  136. package/dist/utils/types.js +6 -0
  137. package/dist/utils/types.js.map +1 -0
  138. package/dist/utils/validate-shared-dependencies.d.ts.map +1 -1
  139. package/dist/utils/validate-shared-dependencies.js +4 -0
  140. package/dist/utils/validate-shared-dependencies.js.map +1 -1
  141. package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
  142. package/dist/vite/build-shared-dependencies.js +1 -2
  143. package/dist/vite/build-shared-dependencies.js.map +1 -1
  144. package/dist/vite/config/asset-file-names.d.ts +4 -0
  145. package/dist/vite/config/asset-file-names.d.ts.map +1 -0
  146. package/dist/vite/config/asset-file-names.js +29 -0
  147. package/dist/vite/config/asset-file-names.js.map +1 -0
  148. package/dist/vite/config/base-config.d.ts.map +1 -1
  149. package/dist/vite/config/base-config.js +67 -40
  150. package/dist/vite/config/base-config.js.map +1 -1
  151. package/dist/vite/config/code-splitting.d.ts +4 -0
  152. package/dist/vite/config/code-splitting.d.ts.map +1 -0
  153. package/dist/vite/config/code-splitting.js +48 -0
  154. package/dist/vite/config/code-splitting.js.map +1 -0
  155. package/dist/vite/config/create-css-config.d.ts +3 -0
  156. package/dist/vite/config/create-css-config.d.ts.map +1 -0
  157. package/dist/vite/config/create-css-config.js +26 -0
  158. package/dist/vite/config/create-css-config.js.map +1 -0
  159. package/dist/vite/config/create-filtering-logger.d.ts +3 -0
  160. package/dist/vite/config/create-filtering-logger.d.ts.map +1 -0
  161. package/dist/vite/config/create-filtering-logger.js +37 -0
  162. package/dist/vite/config/create-filtering-logger.js.map +1 -0
  163. package/dist/vite/config/create-vite-build-context.d.ts +2 -1
  164. package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
  165. package/dist/vite/config/create-vite-build-context.js.map +1 -1
  166. package/dist/vite/config/create-vite-config.d.ts.map +1 -1
  167. package/dist/vite/config/create-vite-config.js +30 -13
  168. package/dist/vite/config/create-vite-config.js.map +1 -1
  169. package/dist/vite/config/get-warmup-client-files.d.ts +3 -0
  170. package/dist/vite/config/get-warmup-client-files.d.ts.map +1 -0
  171. package/dist/vite/config/get-warmup-client-files.js +26 -0
  172. package/dist/vite/config/get-warmup-client-files.js.map +1 -0
  173. package/dist/vite/index.html +1 -0
  174. package/dist/vite/plugins/bundle-stat-plugin.d.ts +4 -0
  175. package/dist/vite/plugins/bundle-stat-plugin.d.ts.map +1 -0
  176. package/dist/vite/plugins/bundle-stat-plugin.js +32 -0
  177. package/dist/vite/plugins/bundle-stat-plugin.js.map +1 -0
  178. package/dist/vite/plugins/chain-source-maps-plugin.d.ts +3 -0
  179. package/dist/vite/plugins/chain-source-maps-plugin.d.ts.map +1 -0
  180. package/dist/vite/plugins/chain-source-maps-plugin.js +37 -0
  181. package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -0
  182. package/dist/vite/plugins/clean-plugin.d.ts +4 -0
  183. package/dist/vite/plugins/clean-plugin.d.ts.map +1 -0
  184. package/dist/vite/plugins/clean-plugin.js +63 -0
  185. package/dist/vite/plugins/clean-plugin.js.map +1 -0
  186. package/dist/vite/plugins/design-system-guard-plugin.d.ts +4 -0
  187. package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -0
  188. package/dist/vite/plugins/design-system-guard-plugin.js +35 -0
  189. package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -0
  190. package/dist/vite/plugins/ignore-modules-plugin.d.ts +17 -1
  191. package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
  192. package/dist/vite/plugins/ignore-modules-plugin.js +22 -8
  193. package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
  194. package/dist/vite/plugins/index.d.ts +7 -0
  195. package/dist/vite/plugins/index.d.ts.map +1 -1
  196. package/dist/vite/plugins/index.js +7 -0
  197. package/dist/vite/plugins/index.js.map +1 -1
  198. package/dist/vite/plugins/istanbul-plugin.d.ts +4 -0
  199. package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -0
  200. package/dist/vite/plugins/istanbul-plugin.js +27 -0
  201. package/dist/vite/plugins/istanbul-plugin.js.map +1 -0
  202. package/dist/vite/plugins/magic-comments-plugin/index.d.ts +2 -0
  203. package/dist/vite/plugins/magic-comments-plugin/index.d.ts.map +1 -0
  204. package/dist/vite/plugins/magic-comments-plugin/index.js +20 -0
  205. package/dist/vite/plugins/magic-comments-plugin/index.js.map +1 -0
  206. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts +4 -0
  207. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts.map +1 -0
  208. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +63 -0
  209. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -0
  210. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts +6 -0
  211. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts.map +1 -0
  212. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js +40 -0
  213. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js.map +1 -0
  214. package/dist/vite/plugins/metadata-plugin.js +2 -2
  215. package/dist/vite/plugins/metadata-plugin.js.map +1 -1
  216. package/dist/vite/plugins/moment-locales-plugin.d.ts +5 -0
  217. package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -0
  218. package/dist/vite/plugins/moment-locales-plugin.js +50 -0
  219. package/dist/vite/plugins/moment-locales-plugin.js.map +1 -0
  220. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts +14 -0
  221. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts.map +1 -0
  222. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js +100 -0
  223. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js.map +1 -0
  224. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts +3 -0
  225. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts.map +1 -0
  226. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js +56 -0
  227. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js.map +1 -0
  228. package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts +2 -0
  229. package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts.map +1 -0
  230. package/dist/vite/plugins/shared-dependencies-plugin/flatten.js +19 -0
  231. package/dist/vite/plugins/shared-dependencies-plugin/flatten.js.map +1 -0
  232. package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts +2 -0
  233. package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts.map +1 -0
  234. package/dist/vite/plugins/shared-dependencies-plugin/index.js +20 -0
  235. package/dist/vite/plugins/shared-dependencies-plugin/index.js.map +1 -0
  236. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -0
  237. package/dist/vite/plugins/{shared-dependencies-plugin.js → shared-dependencies-plugin/shared-dependencies-plugin.js} +29 -107
  238. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -0
  239. package/dist/vite/plugins/utils/import-esm.d.ts +2 -0
  240. package/dist/vite/plugins/utils/import-esm.d.ts.map +1 -0
  241. package/dist/vite/plugins/utils/import-esm.js +22 -0
  242. package/dist/vite/plugins/utils/import-esm.js.map +1 -0
  243. package/dist/vite/plugins/utils/index.d.ts +3 -0
  244. package/dist/vite/plugins/utils/index.d.ts.map +1 -0
  245. package/dist/vite/plugins/utils/index.js +21 -0
  246. package/dist/vite/plugins/utils/index.js.map +1 -0
  247. package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
  248. package/dist/webpack/configs/optimization-config.js +53 -24
  249. package/dist/webpack/configs/optimization-config.js.map +1 -1
  250. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  251. package/dist/webpack/configs/output-config.js +0 -1
  252. package/dist/webpack/configs/output-config.js.map +1 -1
  253. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  254. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +11 -3
  255. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  256. package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
  257. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +2 -21
  258. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
  259. package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts +5 -0
  260. package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts.map +1 -0
  261. package/dist/webpack/configs/plugins/define-process-env-plugin.js +20 -0
  262. package/dist/webpack/configs/plugins/define-process-env-plugin.js.map +1 -0
  263. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts +2 -0
  264. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts.map +1 -0
  265. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js +11 -0
  266. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js.map +1 -0
  267. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +26 -3
  268. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
  269. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +41 -10
  270. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  271. package/dist/webpack/configs/plugins/index.d.ts +1 -0
  272. package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
  273. package/dist/webpack/configs/plugins/index.js +1 -0
  274. package/dist/webpack/configs/plugins/index.js.map +1 -1
  275. package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
  276. package/dist/webpack/configs/plugins/moment-locales-plugin.js +2 -5
  277. package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
  278. package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
  279. package/dist/webpack/configs/plugins-config.js +1 -0
  280. package/dist/webpack/configs/plugins-config.js.map +1 -1
  281. package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
  282. package/dist/webpack/configs/rules/font-rules.js +2 -1
  283. package/dist/webpack/configs/rules/font-rules.js.map +1 -1
  284. package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
  285. package/dist/webpack/configs/rules/image-rules.js +2 -1
  286. package/dist/webpack/configs/rules/image-rules.js.map +1 -1
  287. package/dist/webpack/create-webpack-config.d.ts.map +1 -1
  288. package/dist/webpack/create-webpack-config.js +8 -3
  289. package/dist/webpack/create-webpack-config.js.map +1 -1
  290. package/dist/webpack/create-webpack-configs.d.ts.map +1 -1
  291. package/dist/webpack/create-webpack-configs.js +4 -12
  292. package/dist/webpack/create-webpack-configs.js.map +1 -1
  293. package/dist/webpack/types.d.ts +1 -1
  294. package/dist/webpack/types.d.ts.map +1 -1
  295. package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -1
  296. package/dist/webpack/utils/create-webpack-build-context.js +1 -2
  297. package/dist/webpack/utils/create-webpack-build-context.js.map +1 -1
  298. package/package.json +22 -18
  299. package/src/cli/commands/__tests__/build.test.ts +33 -5
  300. package/src/cli/commands/__tests__/bundle-vite.test.ts +50 -1
  301. package/src/cli/commands/__tests__/start.test.ts +17 -4
  302. package/src/cli/commands/build.ts +5 -6
  303. package/src/cli/commands/bundle-vite.ts +13 -0
  304. package/src/cli/commands/registry/build.ts +6 -1
  305. package/src/cli/commands/registry/command-registry.ts +0 -1
  306. package/src/cli/commands/registry/start.ts +6 -1
  307. package/src/cli/commands/review/rules/__tests__/require-compatible-typescript.test.ts +127 -0
  308. package/src/cli/commands/review/rules/index.ts +2 -0
  309. package/src/cli/commands/review/rules/require-compatible-typescript.ts +64 -0
  310. package/src/cli/commands/start.ts +4 -4
  311. package/src/cli/index.ts +2 -2
  312. package/src/cli/utils/__tests__/get-bundle-command.test.ts +23 -0
  313. package/src/cli/utils/__tests__/get-exit-code.test.ts +41 -0
  314. package/src/cli/utils/__tests__/resolve-bundler.test.ts +64 -0
  315. package/src/cli/utils/get-bundle-command.ts +5 -0
  316. package/src/cli/utils/get-exit-code.ts +17 -0
  317. package/src/cli/utils/index.ts +3 -0
  318. package/src/cli/utils/resolve-bundler.ts +23 -0
  319. package/src/core/__tests__/bundle-report.test.ts +60 -0
  320. package/src/core/__tests__/create-extension-regexp.test.ts +32 -0
  321. package/src/core/__tests__/resolve-output-path.test.ts +45 -0
  322. package/src/core/__tests__/resolve-output-root.test.ts +37 -0
  323. package/src/core/__tests__/sort-shared-css.test.ts +39 -0
  324. package/src/core/bundle-report.ts +33 -0
  325. package/src/core/check-resource/__tests__/check-resource.test.ts +21 -7
  326. package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +70 -13
  327. package/src/core/check-resource/__tests__/is-resolvable.test.ts +20 -0
  328. package/src/core/check-resource/check-resource.ts +15 -14
  329. package/src/core/check-resource/get-peer-dependency-meta.ts +67 -4
  330. package/src/core/check-resource/index.ts +1 -1
  331. package/src/core/check-resource/is-resolvable.ts +19 -0
  332. package/src/core/check-resource/types.ts +2 -0
  333. package/src/core/chunk-patterns.ts +30 -0
  334. package/src/core/create-build-context.ts +2 -2
  335. package/src/core/create-extension-regexp.ts +7 -0
  336. package/src/core/get-process-env.ts +17 -0
  337. package/src/core/index.ts +8 -1
  338. package/src/core/moment-locales.ts +6 -0
  339. package/src/core/resolve-output-path.ts +10 -0
  340. package/src/core/resolve-output-root.ts +8 -0
  341. package/src/core/sort-shared-css.ts +7 -0
  342. package/src/core/types.ts +1 -1
  343. package/src/cypress/config/__tests__/vite-config.test.ts +72 -0
  344. package/src/cypress/config/index.ts +1 -0
  345. package/src/cypress/config/vite-config.ts +37 -0
  346. package/src/storybook-config/__tests__/vite-final.test.ts +122 -0
  347. package/src/storybook-config/index.ts +1 -0
  348. package/src/storybook-config/vite-final.ts +65 -0
  349. package/src/utils/__tests__/get-configuration.test.ts +82 -5
  350. package/src/utils/__tests__/get-package-name.test.ts +57 -0
  351. package/src/utils/__tests__/validate-shared-dependencies.test.ts +50 -35
  352. package/src/utils/get-configuration.ts +50 -15
  353. package/src/utils/get-package-name.ts +8 -2
  354. package/src/utils/index.ts +1 -0
  355. package/src/utils/types.ts +1 -0
  356. package/src/utils/validate-shared-dependencies.ts +15 -1
  357. package/src/vite/__tests__/build-shared-dependencies.test.ts +13 -26
  358. package/src/vite/__tests__/validate-shared-dependencies.test.ts +30 -19
  359. package/src/vite/build-shared-dependencies.ts +3 -7
  360. package/src/vite/config/__tests__/asset-file-names.test.ts +40 -0
  361. package/src/vite/config/__tests__/base-config.test.ts +99 -31
  362. package/src/vite/config/__tests__/code-splitting.test.ts +34 -0
  363. package/src/vite/config/__tests__/create-css-config.test.ts +58 -0
  364. package/src/vite/config/__tests__/create-filtering-logger.test.ts +51 -0
  365. package/src/vite/config/__tests__/create-vite-build-context.test.ts +5 -2
  366. package/src/vite/config/__tests__/create-vite-config.test.ts +91 -13
  367. package/src/vite/config/__tests__/get-warmup-client-files.test.ts +20 -0
  368. package/src/vite/config/asset-file-names.ts +20 -0
  369. package/src/vite/config/base-config.ts +45 -37
  370. package/src/vite/config/code-splitting.ts +23 -0
  371. package/src/vite/config/create-css-config.ts +16 -0
  372. package/src/vite/config/create-filtering-logger.ts +34 -0
  373. package/src/vite/config/create-vite-build-context.ts +3 -5
  374. package/src/vite/config/create-vite-config.ts +45 -12
  375. package/src/vite/config/get-warmup-client-files.ts +13 -0
  376. package/src/vite/index.html +1 -0
  377. package/src/vite/plugins/__tests__/bundle-stat-plugin.test.ts +70 -0
  378. package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +58 -0
  379. package/src/vite/plugins/__tests__/clean-plugin.test.ts +121 -0
  380. package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +83 -0
  381. package/src/vite/plugins/__tests__/html-template.test.ts +6 -0
  382. package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +29 -7
  383. package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +62 -0
  384. package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +104 -0
  385. package/src/vite/plugins/bundle-stat-plugin.ts +24 -0
  386. package/src/vite/plugins/chain-source-maps-plugin.ts +26 -0
  387. package/src/vite/plugins/clean-plugin.ts +46 -0
  388. package/src/vite/plugins/design-system-guard-plugin.ts +34 -0
  389. package/src/vite/plugins/ignore-modules-plugin.ts +31 -5
  390. package/src/vite/plugins/index.ts +7 -0
  391. package/src/vite/plugins/istanbul-plugin.ts +19 -0
  392. package/src/vite/plugins/magic-comments-plugin/__tests__/magic-comments-plugin.test.ts +105 -0
  393. package/src/vite/plugins/magic-comments-plugin/__tests__/parse-magic-comments.test.ts +40 -0
  394. package/src/vite/plugins/magic-comments-plugin/index.ts +1 -0
  395. package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +63 -0
  396. package/src/vite/plugins/magic-comments-plugin/parse-magic-comments.ts +39 -0
  397. package/src/vite/plugins/metadata-plugin.ts +1 -1
  398. package/src/vite/plugins/moment-locales-plugin.ts +41 -0
  399. package/src/vite/plugins/shared-dependencies-plugin/__tests__/assemble-iife.test.ts +29 -0
  400. package/src/vite/plugins/shared-dependencies-plugin/__tests__/assert-no-dynamic-css.test.ts +113 -0
  401. package/src/vite/plugins/shared-dependencies-plugin/__tests__/flatten.test.ts +23 -0
  402. package/src/vite/plugins/{__tests__ → shared-dependencies-plugin/__tests__}/shared-dependencies-plugin.test.ts +38 -4
  403. package/src/vite/plugins/shared-dependencies-plugin/assemble-iife.ts +114 -0
  404. package/src/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.ts +58 -0
  405. package/src/vite/plugins/shared-dependencies-plugin/flatten.ts +8 -0
  406. package/src/vite/plugins/shared-dependencies-plugin/index.ts +1 -0
  407. package/src/vite/plugins/{shared-dependencies-plugin.ts → shared-dependencies-plugin/shared-dependencies-plugin.ts} +24 -115
  408. package/src/vite/plugins/utils/import-esm.ts +15 -0
  409. package/src/vite/plugins/utils/index.ts +2 -0
  410. package/src/vite/rolldown-oxc.d.ts +20 -0
  411. package/src/webpack/__tests__/bundle-webpack.test.ts +8 -8
  412. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +54 -5
  413. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +70 -12
  414. package/src/webpack/__tests__/create-webpack-config.test.ts +92 -9
  415. package/src/webpack/configs/optimization-config.ts +47 -25
  416. package/src/webpack/configs/output-config.ts +1 -2
  417. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +16 -4
  418. package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +3 -25
  419. package/src/webpack/configs/plugins/define-process-env-plugin.ts +10 -0
  420. package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +76 -24
  421. package/src/webpack/configs/plugins/ignore-plugin/empty-module.ts +7 -0
  422. package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +59 -9
  423. package/src/webpack/configs/plugins/index.ts +1 -0
  424. package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -2
  425. package/src/webpack/configs/plugins-config.ts +2 -0
  426. package/src/webpack/configs/rules/font-rules.ts +2 -2
  427. package/src/webpack/configs/rules/image-rules.ts +2 -2
  428. package/src/webpack/create-webpack-config.ts +11 -4
  429. package/src/webpack/create-webpack-configs.ts +2 -8
  430. package/src/webpack/types.ts +1 -4
  431. package/src/webpack/utils/create-webpack-build-context.ts +1 -6
  432. package/tsconfig/base.json +1 -1
  433. package/tsconfig/types.d.ts +10 -0
  434. package/dist/core/get-output-path.d.ts +0 -3
  435. package/dist/core/get-output-path.d.ts.map +0 -1
  436. package/dist/core/get-output-path.js +0 -29
  437. package/dist/core/get-output-path.js.map +0 -1
  438. package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +0 -1
  439. package/dist/vite/plugins/shared-dependencies-plugin.js.map +0 -1
  440. package/src/core/__tests__/get-output-path.test.ts +0 -64
  441. package/src/core/get-output-path.ts +0 -15
  442. /package/dist/vite/plugins/{shared-dependencies-plugin.d.ts → shared-dependencies-plugin/shared-dependencies-plugin.d.ts} +0 -0
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./get-css-file-names"), exports);
6
+ _export_star(require("./import-esm"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/vite/plugins/utils/index.ts"],"sourcesContent":["export * from './get-css-file-names';\nexport * from './import-esm';\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"optimization-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/optimization-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI1D,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAElD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAqBrF"}
1
+ {"version":3,"file":"optimization-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/optimization-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI1D,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAElD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAqBrF"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "optimizationConfig", {
10
10
  });
11
11
  const _cssminimizerwebpackplugin = /*#__PURE__*/ _interop_require_default(require("css-minimizer-webpack-plugin"));
12
12
  const _terserwebpackplugin = /*#__PURE__*/ _interop_require_default(require("terser-webpack-plugin"));
13
+ const _core = require("../../core");
13
14
  function _interop_require_default(obj) {
14
15
  return obj && obj.__esModule ? obj : {
15
16
  default: obj
@@ -31,6 +32,7 @@ function optimizationConfig(context, _) {
31
32
  optimization.runtimeChunk = 'single';
32
33
  }
33
34
  [
35
+ hostConfig,
34
36
  minimizeConfig,
35
37
  sharedDependenciesConfig,
36
38
  webComponentConfig
@@ -39,9 +41,18 @@ function optimizationConfig(context, _) {
39
41
  optimization
40
42
  };
41
43
  }
44
+ function hostConfig(optimization, context) {
45
+ const { isProduction } = context.build;
46
+ const { isWebComponent } = context.package;
47
+ if (isWebComponent || !isProduction) {
48
+ return;
49
+ }
50
+ Object.assign(optimization.splitChunks.cacheGroups, vendorGroups());
51
+ }
42
52
  function minimizeConfig(optimization, context) {
43
53
  var _ref, _ref1;
44
54
  const { isProduction } = context.build;
55
+ const { isWebComponent } = context.package;
45
56
  const { codeCoverage } = context.options;
46
57
  const { minify } = context.bundlerConfig;
47
58
  if (!isProduction) {
@@ -53,9 +64,12 @@ function minimizeConfig(optimization, context) {
53
64
  if (!optimization.minimize) {
54
65
  return;
55
66
  }
56
- const terserOptions = {
57
- compress: false,
58
- mangle: false,
67
+ /*
68
+ * MFE source maps are available to Datadog, so compress and mangle are OK.
69
+ * Disable for hosts until their source maps are uploaded too.
70
+ */ const terserOptions = {
71
+ compress: !!isWebComponent,
72
+ mangle: !!isWebComponent,
59
73
  ...typeof minifyJs === 'object' ? minifyJs : {}
60
74
  };
61
75
  const cssMinimizerPluginOptions = {
@@ -82,44 +96,59 @@ function sharedDependenciesConfig(optimization, context) {
82
96
  test: /@servicetitan[\\/]anvil2[\\/].*\.css$/,
83
97
  name: 'anvil2',
84
98
  chunks: 'all',
85
- enforce: true
99
+ enforce: true,
100
+ // Must outrank vendor groups so anvil2 CSS lands in separate chunk
101
+ priority: 10
86
102
  }
87
103
  });
88
104
  }
89
105
  function webComponentConfig(optimization, context) {
90
106
  const { headless, isProduction } = context.build;
91
107
  const { isWebComponent } = context.package;
92
- if (!isWebComponent || headless) {
108
+ if (!isWebComponent) {
93
109
  return;
94
110
  }
111
+ const groups = vendorGroups();
112
+ const styles = {
113
+ name: 'main',
114
+ type: 'css/mini-extract',
115
+ chunks: 'all',
116
+ enforce: true
117
+ };
95
118
  Object.assign(optimization.splitChunks.cacheGroups, {
96
- styles: {
97
- name: 'main',
98
- type: 'css/mini-extract',
99
- chunks: 'all',
100
- enforce: true
119
+ ...headless ? {} : {
120
+ styles
101
121
  },
102
- servicetitan: {
103
- name: 'servicetitan',
104
- test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
105
- chunks: 'all'
122
+ // assets-manifest-plugin requires servicetitan to order CSS correctly (headless has no CSS)
123
+ ...isProduction ? groups : headless ? {} : {
124
+ servicetitan: groups.servicetitan
106
125
  }
107
126
  });
108
- if (!isProduction) {
109
- return;
110
- }
111
- Object.assign(optimization.splitChunks.cacheGroups, {
112
- common: {
113
- name: 'common',
114
- test: /[\\/]node_modules[\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\/]/,
127
+ }
128
+ function vendorGroups() {
129
+ return {
130
+ 'servicetitan': {
131
+ name: 'servicetitan',
132
+ test: _core.CHUNK_PATTERNS.servicetitan,
115
133
  chunks: 'all'
116
134
  },
117
- kendo: {
135
+ 'vendor-core': {
136
+ name: 'vendor-core',
137
+ test: _core.CHUNK_PATTERNS['vendor-core'],
138
+ chunks: 'all'
139
+ },
140
+ 'kendo': {
118
141
  name: 'kendo',
119
- test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
142
+ test: _core.CHUNK_PATTERNS.kendo,
120
143
  chunks: 'all'
144
+ },
145
+ 'vendor': {
146
+ name: 'vendor',
147
+ test: _core.CHUNK_PATTERNS.vendor,
148
+ chunks: 'all',
149
+ priority: -5
121
150
  }
122
- });
151
+ };
123
152
  }
124
153
 
125
154
  //# sourceMappingURL=optimization-config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webpack/configs/optimization-config.ts"],"sourcesContent":["import CssMinimizerWebpackPlugin from 'css-minimizer-webpack-plugin';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { Configuration } from 'webpack';\nimport { Overrides, WebpackBuildContext } from '../types';\n\ntype Config = Configuration['optimization'];\ntype ConfigWithCacheGroups = Config & { splitChunks: { cacheGroups: Record<string, any> } };\ntype Result = Pick<Configuration, 'optimization'>;\n\nexport function optimizationConfig(context: WebpackBuildContext, _: Overrides): Result {\n const { headless, isProduction, emitExposedDependencies } = context.build;\n\n const optimization: ConfigWithCacheGroups = {\n chunkIds: isProduction ? 'deterministic' : 'named',\n moduleIds: 'size',\n mangleExports: 'size',\n splitChunks: { cacheGroups: {} },\n };\n\n if (emitExposedDependencies) {\n optimization.runtimeChunk = false;\n } else if (!headless && isProduction) {\n optimization.runtimeChunk = 'single';\n }\n\n [minimizeConfig, sharedDependenciesConfig, webComponentConfig].forEach(handler =>\n handler(optimization, context)\n );\n\n return { optimization };\n}\n\nfunction minimizeConfig(optimization: ConfigWithCacheGroups, context: WebpackBuildContext) {\n const { isProduction } = context.build;\n const { codeCoverage } = context.options;\n const { minify } = context.bundlerConfig;\n if (!isProduction) {\n return;\n }\n\n const minifyJs = minify?.js ?? true;\n const minifyCss = minify?.css ?? true;\n optimization.minimize = !codeCoverage && (!!minifyJs || !!minifyCss);\n if (!optimization.minimize) {\n return;\n }\n\n const terserOptions = {\n compress: false,\n mangle: false,\n ...(typeof minifyJs === 'object' ? minifyJs : {}),\n };\n\n const cssMinimizerPluginOptions = {\n ...(typeof minifyCss === 'object' ? minifyCss : {}),\n };\n\n optimization.minimizer = [\n ...(minifyJs ? [new TerserPlugin({ terserOptions })] : []),\n ...(minifyCss ? [new CssMinimizerWebpackPlugin(cssMinimizerPluginOptions)] : []),\n ];\n}\n\nfunction sharedDependenciesConfig(\n optimization: ConfigWithCacheGroups,\n context: WebpackBuildContext\n) {\n const { emitExposedDependencies } = context.build;\n if (!emitExposedDependencies) {\n return;\n }\n\n Object.assign(optimization.splitChunks.cacheGroups, {\n anvil2: {\n test: /@servicetitan[\\\\/]anvil2[\\\\/].*\\.css$/,\n name: 'anvil2',\n chunks: 'all',\n enforce: true,\n },\n });\n}\n\nfunction webComponentConfig(optimization: ConfigWithCacheGroups, context: WebpackBuildContext) {\n const { headless, isProduction } = context.build;\n const { isWebComponent } = context.package;\n if (!isWebComponent || headless) {\n return;\n }\n\n Object.assign(optimization.splitChunks.cacheGroups, {\n styles: {\n name: 'main',\n type: 'css/mini-extract',\n chunks: 'all',\n enforce: true,\n },\n servicetitan: {\n name: 'servicetitan',\n test: /[\\\\/]node_modules[\\\\/]@servicetitan[\\\\/]/,\n chunks: 'all',\n },\n });\n\n if (!isProduction) {\n return;\n }\n\n Object.assign(optimization.splitChunks.cacheGroups, {\n common: {\n name: 'common',\n test: /[\\\\/]node_modules[\\\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\\\/]/,\n chunks: 'all',\n },\n kendo: {\n name: 'kendo',\n test: /[\\\\/]node_modules[\\\\/](@progress|@telerik)[\\\\/]/,\n chunks: 'all',\n },\n });\n}\n"],"names":["optimizationConfig","context","_","headless","isProduction","emitExposedDependencies","build","optimization","chunkIds","moduleIds","mangleExports","splitChunks","cacheGroups","runtimeChunk","minimizeConfig","sharedDependenciesConfig","webComponentConfig","forEach","handler","codeCoverage","options","minify","bundlerConfig","minifyJs","js","minifyCss","css","minimize","terserOptions","compress","mangle","cssMinimizerPluginOptions","minimizer","TerserPlugin","CssMinimizerWebpackPlugin","Object","assign","anvil2","test","name","chunks","enforce","isWebComponent","package","styles","type","servicetitan","common","kendo"],"mappings":";;;;+BASgBA;;;eAAAA;;;kFATsB;4EACb;;;;;;AAQlB,SAASA,mBAAmBC,OAA4B,EAAEC,CAAY;IACzE,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IAEzE,MAAMC,eAAsC;QACxCC,UAAUJ,eAAe,kBAAkB;QAC3CK,WAAW;QACXC,eAAe;QACfC,aAAa;YAAEC,aAAa,CAAC;QAAE;IACnC;IAEA,IAAIP,yBAAyB;QACzBE,aAAaM,YAAY,GAAG;IAChC,OAAO,IAAI,CAACV,YAAYC,cAAc;QAClCG,aAAaM,YAAY,GAAG;IAChC;IAEA;QAACC;QAAgBC;QAA0BC;KAAmB,CAACC,OAAO,CAACC,CAAAA,UACnEA,QAAQX,cAAcN;IAG1B,OAAO;QAAEM;IAAa;AAC1B;AAEA,SAASO,eAAeP,YAAmC,EAAEN,OAA4B;;IACrF,MAAM,EAAEG,YAAY,EAAE,GAAGH,QAAQK,KAAK;IACtC,MAAM,EAAEa,YAAY,EAAE,GAAGlB,QAAQmB,OAAO;IACxC,MAAM,EAAEC,MAAM,EAAE,GAAGpB,QAAQqB,aAAa;IACxC,IAAI,CAAClB,cAAc;QACf;IACJ;IAEA,MAAMmB,mBAAWF,mBAAAA,6BAAAA,OAAQG,EAAE,uCAAI;IAC/B,MAAMC,qBAAYJ,mBAAAA,6BAAAA,OAAQK,GAAG,yCAAI;IACjCnB,aAAaoB,QAAQ,GAAG,CAACR,gBAAiB,CAAA,CAAC,CAACI,YAAY,CAAC,CAACE,SAAQ;IAClE,IAAI,CAAClB,aAAaoB,QAAQ,EAAE;QACxB;IACJ;IAEA,MAAMC,gBAAgB;QAClBC,UAAU;QACVC,QAAQ;QACR,GAAI,OAAOP,aAAa,WAAWA,WAAW,CAAC,CAAC;IACpD;IAEA,MAAMQ,4BAA4B;QAC9B,GAAI,OAAON,cAAc,WAAWA,YAAY,CAAC,CAAC;IACtD;IAEAlB,aAAayB,SAAS,GAAG;WACjBT,WAAW;YAAC,IAAIU,4BAAY,CAAC;gBAAEL;YAAc;SAAG,GAAG,EAAE;WACrDH,YAAY;YAAC,IAAIS,kCAAyB,CAACH;SAA2B,GAAG,EAAE;KAClF;AACL;AAEA,SAAShB,yBACLR,YAAmC,EACnCN,OAA4B;IAE5B,MAAM,EAAEI,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACjD,IAAI,CAACD,yBAAyB;QAC1B;IACJ;IAEA8B,OAAOC,MAAM,CAAC7B,aAAaI,WAAW,CAACC,WAAW,EAAE;QAChDyB,QAAQ;YACJC,MAAM;YACNC,MAAM;YACNC,QAAQ;YACRC,SAAS;QACb;IACJ;AACJ;AAEA,SAASzB,mBAAmBT,YAAmC,EAAEN,OAA4B;IACzF,MAAM,EAAEE,QAAQ,EAAEC,YAAY,EAAE,GAAGH,QAAQK,KAAK;IAChD,MAAM,EAAEoC,cAAc,EAAE,GAAGzC,QAAQ0C,OAAO;IAC1C,IAAI,CAACD,kBAAkBvC,UAAU;QAC7B;IACJ;IAEAgC,OAAOC,MAAM,CAAC7B,aAAaI,WAAW,CAACC,WAAW,EAAE;QAChDgC,QAAQ;YACJL,MAAM;YACNM,MAAM;YACNL,QAAQ;YACRC,SAAS;QACb;QACAK,cAAc;YACVP,MAAM;YACND,MAAM;YACNE,QAAQ;QACZ;IACJ;IAEA,IAAI,CAACpC,cAAc;QACf;IACJ;IAEA+B,OAAOC,MAAM,CAAC7B,aAAaI,WAAW,CAACC,WAAW,EAAE;QAChDmC,QAAQ;YACJR,MAAM;YACND,MAAM;YACNE,QAAQ;QACZ;QACAQ,OAAO;YACHT,MAAM;YACND,MAAM;YACNE,QAAQ;QACZ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/webpack/configs/optimization-config.ts"],"sourcesContent":["import CssMinimizerWebpackPlugin from 'css-minimizer-webpack-plugin';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport { Configuration } from 'webpack';\nimport { CHUNK_PATTERNS } from '../../core';\nimport { Overrides, WebpackBuildContext } from '../types';\n\ntype Config = Configuration['optimization'];\ntype ConfigWithCacheGroups = Config & { splitChunks: { cacheGroups: Record<string, any> } };\ntype Result = Pick<Configuration, 'optimization'>;\n\nexport function optimizationConfig(context: WebpackBuildContext, _: Overrides): Result {\n const { headless, isProduction, emitExposedDependencies } = context.build;\n\n const optimization: ConfigWithCacheGroups = {\n chunkIds: isProduction ? 'deterministic' : 'named',\n moduleIds: 'size',\n mangleExports: 'size',\n splitChunks: { cacheGroups: {} },\n };\n\n if (emitExposedDependencies) {\n optimization.runtimeChunk = false;\n } else if (!headless && isProduction) {\n optimization.runtimeChunk = 'single';\n }\n\n [hostConfig, minimizeConfig, sharedDependenciesConfig, webComponentConfig].forEach(handler =>\n handler(optimization, context)\n );\n\n return { optimization };\n}\n\nfunction hostConfig(optimization: ConfigWithCacheGroups, context: WebpackBuildContext) {\n const { isProduction } = context.build;\n const { isWebComponent } = context.package;\n if (isWebComponent || !isProduction) {\n return;\n }\n\n Object.assign(optimization.splitChunks.cacheGroups, vendorGroups());\n}\n\nfunction minimizeConfig(optimization: ConfigWithCacheGroups, context: WebpackBuildContext) {\n const { isProduction } = context.build;\n const { isWebComponent } = context.package;\n const { codeCoverage } = context.options;\n const { minify } = context.bundlerConfig;\n if (!isProduction) {\n return;\n }\n\n const minifyJs = minify?.js ?? true;\n const minifyCss = minify?.css ?? true;\n optimization.minimize = !codeCoverage && (!!minifyJs || !!minifyCss);\n if (!optimization.minimize) {\n return;\n }\n\n /*\n * MFE source maps are available to Datadog, so compress and mangle are OK.\n * Disable for hosts until their source maps are uploaded too.\n */\n const terserOptions = {\n compress: !!isWebComponent,\n mangle: !!isWebComponent,\n ...(typeof minifyJs === 'object' ? minifyJs : {}),\n };\n\n const cssMinimizerPluginOptions = {\n ...(typeof minifyCss === 'object' ? minifyCss : {}),\n };\n\n optimization.minimizer = [\n ...(minifyJs ? [new TerserPlugin({ terserOptions })] : []),\n ...(minifyCss ? [new CssMinimizerWebpackPlugin(cssMinimizerPluginOptions)] : []),\n ];\n}\n\nfunction sharedDependenciesConfig(\n optimization: ConfigWithCacheGroups,\n context: WebpackBuildContext\n) {\n const { emitExposedDependencies } = context.build;\n if (!emitExposedDependencies) {\n return;\n }\n\n Object.assign(optimization.splitChunks.cacheGroups, {\n anvil2: {\n test: /@servicetitan[\\\\/]anvil2[\\\\/].*\\.css$/,\n name: 'anvil2',\n chunks: 'all',\n enforce: true,\n // Must outrank vendor groups so anvil2 CSS lands in separate chunk\n priority: 10,\n },\n });\n}\n\nfunction webComponentConfig(optimization: ConfigWithCacheGroups, context: WebpackBuildContext) {\n const { headless, isProduction } = context.build;\n const { isWebComponent } = context.package;\n if (!isWebComponent) {\n return;\n }\n\n const groups = vendorGroups();\n const styles = { name: 'main', type: 'css/mini-extract', chunks: 'all', enforce: true };\n\n Object.assign(optimization.splitChunks.cacheGroups, {\n ...(headless ? {} : { styles }),\n // assets-manifest-plugin requires servicetitan to order CSS correctly (headless has no CSS)\n ...(isProduction ? groups : headless ? {} : { servicetitan: groups.servicetitan }),\n });\n}\n\nfunction vendorGroups() {\n return {\n 'servicetitan': {\n name: 'servicetitan',\n test: CHUNK_PATTERNS.servicetitan,\n chunks: 'all',\n },\n 'vendor-core': {\n name: 'vendor-core',\n test: CHUNK_PATTERNS['vendor-core'],\n chunks: 'all',\n },\n 'kendo': {\n name: 'kendo',\n test: CHUNK_PATTERNS.kendo,\n chunks: 'all',\n },\n 'vendor': {\n name: 'vendor',\n test: CHUNK_PATTERNS.vendor,\n chunks: 'all',\n priority: -5,\n },\n };\n}\n"],"names":["optimizationConfig","context","_","headless","isProduction","emitExposedDependencies","build","optimization","chunkIds","moduleIds","mangleExports","splitChunks","cacheGroups","runtimeChunk","hostConfig","minimizeConfig","sharedDependenciesConfig","webComponentConfig","forEach","handler","isWebComponent","package","Object","assign","vendorGroups","codeCoverage","options","minify","bundlerConfig","minifyJs","js","minifyCss","css","minimize","terserOptions","compress","mangle","cssMinimizerPluginOptions","minimizer","TerserPlugin","CssMinimizerWebpackPlugin","anvil2","test","name","chunks","enforce","priority","groups","styles","type","servicetitan","CHUNK_PATTERNS","kendo","vendor"],"mappings":";;;;+BAUgBA;;;eAAAA;;;kFAVsB;4EACb;sBAEM;;;;;;AAOxB,SAASA,mBAAmBC,OAA4B,EAAEC,CAAY;IACzE,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IAEzE,MAAMC,eAAsC;QACxCC,UAAUJ,eAAe,kBAAkB;QAC3CK,WAAW;QACXC,eAAe;QACfC,aAAa;YAAEC,aAAa,CAAC;QAAE;IACnC;IAEA,IAAIP,yBAAyB;QACzBE,aAAaM,YAAY,GAAG;IAChC,OAAO,IAAI,CAACV,YAAYC,cAAc;QAClCG,aAAaM,YAAY,GAAG;IAChC;IAEA;QAACC;QAAYC;QAAgBC;QAA0BC;KAAmB,CAACC,OAAO,CAACC,CAAAA,UAC/EA,QAAQZ,cAAcN;IAG1B,OAAO;QAAEM;IAAa;AAC1B;AAEA,SAASO,WAAWP,YAAmC,EAAEN,OAA4B;IACjF,MAAM,EAAEG,YAAY,EAAE,GAAGH,QAAQK,KAAK;IACtC,MAAM,EAAEc,cAAc,EAAE,GAAGnB,QAAQoB,OAAO;IAC1C,IAAID,kBAAkB,CAAChB,cAAc;QACjC;IACJ;IAEAkB,OAAOC,MAAM,CAAChB,aAAaI,WAAW,CAACC,WAAW,EAAEY;AACxD;AAEA,SAAST,eAAeR,YAAmC,EAAEN,OAA4B;;IACrF,MAAM,EAAEG,YAAY,EAAE,GAAGH,QAAQK,KAAK;IACtC,MAAM,EAAEc,cAAc,EAAE,GAAGnB,QAAQoB,OAAO;IAC1C,MAAM,EAAEI,YAAY,EAAE,GAAGxB,QAAQyB,OAAO;IACxC,MAAM,EAAEC,MAAM,EAAE,GAAG1B,QAAQ2B,aAAa;IACxC,IAAI,CAACxB,cAAc;QACf;IACJ;IAEA,MAAMyB,mBAAWF,mBAAAA,6BAAAA,OAAQG,EAAE,uCAAI;IAC/B,MAAMC,qBAAYJ,mBAAAA,6BAAAA,OAAQK,GAAG,yCAAI;IACjCzB,aAAa0B,QAAQ,GAAG,CAACR,gBAAiB,CAAA,CAAC,CAACI,YAAY,CAAC,CAACE,SAAQ;IAClE,IAAI,CAACxB,aAAa0B,QAAQ,EAAE;QACxB;IACJ;IAEA;;;KAGC,GACD,MAAMC,gBAAgB;QAClBC,UAAU,CAAC,CAACf;QACZgB,QAAQ,CAAC,CAAChB;QACV,GAAI,OAAOS,aAAa,WAAWA,WAAW,CAAC,CAAC;IACpD;IAEA,MAAMQ,4BAA4B;QAC9B,GAAI,OAAON,cAAc,WAAWA,YAAY,CAAC,CAAC;IACtD;IAEAxB,aAAa+B,SAAS,GAAG;WACjBT,WAAW;YAAC,IAAIU,4BAAY,CAAC;gBAAEL;YAAc;SAAG,GAAG,EAAE;WACrDH,YAAY;YAAC,IAAIS,kCAAyB,CAACH;SAA2B,GAAG,EAAE;KAClF;AACL;AAEA,SAASrB,yBACLT,YAAmC,EACnCN,OAA4B;IAE5B,MAAM,EAAEI,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACjD,IAAI,CAACD,yBAAyB;QAC1B;IACJ;IAEAiB,OAAOC,MAAM,CAAChB,aAAaI,WAAW,CAACC,WAAW,EAAE;QAChD6B,QAAQ;YACJC,MAAM;YACNC,MAAM;YACNC,QAAQ;YACRC,SAAS;YACT,mEAAmE;YACnEC,UAAU;QACd;IACJ;AACJ;AAEA,SAAS7B,mBAAmBV,YAAmC,EAAEN,OAA4B;IACzF,MAAM,EAAEE,QAAQ,EAAEC,YAAY,EAAE,GAAGH,QAAQK,KAAK;IAChD,MAAM,EAAEc,cAAc,EAAE,GAAGnB,QAAQoB,OAAO;IAC1C,IAAI,CAACD,gBAAgB;QACjB;IACJ;IAEA,MAAM2B,SAASvB;IACf,MAAMwB,SAAS;QAAEL,MAAM;QAAQM,MAAM;QAAoBL,QAAQ;QAAOC,SAAS;IAAK;IAEtFvB,OAAOC,MAAM,CAAChB,aAAaI,WAAW,CAACC,WAAW,EAAE;QAChD,GAAIT,WAAW,CAAC,IAAI;YAAE6C;QAAO,CAAC;QAC9B,4FAA4F;QAC5F,GAAI5C,eAAe2C,SAAS5C,WAAW,CAAC,IAAI;YAAE+C,cAAcH,OAAOG,YAAY;QAAC,CAAC;IACrF;AACJ;AAEA,SAAS1B;IACL,OAAO;QACH,gBAAgB;YACZmB,MAAM;YACND,MAAMS,oBAAc,CAACD,YAAY;YACjCN,QAAQ;QACZ;QACA,eAAe;YACXD,MAAM;YACND,MAAMS,oBAAc,CAAC,cAAc;YACnCP,QAAQ;QACZ;QACA,SAAS;YACLD,MAAM;YACND,MAAMS,oBAAc,CAACC,KAAK;YAC1BR,QAAQ;QACZ;QACA,UAAU;YACND,MAAM;YACND,MAAMS,oBAAc,CAACE,MAAM;YAC3BT,QAAQ;YACRE,UAAU,CAAC;QACf;IACJ;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"output-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/output-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAA4C,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAE5C,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAqBxE"}
1
+ {"version":3,"file":"output-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/output-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAA6B,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAE5C,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAoBxE"}
@@ -14,7 +14,6 @@ function outputConfig(context, _) {
14
14
  const { isWebComponent } = context.package;
15
15
  const output = {
16
16
  filename: '[name].bundle.js',
17
- path: (0, _core.getOutputPath)(context),
18
17
  clean: getClean(context),
19
18
  ...emitExposedDependencies ? {
20
19
  chunkLoadingGlobal: `sharedChunk${name}`
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webpack/configs/output-config.ts"],"sourcesContent":["import { Configuration } from 'webpack';\nimport { BuildContext, getBundleType, getCdnPath, getOutputPath } from '../../core';\nimport { Overrides } from '../types';\n\ntype Config = Configuration['output'];\ntype Result = Pick<Configuration, 'output'>;\n\nexport function outputConfig(context: BuildContext, _: Overrides): Result {\n const { name, isProduction, emitExposedDependencies } = context.build;\n const { isWebComponent } = context.package;\n\n const output: Config = {\n filename: '[name].bundle.js',\n path: getOutputPath(context),\n clean: getClean(context),\n ...(emitExposedDependencies ? { chunkLoadingGlobal: `sharedChunk${name}` } : {}),\n };\n\n if (isProduction) {\n const cdnPath = getCdnPath(context);\n Object.assign(output, {\n filename: '[name].[contenthash].bundle.js',\n ...(isWebComponent ? { uniqueName: name } : {}),\n ...(cdnPath ? { publicPath: cdnPath } : {}),\n });\n }\n\n return { output };\n}\n\nfunction getClean(context: BuildContext): NonNullable<Config>['clean'] {\n const { emitExposedDependencies } = context.build;\n if (emitExposedDependencies) {\n return true;\n }\n const exposedDependenciesDir = getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n return exposedDependenciesDir ? { keep: new RegExp(exposedDependenciesDir) } : true;\n}\n"],"names":["outputConfig","context","_","name","isProduction","emitExposedDependencies","build","isWebComponent","package","output","filename","path","getOutputPath","clean","getClean","chunkLoadingGlobal","cdnPath","getCdnPath","Object","assign","uniqueName","publicPath","exposedDependenciesDir","getBundleType","keep","RegExp"],"mappings":";;;;+BAOgBA;;;eAAAA;;;sBANuD;AAMhE,SAASA,aAAaC,OAAqB,EAAEC,CAAY;IAC5D,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACrE,MAAM,EAAEC,cAAc,EAAE,GAAGN,QAAQO,OAAO;IAE1C,MAAMC,SAAiB;QACnBC,UAAU;QACVC,MAAMC,IAAAA,mBAAa,EAACX;QACpBY,OAAOC,SAASb;QAChB,GAAII,0BAA0B;YAAEU,oBAAoB,CAAC,WAAW,EAAEZ,MAAM;QAAC,IAAI,CAAC,CAAC;IACnF;IAEA,IAAIC,cAAc;QACd,MAAMY,UAAUC,IAAAA,gBAAU,EAAChB;QAC3BiB,OAAOC,MAAM,CAACV,QAAQ;YAClBC,UAAU;YACV,GAAIH,iBAAiB;gBAAEa,YAAYjB;YAAK,IAAI,CAAC,CAAC;YAC9C,GAAIa,UAAU;gBAAEK,YAAYL;YAAQ,IAAI,CAAC,CAAC;QAC9C;IACJ;IAEA,OAAO;QAAEP;IAAO;AACpB;AAEA,SAASK,SAASb,OAAqB;IACnC,MAAM,EAAEI,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACjD,IAAID,yBAAyB;QACzB,OAAO;IACX;IACA,MAAMiB,yBAAyBC,IAAAA,mBAAa,EAAC;QACzC,GAAGtB,OAAO;QACVK,OAAO;YAAE,GAAGL,QAAQK,KAAK;YAAED,yBAAyB;QAAK;IAC7D;IACA,OAAOiB,yBAAyB;QAAEE,MAAM,IAAIC,OAAOH;IAAwB,IAAI;AACnF"}
1
+ {"version":3,"sources":["../../../src/webpack/configs/output-config.ts"],"sourcesContent":["import { Configuration } from 'webpack';\nimport { BuildContext, getBundleType, getCdnPath } from '../../core';\nimport { Overrides } from '../types';\n\ntype Config = Configuration['output'];\ntype Result = Pick<Configuration, 'output'>;\n\nexport function outputConfig(context: BuildContext, _: Overrides): Result {\n const { name, isProduction, emitExposedDependencies } = context.build;\n const { isWebComponent } = context.package;\n\n const output: Config = {\n filename: '[name].bundle.js',\n clean: getClean(context),\n ...(emitExposedDependencies ? { chunkLoadingGlobal: `sharedChunk${name}` } : {}),\n };\n\n if (isProduction) {\n const cdnPath = getCdnPath(context);\n Object.assign(output, {\n filename: '[name].[contenthash].bundle.js',\n ...(isWebComponent ? { uniqueName: name } : {}),\n ...(cdnPath ? { publicPath: cdnPath } : {}),\n });\n }\n\n return { output };\n}\n\nfunction getClean(context: BuildContext): NonNullable<Config>['clean'] {\n const { emitExposedDependencies } = context.build;\n if (emitExposedDependencies) {\n return true;\n }\n const exposedDependenciesDir = getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n return exposedDependenciesDir ? { keep: new RegExp(exposedDependenciesDir) } : true;\n}\n"],"names":["outputConfig","context","_","name","isProduction","emitExposedDependencies","build","isWebComponent","package","output","filename","clean","getClean","chunkLoadingGlobal","cdnPath","getCdnPath","Object","assign","uniqueName","publicPath","exposedDependenciesDir","getBundleType","keep","RegExp"],"mappings":";;;;+BAOgBA;;;eAAAA;;;sBANwC;AAMjD,SAASA,aAAaC,OAAqB,EAAEC,CAAY;IAC5D,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACrE,MAAM,EAAEC,cAAc,EAAE,GAAGN,QAAQO,OAAO;IAE1C,MAAMC,SAAiB;QACnBC,UAAU;QACVC,OAAOC,SAASX;QAChB,GAAII,0BAA0B;YAAEQ,oBAAoB,CAAC,WAAW,EAAEV,MAAM;QAAC,IAAI,CAAC,CAAC;IACnF;IAEA,IAAIC,cAAc;QACd,MAAMU,UAAUC,IAAAA,gBAAU,EAACd;QAC3Be,OAAOC,MAAM,CAACR,QAAQ;YAClBC,UAAU;YACV,GAAIH,iBAAiB;gBAAEW,YAAYf;YAAK,IAAI,CAAC,CAAC;YAC9C,GAAIW,UAAU;gBAAEK,YAAYL;YAAQ,IAAI,CAAC,CAAC;QAC9C;IACJ;IAEA,OAAO;QAAEL;IAAO;AACpB;AAEA,SAASG,SAASX,OAAqB;IACnC,MAAM,EAAEI,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IACjD,IAAID,yBAAyB;QACzB,OAAO;IACX;IACA,MAAMe,yBAAyBC,IAAAA,mBAAa,EAAC;QACzC,GAAGpB,OAAO;QACVK,OAAO;YAAE,GAAGL,QAAQK,KAAK;YAAED,yBAAyB;QAAK;IAC7D;IACA,OAAOe,yBAAyB;QAAEE,MAAM,IAAIC,OAAOH;IAAwB,IAAI;AACnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"assets-manifest-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/assets-manifest-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAyD,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,qCAkCvE"}
1
+ {"version":3,"file":"assets-manifest-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/assets-manifest-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACH,YAAY,EAIf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,qCAoCvE"}
@@ -21,13 +21,17 @@ function assetsManifestPlugin(context, _) {
21
21
  output: 'entrypoints.json',
22
22
  transform (assets) {
23
23
  const getAssetsByType = (type)=>{
24
- return Object.values(assets.entrypoints).flatMap(({ assets })=>{
24
+ const assetsForType = Object.values(assets.entrypoints).flatMap(({ assets })=>{
25
25
  var _assets_type;
26
26
  return (_assets_type = assets[type]) !== null && _assets_type !== void 0 ? _assets_type : [];
27
27
  });
28
+ // Dedupe chunks shared by entry points
29
+ return [
30
+ ...new Set(assetsForType)
31
+ ];
28
32
  };
29
33
  return {
30
- css: ensureDesignSystemCssIsFirst(getAssetsByType('css')),
34
+ css: ensureDesignSystemCssIsFirst(context, getAssetsByType('css')),
31
35
  js: getAssetsByType('js')
32
36
  };
33
37
  },
@@ -41,7 +45,11 @@ function assetsManifestPlugin(context, _) {
41
45
  }
42
46
  });
43
47
  }
44
- function ensureDesignSystemCssIsFirst(cssAssets) {
48
+ function ensureDesignSystemCssIsFirst(context, cssAssets) {
49
+ if (context.build.emitExposedDependencies) {
50
+ return (0, _core.sortSharedCss)(cssAssets);
51
+ }
52
+ // Put MFE's 'servicetitan' CSS chunk first to give custom CSS higher precedence
45
53
  const offset = cssAssets.findIndex((name)=>name.startsWith('servicetitan'));
46
54
  return offset > 0 ? [
47
55
  cssAssets[offset],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/webpack/configs/plugins/assets-manifest-plugin.ts"],"sourcesContent":["import { WebpackAssetsManifest } from 'webpack-assets-manifest';\nimport { BuildContext, generateExposedDependenciesMetadata, generateMetadata } from '../../../core';\nimport { Overrides } from '../../types';\n\ninterface EntryPoints {\n css: string[];\n js: string[];\n}\n\nexport function assetsManifestPlugin(context: BuildContext, _: Overrides) {\n const { destination, isWebComponent } = context.package;\n const { emitExposedDependencies } = context.build;\n\n if (!(isWebComponent || emitExposedDependencies)) {\n return;\n }\n\n return new WebpackAssetsManifest({\n entrypoints: true,\n output: 'entrypoints.json',\n transform(assets: {\n entrypoints: Record<string, { assets: Record<string, string[]> }>;\n }): EntryPoints {\n const getAssetsByType = (type: string) => {\n return Object.values(assets.entrypoints).flatMap(\n ({ assets }) => assets[type] ?? []\n );\n };\n\n return {\n css: ensureDesignSystemCssIsFirst(getAssetsByType('css')),\n js: getAssetsByType('js'),\n };\n },\n // eslint-disable-next-line @typescript-eslint/require-await\n done: async (manifest: WebpackAssetsManifest) => {\n if (emitExposedDependencies) {\n generateExposedDependenciesMetadata(destination, () => manifest.getOutputPath());\n } else {\n generateMetadata(context);\n }\n },\n });\n}\n\nfunction ensureDesignSystemCssIsFirst(cssAssets: string[]) {\n const offset = cssAssets.findIndex(name => name.startsWith('servicetitan'));\n return offset > 0\n ? [cssAssets[offset], ...cssAssets.filter((_, index) => index !== offset)]\n : cssAssets;\n}\n"],"names":["assetsManifestPlugin","context","_","destination","isWebComponent","package","emitExposedDependencies","build","WebpackAssetsManifest","entrypoints","output","transform","assets","getAssetsByType","type","Object","values","flatMap","css","ensureDesignSystemCssIsFirst","js","done","manifest","generateExposedDependenciesMetadata","getOutputPath","generateMetadata","cssAssets","offset","findIndex","name","startsWith","filter","index"],"mappings":";;;;+BASgBA;;;eAAAA;;;uCATsB;sBAC8C;AAQ7E,SAASA,qBAAqBC,OAAqB,EAAEC,CAAY;IACpE,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAE,GAAGH,QAAQI,OAAO;IACvD,MAAM,EAAEC,uBAAuB,EAAE,GAAGL,QAAQM,KAAK;IAEjD,IAAI,CAAEH,CAAAA,kBAAkBE,uBAAsB,GAAI;QAC9C;IACJ;IAEA,OAAO,IAAIE,4CAAqB,CAAC;QAC7BC,aAAa;QACbC,QAAQ;QACRC,WAAUC,MAET;YACG,MAAMC,kBAAkB,CAACC;gBACrB,OAAOC,OAAOC,MAAM,CAACJ,OAAOH,WAAW,EAAEQ,OAAO,CAC5C,CAAC,EAAEL,MAAM,EAAE;wBAAKA;4BAAAA,eAAAA,MAAM,CAACE,KAAK,cAAZF,0BAAAA,eAAgB,EAAE;;YAE1C;YAEA,OAAO;gBACHM,KAAKC,6BAA6BN,gBAAgB;gBAClDO,IAAIP,gBAAgB;YACxB;QACJ;QACA,4DAA4D;QAC5DQ,MAAM,OAAOC;YACT,IAAIhB,yBAAyB;gBACzBiB,IAAAA,yCAAmC,EAACpB,aAAa,IAAMmB,SAASE,aAAa;YACjF,OAAO;gBACHC,IAAAA,sBAAgB,EAACxB;YACrB;QACJ;IACJ;AACJ;AAEA,SAASkB,6BAA6BO,SAAmB;IACrD,MAAMC,SAASD,UAAUE,SAAS,CAACC,CAAAA,OAAQA,KAAKC,UAAU,CAAC;IAC3D,OAAOH,SAAS,IACV;QAACD,SAAS,CAACC,OAAO;WAAKD,UAAUK,MAAM,CAAC,CAAC7B,GAAG8B,QAAUA,UAAUL;KAAQ,GACxED;AACV"}
1
+ {"version":3,"sources":["../../../../src/webpack/configs/plugins/assets-manifest-plugin.ts"],"sourcesContent":["import { WebpackAssetsManifest } from 'webpack-assets-manifest';\nimport {\n BuildContext,\n generateExposedDependenciesMetadata,\n generateMetadata,\n sortSharedCss,\n} from '../../../core';\nimport { Overrides } from '../../types';\n\ninterface EntryPoints {\n css: string[];\n js: string[];\n}\n\nexport function assetsManifestPlugin(context: BuildContext, _: Overrides) {\n const { destination, isWebComponent } = context.package;\n const { emitExposedDependencies } = context.build;\n\n if (!(isWebComponent || emitExposedDependencies)) {\n return;\n }\n\n return new WebpackAssetsManifest({\n entrypoints: true,\n output: 'entrypoints.json',\n transform(assets: {\n entrypoints: Record<string, { assets: Record<string, string[]> }>;\n }): EntryPoints {\n const getAssetsByType = (type: string) => {\n const assetsForType = Object.values(assets.entrypoints).flatMap(\n ({ assets }) => assets[type] ?? []\n );\n // Dedupe chunks shared by entry points\n return [...new Set(assetsForType)];\n };\n\n return {\n css: ensureDesignSystemCssIsFirst(context, getAssetsByType('css')),\n js: getAssetsByType('js'),\n };\n },\n // eslint-disable-next-line @typescript-eslint/require-await\n done: async (manifest: WebpackAssetsManifest) => {\n if (emitExposedDependencies) {\n generateExposedDependenciesMetadata(destination, () => manifest.getOutputPath());\n } else {\n generateMetadata(context);\n }\n },\n });\n}\n\nfunction ensureDesignSystemCssIsFirst(context: BuildContext, cssAssets: string[]) {\n if (context.build.emitExposedDependencies) {\n return sortSharedCss(cssAssets);\n }\n\n // Put MFE's 'servicetitan' CSS chunk first to give custom CSS higher precedence\n const offset = cssAssets.findIndex(name => name.startsWith('servicetitan'));\n return offset > 0\n ? [cssAssets[offset], ...cssAssets.filter((_, index) => index !== offset)]\n : cssAssets;\n}\n"],"names":["assetsManifestPlugin","context","_","destination","isWebComponent","package","emitExposedDependencies","build","WebpackAssetsManifest","entrypoints","output","transform","assets","getAssetsByType","type","assetsForType","Object","values","flatMap","Set","css","ensureDesignSystemCssIsFirst","js","done","manifest","generateExposedDependenciesMetadata","getOutputPath","generateMetadata","cssAssets","sortSharedCss","offset","findIndex","name","startsWith","filter","index"],"mappings":";;;;+BAcgBA;;;eAAAA;;;uCAdsB;sBAM/B;AAQA,SAASA,qBAAqBC,OAAqB,EAAEC,CAAY;IACpE,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAE,GAAGH,QAAQI,OAAO;IACvD,MAAM,EAAEC,uBAAuB,EAAE,GAAGL,QAAQM,KAAK;IAEjD,IAAI,CAAEH,CAAAA,kBAAkBE,uBAAsB,GAAI;QAC9C;IACJ;IAEA,OAAO,IAAIE,4CAAqB,CAAC;QAC7BC,aAAa;QACbC,QAAQ;QACRC,WAAUC,MAET;YACG,MAAMC,kBAAkB,CAACC;gBACrB,MAAMC,gBAAgBC,OAAOC,MAAM,CAACL,OAAOH,WAAW,EAAES,OAAO,CAC3D,CAAC,EAAEN,MAAM,EAAE;wBAAKA;4BAAAA,eAAAA,MAAM,CAACE,KAAK,cAAZF,0BAAAA,eAAgB,EAAE;;gBAEtC,uCAAuC;gBACvC,OAAO;uBAAI,IAAIO,IAAIJ;iBAAe;YACtC;YAEA,OAAO;gBACHK,KAAKC,6BAA6BpB,SAASY,gBAAgB;gBAC3DS,IAAIT,gBAAgB;YACxB;QACJ;QACA,4DAA4D;QAC5DU,MAAM,OAAOC;YACT,IAAIlB,yBAAyB;gBACzBmB,IAAAA,yCAAmC,EAACtB,aAAa,IAAMqB,SAASE,aAAa;YACjF,OAAO;gBACHC,IAAAA,sBAAgB,EAAC1B;YACrB;QACJ;IACJ;AACJ;AAEA,SAASoB,6BAA6BpB,OAAqB,EAAE2B,SAAmB;IAC5E,IAAI3B,QAAQM,KAAK,CAACD,uBAAuB,EAAE;QACvC,OAAOuB,IAAAA,mBAAa,EAACD;IACzB;IAEA,gFAAgF;IAChF,MAAME,SAASF,UAAUG,SAAS,CAACC,CAAAA,OAAQA,KAAKC,UAAU,CAAC;IAC3D,OAAOH,SAAS,IACV;QAACF,SAAS,CAACE,OAAO;WAAKF,UAAUM,MAAM,CAAC,CAAChC,GAAGiC,QAAUA,UAAUL;KAAQ,GACxEF;AACV"}
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-analyser-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/bundle-analyser-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,OAUvE"}
1
+ {"version":3,"file":"bundle-analyser-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/bundle-analyser-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA2C,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,OAUvE"}
@@ -23,28 +23,9 @@ function bundleAnalyzerPlugin(context, _) {
23
23
  }
24
24
  return new BundleAnalyzerPlugin({
25
25
  analyzerMode: 'static',
26
- reportFilename: _path.default.join(_os.default.tmpdir(), getReportFileName(context)),
27
- reportTitle: getReportTitle(context)
26
+ reportFilename: _path.default.join(_os.default.tmpdir(), `${(0, _core.bundleReportFileName)(context)}.html`),
27
+ reportTitle: (0, _core.bundleReportTitle)(context)
28
28
  });
29
29
  }
30
- function getReportFileName(context) {
31
- const type = (0, _core.getBundleType)(context);
32
- const qualifier = type ? `-${type}` : '';
33
- return `${context.package.name}${qualifier}-bundle-${Date.now()}.html`;
34
- }
35
- function getReportTitle(context) {
36
- const unscopedName = context.package.name.replace(/^@[^/]+\//, '');
37
- const type = (0, _core.getBundleType)(context);
38
- const qualifier = type ? ` (${type})` : '';
39
- return `${unscopedName}${qualifier} ${formatDate(new Date())}`;
40
- }
41
- function formatDate(date) {
42
- const yyyy = date.getFullYear();
43
- const mm = date.getMonth() + 1;
44
- const dd = date.getDate();
45
- const HH = date.getHours();
46
- const MM = date.getMinutes();
47
- return `${yyyy}-${mm}-${dd} ${HH}:${MM}`;
48
- }
49
30
 
50
31
  //# sourceMappingURL=bundle-analyser-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/webpack/configs/plugins/bundle-analyser-plugin.ts"],"sourcesContent":["import os from 'os';\nimport path from 'path';\nimport { BuildContext, getBundleType } from '../../../core';\nimport { Overrides } from '../../types';\nconst BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;\n\nexport function bundleAnalyzerPlugin(context: BuildContext, _: Overrides) {\n if (!context.options.buildStat) {\n return;\n }\n\n return new BundleAnalyzerPlugin({\n analyzerMode: 'static',\n reportFilename: path.join(os.tmpdir(), getReportFileName(context)),\n reportTitle: getReportTitle(context),\n });\n}\n\nfunction getReportFileName(context: BuildContext) {\n const type = getBundleType(context);\n const qualifier = type ? `-${type}` : '';\n return `${context.package.name}${qualifier}-bundle-${Date.now()}.html`;\n}\n\nfunction getReportTitle(context: BuildContext) {\n const unscopedName = context.package.name.replace(/^@[^/]+\\//, '');\n const type = getBundleType(context);\n const qualifier = type ? ` (${type})` : '';\n return `${unscopedName}${qualifier} ${formatDate(new Date())}`;\n}\n\nfunction formatDate(date: Date) {\n const yyyy = date.getFullYear();\n const mm = date.getMonth() + 1;\n const dd = date.getDate();\n const HH = date.getHours();\n const MM = date.getMinutes();\n return `${yyyy}-${mm}-${dd} ${HH}:${MM}`;\n}\n"],"names":["bundleAnalyzerPlugin","BundleAnalyzerPlugin","require","context","_","options","buildStat","analyzerMode","reportFilename","path","join","os","tmpdir","getReportFileName","reportTitle","getReportTitle","type","getBundleType","qualifier","package","name","Date","now","unscopedName","replace","formatDate","date","yyyy","getFullYear","mm","getMonth","dd","getDate","HH","getHours","MM","getMinutes"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;sBAC2B;;;;;;AAE5C,MAAMC,uBAAuBC,QAAQ,2BAA2BD,oBAAoB;AAE7E,SAASD,qBAAqBG,OAAqB,EAAEC,CAAY;IACpE,IAAI,CAACD,QAAQE,OAAO,CAACC,SAAS,EAAE;QAC5B;IACJ;IAEA,OAAO,IAAIL,qBAAqB;QAC5BM,cAAc;QACdC,gBAAgBC,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,MAAM,IAAIC,kBAAkBV;QACzDW,aAAaC,eAAeZ;IAChC;AACJ;AAEA,SAASU,kBAAkBV,OAAqB;IAC5C,MAAMa,OAAOC,IAAAA,mBAAa,EAACd;IAC3B,MAAMe,YAAYF,OAAO,CAAC,CAAC,EAAEA,MAAM,GAAG;IACtC,OAAO,GAAGb,QAAQgB,OAAO,CAACC,IAAI,GAAGF,UAAU,QAAQ,EAAEG,KAAKC,GAAG,GAAG,KAAK,CAAC;AAC1E;AAEA,SAASP,eAAeZ,OAAqB;IACzC,MAAMoB,eAAepB,QAAQgB,OAAO,CAACC,IAAI,CAACI,OAAO,CAAC,aAAa;IAC/D,MAAMR,OAAOC,IAAAA,mBAAa,EAACd;IAC3B,MAAMe,YAAYF,OAAO,CAAC,EAAE,EAAEA,KAAK,CAAC,CAAC,GAAG;IACxC,OAAO,GAAGO,eAAeL,UAAU,CAAC,EAAEO,WAAW,IAAIJ,SAAS;AAClE;AAEA,SAASI,WAAWC,IAAU;IAC1B,MAAMC,OAAOD,KAAKE,WAAW;IAC7B,MAAMC,KAAKH,KAAKI,QAAQ,KAAK;IAC7B,MAAMC,KAAKL,KAAKM,OAAO;IACvB,MAAMC,KAAKP,KAAKQ,QAAQ;IACxB,MAAMC,KAAKT,KAAKU,UAAU;IAC1B,OAAO,GAAGT,KAAK,CAAC,EAAEE,GAAG,CAAC,EAAEE,GAAG,CAAC,EAAEE,GAAG,CAAC,EAAEE,IAAI;AAC5C"}
1
+ {"version":3,"sources":["../../../../src/webpack/configs/plugins/bundle-analyser-plugin.ts"],"sourcesContent":["import os from 'os';\nimport path from 'path';\nimport { BuildContext, bundleReportFileName, bundleReportTitle } from '../../../core';\nimport { Overrides } from '../../types';\nconst BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;\n\nexport function bundleAnalyzerPlugin(context: BuildContext, _: Overrides) {\n if (!context.options.buildStat) {\n return;\n }\n\n return new BundleAnalyzerPlugin({\n analyzerMode: 'static',\n reportFilename: path.join(os.tmpdir(), `${bundleReportFileName(context)}.html`),\n reportTitle: bundleReportTitle(context),\n });\n}\n"],"names":["bundleAnalyzerPlugin","BundleAnalyzerPlugin","require","context","_","options","buildStat","analyzerMode","reportFilename","path","join","os","tmpdir","bundleReportFileName","reportTitle","bundleReportTitle"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;sBACqD;;;;;;AAEtE,MAAMC,uBAAuBC,QAAQ,2BAA2BD,oBAAoB;AAE7E,SAASD,qBAAqBG,OAAqB,EAAEC,CAAY;IACpE,IAAI,CAACD,QAAQE,OAAO,CAACC,SAAS,EAAE;QAC5B;IACJ;IAEA,OAAO,IAAIL,qBAAqB;QAC5BM,cAAc;QACdC,gBAAgBC,aAAI,CAACC,IAAI,CAACC,WAAE,CAACC,MAAM,IAAI,GAAGC,IAAAA,0BAAoB,EAACV,SAAS,KAAK,CAAC;QAC9EW,aAAaC,IAAAA,uBAAiB,EAACZ;IACnC;AACJ"}
@@ -0,0 +1,5 @@
1
+ import { DefinePlugin } from 'webpack';
2
+ import { BuildContext } from '../../../core';
3
+ import { Overrides } from '../../types';
4
+ export declare function defineProcessEnvPlugin(context: BuildContext, _: Overrides): DefinePlugin | undefined;
5
+ //# sourceMappingURL=define-process-env-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-process-env-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/define-process-env-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,4BAKzE"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "defineProcessEnvPlugin", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return defineProcessEnvPlugin;
9
+ }
10
+ });
11
+ const _webpack = require("webpack");
12
+ const _core = require("../../../core");
13
+ function defineProcessEnvPlugin(context, _) {
14
+ const definitions = (0, _core.getProcessEnv)(context);
15
+ if (definitions) {
16
+ return new _webpack.DefinePlugin(definitions);
17
+ }
18
+ }
19
+
20
+ //# sourceMappingURL=define-process-env-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/webpack/configs/plugins/define-process-env-plugin.ts"],"sourcesContent":["import { DefinePlugin } from 'webpack';\nimport { BuildContext, getProcessEnv } from '../../../core';\nimport { Overrides } from '../../types';\n\nexport function defineProcessEnvPlugin(context: BuildContext, _: Overrides) {\n const definitions = getProcessEnv(context);\n if (definitions) {\n return new DefinePlugin(definitions);\n }\n}\n"],"names":["defineProcessEnvPlugin","context","_","definitions","getProcessEnv","DefinePlugin"],"mappings":";;;;+BAIgBA;;;eAAAA;;;yBAJa;sBACe;AAGrC,SAASA,uBAAuBC,OAAqB,EAAEC,CAAY;IACtE,MAAMC,cAAcC,IAAAA,mBAAa,EAACH;IAClC,IAAIE,aAAa;QACb,OAAO,IAAIE,qBAAY,CAACF;IAC5B;AACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=empty-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-module.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/empty-module.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Empty module used by IgnoreOptionalDependenciesPlugin in 'empty' mode to substitute missing
3
+ * optional dependencies. This must be a physical file because webpack's resolveData.request
4
+ * requires a resolvable path. Matches the vite plugin's substitute shape (no exports), so a
5
+ * namespace import (`import * as X`) yields an empty namespace under both bundlers.
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ //# sourceMappingURL=empty-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/empty-module.ts"],"sourcesContent":["/*\n * Empty module used by IgnoreOptionalDependenciesPlugin in 'empty' mode to substitute missing\n * optional dependencies. This must be a physical file because webpack's resolveData.request\n * requires a resolvable path. Matches the vite plugin's substitute shape (no exports), so a\n * namespace import (`import * as X`) yields an empty namespace under both bundlers.\n */\nexport {};\n"],"names":[],"mappings":"AAAA;;;;;CAKC"}
@@ -1,5 +1,28 @@
1
- import { IgnorePlugin } from 'webpack';
2
- import { BuildContext } from '../../../../core';
1
+ import { Compiler } from 'webpack';
2
+ import { BuildContext, type CheckerArgs, type IgnoreMode } from '../../../../core';
3
3
  import { Overrides } from '../../../types';
4
- export declare function ignorePlugin(context: BuildContext, _: Overrides): IgnorePlugin;
4
+ /**
5
+ * Handles optional peer dependencies that are not installed.
6
+ *
7
+ * @see {@link file://./../../../../vite/plugins/ignore-modules-plugin.ts} for the vite counterpart.
8
+ *
9
+ * 'throw' mode: returns false from beforeResolve, mirroring webpack's built-in IgnorePlugin.
10
+ * Webpack emits a `webpackMissingModule()` IIFE that throws "Cannot find module" at runtime.
11
+ * Top-level static imports of the resource crash module evaluation, and `try { require(...) }
12
+ * catch {}` patterns work as expected. This is the default for matched optional peers.
13
+ *
14
+ * 'empty' mode: rewrites the request to point at an empty physical module so the import
15
+ * resolves successfully with no exports. Required for top-level `import * as X from 'optional'`
16
+ * followed by `X.foo === undefined` detection. Opt in via
17
+ * `cli.peerDependenciesMeta["pkg"].fallback = "empty"` in the importer's package.json.
18
+ */
19
+ type Checker = (args: CheckerArgs) => IgnoreMode | false;
20
+ declare class IgnoreOptionalDependenciesPlugin {
21
+ private readonly checker;
22
+ private readonly emptyModulePath;
23
+ constructor(checker: Checker);
24
+ apply(compiler: Compiler): void;
25
+ }
26
+ export declare function ignorePlugin(context: BuildContext, _: Overrides): IgnoreOptionalDependenciesPlugin;
27
+ export {};
5
28
  //# sourceMappingURL=ignore-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ignore-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAiB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,gBAQ/D"}
1
+ {"version":3,"file":"ignore-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAiB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,WAAW,KAAK,UAAU,GAAG,KAAK,CAAC;AAEzD,cAAM,gCAAgC;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;gBAE7B,OAAO,EAAE,OAAO;IAK5B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA4B3B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,oCAE/D"}
@@ -8,18 +8,49 @@ Object.defineProperty(exports, "ignorePlugin", {
8
8
  return ignorePlugin;
9
9
  }
10
10
  });
11
- const _webpack = require("webpack");
12
11
  const _core = require("../../../../core");
13
- function ignorePlugin(context, _) {
14
- const checker = (0, _core.checkResource)(context);
15
- return new _webpack.IgnorePlugin({
16
- checkResource (resource, importer) {
17
- return checker({
18
- resource,
19
- importer
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
25
+ class IgnoreOptionalDependenciesPlugin {
26
+ apply(compiler) {
27
+ compiler.hooks.normalModuleFactory.tap('IgnoreOptionalDependenciesPlugin', (normalModuleFactory)=>{
28
+ normalModuleFactory.hooks.beforeResolve.tap('IgnoreOptionalDependenciesPlugin', (resolveData)=>{
29
+ if (!resolveData) {
30
+ return;
31
+ }
32
+ const mode = this.checker({
33
+ resource: resolveData.request,
34
+ importer: resolveData.context
35
+ });
36
+ if (mode === 'throw') {
37
+ return false;
38
+ }
39
+ if (mode === 'empty') {
40
+ resolveData.request = this.emptyModulePath; // must be a physical file
41
+ }
20
42
  });
21
- }
22
- });
43
+ });
44
+ }
45
+ constructor(checker){
46
+ _define_property(this, "checker", void 0);
47
+ _define_property(this, "emptyModulePath", void 0);
48
+ this.checker = checker;
49
+ this.emptyModulePath = require.resolve('./empty-module');
50
+ }
51
+ }
52
+ function ignorePlugin(context, _) {
53
+ return new IgnoreOptionalDependenciesPlugin((0, _core.checkResource)(context));
23
54
  }
24
55
 
25
56
  //# sourceMappingURL=ignore-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts"],"sourcesContent":["import { IgnorePlugin } from 'webpack';\nimport { BuildContext, checkResource } from '../../../../core';\nimport { Overrides } from '../../../types';\n\nexport function ignorePlugin(context: BuildContext, _: Overrides) {\n const checker = checkResource(context);\n\n return new IgnorePlugin({\n checkResource(resource: string, importer: string) {\n return checker({ resource, importer });\n },\n });\n}\n"],"names":["ignorePlugin","context","_","checker","checkResource","IgnorePlugin","resource","importer"],"mappings":";;;;+BAIgBA;;;eAAAA;;;yBAJa;sBACe;AAGrC,SAASA,aAAaC,OAAqB,EAAEC,CAAY;IAC5D,MAAMC,UAAUC,IAAAA,mBAAa,EAACH;IAE9B,OAAO,IAAII,qBAAY,CAAC;QACpBD,eAAcE,QAAgB,EAAEC,QAAgB;YAC5C,OAAOJ,QAAQ;gBAAEG;gBAAUC;YAAS;QACxC;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts"],"sourcesContent":["import { Compiler } from 'webpack';\nimport { BuildContext, type CheckerArgs, checkResource, type IgnoreMode } from '../../../../core';\nimport { Overrides } from '../../../types';\n\n/**\n * Handles optional peer dependencies that are not installed.\n *\n * @see {@link file://./../../../../vite/plugins/ignore-modules-plugin.ts} for the vite counterpart.\n *\n * 'throw' mode: returns false from beforeResolve, mirroring webpack's built-in IgnorePlugin.\n * Webpack emits a `webpackMissingModule()` IIFE that throws \"Cannot find module\" at runtime.\n * Top-level static imports of the resource crash module evaluation, and `try { require(...) }\n * catch {}` patterns work as expected. This is the default for matched optional peers.\n *\n * 'empty' mode: rewrites the request to point at an empty physical module so the import\n * resolves successfully with no exports. Required for top-level `import * as X from 'optional'`\n * followed by `X.foo === undefined` detection. Opt in via\n * `cli.peerDependenciesMeta[\"pkg\"].fallback = \"empty\"` in the importer's package.json.\n */\ntype Checker = (args: CheckerArgs) => IgnoreMode | false;\n\nclass IgnoreOptionalDependenciesPlugin {\n private readonly checker: Checker;\n private readonly emptyModulePath: string;\n\n constructor(checker: Checker) {\n this.checker = checker;\n this.emptyModulePath = require.resolve('./empty-module');\n }\n\n apply(compiler: Compiler) {\n compiler.hooks.normalModuleFactory.tap(\n 'IgnoreOptionalDependenciesPlugin',\n normalModuleFactory => {\n normalModuleFactory.hooks.beforeResolve.tap(\n 'IgnoreOptionalDependenciesPlugin',\n resolveData => {\n if (!resolveData) {\n return;\n }\n\n const mode = this.checker({\n resource: resolveData.request,\n importer: resolveData.context,\n });\n\n if (mode === 'throw') {\n return false;\n }\n\n if (mode === 'empty') {\n resolveData.request = this.emptyModulePath; // must be a physical file\n }\n }\n );\n }\n );\n }\n}\n\nexport function ignorePlugin(context: BuildContext, _: Overrides) {\n return new IgnoreOptionalDependenciesPlugin(checkResource(context));\n}\n"],"names":["ignorePlugin","IgnoreOptionalDependenciesPlugin","apply","compiler","hooks","normalModuleFactory","tap","beforeResolve","resolveData","mode","checker","resource","request","importer","context","emptyModulePath","require","resolve","_","checkResource"],"mappings":";;;;+BA4DgBA;;;eAAAA;;;sBA3D+D;;;;;;;;;;;;;;AAoB/E,MAAMC;IASFC,MAAMC,QAAkB,EAAE;QACtBA,SAASC,KAAK,CAACC,mBAAmB,CAACC,GAAG,CAClC,oCACAD,CAAAA;YACIA,oBAAoBD,KAAK,CAACG,aAAa,CAACD,GAAG,CACvC,oCACAE,CAAAA;gBACI,IAAI,CAACA,aAAa;oBACd;gBACJ;gBAEA,MAAMC,OAAO,IAAI,CAACC,OAAO,CAAC;oBACtBC,UAAUH,YAAYI,OAAO;oBAC7BC,UAAUL,YAAYM,OAAO;gBACjC;gBAEA,IAAIL,SAAS,SAAS;oBAClB,OAAO;gBACX;gBAEA,IAAIA,SAAS,SAAS;oBAClBD,YAAYI,OAAO,GAAG,IAAI,CAACG,eAAe,EAAE,0BAA0B;gBAC1E;YACJ;QAER;IAER;IAhCA,YAAYL,OAAgB,CAAE;QAH9B,uBAAiBA,WAAjB,KAAA;QACA,uBAAiBK,mBAAjB,KAAA;QAGI,IAAI,CAACL,OAAO,GAAGA;QACf,IAAI,CAACK,eAAe,GAAGC,QAAQC,OAAO,CAAC;IAC3C;AA8BJ;AAEO,SAASjB,aAAac,OAAqB,EAAEI,CAAY;IAC5D,OAAO,IAAIjB,iCAAiCkB,IAAAA,mBAAa,EAACL;AAC9D"}
@@ -2,6 +2,7 @@ export * from './assets-manifest-plugin';
2
2
  export * from './bundle-analyser-plugin';
3
3
  export * from './define-exposed-dependencies-plugin';
4
4
  export * from './define-exposed-instance-dependencies-plugin';
5
+ export * from './define-process-env-plugin';
5
6
  export * from './define-web-component-name-plugin';
6
7
  export * from './filter-warnings-plugin';
7
8
  export * from './html-plugin';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
@@ -6,6 +6,7 @@ _export_star(require("./assets-manifest-plugin"), exports);
6
6
  _export_star(require("./bundle-analyser-plugin"), exports);
7
7
  _export_star(require("./define-exposed-dependencies-plugin"), exports);
8
8
  _export_star(require("./define-exposed-instance-dependencies-plugin"), exports);
9
+ _export_star(require("./define-process-env-plugin"), exports);
9
10
  _export_star(require("./define-web-component-name-plugin"), exports);
10
11
  _export_star(require("./filter-warnings-plugin"), exports);
11
12
  _export_star(require("./html-plugin"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/webpack/configs/plugins/index.ts"],"sourcesContent":["export * from './assets-manifest-plugin';\nexport * from './bundle-analyser-plugin';\nexport * from './define-exposed-dependencies-plugin';\nexport * from './define-exposed-instance-dependencies-plugin';\nexport * from './define-web-component-name-plugin';\nexport * from './filter-warnings-plugin';\nexport * from './html-plugin';\nexport * from './html-tags-plugin';\nexport * from './ignore-plugin';\nexport * from './mini-css-extract-plugin';\nexport * from './moment-locales-plugin';\nexport * from './remove-empty-scripts-plugin';\nexport * from './virtual-modules-plugin';\nexport * from './watch-run-plugin';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../../../src/webpack/configs/plugins/index.ts"],"sourcesContent":["export * from './assets-manifest-plugin';\nexport * from './bundle-analyser-plugin';\nexport * from './define-exposed-dependencies-plugin';\nexport * from './define-exposed-instance-dependencies-plugin';\nexport * from './define-process-env-plugin';\nexport * from './define-web-component-name-plugin';\nexport * from './filter-warnings-plugin';\nexport * from './html-plugin';\nexport * from './html-tags-plugin';\nexport * from './ignore-plugin';\nexport * from './mini-css-extract-plugin';\nexport * from './moment-locales-plugin';\nexport * from './remove-empty-scripts-plugin';\nexport * from './virtual-modules-plugin';\nexport * from './watch-run-plugin';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"moment-locales-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/moment-locales-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,uDAOzE"}
1
+ {"version":3,"file":"moment-locales-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/moment-locales-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,uDAOzE"}
@@ -8,14 +8,11 @@ Object.defineProperty(exports, "momentLocalesPlugin", {
8
8
  return momentLocalesPlugin;
9
9
  }
10
10
  });
11
+ const _core = require("../../../core");
11
12
  const MomentLocalesPlugin = isMomentInstalled() ? require('moment-locales-webpack-plugin') : undefined;
12
13
  function momentLocalesPlugin(_, _overrides) {
13
14
  return MomentLocalesPlugin && new MomentLocalesPlugin({
14
- localesToKeep: [
15
- 'en-au',
16
- 'en-ca',
17
- 'en-gb'
18
- ]
15
+ localesToKeep: _core.MOMENT_LOCALES
19
16
  });
20
17
  }
21
18
  function isMomentInstalled() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/webpack/configs/plugins/moment-locales-plugin.ts"],"sourcesContent":["import { BuildContext } from '../../../core';\nimport { Overrides } from '../../types';\n\nconst MomentLocalesPlugin: typeof import('moment-locales-webpack-plugin') | undefined =\n isMomentInstalled() ? require('moment-locales-webpack-plugin') : undefined;\n\nexport function momentLocalesPlugin(_: BuildContext, _overrides: Overrides) {\n return (\n MomentLocalesPlugin &&\n new MomentLocalesPlugin({\n localesToKeep: ['en-au', 'en-ca', 'en-gb'],\n })\n );\n}\n\nfunction isMomentInstalled() {\n try {\n return !!require.resolve('moment');\n } catch {\n return false;\n }\n}\n"],"names":["momentLocalesPlugin","MomentLocalesPlugin","isMomentInstalled","require","undefined","_","_overrides","localesToKeep","resolve"],"mappings":";;;;+BAMgBA;;;eAAAA;;;AAHhB,MAAMC,sBACFC,sBAAsBC,QAAQ,mCAAmCC;AAE9D,SAASJ,oBAAoBK,CAAe,EAAEC,UAAqB;IACtE,OACIL,uBACA,IAAIA,oBAAoB;QACpBM,eAAe;YAAC;YAAS;YAAS;SAAQ;IAC9C;AAER;AAEA,SAASL;IACL,IAAI;QACA,OAAO,CAAC,CAACC,QAAQK,OAAO,CAAC;IAC7B,EAAE,eAAM;QACJ,OAAO;IACX;AACJ"}
1
+ {"version":3,"sources":["../../../../src/webpack/configs/plugins/moment-locales-plugin.ts"],"sourcesContent":["import { BuildContext, MOMENT_LOCALES } from '../../../core';\nimport { Overrides } from '../../types';\n\nconst MomentLocalesPlugin: typeof import('moment-locales-webpack-plugin') | undefined =\n isMomentInstalled() ? require('moment-locales-webpack-plugin') : undefined;\n\nexport function momentLocalesPlugin(_: BuildContext, _overrides: Overrides) {\n return (\n MomentLocalesPlugin &&\n new MomentLocalesPlugin({\n localesToKeep: MOMENT_LOCALES,\n })\n );\n}\n\nfunction isMomentInstalled() {\n try {\n return !!require.resolve('moment');\n } catch {\n return false;\n }\n}\n"],"names":["momentLocalesPlugin","MomentLocalesPlugin","isMomentInstalled","require","undefined","_","_overrides","localesToKeep","MOMENT_LOCALES","resolve"],"mappings":";;;;+BAMgBA;;;eAAAA;;;sBAN6B;AAG7C,MAAMC,sBACFC,sBAAsBC,QAAQ,mCAAmCC;AAE9D,SAASJ,oBAAoBK,CAAe,EAAEC,UAAqB;IACtE,OACIL,uBACA,IAAIA,oBAAoB;QACpBM,eAAeC,oBAAc;IACjC;AAER;AAEA,SAASN;IACL,IAAI;QACA,OAAO,CAAC,CAACC,QAAQM,OAAO,CAAC;IAC7B,EAAE,eAAM;QACJ,OAAO;IACX;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugins-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAmBrC,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAE7C,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAqBjF"}
1
+ {"version":3,"file":"plugins-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAoBrC,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAE7C,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAsBjF"}