aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf/ts
diff options
context:
space:
mode:
authorzaverden <zaverden@yandex-team.com>2024-02-08 07:21:59 +0300
committerzaverden <zaverden@yandex-team.com>2024-02-08 07:43:17 +0300
commit2f1f3d1ad61ece4b0804ebe4bf346c69b20e2751 (patch)
treeccb0e6732c18c7361f0b6adc79b66d55472fa2a2 /build/conf/ts
parentdcf4fb9ddcc3669785108fba005e532001fdfe58 (diff)
downloadydb-2f1f3d1ad61ece4b0804ebe4bf346c69b20e2751.tar.gz
feat(conf): move nots from internal
Diffstat (limited to 'build/conf/ts')
-rw-r--r--build/conf/ts/node_modules.conf113
-rw-r--r--build/conf/ts/ts.conf125
-rw-r--r--build/conf/ts/ts_next.conf59
-rw-r--r--build/conf/ts/ts_package.conf36
-rw-r--r--build/conf/ts/ts_test.conf159
-rw-r--r--build/conf/ts/ts_tsc.conf49
-rw-r--r--build/conf/ts/ts_vite.conf63
-rw-r--r--build/conf/ts/ts_webpack.conf62
8 files changed, 666 insertions, 0 deletions
diff --git a/build/conf/ts/node_modules.conf b/build/conf/ts/node_modules.conf
new file mode 100644
index 0000000000..dd4aaaf0e4
--- /dev/null
+++ b/build/conf/ts/node_modules.conf
@@ -0,0 +1,113 @@
+PNPM_ROOT=
+PNPM_SCRIPT=$PNPM_ROOT/node_modules/pnpm/dist/pnpm.cjs
+NPM_CONTRIBS_PATH=contrib/typescript
+# inputs list, just paths, deprecated (use _NODE_MODULES_INOUTS instead), used only for eslint/jest/hermione
+_NODE_MODULES_INS=
+# outputs list, just paths, deprecated (use _NODE_MODULES_INOUTS instead), used only for eslint/jest/hermione
+_NODE_MODULES_OUTS=
+# combined input/outputs records as list of directives ${input;hide:<path>} ${output;hide:<path>}, used in builders
+_NODE_MODULES_INOUTS=
+_YATOOL_PREBUILDER_ARG=
+
+# TOUCH_UNIT is required to create module identity file.
+# We can "call" macro as `$_GET_NODE_MODULES_INS_OUTS(...)`. in this case we will get .CMD from it.
+# This is the only way to process a variable data as an array.
+# ${output;hide:_NODE_MODULES_OUTS} does not produce list of paths, but a single value (space-separeted paths)
+_NODE_MODULES_CMD=$TOUCH_UNIT \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS create-node-modules \
+ $_GET_NODE_MODULES_INS_OUTS(IN $_NODE_MODULES_INS OUT $_NODE_MODULES_OUTS) \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_NM"}
+
+
+module _NODE_MODULES_BASE: _BARE_UNIT {
+ .CMD=_NODE_MODULES_CMD
+ # ignore SRCS macro, use TS_FILES instead of FILES
+ .ALIASES=SRCS=_NOOP_MACRO FILES=TS_FILES
+ # Propagates peers to related modules
+ .PEERDIR_POLICY=as_build_from
+ .NODE_TYPE=Bundle
+
+ # TODO: remove this. YMAKE-1096 / FBP-1184
+ _NEVERCACHE()
+
+ # we have several modules in the same dir (.PEERDIRSELF=NODE_MODULES in BUILD)
+ # we need different names for module identity file
+ # .fake tells builder to not materialize it in results
+ SET(MODULE_SUFFIX .n_m.fake)
+ # .NODE_TYPE=Bundle is required for peers propagation, but it also affects
+ # how merging of pic/nopic graphs. Here we can override this merging behaviour
+ SET(MODULE_TYPE LIBRARY)
+ # define own tag
+ SET(MODULE_TAG NODE_MODULES)
+ # what modules it can PEERDIR to
+ SET(PEERDIR_TAGS TS NPM_CONTRIBS)
+ # do not include it into "results" of graph
+ DISABLE(START_TARGET)
+
+ # we read package.json and erm-packages.json during configuration
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/pnpm-lock.yaml ${CURDIR}/package.json ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH)
+
+ PEERDIR($NPM_CONTRIBS_PATH)
+ # PEERDIR to the right version of nodejs and pnpm
+ _PEERDIR_TS_RESOURCE(nodejs pnpm)
+
+ # run py logic
+ _NODE_MODULES_CONFIGURE()
+}
+
+# called in on_node_modules_configure
+macro _SET_NODE_MODULES_INS_OUTS(IN{input}[], OUT{output}[]) {
+ SET(_NODE_MODULES_INS $IN)
+ SET(_NODE_MODULES_OUTS $OUT)
+}
+
+macro _GET_NODE_MODULES_INS_OUTS(IN{input}[], OUT{output}[]) {
+ .CMD=${input;hide:IN} ${output;hide:OUT}
+}
+
+
+### @usage: NPM_CONTRIBS() # internal
+###
+### Defines special module that provides contrib tarballs from internal npm registry.
+###
+### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES)
+module NPM_CONTRIBS: _BARE_UNIT {
+ .CMD=TOUCH_UNIT
+ .PEERDIR_POLICY=as_build_from
+ .FINAL_TARGET=no
+ .ALLOWED=FROM_NPM_LOCKFILES
+ .RESTRICTED=PEERDIR
+ .EXTS=_ # Ignore all files, so module is not affected by FROM_NPM output (.EXTS=* is inherited from _BARE_UNIT)
+
+ SET(MODULE_TAG NPM_CONTRIBS)
+
+ # .fake tells builder to not materialize it in results
+ SET(MODULE_SUFFIX .fake)
+}
+
+### @usage: FROM_NPM_LOCKFILES(LOCKFILES...) # internal
+###
+### Defines lockfile list for `NPM_CONTRIBS` module.
+###
+### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS)
+macro FROM_NPM_LOCKFILES(LOCKFILES...) {
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $LOCKFILES)
+ # See implementation in build/plugins/nots.py
+ _FROM_NPM_LOCKFILES($LOCKFILES)
+}
+
+FROM_NPM_CWD=$ARCADIA_BUILD_ROOT/$NPM_CONTRIBS_PATH
+macro _FROM_NPM(TARBALL_URL, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) {
+ .CMD=${cwd:FROM_NPM_CWD} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --tarball-url $TARBALL_URL --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output;noauto:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p TS_FNPM"} ${kv;hide:"pc magenta"}
+ # we want output to be available for other modules without affecting NPM_CONTRIBS
+ # we need to expose it (some details in https://st.yandex-team.ru/YMAKE-34)
+ _EXPOSE($TARBALL_PATH)
+}
+
+macro _TS_ADD_NODE_MODULES_FOR_BUILDER() {
+ # Provide downloaded dependencies in `/contrib/typescript/-`
+ PEERDIR($NPM_CONTRIBS_PATH)
+
+ # Calculate inputs and outputs of node_modules, fill `_NODE_MODULES_INOUTS` variable
+ _NODE_MODULES_CONFIGURE()
+}
diff --git a/build/conf/ts/ts.conf b/build/conf/ts/ts.conf
new file mode 100644
index 0000000000..bd8e45cd81
--- /dev/null
+++ b/build/conf/ts/ts.conf
@@ -0,0 +1,125 @@
+NODEJS_ROOT=
+NODEJS_BIN=$NODEJS_ROOT/node
+
+TS_TRACE=no
+TS_LOCAL_CLI=no
+# Use outdir defined in tsconfig
+TS_CONFIG_USE_OUTDIR=
+
+NOTS_TOOL=${tool:"devtools/frontend_build_platform/nots/builder"}
+
+# Arguments for the all commands of the `nots/builder`, passed before the command
+NOTS_TOOL_BASE_ARGS=\
+ --arcadia-root $ARCADIA_ROOT \
+ --arcadia-build-root $ARCADIA_BUILD_ROOT \
+ --moddir $MODDIR \
+ --local-cli $TS_LOCAL_CLI \
+ --nodejs-bin $NODEJS_BIN \
+ --pnpm-script $PNPM_SCRIPT \
+ --contribs $NPM_CONTRIBS_PATH \
+ --trace $TS_TRACE \
+ --verbose $TS_LOG \
+ $_YATOOL_PREBUILDER_ARG
+
+# Arguments for builders' commands, passed after the command
+NOTS_TOOL_COMMON_BUILDER_ARGS=\
+ --output-file ${output:TS_OUTPUT_FILE} \
+ --tsconfigs $TS_CONFIG_PATH \
+ --vcs-info "${VCS_INFO_FILE}"
+
+ERM_PACKAGES_PATH=devtools/frontend_build_platform/erm/erm-packages.json
+
+TS_CONFIG_PATH=tsconfig.json
+TS_OUTPUT_FILE=output.tar
+TS_EXCLUDE_DIR_GLOB=(.idea|.vscode|node_modules)/**/*
+TS_COMMON_OUTDIR_GLOB=(build|dist|bundle|$WEBPACK_OUTPUT_DIR|$TS_NEXT_OUTPUT_DIR|$VITE_OUTPUT_DIR)/**/*
+TS_GLOB_EXCLUDE_ADDITIONAL=
+
+module _TS_BASE_UNIT: _BARE_UNIT {
+ # Propagates peers to related modules
+ .PEERDIR_POLICY=as_build_from
+ .NODE_TYPE=Bundle
+ # Needed for DEPENDS in tests to choose right submodule from multimodule
+ .FINAL_TARGET=yes
+ # use TS_FILES instead of FILES
+ .ALIASES=FILES=TS_FILES
+
+ # TODO: remove this. YMAKE-1096 / FBP-1184
+ _NEVERCACHE()
+
+ # .NODE_TYPE=Bundle is required for peers propagation, but it also affects
+ # how merging of pic/nopic graphs. Here we can override this merging behaviour
+ SET(MODULE_TYPE LIBRARY)
+ # Include processor works only for TS tag
+ SET(MODULE_TAG TS)
+ # TS should peer to TS
+ SET(PEERDIR_TAGS TS)
+ # .fake tells builder to not materialize it in results
+ SET(MODULE_SUFFIX .ts.fake)
+
+ # We read erm-packages.json during configuration, so we have to include it to configuration cache key
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH)
+
+ # PEERDIR that reads required version of tool from package.json
+ _PEERDIR_TS_RESOURCE(nodejs pnpm)
+}
+
+
+# tag:test
+ESLINT_CONFIG_PATH=.eslintrc.js
+_TS_LINT_SRCS_VALUE=
+### _TS_CONFIG_EPILOGUE() # internal
+###
+### This macro executes macros which should be invoked after all user specified macros in the ya.make file
+macro _TS_CONFIG_EPILOGUE() {
+ ### Fill $TS_GLOB_FILES with potential inputs.
+ ### It will be reduced later in _TS_CONFIGURE based on `tsconfig.json` rules.
+ _GLOB(TS_GLOB_FILES $TS_GLOB_INCLUDE EXCLUDE $TS_GLOB_EXCLUDE)
+
+ _GLOB(_TS_LINT_SRCS_VALUE **/*.(ts|tsx|js|jsx) EXCLUDE $TS_EXCLUDE_DIR_GLOB $TS_COMMON_OUTDIR_GLOB $TS_GLOB_EXCLUDE_ADDITIONAL)
+
+ _SETUP_EXTRACT_NODE_MODULES_RECIPE(${MODDIR})
+}
+
+# Used as inputs in TS_COMPILE through `$_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES)`
+TS_INPUT_FILES=
+
+# List of the files, filled in _TS_CONFIG_EPILOGUE. Will be reduced in _TS_CONFIGURE macro to TS_INPUT_FILES.
+TS_GLOB_FILES=
+
+# Hardcoded "include" list (all other files will be ignored)
+TS_GLOB_INCLUDE=**/*
+
+# Hardcoded "exclude" list (reasonable default).
+TS_GLOB_EXCLUDE=$TS_CONFIG_PATH \
+ ya.make a.yaml \
+ $TS_EXCLUDE_DIR_GLOB \
+ $TS_COMMON_OUTDIR_GLOB \
+ $TS_GLOB_EXCLUDE_ADDITIONAL \
+ package.json pnpm-lock.yaml .* \
+ tests/**/* **/*.(test|spec).(ts|tsx|js|jsx)
+
+
+# Ugly hack for using inputs from the variable
+macro _AS_HIDDEN_INPUTS(IN{input}[]) {
+ # "context=TEXT" exclude file from the "include processing"
+ .CMD=${input;hide;context=TEXT:IN}
+}
+
+
+_TS_FILES_COPY_CMD=
+
+### TS_FILES(Files...)
+###
+### Adds files to output as is. Similar to FILES but works for TS build modules
+macro TS_FILES(Files...) {
+ _TS_FILES($Files)
+}
+
+@import "${CONF_ROOT}/conf/ts/node_modules.conf"
+@import "${CONF_ROOT}/conf/ts/ts_next.conf"
+@import "${CONF_ROOT}/conf/ts/ts_package.conf"
+@import "${CONF_ROOT}/conf/ts/ts_test.conf"
+@import "${CONF_ROOT}/conf/ts/ts_tsc.conf"
+@import "${CONF_ROOT}/conf/ts/ts_vite.conf"
+@import "${CONF_ROOT}/conf/ts/ts_webpack.conf"
diff --git a/build/conf/ts/ts_next.conf b/build/conf/ts/ts_next.conf
new file mode 100644
index 0000000000..0bf65e3e2d
--- /dev/null
+++ b/build/conf/ts/ts_next.conf
@@ -0,0 +1,59 @@
+TS_NEXT_OUTPUT_DIR=.next
+TS_NEXT_CONFIG_PATH=next.config.js
+
+TS_NEXT_CMD=$TOUCH_UNIT \
+ && $_TS_FILES_COPY_CMD \
+ && $ADD_VCS_INFO_FILE_CMD \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-next $NOTS_TOOL_COMMON_BUILDER_ARGS \
+ --bundler-config-path ${input:TS_NEXT_CONFIG_PATH} \
+ --output-dir ${TS_NEXT_OUTPUT_DIR} \
+ $_NODE_MODULES_INOUTS ${hide:PEERS} \
+ ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
+ ${output;hide:"package.json"} \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_NXT"}
+
+### @usage: TS_NEXT()
+###
+### NextJS app, built with `next build`. Requires sources to be under /src folder.
+### /pages and /app on the root level ar not supported.
+### Build results are output.tar.
+###
+### @example
+###
+### TS_NEXT()
+### END()
+###
+multimodule TS_NEXT {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_NEXT_CMD
+ .EPILOGUE=_TS_CONFIG_EPILOGUE
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ _PEERDIR_TS_RESOURCE(next)
+
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+ DISABLE(TS_CONFIG_USE_OUTDIR)
+
+ _TS_CONFIGURE($TS_CONFIG_PATH)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+ }
+}
+
+macro TS_NEXT_CONFIG(Path) {
+ SET(TS_NEXT_CONFIG_PATH $Path)
+}
+
+
+### @usage: TS_NEXT_OUTPUT(DirName)
+###
+### Macro sets the output directory name for TS_NEXT module.
+###
+### - DirName - output directory name ("bundle" by default).
+macro TS_NEXT_OUTPUT(DirName) {
+ SET(TS_NEXT_OUTPUT_DIR $DirName)
+}
diff --git a/build/conf/ts/ts_package.conf b/build/conf/ts/ts_package.conf
new file mode 100644
index 0000000000..bad2085a62
--- /dev/null
+++ b/build/conf/ts/ts_package.conf
@@ -0,0 +1,36 @@
+
+TS_PACK=$TOUCH_UNIT \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-package $_NODE_MODULES_INOUTS \
+ && $COPY_CMD ${input:"package.json"} ${output:"package.json"} \
+ && $_TS_FILES_COPY_CMD \
+ ${kv;hide:"p TS_PKG"} ${kv;hide:"pc magenta"}
+
+### @usage: TS_PACKAGE()
+###
+### The TypeScript/JavaScript library module, that does not need any compilation,
+### and is just a set of files and NPM dependencies. List required files in TS_FILES macro.
+### `package.json` is included by default.
+###
+### @example
+###
+### TS_PACKAGE()
+### TS_FILES(
+### eslint.config.json
+### prettierrc.json
+### )
+### END()
+###
+multimodule TS_PACKAGE {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_PACK
+ .ALLOWED=TS_FILES
+ .ALIASES=FILES=TS_FILES SRCS=TS_FILES
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml)
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+ }
+}
diff --git a/build/conf/ts/ts_test.conf b/build/conf/ts/ts_test.conf
new file mode 100644
index 0000000000..86ab3431c8
--- /dev/null
+++ b/build/conf/ts/ts_test.conf
@@ -0,0 +1,159 @@
+TS_TEST_EXTENSION=
+TS_TEST_EXTRA_SRCS_MASK=
+
+TS_TEST_CONFIG_PATH=
+TS_TEST_NM=
+
+# We have to rename node_modules.tar to workspace_node_modules.tar,
+# so TS_TEST_JEST module has it's own unique output.
+# TS_TEST_JEST_FOR module has to output all files required for test run.
+TS_TEST_JEST_CMD=$TOUCH_UNIT \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS create-node-modules --moddir $TS_TEST_FOR_PATH \
+ $_NODE_MODULES_INOUTS ${hide:PEERS} \
+ && ${cwd:BINDIR} $MOVE_FILE $TS_TEST_NM ${output:"workspace_node_modules.tar"} \
+ ${kv;hide:"p TS_JST"} ${kv;hide:"pc magenta"}
+
+### @usage: TS_TEST_JEST_FOR(Path)
+###
+### Defines testing module with jest test runner.
+###
+### @example
+###
+### TS_TEST_JEST_FOR(path/to/module)
+### TS_TEST_SRCS(../src)
+### TS_TEST_CONFIG(../jest.config.js)
+### END()
+###
+module TS_TEST_JEST_FOR: _TS_TEST_BASE {
+ .CMD=TS_TEST_JEST_CMD
+
+ # for multimodule peers we should choose NODE_MODULES
+ SET(PEERDIR_TAGS NODE_MODULES)
+
+ # compatibility with old TS_TEST_SRCS
+ SET(TS_TEST_EXTENSION test.(ts|tsx|js|jsx))
+ SET(TS_TEST_EXTRA_SRCS_MASK /**/__mocks__/*)
+
+ _PEERDIR_TS_RESOURCE(nodejs pnpm jest)
+ _TS_TEST_FOR_CONFIGURE(jest jest.config.js workspace_node_modules.tar)
+
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+}
+
+TS_TEST_HERMIONE_CMD=$TOUCH_UNIT \
+ && ${cwd:BINDIR} $MOVE_FILE ${input:TS_TEST_NM} ${output:"workspace_node_modules.tar"} \
+ ${kv;hide:"p TSHRM"} ${kv;hide:"pc magenta"}
+
+### @usage: TS_TEST_HERMIONE_FOR(Path)
+###
+### Defines testing module with hermione test runner.
+###
+### @example
+###
+### TS_TEST_HERMIONE_FOR(path/to/module)
+### TS_TEST_SRCS(../src)
+### TS_TEST_CONFIG(../hermione.conf.js)
+### END()
+###
+module TS_TEST_HERMIONE_FOR: _TS_TEST_BASE {
+ .CMD=TS_TEST_HERMIONE_CMD
+
+ # for multimodule peers we should choose TS
+ SET(PEERDIR_TAGS TS)
+
+ # compatibility with old TS_TEST_SRCS
+ SET(TS_TEST_EXTENSION hermione.(ts|js))
+
+ _DEPENDS_ON_MOD()
+ _PEERDIR_TS_RESOURCE(nodejs pnpm typescript hermione)
+ _TS_TEST_FOR_CONFIGURE(hermione .hermione.conf.js workspace_node_modules.tar)
+}
+
+module _TS_TEST_BASE: _BARE_UNIT {
+ # ignore SRCS macro
+ .ALIASES=SRCS=_NOOP_MACRO
+ # use this parser to get module args in $MODULE_ARGS_RAW
+ .ARGS_PARSER=Raw
+ .NODE_TYPE=Program
+
+ # TODO: remove this. YMAKE-1096 / FBP-1184
+ _NEVERCACHE()
+
+ # .fake tells builder to not materialize it in results
+ SET(MODULE_SUFFIX .ts_test.fake)
+ # include processor works only for TS tag
+ SET(MODULE_TAG TS)
+ # we read erm-packages.json during configuration, so we have to include it to configuration cache key
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$ERM_PACKAGES_PATH)
+
+ # parse module args
+ _TS_TEST_FOR_ARGS($MODULE_ARGS_RAW)
+
+ # we don't want to have TS outputs for tests
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+}
+
+macro _TS_TEST_FOR_ARGS(FOR_MOD, RELATIVE?"${CURDIR}":"${ARCADIA_ROOT}") {
+ # we read testing modules' package.json during configuration,
+ # so we have to include it to configuration cache key
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $RELATIVE/$FOR_MOD/package.json)
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS $RELATIVE/$FOR_MOD/pnpm-lock.yaml)
+ _VALIDATE_TS_TEST_FOR_ARGS($FOR_MOD $RELATIVE)
+ _SET_TS_TEST_FOR_VARS($FOR_MOD)
+}
+
+macro _SETUP_EXTRACT_NODE_MODULES_RECIPE(FOR_PATH) {
+ DEPENDS(devtools/frontend_build_platform/nots/recipes/extract_node_modules)
+ USE_RECIPE(devtools/frontend_build_platform/nots/recipes/extract_node_modules/recipe $FOR_PATH workspace_node_modules.tar)
+}
+
+macro _SETUP_EXTRACT_PEER_TARS_RECIPE(FOR_PATH) {
+ DEPENDS(devtools/frontend_build_platform/nots/recipes/extract_peer_tars)
+ USE_RECIPE(devtools/frontend_build_platform/nots/recipes/extract_peer_tars/recipe $FOR_PATH)
+}
+
+
+### @usage: TS_TEST_CONFIG(Path)
+###
+### Macro sets the path to configuration file of the test runner.
+###
+### - Path - path to the config file.
+macro TS_TEST_CONFIG(Path) {
+ SET(TS_TEST_CONFIG_PATH $Path)
+}
+
+
+_TS_TEST_SRCS_VALUE=
+_TS_TEST_EXTRA_SRCS_VALUE=
+### @usage: TS_TEST_SRCS(DIRS...)
+###
+### Macro to define directories where the test source files should be located.
+###
+### - DIRS... - directories.
+macro TS_TEST_SRCS(DIRS...) {
+ _GLOB(_TS_TEST_SRCS_VALUE ${suf=/**/*.$TS_TEST_EXTENSION:DIRS})
+ SRCS($_TS_TEST_SRCS_VALUE)
+
+ _GLOB(_TS_TEST_EXTRA_SRCS_VALUE ${suf=$TS_TEST_EXTRA_SRCS_MASK:DIRS})
+ SRCS($_TS_TEST_EXTRA_SRCS_VALUE)
+}
+
+
+_TS_TEST_DATA_VALUE=
+_TS_TEST_DATA_DIRS_RENAME_VALUE=
+### @usage: TS_TEST_DATA([RENAME] GLOBS...)
+###
+### Macro to add tests data (i.e. snapshots) used in testing to a bindir from curdir.
+### Creates symbolic links to directories of files found by the specified globs.
+###
+### Parameters:
+### - RENAME - adds ability to rename paths for tests data from curdir to bindir.
+### For example if your tested module located on "module" path and tests data in "module/tests_data".
+### Then you can be able to rename "tests_data" folder to something else - `RENAME tests_data:example`.
+### As a result in your bindir will be created folder - "module/example" which is a symbolic link on "module/tests_data" in curdir.
+### It is possible to specify multiple renaming rules in the following format "dir1:dir2;dir3/foo:dir4/bar", where "dir1" and "dir3" folders in curdir.
+### - GLOBS... - globs to tests data files, symbolic links will be created to their folders. For example - "tests_data/**/*".
+macro TS_TEST_DATA(RENAME="", GLOBS...) {
+ _GLOB(_TS_TEST_DATA_VALUE $GLOBS)
+ SET(_TS_TEST_DATA_DIRS_RENAME_VALUE $RENAME)
+}
diff --git a/build/conf/ts/ts_tsc.conf b/build/conf/ts/ts_tsc.conf
new file mode 100644
index 0000000000..d76b5088c8
--- /dev/null
+++ b/build/conf/ts/ts_tsc.conf
@@ -0,0 +1,49 @@
+TS_TSC_CMD=$TOUCH_UNIT \
+ && $_TS_FILES_COPY_CMD \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-tsc $NOTS_TOOL_COMMON_BUILDER_ARGS \
+ $_NODE_MODULES_INOUTS ${hide:PEERS} \
+ ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
+ ${output;hide:"package.json"} \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_TSC"}
+
+### @usage: TS_TSC([name])
+###
+### The TypeScript/JavaScript library module, compiles TypeScript sources to JavaScript using tsc.
+### Build results are JavaScript files, typings and source mappings (depending on local tsconfig.json settings).
+###
+### @example
+###
+### TS_TSC()
+###
+### END()
+###
+multimodule TS_TSC {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_TSC_CMD
+ .EPILOGUE=_TS_CONFIG_EPILOGUE
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ _PEERDIR_TS_RESOURCE(typescript)
+
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+ ENABLE(TS_CONFIG_USE_OUTDIR)
+
+ _TS_CONFIGURE($TS_CONFIG_PATH)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+ }
+}
+
+### @usage: TS_TSC([name])
+###
+### deprecated, use TS_TSC instead
+module TS_LIBRARY: _BARE_UNIT {
+ MESSAGE(TS_LIBRARY has been renamed to TS_TSC)
+ MESSAGE(To update the project edit "ya.make" manualy or run:)
+ MESSAGE(FATAL_ERROR ya project macro replace "TS_LIBRARY=TS_TSC")
+}
+
diff --git a/build/conf/ts/ts_vite.conf b/build/conf/ts/ts_vite.conf
new file mode 100644
index 0000000000..f5f675d8ee
--- /dev/null
+++ b/build/conf/ts/ts_vite.conf
@@ -0,0 +1,63 @@
+VITE_OUTPUT_DIR=dist
+VITE_CONFIG_PATH=vite.config.ts
+
+TS_VITE_CMD=$TOUCH_UNIT \
+ && $_TS_FILES_COPY_CMD \
+ && $ADD_VCS_INFO_FILE_CMD \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-vite $NOTS_TOOL_COMMON_BUILDER_ARGS \
+ --bundler-config-path ${input:VITE_CONFIG_PATH} \
+ --output-dir ${VITE_OUTPUT_DIR} \
+ $_NODE_MODULES_INOUTS ${hide:PEERS} \
+ ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
+ ${output;hide:"package.json"} \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_VIT"}
+
+### @usage: VITE_OUTPUT(DirName)
+###
+### Macro sets the output directory name for TS_VITE module.
+###
+### - DirName - output directory name ("dist" by default).
+macro VITE_OUTPUT(DirName) {
+ SET(VITE_OUTPUT_DIR $DirName)
+}
+
+### @usage: TS_VITE([name])
+###
+### The Vite bundle, bundles JavaScript code.
+### Build results are packed as `output.tar`.
+###
+### @example
+###
+### TS_VITE()
+### END()
+###
+multimodule TS_VITE {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_VITE_CMD
+ .EPILOGUE=_TS_CONFIG_EPILOGUE
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ _PEERDIR_TS_RESOURCE(vite)
+
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+ DISABLE(TS_CONFIG_USE_OUTDIR)
+
+ _TS_CONFIGURE($TS_CONFIG_PATH)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+ }
+}
+
+
+### @usage: TS_VITE([name])
+###
+### deprecated, use TS_VITE instead
+module TS_VITE_BUNDLE: _BARE_UNIT {
+ MESSAGE(TS_VITE_BUNDLE has been renamed to TS_VITE)
+ MESSAGE(To update the project edit "ya.make" manualy or run:)
+ MESSAGE(FATAL_ERROR ya project macro replace "TS_VITE_BUNDLE=TS_VITE")
+}
diff --git a/build/conf/ts/ts_webpack.conf b/build/conf/ts/ts_webpack.conf
new file mode 100644
index 0000000000..36a1bcebf8
--- /dev/null
+++ b/build/conf/ts/ts_webpack.conf
@@ -0,0 +1,62 @@
+WEBPACK_OUTPUT_DIR=bundle
+WEBPACK_CONFIG_PATH=webpack.config.js
+
+TS_WEBPACK_CMD=$TOUCH_UNIT \
+ && $_TS_FILES_COPY_CMD \
+ && $ADD_VCS_INFO_FILE_CMD \
+ && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-webpack $NOTS_TOOL_COMMON_BUILDER_ARGS \
+ --bundler-config-path ${input:WEBPACK_CONFIG_PATH} \
+ --output-dir ${WEBPACK_OUTPUT_DIR} \
+ $_NODE_MODULES_INOUTS ${hide:PEERS} \
+ ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
+ ${output;hide:"package.json"} \
+ ${kv;hide:"pc magenta"} ${kv;hide:"p TS_WPK"}
+
+### @usage: WEBPACK_OUTPUT(DirName)
+###
+### Macro sets the output directory name for TS_BUNDLE module.
+###
+### - DirName - output directory name ("bundle" by default).
+macro WEBPACK_OUTPUT(DirName) {
+ SET(WEBPACK_OUTPUT_DIR $DirName)
+}
+
+### @usage: TS_WEBPACK([name])
+###
+### The Webpack bundle, bundles JavaScript code.
+### Build results are packed as `output.tar`.
+###
+### @example
+###
+### TS_WEBPACK()
+### END()
+###
+multimodule TS_WEBPACK {
+ module BUILD: _TS_BASE_UNIT {
+ .CMD=TS_WEBPACK_CMD
+ .EPILOGUE=_TS_CONFIG_EPILOGUE
+
+ # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
+ # but we have to set it to TS for include processor to work
+ SET(MODULE_TAG TS)
+
+ _PEERDIR_TS_RESOURCE(webpack webpack-cli)
+
+ DISABLE(TS_CONFIG_DEDUCE_OUT)
+ DISABLE(TS_CONFIG_USE_OUTDIR)
+
+ _TS_CONFIGURE($TS_CONFIG_PATH)
+
+ SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
+ _TS_ADD_NODE_MODULES_FOR_BUILDER()
+ }
+}
+
+### @usage: TS_TSC([name])
+###
+### deprecated, use TS_TSC instead
+module TS_BUNDLE: _BARE_UNIT {
+ MESSAGE(TS_BUNDLE has been renamed to TS_WEBPACK)
+ MESSAGE(To update the project edit "ya.make" manualy or run:)
+ MESSAGE(FATAL_ERROR ya project macro replace "TS_BUNDLE=TS_WEBPACK")
+}