ts_vite.conf 2.0 KB

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