NODEJS_ROOT=$NODEJS_RESOURCE_GLOBAL NODEJS_BIN=$NODEJS_ROOT/node PNPM_ROOT=$PNPM_RESOURCE_GLOBAL PNPM_SCRIPT=$PNPM_ROOT/pnpm.js TSC_ROOT=$TS_COMPILER_RESOURCE_GLOBAL/typescript TSC_SCRIPT=$TSC_ROOT/lib/tsc.js WEBPACK_ROOT=$WEBPACK_RESOURCE_GLOBAL/node_modules WEBPACK_SCRIPT=$WEBPACK_ROOT/.bin/webpack NOTS_TOOL=${tool:"tools/nots"} NOTS_TOOL_BASE_ARGS=--build-root $ARCADIA_BUILD_ROOT --bindir $BINDIR --curdir $CURDIR --nodejs-bin $NODEJS_BIN NPM_CONTRIBS_PATH=devtools/dummy_arcadia/ts/contribs ### @usage: NPM_CONTRIBS() # internal ### ### Defines special module that provides contrib tarballs from internal npm registry. ### Should be used only with `NODE_MODULES` macro. ### ### @see [FROM_NPM_LOCKFILES()](#macro_FROM_NPM_LOCKFILES) ### @see [NODE_MODULES()](#macro_NODE_MODULES) module NPM_CONTRIBS: _BASE_UNIT { .CMD=TOUCH_UNIT .PEERDIR_POLICY=as_build_from .FINAL_TARGET=no .ALLOWED=FROM_NPM_LOCKFILES .RESTRICTED=PEERDIR SET(MODULE_TAG NPM_CONTRIBS) MODULE_SUFFIX=.fake _BARE_MODULE() } ### @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) } ### @usage: FROM_NPM(NAME VERSION SKY_ID INTEGRITY INTEGRITY_ALGO TARBALL_PATH) macro FROM_NPM(NAME, VERSION, SKY_ID, INTEGRITY, INTEGRITY_ALGO, TARBALL_PATH) { .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_npm.py"} ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/sky.py"} --name $NAME --version $VERSION --sky-id $SKY_ID --integrity $INTEGRITY --integrity-algorithm $INTEGRITY_ALGO --copy-to ${output:TARBALL_PATH} ${requirements;hide:"network:full"} ${kv;hide:"p NP"} ${kv;hide:"pc yellow"} } ### @usage: NODE_MODULES() ### ### Materializes `node_modules.tar` bundle according to the module's lockfile. ### ### @see [NPM_CONTRIBS()](#module_NPM_CONTRIBS) macro NODE_MODULES() { # See implementation in build/plugins/nots.py } _NODE_MODULES_INPUTS= macro _NODE_MODULES(IN{input}[], OUT{output}[]) { PEERDIR($NPM_CONTRIBS_PATH) SET(_NODE_MODULES_INPUTS \${input;hide:node_modules.tar}) .CMD=${cwd:BINDIR} $NOTS_TOOL create-node-modules $NOTS_TOOL_BASE_ARGS --pnpm-script $PNPM_SCRIPT --contribs $NPM_CONTRIBS_PATH ${input;hide:IN} ${output;global;hide:OUT} ${kv;hide:"p NM"} ${kv;hide:"pc yellow"} } module _TS_BASE_UNIT: _BASE_UNIT { SET(MODULE_TAG TS) SET(PEERDIR_TAGS TS NPM_CONTRIBS) PEERDIR(build/platform/nodejs) PEERDIR(build/external_resources/pnpm) PEERDIR(build/external_resources/typescript) MODULE_SUFFIX=.fake _BARE_MODULE() } TS_CONFIG_PATH=tsconfig.json TS_COMPILE=${cwd:BINDIR} $NOTS_TOOL compile-ts $NOTS_TOOL_BASE_ARGS --tsc-script $TSC_SCRIPT --config ${input:TS_CONFIG_PATH} ${hide:PEERS} $_NODE_MODULES_INPUTS ${output;hide:"package.json"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} && $TOUCH_UNIT ### @usage: TS_LIBRARY([name]) ### ### The TypeScript/JavaScript library module, compiles TypeScript sources to JavaScript. ### Build results are JavaScript files, typings and source mappings (depending on local tsconfig.json settings). ### ### @see [NODE_MODULES()](#macro_NODE_MODULES) ### @example ### ### TS_LIBRARY() ### SRCS(src/index.ts) ### NODE_MODULES() ### END() ### module TS_LIBRARY : _TS_BASE_UNIT { .CMD=TS_COMPILE .FINAL_TARGET=yes .PEERDIR_POLICY=as_build_from SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${TS_CONFIG_PATH} ${CURDIR}/package.json) SET(TS_CONFIG_DEDUCE_OUT yes) _TS_CONFIGURE($TS_CONFIG_PATH) } WEBPACK_CONFIG_PATH=webpack.config.js TS_BUNDLE_WEBPACK=${cwd:BINDIR} $NOTS_TOOL bundle-webpack $NOTS_TOOL_BASE_ARGS --webpack-root $WEBPACK_ROOT --webpack-script $WEBPACK_SCRIPT --config ${input:WEBPACK_CONFIG_PATH} ${hide:PEERS} $_NODE_MODULES_INPUTS ${output;hide:"bundle.tar"} ${kv;hide:"p FE"} ${kv;hide:"pc yellow"} && $TOUCH_UNIT ### @usage: TS_BUNDLE([name]) ### ### The Webpack bundle, bundles JavaScript code. ### Build results are bundle.tar, typings and source mappings (depending on local tsconfig.json settings). ### ### @see [NODE_MODULES()](#macro_NODE_MODULES) ### @example ### ### TS_BUNDLE() ### SRCS(src/index.ts) ### NODE_MODULES() ### END() ### module TS_BUNDLE : _TS_BASE_UNIT { .CMD=TS_BUNDLE_WEBPACK .FINAL_TARGET=yes .PEERDIR_POLICY=as_build_from DECLARE_EXTERNAL_RESOURCE(WEBPACK sbr:2815569512) SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/${WEBPACK_CONFIG_PATH} ${CURDIR}/package.json) SET(TS_CONFIG_DEDUCE_OUT no) _TS_CONFIGURE($TS_CONFIG_PATH) }