ts_vite.conf 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_VIT"}
  39. ### @usage: TS_VITE([name])
  40. ###
  41. ### The Vite bundle, bundles JavaScript code.
  42. ### Build results are packed as `output.tar`.
  43. ###
  44. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_VITE
  45. ###
  46. ### @example
  47. ###
  48. ### TS_VITE()
  49. ### END()
  50. ###
  51. multimodule TS_VITE {
  52. module BUILD: _TS_BASE_UNIT {
  53. .CMD=TS_VITE_CMD
  54. .EPILOGUE=_TS_CONFIG_EPILOGUE
  55. .PEERDIRSELF=TS_PREPARE_DEPS
  56. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  57. # but we have to set it to TS for include processor to work
  58. SET(MODULE_TAG TS)
  59. SET(MODULE_LANG TS)
  60. _PEERDIR_TS_RESOURCE(vite)
  61. DISABLE(TS_CONFIG_DEDUCE_OUT)
  62. DISABLE(TS_CONFIG_USE_OUTDIR)
  63. _TS_CONFIGURE()
  64. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
  65. _TS_ADD_NODE_MODULES_FOR_BUILDER()
  66. }
  67. module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
  68. }
  69. }