ts_vite.conf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. VITE_CONFIG_PATH=vite.config.ts
  2. ### @usage: TS_VITE_CONFIG(ConfigPath)
  3. ###
  4. ### Macro sets the config path for TS_VITE module.
  5. ###
  6. ### - ConfigPath - config path
  7. ###
  8. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_VITE#ts-vite-config
  9. macro TS_VITE_CONFIG(ConfigPath) {
  10. SET(VITE_CONFIG_PATH $ConfigPath)
  11. }
  12. VITE_OUTPUT_DIR=dist
  13. ### @usage: TS_VITE_OUTPUT(DirName)
  14. ###
  15. ### Macro sets the output directory name for TS_VITE module.
  16. ###
  17. ### - DirName - output directory name
  18. ###
  19. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_VITE#ts-vite-output
  20. macro TS_VITE_OUTPUT(DirName) {
  21. SET(VITE_OUTPUT_DIR $DirName)
  22. }
  23. # TODO: remove me: https://st.yandex-team.ru/FBP-1678
  24. # tag:deprecated
  25. macro VITE_OUTPUT(DirName) {
  26. MESSAGE(WARNING "VITE_OUTPUT is deprecated, use TS_VITE_OUTPUT instead")
  27. SET(VITE_OUTPUT_DIR $DirName)
  28. }
  29. TS_VITE_CMD=$TOUCH_UNIT \
  30. && $_TS_FILES_COPY_CMD \
  31. && $ADD_VCS_INFO_FILE_CMD \
  32. && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-vite $NOTS_TOOL_COMMON_BUILDER_ARGS \
  33. --bundler-config-path ${input:VITE_CONFIG_PATH} \
  34. --output-dirs ${VITE_OUTPUT_DIR} \
  35. $_NODE_MODULES_INOUTS ${hide:PEERS} \
  36. ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
  37. ${output;hide:"package.json"} \
  38. ${requirements;hide:"cpu:2"} \
  39. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_VIT"}
  40. ### @usage: TS_VITE([name])
  41. ###
  42. ### The Vite bundle, bundles JavaScript code.
  43. ### Build results are packed as `output.tar`.
  44. ###
  45. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_VITE
  46. ###
  47. ### @example
  48. ###
  49. ### TS_VITE()
  50. ### END()
  51. ###
  52. multimodule TS_VITE {
  53. module BUILD: _TS_BASE_UNIT {
  54. .CMD=TS_VITE_CMD
  55. .EPILOGUE=_TS_CONFIG_EPILOGUE
  56. .PEERDIRSELF=TS_PREPARE_DEPS
  57. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  58. # but we have to set it to TS for include processor to work
  59. SET(MODULE_TAG TS)
  60. SET(MODULE_LANG TS)
  61. _PEERDIR_TS_RESOURCE(vite)
  62. DISABLE(TS_CONFIG_DEDUCE_OUT)
  63. DISABLE(TS_CONFIG_USE_OUTDIR)
  64. _TS_CONFIGURE()
  65. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
  66. _TS_ADD_NODE_MODULES_FOR_BUILDER()
  67. }
  68. module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
  69. }
  70. }