Skip to content

Commit c9ad3d7

Browse files
author
baymer
committed
Добавить rspack в nots/builder
commit_hash:a3b2cbab2da298600b67260d8980965bf808e453
1 parent 5ff916b commit c9ad3d7

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

build/conf/ts/ts.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ macro RUN_JAVASCRIPT(JS_SCRIPT, OUTDIR="", IN{input}[], ARGS...) {
256256
@import "${CONF_ROOT}/conf/ts/ts_next.conf"
257257
@import "${CONF_ROOT}/conf/ts/ts_package.conf"
258258
@import "${CONF_ROOT}/conf/ts/ts_proto.conf"
259+
@import "${CONF_ROOT}/conf/ts/ts_rspack.conf"
259260
@import "${CONF_ROOT}/conf/ts/ts_test.conf"
260261
@import "${CONF_ROOT}/conf/ts/ts_tsc.conf"
261262
@import "${CONF_ROOT}/conf/ts/ts_vite.conf"

build/conf/ts/ts_rspack.conf

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
RSPACK_CONFIG_PATH=rspack.config.js
2+
3+
### @usage: TS_RSPACK_CONFIG(ConfigPath)
4+
###
5+
### Macro sets the config path for TS_RSPACK module.
6+
###
7+
### - ConfigPath - config path
8+
###
9+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_RSPACK#ts-rspack-config
10+
macro TS_RSPACK_CONFIG(ConfigPath) {
11+
SET(RSPACK_CONFIG_PATH $ConfigPath)
12+
}
13+
14+
RSPACK_OUTPUT_DIR=bundle
15+
16+
### @usage: TS_RSPACK_OUTPUT(FirstDirName DirNames)
17+
###
18+
### Macro sets the output directory names (one at least) for TS_RSPACK module.
19+
###
20+
### - DirNames - output directory names (one at least)
21+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_RSPACK#ts-rspack-output
22+
macro TS_RSPACK_OUTPUT(FirstDirName, DirNames...) {
23+
SET(RSPACK_OUTPUT_DIR $FirstDirName $DirNames)
24+
}
25+
26+
TS_RSPACK_CMD=$_TS_PROJECT_SETUP_CMD \
27+
&& $ADD_VCS_INFO_FILE_CMD \
28+
&& $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-rspack $NOTS_TOOL_COMMON_BUILDER_ARGS \
29+
--bundler-config-path ${input:RSPACK_CONFIG_PATH} \
30+
--output-dirs ${RSPACK_OUTPUT_DIR} \
31+
$_NODE_MODULES_INOUTS $_TS_FILES_INOUTS ${hide:PEERS} \
32+
${hide;input:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
33+
${hide;output:"package.json"} \
34+
${hide;kv:"pc magenta"} ${hide;kv:"p TS_RSPK"}
35+
36+
### @usage: TS_RSPACK([name])
37+
###
38+
### The Rspack bundle, bundles JavaScript code.
39+
### Build results are packed as `<module_name>.output.tar`.
40+
###
41+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_RSPACK
42+
###
43+
### @example
44+
###
45+
### TS_RSPACK()
46+
### END()
47+
###
48+
multimodule TS_RSPACK {
49+
module BUILD: _TS_BASE_UNIT {
50+
.CMD=TS_RSPACK_CMD
51+
.SEM=_SEM_IGNORED
52+
.EPILOGUE=_TS_CONFIG_EPILOGUE
53+
.PEERDIRSELF=TS_PREPARE_DEPS
54+
55+
# by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
56+
# but we have to set it to TS for include processor to work
57+
SET(MODULE_TAG TS)
58+
SET(MODULE_LANG TS)
59+
60+
_PEERDIR_TS_RESOURCE(@rspack/cli @rspack/core)
61+
62+
DISABLE(TS_CONFIG_DEDUCE_OUT)
63+
DISABLE(TS_CONFIG_USE_OUTDIR)
64+
65+
_TS_CONFIGURE()
66+
67+
SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
68+
_TS_ADD_NODE_MODULES_FOR_BUILDER()
69+
}
70+
71+
module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
72+
73+
}
74+
}

0 commit comments

Comments
 (0)