@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
@@ -1,4 +1,3 @@
1
- import { IgnorePlugin } from 'webpack';
2
1
  import type { BuildContext } from '../../../../../core';
3
2
  import { checkResource } from '../../../../../core';
4
3
  import { ignorePlugin } from '../ignore-plugin';
@@ -13,54 +12,107 @@ describe(ignorePlugin.name, () => {
13
12
 
14
13
  beforeEach(() => {
15
14
  jest.clearAllMocks();
16
- context = {} as BuildContext;
15
+ context = {} as any;
17
16
  checker = jest.fn().mockReturnValue(false);
18
17
  jest.mocked(checkResource).mockReturnValue(checker);
19
18
  });
20
19
 
21
20
  const subject = () => ignorePlugin(context, {});
22
21
 
23
- test('returns an IgnorePlugin', () => {
24
- expect(subject()).toBeInstanceOf(IgnorePlugin);
25
- });
26
-
27
22
  test('creates checker from build context', () => {
28
23
  subject();
29
24
 
30
25
  expect(checkResource).toHaveBeenCalledWith(context);
31
26
  });
32
27
 
33
- describe('checkResource callback', () => {
34
- let resource: string;
35
- let importer: string;
28
+ describe('apply', () => {
29
+ let resolveData: { request: string; context: string };
30
+ let beforeResolveTap: (resolveData: any) => any;
36
31
 
37
32
  beforeEach(() => {
38
- resource = 'some-module';
39
- importer = '/app';
33
+ resolveData = { request: 'some-module', context: '/app' };
34
+
35
+ const plugin = ignorePlugin(context, {});
36
+ const mockCompiler = {
37
+ hooks: {
38
+ normalModuleFactory: {
39
+ tap: (_name: string, callback: Function) => {
40
+ callback({
41
+ hooks: {
42
+ beforeResolve: {
43
+ tap: (_name: string, cb: Function) => {
44
+ beforeResolveTap = cb as any;
45
+ },
46
+ },
47
+ },
48
+ });
49
+ },
50
+ },
51
+ },
52
+ };
53
+ plugin.apply(mockCompiler as any);
40
54
  });
41
55
 
42
- const subject = () => {
43
- const { options } = ignorePlugin(context, {});
44
- return (
45
- options as { checkResource: (resource: string, importer: string) => boolean }
46
- ).checkResource(resource, importer);
47
- };
56
+ const subject = () => beforeResolveTap(resolveData);
48
57
 
49
58
  test('checks resource against importer', () => {
50
59
  subject();
51
60
 
52
- expect(checker).toHaveBeenCalledWith({ resource, importer });
61
+ expect(checker).toHaveBeenCalledWith({
62
+ resource: resolveData.request,
63
+ importer: resolveData.context,
64
+ });
53
65
  });
54
66
 
55
- test('returns false', () => {
56
- expect(subject()).toBe(false);
67
+ test('does not replace request', () => {
68
+ const { request } = resolveData;
69
+
70
+ subject();
71
+
72
+ expect(resolveData.request).toBe(request);
57
73
  });
58
74
 
59
- describe('when checker matches the resource', () => {
60
- beforeEach(() => checker.mockReturnValue(true));
75
+ test('returns undefined', () => {
76
+ expect(subject()).toBeUndefined();
77
+ });
78
+
79
+ describe('when resolve data is falsy', () => {
80
+ beforeEach(() => (resolveData = null as any));
81
+
82
+ test('skips resource check', () => {
83
+ subject();
84
+
85
+ expect(checker).not.toHaveBeenCalled();
86
+ });
87
+ });
88
+
89
+ describe('when checker returns "throw"', () => {
90
+ beforeEach(() => checker.mockReturnValue('throw'));
91
+
92
+ test('returns false to signal ignore', () => {
93
+ expect(subject()).toBe(false);
94
+ });
95
+
96
+ test('does not replace request', () => {
97
+ const { request } = resolveData;
98
+
99
+ subject();
100
+
101
+ expect(resolveData.request).toBe(request);
102
+ });
103
+ });
104
+
105
+ describe('when checker returns "empty"', () => {
106
+ beforeEach(() => checker.mockReturnValue('empty'));
107
+
108
+ test('replaces request with empty module path', () => {
109
+ subject();
110
+
111
+ expect(resolveData.request).toBe(require.resolve('../empty-module'));
112
+ });
61
113
 
62
- test('returns true', () => {
63
- expect(subject()).toBe(true);
114
+ test('returns undefined', () => {
115
+ expect(subject()).toBeUndefined();
64
116
  });
65
117
  });
66
118
  });
@@ -0,0 +1,7 @@
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
+ */
7
+ export {};
@@ -1,13 +1,63 @@
1
- import { IgnorePlugin } from 'webpack';
2
- import { BuildContext, checkResource } from '../../../../core';
1
+ import { Compiler } from 'webpack';
2
+ import { BuildContext, type CheckerArgs, checkResource, type IgnoreMode } from '../../../../core';
3
3
  import { Overrides } from '../../../types';
4
4
 
5
- export function ignorePlugin(context: BuildContext, _: Overrides) {
6
- const checker = checkResource(context);
5
+ /**
6
+ * Handles optional peer dependencies that are not installed.
7
+ *
8
+ * @see {@link file://./../../../../vite/plugins/ignore-modules-plugin.ts} for the vite counterpart.
9
+ *
10
+ * 'throw' mode: returns false from beforeResolve, mirroring webpack's built-in IgnorePlugin.
11
+ * Webpack emits a `webpackMissingModule()` IIFE that throws "Cannot find module" at runtime.
12
+ * Top-level static imports of the resource crash module evaluation, and `try { require(...) }
13
+ * catch {}` patterns work as expected. This is the default for matched optional peers.
14
+ *
15
+ * 'empty' mode: rewrites the request to point at an empty physical module so the import
16
+ * resolves successfully with no exports. Required for top-level `import * as X from 'optional'`
17
+ * followed by `X.foo === undefined` detection. Opt in via
18
+ * `cli.peerDependenciesMeta["pkg"].fallback = "empty"` in the importer's package.json.
19
+ */
20
+ type Checker = (args: CheckerArgs) => IgnoreMode | false;
21
+
22
+ class IgnoreOptionalDependenciesPlugin {
23
+ private readonly checker: Checker;
24
+ private readonly emptyModulePath: string;
25
+
26
+ constructor(checker: Checker) {
27
+ this.checker = checker;
28
+ this.emptyModulePath = require.resolve('./empty-module');
29
+ }
30
+
31
+ apply(compiler: Compiler) {
32
+ compiler.hooks.normalModuleFactory.tap(
33
+ 'IgnoreOptionalDependenciesPlugin',
34
+ normalModuleFactory => {
35
+ normalModuleFactory.hooks.beforeResolve.tap(
36
+ 'IgnoreOptionalDependenciesPlugin',
37
+ resolveData => {
38
+ if (!resolveData) {
39
+ return;
40
+ }
41
+
42
+ const mode = this.checker({
43
+ resource: resolveData.request,
44
+ importer: resolveData.context,
45
+ });
7
46
 
8
- return new IgnorePlugin({
9
- checkResource(resource: string, importer: string) {
10
- return checker({ resource, importer });
11
- },
12
- });
47
+ if (mode === 'throw') {
48
+ return false;
49
+ }
50
+
51
+ if (mode === 'empty') {
52
+ resolveData.request = this.emptyModulePath; // must be a physical file
53
+ }
54
+ }
55
+ );
56
+ }
57
+ );
58
+ }
59
+ }
60
+
61
+ export function ignorePlugin(context: BuildContext, _: Overrides) {
62
+ return new IgnoreOptionalDependenciesPlugin(checkResource(context));
13
63
  }
@@ -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,4 +1,4 @@
1
- import { BuildContext } from '../../../core';
1
+ import { BuildContext, MOMENT_LOCALES } from '../../../core';
2
2
  import { Overrides } from '../../types';
3
3
 
4
4
  const MomentLocalesPlugin: typeof import('moment-locales-webpack-plugin') | undefined =
@@ -8,7 +8,7 @@ export function momentLocalesPlugin(_: BuildContext, _overrides: Overrides) {
8
8
  return (
9
9
  MomentLocalesPlugin &&
10
10
  new MomentLocalesPlugin({
11
- localesToKeep: ['en-au', 'en-ca', 'en-gb'],
11
+ localesToKeep: MOMENT_LOCALES,
12
12
  })
13
13
  );
14
14
  }
@@ -6,6 +6,7 @@ import {
6
6
  bundleAnalyzerPlugin,
7
7
  defineExposedDependenciesPlugin,
8
8
  defineExposedInstanceDependenciesPlugin,
9
+ defineProcessEnvPlugin,
9
10
  defineWebComponentNamePlugin,
10
11
  filterWarningsPlugin,
11
12
  htmlPlugin,
@@ -27,6 +28,7 @@ export function pluginsConfig(context: BuildContext, overrides: Overrides): Resu
27
28
  bundleAnalyzerPlugin,
28
29
  defineExposedDependenciesPlugin,
29
30
  defineExposedInstanceDependenciesPlugin,
31
+ defineProcessEnvPlugin,
30
32
  defineWebComponentNamePlugin,
31
33
  filterWarningsPlugin,
32
34
  htmlPlugin,
@@ -1,10 +1,10 @@
1
1
  import { RuleSetRule } from 'webpack';
2
- import { BuildContext } from '../../../core';
2
+ import { BuildContext, FONT_EXTENSIONS, createExtensionRegExp } from '../../../core';
3
3
 
4
4
  export function fontRules(_: BuildContext): RuleSetRule[] {
5
5
  return [
6
6
  {
7
- test: /\.(woff|woff2|eot|ttf|otf)$/i,
7
+ test: createExtensionRegExp(FONT_EXTENSIONS),
8
8
  type: 'asset/resource',
9
9
  generator: {
10
10
  filename: 'fonts/[contenthash][ext][query]',
@@ -1,10 +1,10 @@
1
1
  import { RuleSetRule } from 'webpack';
2
- import { BuildContext } from '../../../core';
2
+ import { BuildContext, IMAGE_EXTENSIONS, createExtensionRegExp } from '../../../core';
3
3
 
4
4
  export function imageRules(_: BuildContext): RuleSetRule[] {
5
5
  return [
6
6
  {
7
- test: /\.(png|jpg|jpeg|gif)$/i,
7
+ test: createExtensionRegExp(IMAGE_EXTENSIONS),
8
8
  type: 'asset',
9
9
  generator: {
10
10
  filename: 'images/[contenthash][ext][query]',
@@ -1,6 +1,6 @@
1
1
  import { Configuration } from 'webpack';
2
2
  import { merge } from 'webpack-merge';
3
- import { stringifyConfig } from '../core';
3
+ import { resolveOutputPath, stringifyConfig } from '../core';
4
4
  import { log } from '../utils';
5
5
  import {
6
6
  amdConfig,
@@ -30,7 +30,6 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
30
30
  light: options.light,
31
31
  headless: options.headless,
32
32
  emitExposedDependencies: options.emitExposedDependencies,
33
- outputBasePath: options.outputBasePath,
34
33
  codeCoverage: options.codeCoverage,
35
34
  buildStat: options.buildStat,
36
35
  });
@@ -59,11 +58,19 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
59
58
  watchOptionsConfig,
60
59
  ];
61
60
 
62
- const result = merge(
63
- configs.reduce((result, fn) => ({ ...result, ...fn(context, overrides) }), {}),
61
+ const merged = merge(
62
+ configs.reduce<Configuration>(
63
+ (result, fn) => ({ ...result, ...fn(context, overrides) }),
64
+ {}
65
+ ),
64
66
  overrides.configuration ?? {}
65
67
  );
66
68
 
69
+ // Resolve the output path: web components force the default, hosts honor a configured path.
70
+ const result = merge(merged, {
71
+ output: { path: resolveOutputPath(context, merged.output?.path) },
72
+ });
73
+
67
74
  /* istanbul ignore next: debug only */
68
75
  log.debug('create-webpack-config', () => stringifyConfig(result));
69
76
 
@@ -58,16 +58,10 @@ export function createWebpackConfigs(options: {
58
58
  return { full: customConfig };
59
59
  }
60
60
 
61
- /*
62
- * outputBasePath is wired only here, for the shared-deps build. MFE main
63
- * bundles (handled above) must publish under <package>/dist/bundle/<subdir>,
64
- * so a custom output.path from the user's webpack config is not honored
65
- * for them.
66
- */
67
61
  return {
68
62
  full: createWebpackConfig(
69
- { configuration: { mode } },
70
- { ...resolved, outputBasePath: customConfig?.output?.path }
63
+ { configuration: { mode, output: customConfig?.output } },
64
+ resolved
71
65
  ),
72
66
  };
73
67
  }
@@ -5,10 +5,7 @@ import { BuildContext, BuildIdentity, BuildOptions } from '../core';
5
5
  import { WebpackConfiguration } from '../utils';
6
6
 
7
7
  export type Options = Partial<
8
- Pick<
9
- BuildIdentity,
10
- 'name' | 'light' | 'headless' | 'emitExposedDependencies' | 'outputBasePath'
11
- > &
8
+ Pick<BuildIdentity, 'name' | 'light' | 'headless' | 'emitExposedDependencies'> &
12
9
  Pick<BuildOptions, 'codeCoverage' | 'buildStat'>
13
10
  >;
14
11
 
@@ -3,10 +3,5 @@ import { getWebpackConfiguration } from '../../utils';
3
3
  import { WebpackBuildContext } from '../types';
4
4
 
5
5
  export function createWebpackBuildContext(options: BuildContextOptions): WebpackBuildContext {
6
- const context = createBuildContext(options);
7
-
8
- return {
9
- ...context,
10
- bundlerConfig: getWebpackConfiguration(),
11
- };
6
+ return { ...createBuildContext(options), bundlerConfig: getWebpackConfiguration() };
12
7
  }
@@ -6,11 +6,11 @@
6
6
  "module": "esnext",
7
7
  "moduleResolution": "Bundler",
8
8
  "lib": ["dom", "dom.iterable", "esnext"],
9
+ "types": ["node", "jest"],
9
10
  "jsx": "react-jsx",
10
11
  "declaration": true,
11
12
  "declarationMap": true,
12
13
  "sourceMap": true,
13
- "strict": true,
14
14
  "strictFunctionTypes": false,
15
15
  "esModuleInterop": true,
16
16
  "experimentalDecorators": true,
@@ -22,3 +22,13 @@ declare module '@servicetitan/anvil2/*.svg' {
22
22
  const ReactComponent: SvgComponent;
23
23
  export default ReactComponent;
24
24
  }
25
+
26
+ declare module '*.less' {
27
+ const content: string;
28
+ export default content;
29
+ }
30
+
31
+ declare module '*.css' {
32
+ const content: string;
33
+ export default content;
34
+ }
@@ -1,3 +0,0 @@
1
- import { BuildContext } from './types';
2
- export declare function getOutputPath(context: BuildContext): string;
3
- //# sourceMappingURL=get-output-path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-output-path.d.ts","sourceRoot":"","sources":["../../src/core/get-output-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,UAUlD"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getOutputPath", {
6
- enumerable: true,
7
- get: function() {
8
- return getOutputPath;
9
- }
10
- });
11
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
- const _getbundletype = require("./get-bundle-type");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
- function getOutputPath(context) {
19
- var _getBundleType;
20
- const { destination } = context.package;
21
- const { outputBasePath } = context.build;
22
- const subdir = (_getBundleType = (0, _getbundletype.getBundleType)(context)) !== null && _getBundleType !== void 0 ? _getBundleType : '';
23
- if (outputBasePath) {
24
- return _path.default.join(outputBasePath, subdir);
25
- }
26
- return _path.default.join(process.cwd(), destination, 'bundle', subdir);
27
- }
28
-
29
- //# sourceMappingURL=get-output-path.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/get-output-path.ts"],"sourcesContent":["import path from 'path';\nimport { getBundleType } from './get-bundle-type';\nimport { BuildContext } from './types';\n\nexport function getOutputPath(context: BuildContext) {\n const { destination } = context.package;\n const { outputBasePath } = context.build;\n const subdir = getBundleType(context) ?? '';\n\n if (outputBasePath) {\n return path.join(outputBasePath, subdir);\n }\n\n return path.join(process.cwd(), destination, 'bundle', subdir);\n}\n"],"names":["getOutputPath","context","getBundleType","destination","package","outputBasePath","build","subdir","path","join","process","cwd"],"mappings":";;;;+BAIgBA;;;eAAAA;;;6DAJC;+BACa;;;;;;AAGvB,SAASA,cAAcC,OAAqB;QAGhCC;IAFf,MAAM,EAAEC,WAAW,EAAE,GAAGF,QAAQG,OAAO;IACvC,MAAM,EAAEC,cAAc,EAAE,GAAGJ,QAAQK,KAAK;IACxC,MAAMC,UAASL,iBAAAA,IAAAA,4BAAa,EAACD,sBAAdC,4BAAAA,iBAA0B;IAEzC,IAAIG,gBAAgB;QAChB,OAAOG,aAAI,CAACC,IAAI,CAACJ,gBAAgBE;IACrC;IAEA,OAAOC,aAAI,CAACC,IAAI,CAACC,QAAQC,GAAG,IAAIR,aAAa,UAAUI;AAC3D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-dependencies-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/shared-dependencies-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAY9B,MAAM,WAAW,+BAA+B;IAC5C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD,wBAAgB,wBAAwB,CAAC,EACrC,YAAY,EACZ,GAAG,EACH,WAAW,GACd,EAAE,+BAA+B,GAAG,MAAM,CAgK1C"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/shared-dependencies-plugin.ts"],"sourcesContent":["import crypto from 'crypto';\nimport path from 'path';\nimport { Plugin } from 'vite';\nimport { bundleConstants, generateExposedDependenciesMetadata } from '../../core';\n\n/*\n * Replaces `/` with `-` so scoped packages stay flat in Rolldown output.\n * Without this, `@scope/foo` emits into a subdirectory and its require()\n * calls use `../` paths that don't match the IIFE's flat module keys.\n */\nfunction flatName(dep: string) {\n return dep.replace('/', '-');\n}\n\nexport interface SharedDependenciesPluginOptions {\n dependencies: Record<string, string>;\n css?: Record<string, string[]>;\n metadataDir?: string;\n}\n\nfunction indent(spaces: number) {\n return ' '.repeat(spaces);\n}\n\nexport function sharedDependenciesPlugin({\n dependencies,\n css,\n metadataDir,\n}: SharedDependenciesPluginOptions): Plugin {\n const CSS_VIRTUAL_PREFIX = '\\0SHARED_DEPENDENCY_CSS';\n\n const dependencyNames = Object.keys(dependencies);\n const dependencySet = new Set(dependencyNames);\n const cssEntries = css ?? {};\n const cssInputNames = Object.keys(cssEntries);\n let isProduction = false;\n\n return {\n name: 'shared-dependencies',\n enforce: 'pre',\n\n config(_, env) {\n isProduction = env.mode === bundleConstants.mode.production;\n\n const input: Record<string, string> = {};\n for (const dependency of dependencyNames) {\n input[flatName(dependency)] = dependency;\n }\n for (const name of cssInputNames) {\n input[name] = CSS_VIRTUAL_PREFIX + name;\n }\n\n return {\n // Relative base so CSS font URLs resolve from the CSS file's directory, not site root\n base: './',\n // Must match host build mode — mismatch causes react-dom/client usingClientEntryPoint errors\n define: {\n 'process.env.NODE_ENV': JSON.stringify(env.mode),\n },\n build: {\n rolldownOptions: {\n // Vite defaults to false which strips all CJS exports from entry chunks\n preserveEntrySignatures: 'exports-only',\n input,\n output: {\n /*\n * CJS format + named exports: the factory system wraps each entry's\n * code in function(module, exports, require) { ... }\n */\n format: 'cjs',\n exports: 'named',\n entryFileNames: '[name].cjs.js',\n chunkFileNames: '_[name]-[hash].js',\n assetFileNames: assetInfo => {\n const rawName = assetInfo.names?.[0] ?? '';\n const ext = rawName.split('.').pop() ?? '';\n // Strip scope prefix added by flatName (e.g. @servicetitan-anvil2 → anvil2)\n const name = rawName\n .replace(/^@[^-]+-/, '')\n .replace(/\\.[^.]+$/, '');\n if (ext === 'css') {\n return isProduction\n ? `${name}.[hash].bundle[extname]`\n : `${name}.bundle[extname]`;\n }\n return isProduction\n ? `${name}.[hash][extname]`\n : `${name}[extname]`;\n },\n },\n // Disabled: we don't know which exports MFEs will use at runtime\n treeshake: false,\n },\n },\n };\n },\n\n resolveId(source: string, importer: string | undefined) {\n if (source.startsWith(CSS_VIRTUAL_PREFIX)) {\n return source;\n }\n if (!importer) {\n return;\n }\n if (dependencySet.has(source)) {\n return { id: source, external: true };\n }\n },\n\n load(id: string) {\n if (!id.startsWith(CSS_VIRTUAL_PREFIX)) {\n return;\n }\n const name = id.slice(CSS_VIRTUAL_PREFIX.length);\n const imports = cssEntries[name];\n if (!imports) {\n return;\n }\n return imports.map(p => `import '${p}';`).join('\\n');\n },\n\n generateBundle(_options, bundle) {\n const factories: string[] = [];\n const exposes: string[] = [];\n\n for (const [fileName, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') {\n continue;\n }\n if (!chunk.isEntry) {\n factories.push(\n `'./${fileName}': function(module, exports, require) {\\n${indent(12)}${chunk.code}\\n${indent(8)}}`\n );\n delete bundle[fileName];\n }\n }\n\n for (const [dependency, variable] of Object.entries(dependencies)) {\n const entryFileName = `${flatName(dependency)}.cjs.js`;\n const chunk = bundle[entryFileName];\n if (chunk?.type !== 'chunk') {\n throw new Error(\n `Expected entry chunk for ${dependency}, got type: ${chunk?.type ?? 'undefined'}`\n );\n }\n factories.push(\n `'${dependency}': function(module, exports, require) {\\n${indent(12)}${chunk.code}\\n${indent(8)}}`\n );\n exposes.push(`expose('${variable}', '${dependency}');`);\n delete bundle[entryFileName];\n }\n\n for (const name of cssInputNames) {\n delete bundle[`${name}.cjs.js`];\n }\n\n const code = assembleIIFE(factories, exposes);\n const hash = crypto.createHash('md5').update(code).digest('hex').slice(0, 20);\n const sharedFileName = isProduction ? `shared.${hash}.bundle.js` : 'shared.bundle.js';\n\n this.emitFile({\n type: 'asset',\n fileName: sharedFileName,\n source: code,\n });\n\n const cssFiles = Object.keys(bundle).filter(f => f.endsWith('.bundle.css'));\n const entrypoints = { css: cssFiles, js: [sharedFileName] };\n this.emitFile({\n type: 'asset',\n fileName: 'entrypoints.json',\n source: JSON.stringify(entrypoints, null, 2),\n });\n },\n\n writeBundle: metadataDir\n ? options => {\n /*\n * dir is always set when build.outDir is configured (our case).\n * Rolldown types it as optional, but falling back to '' would\n * silently resolve to cwd — better to crash than write wrong metadata.\n */\n generateExposedDependenciesMetadata(metadataDir, () =>\n path.resolve(options.dir!, 'entrypoints.json')\n );\n }\n : undefined,\n };\n}\n\nfunction assembleIIFE(factories: string[], exposes: string[]): string {\n return `\\\n(function () {\n const STORAGE_KEY = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');\n const g = globalThis;\n\n if (g[STORAGE_KEY] === undefined) {\n g[STORAGE_KEY] = Object.assign(Object.create(null), {\n clear(scope) {\n delete this[scope];\n },\n });\n }\n\n var storage = g[STORAGE_KEY];\n\n var modules = {\n ${factories.join(`,\\n${indent(8)}`)}\n };\n\n function createScopedRequire(scope) {\n const cache = (storage[scope] = storage[scope] || Object.create(null));\n\n function require(id) {\n if (cache[id]) {\n return cache[id].exports;\n }\n if (!modules[id]) {\n throw new Error('Module not found: ' + id);\n }\n\n const module = (cache[id] = { id, loaded: false, exports: {} });\n modules[id](module, module.exports, require);\n module.loaded = true;\n\n const keys = Object.keys(module.exports);\n if (module.exports.__esModule && keys.length === 1 && keys[0] === 'default') {\n module.exports = module.exports.default;\n }\n\n return module.exports;\n }\n\n Object.setPrototypeOf(require, {\n resolve(id) {\n return id;\n },\n });\n return require;\n }\n\n function expose(path, moduleId) {\n const parts = path.split('.');\n let obj = g;\n\n for (let i = 0; i < parts.length - 1; i++) {\n if (obj[parts[i]] === undefined) {\n obj[parts[i]] = Object.create(null);\n }\n obj = obj[parts[i]];\n }\n\n obj[parts[parts.length - 1]] = new Proxy(\n Object.assign(Object.create(null), {\n getStorage() {\n return storage;\n },\n }),\n {\n get(target, scope, receiver) {\n if (scope === 'getStorage') {\n return Reflect.get(target, scope, receiver);\n }\n return createScopedRequire(scope)(moduleId);\n },\n }\n );\n }\n\n ${exposes.join(`\\n${indent(4)}`)}\n})();\n`;\n}\n"],"names":["sharedDependenciesPlugin","flatName","dep","replace","indent","spaces","repeat","dependencies","css","metadataDir","CSS_VIRTUAL_PREFIX","dependencyNames","Object","keys","dependencySet","Set","cssEntries","cssInputNames","isProduction","name","enforce","config","_","env","mode","bundleConstants","production","input","dependency","base","define","JSON","stringify","build","rolldownOptions","preserveEntrySignatures","output","format","exports","entryFileNames","chunkFileNames","assetFileNames","assetInfo","rawName","names","ext","split","pop","treeshake","resolveId","source","importer","startsWith","has","id","external","load","slice","length","imports","map","p","join","generateBundle","_options","bundle","factories","exposes","fileName","chunk","entries","type","isEntry","push","code","variable","entryFileName","Error","assembleIIFE","hash","crypto","createHash","update","digest","sharedFileName","emitFile","cssFiles","filter","f","endsWith","entrypoints","js","writeBundle","options","generateExposedDependenciesMetadata","path","resolve","dir","undefined"],"mappings":"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"}
@@ -1,64 +0,0 @@
1
- import path from 'path';
2
- import { getBundleType } from '../get-bundle-type';
3
- import { getOutputPath } from '../get-output-path';
4
- import { BuildContext } from '../types';
5
-
6
- jest.mock('../get-bundle-type', () => ({
7
- getBundleType: jest.fn(),
8
- }));
9
-
10
- describe(`[startup] ${getOutputPath.name}`, () => {
11
- const destination = 'dist';
12
- let context: BuildContext;
13
-
14
- beforeEach(() => {
15
- jest.clearAllMocks();
16
- context = {
17
- build: {},
18
- package: { destination },
19
- } as BuildContext;
20
- jest.mocked(getBundleType).mockReturnValue(undefined);
21
- });
22
-
23
- const subject = () => getOutputPath(context);
24
-
25
- test('returns default path under cwd', () => {
26
- expect(subject()).toBe(path.join(process.cwd(), destination, 'bundle'));
27
- });
28
-
29
- describe('when getBundleType returns a subdir', () => {
30
- const subdir = 'full';
31
-
32
- beforeEach(() => {
33
- jest.mocked(getBundleType).mockReturnValue(subdir);
34
- });
35
-
36
- test('appends subdir to default path', () => {
37
- expect(subject()).toBe(path.join(process.cwd(), destination, 'bundle', subdir));
38
- });
39
- });
40
-
41
- describe('when outputBasePath is set', () => {
42
- const outputBasePath = '/custom/out';
43
-
44
- beforeEach(() => {
45
- context.build.outputBasePath = outputBasePath;
46
- });
47
-
48
- test('uses outputBasePath as base', () => {
49
- expect(subject()).toBe(path.normalize(outputBasePath));
50
- });
51
-
52
- describe('with a subdir from getBundleType', () => {
53
- const subdir = 'shared';
54
-
55
- beforeEach(() => {
56
- jest.mocked(getBundleType).mockReturnValue(subdir);
57
- });
58
-
59
- test('appends subdir to outputBasePath', () => {
60
- expect(subject()).toBe(path.join(outputBasePath, subdir));
61
- });
62
- });
63
- });
64
- });
@@ -1,15 +0,0 @@
1
- import path from 'path';
2
- import { getBundleType } from './get-bundle-type';
3
- import { BuildContext } from './types';
4
-
5
- export function getOutputPath(context: BuildContext) {
6
- const { destination } = context.package;
7
- const { outputBasePath } = context.build;
8
- const subdir = getBundleType(context) ?? '';
9
-
10
- if (outputBasePath) {
11
- return path.join(outputBasePath, subdir);
12
- }
13
-
14
- return path.join(process.cwd(), destination, 'bundle', subdir);
15
- }