@servicetitan/startup 36.4.0 → 37.0.1

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 (457) 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/commands/test/runners/vitest.d.ts.map +1 -1
  31. package/dist/cli/commands/test/runners/vitest.js +7 -1
  32. package/dist/cli/commands/test/runners/vitest.js.map +1 -1
  33. package/dist/cli/index.js +1 -1
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/cli/utils/get-bundle-command.d.ts +3 -0
  36. package/dist/cli/utils/get-bundle-command.d.ts.map +1 -0
  37. package/dist/cli/utils/get-bundle-command.js +16 -0
  38. package/dist/cli/utils/get-bundle-command.js.map +1 -0
  39. package/dist/cli/utils/get-exit-code.d.ts +12 -0
  40. package/dist/cli/utils/get-exit-code.d.ts.map +1 -0
  41. package/dist/cli/utils/get-exit-code.js +26 -0
  42. package/dist/cli/utils/get-exit-code.js.map +1 -0
  43. package/dist/cli/utils/index.d.ts +3 -0
  44. package/dist/cli/utils/index.d.ts.map +1 -1
  45. package/dist/cli/utils/index.js +3 -0
  46. package/dist/cli/utils/index.js.map +1 -1
  47. package/dist/cli/utils/resolve-bundler.d.ts +8 -0
  48. package/dist/cli/utils/resolve-bundler.d.ts.map +1 -0
  49. package/dist/cli/utils/resolve-bundler.js +24 -0
  50. package/dist/cli/utils/resolve-bundler.js.map +1 -0
  51. package/dist/core/bundle-report.d.ts +4 -0
  52. package/dist/core/bundle-report.d.ts.map +1 -0
  53. package/dist/core/bundle-report.js +43 -0
  54. package/dist/core/bundle-report.js.map +1 -0
  55. package/dist/core/check-resource/check-resource.d.ts +5 -3
  56. package/dist/core/check-resource/check-resource.d.ts.map +1 -1
  57. package/dist/core/check-resource/check-resource.js +20 -13
  58. package/dist/core/check-resource/check-resource.js.map +1 -1
  59. package/dist/core/check-resource/get-peer-dependency-meta.d.ts +11 -1
  60. package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -1
  61. package/dist/core/check-resource/get-peer-dependency-meta.js +58 -2
  62. package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -1
  63. package/dist/core/check-resource/index.d.ts +1 -1
  64. package/dist/core/check-resource/index.d.ts.map +1 -1
  65. package/dist/core/check-resource/index.js.map +1 -1
  66. package/dist/core/check-resource/is-resolvable.d.ts +7 -0
  67. package/dist/core/check-resource/is-resolvable.d.ts.map +1 -0
  68. package/dist/core/check-resource/is-resolvable.js +31 -0
  69. package/dist/core/check-resource/is-resolvable.js.map +1 -0
  70. package/dist/core/check-resource/types.d.ts +1 -0
  71. package/dist/core/check-resource/types.d.ts.map +1 -1
  72. package/dist/core/chunk-patterns.d.ts +7 -0
  73. package/dist/core/chunk-patterns.d.ts.map +1 -0
  74. package/dist/core/chunk-patterns.js +37 -0
  75. package/dist/core/chunk-patterns.js.map +1 -0
  76. package/dist/core/create-build-context.d.ts +0 -1
  77. package/dist/core/create-build-context.d.ts.map +1 -1
  78. package/dist/core/create-build-context.js +2 -2
  79. package/dist/core/create-build-context.js.map +1 -1
  80. package/dist/core/create-extension-regexp.d.ts +5 -0
  81. package/dist/core/create-extension-regexp.d.ts.map +1 -0
  82. package/dist/core/create-extension-regexp.js +45 -0
  83. package/dist/core/create-extension-regexp.js.map +1 -0
  84. package/dist/core/get-process-env.d.ts +3 -0
  85. package/dist/core/get-process-env.d.ts.map +1 -0
  86. package/dist/core/get-process-env.js +25 -0
  87. package/dist/core/get-process-env.js.map +1 -0
  88. package/dist/core/index.d.ts +8 -1
  89. package/dist/core/index.d.ts.map +1 -1
  90. package/dist/core/index.js +8 -1
  91. package/dist/core/index.js.map +1 -1
  92. package/dist/core/moment-locales.d.ts +2 -0
  93. package/dist/core/moment-locales.d.ts.map +1 -0
  94. package/dist/core/moment-locales.js +21 -0
  95. package/dist/core/moment-locales.js.map +1 -0
  96. package/dist/core/resolve-output-path.d.ts +3 -0
  97. package/dist/core/resolve-output-path.d.ts.map +1 -0
  98. package/dist/core/resolve-output-path.js +25 -0
  99. package/dist/core/resolve-output-path.js.map +1 -0
  100. package/dist/core/resolve-output-root.d.ts +3 -0
  101. package/dist/core/resolve-output-root.d.ts.map +1 -0
  102. package/dist/core/resolve-output-root.js +23 -0
  103. package/dist/core/resolve-output-root.js.map +1 -0
  104. package/dist/core/sort-shared-css.d.ts +2 -0
  105. package/dist/core/sort-shared-css.d.ts.map +1 -0
  106. package/dist/core/sort-shared-css.js +20 -0
  107. package/dist/core/sort-shared-css.js.map +1 -0
  108. package/dist/core/types.d.ts +1 -1
  109. package/dist/core/types.d.ts.map +1 -1
  110. package/dist/cypress/config/index.d.ts +1 -0
  111. package/dist/cypress/config/index.d.ts.map +1 -1
  112. package/dist/cypress/config/index.js +1 -0
  113. package/dist/cypress/config/index.js.map +1 -1
  114. package/dist/cypress/config/vite-config.d.ts +3 -0
  115. package/dist/cypress/config/vite-config.d.ts.map +1 -0
  116. package/dist/cypress/config/vite-config.js +58 -0
  117. package/dist/cypress/config/vite-config.js.map +1 -0
  118. package/dist/jest/resolver.d.ts.map +1 -1
  119. package/dist/jest/resolver.js +20 -1
  120. package/dist/jest/resolver.js.map +1 -1
  121. package/dist/storybook-config/index.d.ts +1 -0
  122. package/dist/storybook-config/index.d.ts.map +1 -1
  123. package/dist/storybook-config/index.js +1 -0
  124. package/dist/storybook-config/index.js.map +1 -1
  125. package/dist/storybook-config/vite-final.d.ts +7 -0
  126. package/dist/storybook-config/vite-final.d.ts.map +1 -0
  127. package/dist/storybook-config/vite-final.js +86 -0
  128. package/dist/storybook-config/vite-final.js.map +1 -0
  129. package/dist/utils/get-configuration.d.ts +15 -10
  130. package/dist/utils/get-configuration.d.ts.map +1 -1
  131. package/dist/utils/get-configuration.js +32 -2
  132. package/dist/utils/get-configuration.js.map +1 -1
  133. package/dist/utils/get-package-name.d.ts +2 -1
  134. package/dist/utils/get-package-name.d.ts.map +1 -1
  135. package/dist/utils/get-package-name.js +4 -2
  136. package/dist/utils/get-package-name.js.map +1 -1
  137. package/dist/utils/index.d.ts +1 -0
  138. package/dist/utils/index.d.ts.map +1 -1
  139. package/dist/utils/index.js.map +1 -1
  140. package/dist/utils/types.d.ts +2 -0
  141. package/dist/utils/types.d.ts.map +1 -0
  142. package/dist/utils/types.js +6 -0
  143. package/dist/utils/types.js.map +1 -0
  144. package/dist/utils/validate-shared-dependencies.d.ts.map +1 -1
  145. package/dist/utils/validate-shared-dependencies.js +4 -0
  146. package/dist/utils/validate-shared-dependencies.js.map +1 -1
  147. package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
  148. package/dist/vite/build-shared-dependencies.js +1 -2
  149. package/dist/vite/build-shared-dependencies.js.map +1 -1
  150. package/dist/vite/config/asset-file-names.d.ts +4 -0
  151. package/dist/vite/config/asset-file-names.d.ts.map +1 -0
  152. package/dist/vite/config/asset-file-names.js +29 -0
  153. package/dist/vite/config/asset-file-names.js.map +1 -0
  154. package/dist/vite/config/base-config.d.ts.map +1 -1
  155. package/dist/vite/config/base-config.js +67 -40
  156. package/dist/vite/config/base-config.js.map +1 -1
  157. package/dist/vite/config/code-splitting.d.ts +4 -0
  158. package/dist/vite/config/code-splitting.d.ts.map +1 -0
  159. package/dist/vite/config/code-splitting.js +48 -0
  160. package/dist/vite/config/code-splitting.js.map +1 -0
  161. package/dist/vite/config/create-css-config.d.ts +3 -0
  162. package/dist/vite/config/create-css-config.d.ts.map +1 -0
  163. package/dist/vite/config/create-css-config.js +26 -0
  164. package/dist/vite/config/create-css-config.js.map +1 -0
  165. package/dist/vite/config/create-filtering-logger.d.ts +3 -0
  166. package/dist/vite/config/create-filtering-logger.d.ts.map +1 -0
  167. package/dist/vite/config/create-filtering-logger.js +37 -0
  168. package/dist/vite/config/create-filtering-logger.js.map +1 -0
  169. package/dist/vite/config/create-vite-build-context.d.ts +2 -1
  170. package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
  171. package/dist/vite/config/create-vite-build-context.js.map +1 -1
  172. package/dist/vite/config/create-vite-config.d.ts.map +1 -1
  173. package/dist/vite/config/create-vite-config.js +30 -13
  174. package/dist/vite/config/create-vite-config.js.map +1 -1
  175. package/dist/vite/config/get-warmup-client-files.d.ts +3 -0
  176. package/dist/vite/config/get-warmup-client-files.d.ts.map +1 -0
  177. package/dist/vite/config/get-warmup-client-files.js +26 -0
  178. package/dist/vite/config/get-warmup-client-files.js.map +1 -0
  179. package/dist/vite/index.html +1 -0
  180. package/dist/vite/plugins/bundle-stat-plugin.d.ts +4 -0
  181. package/dist/vite/plugins/bundle-stat-plugin.d.ts.map +1 -0
  182. package/dist/vite/plugins/bundle-stat-plugin.js +32 -0
  183. package/dist/vite/plugins/bundle-stat-plugin.js.map +1 -0
  184. package/dist/vite/plugins/chain-source-maps-plugin.d.ts +3 -0
  185. package/dist/vite/plugins/chain-source-maps-plugin.d.ts.map +1 -0
  186. package/dist/vite/plugins/chain-source-maps-plugin.js +37 -0
  187. package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -0
  188. package/dist/vite/plugins/clean-plugin.d.ts +4 -0
  189. package/dist/vite/plugins/clean-plugin.d.ts.map +1 -0
  190. package/dist/vite/plugins/clean-plugin.js +63 -0
  191. package/dist/vite/plugins/clean-plugin.js.map +1 -0
  192. package/dist/vite/plugins/design-system-guard-plugin.d.ts +4 -0
  193. package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -0
  194. package/dist/vite/plugins/design-system-guard-plugin.js +35 -0
  195. package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -0
  196. package/dist/vite/plugins/ignore-modules-plugin.d.ts +21 -3
  197. package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
  198. package/dist/vite/plugins/ignore-modules-plugin.js +22 -8
  199. package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
  200. package/dist/vite/plugins/index.d.ts +7 -0
  201. package/dist/vite/plugins/index.d.ts.map +1 -1
  202. package/dist/vite/plugins/index.js +7 -0
  203. package/dist/vite/plugins/index.js.map +1 -1
  204. package/dist/vite/plugins/istanbul-plugin.d.ts +4 -0
  205. package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -0
  206. package/dist/vite/plugins/istanbul-plugin.js +27 -0
  207. package/dist/vite/plugins/istanbul-plugin.js.map +1 -0
  208. package/dist/vite/plugins/magic-comments-plugin/index.d.ts +2 -0
  209. package/dist/vite/plugins/magic-comments-plugin/index.d.ts.map +1 -0
  210. package/dist/vite/plugins/magic-comments-plugin/index.js +20 -0
  211. package/dist/vite/plugins/magic-comments-plugin/index.js.map +1 -0
  212. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts +4 -0
  213. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts.map +1 -0
  214. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +63 -0
  215. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -0
  216. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts +6 -0
  217. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts.map +1 -0
  218. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js +40 -0
  219. package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js.map +1 -0
  220. package/dist/vite/plugins/metadata-plugin.js +2 -2
  221. package/dist/vite/plugins/metadata-plugin.js.map +1 -1
  222. package/dist/vite/plugins/moment-locales-plugin.d.ts +5 -0
  223. package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -0
  224. package/dist/vite/plugins/moment-locales-plugin.js +50 -0
  225. package/dist/vite/plugins/moment-locales-plugin.js.map +1 -0
  226. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts +14 -0
  227. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts.map +1 -0
  228. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js +100 -0
  229. package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js.map +1 -0
  230. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts +3 -0
  231. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts.map +1 -0
  232. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js +56 -0
  233. package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js.map +1 -0
  234. package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts +2 -0
  235. package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts.map +1 -0
  236. package/dist/vite/plugins/shared-dependencies-plugin/flatten.js +19 -0
  237. package/dist/vite/plugins/shared-dependencies-plugin/flatten.js.map +1 -0
  238. package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts +2 -0
  239. package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts.map +1 -0
  240. package/dist/vite/plugins/shared-dependencies-plugin/index.js +20 -0
  241. package/dist/vite/plugins/shared-dependencies-plugin/index.js.map +1 -0
  242. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -0
  243. package/dist/vite/plugins/{shared-dependencies-plugin.js → shared-dependencies-plugin/shared-dependencies-plugin.js} +29 -107
  244. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -0
  245. package/dist/vite/plugins/utils/import-esm.d.ts +2 -0
  246. package/dist/vite/plugins/utils/import-esm.d.ts.map +1 -0
  247. package/dist/vite/plugins/utils/import-esm.js +22 -0
  248. package/dist/vite/plugins/utils/import-esm.js.map +1 -0
  249. package/dist/vite/plugins/utils/index.d.ts +3 -0
  250. package/dist/vite/plugins/utils/index.d.ts.map +1 -0
  251. package/dist/vite/plugins/utils/index.js +21 -0
  252. package/dist/vite/plugins/utils/index.js.map +1 -0
  253. package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
  254. package/dist/webpack/configs/optimization-config.js +53 -24
  255. package/dist/webpack/configs/optimization-config.js.map +1 -1
  256. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  257. package/dist/webpack/configs/output-config.js +0 -1
  258. package/dist/webpack/configs/output-config.js.map +1 -1
  259. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  260. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +11 -3
  261. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  262. package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
  263. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +2 -21
  264. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
  265. package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts +5 -0
  266. package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts.map +1 -0
  267. package/dist/webpack/configs/plugins/define-process-env-plugin.js +20 -0
  268. package/dist/webpack/configs/plugins/define-process-env-plugin.js.map +1 -0
  269. package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +1 -1
  270. package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
  271. package/dist/webpack/configs/plugins/filter-warnings-plugin.js +1 -4
  272. package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
  273. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts +2 -0
  274. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts.map +1 -0
  275. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js +11 -0
  276. package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js.map +1 -0
  277. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +26 -3
  278. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
  279. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +41 -10
  280. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  281. package/dist/webpack/configs/plugins/index.d.ts +1 -0
  282. package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
  283. package/dist/webpack/configs/plugins/index.js +1 -0
  284. package/dist/webpack/configs/plugins/index.js.map +1 -1
  285. package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
  286. package/dist/webpack/configs/plugins/moment-locales-plugin.js +2 -5
  287. package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
  288. package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
  289. package/dist/webpack/configs/plugins-config.js +1 -0
  290. package/dist/webpack/configs/plugins-config.js.map +1 -1
  291. package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
  292. package/dist/webpack/configs/rules/font-rules.js +2 -1
  293. package/dist/webpack/configs/rules/font-rules.js.map +1 -1
  294. package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
  295. package/dist/webpack/configs/rules/image-rules.js +2 -1
  296. package/dist/webpack/configs/rules/image-rules.js.map +1 -1
  297. package/dist/webpack/create-webpack-config.d.ts.map +1 -1
  298. package/dist/webpack/create-webpack-config.js +8 -3
  299. package/dist/webpack/create-webpack-config.js.map +1 -1
  300. package/dist/webpack/create-webpack-configs.d.ts.map +1 -1
  301. package/dist/webpack/create-webpack-configs.js +4 -12
  302. package/dist/webpack/create-webpack-configs.js.map +1 -1
  303. package/dist/webpack/types.d.ts +1 -1
  304. package/dist/webpack/types.d.ts.map +1 -1
  305. package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -1
  306. package/dist/webpack/utils/create-webpack-build-context.js +1 -2
  307. package/dist/webpack/utils/create-webpack-build-context.js.map +1 -1
  308. package/package.json +22 -18
  309. package/src/cli/commands/__tests__/build.test.ts +33 -5
  310. package/src/cli/commands/__tests__/bundle-vite.test.ts +50 -1
  311. package/src/cli/commands/__tests__/start.test.ts +17 -4
  312. package/src/cli/commands/build.ts +5 -6
  313. package/src/cli/commands/bundle-vite.ts +13 -0
  314. package/src/cli/commands/registry/build.ts +6 -1
  315. package/src/cli/commands/registry/command-registry.ts +0 -1
  316. package/src/cli/commands/registry/start.ts +6 -1
  317. package/src/cli/commands/review/rules/__tests__/require-compatible-typescript.test.ts +127 -0
  318. package/src/cli/commands/review/rules/index.ts +2 -0
  319. package/src/cli/commands/review/rules/require-compatible-typescript.ts +64 -0
  320. package/src/cli/commands/start.ts +4 -4
  321. package/src/cli/commands/test/runners/__tests__/vitest.test.ts +8 -1
  322. package/src/cli/commands/test/runners/vitest.ts +5 -3
  323. package/src/cli/index.ts +2 -2
  324. package/src/cli/utils/__tests__/get-bundle-command.test.ts +23 -0
  325. package/src/cli/utils/__tests__/get-exit-code.test.ts +41 -0
  326. package/src/cli/utils/__tests__/resolve-bundler.test.ts +64 -0
  327. package/src/cli/utils/get-bundle-command.ts +5 -0
  328. package/src/cli/utils/get-exit-code.ts +17 -0
  329. package/src/cli/utils/index.ts +3 -0
  330. package/src/cli/utils/resolve-bundler.ts +23 -0
  331. package/src/core/__tests__/bundle-report.test.ts +60 -0
  332. package/src/core/__tests__/create-extension-regexp.test.ts +32 -0
  333. package/src/core/__tests__/resolve-output-path.test.ts +45 -0
  334. package/src/core/__tests__/resolve-output-root.test.ts +37 -0
  335. package/src/core/__tests__/sort-shared-css.test.ts +39 -0
  336. package/src/core/bundle-report.ts +33 -0
  337. package/src/core/check-resource/__tests__/check-resource.test.ts +21 -7
  338. package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +70 -13
  339. package/src/core/check-resource/__tests__/is-resolvable.test.ts +20 -0
  340. package/src/core/check-resource/check-resource.ts +17 -16
  341. package/src/core/check-resource/get-peer-dependency-meta.ts +67 -4
  342. package/src/core/check-resource/index.ts +1 -1
  343. package/src/core/check-resource/is-resolvable.ts +19 -0
  344. package/src/core/check-resource/types.ts +2 -0
  345. package/src/core/chunk-patterns.ts +30 -0
  346. package/src/core/create-build-context.ts +2 -2
  347. package/src/core/create-extension-regexp.ts +7 -0
  348. package/src/core/get-process-env.ts +17 -0
  349. package/src/core/index.ts +8 -1
  350. package/src/core/moment-locales.ts +6 -0
  351. package/src/core/resolve-output-path.ts +10 -0
  352. package/src/core/resolve-output-root.ts +8 -0
  353. package/src/core/sort-shared-css.ts +7 -0
  354. package/src/core/types.ts +1 -1
  355. package/src/cypress/config/__tests__/vite-config.test.ts +72 -0
  356. package/src/cypress/config/index.ts +1 -0
  357. package/src/cypress/config/vite-config.ts +37 -0
  358. package/src/jest/__tests__/resolver.test.ts +42 -1
  359. package/src/jest/resolver.ts +17 -1
  360. package/src/storybook-config/__tests__/vite-final.test.ts +122 -0
  361. package/src/storybook-config/index.ts +1 -0
  362. package/src/storybook-config/vite-final.ts +65 -0
  363. package/src/utils/__tests__/get-configuration.test.ts +82 -5
  364. package/src/utils/__tests__/get-package-name.test.ts +57 -0
  365. package/src/utils/__tests__/validate-shared-dependencies.test.ts +50 -35
  366. package/src/utils/get-configuration.ts +50 -15
  367. package/src/utils/get-package-name.ts +8 -2
  368. package/src/utils/index.ts +1 -0
  369. package/src/utils/types.ts +1 -0
  370. package/src/utils/validate-shared-dependencies.ts +15 -1
  371. package/src/vite/__tests__/build-shared-dependencies.test.ts +13 -26
  372. package/src/vite/__tests__/validate-shared-dependencies.test.ts +30 -19
  373. package/src/vite/build-shared-dependencies.ts +3 -7
  374. package/src/vite/config/__tests__/asset-file-names.test.ts +40 -0
  375. package/src/vite/config/__tests__/base-config.test.ts +99 -31
  376. package/src/vite/config/__tests__/code-splitting.test.ts +34 -0
  377. package/src/vite/config/__tests__/create-css-config.test.ts +58 -0
  378. package/src/vite/config/__tests__/create-filtering-logger.test.ts +51 -0
  379. package/src/vite/config/__tests__/create-vite-build-context.test.ts +5 -2
  380. package/src/vite/config/__tests__/create-vite-config.test.ts +91 -13
  381. package/src/vite/config/__tests__/get-warmup-client-files.test.ts +20 -0
  382. package/src/vite/config/asset-file-names.ts +20 -0
  383. package/src/vite/config/base-config.ts +45 -37
  384. package/src/vite/config/code-splitting.ts +23 -0
  385. package/src/vite/config/create-css-config.ts +16 -0
  386. package/src/vite/config/create-filtering-logger.ts +34 -0
  387. package/src/vite/config/create-vite-build-context.ts +3 -5
  388. package/src/vite/config/create-vite-config.ts +45 -12
  389. package/src/vite/config/get-warmup-client-files.ts +13 -0
  390. package/src/vite/index.html +1 -0
  391. package/src/vite/plugins/__tests__/bundle-stat-plugin.test.ts +70 -0
  392. package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +58 -0
  393. package/src/vite/plugins/__tests__/clean-plugin.test.ts +121 -0
  394. package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +83 -0
  395. package/src/vite/plugins/__tests__/html-template.test.ts +6 -0
  396. package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +29 -7
  397. package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +62 -0
  398. package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +104 -0
  399. package/src/vite/plugins/bundle-stat-plugin.ts +24 -0
  400. package/src/vite/plugins/chain-source-maps-plugin.ts +26 -0
  401. package/src/vite/plugins/clean-plugin.ts +46 -0
  402. package/src/vite/plugins/design-system-guard-plugin.ts +34 -0
  403. package/src/vite/plugins/ignore-modules-plugin.ts +36 -7
  404. package/src/vite/plugins/index.ts +7 -0
  405. package/src/vite/plugins/istanbul-plugin.ts +19 -0
  406. package/src/vite/plugins/magic-comments-plugin/__tests__/magic-comments-plugin.test.ts +105 -0
  407. package/src/vite/plugins/magic-comments-plugin/__tests__/parse-magic-comments.test.ts +40 -0
  408. package/src/vite/plugins/magic-comments-plugin/index.ts +1 -0
  409. package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +63 -0
  410. package/src/vite/plugins/magic-comments-plugin/parse-magic-comments.ts +39 -0
  411. package/src/vite/plugins/metadata-plugin.ts +1 -1
  412. package/src/vite/plugins/moment-locales-plugin.ts +41 -0
  413. package/src/vite/plugins/shared-dependencies-plugin/__tests__/assemble-iife.test.ts +29 -0
  414. package/src/vite/plugins/shared-dependencies-plugin/__tests__/assert-no-dynamic-css.test.ts +113 -0
  415. package/src/vite/plugins/shared-dependencies-plugin/__tests__/flatten.test.ts +23 -0
  416. package/src/vite/plugins/{__tests__ → shared-dependencies-plugin/__tests__}/shared-dependencies-plugin.test.ts +38 -4
  417. package/src/vite/plugins/shared-dependencies-plugin/assemble-iife.ts +114 -0
  418. package/src/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.ts +58 -0
  419. package/src/vite/plugins/shared-dependencies-plugin/flatten.ts +8 -0
  420. package/src/vite/plugins/shared-dependencies-plugin/index.ts +1 -0
  421. package/src/vite/plugins/{shared-dependencies-plugin.ts → shared-dependencies-plugin/shared-dependencies-plugin.ts} +24 -115
  422. package/src/vite/plugins/utils/import-esm.ts +15 -0
  423. package/src/vite/plugins/utils/index.ts +2 -0
  424. package/src/vite/rolldown-oxc.d.ts +20 -0
  425. package/src/webpack/__tests__/bundle-webpack.test.ts +8 -8
  426. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +54 -5
  427. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +81 -12
  428. package/src/webpack/__tests__/create-webpack-config.test.ts +92 -9
  429. package/src/webpack/configs/optimization-config.ts +47 -25
  430. package/src/webpack/configs/output-config.ts +1 -2
  431. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +16 -4
  432. package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +3 -25
  433. package/src/webpack/configs/plugins/define-process-env-plugin.ts +10 -0
  434. package/src/webpack/configs/plugins/filter-warnings-plugin.ts +1 -5
  435. package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +76 -24
  436. package/src/webpack/configs/plugins/ignore-plugin/empty-module.ts +7 -0
  437. package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +59 -9
  438. package/src/webpack/configs/plugins/index.ts +1 -0
  439. package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -2
  440. package/src/webpack/configs/plugins-config.ts +2 -0
  441. package/src/webpack/configs/rules/font-rules.ts +2 -2
  442. package/src/webpack/configs/rules/image-rules.ts +2 -2
  443. package/src/webpack/create-webpack-config.ts +11 -4
  444. package/src/webpack/create-webpack-configs.ts +2 -8
  445. package/src/webpack/types.ts +1 -4
  446. package/src/webpack/utils/create-webpack-build-context.ts +1 -6
  447. package/tsconfig/base.json +1 -1
  448. package/tsconfig/types.d.ts +10 -0
  449. package/dist/core/get-output-path.d.ts +0 -3
  450. package/dist/core/get-output-path.d.ts.map +0 -1
  451. package/dist/core/get-output-path.js +0 -29
  452. package/dist/core/get-output-path.js.map +0 -1
  453. package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +0 -1
  454. package/dist/vite/plugins/shared-dependencies-plugin.js.map +0 -1
  455. package/src/core/__tests__/get-output-path.test.ts +0 -64
  456. package/src/core/get-output-path.ts +0 -15
  457. /package/dist/vite/plugins/{shared-dependencies-plugin.d.ts → shared-dependencies-plugin/shared-dependencies-plugin.d.ts} +0 -0
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "viteConfig", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return viteConfig;
9
+ }
10
+ });
11
+ const _vite = require("vite");
12
+ const _createcssconfig = require("../../vite/config/create-css-config");
13
+ const _plugins = require("../../vite/plugins");
14
+ /*
15
+ * Dedupe and pre-bundle React so component tests load a single React instance.
16
+ * Mirrors how viteFinal handles Storybook, where automatic discovery can miss
17
+ * React in monorepos.
18
+ */ const REACT_DEDUPE = [
19
+ 'react',
20
+ 'react-dom'
21
+ ];
22
+ const REACT_OPTIMIZE = [
23
+ ...REACT_DEDUPE,
24
+ 'react/jsx-runtime'
25
+ ];
26
+ function viteConfig(overrides) {
27
+ const context = getContext();
28
+ const config = {
29
+ css: (0, _createcssconfig.createCssConfig)(false),
30
+ resolve: {
31
+ dedupe: REACT_DEDUPE
32
+ },
33
+ optimizeDeps: {
34
+ include: REACT_OPTIMIZE
35
+ },
36
+ plugins: [
37
+ (0, _plugins.svgrPlugin)(context),
38
+ (0, _plugins.istanbulPlugin)(context)
39
+ ]
40
+ };
41
+ return (0, _vite.mergeConfig)(config, overrides !== null && overrides !== void 0 ? overrides : {});
42
+ }
43
+ function getContext() {
44
+ /*
45
+ * svgrPlugin reads bundlerConfig.pluginOverrides and istanbulPlugin reads
46
+ * options.codeCoverage, so a minimal context reuses both. Component tests
47
+ * always instrument for coverage, matching the webpack Cypress config.
48
+ */ return {
49
+ options: {
50
+ codeCoverage: true
51
+ },
52
+ bundlerConfig: {
53
+ pluginOverrides: {}
54
+ }
55
+ };
56
+ }
57
+
58
+ //# sourceMappingURL=vite-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cypress/config/vite-config.ts"],"sourcesContent":["import { type InlineConfig, mergeConfig } from 'vite';\nimport { createCssConfig } from '../../vite/config/create-css-config';\nimport { istanbulPlugin, svgrPlugin } from '../../vite/plugins';\nimport type { ViteBuildContext } from '../../vite/types';\n\n/*\n * Dedupe and pre-bundle React so component tests load a single React instance.\n * Mirrors how viteFinal handles Storybook, where automatic discovery can miss\n * React in monorepos.\n */\nconst REACT_DEDUPE = ['react', 'react-dom'];\nconst REACT_OPTIMIZE = [...REACT_DEDUPE, 'react/jsx-runtime'];\n\nexport function viteConfig(overrides?: InlineConfig): InlineConfig {\n const context = getContext();\n\n const config: InlineConfig = {\n css: createCssConfig(false),\n resolve: { dedupe: REACT_DEDUPE },\n optimizeDeps: { include: REACT_OPTIMIZE },\n plugins: [svgrPlugin(context), istanbulPlugin(context)],\n };\n\n return mergeConfig(config, overrides ?? {});\n}\n\nfunction getContext(): ViteBuildContext {\n /*\n * svgrPlugin reads bundlerConfig.pluginOverrides and istanbulPlugin reads\n * options.codeCoverage, so a minimal context reuses both. Component tests\n * always instrument for coverage, matching the webpack Cypress config.\n */\n return {\n options: { codeCoverage: true },\n bundlerConfig: { pluginOverrides: {} },\n } as ViteBuildContext;\n}\n"],"names":["viteConfig","REACT_DEDUPE","REACT_OPTIMIZE","overrides","context","getContext","config","css","createCssConfig","resolve","dedupe","optimizeDeps","include","plugins","svgrPlugin","istanbulPlugin","mergeConfig","options","codeCoverage","bundlerConfig","pluginOverrides"],"mappings":";;;;+BAagBA;;;eAAAA;;;sBAb+B;iCACf;yBACW;AAG3C;;;;CAIC,GACD,MAAMC,eAAe;IAAC;IAAS;CAAY;AAC3C,MAAMC,iBAAiB;OAAID;IAAc;CAAoB;AAEtD,SAASD,WAAWG,SAAwB;IAC/C,MAAMC,UAAUC;IAEhB,MAAMC,SAAuB;QACzBC,KAAKC,IAAAA,gCAAe,EAAC;QACrBC,SAAS;YAAEC,QAAQT;QAAa;QAChCU,cAAc;YAAEC,SAASV;QAAe;QACxCW,SAAS;YAACC,IAAAA,mBAAU,EAACV;YAAUW,IAAAA,uBAAc,EAACX;SAAS;IAC3D;IAEA,OAAOY,IAAAA,iBAAW,EAACV,QAAQH,sBAAAA,uBAAAA,YAAa,CAAC;AAC7C;AAEA,SAASE;IACL;;;;KAIC,GACD,OAAO;QACHY,SAAS;YAAEC,cAAc;QAAK;QAC9BC,eAAe;YAAEC,iBAAiB,CAAC;QAAE;IACzC;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/jest/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,QAAA,MAAM,QAAQ,EAAE,YAGf,CAAC;AAEF,SAAS,QAAQ,CAAC"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/jest/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMjD,QAAA,MAAM,QAAQ,EAAE,YAgBf,CAAC;AAEF,SAAS,QAAQ,CAAC"}
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ const _checkresource = require("../core/check-resource");
2
3
  const _transformsvg = require("../utils/transform-svg");
4
+ const EMPTY_MODULE_PATH = require.resolve('../webpack/configs/plugins/ignore-plugin/empty-module');
3
5
  const resolver = (path, options)=>{
4
6
  var _ref;
5
7
  var _SVG_PATH_REGEX_exec;
6
8
  const { type, path: pathSansType } = (_ref = (_SVG_PATH_REGEX_exec = _transformsvg.SVG_PATH_REGEX.exec(path)) === null || _SVG_PATH_REGEX_exec === void 0 ? void 0 : _SVG_PATH_REGEX_exec.groups) !== null && _ref !== void 0 ? _ref : {};
7
- return options.defaultResolver(type ? pathSansType : path, options);
9
+ const resolvedPath = type ? pathSansType : path;
10
+ try {
11
+ return options.defaultResolver(resolvedPath, options);
12
+ } catch (error) {
13
+ var _options_basedir;
14
+ const mode = (0, _checkresource.checkResource)({
15
+ package: {
16
+ dependencies: {}
17
+ }
18
+ })({
19
+ resource: resolvedPath,
20
+ importer: (_options_basedir = options.basedir) !== null && _options_basedir !== void 0 ? _options_basedir : ''
21
+ });
22
+ if (mode === 'empty') {
23
+ return EMPTY_MODULE_PATH;
24
+ }
25
+ throw error;
26
+ }
8
27
  };
9
28
  module.exports = resolver;
10
29
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jest/resolver.ts"],"sourcesContent":["import type { SyncResolver } from 'jest-resolve';\nimport { SVG_PATH_REGEX } from '../utils/transform-svg';\n\nconst resolver: SyncResolver = (path, options) => {\n const { type, path: pathSansType } = SVG_PATH_REGEX.exec(path)?.groups ?? {};\n return options.defaultResolver(type ? pathSansType : path, options);\n};\n\nexport = resolver;\n"],"names":["resolver","path","options","SVG_PATH_REGEX","type","pathSansType","exec","groups","defaultResolver"],"mappings":";8BAC+B;AAE/B,MAAMA,WAAyB,CAACC,MAAMC;;QACGC;IAArC,MAAM,EAAEC,IAAI,EAAEH,MAAMI,YAAY,EAAE,YAAGF,uBAAAA,4BAAc,CAACG,IAAI,CAACL,mBAApBE,2CAAAA,qBAA2BI,MAAM,uCAAI,CAAC;IAC3E,OAAOL,QAAQM,eAAe,CAACJ,OAAOC,eAAeJ,MAAMC;AAC/D;iBAESF"}
1
+ {"version":3,"sources":["../../src/jest/resolver.ts"],"sourcesContent":["import type { SyncResolver } from 'jest-resolve';\nimport { checkResource } from '../core/check-resource';\nimport { SVG_PATH_REGEX } from '../utils/transform-svg';\n\nconst EMPTY_MODULE_PATH = require.resolve('../webpack/configs/plugins/ignore-plugin/empty-module');\n\nconst resolver: SyncResolver = (path, options) => {\n const { type, path: pathSansType } = SVG_PATH_REGEX.exec(path)?.groups ?? {};\n const resolvedPath = type ? pathSansType : path;\n\n try {\n return options.defaultResolver(resolvedPath, options);\n } catch (error) {\n const mode = checkResource({ package: { dependencies: {} } })({\n resource: resolvedPath,\n importer: options.basedir ?? '',\n });\n if (mode === 'empty') {\n return EMPTY_MODULE_PATH;\n }\n throw error;\n }\n};\n\nexport = resolver;\n"],"names":["EMPTY_MODULE_PATH","require","resolve","resolver","path","options","SVG_PATH_REGEX","type","pathSansType","exec","groups","resolvedPath","defaultResolver","error","mode","checkResource","package","dependencies","resource","importer","basedir"],"mappings":";+BAC8B;8BACC;AAE/B,MAAMA,oBAAoBC,QAAQC,OAAO,CAAC;AAE1C,MAAMC,WAAyB,CAACC,MAAMC;;QACGC;IAArC,MAAM,EAAEC,IAAI,EAAEH,MAAMI,YAAY,EAAE,YAAGF,uBAAAA,4BAAc,CAACG,IAAI,CAACL,mBAApBE,2CAAAA,qBAA2BI,MAAM,uCAAI,CAAC;IAC3E,MAAMC,eAAeJ,OAAOC,eAAeJ;IAE3C,IAAI;QACA,OAAOC,QAAQO,eAAe,CAACD,cAAcN;IACjD,EAAE,OAAOQ,OAAO;YAGER;QAFd,MAAMS,OAAOC,IAAAA,4BAAa,EAAC;YAAEC,SAAS;gBAAEC,cAAc,CAAC;YAAE;QAAE,GAAG;YAC1DC,UAAUP;YACVQ,QAAQ,GAAEd,mBAAAA,QAAQe,OAAO,cAAff,8BAAAA,mBAAmB;QACjC;QACA,IAAIS,SAAS,SAAS;YAClB,OAAOd;QACX;QACA,MAAMa;IACV;AACJ;iBAESV"}
@@ -1,3 +1,4 @@
1
1
  export * from './swc';
2
+ export * from './vite-final';
2
3
  export * from './webpack-final';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storybook-config/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storybook-config/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  _export_star(require("./swc"), exports);
6
+ _export_star(require("./vite-final"), exports);
6
7
  _export_star(require("./webpack-final"), exports);
7
8
  function _export_star(from, to) {
8
9
  Object.keys(from).forEach(function(k) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/storybook-config/index.ts"],"sourcesContent":["export * from './swc';\nexport * from './webpack-final';\n"],"names":[],"mappings":";;;;qBAAc;qBACA"}
1
+ {"version":3,"sources":["../../src/storybook-config/index.ts"],"sourcesContent":["export * from './swc';\nexport * from './vite-final';\nexport * from './webpack-final';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA"}
@@ -0,0 +1,7 @@
1
+ import type { InlineConfig } from 'vite';
2
+ interface ViteFinalOptions {
3
+ configType?: 'DEVELOPMENT' | 'PRODUCTION';
4
+ }
5
+ export declare function viteFinal(config: InlineConfig, { configType }?: ViteFinalOptions): InlineConfig;
6
+ export {};
7
+ //# sourceMappingURL=vite-final.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-final.d.ts","sourceRoot":"","sources":["../../src/storybook-config/vite-final.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAMzC,UAAU,gBAAgB;IAKtB,UAAU,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CAC7C;AAUD,wBAAgB,SAAS,CACrB,MAAM,EAAE,YAAY,EACpB,EAAE,UAAU,EAAE,GAAE,gBAAqB,GACtC,YAAY,CA8Bd"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "viteFinal", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return viteFinal;
9
+ }
10
+ });
11
+ const _nodeutil = require("node:util");
12
+ const _utils = require("../utils");
13
+ const _createcssconfig = require("../vite/config/create-css-config");
14
+ const _svgrplugin = require("../vite/plugins/svgr-plugin");
15
+ /*
16
+ * Pre-bundle and dedupe React so the Storybook preview loads a single React
17
+ * instance. Storybook leaves this to Vite's automatic discovery, which can miss
18
+ * React in monorepos.
19
+ */ const REACT_DEDUPE = [
20
+ 'react',
21
+ 'react-dom'
22
+ ];
23
+ const REACT_OPTIMIZE = [
24
+ ...REACT_DEDUPE,
25
+ 'react/jsx-runtime'
26
+ ];
27
+ function viteFinal(config, { configType } = {}) {
28
+ var _ref, _ref1, _config_plugins;
29
+ var _config_css, _config_resolve, _config_optimizeDeps;
30
+ const isProduction = configType === 'PRODUCTION';
31
+ const css = (0, _createcssconfig.createCssConfig)(isProduction);
32
+ const plugins = [
33
+ (0, _svgrplugin.svgrPlugin)(getContext())
34
+ ];
35
+ const merged = {
36
+ ...config,
37
+ css: {
38
+ ...config.css,
39
+ modules: css.modules,
40
+ preprocessorOptions: {
41
+ ...(_config_css = config.css) === null || _config_css === void 0 ? void 0 : _config_css.preprocessorOptions,
42
+ ...css.preprocessorOptions
43
+ }
44
+ },
45
+ resolve: {
46
+ ...config.resolve,
47
+ dedupe: [
48
+ ...new Set([
49
+ ...(_ref = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref !== void 0 ? _ref : [],
50
+ ...REACT_DEDUPE
51
+ ])
52
+ ]
53
+ },
54
+ optimizeDeps: {
55
+ ...config.optimizeDeps,
56
+ include: [
57
+ ...new Set([
58
+ ...(_ref1 = (_config_optimizeDeps = config.optimizeDeps) === null || _config_optimizeDeps === void 0 ? void 0 : _config_optimizeDeps.include) !== null && _ref1 !== void 0 ? _ref1 : [],
59
+ ...REACT_OPTIMIZE
60
+ ])
61
+ ]
62
+ },
63
+ plugins: [
64
+ ...(_config_plugins = config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [],
65
+ ...plugins
66
+ ]
67
+ };
68
+ /* istanbul ignore next: debug only */ _utils.log.debug('storybook-config:vite-final', ()=>(0, _nodeutil.inspect)({
69
+ merged
70
+ }, {
71
+ depth: null
72
+ }));
73
+ return merged;
74
+ }
75
+ function getContext() {
76
+ /*
77
+ * svgrPlugin only reads bundlerConfig.pluginOverrides, so a minimal context
78
+ * is enough to reuse it with startup's default SVG include patterns.
79
+ */ return {
80
+ bundlerConfig: {
81
+ pluginOverrides: {}
82
+ }
83
+ };
84
+ }
85
+
86
+ //# sourceMappingURL=vite-final.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/storybook-config/vite-final.ts"],"sourcesContent":["import { inspect } from 'node:util';\nimport type { InlineConfig } from 'vite';\nimport { log } from '../utils';\nimport { createCssConfig } from '../vite/config/create-css-config';\nimport { svgrPlugin } from '../vite/plugins/svgr-plugin';\nimport type { ViteBuildContext } from '../vite/types';\n\ninterface ViteFinalOptions {\n /*\n * Storybook signals the build type through `configType`, not Vite's\n * `config.mode` (which Storybook's Vite builder leaves unset).\n */\n configType?: 'DEVELOPMENT' | 'PRODUCTION';\n}\n\n/*\n * Pre-bundle and dedupe React so the Storybook preview loads a single React\n * instance. Storybook leaves this to Vite's automatic discovery, which can miss\n * React in monorepos.\n */\nconst REACT_DEDUPE = ['react', 'react-dom'];\nconst REACT_OPTIMIZE = [...REACT_DEDUPE, 'react/jsx-runtime'];\n\nexport function viteFinal(\n config: InlineConfig,\n { configType }: ViteFinalOptions = {}\n): InlineConfig {\n const isProduction = configType === 'PRODUCTION';\n const css = createCssConfig(isProduction);\n const plugins = [svgrPlugin(getContext())];\n\n const merged: InlineConfig = {\n ...config,\n css: {\n ...config.css,\n modules: css.modules,\n preprocessorOptions: {\n ...config.css?.preprocessorOptions,\n ...css.preprocessorOptions,\n },\n },\n resolve: {\n ...config.resolve,\n dedupe: [...new Set([...(config.resolve?.dedupe ?? []), ...REACT_DEDUPE])],\n },\n optimizeDeps: {\n ...config.optimizeDeps,\n include: [...new Set([...(config.optimizeDeps?.include ?? []), ...REACT_OPTIMIZE])],\n },\n plugins: [...(config.plugins ?? []), ...plugins],\n };\n\n /* istanbul ignore next: debug only */\n log.debug('storybook-config:vite-final', () => inspect({ merged }, { depth: null }));\n\n return merged;\n}\n\nfunction getContext(): ViteBuildContext {\n /*\n * svgrPlugin only reads bundlerConfig.pluginOverrides, so a minimal context\n * is enough to reuse it with startup's default SVG include patterns.\n */\n return { bundlerConfig: { pluginOverrides: {} } } as ViteBuildContext;\n}\n"],"names":["viteFinal","REACT_DEDUPE","REACT_OPTIMIZE","config","configType","isProduction","css","createCssConfig","plugins","svgrPlugin","getContext","merged","modules","preprocessorOptions","resolve","dedupe","Set","optimizeDeps","include","log","debug","inspect","depth","bundlerConfig","pluginOverrides"],"mappings":";;;;+BAuBgBA;;;eAAAA;;;0BAvBQ;uBAEJ;iCACY;4BACL;AAW3B;;;;CAIC,GACD,MAAMC,eAAe;IAAC;IAAS;CAAY;AAC3C,MAAMC,iBAAiB;OAAID;IAAc;CAAoB;AAEtD,SAASD,UACZG,MAAoB,EACpB,EAAEC,UAAU,EAAoB,GAAG,CAAC,CAAC;qBAwBnBD;QAZHA,aAMkBA,iBAICA;IApBlC,MAAME,eAAeD,eAAe;IACpC,MAAME,MAAMC,IAAAA,gCAAe,EAACF;IAC5B,MAAMG,UAAU;QAACC,IAAAA,sBAAU,EAACC;KAAc;IAE1C,MAAMC,SAAuB;QACzB,GAAGR,MAAM;QACTG,KAAK;YACD,GAAGH,OAAOG,GAAG;YACbM,SAASN,IAAIM,OAAO;YACpBC,qBAAqB;oBACdV,cAAAA,OAAOG,GAAG,cAAVH,kCAAAA,YAAYU,mBAAmB,AAAlC;gBACA,GAAGP,IAAIO,mBAAmB;YAC9B;QACJ;QACAC,SAAS;YACL,GAAGX,OAAOW,OAAO;YACjBC,QAAQ;mBAAI,IAAIC,IAAI;gCAAKb,kBAAAA,OAAOW,OAAO,cAAdX,sCAAAA,gBAAgBY,MAAM,uCAAI,EAAE;uBAAMd;iBAAa;aAAE;QAC9E;QACAgB,cAAc;YACV,GAAGd,OAAOc,YAAY;YACtBC,SAAS;mBAAI,IAAIF,IAAI;iCAAKb,uBAAAA,OAAOc,YAAY,cAAnBd,2CAAAA,qBAAqBe,OAAO,yCAAI,EAAE;uBAAMhB;iBAAe;aAAE;QACvF;QACAM,SAAS;gBAAKL,kBAAAA,OAAOK,OAAO,cAAdL,6BAAAA,kBAAkB,EAAE;eAAMK;SAAQ;IACpD;IAEA,oCAAoC,GACpCW,UAAG,CAACC,KAAK,CAAC,+BAA+B,IAAMC,IAAAA,iBAAO,EAAC;YAAEV;QAAO,GAAG;YAAEW,OAAO;QAAK;IAEjF,OAAOX;AACX;AAEA,SAASD;IACL;;;KAGC,GACD,OAAO;QAAEa,eAAe;YAAEC,iBAAiB,CAAC;QAAE;IAAE;AACpD"}
@@ -1,13 +1,15 @@
1
- import { Config } from '@jest/types';
2
- import { swcDir } from '@swc/cli';
3
- import { ESLint } from 'eslint';
4
- import { LinterOptions } from 'stylelint';
5
- import svgr from 'vite-plugin-svgr';
6
- import { ViteUserConfig } from 'vitest/config';
7
- import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
8
- import { ReviewConfiguration } from '../cli/commands/review';
1
+ import type { Config } from '@jest/types';
2
+ import type { swcDir } from '@swc/cli';
3
+ import type { ESLint } from 'eslint';
4
+ import type { LinterOptions } from 'stylelint';
5
+ import type svgr from 'vite-plugin-svgr';
6
+ import type { ViteUserConfig } from 'vitest/config';
7
+ import type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
8
+ import type { ReviewConfiguration } from '../cli/commands/review';
9
+ import { LocationOrJson } from './types';
9
10
  type VitePluginSvgrOptions = NonNullable<Parameters<typeof svgr>[0]>;
10
11
  type ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;
12
+ export type Bundler = 'vite' | 'webpack';
11
13
  export declare const allowedWebpackDevServerOptions: readonly ["headers", "port", "proxy", "static"];
12
14
  export interface MinifyJSOptions {
13
15
  compress?: boolean;
@@ -44,7 +46,6 @@ export interface NodeConfiguration {
44
46
  }
45
47
  export declare enum CommandName {
46
48
  'build' = "build",
47
- 'bundle-package' = "bundle-package",
48
49
  'bundle-vite' = "bundle-vite",
49
50
  'bundle-webpack' = "bundle-webpack",
50
51
  'clean' = "clean",
@@ -96,6 +97,7 @@ export interface ViteBundlerConfig {
96
97
  }
97
98
  export interface VitePackageJsonOverride extends ViteBundlerConfig {
98
99
  config?: Omit<import('vite').UserConfig, 'plugins'>;
100
+ devServer?: false;
99
101
  }
100
102
  export interface WebComponentBranchConfigs {
101
103
  publishTag?: string;
@@ -110,6 +112,7 @@ interface WebComponentOptions {
110
112
  branches?: Record<string, WebComponentBranchConfigs>;
111
113
  }
112
114
  type Configuration = {
115
+ 'bundler'?: Bundler;
113
116
  'jest'?: JestConfiguration;
114
117
  'legacy'?: boolean;
115
118
  'lint'?: {
@@ -120,6 +123,7 @@ type Configuration = {
120
123
  'swc-compile-package'?: Parameters<typeof swcDir>[0];
121
124
  'test'?: JestConfiguration;
122
125
  'testRunner'?: string;
126
+ 'expose-process-env'?: string[];
123
127
  'expose-shared-dependencies'?: boolean;
124
128
  'shared-dependencies'?: Record<string, string>;
125
129
  'vite'?: false | VitePackageJsonOverride;
@@ -129,13 +133,13 @@ type Configuration = {
129
133
  } & {
130
134
  [key in CommandName]?: NodeConfiguration;
131
135
  } & NodeConfiguration;
132
- type LocationOrJson = string | Record<string, any>;
133
136
  export declare function getConfiguration(locationOrJson?: LocationOrJson): Configuration;
134
137
  export declare function getConfigurationSafe(locationOrJson?: LocationOrJson): Configuration;
135
138
  export declare function getESLintConfiguration(): ESLintConfiguration;
136
139
  export declare function getJestConfiguration(): JestConfiguration;
137
140
  export declare function getReviewConfiguration(): ReviewConfiguration & NodeConfiguration;
138
141
  export declare function getStylelintConfiguration(): StylelintConfiguration;
142
+ export declare function getExposeProcessEnv(): string[];
139
143
  export declare function getViteConfiguration(): VitePackageJsonOverride;
140
144
  export declare function getVitestConfiguration(): import("vitest/node").InlineConfig & {
141
145
  omitDefault?: string[];
@@ -147,6 +151,7 @@ export declare function hasHeadlessBundle(): boolean;
147
151
  export declare function getSwcCompilePackageConfiguration(): import("@swc/cli").Options;
148
152
  export declare function isBundle(locationOrJson?: LocationOrJson): boolean;
149
153
  export declare function isDevServerDisabled(): boolean;
154
+ export declare function isViteDevServerDisabled(): boolean;
150
155
  export declare function isExposeSharedDependencies(): boolean;
151
156
  export declare function isLegacy(locationOrJson?: LocationOrJson): boolean;
152
157
  export declare function isLegacyRoot(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,KAAK,qBAAqB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAErE,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,WAAW,CAAC,EAAE,GAAG,WAAW,GAAG,KAAK,CAAC;AAErF,eAAO,MAAM,8BAA8B,iDAAkD,CAAC;AAE9F,MAAM,WAAW,eAAe;IAC5B,QAAQ,C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kBA5GpB,MAAM,EAAE;EA8GzB;AAED,wBAAgB,uBAAuB,CAAC,cAAc,CAAC,EAAE,cAAc,wBAGtE;AAED,wBAAgB,4BAA4B,CACxC,cAAc,GAAE,cAAqB,GACtC,mBAAmB,GAAG,SAAS,CAsBjC;AAED,wBAAgB,4BAA4B,CAAC,cAAc,GAAE,cAAqB,yDAIjF;AAED,wBAAgB,iBAAiB,YAShC;AAED,wBAAgB,iCAAiC,+BAEhD;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAIvD;AAED,wBAAgB,mBAAmB,YAGlC;AAED,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,0BAA0B,YAKzC;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,YAAY,YAE3B;AAED,wBAAgB,oBAAoB,YAEnC;AAED,wBAAgB,cAAc,CAAC,cAAc,GAAE,cAAqB,WAEnE"}
@@ -24,6 +24,9 @@ _export(exports, {
24
24
  get getESLintConfiguration () {
25
25
  return getESLintConfiguration;
26
26
  },
27
+ get getExposeProcessEnv () {
28
+ return getExposeProcessEnv;
29
+ },
27
30
  get getJestConfiguration () {
28
31
  return getJestConfiguration;
29
32
  },
@@ -72,6 +75,9 @@ _export(exports, {
72
75
  get isStyleCheckDisabled () {
73
76
  return isStyleCheckDisabled;
74
77
  },
78
+ get isViteDevServerDisabled () {
79
+ return isViteDevServerDisabled;
80
+ },
75
81
  get isWebComponent () {
76
82
  return isWebComponent;
77
83
  }
@@ -79,6 +85,7 @@ _export(exports, {
79
85
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
80
86
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
81
87
  const _getfolders = require("./get-folders");
88
+ const _getpackagename = require("./get-package-name");
82
89
  const _log = require("./log");
83
90
  const _readjson = require("./read-json");
84
91
  function _interop_require_default(obj) {
@@ -94,7 +101,6 @@ const allowedWebpackDevServerOptions = [
94
101
  ];
95
102
  var CommandName = /*#__PURE__*/ function(CommandName) {
96
103
  CommandName["build"] = "build";
97
- CommandName["bundle-package"] = "bundle-package";
98
104
  CommandName["bundle-vite"] = "bundle-vite";
99
105
  CommandName["bundle-webpack"] = "bundle-webpack";
100
106
  CommandName["clean"] = "clean";
@@ -151,6 +157,10 @@ function getStylelintConfiguration() {
151
157
  var _getConfiguration_lint;
152
158
  return (_ref = (_getConfiguration_lint = getConfiguration().lint) === null || _getConfiguration_lint === void 0 ? void 0 : _getConfiguration_lint.stylelint) !== null && _ref !== void 0 ? _ref : {};
153
159
  }
160
+ function getExposeProcessEnv() {
161
+ var _getConfiguration_exposeprocessenv;
162
+ return (_getConfiguration_exposeprocessenv = getConfiguration()['expose-process-env']) !== null && _getConfiguration_exposeprocessenv !== void 0 ? _getConfiguration_exposeprocessenv : [];
163
+ }
154
164
  function getViteConfiguration() {
155
165
  const { vite } = getConfiguration();
156
166
  return typeof vite === 'object' ? vite : {};
@@ -199,12 +209,17 @@ function getSwcCompilePackageConfiguration() {
199
209
  return (_getConfiguration_swccompilepackage = getConfiguration()['swc-compile-package']) !== null && _getConfiguration_swccompilepackage !== void 0 ? _getConfiguration_swccompilepackage : {};
200
210
  }
201
211
  function isBundle(locationOrJson) {
202
- return getConfiguration(locationOrJson).webpack !== false && getConfiguration(locationOrJson).vite !== false;
212
+ const { webpack, vite } = getConfiguration(locationOrJson);
213
+ assertBundlersAgree(webpack, vite, locationOrJson);
214
+ return webpack !== false && vite !== false;
203
215
  }
204
216
  function isDevServerDisabled() {
205
217
  const webpackConfiguration = getWebpackConfiguration();
206
218
  return webpackConfiguration.devServer === false;
207
219
  }
220
+ function isViteDevServerDisabled() {
221
+ return getViteConfiguration().devServer === false;
222
+ }
208
223
  function isExposeSharedDependencies() {
209
224
  var _getConfiguration_exposeshareddependencies;
210
225
  return ((_getConfiguration_exposeshareddependencies = getConfiguration()['expose-shared-dependencies']) !== null && _getConfiguration_exposeshareddependencies !== void 0 ? _getConfiguration_exposeshareddependencies : getWebpackConfiguration()['expose-shared-dependencies']) === true;
@@ -222,5 +237,20 @@ function isStyleCheckDisabled() {
222
237
  function isWebComponent(locationOrJson = './') {
223
238
  return !!getWebComponentConfiguration(locationOrJson);
224
239
  }
240
+ /*
241
+ * Require that Vite and Webpack configurations agree whether package is a bundle.
242
+ */ function assertBundlersAgree(webpack, vite, locationOrJson) {
243
+ if (webpack === undefined || vite === undefined || !!webpack === !!vite) {
244
+ return;
245
+ }
246
+ const mismatch = webpack === false ? {
247
+ falsy: 'cli.webpack',
248
+ truthy: 'cli.vite'
249
+ } : {
250
+ falsy: 'cli.vite',
251
+ truthy: 'cli.webpack'
252
+ };
253
+ throw new Error(`package ${(0, _getpackagename.getPackageName)(locationOrJson)} has conflicting webpack ` + `and vite configurations: ${mismatch.falsy} is false but ` + `${mismatch.truthy} is not`);
254
+ }
225
255
 
226
256
  //# sourceMappingURL=get-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport { swcDir } from '@swc/cli';\nimport { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport { LinterOptions } from 'stylelint';\nimport svgr from 'vite-plugin-svgr';\nimport { ViteUserConfig } from 'vitest/config';\nimport { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\nimport { ReviewConfiguration } from '../cli/commands/review';\nimport { getFolders } from './get-folders';\nimport { log } from './log';\nimport { readJson, readJsonSafe } from './read-json';\n\ntype VitePluginSvgrOptions = NonNullable<Parameters<typeof svgr>[0]>;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n> {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n 'shared-dependencies'?: Record<string, string>;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {\n omitDefault?: string[];\n}\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-package' = 'bundle-package',\n 'bundle-vite' = 'bundle-vite',\n 'bundle-webpack' = 'bundle-webpack',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-check' = 'mfe-check',\n 'mfe-generate-metadata' = 'mfe-generate-metadata',\n 'mfe-list' = 'mfe-list',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-package-rollback' = 'mfe-package-rollback',\n 'mfe-publish' = 'mfe-publish',\n 'mfe-purge-cache' = 'mfe-purge-cache',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'stylelint' = 'stylelint',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'] & {\n omitDefault?: string[];\n};\n\nexport interface HtmlPluginOptions {\n title?: string;\n favicon?: string;\n template?: string;\n}\n\nexport interface SvgrPluginOptions {\n include?: VitePluginSvgrOptions['include'];\n exclude?: VitePluginSvgrOptions['exclude'];\n svgrOptions?: VitePluginSvgrOptions['svgrOptions'];\n}\n\nexport interface PluginOverrides {\n html?: HtmlPluginOptions;\n svgr?: SvgrPluginOptions;\n}\n\nexport interface ViteBundlerConfig {\n port?: number;\n omitDefault?: string[];\n minify?: MinifyOptions;\n pluginOverrides?: PluginOverrides;\n}\n\nexport interface VitePackageJsonOverride extends ViteBundlerConfig {\n config?: Omit<import('vite').UserConfig, 'plugins'>;\n}\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'expose-shared-dependencies'?: boolean;\n 'shared-dependencies'?: Record<string, string>;\n 'vite'?: false | VitePackageJsonOverride;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\ntype LocationOrJson = string | Record<string, any>;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getViteConfiguration(): VitePackageJsonOverride {\n const { vite } = getConfiguration();\n return typeof vite === 'object' ? vite : {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n return (\n getConfiguration(locationOrJson).webpack !== false &&\n getConfiguration(locationOrJson).vite !== false\n );\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return (\n (getConfiguration()['expose-shared-dependencies'] ??\n getWebpackConfiguration()['expose-shared-dependencies']) === true\n );\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getViteConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vite","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","webpackConfiguration","devServer","legacy","legacyRoot"],"mappings":";;;;;;;;;;;QAiEYA;eAAAA;;QA/CCC;eAAAA;;QAgJGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QA6DAC;eAAAA;;QAzDAC;eAAAA;;QAKAC;eAAAA;;QAmCAC;eAAAA;;QA1BAC;eAAAA;;QALAC;eAAAA;;QAqCAC;eAAAA;;QAeAC;eAAAA;;QAOAC;eAAAA;;QAKAC;eAAAA;;Q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A+B;IACpD,OACIpB,iBAAiBoB,gBAAgBgB,OAAO,KAAK,SAC7CpC,iBAAiBoB,gBAAgBc,IAAI,KAAK;AAElD;AAEO,SAASpB;IACZ,MAAMoC,uBAAuBvC;IAC7B,OAAOuC,qBAAqBC,SAAS,KAAK;AAC9C;AAEO,SAASpC;QAEPf;IADL,OACI,EAACA,6CAAAA,kBAAkB,CAAC,6BAA6B,cAAhDA,wDAAAA,6CACGW,yBAAyB,CAAC,6BAA6B,MAAM;AAEzE;AAEO,SAASK,SAASI,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgBgC,MAAM,KAAK;AACvD;AAEO,SAASnC;QACLP;IAAP,OAAOA,EAAAA,gCAAAA,4CAAAA,oDAAAA,8BAAgC2C,UAAU,MAAK;AAC1D;AAEO,SAASnC;IACZ,OAAOP,yBAAyB,CAAC,sBAAsB,KAAK;AAChE;AAEO,SAASQ,eAAeC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAACV,6BAA6BU;AAC1C"}
1
+ {"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import type { Config } from '@jest/types';\nimport type { swcDir } from '@swc/cli';\nimport type { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport type { LinterOptions } from 'stylelint';\nimport type svgr from 'vite-plugin-svgr';\nimport type { ViteUserConfig } from 'vitest/config';\nimport type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\nimport type { ReviewConfiguration } from '../cli/commands/review';\nimport { getFolders } from './get-folders';\nimport { getPackageName } from './get-package-name';\nimport { log } from './log';\nimport { readJson, readJsonSafe } from './read-json';\nimport { LocationOrJson } from './types';\n\ntype VitePluginSvgrOptions = NonNullable<Parameters<typeof svgr>[0]>;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport type Bundler = 'vite' | 'webpack';\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n> {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n 'shared-dependencies'?: Record<string, string>;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {\n omitDefault?: string[];\n}\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-vite' = 'bundle-vite',\n 'bundle-webpack' = 'bundle-webpack',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-check' = 'mfe-check',\n 'mfe-generate-metadata' = 'mfe-generate-metadata',\n 'mfe-list' = 'mfe-list',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-package-rollback' = 'mfe-package-rollback',\n 'mfe-publish' = 'mfe-publish',\n 'mfe-purge-cache' = 'mfe-purge-cache',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'stylelint' = 'stylelint',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'] & {\n omitDefault?: string[];\n};\n\nexport interface HtmlPluginOptions {\n title?: string;\n favicon?: string;\n template?: string;\n}\n\nexport interface SvgrPluginOptions {\n include?: VitePluginSvgrOptions['include'];\n exclude?: VitePluginSvgrOptions['exclude'];\n svgrOptions?: VitePluginSvgrOptions['svgrOptions'];\n}\n\nexport interface PluginOverrides {\n html?: HtmlPluginOptions;\n svgr?: SvgrPluginOptions;\n}\n\nexport interface ViteBundlerConfig {\n port?: number;\n omitDefault?: string[];\n minify?: MinifyOptions;\n pluginOverrides?: PluginOverrides;\n}\n\nexport interface VitePackageJsonOverride extends ViteBundlerConfig {\n config?: Omit<import('vite').UserConfig, 'plugins'>;\n devServer?: false;\n}\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'bundler'?: Bundler;\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'expose-process-env'?: string[];\n 'expose-shared-dependencies'?: boolean;\n 'shared-dependencies'?: Record<string, string>;\n 'vite'?: false | VitePackageJsonOverride;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getExposeProcessEnv(): string[] {\n return getConfiguration()['expose-process-env'] ?? [];\n}\n\nexport function getViteConfiguration(): VitePackageJsonOverride {\n const { vite } = getConfiguration();\n return typeof vite === 'object' ? vite : {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n const { webpack, vite } = getConfiguration(locationOrJson);\n assertBundlersAgree(webpack, vite, locationOrJson);\n return webpack !== false && vite !== false;\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isViteDevServerDisabled() {\n return getViteConfiguration().devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return (\n (getConfiguration()['expose-shared-dependencies'] ??\n getWebpackConfiguration()['expose-shared-dependencies']) === true\n );\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n\n/*\n * Require that Vite and Webpack configurations agree whether package is a bundle.\n */\nfunction assertBundlersAgree(\n webpack: Configuration['webpack'],\n vite: Configuration['vite'],\n locationOrJson?: LocationOrJson\n) {\n if (webpack === undefined || vite === undefined || !!webpack === !!vite) {\n return;\n }\n\n const mismatch =\n webpack === false\n ? { falsy: 'cli.webpack', truthy: 'cli.vite' }\n : { falsy: 'cli.vite', truthy: 'cli.webpack' };\n\n throw new Error(\n `package ${getPackageName(locationOrJson)} has conflicting webpack ` +\n `and vite configurations: ${mismatch.falsy} is false but ` +\n `${mismatch.truthy} is not`\n );\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getExposeProcessEnv","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getViteConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isViteDevServerDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vite","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","assertBundlersAgree","webpackConfiguration","devServer","legacy","legacyRoot","mismatch","falsy","truthy","Error","getPackageName"],"mappings":";;;;;;;;;;;QAqEYA;eAAAA;;QA/CCC;eAAAA;;QAgJGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAiBAC;eAAAA;;QAbAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAiEAC;eAAAA;;QAzDAC;eAAAA;;QAKAC;eAAAA;;QAmCAC;eAAAA;;QA1BAC;eAAAA;;QALAC;eAAAA;;QAqCAC;eAAAA;;QAeAC;eAAAA;;QAMAC;eAAAA;;QASAC;eAAAA;;QAOAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAnBAC;eAAAA;;QAuBAC;eAAAA;;;2DAvSD;6DACE;4BAMU;gCACI;qBACX;0BACmB;;;;;;AAShC,MAAMtB,iCAAiC;IAAC;IAAW;IAAQ;IAAS;CAAS;AA+C7E,IAAA,AAAKD,qCAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAAA;;AAiGL,SAASE,iBAAiBsB,iBAAiC,IAAI;;IAClE,MAAMC,OACF,OAAOD,mBAAmB,WACpBE,IAAAA,kBAAQ,EAACC,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACnCA;IACV,eAAOC,iBAAAA,2BAAAA,KAAMI,GAAG,uCAAI,CAAC;AACzB;AAEO,SAAS1B,qBAAqBqB,iBAAiC,IAAI;;IACtE,MAAMC,OACF,OAAOD,mBAAmB,W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E;AAEO,SAASK,SAASK,cAA+B;IACpD,OAAOtB,iBAAiBsB,gBAAgBiC,MAAM,KAAK;AACvD;AAEO,SAASrC;QACLP;IAAP,OAAOA,EAAAA,gCAAAA,4CAAAA,oDAAAA,8BAAgC6C,UAAU,MAAK;AAC1D;AAEO,SAASrC;IACZ,OAAOP,yBAAyB,CAAC,sBAAsB,KAAK;AAChE;AAEO,SAASS,eAAeC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAACX,6BAA6BW;AAC1C;AAEA;;CAEC,GACD,SAAS8B,oBACLd,OAAiC,EACjCF,IAA2B,EAC3Bd,cAA+B;IAE/B,IAAIgB,YAAYS,aAAaX,SAASW,aAAa,CAAC,CAACT,YAAY,CAAC,CAACF,MAAM;QACrE;IACJ;IAEA,MAAMqB,WACFnB,YAAY,QACN;QAAEoB,OAAO;QAAeC,QAAQ;IAAW,IAC3C;QAAED,OAAO;QAAYC,QAAQ;IAAc;IAErD,MAAM,IAAIC,MACN,CAAC,QAAQ,EAAEC,IAAAA,8BAAc,EAACvC,gBAAgB,yBAAyB,CAAC,GAChE,CAAC,yBAAyB,EAAEmC,SAASC,KAAK,CAAC,cAAc,CAAC,GAC1D,GAAGD,SAASE,MAAM,CAAC,OAAO,CAAC;AAEvC"}
@@ -1,2 +1,3 @@
1
- export declare function getPackageName(location?: string): string;
1
+ import { LocationOrJson } from './types';
2
+ export declare function getPackageName(locationOrJson?: LocationOrJson): string;
2
3
  //# sourceMappingURL=get-package-name.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-package-name.d.ts","sourceRoot":"","sources":["../../src/utils/get-package-name.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,QAAQ,SAAO,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"get-package-name.d.ts","sourceRoot":"","sources":["../../src/utils/get-package-name.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,cAAc,CAAC,cAAc,GAAE,cAAqB,GAAG,MAAM,CAO5E"}
@@ -15,8 +15,10 @@ function _interop_require_default(obj) {
15
15
  default: obj
16
16
  };
17
17
  }
18
- function getPackageName(location = './') {
19
- return (0, _readjson.readJson)(_path.default.join(location, 'package.json')).name;
18
+ function getPackageName(locationOrJson = './') {
19
+ var _ref;
20
+ const json = typeof locationOrJson === 'string' ? (0, _readjson.readJson)(_path.default.join(locationOrJson, 'package.json')) : locationOrJson;
21
+ return (_ref = json === null || json === void 0 ? void 0 : json.name) !== null && _ref !== void 0 ? _ref : '';
20
22
  }
21
23
 
22
24
  //# sourceMappingURL=get-package-name.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/get-package-name.ts"],"sourcesContent":["import path from 'path';\nimport { readJson } from './read-json';\n\nexport function getPackageName(location = './'): string {\n return readJson(path.join(location, 'package.json')).name;\n}\n"],"names":["getPackageName","location","readJson","path","join","name"],"mappings":";;;;+BAGgBA;;;eAAAA;;;6DAHC;0BACQ;;;;;;AAElB,SAASA,eAAeC,WAAW,IAAI;IAC1C,OAAOC,IAAAA,kBAAQ,EAACC,aAAI,CAACC,IAAI,CAACH,UAAU,iBAAiBI,IAAI;AAC7D"}
1
+ {"version":3,"sources":["../../src/utils/get-package-name.ts"],"sourcesContent":["import path from 'path';\nimport { readJson } from './read-json';\nimport { LocationOrJson } from './types';\n\nexport function getPackageName(locationOrJson: LocationOrJson = './'): string {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n\n return json?.name ?? '';\n}\n"],"names":["getPackageName","locationOrJson","json","readJson","path","join","name"],"mappings":";;;;+BAIgBA;;;eAAAA;;;6DAJC;0BACQ;;;;;;AAGlB,SAASA,eAAeC,iBAAiC,IAAI;;IAChE,MAAMC,OACF,OAAOD,mBAAmB,WACpBE,IAAAA,kBAAQ,EAACC,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACnCA;IAEV,eAAOC,iBAAAA,2BAAAA,KAAMI,IAAI,uCAAI;AACzB"}
@@ -22,5 +22,6 @@ export * from './pick';
22
22
  export * from './prettify';
23
23
  export * from './read-json';
24
24
  export * from './to-array';
25
+ export type * from './types';
25
26
  export * from './validate-shared-dependencies';
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,mBAAmB,SAAS,CAAC;AAC7B,cAAc,gCAAgC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './format-relative-date';\nexport * from './get-base-tsconfig';\nexport * from './get-branch-configs';\nexport * from './get-configuration';\nexport * from './get-default-test-excludes';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-tsconfig';\nexport * from './get-tsconfig-with-fallback';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './omit';\nexport * from './pick';\nexport * from './prettify';\nexport * from './read-json';\nexport * from './to-array';\nexport * from './validate-shared-dependencies';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './format-relative-date';\nexport * from './get-base-tsconfig';\nexport * from './get-branch-configs';\nexport * from './get-configuration';\nexport * from './get-default-test-excludes';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-tsconfig';\nexport * from './get-tsconfig-with-fallback';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './omit';\nexport * from './pick';\nexport * from './prettify';\nexport * from './read-json';\nexport * from './to-array';\nexport type * from './types';\nexport * from './validate-shared-dependencies';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBAEA"}
@@ -0,0 +1,2 @@
1
+ export type LocationOrJson = string | Record<string, any>;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-shared-dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/validate-shared-dependencies.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,SA6BzC"}
1
+ {"version":3,"file":"validate-shared-dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/validate-shared-dependencies.ts"],"names":[],"mappings":"AAQA,wBAAgB,0BAA0B,SAqCzC"}
@@ -9,8 +9,12 @@ Object.defineProperty(exports, "validateSharedDependencies", {
9
9
  }
10
10
  });
11
11
  const _getconfiguration = require("./get-configuration");
12
+ const _getpackagename = require("./get-package-name");
12
13
  function validateSharedDependencies() {
13
14
  const config = (0, _getconfiguration.getConfiguration)();
15
+ if ((0, _getconfiguration.isWebComponent)() && (0, _getconfiguration.isExposeSharedDependencies)()) {
16
+ throw new Error('cli.expose-shared-dependencies only applies to host applications.' + `Remove it from ${(0, _getpackagename.getPackageName)()}.`);
17
+ }
14
18
  const webpackSharedDependencies = (0, _getconfiguration.getWebpackConfiguration)()['shared-dependencies'];
15
19
  const topLevelSharedDependencies = config['shared-dependencies'];
16
20
  if (webpackSharedDependencies && topLevelSharedDependencies && JSON.stringify(webpackSharedDependencies) !== JSON.stringify(topLevelSharedDependencies)) {