@servicetitan/startup 37.0.2 → 38.1.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 (433) hide show
  1. package/bin/js-yaml.js +2 -2
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +22 -9
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-package.d.ts +6 -0
  6. package/dist/cli/commands/bundle-package.d.ts.map +1 -0
  7. package/dist/cli/commands/bundle-package.js +59 -0
  8. package/dist/cli/commands/bundle-package.js.map +1 -0
  9. package/dist/cli/commands/bundle-vite.js +13 -4
  10. package/dist/cli/commands/bundle-vite.js.map +1 -1
  11. package/dist/cli/commands/bundle-webpack.js +13 -4
  12. package/dist/cli/commands/bundle-webpack.js.map +1 -1
  13. package/dist/cli/commands/clean.js +13 -4
  14. package/dist/cli/commands/clean.js.map +1 -1
  15. package/dist/cli/commands/command.d.ts +9 -0
  16. package/dist/cli/commands/command.d.ts.map +1 -0
  17. package/dist/cli/commands/command.js +35 -0
  18. package/dist/cli/commands/command.js.map +1 -0
  19. package/dist/cli/commands/convert-eslint-config.js +14 -7
  20. package/dist/cli/commands/convert-eslint-config.js.map +1 -1
  21. package/dist/cli/commands/eslint.js +13 -4
  22. package/dist/cli/commands/eslint.js.map +1 -1
  23. package/dist/cli/commands/init.js +13 -4
  24. package/dist/cli/commands/init.js.map +1 -1
  25. package/dist/cli/commands/install.js +13 -4
  26. package/dist/cli/commands/install.js.map +1 -1
  27. package/dist/cli/commands/kendo-ui-license.js +13 -4
  28. package/dist/cli/commands/kendo-ui-license.js.map +1 -1
  29. package/dist/cli/commands/lint.js +13 -4
  30. package/dist/cli/commands/lint.js.map +1 -1
  31. package/dist/cli/commands/mfe-check.d.ts.map +1 -1
  32. package/dist/cli/commands/mfe-check.js +15 -7
  33. package/dist/cli/commands/mfe-check.js.map +1 -1
  34. package/dist/cli/commands/mfe-generate-metadata.js +13 -4
  35. package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
  36. package/dist/cli/commands/mfe-list.js +13 -4
  37. package/dist/cli/commands/mfe-list.js.map +1 -1
  38. package/dist/cli/commands/mfe-package-clean.js +13 -4
  39. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  40. package/dist/cli/commands/mfe-package-publish.js +13 -4
  41. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  42. package/dist/cli/commands/mfe-package-rollback.js +13 -4
  43. package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
  44. package/dist/cli/commands/mfe-publish.js +13 -4
  45. package/dist/cli/commands/mfe-publish.js.map +1 -1
  46. package/dist/cli/commands/mfe-purge-cache.js +13 -4
  47. package/dist/cli/commands/mfe-purge-cache.js.map +1 -1
  48. package/dist/cli/commands/prepare-package.js +13 -4
  49. package/dist/cli/commands/prepare-package.js.map +1 -1
  50. package/dist/cli/commands/registry/build.d.ts +1 -1
  51. package/dist/cli/commands/registry/build.d.ts.map +1 -1
  52. package/dist/cli/commands/registry/build.js +3 -5
  53. package/dist/cli/commands/registry/build.js.map +1 -1
  54. package/dist/cli/commands/registry/bundle-package.d.ts +41 -0
  55. package/dist/cli/commands/registry/bundle-package.d.ts.map +1 -0
  56. package/dist/cli/commands/registry/bundle-package.js +54 -0
  57. package/dist/cli/commands/registry/bundle-package.js.map +1 -0
  58. package/dist/cli/commands/registry/command-registry.d.ts +42 -2
  59. package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
  60. package/dist/cli/commands/registry/command-registry.js +10 -19
  61. package/dist/cli/commands/registry/command-registry.js.map +1 -1
  62. package/dist/cli/commands/registry/start.d.ts +1 -1
  63. package/dist/cli/commands/registry/start.d.ts.map +1 -1
  64. package/dist/cli/commands/registry/start.js +3 -5
  65. package/dist/cli/commands/registry/start.js.map +1 -1
  66. package/dist/cli/commands/review/review.js +14 -7
  67. package/dist/cli/commands/review/review.js.map +1 -1
  68. package/dist/cli/commands/review/rules/no-deprecated-content-base.js +1 -3
  69. package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
  70. package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js +1 -3
  71. package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js.map +1 -1
  72. package/dist/cli/commands/review/rules/no-typescript-entry-point.js +1 -3
  73. package/dist/cli/commands/review/rules/no-typescript-entry-point.js.map +1 -1
  74. package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js +5 -12
  75. package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
  76. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +5 -12
  77. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
  78. package/dist/cli/commands/review/rules/require-explicit-side-effects.js +1 -3
  79. package/dist/cli/commands/review/rules/require-explicit-side-effects.js.map +1 -1
  80. package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -3
  81. package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
  82. package/dist/cli/commands/review/rules/require-servicetitan-scope.js +1 -3
  83. package/dist/cli/commands/review/rules/require-servicetitan-scope.js.map +1 -1
  84. package/dist/cli/commands/review/rules/require-tsconfig-references.js +1 -3
  85. package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -1
  86. package/dist/cli/commands/review/types.d.ts.map +1 -1
  87. package/dist/cli/commands/review/types.js.map +1 -1
  88. package/dist/cli/commands/review/utils/compare-version.js +8 -19
  89. package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
  90. package/dist/cli/commands/run-task.d.ts +1 -0
  91. package/dist/cli/commands/run-task.d.ts.map +1 -1
  92. package/dist/cli/commands/run-task.js +20 -6
  93. package/dist/cli/commands/run-task.js.map +1 -1
  94. package/dist/cli/commands/start.d.ts.map +1 -1
  95. package/dist/cli/commands/start.js +28 -13
  96. package/dist/cli/commands/start.js.map +1 -1
  97. package/dist/cli/commands/stylelint.js +13 -4
  98. package/dist/cli/commands/stylelint.js.map +1 -1
  99. package/dist/cli/commands/styles-check.js +13 -4
  100. package/dist/cli/commands/styles-check.js.map +1 -1
  101. package/dist/cli/commands/test/runners/jest.js +1 -3
  102. package/dist/cli/commands/test/runners/jest.js.map +1 -1
  103. package/dist/cli/commands/test/tests.js +13 -4
  104. package/dist/cli/commands/test/tests.js.map +1 -1
  105. package/dist/cli/commands/types.d.ts +1 -6
  106. package/dist/cli/commands/types.d.ts.map +1 -1
  107. package/dist/cli/commands/types.js +2 -20
  108. package/dist/cli/commands/types.js.map +1 -1
  109. package/dist/cli/commands/upload-sourcemaps.js +17 -13
  110. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  111. package/dist/cli/index.js +1 -0
  112. package/dist/cli/index.js.map +1 -1
  113. package/dist/cli/tasks/cli-task.d.ts +3 -0
  114. package/dist/cli/tasks/cli-task.d.ts.map +1 -1
  115. package/dist/cli/tasks/cli-task.js +41 -9
  116. package/dist/cli/tasks/cli-task.js.map +1 -1
  117. package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts +9 -1
  118. package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts.map +1 -1
  119. package/dist/cli/tasks/swc-compile-package/get-swc-options.js +18 -2
  120. package/dist/cli/tasks/swc-compile-package/get-swc-options.js.map +1 -1
  121. package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts +3 -1
  122. package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts.map +1 -1
  123. package/dist/cli/tasks/swc-compile-package/swc-compile-package.js +17 -3
  124. package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
  125. package/dist/cli/tasks/task.d.ts +2 -1
  126. package/dist/cli/tasks/task.d.ts.map +1 -1
  127. package/dist/cli/tasks/task.js +6 -3
  128. package/dist/cli/tasks/task.js.map +1 -1
  129. package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -3
  130. package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
  131. package/dist/cli/utils/cli-npm.d.ts.map +1 -1
  132. package/dist/cli/utils/cli-npm.js +8 -1
  133. package/dist/cli/utils/cli-npm.js.map +1 -1
  134. package/dist/cli/utils/cli-os.d.ts +1 -0
  135. package/dist/cli/utils/cli-os.d.ts.map +1 -1
  136. package/dist/cli/utils/cli-os.js +20 -0
  137. package/dist/cli/utils/cli-os.js.map +1 -1
  138. package/dist/cli/utils/compile.d.ts.map +1 -1
  139. package/dist/cli/utils/compile.js +7 -4
  140. package/dist/cli/utils/compile.js.map +1 -1
  141. package/dist/cli/utils/copy-files.js +1 -0
  142. package/dist/cli/utils/copy-files.js.map +1 -1
  143. package/dist/cli/utils/index.d.ts +1 -1
  144. package/dist/cli/utils/index.d.ts.map +1 -1
  145. package/dist/cli/utils/index.js +1 -1
  146. package/dist/cli/utils/index.js.map +1 -1
  147. package/dist/cli/utils/process-tree.js +2 -6
  148. package/dist/cli/utils/process-tree.js.map +1 -1
  149. package/dist/cli/utils/resolve-bundler.d.ts.map +1 -1
  150. package/dist/cli/utils/resolve-bundler.js +2 -1
  151. package/dist/cli/utils/resolve-bundler.js.map +1 -1
  152. package/dist/cli/utils/ts-config.d.ts +1 -1
  153. package/dist/cli/utils/ts-config.d.ts.map +1 -1
  154. package/dist/cli/utils/ts-config.js +1 -3
  155. package/dist/cli/utils/ts-config.js.map +1 -1
  156. package/dist/cli/utils/with-exponential-backoff.d.ts +7 -0
  157. package/dist/cli/utils/with-exponential-backoff.d.ts.map +1 -0
  158. package/dist/cli/utils/with-exponential-backoff.js +28 -0
  159. package/dist/cli/utils/with-exponential-backoff.js.map +1 -0
  160. package/dist/core/constants.d.ts +2 -0
  161. package/dist/core/constants.d.ts.map +1 -1
  162. package/dist/core/constants.js +6 -1
  163. package/dist/core/constants.js.map +1 -1
  164. package/dist/cypress/config/vite-config.d.ts.map +1 -1
  165. package/dist/cypress/config/vite-config.js +23 -3
  166. package/dist/cypress/config/vite-config.js.map +1 -1
  167. package/dist/cypress/config/webpack-config.d.ts.map +1 -1
  168. package/dist/cypress/config/webpack-config.js +5 -0
  169. package/dist/cypress/config/webpack-config.js.map +1 -1
  170. package/dist/postinstall.js +118 -0
  171. package/dist/scripts/generate-bin-wrappers.js +203 -0
  172. package/dist/storybook-config/swc.d.ts +6 -0
  173. package/dist/storybook-config/swc.d.ts.map +1 -1
  174. package/dist/storybook-config/vite-final.d.ts.map +1 -1
  175. package/dist/storybook-config/vite-final.js +32 -6
  176. package/dist/storybook-config/vite-final.js.map +1 -1
  177. package/dist/storybook-config/webpack-final.d.ts.map +1 -1
  178. package/dist/storybook-config/webpack-final.js +3 -1
  179. package/dist/storybook-config/webpack-final.js.map +1 -1
  180. package/dist/utils/exit-when-parent-exits.d.ts +6 -0
  181. package/dist/utils/exit-when-parent-exits.d.ts.map +1 -0
  182. package/dist/utils/exit-when-parent-exits.js +37 -0
  183. package/dist/utils/exit-when-parent-exits.js.map +1 -0
  184. package/dist/utils/find-up.d.ts +1 -1
  185. package/dist/utils/find-up.d.ts.map +1 -1
  186. package/dist/utils/find-up.js +2 -2
  187. package/dist/utils/find-up.js.map +1 -1
  188. package/dist/utils/get-configuration.d.ts +6 -3
  189. package/dist/utils/get-configuration.d.ts.map +1 -1
  190. package/dist/utils/get-configuration.js +10 -2
  191. package/dist/utils/get-configuration.js.map +1 -1
  192. package/dist/utils/index.d.ts +1 -0
  193. package/dist/utils/index.d.ts.map +1 -1
  194. package/dist/utils/index.js +1 -0
  195. package/dist/utils/index.js.map +1 -1
  196. package/dist/utils/log.js +1 -3
  197. package/dist/utils/log.js.map +1 -1
  198. package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
  199. package/dist/vite/build-shared-dependencies.js +2 -0
  200. package/dist/vite/build-shared-dependencies.js.map +1 -1
  201. package/dist/vite/config/base-config.d.ts.map +1 -1
  202. package/dist/vite/config/base-config.js +14 -1
  203. package/dist/vite/config/base-config.js.map +1 -1
  204. package/dist/vite/config/create-filtering-logger.d.ts.map +1 -1
  205. package/dist/vite/config/create-filtering-logger.js +12 -1
  206. package/dist/vite/config/create-filtering-logger.js.map +1 -1
  207. package/dist/vite/config/create-vite-build-context.d.ts.map +1 -1
  208. package/dist/vite/config/create-vite-build-context.js +4 -1
  209. package/dist/vite/config/create-vite-build-context.js.map +1 -1
  210. package/dist/vite/config/create-vite-config.js +7 -2
  211. package/dist/vite/config/create-vite-config.js.map +1 -1
  212. package/dist/vite/config/load-config-file.js +8 -19
  213. package/dist/vite/config/load-config-file.js.map +1 -1
  214. package/dist/vite/index.d.ts +2 -0
  215. package/dist/vite/index.d.ts.map +1 -1
  216. package/dist/vite/index.html +2 -2
  217. package/dist/vite/index.js +16 -0
  218. package/dist/vite/index.js.map +1 -1
  219. package/dist/vite/plugins/chain-source-maps-plugin.js +1 -1
  220. package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -1
  221. package/dist/vite/plugins/clean-plugin.js +1 -1
  222. package/dist/vite/plugins/clean-plugin.js.map +1 -1
  223. package/dist/vite/plugins/css-injector-plugin.js +1 -1
  224. package/dist/vite/plugins/css-injector-plugin.js.map +1 -1
  225. package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -1
  226. package/dist/vite/plugins/design-system-guard-plugin.js +10 -5
  227. package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -1
  228. package/dist/vite/plugins/dev-server-routing-plugin.d.ts +1 -1
  229. package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -1
  230. package/dist/vite/plugins/dev-server-routing-plugin.js +4 -3
  231. package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -1
  232. package/dist/vite/plugins/externals-plugin.d.ts.map +1 -1
  233. package/dist/vite/plugins/externals-plugin.js +11 -5
  234. package/dist/vite/plugins/externals-plugin.js.map +1 -1
  235. package/dist/vite/plugins/html-plugin.d.ts.map +1 -1
  236. package/dist/vite/plugins/html-plugin.js +5 -3
  237. package/dist/vite/plugins/html-plugin.js.map +1 -1
  238. package/dist/vite/plugins/ignore-modules-plugin.d.ts +2 -2
  239. package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
  240. package/dist/vite/plugins/ignore-modules-plugin.js +36 -24
  241. package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
  242. package/dist/vite/plugins/index.d.ts +3 -0
  243. package/dist/vite/plugins/index.d.ts.map +1 -1
  244. package/dist/vite/plugins/index.js +3 -0
  245. package/dist/vite/plugins/index.js.map +1 -1
  246. package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -1
  247. package/dist/vite/plugins/istanbul-plugin.js +33 -1
  248. package/dist/vite/plugins/istanbul-plugin.js.map +1 -1
  249. package/dist/vite/plugins/less-tilde-plugin.d.ts +8 -0
  250. package/dist/vite/plugins/less-tilde-plugin.d.ts.map +1 -0
  251. package/dist/vite/plugins/less-tilde-plugin.js +53 -0
  252. package/dist/vite/plugins/less-tilde-plugin.js.map +1 -0
  253. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +1 -1
  254. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -1
  255. package/dist/vite/plugins/metadata-plugin.js +1 -1
  256. package/dist/vite/plugins/metadata-plugin.js.map +1 -1
  257. package/dist/vite/plugins/moment-locales-plugin.d.ts +1 -1
  258. package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -1
  259. package/dist/vite/plugins/moment-locales-plugin.js +30 -14
  260. package/dist/vite/plugins/moment-locales-plugin.js.map +1 -1
  261. package/dist/vite/plugins/react-refresh-plugin/index.d.ts +2 -0
  262. package/dist/vite/plugins/react-refresh-plugin/index.d.ts.map +1 -0
  263. package/dist/vite/plugins/react-refresh-plugin/index.js +20 -0
  264. package/dist/vite/plugins/react-refresh-plugin/index.js.map +1 -0
  265. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts +4 -0
  266. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts.map +1 -0
  267. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js +143 -0
  268. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js.map +1 -0
  269. package/dist/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
  270. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -1
  271. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js +14 -11
  272. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -1
  273. package/dist/vite/plugins/style-urls-plugin.js +1 -1
  274. package/dist/vite/plugins/style-urls-plugin.js.map +1 -1
  275. package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -1
  276. package/dist/vite/plugins/virtual-modules-plugin.js +9 -6
  277. package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -1
  278. package/dist/vite/plugins/window-externals-plugin.d.ts +22 -0
  279. package/dist/vite/plugins/window-externals-plugin.d.ts.map +1 -0
  280. package/dist/vite/plugins/window-externals-plugin.js +74 -0
  281. package/dist/vite/plugins/window-externals-plugin.js.map +1 -0
  282. package/dist/vite/types.d.ts +4 -1
  283. package/dist/vite/types.d.ts.map +1 -1
  284. package/dist/webpack/bundle-webpack.d.ts.map +1 -1
  285. package/dist/webpack/bundle-webpack.js +6 -1
  286. package/dist/webpack/bundle-webpack.js.map +1 -1
  287. package/dist/webpack/configs/optimization-config.js +4 -4
  288. package/dist/webpack/configs/optimization-config.js.map +1 -1
  289. package/dist/webpack/configs/output-config.js +1 -1
  290. package/dist/webpack/configs/output-config.js.map +1 -1
  291. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +1 -3
  292. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  293. package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/configuration.expose-loader.js +13 -0
  294. package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/index.js +1 -0
  295. package/dist/webpack/utils/index.d.ts +1 -0
  296. package/dist/webpack/utils/index.d.ts.map +1 -1
  297. package/dist/webpack/utils/index.js +1 -0
  298. package/dist/webpack/utils/index.js.map +1 -1
  299. package/dist/webpack/utils/normalize-proxy-config.d.ts +6 -0
  300. package/dist/webpack/utils/normalize-proxy-config.d.ts.map +1 -0
  301. package/dist/webpack/utils/normalize-proxy-config.js +52 -0
  302. package/dist/webpack/utils/normalize-proxy-config.js.map +1 -0
  303. package/package.json +25 -22
  304. package/src/cli/commands/__tests__/build.test.ts +33 -19
  305. package/src/cli/commands/__tests__/bundle-package.test.ts +65 -0
  306. package/src/cli/commands/__tests__/bundle-vite.test.ts +1 -0
  307. package/src/cli/commands/__tests__/command.test.ts +42 -0
  308. package/src/cli/commands/__tests__/mfe-check.test.ts +26 -5
  309. package/src/cli/commands/__tests__/run-task.test.ts +20 -1
  310. package/src/cli/commands/__tests__/start.test.ts +35 -15
  311. package/src/cli/commands/build.ts +6 -5
  312. package/src/cli/commands/bundle-package.ts +20 -0
  313. package/src/cli/commands/command.ts +14 -0
  314. package/src/cli/commands/mfe-check.ts +6 -10
  315. package/src/cli/commands/registry/build.ts +3 -2
  316. package/src/cli/commands/registry/bundle-package.ts +22 -0
  317. package/src/cli/commands/registry/command-registry.ts +2 -0
  318. package/src/cli/commands/registry/start.ts +3 -2
  319. package/src/cli/commands/review/types.ts +1 -3
  320. package/src/cli/commands/run-task.ts +8 -2
  321. package/src/cli/commands/start.ts +9 -5
  322. package/src/cli/commands/types.ts +2 -6
  323. package/src/cli/index.ts +3 -0
  324. package/src/cli/tasks/__tests__/cli-task.test.ts +181 -69
  325. package/src/cli/tasks/__tests__/task.test.ts +40 -45
  326. package/src/cli/tasks/cli-task.ts +43 -2
  327. package/src/cli/tasks/swc-compile-package/__tests__/get-swc-options.test.ts +46 -4
  328. package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +25 -4
  329. package/src/cli/tasks/swc-compile-package/get-swc-options.ts +14 -1
  330. package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +6 -2
  331. package/src/cli/tasks/task.ts +8 -2
  332. package/src/cli/tasks/tsc-compile/__tests__/tsc-compile.test.ts +8 -32
  333. package/src/cli/tasks/tsc-compile-package/__tests__/tsc-compile-package.test.ts +10 -19
  334. package/src/cli/utils/__tests__/cli-npm.test.ts +33 -0
  335. package/src/cli/utils/__tests__/cli-os.test.ts +86 -3
  336. package/src/cli/utils/__tests__/compile.test.ts +37 -2
  337. package/src/cli/utils/__tests__/copy-files.test.ts +1 -1
  338. package/src/cli/utils/__tests__/with-exponential-backoff.test.ts +119 -0
  339. package/src/cli/utils/cli-npm.ts +19 -4
  340. package/src/cli/utils/cli-os.ts +14 -0
  341. package/src/cli/utils/compile.ts +8 -1
  342. package/src/cli/utils/copy-files.ts +1 -1
  343. package/src/cli/utils/index.ts +1 -1
  344. package/src/cli/utils/resolve-bundler.ts +2 -1
  345. package/src/cli/utils/ts-config.ts +1 -1
  346. package/src/cli/utils/with-exponential-backoff.ts +28 -0
  347. package/src/core/constants.ts +2 -0
  348. package/src/cypress/config/__tests__/vite-config.test.ts +21 -11
  349. package/src/cypress/config/__tests__/webpack-config.test.ts +17 -0
  350. package/src/cypress/config/vite-config.ts +18 -3
  351. package/src/cypress/config/webpack-config.ts +2 -0
  352. package/src/storybook-config/__tests__/vite-final.test.ts +71 -11
  353. package/src/storybook-config/__tests__/webpack-final.test.ts +30 -6
  354. package/src/storybook-config/vite-final.ts +23 -2
  355. package/src/storybook-config/webpack-final.ts +10 -2
  356. package/src/utils/__tests__/exit-when-parent-exits.test.ts +87 -0
  357. package/src/utils/__tests__/find-up.test.ts +49 -0
  358. package/src/utils/__tests__/get-configuration.test.ts +62 -0
  359. package/src/utils/exit-when-parent-exits.ts +33 -0
  360. package/src/utils/find-up.ts +2 -2
  361. package/src/utils/get-configuration.ts +14 -5
  362. package/src/utils/index.ts +1 -0
  363. package/src/vite/__tests__/build-shared-dependencies.test.ts +39 -5
  364. package/src/vite/build-shared-dependencies.ts +2 -1
  365. package/src/vite/config/__tests__/base-config.test.ts +16 -4
  366. package/src/vite/config/__tests__/create-css-config.test.ts +2 -6
  367. package/src/vite/config/__tests__/create-filtering-logger.test.ts +9 -0
  368. package/src/vite/config/__tests__/create-vite-build-context.test.ts +25 -0
  369. package/src/vite/config/__tests__/create-vite-config.test.ts +6 -3
  370. package/src/vite/config/base-config.ts +18 -2
  371. package/src/vite/config/create-filtering-logger.ts +13 -2
  372. package/src/vite/config/create-vite-build-context.ts +1 -0
  373. package/src/vite/config/create-vite-config.ts +6 -3
  374. package/src/vite/index.html +2 -2
  375. package/src/vite/index.ts +2 -0
  376. package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +1 -1
  377. package/src/vite/plugins/__tests__/clean-plugin.test.ts +1 -1
  378. package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +1 -1
  379. package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +15 -3
  380. package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +121 -99
  381. package/src/vite/plugins/__tests__/externals-plugin.test.ts +24 -3
  382. package/src/vite/plugins/__tests__/html-plugin.test.ts +10 -3
  383. package/src/vite/plugins/__tests__/html-template.test.ts +10 -2
  384. package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +30 -6
  385. package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +42 -1
  386. package/src/vite/plugins/__tests__/less-tilde-plugin.test.ts +91 -0
  387. package/src/vite/plugins/__tests__/metadata-plugin.test.ts +1 -1
  388. package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +35 -25
  389. package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +1 -1
  390. package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +20 -9
  391. package/src/vite/plugins/__tests__/window-externals-plugin.test.ts +128 -0
  392. package/src/vite/plugins/chain-source-maps-plugin.ts +1 -1
  393. package/src/vite/plugins/clean-plugin.ts +1 -1
  394. package/src/vite/plugins/css-injector-plugin.ts +1 -1
  395. package/src/vite/plugins/design-system-guard-plugin.ts +11 -8
  396. package/src/vite/plugins/dev-server-routing-plugin.ts +4 -4
  397. package/src/vite/plugins/externals-plugin.ts +15 -6
  398. package/src/vite/plugins/html-plugin.ts +4 -2
  399. package/src/vite/plugins/ignore-modules-plugin.ts +32 -23
  400. package/src/vite/plugins/index.ts +3 -0
  401. package/src/vite/plugins/istanbul-plugin.ts +28 -1
  402. package/src/vite/plugins/less-tilde-plugin.ts +64 -0
  403. package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +1 -1
  404. package/src/vite/plugins/metadata-plugin.ts +1 -1
  405. package/src/vite/plugins/moment-locales-plugin.ts +24 -14
  406. package/src/vite/plugins/react-refresh-plugin/README.md +165 -0
  407. package/src/vite/plugins/react-refresh-plugin/__tests__/react-refresh-plugin.test.ts +366 -0
  408. package/src/vite/plugins/react-refresh-plugin/__tests__/refresh-runtime.test.ts +193 -0
  409. package/src/vite/plugins/react-refresh-plugin/index.ts +1 -0
  410. package/src/vite/plugins/react-refresh-plugin/react-refresh-plugin.ts +144 -0
  411. package/src/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
  412. package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts +21 -16
  413. package/src/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.ts +13 -12
  414. package/src/vite/plugins/style-urls-plugin.ts +1 -1
  415. package/src/vite/plugins/virtual-modules-plugin.ts +8 -7
  416. package/src/vite/plugins/window-externals-plugin.ts +94 -0
  417. package/src/vite/types.ts +4 -1
  418. package/src/webpack/__tests__/bundle-webpack.test.ts +32 -0
  419. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -5
  420. package/src/webpack/__tests__/create-webpack-config.test.ts +10 -6
  421. package/src/webpack/bundle-webpack.ts +7 -1
  422. package/src/webpack/configs/optimization-config.ts +3 -3
  423. package/src/webpack/configs/output-config.ts +1 -1
  424. package/src/webpack/utils/__tests__/normalize-proxy-config.test.ts +121 -0
  425. package/src/webpack/utils/index.ts +1 -0
  426. package/src/webpack/utils/normalize-proxy-config.ts +59 -0
  427. package/tsconfig/types.d.ts +10 -0
  428. package/dist/cli/utils/get-bundle-command.d.ts +0 -3
  429. package/dist/cli/utils/get-bundle-command.d.ts.map +0 -1
  430. package/dist/cli/utils/get-bundle-command.js +0 -16
  431. package/dist/cli/utils/get-bundle-command.js.map +0 -1
  432. package/src/cli/utils/__tests__/get-bundle-command.test.ts +0 -23
  433. package/src/cli/utils/get-bundle-command.ts +0 -5
@@ -2,7 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get lessTildePlugin () {
13
+ return _lesstildeplugin.lessTildePlugin;
14
+ },
15
+ get windowExternalsPlugin () {
16
+ return _windowexternalsplugin.windowExternalsPlugin;
17
+ }
18
+ });
5
19
  _export_star(require("./config/define-config"), exports);
20
+ const _lesstildeplugin = require("./plugins/less-tilde-plugin");
21
+ const _windowexternalsplugin = require("./plugins/window-externals-plugin");
6
22
  function _export_star(from, to) {
7
23
  Object.keys(from).forEach(function(k) {
8
24
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["export * from './config/define-config';\n"],"names":[],"mappings":";;;;qBAAc"}
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["export * from './config/define-config';\nexport { lessTildePlugin } from './plugins/less-tilde-plugin';\nexport { windowExternalsPlugin, type WindowExternals } from './plugins/window-externals-plugin';\n"],"names":["lessTildePlugin","windowExternalsPlugin"],"mappings":";;;;;;;;;;;QACSA;eAAAA,gCAAe;;QACfC;eAAAA,4CAAqB;;;qBAFhB;iCACkB;uCAC4B"}
@@ -17,7 +17,7 @@ function _interop_require_default(obj) {
17
17
  }
18
18
  function chainSourceMapsPlugin() {
19
19
  return {
20
- name: 'chain-source-maps',
20
+ name: 'st:chain-source-maps',
21
21
  load (id) {
22
22
  const mapPath = `${id}.map`;
23
23
  if (id.endsWith('.js') && _fs.default.existsSync(mapPath)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/chain-source-maps-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'rolldown';\n\n/*\n * Return each compiled `.js` file's external `.js.map` (emitted by SWC) from the\n * load hook so Rolldown chains it, making source maps resolve to the original\n * `.ts` instead of stopping at the compiled `.js`.\n */\nexport function chainSourceMapsPlugin(): Plugin {\n return {\n name: 'chain-source-maps',\n load(id) {\n const mapPath = `${id}.map`;\n if (id.endsWith('.js') && fs.existsSync(mapPath)) {\n const map = JSON.parse(fs.readFileSync(mapPath, 'utf8'));\n const dir = path.dirname(mapPath);\n // Absolute paths let Rolldown resolve the sources; source maps require `/` separators.\n map.sources = map.sources.map((source: string) =>\n path.resolve(dir, source).replace(/\\\\/g, '/')\n );\n return { code: fs.readFileSync(id, 'utf8'), map };\n }\n },\n };\n}\n"],"names":["chainSourceMapsPlugin","name","load","id","mapPath","endsWith","fs","existsSync","map","JSON","parse","readFileSync","dir","path","dirname","sources","source","resolve","replace","code"],"mappings":";;;;+BASgBA;;;eAAAA;;;2DATD;6DACE;;;;;;AAQV,SAASA;IACZ,OAAO;QACHC,MAAM;QACNC,MAAKC,EAAE;YACH,MAAMC,UAAU,GAAGD,GAAG,IAAI,CAAC;YAC3B,IAAIA,GAAGE,QAAQ,CAAC,UAAUC,WAAE,CAACC,UAAU,CAACH,UAAU;gBAC9C,MAAMI,MAAMC,KAAKC,KAAK,CAACJ,WAAE,CAACK,YAAY,CAACP,SAAS;gBAChD,MAAMQ,MAAMC,aAAI,CAACC,OAAO,CAACV;gBACzB,uFAAuF;gBACvFI,IAAIO,OAAO,GAAGP,IAAIO,OAAO,CAACP,GAAG,CAAC,CAACQ,SAC3BH,aAAI,CAACI,OAAO,CAACL,KAAKI,QAAQE,OAAO,CAAC,OAAO;gBAE7C,OAAO;oBAAEC,MAAMb,WAAE,CAACK,YAAY,CAACR,IAAI;oBAASK;gBAAI;YACpD;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/chain-source-maps-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'rolldown';\n\n/*\n * Return each compiled `.js` file's external `.js.map` (emitted by SWC) from the\n * load hook so Rolldown chains it, making source maps resolve to the original\n * `.ts` instead of stopping at the compiled `.js`.\n */\nexport function chainSourceMapsPlugin(): Plugin {\n return {\n name: 'st:chain-source-maps',\n load(id) {\n const mapPath = `${id}.map`;\n if (id.endsWith('.js') && fs.existsSync(mapPath)) {\n const map = JSON.parse(fs.readFileSync(mapPath, 'utf8'));\n const dir = path.dirname(mapPath);\n // Absolute paths let Rolldown resolve the sources; source maps require `/` separators.\n map.sources = map.sources.map((source: string) =>\n path.resolve(dir, source).replace(/\\\\/g, '/')\n );\n return { code: fs.readFileSync(id, 'utf8'), map };\n }\n },\n };\n}\n"],"names":["chainSourceMapsPlugin","name","load","id","mapPath","endsWith","fs","existsSync","map","JSON","parse","readFileSync","dir","path","dirname","sources","source","resolve","replace","code"],"mappings":";;;;+BASgBA;;;eAAAA;;;2DATD;6DACE;;;;;;AAQV,SAASA;IACZ,OAAO;QACHC,MAAM;QACNC,MAAKC,EAAE;YACH,MAAMC,UAAU,GAAGD,GAAG,IAAI,CAAC;YAC3B,IAAIA,GAAGE,QAAQ,CAAC,UAAUC,WAAE,CAACC,UAAU,CAACH,UAAU;gBAC9C,MAAMI,MAAMC,KAAKC,KAAK,CAACJ,WAAE,CAACK,YAAY,CAACP,SAAS;gBAChD,MAAMQ,MAAMC,aAAI,CAACC,OAAO,CAACV;gBACzB,uFAAuF;gBACvFI,IAAIO,OAAO,GAAGP,IAAIO,OAAO,CAACP,GAAG,CAAC,CAACQ,SAC3BH,aAAI,CAACI,OAAO,CAACL,KAAKI,QAAQE,OAAO,CAAC,OAAO;gBAE7C,OAAO;oBAAEC,MAAMb,WAAE,CAACK,YAAY,CAACR,IAAI;oBAASK;gBAAI;YACpD;QACJ;IACJ;AACJ"}
@@ -20,7 +20,7 @@ function cleanPlugin(context) {
20
20
  const { isWebComponent } = context.package;
21
21
  let outDir = '';
22
22
  return {
23
- name: 'clean',
23
+ name: 'st:clean',
24
24
  apply: 'build',
25
25
  config: ()=>({
26
26
  build: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/clean-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, getBundleType } from '../../core';\n\n/*\n * Removes stale artifacts from the output directory. MFE builds use Vite's `emptyOutDir`.\n * Host builds can't, since their outDir holds the shared dependencies subdir, so\n * `buildStart` empties it while keeping shared dependencies.\n */\nexport function cleanPlugin(context: BuildContext): Plugin {\n const { isWebComponent } = context.package;\n let outDir = '';\n\n return {\n name: 'clean',\n apply: 'build',\n config: () => ({ build: { emptyOutDir: isWebComponent } }),\n configResolved(config) {\n outDir = config.build.outDir;\n },\n buildStart() {\n if (isWebComponent || !fs.existsSync(outDir)) {\n return;\n }\n const keep = getKeepDir(context);\n for (const entry of fs.readdirSync(outDir)) {\n if (entry === keep) {\n continue;\n }\n fs.rmSync(path.join(outDir, entry), { recursive: true, force: true });\n }\n },\n };\n}\n\n/* The shared deps subdirectory to preserve, or undefined to clean everything. */\nfunction getKeepDir(context: BuildContext): string | undefined {\n if (context.build.emitExposedDependencies) {\n return undefined;\n }\n return getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n}\n"],"names":["cleanPlugin","context","isWebComponent","package","outDir","name","apply","config","build","emptyOutDir","configResolved","buildStart","fs","existsSync","keep","getKeepDir","entry","readdirSync","rmSync","path","join","recursive","force","emitExposedDependencies","undefined","getBundleType"],"mappings":";;;;+BAUgBA;;;eAAAA;;;2DAVD;6DACE;sBAE2B;;;;;;AAOrC,SAASA,YAAYC,OAAqB;IAC7C,MAAM,EAAEC,cAAc,EAAE,GAAGD,QAAQE,OAAO;IAC1C,IAAIC,SAAS;IAEb,OAAO;QACHC,MAAM;QACNC,OAAO;QACPC,QAAQ,IAAO,CAAA;gBAAEC,OAAO;oBAAEC,aAAaP;gBAAe;YAAE,CAAA;QACxDQ,gBAAeH,MAAM;YACjBH,SAASG,OAAOC,KAAK,CAACJ,MAAM;QAChC;QACAO;YACI,IAAIT,kBAAkB,CAACU,WAAE,CAACC,UAAU,CAACT,SAAS;gBAC1C;YACJ;YACA,MAAMU,OAAOC,WAAWd;YACxB,KAAK,MAAMe,SAASJ,WAAE,CAACK,WAAW,CAACb,QAAS;gBACxC,IAAIY,UAAUF,MAAM;oBAChB;gBACJ;gBACAF,WAAE,CAACM,MAAM,CAACC,aAAI,CAACC,IAAI,CAAChB,QAAQY,QAAQ;oBAAEK,WAAW;oBAAMC,OAAO;gBAAK;YACvE;QACJ;IACJ;AACJ;AAEA,+EAA+E,GAC/E,SAASP,WAAWd,OAAqB;IACrC,IAAIA,QAAQO,KAAK,CAACe,uBAAuB,EAAE;QACvC,OAAOC;IACX;IACA,OAAOC,IAAAA,mBAAa,EAAC;QACjB,GAAGxB,OAAO;QACVO,OAAO;YAAE,GAAGP,QAAQO,KAAK;YAAEe,yBAAyB;QAAK;IAC7D;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/clean-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, getBundleType } from '../../core';\n\n/*\n * Removes stale artifacts from the output directory. MFE builds use Vite's `emptyOutDir`.\n * Host builds can't, since their outDir holds the shared dependencies subdir, so\n * `buildStart` empties it while keeping shared dependencies.\n */\nexport function cleanPlugin(context: BuildContext): Plugin {\n const { isWebComponent } = context.package;\n let outDir = '';\n\n return {\n name: 'st:clean',\n apply: 'build',\n config: () => ({ build: { emptyOutDir: isWebComponent } }),\n configResolved(config) {\n outDir = config.build.outDir;\n },\n buildStart() {\n if (isWebComponent || !fs.existsSync(outDir)) {\n return;\n }\n const keep = getKeepDir(context);\n for (const entry of fs.readdirSync(outDir)) {\n if (entry === keep) {\n continue;\n }\n fs.rmSync(path.join(outDir, entry), { recursive: true, force: true });\n }\n },\n };\n}\n\n/* The shared deps subdirectory to preserve, or undefined to clean everything. */\nfunction getKeepDir(context: BuildContext): string | undefined {\n if (context.build.emitExposedDependencies) {\n return undefined;\n }\n return getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n}\n"],"names":["cleanPlugin","context","isWebComponent","package","outDir","name","apply","config","build","emptyOutDir","configResolved","buildStart","fs","existsSync","keep","getKeepDir","entry","readdirSync","rmSync","path","join","recursive","force","emitExposedDependencies","undefined","getBundleType"],"mappings":";;;;+BAUgBA;;;eAAAA;;;2DAVD;6DACE;sBAE2B;;;;;;AAOrC,SAASA,YAAYC,OAAqB;IAC7C,MAAM,EAAEC,cAAc,EAAE,GAAGD,QAAQE,OAAO;IAC1C,IAAIC,SAAS;IAEb,OAAO;QACHC,MAAM;QACNC,OAAO;QACPC,QAAQ,IAAO,CAAA;gBAAEC,OAAO;oBAAEC,aAAaP;gBAAe;YAAE,CAAA;QACxDQ,gBAAeH,MAAM;YACjBH,SAASG,OAAOC,KAAK,CAACJ,MAAM;QAChC;QACAO;YACI,IAAIT,kBAAkB,CAACU,WAAE,CAACC,UAAU,CAACT,SAAS;gBAC1C;YACJ;YACA,MAAMU,OAAOC,WAAWd;YACxB,KAAK,MAAMe,SAASJ,WAAE,CAACK,WAAW,CAACb,QAAS;gBACxC,IAAIY,UAAUF,MAAM;oBAChB;gBACJ;gBACAF,WAAE,CAACM,MAAM,CAACC,aAAI,CAACC,IAAI,CAAChB,QAAQY,QAAQ;oBAAEK,WAAW;oBAAMC,OAAO;gBAAK;YACvE;QACJ;IACJ;AACJ;AAEA,+EAA+E,GAC/E,SAASP,WAAWd,OAAqB;IACrC,IAAIA,QAAQO,KAAK,CAACe,uBAAuB,EAAE;QACvC,OAAOC;IACX;IACA,OAAOC,IAAAA,mBAAa,EAAC;QACjB,GAAGxB,OAAO;QACVO,OAAO;YAAE,GAAGP,QAAQO,KAAK;YAAEe,yBAAyB;QAAK;IAC7D;AACJ"}
@@ -15,7 +15,7 @@ function cssInjectorPlugin(context) {
15
15
  return;
16
16
  }
17
17
  return {
18
- name: 'mfe-css-injector',
18
+ name: 'st:mfe-css-injector',
19
19
  enforce: 'post',
20
20
  transform (code, id) {
21
21
  if (!id.endsWith('.css') && !id.endsWith('.less') && !id.endsWith('.scss')) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/css-injector-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport type { BuildContext } from '../../core';\n\n/*\n * Replaces Vite's default CSS injection (<style> tags in document.head) with\n * MfeStyleRegistry.injectSheet() from @servicetitan/web-components, which\n * creates CSSStyleSheet objects that can be adopted into shadow roots.\n *\n * Works by transforming Vite's CSS module output at enforce:'post'. Vite\n * transforms CSS imports into JS modules that call updateStyle(id, css) from\n * /@vite/client — this plugin replaces that call with injectSheet().\n *\n * HMR works automatically: when a CSS file changes, Vite re-evaluates the\n * module, which re-runs injectSheet(). Existing CSSStyleSheet objects are\n * updated via replaceSync(), so all shadow roots that adopted them see the\n * change immediately.\n */\nexport function cssInjectorPlugin(context: BuildContext): Plugin | undefined {\n const { name, isProduction } = context.build;\n const { isWebComponent } = context.package;\n if (!isWebComponent || isProduction) {\n return;\n }\n\n return {\n name: 'mfe-css-injector',\n enforce: 'post',\n transform(code, id) {\n if (!id.endsWith('.css') && !id.endsWith('.less') && !id.endsWith('.scss')) {\n return;\n }\n if (!code.includes('__vite__updateStyle')) {\n return;\n }\n\n let transformed = code;\n\n const importPattern =\n /import \\{ updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle \\} from [^\\n]+/;\n const callPattern = '__vite__updateStyle(__vite__id, __vite__css)';\n\n if (!importPattern.test(transformed) || !transformed.includes(callPattern)) {\n this.error(\n `[startup] Failed to transform CSS module — Vite's internal output format may have changed. File: ${id}`\n );\n }\n\n transformed = transformed\n .replace(\n importPattern,\n `import { MfeStyleRegistry as __mfe__Registry } from '@servicetitan/web-components'`\n )\n .replace(\n callPattern,\n `__mfe__Registry.for(${JSON.stringify(name)}).injectSheet(__vite__id, __vite__css)`\n )\n .replace(\n /import\\.meta\\.hot\\.prune\\(\\(\\) => __vite__removeStyle\\(__vite__id\\)\\)/,\n ''\n );\n\n return { code: transformed, map: null };\n },\n };\n}\n"],"names":["cssInjectorPlugin","context","name","isProduction","build","isWebComponent","package","enforce","transform","code","id","endsWith","includes","transformed","importPattern","callPattern","test","error","replace","JSON","stringify","map"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,OAAqB;IACnD,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGF,QAAQG,KAAK;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGJ,QAAQK,OAAO;IAC1C,IAAI,CAACD,kBAAkBF,cAAc;QACjC;IACJ;IAEA,OAAO;QACHD,MAAM;QACNK,SAAS;QACTC,WAAUC,IAAI,EAAEC,EAAE;YACd,IAAI,CAACA,GAAGC,QAAQ,CAAC,WAAW,CAACD,GAAGC,QAAQ,CAAC,YAAY,CAACD,GAAGC,QAAQ,CAAC,UAAU;gBACxE;YACJ;YACA,IAAI,CAACF,KAAKG,QAAQ,CAAC,wBAAwB;gBACvC;YACJ;YAEA,IAAIC,cAAcJ;YAElB,MAAMK,gBACF;YACJ,MAAMC,cAAc;YAEpB,IAAI,CAACD,cAAcE,IAAI,CAACH,gBAAgB,CAACA,YAAYD,QAAQ,CAACG,cAAc;gBACxE,IAAI,CAACE,KAAK,CACN,CAAC,iGAAiG,EAAEP,IAAI;YAEhH;YAEAG,cAAcA,YACTK,OAAO,CACJJ,eACA,CAAC,kFAAkF,CAAC,EAEvFI,OAAO,CACJH,aACA,CAAC,oBAAoB,EAAEI,KAAKC,SAAS,CAAClB,MAAM,sCAAsC,CAAC,EAEtFgB,OAAO,CACJ,yEACA;YAGR,OAAO;gBAAET,MAAMI;gBAAaQ,KAAK;YAAK;QAC1C;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/css-injector-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport type { BuildContext } from '../../core';\n\n/*\n * Replaces Vite's default CSS injection (<style> tags in document.head) with\n * MfeStyleRegistry.injectSheet() from @servicetitan/web-components, which\n * creates CSSStyleSheet objects that can be adopted into shadow roots.\n *\n * Works by transforming Vite's CSS module output at enforce:'post'. Vite\n * transforms CSS imports into JS modules that call updateStyle(id, css) from\n * /@vite/client — this plugin replaces that call with injectSheet().\n *\n * HMR works automatically: when a CSS file changes, Vite re-evaluates the\n * module, which re-runs injectSheet(). Existing CSSStyleSheet objects are\n * updated via replaceSync(), so all shadow roots that adopted them see the\n * change immediately.\n */\nexport function cssInjectorPlugin(context: BuildContext): Plugin | undefined {\n const { name, isProduction } = context.build;\n const { isWebComponent } = context.package;\n if (!isWebComponent || isProduction) {\n return;\n }\n\n return {\n name: 'st:mfe-css-injector',\n enforce: 'post',\n transform(code, id) {\n if (!id.endsWith('.css') && !id.endsWith('.less') && !id.endsWith('.scss')) {\n return;\n }\n if (!code.includes('__vite__updateStyle')) {\n return;\n }\n\n let transformed = code;\n\n const importPattern =\n /import \\{ updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle \\} from [^\\n]+/;\n const callPattern = '__vite__updateStyle(__vite__id, __vite__css)';\n\n if (!importPattern.test(transformed) || !transformed.includes(callPattern)) {\n this.error(\n `[startup] Failed to transform CSS module — Vite's internal output format may have changed. File: ${id}`\n );\n }\n\n transformed = transformed\n .replace(\n importPattern,\n `import { MfeStyleRegistry as __mfe__Registry } from '@servicetitan/web-components'`\n )\n .replace(\n callPattern,\n `__mfe__Registry.for(${JSON.stringify(name)}).injectSheet(__vite__id, __vite__css)`\n )\n .replace(\n /import\\.meta\\.hot\\.prune\\(\\(\\) => __vite__removeStyle\\(__vite__id\\)\\)/,\n ''\n );\n\n return { code: transformed, map: null };\n },\n };\n}\n"],"names":["cssInjectorPlugin","context","name","isProduction","build","isWebComponent","package","enforce","transform","code","id","endsWith","includes","transformed","importPattern","callPattern","test","error","replace","JSON","stringify","map"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,OAAqB;IACnD,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGF,QAAQG,KAAK;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGJ,QAAQK,OAAO;IAC1C,IAAI,CAACD,kBAAkBF,cAAc;QACjC;IACJ;IAEA,OAAO;QACHD,MAAM;QACNK,SAAS;QACTC,WAAUC,IAAI,EAAEC,EAAE;YACd,IAAI,CAACA,GAAGC,QAAQ,CAAC,WAAW,CAACD,GAAGC,QAAQ,CAAC,YAAY,CAACD,GAAGC,QAAQ,CAAC,UAAU;gBACxE;YACJ;YACA,IAAI,CAACF,KAAKG,QAAQ,CAAC,wBAAwB;gBACvC;YACJ;YAEA,IAAIC,cAAcJ;YAElB,MAAMK,gBACF;YACJ,MAAMC,cAAc;YAEpB,IAAI,CAACD,cAAcE,IAAI,CAACH,gBAAgB,CAACA,YAAYD,QAAQ,CAACG,cAAc;gBACxE,IAAI,CAACE,KAAK,CACN,CAAC,iGAAiG,EAAEP,IAAI;YAEhH;YAEAG,cAAcA,YACTK,OAAO,CACJJ,eACA,CAAC,kFAAkF,CAAC,EAEvFI,OAAO,CACJH,aACA,CAAC,oBAAoB,EAAEI,KAAKC,SAAS,CAAClB,MAAM,sCAAsC,CAAC,EAEtFgB,OAAO,CACJ,yEACA;YAGR,OAAO;gBAAET,MAAMI;gBAAaQ,KAAK;YAAK;QAC1C;IACJ;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"design-system-guard-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/design-system-guard-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU1C,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAqBrE"}
1
+ {"version":3,"file":"design-system-guard-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/design-system-guard-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU1C,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAwBrE"}
@@ -21,12 +21,17 @@ function designSystemGuardPlugin(context) {
21
21
  const { emitExposedDependencies } = context.build;
22
22
  const designSystemInSharedBundle = isExposeSharedDependencies && !!sharedDependencies[DESIGN_SYSTEM] && !emitExposedDependencies;
23
23
  return {
24
- name: 'design-system-guard',
24
+ name: 'st:design-system-guard',
25
25
  enforce: 'pre',
26
- resolveId (source, importer) {
27
- if (designSystemInSharedBundle && importer && DESIGN_SYSTEM_CSS.test(source)) {
28
- const filename = _path.default.parse(importer).name;
29
- this.error(`do not import design-system.css in "${filename}"; it is automatically included as a shared dependency`);
26
+ resolveId: {
27
+ filter: {
28
+ id: DESIGN_SYSTEM_CSS
29
+ },
30
+ handler (source, importer) {
31
+ if (designSystemInSharedBundle && importer && DESIGN_SYSTEM_CSS.test(source)) {
32
+ const filename = _path.default.parse(importer).name;
33
+ this.error(`do not import design-system.css in "${filename}"; it is automatically included as a shared dependency`);
34
+ }
30
35
  }
31
36
  }
32
37
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/design-system-guard-plugin.ts"],"sourcesContent":["import path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext } from '../../core';\n\nconst DESIGN_SYSTEM = '@servicetitan/design-system';\nconst DESIGN_SYSTEM_CSS = /[\\\\/]design-system\\.css$/;\n\n/*\n * Errors when a host's own code imports design-system.css while it exposes the design\n * system as a shared dependency. The CSS already ships in the shared bundle, so a direct\n * import would load the design system twice. Mirrors the webpack guard in css-rules.ts.\n */\nexport function designSystemGuardPlugin(context: BuildContext): Plugin {\n const { isExposeSharedDependencies, sharedDependencies } = context.package;\n const { emitExposedDependencies } = context.build;\n\n const designSystemInSharedBundle =\n isExposeSharedDependencies &&\n !!sharedDependencies[DESIGN_SYSTEM] &&\n !emitExposedDependencies;\n\n return {\n name: 'design-system-guard',\n enforce: 'pre',\n resolveId(source, importer) {\n if (designSystemInSharedBundle && importer && DESIGN_SYSTEM_CSS.test(source)) {\n const filename = path.parse(importer).name;\n this.error(\n `do not import design-system.css in \"${filename}\"; it is automatically included as a shared dependency`\n );\n }\n },\n };\n}\n"],"names":["designSystemGuardPlugin","DESIGN_SYSTEM","DESIGN_SYSTEM_CSS","context","isExposeSharedDependencies","sharedDependencies","package","emitExposedDependencies","build","designSystemInSharedBundle","name","enforce","resolveId","source","importer","test","filename","path","parse","error"],"mappings":";;;;+BAYgBA;;;eAAAA;;;6DAZC;;;;;;AAIjB,MAAMC,gBAAgB;AACtB,MAAMC,oBAAoB;AAOnB,SAASF,wBAAwBG,OAAqB;IACzD,MAAM,EAAEC,0BAA0B,EAAEC,kBAAkB,EAAE,GAAGF,QAAQG,OAAO;IAC1E,MAAM,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IAEjD,MAAMC,6BACFL,8BACA,CAAC,CAACC,kBAAkB,CAACJ,cAAc,IACnC,CAACM;IAEL,OAAO;QACHG,MAAM;QACNC,SAAS;QACTC,WAAUC,MAAM,EAAEC,QAAQ;YACtB,IAAIL,8BAA8BK,YAAYZ,kBAAkBa,IAAI,CAACF,SAAS;gBAC1E,MAAMG,WAAWC,aAAI,CAACC,KAAK,CAACJ,UAAUJ,IAAI;gBAC1C,IAAI,CAACS,KAAK,CACN,CAAC,oCAAoC,EAAEH,SAAS,sDAAsD,CAAC;YAE/G;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/design-system-guard-plugin.ts"],"sourcesContent":["import path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext } from '../../core';\n\nconst DESIGN_SYSTEM = '@servicetitan/design-system';\nconst DESIGN_SYSTEM_CSS = /[\\\\/]design-system\\.css$/;\n\n/*\n * Errors when a host's own code imports design-system.css while it exposes the design\n * system as a shared dependency. The CSS already ships in the shared bundle, so a direct\n * import would load the design system twice. Mirrors the webpack guard in css-rules.ts.\n */\nexport function designSystemGuardPlugin(context: BuildContext): Plugin {\n const { isExposeSharedDependencies, sharedDependencies } = context.package;\n const { emitExposedDependencies } = context.build;\n\n const designSystemInSharedBundle =\n isExposeSharedDependencies &&\n !!sharedDependencies[DESIGN_SYSTEM] &&\n !emitExposedDependencies;\n\n return {\n name: 'st:design-system-guard',\n enforce: 'pre',\n resolveId: {\n filter: { id: DESIGN_SYSTEM_CSS },\n handler(source, importer) {\n if (designSystemInSharedBundle && importer && DESIGN_SYSTEM_CSS.test(source)) {\n const filename = path.parse(importer).name;\n this.error(\n `do not import design-system.css in \"${filename}\"; it is automatically included as a shared dependency`\n );\n }\n },\n },\n };\n}\n"],"names":["designSystemGuardPlugin","DESIGN_SYSTEM","DESIGN_SYSTEM_CSS","context","isExposeSharedDependencies","sharedDependencies","package","emitExposedDependencies","build","designSystemInSharedBundle","name","enforce","resolveId","filter","id","handler","source","importer","test","filename","path","parse","error"],"mappings":";;;;+BAYgBA;;;eAAAA;;;6DAZC;;;;;;AAIjB,MAAMC,gBAAgB;AACtB,MAAMC,oBAAoB;AAOnB,SAASF,wBAAwBG,OAAqB;IACzD,MAAM,EAAEC,0BAA0B,EAAEC,kBAAkB,EAAE,GAAGF,QAAQG,OAAO;IAC1E,MAAM,EAAEC,uBAAuB,EAAE,GAAGJ,QAAQK,KAAK;IAEjD,MAAMC,6BACFL,8BACA,CAAC,CAACC,kBAAkB,CAACJ,cAAc,IACnC,CAACM;IAEL,OAAO;QACHG,MAAM;QACNC,SAAS;QACTC,WAAW;YACPC,QAAQ;gBAAEC,IAAIZ;YAAkB;YAChCa,SAAQC,MAAM,EAAEC,QAAQ;gBACpB,IAAIR,8BAA8BQ,YAAYf,kBAAkBgB,IAAI,CAACF,SAAS;oBAC1E,MAAMG,WAAWC,aAAI,CAACC,KAAK,CAACJ,UAAUP,IAAI;oBAC1C,IAAI,CAACY,KAAK,CACN,CAAC,oCAAoC,EAAEH,SAAS,sDAAsD,CAAC;gBAE/G;YACJ;QACJ;IACJ;AACJ"}
@@ -1,4 +1,4 @@
1
- import type { Plugin } from 'vite';
1
+ import { type Plugin } from 'vite';
2
2
  import { type BuildContext } from '../../core';
3
3
  /**
4
4
  * URL rewrites for dev and preview servers.
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-routing-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/dev-server-routing-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAqEpE"}
1
+ {"version":3,"file":"dev-server-routing-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/dev-server-routing-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAqEpE"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "devServerRoutingPlugin", {
10
10
  });
11
11
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
12
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ const _vite = require("vite");
13
14
  const _core = require("../../core");
14
15
  const _utils = require("../../utils");
15
16
  function _interop_require_default(obj) {
@@ -31,12 +32,12 @@ function devServerRoutingPlugin(context) {
31
32
  _utils.log.info(`[${_utils.log.timestamp}]: ${req.method} ${req.url}`);
32
33
  };
33
34
  return {
34
- name: 'dev-server-routing',
35
+ name: 'st:dev-server-routing',
35
36
  configResolved (config) {
36
37
  outDir = config.build.outDir;
37
38
  },
38
39
  configureServer (server) {
39
- const outDirRelative = `/${_path.default.relative(process.cwd(), outDir)}/`;
40
+ const outDirRelative = `/${(0, _vite.normalizePath)(_path.default.relative(process.cwd(), outDir))}/`;
40
41
  server.middlewares.use((req, _res, next)=>{
41
42
  var _req_url;
42
43
  logRequest(req);
@@ -60,7 +61,7 @@ function devServerRoutingPlugin(context) {
60
61
  return;
61
62
  }
62
63
  const destDir = _path.default.resolve(destination);
63
- const mountPath = '/' + _path.default.relative(process.cwd(), destDir);
64
+ const mountPath = '/' + (0, _vite.normalizePath)(_path.default.relative(process.cwd(), destDir));
64
65
  const contentTypes = {
65
66
  '.js': 'application/javascript',
66
67
  '.css': 'text/css',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/dev-server-routing-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { getBundleType, type BuildContext } from '../../core';\nimport { log } from '../../utils';\n\n/**\n * URL rewrites for dev and preview servers.\n *\n * Dev serves from the project root, preview serves from outDir. Production builds output to\n * dist/bundle/. Paths that work in prod (relative to index.html in outDir) break in dev and\n * preview because the server root differs.\n *\n * - Host dev (root: project root): template uses ./shared/... which resolves to /shared/...\n * but files are at dist/bundle/shared/. Rewrites to /dist/bundle/shared/... so Vite serves them.\n *\n * - MFE dev (root: project root): Loader reads entrypoints.json and requests assets at\n * production output paths (e.g. /dist/bundle/full/index.js). Strips the outDir prefix\n * so files resolve from root.\n *\n * - Host preview (root: dist/bundle/): shared/ is inside outDir, no rewrites needed.\n *\n * - MFE preview (root: dist/bundle/full/): host requests metadata.json from the parent\n * dist/bundle/ and sibling bundle assets (light/, headless/). Serves the entire destination\n * directory as static files.\n */\nexport function devServerRoutingPlugin(context: BuildContext): Plugin {\n const { isWebComponent, destination } = context.package;\n let outDir = '';\n\n const sharedDepsDirname = getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n\n const logRequest = (req: import('http').IncomingMessage) => {\n log.info(`[${log.timestamp}]: ${req.method} ${req.url}`);\n };\n\n return {\n name: 'dev-server-routing',\n\n configResolved(config) {\n outDir = config.build.outDir;\n },\n\n configureServer(server) {\n const outDirRelative = `/${path.relative(process.cwd(), outDir)}/`;\n\n server.middlewares.use((req, _res, next) => {\n logRequest(req);\n const url = req.url ?? '';\n if (isWebComponent) {\n if (url.startsWith(outDirRelative)) {\n req.url = url.slice(outDirRelative.length - 1);\n }\n } else if (url.startsWith(`/${sharedDepsDirname}/`)) {\n req.url = `${outDirRelative}${url.slice(1)}`;\n }\n next();\n });\n },\n\n configurePreviewServer(server) {\n server.middlewares.use((req, _res, next) => {\n logRequest(req);\n next();\n });\n\n if (!isWebComponent) {\n return;\n }\n\n const destDir = path.resolve(destination);\n const mountPath = '/' + path.relative(process.cwd(), destDir);\n\n const contentTypes: Record<string, string> = {\n '.js': 'application/javascript',\n '.css': 'text/css',\n '.json': 'application/json',\n };\n\n server.middlewares.use(mountPath, (req, res, next) => {\n const filePath = path.join(destDir, req.url ?? '');\n if (!filePath.startsWith(destDir + path.sep) || !fs.existsSync(filePath)) {\n return next();\n }\n const contentType = contentTypes[path.extname(filePath)];\n if (contentType) {\n res.setHeader('Content-Type', contentType);\n }\n fs.createReadStream(filePath).pipe(res);\n });\n },\n };\n}\n"],"names":["devServerRoutingPlugin","context","isWebComponent","destination","package","outDir","sharedDepsDirname","getBundleType","build","emitExposedDependencies","logRequest","req","log","info","timestamp","method","url","name","configResolved","config","configureServer","server","outDirRelative","path","relative","process","cwd","middlewares","use","_res","next","startsWith","slice","length","configurePreviewServer","destDir","resolve","mountPath","contentTypes","res","filePath","join","sep","fs","existsSync","contentType","extname","setHeader","createReadStream","pipe"],"mappings":";;;;+BA0BgBA;;;eAAAA;;;2DA1BD;6DACE;sBAEgC;uBAC7B;;;;;;AAsBb,SAASA,uBAAuBC,OAAqB;IACxD,MAAM,EAAEC,cAAc,EAAEC,WAAW,EAAE,GAAGF,QAAQG,OAAO;IACvD,IAAIC,SAAS;IAEb,MAAMC,oBAAoBC,IAAAA,mBAAa,EAAC;QACpC,GAAGN,OAAO;QACVO,OAAO;YAAE,GAAGP,QAAQO,KAAK;YAAEC,yBAAyB;QAAK;IAC7D;IAEA,MAAMC,aAAa,CAACC;QAChBC,UAAG,CAACC,IAAI,CAAC,CAAC,CAAC,EAAED,UAAG,CAACE,SAAS,CAAC,GAAG,EAAEH,IAAII,MAAM,CAAC,CAAC,EAAEJ,IAAIK,GAAG,EAAE;IAC3D;IAEA,OAAO;QACHC,MAAM;QAENC,gBAAeC,MAAM;YACjBd,SAASc,OAAOX,KAAK,CAACH,MAAM;QAChC;QAEAe,iBAAgBC,MAAM;YAClB,MAAMC,iBAAiB,CAAC,CAAC,EAAEC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIrB,QAAQ,CAAC,CAAC;YAElEgB,OAAOM,WAAW,CAACC,GAAG,CAAC,CAACjB,KAAKkB,MAAMC;oBAEnBnB;gBADZD,WAAWC;gBACX,MAAMK,OAAML,WAAAA,IAAIK,GAAG,cAAPL,sBAAAA,WAAW;gBACvB,IAAIT,gBAAgB;oBAChB,IAAIc,IAAIe,UAAU,CAACT,iBAAiB;wBAChCX,IAAIK,GAAG,GAAGA,IAAIgB,KAAK,CAACV,eAAeW,MAAM,GAAG;oBAChD;gBACJ,OAAO,IAAIjB,IAAIe,UAAU,CAAC,CAAC,CAAC,EAAEzB,kBAAkB,CAAC,CAAC,GAAG;oBACjDK,IAAIK,GAAG,GAAG,GAAGM,iBAAiBN,IAAIgB,KAAK,CAAC,IAAI;gBAChD;gBACAF;YACJ;QACJ;QAEAI,wBAAuBb,MAAM;YACzBA,OAAOM,WAAW,CAACC,GAAG,CAAC,CAACjB,KAAKkB,MAAMC;gBAC/BpB,WAAWC;gBACXmB;YACJ;YAEA,IAAI,CAAC5B,gBAAgB;gBACjB;YACJ;YAEA,MAAMiC,UAAUZ,aAAI,CAACa,OAAO,CAACjC;YAC7B,MAAMkC,YAAY,MAAMd,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIS;YAErD,MAAMG,eAAuC;gBACzC,OAAO;gBACP,QAAQ;gBACR,SAAS;YACb;YAEAjB,OAAOM,WAAW,CAACC,GAAG,CAACS,WAAW,CAAC1B,KAAK4B,KAAKT;oBACLnB;gBAApC,MAAM6B,WAAWjB,aAAI,CAACkB,IAAI,CAACN,UAASxB,WAAAA,IAAIK,GAAG,cAAPL,sBAAAA,WAAW;gBAC/C,IAAI,CAAC6B,SAAST,UAAU,CAACI,UAAUZ,aAAI,CAACmB,GAAG,KAAK,CAACC,WAAE,CAACC,UAAU,CAACJ,WAAW;oBACtE,OAAOV;gBACX;gBACA,MAAMe,cAAcP,YAAY,CAACf,aAAI,CAACuB,OAAO,CAACN,UAAU;gBACxD,IAAIK,aAAa;oBACbN,IAAIQ,SAAS,CAAC,gBAAgBF;gBAClC;gBACAF,WAAE,CAACK,gBAAgB,CAACR,UAAUS,IAAI,CAACV;YACvC;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/dev-server-routing-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { normalizePath, type Plugin } from 'vite';\nimport { getBundleType, type BuildContext } from '../../core';\nimport { log } from '../../utils';\n\n/**\n * URL rewrites for dev and preview servers.\n *\n * Dev serves from the project root, preview serves from outDir. Production builds output to\n * dist/bundle/. Paths that work in prod (relative to index.html in outDir) break in dev and\n * preview because the server root differs.\n *\n * - Host dev (root: project root): template uses ./shared/... which resolves to /shared/...\n * but files are at dist/bundle/shared/. Rewrites to /dist/bundle/shared/... so Vite serves them.\n *\n * - MFE dev (root: project root): Loader reads entrypoints.json and requests assets at\n * production output paths (e.g. /dist/bundle/full/index.js). Strips the outDir prefix\n * so files resolve from root.\n *\n * - Host preview (root: dist/bundle/): shared/ is inside outDir, no rewrites needed.\n *\n * - MFE preview (root: dist/bundle/full/): host requests metadata.json from the parent\n * dist/bundle/ and sibling bundle assets (light/, headless/). Serves the entire destination\n * directory as static files.\n */\nexport function devServerRoutingPlugin(context: BuildContext): Plugin {\n const { isWebComponent, destination } = context.package;\n let outDir = '';\n\n const sharedDepsDirname = getBundleType({\n ...context,\n build: { ...context.build, emitExposedDependencies: true },\n });\n\n const logRequest = (req: import('http').IncomingMessage) => {\n log.info(`[${log.timestamp}]: ${req.method} ${req.url}`);\n };\n\n return {\n name: 'st:dev-server-routing',\n\n configResolved(config) {\n outDir = config.build.outDir;\n },\n\n configureServer(server) {\n const outDirRelative = `/${normalizePath(path.relative(process.cwd(), outDir))}/`;\n\n server.middlewares.use((req, _res, next) => {\n logRequest(req);\n const url = req.url ?? '';\n if (isWebComponent) {\n if (url.startsWith(outDirRelative)) {\n req.url = url.slice(outDirRelative.length - 1);\n }\n } else if (url.startsWith(`/${sharedDepsDirname}/`)) {\n req.url = `${outDirRelative}${url.slice(1)}`;\n }\n next();\n });\n },\n\n configurePreviewServer(server) {\n server.middlewares.use((req, _res, next) => {\n logRequest(req);\n next();\n });\n\n if (!isWebComponent) {\n return;\n }\n\n const destDir = path.resolve(destination);\n const mountPath = '/' + normalizePath(path.relative(process.cwd(), destDir));\n\n const contentTypes: Record<string, string> = {\n '.js': 'application/javascript',\n '.css': 'text/css',\n '.json': 'application/json',\n };\n\n server.middlewares.use(mountPath, (req, res, next) => {\n const filePath = path.join(destDir, req.url ?? '');\n if (!filePath.startsWith(destDir + path.sep) || !fs.existsSync(filePath)) {\n return next();\n }\n const contentType = contentTypes[path.extname(filePath)];\n if (contentType) {\n res.setHeader('Content-Type', contentType);\n }\n fs.createReadStream(filePath).pipe(res);\n });\n },\n };\n}\n"],"names":["devServerRoutingPlugin","context","isWebComponent","destination","package","outDir","sharedDepsDirname","getBundleType","build","emitExposedDependencies","logRequest","req","log","info","timestamp","method","url","name","configResolved","config","configureServer","server","outDirRelative","normalizePath","path","relative","process","cwd","middlewares","use","_res","next","startsWith","slice","length","configurePreviewServer","destDir","resolve","mountPath","contentTypes","res","filePath","join","sep","fs","existsSync","contentType","extname","setHeader","createReadStream","pipe"],"mappings":";;;;+BA0BgBA;;;eAAAA;;;2DA1BD;6DACE;sBAC0B;sBACM;uBAC7B;;;;;;AAsBb,SAASA,uBAAuBC,OAAqB;IACxD,MAAM,EAAEC,cAAc,EAAEC,WAAW,EAAE,GAAGF,QAAQG,OAAO;IACvD,IAAIC,SAAS;IAEb,MAAMC,oBAAoBC,IAAAA,mBAAa,EAAC;QACpC,GAAGN,OAAO;QACVO,OAAO;YAAE,GAAGP,QAAQO,KAAK;YAAEC,yBAAyB;QAAK;IAC7D;IAEA,MAAMC,aAAa,CAACC;QAChBC,UAAG,CAACC,IAAI,CAAC,CAAC,CAAC,EAAED,UAAG,CAACE,SAAS,CAAC,GAAG,EAAEH,IAAII,MAAM,CAAC,CAAC,EAAEJ,IAAIK,GAAG,EAAE;IAC3D;IAEA,OAAO;QACHC,MAAM;QAENC,gBAAeC,MAAM;YACjBd,SAASc,OAAOX,KAAK,CAACH,MAAM;QAChC;QAEAe,iBAAgBC,MAAM;YAClB,MAAMC,iBAAiB,CAAC,CAAC,EAAEC,IAAAA,mBAAa,EAACC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAItB,SAAS,CAAC,CAAC;YAEjFgB,OAAOO,WAAW,CAACC,GAAG,CAAC,CAAClB,KAAKmB,MAAMC;oBAEnBpB;gBADZD,WAAWC;gBACX,MAAMK,OAAML,WAAAA,IAAIK,GAAG,cAAPL,sBAAAA,WAAW;gBACvB,IAAIT,gBAAgB;oBAChB,IAAIc,IAAIgB,UAAU,CAACV,iBAAiB;wBAChCX,IAAIK,GAAG,GAAGA,IAAIiB,KAAK,CAACX,eAAeY,MAAM,GAAG;oBAChD;gBACJ,OAAO,IAAIlB,IAAIgB,UAAU,CAAC,CAAC,CAAC,EAAE1B,kBAAkB,CAAC,CAAC,GAAG;oBACjDK,IAAIK,GAAG,GAAG,GAAGM,iBAAiBN,IAAIiB,KAAK,CAAC,IAAI;gBAChD;gBACAF;YACJ;QACJ;QAEAI,wBAAuBd,MAAM;YACzBA,OAAOO,WAAW,CAACC,GAAG,CAAC,CAAClB,KAAKmB,MAAMC;gBAC/BrB,WAAWC;gBACXoB;YACJ;YAEA,IAAI,CAAC7B,gBAAgB;gBACjB;YACJ;YAEA,MAAMkC,UAAUZ,aAAI,CAACa,OAAO,CAAClC;YAC7B,MAAMmC,YAAY,MAAMf,IAAAA,mBAAa,EAACC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIS;YAEnE,MAAMG,eAAuC;gBACzC,OAAO;gBACP,QAAQ;gBACR,SAAS;YACb;YAEAlB,OAAOO,WAAW,CAACC,GAAG,CAACS,WAAW,CAAC3B,KAAK6B,KAAKT;oBACLpB;gBAApC,MAAM8B,WAAWjB,aAAI,CAACkB,IAAI,CAACN,UAASzB,WAAAA,IAAIK,GAAG,cAAPL,sBAAAA,WAAW;gBAC/C,IAAI,CAAC8B,SAAST,UAAU,CAACI,UAAUZ,aAAI,CAACmB,GAAG,KAAK,CAACC,WAAE,CAACC,UAAU,CAACJ,WAAW;oBACtE,OAAOV;gBACX;gBACA,MAAMe,cAAcP,YAAY,CAACf,aAAI,CAACuB,OAAO,CAACN,UAAU;gBACxD,IAAIK,aAAa;oBACbN,IAAIQ,SAAS,CAAC,gBAAgBF;gBAClC;gBACAF,WAAE,CAACK,gBAAgB,CAACR,UAAUS,IAAI,CAACV;YACvC;QACJ;IACJ;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"externals-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/externals-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AAgCxD,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CA6CzE"}
1
+ {"version":3,"file":"externals-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/externals-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AAoCxD,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAkDzE"}
@@ -16,6 +16,7 @@ function _interop_require_default(obj) {
16
16
  default: obj
17
17
  };
18
18
  }
19
+ /* Dots are the only valid regex-special character in package names */ const buildEscapedRegExp = (dependency)=>new RegExp(`^${dependency.replace(/\./g, '\\.')}$`);
19
20
  function externalsPlugin(context) {
20
21
  const entries = (0, _core.getExternals)(context);
21
22
  if (!entries) {
@@ -36,12 +37,12 @@ function externalsPlugin(context) {
36
37
  const proxyNodeModules = _path.default.join(proxyModulesDir, 'node_modules');
37
38
  const { isProduction } = context.build;
38
39
  return {
39
- name: 'externals',
40
+ name: 'st:externals',
40
41
  enforce: 'pre',
41
42
  config: isProduction ? undefined : ()=>({
42
43
  resolve: {
43
44
  alias: Object.keys(entries).map((dep)=>({
44
- find: new RegExp(`^${dep.replace('/', '\\/')}$`),
45
+ find: buildEscapedRegExp(dep),
45
46
  replacement: _path.default.join(proxyNodeModules, dep)
46
47
  }))
47
48
  },
@@ -49,9 +50,14 @@ function externalsPlugin(context) {
49
50
  include: Object.keys(entries)
50
51
  }
51
52
  }),
52
- resolveId: isProduction ? (source)=>{
53
- if (source in entries) {
54
- return _path.default.join(proxyNodeModules, source, 'index.cjs');
53
+ resolveId: isProduction ? {
54
+ filter: {
55
+ id: Object.keys(entries).map(buildEscapedRegExp)
56
+ },
57
+ handler (source) {
58
+ if (source in entries) {
59
+ return _path.default.join(proxyNodeModules, source, 'index.cjs');
60
+ }
55
61
  }
56
62
  } : undefined
57
63
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/externals-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, getExternals } from '../../core';\n\n/*\n * Externalizes shared dependencies by redirecting imports to CJS proxy modules\n * that read from the host's global shared deps registry at runtime.\n *\n * Each shared dep gets a fake package on disk (node_modules/.startup/externals/)\n * with `module.exports = SharedDependencies.Foo['scope']`.\n *\n * Three mechanisms work together, each handling a different mode:\n *\n * - resolve.alias (dev) — exact-match regex redirects `react` to the proxy package.\n * Subpath imports (react/jsx-runtime) are NOT matched and resolve normally.\n *\n * - optimizeDeps.include (dev) — forces Vite to pre-bundle the proxy packages.\n * This triggers Vite's CJS-to-ESM interop: the pre-bundled output has `export default`,\n * and Vite's import-analysis plugin rewrites consumers' named imports to property access\n * on the default export (e.g. `import { useState } from 'react'` becomes\n * `const useState = __default[\"useState\"]`). Without optimizeDeps, the raw CJS proxy\n * would be served to the browser and fail on named imports.\n *\n * - resolveId (prod) — resolve.alias doesn't run during Rolldown bundling, so resolveId\n * with enforce:'pre' intercepts shared dep imports before Vite's default resolver.\n * Rolldown handles CJS-to-ESM interop natively via __commonJSMin/__toESM helpers.\n * Only exact matches — subpath imports must NOT be redirected because they export\n * different things than the barrel.\n *\n * The disk-based proxy + optimizeDeps complexity exists because Vite's dev server serves\n * modules as native ESM without bundling — CJS virtual modules can't be served to the browser.\n * When Vite's \"full bundle\" dev mode ships (Rolldown bundles in dev, like prod), this can be\n * simplified to a single resolveId + load with a virtual CJS module for both modes (see 9ffd1815).\n */\nexport function externalsPlugin(context: BuildContext): Plugin | undefined {\n const entries = getExternals(context);\n if (!entries) {\n return;\n }\n\n const proxyModulesDir = path.resolve('node_modules', '.startup', 'externals');\n for (const [dep, proxy] of Object.entries(entries)) {\n const pkgDir = path.join(proxyModulesDir, 'node_modules', dep);\n fs.mkdirSync(pkgDir, { recursive: true });\n fs.writeFileSync(path.join(pkgDir, 'index.cjs'), `module.exports = ${proxy};`);\n fs.writeFileSync(\n path.join(pkgDir, 'package.json'),\n JSON.stringify({ name: dep, main: './index.cjs' })\n );\n }\n\n const proxyNodeModules = path.join(proxyModulesDir, 'node_modules');\n\n const { isProduction } = context.build;\n\n return {\n name: 'externals',\n enforce: 'pre',\n config: isProduction\n ? undefined\n : () => ({\n resolve: {\n alias: Object.keys(entries).map(dep => ({\n find: new RegExp(`^${dep.replace('/', '\\\\/')}$`),\n replacement: path.join(proxyNodeModules, dep),\n })),\n },\n optimizeDeps: {\n include: Object.keys(entries),\n },\n }),\n resolveId: isProduction\n ? (source: string) => {\n if (source in entries) {\n return path.join(proxyNodeModules, source, 'index.cjs');\n }\n }\n : undefined,\n };\n}\n"],"names":["externalsPlugin","context","entries","getExternals","proxyModulesDir","path","resolve","dep","proxy","Object","pkgDir","join","fs","mkdirSync","recursive","writeFileSync","JSON","stringify","name","main","proxyNodeModules","isProduction","build","enforce","config","undefined","alias","keys","map","find","RegExp","replace","replacement","optimizeDeps","include","resolveId","source"],"mappings":";;;;+BAmCgBA;;;eAAAA;;;2DAnCD;6DACE;sBAE0B;;;;;;AAgCpC,SAASA,gBAAgBC,OAAqB;IACjD,MAAMC,UAAUC,IAAAA,kBAAY,EAACF;IAC7B,IAAI,CAACC,SAAS;QACV;IACJ;IAEA,MAAME,kBAAkBC,aAAI,CAACC,OAAO,CAAC,gBAAgB,YAAY;IACjE,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOP,OAAO,CAACA,SAAU;QAChD,MAAMQ,SAASL,aAAI,CAACM,IAAI,CAACP,iBAAiB,gBAAgBG;QAC1DK,WAAE,CAACC,SAAS,CAACH,QAAQ;YAAEI,WAAW;QAAK;QACvCF,WAAE,CAACG,aAAa,CAACV,aAAI,CAACM,IAAI,CAACD,QAAQ,cAAc,CAAC,iBAAiB,EAAEF,MAAM,CAAC,CAAC;QAC7EI,WAAE,CAACG,aAAa,CACZV,aAAI,CAACM,IAAI,CAACD,QAAQ,iBAClBM,KAAKC,SAAS,CAAC;YAAEC,MAAMX;YAAKY,MAAM;QAAc;IAExD;IAEA,MAAMC,mBAAmBf,aAAI,CAACM,IAAI,CAACP,iBAAiB;IAEpD,MAAM,EAAEiB,YAAY,EAAE,GAAGpB,QAAQqB,KAAK;IAEtC,OAAO;QACHJ,MAAM;QACNK,SAAS;QACTC,QAAQH,eACFI,YACA,IAAO,CAAA;gBACHnB,SAAS;oBACLoB,OAAOjB,OAAOkB,IAAI,CAACzB,SAAS0B,GAAG,CAACrB,CAAAA,MAAQ,CAAA;4BACpCsB,MAAM,IAAIC,OAAO,CAAC,CAAC,EAAEvB,IAAIwB,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC;4BAC/CC,aAAa3B,aAAI,CAACM,IAAI,CAACS,kBAAkBb;wBAC7C,CAAA;gBACJ;gBACA0B,cAAc;oBACVC,SAASzB,OAAOkB,IAAI,CAACzB;gBACzB;YACJ,CAAA;QACNiC,WAAWd,eACL,CAACe;YACG,IAAIA,UAAUlC,SAAS;gBACnB,OAAOG,aAAI,CAACM,IAAI,CAACS,kBAAkBgB,QAAQ;YAC/C;QACJ,IACAX;IACV;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/externals-plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { BuildContext, getExternals } from '../../core';\n\n/* Dots are the only valid regex-special character in package names */\nconst buildEscapedRegExp = (dependency: string) =>\n new RegExp(`^${dependency.replace(/\\./g, '\\\\.')}$`);\n\n/*\n * Externalizes shared dependencies by redirecting imports to CJS proxy modules\n * that read from the host's global shared deps registry at runtime.\n *\n * Each shared dep gets a fake package on disk (node_modules/.startup/externals/)\n * with `module.exports = SharedDependencies.Foo['scope']`.\n *\n * Three mechanisms work together, each handling a different mode:\n *\n * - resolve.alias (dev) — exact-match regex redirects `react` to the proxy package.\n * Subpath imports (react/jsx-runtime) are NOT matched and resolve normally.\n *\n * - optimizeDeps.include (dev) — forces Vite to pre-bundle the proxy packages.\n * This triggers Vite's CJS-to-ESM interop: the pre-bundled output has `export default`,\n * and Vite's import-analysis plugin rewrites consumers' named imports to property access\n * on the default export (e.g. `import { useState } from 'react'` becomes\n * `const useState = __default[\"useState\"]`). Without optimizeDeps, the raw CJS proxy\n * would be served to the browser and fail on named imports.\n *\n * - resolveId (prod) — resolve.alias doesn't run during Rolldown bundling, so resolveId\n * with enforce:'pre' intercepts shared dep imports before Vite's default resolver.\n * Rolldown handles CJS-to-ESM interop natively via __commonJSMin/__toESM helpers.\n * Only exact matches — subpath imports must NOT be redirected because they export\n * different things than the barrel.\n *\n * The disk-based proxy + optimizeDeps complexity exists because Vite's dev server serves\n * modules as native ESM without bundling — CJS virtual modules can't be served to the browser.\n * When Vite's \"full bundle\" dev mode ships (Rolldown bundles in dev, like prod), this can be\n * simplified to a single resolveId + load with a virtual CJS module for both modes (see 9ffd1815).\n */\nexport function externalsPlugin(context: BuildContext): Plugin | undefined {\n const entries = getExternals(context);\n if (!entries) {\n return;\n }\n\n const proxyModulesDir = path.resolve('node_modules', '.startup', 'externals');\n for (const [dep, proxy] of Object.entries(entries)) {\n const pkgDir = path.join(proxyModulesDir, 'node_modules', dep);\n fs.mkdirSync(pkgDir, { recursive: true });\n fs.writeFileSync(path.join(pkgDir, 'index.cjs'), `module.exports = ${proxy};`);\n fs.writeFileSync(\n path.join(pkgDir, 'package.json'),\n JSON.stringify({ name: dep, main: './index.cjs' })\n );\n }\n\n const proxyNodeModules = path.join(proxyModulesDir, 'node_modules');\n\n const { isProduction } = context.build;\n\n return {\n name: 'st:externals',\n enforce: 'pre',\n config: isProduction\n ? undefined\n : () => ({\n resolve: {\n alias: Object.keys(entries).map(dep => ({\n find: buildEscapedRegExp(dep),\n replacement: path.join(proxyNodeModules, dep),\n })),\n },\n optimizeDeps: {\n include: Object.keys(entries),\n },\n }),\n resolveId: isProduction\n ? {\n filter: {\n id: Object.keys(entries).map(buildEscapedRegExp),\n },\n handler(source: string) {\n if (source in entries) {\n return path.join(proxyNodeModules, source, 'index.cjs');\n }\n },\n }\n : undefined,\n };\n}\n"],"names":["externalsPlugin","buildEscapedRegExp","dependency","RegExp","replace","context","entries","getExternals","proxyModulesDir","path","resolve","dep","proxy","Object","pkgDir","join","fs","mkdirSync","recursive","writeFileSync","JSON","stringify","name","main","proxyNodeModules","isProduction","build","enforce","config","undefined","alias","keys","map","find","replacement","optimizeDeps","include","resolveId","filter","id","handler","source"],"mappings":";;;;+BAuCgBA;;;eAAAA;;;2DAvCD;6DACE;sBAE0B;;;;;;AAE3C,oEAAoE,GACpE,MAAMC,qBAAqB,CAACC,aACxB,IAAIC,OAAO,CAAC,CAAC,EAAED,WAAWE,OAAO,CAAC,OAAO,OAAO,CAAC,CAAC;AAgC/C,SAASJ,gBAAgBK,OAAqB;IACjD,MAAMC,UAAUC,IAAAA,kBAAY,EAACF;IAC7B,IAAI,CAACC,SAAS;QACV;IACJ;IAEA,MAAME,kBAAkBC,aAAI,CAACC,OAAO,CAAC,gBAAgB,YAAY;IACjE,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOP,OAAO,CAACA,SAAU;QAChD,MAAMQ,SAASL,aAAI,CAACM,IAAI,CAACP,iBAAiB,gBAAgBG;QAC1DK,WAAE,CAACC,SAAS,CAACH,QAAQ;YAAEI,WAAW;QAAK;QACvCF,WAAE,CAACG,aAAa,CAACV,aAAI,CAACM,IAAI,CAACD,QAAQ,cAAc,CAAC,iBAAiB,EAAEF,MAAM,CAAC,CAAC;QAC7EI,WAAE,CAACG,aAAa,CACZV,aAAI,CAACM,IAAI,CAACD,QAAQ,iBAClBM,KAAKC,SAAS,CAAC;YAAEC,MAAMX;YAAKY,MAAM;QAAc;IAExD;IAEA,MAAMC,mBAAmBf,aAAI,CAACM,IAAI,CAACP,iBAAiB;IAEpD,MAAM,EAAEiB,YAAY,EAAE,GAAGpB,QAAQqB,KAAK;IAEtC,OAAO;QACHJ,MAAM;QACNK,SAAS;QACTC,QAAQH,eACFI,YACA,IAAO,CAAA;gBACHnB,SAAS;oBACLoB,OAAOjB,OAAOkB,IAAI,CAACzB,SAAS0B,GAAG,CAACrB,CAAAA,MAAQ,CAAA;4BACpCsB,MAAMhC,mBAAmBU;4BACzBuB,aAAazB,aAAI,CAACM,IAAI,CAACS,kBAAkBb;wBAC7C,CAAA;gBACJ;gBACAwB,cAAc;oBACVC,SAASvB,OAAOkB,IAAI,CAACzB;gBACzB;YACJ,CAAA;QACN+B,WAAWZ,eACL;YACIa,QAAQ;gBACJC,IAAI1B,OAAOkB,IAAI,CAACzB,SAAS0B,GAAG,CAAC/B;YACjC;YACAuC,SAAQC,MAAc;gBAClB,IAAIA,UAAUnC,SAAS;oBACnB,OAAOG,aAAI,CAACM,IAAI,CAACS,kBAAkBiB,QAAQ;gBAC/C;YACJ;QACJ,IACAZ;IACV;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"html-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/html-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAoF5D"}
1
+ {"version":3,"file":"html-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/html-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAsF5D"}
@@ -19,7 +19,7 @@ function _interop_require_default(obj) {
19
19
  }
20
20
  function htmlPlugin(context) {
21
21
  const { name, isProduction } = context.build;
22
- const { isWebComponent } = context.package;
22
+ const { isWebComponent, destination } = context.package;
23
23
  const { css, js } = (0, _core.getSharedEntryPoints)(context);
24
24
  const { pluginOverrides } = context.bundlerConfig;
25
25
  const htmlTemplatePath = resolveTemplatePath(context);
@@ -37,7 +37,8 @@ function htmlPlugin(context) {
37
37
  js,
38
38
  isProduction,
39
39
  isWebComponent,
40
- name
40
+ name,
41
+ tsOutDir: destination
41
42
  });
42
43
  }
43
44
  /*
@@ -51,7 +52,7 @@ function htmlPlugin(context) {
51
52
  */ const INDEX_HTML = 'index.html';
52
53
  const VIRTUAL_HTML_PATH = _path.default.resolve(INDEX_HTML);
53
54
  return {
54
- name: 'html',
55
+ name: 'st:html',
55
56
  /*
56
57
  * Auto-detect favicon.ico in vite's publicDir so projects following
57
58
  * the convention get a working favicon link without explicit config.
@@ -72,6 +73,7 @@ function htmlPlugin(context) {
72
73
  }
73
74
  let html = renderHtml();
74
75
  html = await server.transformIndexHtml(req.url, html);
76
+ res.setHeader('Content-Type', 'text/html');
75
77
  res.end(html);
76
78
  });
77
79
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/html-plugin.ts"],"sourcesContent":["import { Eta } from 'eta';\nimport fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { getSharedEntryPoints } from '../../core';\nimport { ViteBuildContext } from '../types';\n\nexport function htmlPlugin(context: ViteBuildContext): Plugin {\n const { name, isProduction } = context.build;\n const { isWebComponent } = context.package;\n const { css, js } = getSharedEntryPoints(context);\n const { pluginOverrides } = context.bundlerConfig;\n\n const htmlTemplatePath = resolveTemplatePath(context);\n\n const eta = new Eta({ views: path.dirname(htmlTemplatePath) });\n\n let detectedFavicon: string | undefined;\n\n function renderHtml() {\n return eta.render(path.basename(htmlTemplatePath), {\n title: pluginOverrides.html?.title ?? 'ServiceTitan',\n favicon: pluginOverrides.html?.favicon ?? detectedFavicon,\n css,\n js,\n isProduction,\n isWebComponent,\n name,\n });\n }\n\n /*\n * Virtual entry point for the HTML module. The file doesn't exist on disk —\n * resolveId claims this path and load returns Eta-rendered HTML.\n *\n * Uses an absolute path (e.g., /path/to/project/index.html) instead of a\n * synthetic prefix because Vite resolves asset references in HTML (favicon,\n * CSS links) relative to the HTML file's directory. A non-filesystem path\n * would break those references.\n */\n const INDEX_HTML = 'index.html';\n const VIRTUAL_HTML_PATH = path.resolve(INDEX_HTML);\n\n return {\n name: 'html',\n /*\n * Auto-detect favicon.ico in vite's publicDir so projects following\n * the convention get a working favicon link without explicit config.\n */\n configResolved(config) {\n if (config.publicDir && fs.existsSync(path.join(config.publicDir, 'favicon.ico'))) {\n detectedFavicon = '/favicon.ico';\n }\n },\n /*\n * Dev server serves HTML via middleware (load is not called in dev mode).\n * Returns a callback so middleware registers after Vite's built-in middleware.\n */\n configureServer(server) {\n return () => {\n server.middlewares.use(async (req, res, next) => {\n if (!req.url?.endsWith(INDEX_HTML)) {\n return next();\n }\n let html = renderHtml();\n html = await server.transformIndexHtml(req.url, html);\n res.end(html);\n });\n };\n },\n resolveId(source: string, importer: string | undefined) {\n /*\n * Claim the HTML entry so Vite doesn't look for it on disk (it's virtual, rendered by Eta).\n * Only needed for production builds — dev mode serves HTML via configureServer middleware.\n */\n if (source === VIRTUAL_HTML_PATH) {\n return VIRTUAL_HTML_PATH;\n }\n if (importer?.includes(INDEX_HTML) && source.startsWith('.')) {\n const resolved = path.resolve(source + '.js');\n if (fs.existsSync(resolved)) {\n return resolved;\n }\n }\n },\n load(id: string) {\n if (id === VIRTUAL_HTML_PATH) {\n return renderHtml();\n }\n },\n };\n}\n\n/*\n * Resolve the HTML template, mirroring webpack HtmlWebpackPlugin's \"auto\" default:\n * an explicit override wins, then a project template (index.ejs, then index.html)\n * under the package source directory, then the built-in template. Eta renders .ejs\n * and .html identically, so the extension is a convention, not a syntax switch.\n */\nfunction resolveTemplatePath(context: ViteBuildContext): string {\n const { template } = context.bundlerConfig.pluginOverrides.html ?? {};\n if (template) {\n return path.resolve(template);\n }\n\n const projectTemplate = ['index.ejs', 'index.html']\n .map(file => path.resolve(context.package.source, file))\n .find(file => fs.existsSync(file));\n\n return projectTemplate ?? path.resolve(__dirname, '../index.html');\n}\n"],"names":["htmlPlugin","context","name","isProduction","build","isWebComponent","package","css","js","getSharedEntryPoints","pluginOverrides","bundlerConfig","htmlTemplatePath","resolveTemplatePath","eta","Eta","views","path","dirname","detectedFavicon","renderHtml","render","basename","title","html","favicon","INDEX_HTML","VIRTUAL_HTML_PATH","resolve","configResolved","config","publicDir","fs","existsSync","join","configureServer","server","middlewares","use","req","res","next","url","endsWith","transformIndexHtml","end","resolveId","source","importer","includes","startsWith","resolved","load","id","template","projectTemplate","map","file","find","__dirname"],"mappings":";;;;+BAOgBA;;;eAAAA;;;qBAPI;2DACL;6DACE;sBAEoB;;;;;;AAG9B,SAASA,WAAWC,OAAyB;IAChD,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGF,QAAQG,KAAK;IAC5C,MAAM,EAAEC,cAAc,EAAE,GAAGJ,QAAQK,OAAO;IAC1C,MAAM,EAAEC,GAAG,EAAEC,EAAE,EAAE,GAAGC,IAAAA,0BAAoB,EAACR;IACzC,MAAM,EAAES,eAAe,EAAE,GAAGT,QAAQU,aAAa;IAEjD,MAAMC,mBAAmBC,oBAAoBZ;IAE7C,MAAMa,MAAM,IAAIC,QAAG,CAAC;QAAEC,OAAOC,aAAI,CAACC,OAAO,CAACN;IAAkB;IAE5D,IAAIO;IAEJ,SAASC;;YAEMV,uBACEA;QAFb,OAAOI,IAAIO,MAAM,CAACJ,aAAI,CAACK,QAAQ,CAACV,mBAAmB;YAC/CW,KAAK,WAAEb,wBAAAA,gBAAgBc,IAAI,cAApBd,4CAAAA,sBAAsBa,KAAK,uCAAI;YACtCE,OAAO,YAAEf,yBAAAA,gBAAgBc,IAAI,cAApBd,6CAAAA,uBAAsBe,OAAO,yCAAIN;YAC1CZ;YACAC;YACAL;YACAE;YACAH;QACJ;IACJ;IAEA;;;;;;;;KAQC,GACD,MAAMwB,aAAa;IACnB,MAAMC,oBAAoBV,aAAI,CAACW,OAAO,CAACF;IAEvC,OAAO;QACHxB,MAAM;QACN;;;SAGC,GACD2B,gBAAeC,MAAM;YACjB,IAAIA,OAAOC,SAAS,IAAIC,WAAE,CAACC,UAAU,CAAChB,aAAI,CAACiB,IAAI,CAACJ,OAAOC,SAAS,EAAE,iBAAiB;gBAC/EZ,kBAAkB;YACtB;QACJ;QACA;;;SAGC,GACDgB,iBAAgBC,MAAM;YAClB,OAAO;gBACHA,OAAOC,WAAW,CAACC,GAAG,CAAC,OAAOC,KAAKC,KAAKC;wBAC/BF;oBAAL,IAAI,GAACA,WAAAA,IAAIG,GAAG,cAAPH,+BAAAA,SAASI,QAAQ,CAACjB,cAAa;wBAChC,OAAOe;oBACX;oBACA,IAAIjB,OAAOJ;oBACXI,OAAO,MAAMY,OAAOQ,kBAAkB,CAACL,IAAIG,GAAG,EAAElB;oBAChDgB,IAAIK,GAAG,CAACrB;gBACZ;YACJ;QACJ;QACAsB,WAAUC,MAAc,EAAEC,QAA4B;YAClD;;;aAGC,GACD,IAAID,WAAWpB,mBAAmB;gBAC9B,OAAOA;YACX;YACA,IAAIqB,CAAAA,qBAAAA,+BAAAA,SAAUC,QAAQ,CAACvB,gBAAeqB,OAAOG,UAAU,CAAC,MAAM;gBAC1D,MAAMC,WAAWlC,aAAI,CAACW,OAAO,CAACmB,SAAS;gBACvC,IAAIf,WAAE,CAACC,UAAU,CAACkB,WAAW;oBACzB,OAAOA;gBACX;YACJ;QACJ;QACAC,MAAKC,EAAU;YACX,IAAIA,OAAO1B,mBAAmB;gBAC1B,OAAOP;YACX;QACJ;IACJ;AACJ;AAEA;;;;;CAKC,GACD,SAASP,oBAAoBZ,OAAyB;QAC7BA;IAArB,MAAM,EAAEqD,QAAQ,EAAE,IAAGrD,8CAAAA,QAAQU,aAAa,CAACD,eAAe,CAACc,IAAI,cAA1CvB,yDAAAA,8CAA8C,CAAC;IACpE,IAAIqD,UAAU;QACV,OAAOrC,aAAI,CAACW,OAAO,CAAC0B;IACxB;IAEA,MAAMC,kBAAkB;QAAC;QAAa;KAAa,CAC9CC,GAAG,CAACC,CAAAA,OAAQxC,aAAI,CAACW,OAAO,CAAC3B,QAAQK,OAAO,CAACyC,MAAM,EAAEU,OACjDC,IAAI,CAACD,CAAAA,OAAQzB,WAAE,CAACC,UAAU,CAACwB;IAEhC,OAAOF,4BAAAA,6BAAAA,kBAAmBtC,aAAI,CAACW,OAAO,CAAC+B,WAAW;AACtD"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/html-plugin.ts"],"sourcesContent":["import { Eta } from 'eta';\nimport fs from 'fs';\nimport path from 'path';\nimport type { Plugin } from 'vite';\nimport { getSharedEntryPoints } from '../../core';\nimport { ViteBuildContext } from '../types';\n\nexport function htmlPlugin(context: ViteBuildContext): Plugin {\n const { name, isProduction } = context.build;\n const { isWebComponent, destination } = context.package;\n const { css, js } = getSharedEntryPoints(context);\n const { pluginOverrides } = context.bundlerConfig;\n\n const htmlTemplatePath = resolveTemplatePath(context);\n\n const eta = new Eta({ views: path.dirname(htmlTemplatePath) });\n\n let detectedFavicon: string | undefined;\n\n function renderHtml() {\n return eta.render(path.basename(htmlTemplatePath), {\n title: pluginOverrides.html?.title ?? 'ServiceTitan',\n favicon: pluginOverrides.html?.favicon ?? detectedFavicon,\n css,\n js,\n isProduction,\n isWebComponent,\n name,\n tsOutDir: destination,\n });\n }\n\n /*\n * Virtual entry point for the HTML module. The file doesn't exist on disk —\n * resolveId claims this path and load returns Eta-rendered HTML.\n *\n * Uses an absolute path (e.g., /path/to/project/index.html) instead of a\n * synthetic prefix because Vite resolves asset references in HTML (favicon,\n * CSS links) relative to the HTML file's directory. A non-filesystem path\n * would break those references.\n */\n const INDEX_HTML = 'index.html';\n const VIRTUAL_HTML_PATH = path.resolve(INDEX_HTML);\n\n return {\n name: 'st:html',\n /*\n * Auto-detect favicon.ico in vite's publicDir so projects following\n * the convention get a working favicon link without explicit config.\n */\n configResolved(config) {\n if (config.publicDir && fs.existsSync(path.join(config.publicDir, 'favicon.ico'))) {\n detectedFavicon = '/favicon.ico';\n }\n },\n /*\n * Dev server serves HTML via middleware (load is not called in dev mode).\n * Returns a callback so middleware registers after Vite's built-in middleware.\n */\n configureServer(server) {\n return () => {\n server.middlewares.use(async (req, res, next) => {\n if (!req.url?.endsWith(INDEX_HTML)) {\n return next();\n }\n let html = renderHtml();\n html = await server.transformIndexHtml(req.url, html);\n res.setHeader('Content-Type', 'text/html');\n res.end(html);\n });\n };\n },\n resolveId(source: string, importer: string | undefined) {\n /*\n * Claim the HTML entry so Vite doesn't look for it on disk (it's virtual, rendered by Eta).\n * Only needed for production builds — dev mode serves HTML via configureServer middleware.\n */\n if (source === VIRTUAL_HTML_PATH) {\n return VIRTUAL_HTML_PATH;\n }\n if (importer?.includes(INDEX_HTML) && source.startsWith('.')) {\n const resolved = path.resolve(source + '.js');\n if (fs.existsSync(resolved)) {\n return resolved;\n }\n }\n },\n load(id: string) {\n if (id === VIRTUAL_HTML_PATH) {\n return renderHtml();\n }\n },\n };\n}\n\n/*\n * Resolve the HTML template, mirroring webpack HtmlWebpackPlugin's \"auto\" default:\n * an explicit override wins, then a project template (index.ejs, then index.html)\n * under the package source directory, then the built-in template. Eta renders .ejs\n * and .html identically, so the extension is a convention, not a syntax switch.\n */\nfunction resolveTemplatePath(context: ViteBuildContext): string {\n const { template } = context.bundlerConfig.pluginOverrides.html ?? {};\n if (template) {\n return path.resolve(template);\n }\n\n const projectTemplate = ['index.ejs', 'index.html']\n .map(file => path.resolve(context.package.source, file))\n .find(file => fs.existsSync(file));\n\n return projectTemplate ?? path.resolve(__dirname, '../index.html');\n}\n"],"names":["htmlPlugin","context","name","isProduction","build","isWebComponent","destination","package","css","js","getSharedEntryPoints","pluginOverrides","bundlerConfig","htmlTemplatePath","resolveTemplatePath","eta","Eta","views","path","dirname","detectedFavicon","renderHtml","render","basename","title","html","favicon","tsOutDir","INDEX_HTML","VIRTUAL_HTML_PATH","resolve","configResolved","config","publicDir","fs","existsSync","join","configureServer","server","middlewares","use","req","res","next","url","endsWith","transformIndexHtml","setHeader","end","resolveId","source","importer","includes","startsWith","resolved","load","id","template","projectTemplate","map","file","find","__dirname"],"mappings":";;;;+BAOgBA;;;eAAAA;;;qBAPI;2DACL;6DACE;sBAEoB;;;;;;AAG9B,SAASA,WAAWC,OAAyB;IAChD,MAAM,EAAEC,IAAI,EAAEC,YAAY,EAAE,GAAGF,QAAQG,KAAK;IAC5C,MAAM,EAAEC,cAAc,EAAEC,WAAW,EAAE,GAAGL,QAAQM,OAAO;IACvD,MAAM,EAAEC,GAAG,EAAEC,EAAE,EAAE,GAAGC,IAAAA,0BAAoB,EAACT;IACzC,MAAM,EAAEU,eAAe,EAAE,GAAGV,QAAQW,aAAa;IAEjD,MAAMC,mBAAmBC,oBAAoBb;IAE7C,MAAMc,MAAM,IAAIC,QAAG,CAAC;QAAEC,OAAOC,aAAI,CAACC,OAAO,CAACN;IAAkB;IAE5D,IAAIO;IAEJ,SAASC;;YAEMV,uBACEA;QAFb,OAAOI,IAAIO,MAAM,CAACJ,aAAI,CAACK,QAAQ,CAACV,mBAAmB;YAC/CW,KAAK,WAAEb,wBAAAA,gBAAgBc,IAAI,cAApBd,4CAAAA,sBAAsBa,KAAK,uCAAI;YACtCE,OAAO,YAAEf,yBAAAA,gBAAgBc,IAAI,cAApBd,6CAAAA,uBAAsBe,OAAO,yCAAIN;YAC1CZ;YACAC;YACAN;YACAE;YACAH;YACAyB,UAAUrB;QACd;IACJ;IAEA;;;;;;;;KAQC,GACD,MAAMsB,aAAa;IACnB,MAAMC,oBAAoBX,aAAI,CAACY,OAAO,CAACF;IAEvC,OAAO;QACH1B,MAAM;QACN;;;SAGC,GACD6B,gBAAeC,MAAM;YACjB,IAAIA,OAAOC,SAAS,IAAIC,WAAE,CAACC,UAAU,CAACjB,aAAI,CAACkB,IAAI,CAACJ,OAAOC,SAAS,EAAE,iBAAiB;gBAC/Eb,kBAAkB;YACtB;QACJ;QACA;;;SAGC,GACDiB,iBAAgBC,MAAM;YAClB,OAAO;gBACHA,OAAOC,WAAW,CAACC,GAAG,CAAC,OAAOC,KAAKC,KAAKC;wBAC/BF;oBAAL,IAAI,GAACA,WAAAA,IAAIG,GAAG,cAAPH,+BAAAA,SAASI,QAAQ,CAACjB,cAAa;wBAChC,OAAOe;oBACX;oBACA,IAAIlB,OAAOJ;oBACXI,OAAO,MAAMa,OAAOQ,kBAAkB,CAACL,IAAIG,GAAG,EAAEnB;oBAChDiB,IAAIK,SAAS,CAAC,gBAAgB;oBAC9BL,IAAIM,GAAG,CAACvB;gBACZ;YACJ;QACJ;QACAwB,WAAUC,MAAc,EAAEC,QAA4B;YAClD;;;aAGC,GACD,IAAID,WAAWrB,mBAAmB;gBAC9B,OAAOA;YACX;YACA,IAAIsB,CAAAA,qBAAAA,+BAAAA,SAAUC,QAAQ,CAACxB,gBAAesB,OAAOG,UAAU,CAAC,MAAM;gBAC1D,MAAMC,WAAWpC,aAAI,CAACY,OAAO,CAACoB,SAAS;gBACvC,IAAIhB,WAAE,CAACC,UAAU,CAACmB,WAAW;oBACzB,OAAOA;gBACX;YACJ;QACJ;QACAC,MAAKC,EAAU;YACX,IAAIA,OAAO3B,mBAAmB;gBAC1B,OAAOR;YACX;QACJ;IACJ;AACJ;AAEA;;;;;CAKC,GACD,SAASP,oBAAoBb,OAAyB;QAC7BA;IAArB,MAAM,EAAEwD,QAAQ,EAAE,IAAGxD,8CAAAA,QAAQW,aAAa,CAACD,eAAe,CAACc,IAAI,cAA1CxB,yDAAAA,8CAA8C,CAAC;IACpE,IAAIwD,UAAU;QACV,OAAOvC,aAAI,CAACY,OAAO,CAAC2B;IACxB;IAEA,MAAMC,kBAAkB;QAAC;QAAa;KAAa,CAC9CC,GAAG,CAACC,CAAAA,OAAQ1C,aAAI,CAACY,OAAO,CAAC7B,QAAQM,OAAO,CAAC2C,MAAM,EAAEU,OACjDC,IAAI,CAACD,CAAAA,OAAQ1B,WAAE,CAACC,UAAU,CAACyB;IAEhC,OAAOF,4BAAAA,6BAAAA,kBAAmBxC,aAAI,CAACY,OAAO,CAACgC,WAAW;AACtD"}
@@ -1,7 +1,7 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import type { PackageContext } from '../../core/types';
3
- export declare const THROW_PREFIX = "\0IGNORE_THROW:";
4
- export declare const EMPTY_PREFIX = "\0IGNORE_EMPTY:";
3
+ export declare const THROW_PREFIX = "\0ignore-modules:throw:";
4
+ export declare const EMPTY_PREFIX = "\0ignore-modules:empty:";
5
5
  /**
6
6
  * Handles optional peer dependencies that are not installed.
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ignore-modules-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/ignore-modules-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAC9C,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IACzC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;CACjD,GAAG,MAAM,CA6BT"}
1
+ {"version":3,"file":"ignore-modules-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/ignore-modules-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,eAAO,MAAM,YAAY,4BAA4B,CAAC;AACtD,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IACzC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;CACjD,GAAG,MAAM,CAmCT"}
@@ -20,36 +20,48 @@ _export(exports, {
20
20
  }
21
21
  });
22
22
  const _core = require("../../core");
23
- const THROW_PREFIX = '\0IGNORE_THROW:';
24
- const EMPTY_PREFIX = '\0IGNORE_EMPTY:';
23
+ const VIRTUAL_PREFIX = '\0ignore-modules:';
24
+ const VIRTUAL_ID_PATTERN = new RegExp(`^${VIRTUAL_PREFIX}`);
25
+ const THROW_PREFIX = `${VIRTUAL_PREFIX}throw:`;
26
+ const EMPTY_PREFIX = `${VIRTUAL_PREFIX}empty:`;
25
27
  function ignoreModulesPlugin(context) {
26
28
  const checker = (0, _core.checkResource)(context);
27
29
  return {
28
- name: 'ignore-modules',
30
+ name: 'st:ignore-modules',
29
31
  enforce: 'pre',
30
- resolveId (source, importer) {
31
- if (!importer) {
32
- return;
33
- }
34
- const mode = checker({
35
- resource: source,
36
- importer
37
- });
38
- if (mode === 'throw') {
39
- return `${THROW_PREFIX}${source}`;
40
- }
41
- if (mode === 'empty') {
42
- return `${EMPTY_PREFIX}${source}`;
32
+ resolveId: {
33
+ filter: {
34
+ id: /^[@a-z]/
35
+ },
36
+ handler (source, importer) {
37
+ if (!importer) {
38
+ return;
39
+ }
40
+ const mode = checker({
41
+ resource: source,
42
+ importer
43
+ });
44
+ if (mode === 'throw') {
45
+ return `${THROW_PREFIX}${source}`;
46
+ }
47
+ if (mode === 'empty') {
48
+ return `${EMPTY_PREFIX}${source}`;
49
+ }
43
50
  }
44
51
  },
45
- load (id) {
46
- if (id.startsWith(THROW_PREFIX)) {
47
- const source = id.slice(THROW_PREFIX.length);
48
- const message = JSON.stringify(`Cannot find module '${source}'`);
49
- return `throw Object.assign(new Error(${message}), { code: 'MODULE_NOT_FOUND' });`;
50
- }
51
- if (id.startsWith(EMPTY_PREFIX)) {
52
- return 'export {};';
52
+ load: {
53
+ filter: {
54
+ id: VIRTUAL_ID_PATTERN
55
+ },
56
+ handler (id) {
57
+ if (id.startsWith(THROW_PREFIX)) {
58
+ const source = id.slice(THROW_PREFIX.length);
59
+ const message = JSON.stringify(`Cannot find module '${source}'`);
60
+ return `throw Object.assign(new Error(${message}), { code: 'MODULE_NOT_FOUND' });`;
61
+ }
62
+ if (id.startsWith(EMPTY_PREFIX)) {
63
+ return 'export {};';
64
+ }
53
65
  }
54
66
  }
55
67
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/ignore-modules-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { checkResource } from '../../core';\nimport type { PackageContext } from '../../core/types';\n\nexport const THROW_PREFIX = '\\0IGNORE_THROW:';\nexport const EMPTY_PREFIX = '\\0IGNORE_EMPTY:';\n\n/**\n * Handles optional peer dependencies that are not installed.\n *\n * @see {@link file://./../../webpack/configs/plugins/ignore-plugin/ignore-plugin.ts} for the webpack counterpart.\n *\n * 'throw' mode: substitutes a virtual module whose body throws \"Cannot find module\" on\n * evaluation. Mirrors webpack's `webpackMissingModule()` semantics. Top-level static\n * imports of the resource crash module evaluation, and `try { await import(...) } catch {}`\n * (or `try { require(...) } catch {}` in CJS code Rolldown bundles) work as expected.\n * This is the default for matched optional peers.\n *\n * 'empty' mode: substitutes a virtual module with no exports. Required for top-level\n * `import * as X from 'optional'` followed by `X.foo === undefined` detection. Opt in via\n * `cli.peerDependenciesMeta[\"pkg\"].fallback = \"empty\"` in the importer's package.json.\n */\nexport function ignoreModulesPlugin(context: {\n package: Pick<PackageContext, 'dependencies'>;\n}): Plugin {\n const checker = checkResource(context);\n\n return {\n name: 'ignore-modules',\n enforce: 'pre',\n resolveId(source, importer) {\n if (!importer) {\n return;\n }\n const mode = checker({ resource: source, importer });\n if (mode === 'throw') {\n return `${THROW_PREFIX}${source}`;\n }\n if (mode === 'empty') {\n return `${EMPTY_PREFIX}${source}`;\n }\n },\n load(id) {\n if (id.startsWith(THROW_PREFIX)) {\n const source = id.slice(THROW_PREFIX.length);\n const message = JSON.stringify(`Cannot find module '${source}'`);\n return `throw Object.assign(new Error(${message}), { code: 'MODULE_NOT_FOUND' });`;\n }\n if (id.startsWith(EMPTY_PREFIX)) {\n return 'export {};';\n }\n },\n };\n}\n"],"names":["EMPTY_PREFIX","THROW_PREFIX","ignoreModulesPlugin","context","checker","checkResource","name","enforce","resolveId","source","importer","mode","resource","load","id","startsWith","slice","length","message","JSON","stringify"],"mappings":";;;;;;;;;;;QAKaA;eAAAA;;QADAC;eAAAA;;QAkBGC;eAAAA;;;sBArBc;AAGvB,MAAMD,eAAe;AACrB,MAAMD,eAAe;AAiBrB,SAASE,oBAAoBC,OAEnC;IACG,MAAMC,UAAUC,IAAAA,mBAAa,EAACF;IAE9B,OAAO;QACHG,MAAM;QACNC,SAAS;QACTC,WAAUC,MAAM,EAAEC,QAAQ;YACtB,IAAI,CAACA,UAAU;gBACX;YACJ;YACA,MAAMC,OAAOP,QAAQ;gBAAEQ,UAAUH;gBAAQC;YAAS;YAClD,IAAIC,SAAS,SAAS;gBAClB,OAAO,GAAGV,eAAeQ,QAAQ;YACrC;YACA,IAAIE,SAAS,SAAS;gBAClB,OAAO,GAAGX,eAAeS,QAAQ;YACrC;QACJ;QACAI,MAAKC,EAAE;YACH,IAAIA,GAAGC,UAAU,CAACd,eAAe;gBAC7B,MAAMQ,SAASK,GAAGE,KAAK,CAACf,aAAagB,MAAM;gBAC3C,MAAMC,UAAUC,KAAKC,SAAS,CAAC,CAAC,oBAAoB,EAAEX,OAAO,CAAC,CAAC;gBAC/D,OAAO,CAAC,8BAA8B,EAAES,QAAQ,iCAAiC,CAAC;YACtF;YACA,IAAIJ,GAAGC,UAAU,CAACf,eAAe;gBAC7B,OAAO;YACX;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/ignore-modules-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nimport { checkResource } from '../../core';\nimport type { PackageContext } from '../../core/types';\n\nconst VIRTUAL_PREFIX = '\\0ignore-modules:';\nconst VIRTUAL_ID_PATTERN = new RegExp(`^${VIRTUAL_PREFIX}`);\n\nexport const THROW_PREFIX = `${VIRTUAL_PREFIX}throw:`;\nexport const EMPTY_PREFIX = `${VIRTUAL_PREFIX}empty:`;\n\n/**\n * Handles optional peer dependencies that are not installed.\n *\n * @see {@link file://./../../webpack/configs/plugins/ignore-plugin/ignore-plugin.ts} for the webpack counterpart.\n *\n * 'throw' mode: substitutes a virtual module whose body throws \"Cannot find module\" on\n * evaluation. Mirrors webpack's `webpackMissingModule()` semantics. Top-level static\n * imports of the resource crash module evaluation, and `try { await import(...) } catch {}`\n * (or `try { require(...) } catch {}` in CJS code Rolldown bundles) work as expected.\n * This is the default for matched optional peers.\n *\n * 'empty' mode: substitutes a virtual module with no exports. Required for top-level\n * `import * as X from 'optional'` followed by `X.foo === undefined` detection. Opt in via\n * `cli.peerDependenciesMeta[\"pkg\"].fallback = \"empty\"` in the importer's package.json.\n */\nexport function ignoreModulesPlugin(context: {\n package: Pick<PackageContext, 'dependencies'>;\n}): Plugin {\n const checker = checkResource(context);\n\n return {\n name: 'st:ignore-modules',\n enforce: 'pre',\n resolveId: {\n filter: { id: /^[@a-z]/ }, // Only bare specifiers can be optional peers\n handler(source, importer) {\n if (!importer) {\n return;\n }\n const mode = checker({ resource: source, importer });\n if (mode === 'throw') {\n return `${THROW_PREFIX}${source}`;\n }\n if (mode === 'empty') {\n return `${EMPTY_PREFIX}${source}`;\n }\n },\n },\n load: {\n filter: { id: VIRTUAL_ID_PATTERN },\n handler(id) {\n if (id.startsWith(THROW_PREFIX)) {\n const source = id.slice(THROW_PREFIX.length);\n const message = JSON.stringify(`Cannot find module '${source}'`);\n return `throw Object.assign(new Error(${message}), { code: 'MODULE_NOT_FOUND' });`;\n }\n if (id.startsWith(EMPTY_PREFIX)) {\n return 'export {};';\n }\n },\n },\n };\n}\n"],"names":["EMPTY_PREFIX","THROW_PREFIX","ignoreModulesPlugin","VIRTUAL_PREFIX","VIRTUAL_ID_PATTERN","RegExp","context","checker","checkResource","name","enforce","resolveId","filter","id","handler","source","importer","mode","resource","load","startsWith","slice","length","message","JSON","stringify"],"mappings":";;;;;;;;;;;QAQaA;eAAAA;;QADAC;eAAAA;;QAkBGC;eAAAA;;;sBAxBc;AAG9B,MAAMC,iBAAiB;AACvB,MAAMC,qBAAqB,IAAIC,OAAO,CAAC,CAAC,EAAEF,gBAAgB;AAEnD,MAAMF,eAAe,GAAGE,eAAe,MAAM,CAAC;AAC9C,MAAMH,eAAe,GAAGG,eAAe,MAAM,CAAC;AAiB9C,SAASD,oBAAoBI,OAEnC;IACG,MAAMC,UAAUC,IAAAA,mBAAa,EAACF;IAE9B,OAAO;QACHG,MAAM;QACNC,SAAS;QACTC,WAAW;YACPC,QAAQ;gBAAEC,IAAI;YAAU;YACxBC,SAAQC,MAAM,EAAEC,QAAQ;gBACpB,IAAI,CAACA,UAAU;oBACX;gBACJ;gBACA,MAAMC,OAAOV,QAAQ;oBAAEW,UAAUH;oBAAQC;gBAAS;gBAClD,IAAIC,SAAS,SAAS;oBAClB,OAAO,GAAGhB,eAAec,QAAQ;gBACrC;gBACA,IAAIE,SAAS,SAAS;oBAClB,OAAO,GAAGjB,eAAee,QAAQ;gBACrC;YACJ;QACJ;QACAI,MAAM;YACFP,QAAQ;gBAAEC,IAAIT;YAAmB;YACjCU,SAAQD,EAAE;gBACN,IAAIA,GAAGO,UAAU,CAACnB,eAAe;oBAC7B,MAAMc,SAASF,GAAGQ,KAAK,CAACpB,aAAaqB,MAAM;oBAC3C,MAAMC,UAAUC,KAAKC,SAAS,CAAC,CAAC,oBAAoB,EAAEV,OAAO,CAAC,CAAC;oBAC/D,OAAO,CAAC,8BAA8B,EAAEQ,QAAQ,iCAAiC,CAAC;gBACtF;gBACA,IAAIV,GAAGO,UAAU,CAACpB,eAAe;oBAC7B,OAAO;gBACX;YACJ;QACJ;IACJ;AACJ"}
@@ -8,10 +8,13 @@ export * from './externals-plugin';
8
8
  export * from './html-plugin';
9
9
  export * from './ignore-modules-plugin';
10
10
  export * from './istanbul-plugin';
11
+ export * from './less-tilde-plugin';
11
12
  export * from './magic-comments-plugin';
12
13
  export * from './metadata-plugin';
13
14
  export * from './moment-locales-plugin';
15
+ export * from './react-refresh-plugin';
14
16
  export * from './style-urls-plugin';
15
17
  export * from './svgr-plugin';
16
18
  export * from './virtual-modules-plugin';
19
+ export * from './window-externals-plugin';
17
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
@@ -12,12 +12,15 @@ _export_star(require("./externals-plugin"), exports);
12
12
  _export_star(require("./html-plugin"), exports);
13
13
  _export_star(require("./ignore-modules-plugin"), exports);
14
14
  _export_star(require("./istanbul-plugin"), exports);
15
+ _export_star(require("./less-tilde-plugin"), exports);
15
16
  _export_star(require("./magic-comments-plugin"), exports);
16
17
  _export_star(require("./metadata-plugin"), exports);
17
18
  _export_star(require("./moment-locales-plugin"), exports);
19
+ _export_star(require("./react-refresh-plugin"), exports);
18
20
  _export_star(require("./style-urls-plugin"), exports);
19
21
  _export_star(require("./svgr-plugin"), exports);
20
22
  _export_star(require("./virtual-modules-plugin"), exports);
23
+ _export_star(require("./window-externals-plugin"), exports);
21
24
  function _export_star(from, to) {
22
25
  Object.keys(from).forEach(function(k) {
23
26
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/plugins/index.ts"],"sourcesContent":["export * from './bundle-stat-plugin';\nexport * from './chain-source-maps-plugin';\nexport * from './clean-plugin';\nexport * from './css-injector-plugin';\nexport * from './design-system-guard-plugin';\nexport * from './dev-server-routing-plugin';\nexport * from './externals-plugin';\nexport * from './html-plugin';\nexport * from './ignore-modules-plugin';\nexport * from './istanbul-plugin';\nexport * from './magic-comments-plugin';\nexport * from './metadata-plugin';\nexport * from './moment-locales-plugin';\nexport * from './style-urls-plugin';\nexport * from './svgr-plugin';\nexport * from './virtual-modules-plugin';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../../src/vite/plugins/index.ts"],"sourcesContent":["export * from './bundle-stat-plugin';\nexport * from './chain-source-maps-plugin';\nexport * from './clean-plugin';\nexport * from './css-injector-plugin';\nexport * from './design-system-guard-plugin';\nexport * from './dev-server-routing-plugin';\nexport * from './externals-plugin';\nexport * from './html-plugin';\nexport * from './ignore-modules-plugin';\nexport * from './istanbul-plugin';\nexport * from './less-tilde-plugin';\nexport * from './magic-comments-plugin';\nexport * from './metadata-plugin';\nexport * from './moment-locales-plugin';\nexport * from './react-refresh-plugin';\nexport * from './style-urls-plugin';\nexport * from './svgr-plugin';\nexport * from './virtual-modules-plugin';\nexport * from './window-externals-plugin';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"istanbul-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/istanbul-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAcrF"}
1
+ {"version":3,"file":"istanbul-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/istanbul-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAkBrF"}