ts_vite.conf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. VITE_OUTPUT_DIR=dist
  2. VITE_CONFIG_PATH=vite.config.ts
  3. TS_VITE_CMD=$TOUCH_UNIT \
  4. && $_TS_FILES_COPY_CMD \
  5. && $ADD_VCS_INFO_FILE_CMD \
  6. && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-vite $NOTS_TOOL_COMMON_BUILDER_ARGS \
  7. --bundler-config-path ${input:VITE_CONFIG_PATH} \
  8. --output-dir ${VITE_OUTPUT_DIR} \
  9. $_NODE_MODULES_INOUTS ${hide:PEERS} \
  10. ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
  11. ${output;hide:"package.json"} \
  12. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_VIT"}
  13. ### @usage: VITE_OUTPUT(DirName)
  14. ###
  15. ### Macro sets the output directory name for TS_VITE module.
  16. ###
  17. ### - DirName - output directory name ("dist" by default).
  18. macro VITE_OUTPUT(DirName) {
  19. SET(VITE_OUTPUT_DIR $DirName)
  20. }
  21. ### @usage: TS_VITE([name])
  22. ###
  23. ### The Vite bundle, bundles JavaScript code.
  24. ### Build results are packed as `output.tar`.
  25. ###
  26. ### @example
  27. ###
  28. ### TS_VITE()
  29. ### END()
  30. ###
  31. multimodule TS_VITE {
  32. module BUILD: _TS_BASE_UNIT {
  33. .CMD=TS_VITE_CMD
  34. .EPILOGUE=_TS_CONFIG_EPILOGUE
  35. .PEERDIRSELF=TS_PREPARE_DEPS
  36. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  37. # but we have to set it to TS for include processor to work
  38. SET(MODULE_TAG TS)
  39. _PEERDIR_TS_RESOURCE(vite)
  40. DISABLE(TS_CONFIG_DEDUCE_OUT)
  41. DISABLE(TS_CONFIG_USE_OUTDIR)
  42. _TS_CONFIGURE($TS_CONFIG_PATH)
  43. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
  44. _TS_ADD_NODE_MODULES_FOR_BUILDER()
  45. }
  46. module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
  47. }
  48. }