From 0cfd8afb4cee729e768a5966cb60bba918c862da Mon Sep 17 00:00:00 2001 From: Victor Savkin Date: Thu, 10 Aug 2023 11:15:55 -0400 Subject: [PATCH] feat(core): cache executor information resolution --- package.json | 2 + packages/angular/project.json | 4 +- packages/nx/.eslintrc.json | 1 + .../nx/src/command-line/run/executor-utils.ts | 18 +- pnpm-lock.yaml | 216 ++++++++++++++---- 5 files changed, 194 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 055c1174d67a6..49a554be342ac 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,8 @@ "@nx/storybook": "16.7.0-beta.3", "@nx/web": "16.7.0-beta.3", "@nx/webpack": "16.7.0-beta.3", + "@nx/esbuild": "16.7.0-beta.3", + "@nx/angular": "16.7.0-beta.3", "@parcel/watcher": "2.0.4", "@phenomnomnominal/tsquery": "~5.0.1", "@playwright/test": "^1.36.1", diff --git a/packages/angular/project.json b/packages/angular/project.json index e450027032e11..04cbca8800260 100644 --- a/packages/angular/project.json +++ b/packages/angular/project.json @@ -64,9 +64,7 @@ "dependsOn": ["build-ng", "build-base", "^build"], "options": { "commands": [ - { - "command": "node ./scripts/copy-readme.js angular" - }, + "node ./scripts/copy-readme.js angular", "node ./scripts/add-dependency-to-build.js angular @nrwl/angular" ], "parallel": false diff --git a/packages/nx/.eslintrc.json b/packages/nx/.eslintrc.json index 9c43bd42c92ce..feac867a7b146 100644 --- a/packages/nx/.eslintrc.json +++ b/packages/nx/.eslintrc.json @@ -81,6 +81,7 @@ "buildTargets": ["build-base"], "ignoredDependencies": [ "typescript", + "@nrwl/angular", "@angular-devkit/build-angular", "@angular-devkit/core", "@angular-devkit/architect", diff --git a/packages/nx/src/command-line/run/executor-utils.ts b/packages/nx/src/command-line/run/executor-utils.ts index 08f016021e63a..9dd4439a90422 100644 --- a/packages/nx/src/command-line/run/executor-utils.ts +++ b/packages/nx/src/command-line/run/executor-utils.ts @@ -31,13 +31,22 @@ export function normalizeExecutorSchema( }; } +function cacheKey(nodeModule: string, executor: string, root: string) { + return `${root}:${nodeModule}:${executor}`; +} + +const cachedExecutorInformation = {}; + export function getExecutorInformation( nodeModule: string, executor: string, root: string ): ExecutorConfig & { isNgCompat: boolean; isNxExecutor: boolean } { try { - const { executorsFilePath, executorConfig, isNgCompat } = readExecutorsJson( + const key = cacheKey(nodeModule, executor, root); + if (cachedExecutorInformation[key]) return cachedExecutorInformation[key]; + + const { executorsFilePath, executorConfig, isNgCompat } = readExecutorJson( nodeModule, executor, root @@ -65,7 +74,7 @@ export function getExecutorInformation( ) : null; - return { + const res = { schema, implementationFactory, batchImplementationFactory, @@ -73,6 +82,9 @@ export function getExecutorInformation( isNgCompat, isNxExecutor: !isNgCompat, }; + + cachedExecutorInformation[key] = res; + return res; } catch (e) { throw new Error( `Unable to resolve ${nodeModule}:${executor}.\n${e.message}` @@ -80,7 +92,7 @@ export function getExecutorInformation( } } -function readExecutorsJson( +function readExecutorJson( nodeModule: string, executor: string, root: string diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eee02035b1716..b6d949d3606e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - overrides: '@angular-devkit/core': ~16.2.0-rc.1 @@ -270,12 +266,18 @@ devDependencies: '@nguniversal/builders': specifier: ~16.2.0-rc.0 version: 16.2.0-rc.0(@angular-devkit/build-angular@16.2.0-rc.1)(@angular/common@16.2.0-rc.0)(@angular/core@16.2.0-rc.0)(@types/express@4.17.14)(chokidar@3.5.3)(typescript@5.1.3) + '@nx/angular': + specifier: 16.7.0-beta.3 + version: 16.7.0-beta.3(@angular-devkit/build-angular@16.2.0-rc.1)(@angular-devkit/core@16.2.0-rc.1)(@angular-devkit/schematics@16.2.0-rc.1)(@nguniversal/builders@16.2.0-rc.0)(@schematics/angular@16.2.0-rc.1)(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(esbuild@0.17.18)(eslint@8.46.0)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(rxjs@7.8.1)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4) '@nx/cypress': specifier: 16.7.0-beta.3 version: 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) '@nx/devkit': specifier: 16.7.0-beta.3 version: 16.7.0-beta.3(nx@16.7.0-beta.3) + '@nx/esbuild': + specifier: 16.7.0-beta.3 + version: 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) '@nx/eslint-plugin': specifier: 16.7.0-beta.3 version: 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(@typescript-eslint/parser@5.62.0)(eslint-config-prettier@8.5.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) @@ -5487,6 +5489,49 @@ packages: - supports-color dev: true + /@nrwl/angular@16.7.0-beta.3(@angular-devkit/build-angular@16.2.0-rc.1)(@angular-devkit/core@16.2.0-rc.1)(@angular-devkit/schematics@16.2.0-rc.1)(@nguniversal/builders@16.2.0-rc.0)(@schematics/angular@16.2.0-rc.1)(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(esbuild@0.17.18)(eslint@8.46.0)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(rxjs@7.8.1)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4): + resolution: {integrity: sha512-PrspNencRsTWTLMuuLTbYPyRYQdi51fhjaRI/LcPGtRIs+ZMVnLAwxYloNIvdxh48ifrA6Sdn0ztQAn4kO8bhg==} + dependencies: + '@nx/angular': 16.7.0-beta.3(@angular-devkit/build-angular@16.2.0-rc.1)(@angular-devkit/core@16.2.0-rc.1)(@angular-devkit/schematics@16.2.0-rc.1)(@nguniversal/builders@16.2.0-rc.0)(@schematics/angular@16.2.0-rc.1)(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(esbuild@0.17.18)(eslint@8.46.0)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(rxjs@7.8.1)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4) + tslib: 2.6.1 + transitivePeerDependencies: + - '@angular-devkit/build-angular' + - '@angular-devkit/core' + - '@angular-devkit/schematics' + - '@babel/traverse' + - '@nguniversal/builders' + - '@parcel/css' + - '@schematics/angular' + - '@swc-node/register' + - '@swc/core' + - '@swc/css' + - '@swc/wasm' + - '@types/node' + - bufferutil + - clean-css + - csso + - cypress + - debug + - esbuild + - eslint + - fibers + - html-webpack-plugin + - lightningcss + - node-notifier + - node-sass + - nx + - rxjs + - sass-embedded + - supports-color + - ts-node + - typescript + - uglify-js + - utf-8-validate + - verdaccio + - vue-template-compiler + - webpack-cli + dev: true + /@nrwl/cli@15.8.0(@swc-node/register@1.5.4)(@swc/core@1.3.51): resolution: {integrity: sha512-XLVgzKygZmmJ6nUIZz+DyWMjh96fr+gvAlXF24zvlY7HkPgCiUo9QXLIeJxEd2HawGoATrUE/erp74ldnz2WrA==} dependencies: @@ -5582,6 +5627,24 @@ packages: - nx dev: true + /@nrwl/esbuild@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): + resolution: {integrity: sha512-FAfDf8vHKCrVE6Qk7+ZLFV75divC884HCMtv+GRLf846ONyB76x4i8BirUZ0RDTH5fkyHxiJNwx8N+tKa/y75A==} + dependencies: + '@nx/esbuild': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + transitivePeerDependencies: + - '@babel/traverse' + - '@swc-node/register' + - '@swc/core' + - '@swc/wasm' + - '@types/node' + - debug + - esbuild + - nx + - supports-color + - typescript + - verdaccio + dev: true + /@nrwl/eslint-plugin-nx@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(@typescript-eslint/parser@5.62.0)(eslint-config-prettier@8.5.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): resolution: {integrity: sha512-lHvAtgdXG16GJdtA07/Qfwyex2LK+Oee84kugqOfKNb3W4kFPfQT9VtybuxUvgXa/NnlJ+S7PPS0U7502OI3/A==} dependencies: @@ -5658,42 +5721,6 @@ packages: - typescript dev: true - /@nrwl/js@15.8.0(@swc-node/register@1.5.4)(@swc/core@1.3.51)(nx@15.8.0)(prettier@2.7.1)(typescript@5.1.3): - resolution: {integrity: sha512-l2Q7oFpzx6ul7G0nKpMkrvnIEaOY+X8fc2g2Db5WqpnnBdfkrtWXZPg/O4DQ1p9O6BXrZ+Q2AK9bfgnliiwyEg==} - dependencies: - '@babel/core': 7.22.9 - '@babel/plugin-proposal-class-properties': 7.18.6(@babel/core@7.22.9) - '@babel/plugin-proposal-decorators': 7.22.7(@babel/core@7.22.9) - '@babel/plugin-transform-runtime': 7.22.9(@babel/core@7.22.9) - '@babel/preset-env': 7.22.9(@babel/core@7.22.9) - '@babel/preset-typescript': 7.22.5(@babel/core@7.22.9) - '@babel/runtime': 7.22.6 - '@nrwl/devkit': 15.8.0(nx@15.8.0)(typescript@5.1.3) - '@nrwl/workspace': 15.8.0(@swc-node/register@1.5.4)(@swc/core@1.3.51)(eslint@8.46.0)(prettier@2.7.1)(typescript@5.1.3) - '@phenomnomnominal/tsquery': 4.1.1(typescript@5.1.3) - babel-plugin-const-enum: 1.2.0(@babel/core@7.22.9) - babel-plugin-macros: 2.8.0 - babel-plugin-transform-typescript-metadata: 0.3.2(@babel/core@7.22.9) - chalk: 4.1.2 - fast-glob: 3.2.7 - fs-extra: 11.1.1 - ignore: 5.2.0 - js-tokens: 4.0.0 - minimatch: 3.0.5 - source-map-support: 0.5.19 - tree-kill: 1.2.2 - tslib: 2.6.1 - transitivePeerDependencies: - - '@babel/traverse' - - '@swc-node/register' - - '@swc/core' - - debug - - nx - - prettier - - supports-color - - typescript - dev: true - /@nrwl/js@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): resolution: {integrity: sha512-abC4XOAt03NZ4svrBlxJvO6jxXtVncihWVflJnxMsa6Wu1BDOwFnK9s2i0TGJizttmvOt6PnVXJIk4Rt+0wtkg==} dependencies: @@ -5720,7 +5747,7 @@ packages: optional: true dependencies: '@nrwl/devkit': 15.8.0(nx@15.8.0)(typescript@5.1.3) - '@nrwl/js': 15.8.0(@swc-node/register@1.5.4)(@swc/core@1.3.51)(nx@15.8.0)(prettier@2.7.1)(typescript@5.1.3) + '@nrwl/js': 15.8.0(@swc-node/register@1.5.4)(@swc/core@1.3.51)(eslint@8.46.0)(nx@16.7.0-beta.3)(prettier@2.7.1)(typescript@5.1.3) '@phenomnomnominal/tsquery': 4.1.1(typescript@5.1.3) eslint: 8.46.0 tmp: 0.2.1 @@ -6129,6 +6156,78 @@ packages: - encoding dev: true + /@nx/angular@16.7.0-beta.3(@angular-devkit/build-angular@16.2.0-rc.1)(@angular-devkit/core@16.2.0-rc.1)(@angular-devkit/schematics@16.2.0-rc.1)(@nguniversal/builders@16.2.0-rc.0)(@schematics/angular@16.2.0-rc.1)(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(esbuild@0.17.18)(eslint@8.46.0)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(rxjs@7.8.1)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4): + resolution: {integrity: sha512-aY374hhe7KJYuOTqQZSupfYKhuBlQB0OMhZ7GH2jQqAXVdNYobmMS6sXaxUFlhIgtpaPCRkthhSNtB5vIp10og==} + peerDependencies: + '@angular-devkit/build-angular': '>= 14.0.0 < 17.0.0' + '@angular-devkit/core': '>= 14.0.0 < 17.0.0' + '@angular-devkit/schematics': '>= 14.0.0 < 17.0.0' + '@nguniversal/builders': '>= 14.0.0 < 17.0.0' + '@schematics/angular': '>= 14.0.0 < 17.0.0' + esbuild: ^0.17.5 + rxjs: ^6.5.3 || ^7.5.0 + peerDependenciesMeta: + '@nguniversal/builders': + optional: true + dependencies: + '@angular-devkit/build-angular': 16.2.0-rc.1(@angular/compiler-cli@16.2.0-rc.0)(@swc/core@1.3.51)(@types/node@18.16.9)(html-webpack-plugin@5.5.0)(jest-environment-jsdom@29.4.3)(jest@29.4.3)(ng-packagr@16.2.0-next.1)(stylus@0.59.0)(tailwindcss@3.2.4)(typescript@5.1.3) + '@angular-devkit/core': 16.2.0-rc.1(chokidar@3.5.3) + '@angular-devkit/schematics': 16.2.0-rc.1(chokidar@3.5.3) + '@nguniversal/builders': 16.2.0-rc.0(@angular-devkit/build-angular@16.2.0-rc.1)(@angular/common@16.2.0-rc.0)(@angular/core@16.2.0-rc.0)(@types/express@4.17.14)(chokidar@3.5.3)(typescript@5.1.3) + '@nrwl/angular': 16.7.0-beta.3(@angular-devkit/build-angular@16.2.0-rc.1)(@angular-devkit/core@16.2.0-rc.1)(@angular-devkit/schematics@16.2.0-rc.1)(@nguniversal/builders@16.2.0-rc.0)(@schematics/angular@16.2.0-rc.1)(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(esbuild@0.17.18)(eslint@8.46.0)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(rxjs@7.8.1)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/cypress': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/devkit': 16.7.0-beta.3(nx@16.7.0-beta.3) + '@nx/jest': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(nx@16.7.0-beta.3)(ts-node@10.9.1)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/js': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/linter': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(eslint@8.46.0)(nx@16.7.0-beta.3)(verdaccio@5.15.4) + '@nx/webpack': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(html-webpack-plugin@5.5.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/workspace': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51) + '@phenomnomnominal/tsquery': 5.0.1(typescript@5.1.3) + '@schematics/angular': 16.2.0-rc.1(chokidar@3.5.3) + '@typescript-eslint/type-utils': 5.60.1(eslint@8.46.0)(typescript@5.1.3) + chalk: 4.1.2 + enquirer: 2.3.6 + esbuild: 0.17.18 + find-cache-dir: 3.3.2 + ignore: 5.2.0 + magic-string: 0.30.2 + minimatch: 3.0.5 + rxjs: 7.8.1 + semver: 7.5.3 + tslib: 2.6.1 + webpack: 5.88.0(@swc/core@1.3.51)(esbuild@0.17.18) + webpack-merge: 5.9.0 + transitivePeerDependencies: + - '@babel/traverse' + - '@parcel/css' + - '@swc-node/register' + - '@swc/core' + - '@swc/css' + - '@swc/wasm' + - '@types/node' + - bufferutil + - clean-css + - csso + - cypress + - debug + - eslint + - fibers + - html-webpack-plugin + - lightningcss + - node-notifier + - node-sass + - nx + - sass-embedded + - supports-color + - ts-node + - typescript + - uglify-js + - utf-8-validate + - verdaccio + - vue-template-compiler + - webpack-cli + dev: true + /@nx/cypress@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(cypress@12.16.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): resolution: {integrity: sha512-4WinMLAX90DpXZm62jEkCSEj2w2elphJT/J4j5dWhLYIpVeWRIFS5cMrHGMMW+TPOw6yoCYMNqgBX0S2Bf12QA==} peerDependencies: @@ -6175,6 +6274,37 @@ packages: tslib: 2.6.1 dev: true + /@nx/esbuild@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): + resolution: {integrity: sha512-lYGpu5TR4JdHrirBXb6lkggUnSJCvXs3llanuFcl7PC4ZCFit+M2PyE6rfFGCY7pGzXmu2KVcOsKsKXSXyJJMA==} + peerDependencies: + esbuild: ~0.17.5 + peerDependenciesMeta: + esbuild: + optional: true + dependencies: + '@nrwl/esbuild': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(esbuild@0.17.18)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + '@nx/devkit': 16.7.0-beta.3(nx@16.7.0-beta.3) + '@nx/js': 16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4) + chalk: 4.1.2 + dotenv: 10.0.0 + esbuild: 0.17.18 + fast-glob: 3.2.7 + fs-extra: 11.1.1 + tsconfig-paths: 4.1.2 + tslib: 2.6.1 + transitivePeerDependencies: + - '@babel/traverse' + - '@swc-node/register' + - '@swc/core' + - '@swc/wasm' + - '@types/node' + - debug + - nx + - supports-color + - typescript + - verdaccio + dev: true + /@nx/eslint-plugin@16.7.0-beta.3(@swc-node/register@1.5.4)(@swc/core@1.3.51)(@types/node@18.16.9)(@typescript-eslint/parser@5.62.0)(eslint-config-prettier@8.5.0)(eslint@8.46.0)(nx@16.7.0-beta.3)(typescript@5.1.3)(verdaccio@5.15.4): resolution: {integrity: sha512-Tia3wvJwJW8bjDulR5RQ8552B4BA3g3Xk9WEJ3ppjsJCOUGaAfW01yytYZlavB4CCQZw8gH0OWfItTpTQHq9xQ==} peerDependencies: @@ -28118,3 +28248,7 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false