From 64b8bb4ef01e0a0663ce065f5a20f1465d74f55c Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 28 Jul 2022 09:34:16 -0400 Subject: [PATCH 01/27] feat: nx lsp --- apps/lsp/.eslintrc.json | 18 +++++++ apps/lsp/jest.config.ts | 16 ++++++ apps/lsp/project.json | 51 +++++++++++++++++++ apps/lsp/src/app/.gitkeep | 0 apps/lsp/src/assets/.gitkeep | 0 apps/lsp/src/environments/environment.prod.ts | 3 ++ apps/lsp/src/environments/environment.ts | 3 ++ apps/lsp/src/main.ts | 1 + apps/lsp/tsconfig.app.json | 10 ++++ apps/lsp/tsconfig.json | 13 +++++ apps/lsp/tsconfig.spec.json | 9 ++++ workspace.json | 1 + 12 files changed, 125 insertions(+) create mode 100644 apps/lsp/.eslintrc.json create mode 100644 apps/lsp/jest.config.ts create mode 100644 apps/lsp/project.json create mode 100644 apps/lsp/src/app/.gitkeep create mode 100644 apps/lsp/src/assets/.gitkeep create mode 100644 apps/lsp/src/environments/environment.prod.ts create mode 100644 apps/lsp/src/environments/environment.ts create mode 100644 apps/lsp/src/main.ts create mode 100644 apps/lsp/tsconfig.app.json create mode 100644 apps/lsp/tsconfig.json create mode 100644 apps/lsp/tsconfig.spec.json diff --git a/apps/lsp/.eslintrc.json b/apps/lsp/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/apps/lsp/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/apps/lsp/jest.config.ts b/apps/lsp/jest.config.ts new file mode 100644 index 0000000000..2e83a3073f --- /dev/null +++ b/apps/lsp/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'lsp', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/apps/lsp', +}; diff --git a/apps/lsp/project.json b/apps/lsp/project.json new file mode 100644 index 0000000000..b4187f05d4 --- /dev/null +++ b/apps/lsp/project.json @@ -0,0 +1,51 @@ +{ + "sourceRoot": "apps/lsp/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nrwl/node:webpack", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/vscode/lsp", + "main": "apps/lsp/src/main.ts", + "tsConfig": "apps/lsp/tsconfig.app.json", + "assets": ["apps/lsp/src/assets"] + }, + "configurations": { + "production": { + "optimization": true, + "extractLicenses": true, + "inspect": false, + "fileReplacements": [ + { + "replace": "apps/lsp/src/environments/environment.ts", + "with": "apps/lsp/src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "executor": "@nrwl/node:node", + "options": { + "buildTarget": "lsp:build" + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/lsp/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/apps/lsp"], + "options": { + "jestConfig": "apps/lsp/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/apps/lsp/src/app/.gitkeep b/apps/lsp/src/app/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/lsp/src/assets/.gitkeep b/apps/lsp/src/assets/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/lsp/src/environments/environment.prod.ts b/apps/lsp/src/environments/environment.prod.ts new file mode 100644 index 0000000000..c9669790be --- /dev/null +++ b/apps/lsp/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true, +}; diff --git a/apps/lsp/src/environments/environment.ts b/apps/lsp/src/environments/environment.ts new file mode 100644 index 0000000000..a20cfe5573 --- /dev/null +++ b/apps/lsp/src/environments/environment.ts @@ -0,0 +1,3 @@ +export const environment = { + production: false, +}; diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts new file mode 100644 index 0000000000..a420803c09 --- /dev/null +++ b/apps/lsp/src/main.ts @@ -0,0 +1 @@ +console.log('Hello World!'); diff --git a/apps/lsp/tsconfig.app.json b/apps/lsp/tsconfig.app.json new file mode 100644 index 0000000000..0d16dce91b --- /dev/null +++ b/apps/lsp/tsconfig.app.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/apps/lsp/tsconfig.json b/apps/lsp/tsconfig.json new file mode 100644 index 0000000000..63dbe35fb2 --- /dev/null +++ b/apps/lsp/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/apps/lsp/tsconfig.spec.json b/apps/lsp/tsconfig.spec.json new file mode 100644 index 0000000000..546f12877f --- /dev/null +++ b/apps/lsp/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/workspace.json b/workspace.json index 12cb8f1cf2..f3c740a16b 100644 --- a/workspace.json +++ b/workspace.json @@ -1,6 +1,7 @@ { "version": 2, "projects": { + "lsp": "apps/lsp", "npm": "libs/npm", "schema": "libs/schema", "server": "libs/server", From c635416dc9071c94ecf6ee12bb3cd397aa939bed Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 28 Jul 2022 09:39:59 -0400 Subject: [PATCH 02/27] rename server to utils --- apps/vscode/src/main.ts | 2 +- libs/server/package.json | 4 ---- libs/typescript-plugin/src/lib/typescript-plugin.ts | 4 ++-- libs/{server => utils}/.eslintrc.json | 0 libs/{server => utils}/jest.config.ts | 4 ++-- libs/utils/package.json | 4 ++++ libs/{server => utils}/project.json | 6 +++--- libs/{server => utils}/src/index.ts | 0 libs/{server => utils}/src/lib/abstract-tree-provider.ts | 0 libs/{server => utils}/src/lib/check-is-nx-workspace.ts | 0 libs/{server => utils}/src/lib/telemetry/index.ts | 2 +- libs/{server => utils}/src/lib/telemetry/init.ts | 0 libs/{server => utils}/src/lib/telemetry/message-builder.ts | 0 libs/{server => utils}/src/lib/telemetry/record.ts | 0 libs/{server => utils}/src/lib/telemetry/sink.ts | 0 .../src/lib/telemetry/sinks/google-analytics-sink.ts | 0 libs/{server => utils}/src/lib/telemetry/sinks/index.ts | 0 .../src/lib/telemetry/sinks/logger-sink.spec.ts | 0 .../src/lib/telemetry/sinks/logger-sink.ts | 0 .../src/lib/telemetry/sinks/memory-sink.spec.ts | 0 .../src/lib/telemetry/sinks/memory-sink.ts | 0 .../src/lib/telemetry/sinks/telemetry-parameters.ts | 0 libs/{server => utils}/src/lib/telemetry/telemetry.spec.ts | 0 libs/{server => utils}/src/lib/telemetry/telemetry.ts | 0 libs/{server => utils}/src/lib/telemetry/user.spec.ts | 0 libs/{server => utils}/src/lib/telemetry/user.ts | 0 libs/{server => utils}/src/lib/utils/build-project-path.ts | 0 libs/{server => utils}/src/lib/utils/find-config.ts | 0 libs/{server => utils}/src/lib/utils/get-executors.ts | 0 libs/{server => utils}/src/lib/utils/get-generators.ts | 0 libs/{server => utils}/src/lib/utils/ng-version.ts | 0 libs/{server => utils}/src/lib/utils/output-channel.ts | 0 libs/{server => utils}/src/lib/utils/read-collections.ts | 0 libs/{server => utils}/src/lib/utils/read-projects.ts | 0 libs/{server => utils}/src/lib/utils/shell-execution.ts | 0 libs/{server => utils}/src/lib/utils/utils.spec.ts | 0 libs/{server => utils}/src/lib/utils/utils.ts | 0 libs/{server => utils}/src/lib/utils/watch-file.ts | 0 libs/{server => utils}/tsconfig.json | 0 libs/{server => utils}/tsconfig.lib.json | 0 libs/{server => utils}/tsconfig.spec.json | 0 libs/vscode/json-schema/src/lib/project-json-schema.ts | 2 +- libs/vscode/json-schema/src/lib/workspace-json-schema.ts | 2 +- .../vscode/nx-commands-view/src/lib/nx-commands-provider.ts | 2 +- libs/vscode/nx-conversion/src/lib/vscode-nx-conversion.ts | 2 +- .../nx-project-view/src/lib/nx-project-tree-provider.ts | 2 +- .../nx-run-target-view/src/lib/run-target-tree-provider.ts | 2 +- libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts | 2 +- .../vscode/nx-workspace/src/lib/get-nx-workspace-package.ts | 2 +- libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts | 4 ++-- libs/vscode/nx-workspace/src/lib/nx-workspace.ts | 2 +- libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts | 2 +- .../nx-workspace/src/lib/workspace-codelens-provider.ts | 2 +- libs/vscode/project-graph/src/lib/create-project-graph.ts | 2 +- libs/vscode/tasks/src/lib/cli-task-commands.ts | 2 +- libs/vscode/tasks/src/lib/cli-task-provider.ts | 2 +- libs/vscode/tasks/src/lib/cli-task.ts | 2 +- libs/vscode/tasks/src/lib/nx-task-commands.ts | 2 +- libs/vscode/tasks/src/lib/nx-task.ts | 2 +- libs/vscode/tasks/src/lib/select-generator.ts | 2 +- libs/vscode/verify/src/lib/verify-builder-definition.ts | 6 +----- libs/vscode/webview/src/lib/get-task-execution-schema.ts | 2 +- libs/vscode/webview/src/lib/webview.ts | 2 +- tsconfig.base.json | 2 +- workspace.json | 2 +- 65 files changed, 38 insertions(+), 42 deletions(-) delete mode 100644 libs/server/package.json rename libs/{server => utils}/.eslintrc.json (100%) rename libs/{server => utils}/jest.config.ts (66%) create mode 100644 libs/utils/package.json rename libs/{server => utils}/project.json (65%) rename libs/{server => utils}/src/index.ts (100%) rename libs/{server => utils}/src/lib/abstract-tree-provider.ts (100%) rename libs/{server => utils}/src/lib/check-is-nx-workspace.ts (100%) rename libs/{server => utils}/src/lib/telemetry/index.ts (54%) rename libs/{server => utils}/src/lib/telemetry/init.ts (100%) rename libs/{server => utils}/src/lib/telemetry/message-builder.ts (100%) rename libs/{server => utils}/src/lib/telemetry/record.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sink.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/google-analytics-sink.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/index.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/logger-sink.spec.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/logger-sink.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/memory-sink.spec.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/memory-sink.ts (100%) rename libs/{server => utils}/src/lib/telemetry/sinks/telemetry-parameters.ts (100%) rename libs/{server => utils}/src/lib/telemetry/telemetry.spec.ts (100%) rename libs/{server => utils}/src/lib/telemetry/telemetry.ts (100%) rename libs/{server => utils}/src/lib/telemetry/user.spec.ts (100%) rename libs/{server => utils}/src/lib/telemetry/user.ts (100%) rename libs/{server => utils}/src/lib/utils/build-project-path.ts (100%) rename libs/{server => utils}/src/lib/utils/find-config.ts (100%) rename libs/{server => utils}/src/lib/utils/get-executors.ts (100%) rename libs/{server => utils}/src/lib/utils/get-generators.ts (100%) rename libs/{server => utils}/src/lib/utils/ng-version.ts (100%) rename libs/{server => utils}/src/lib/utils/output-channel.ts (100%) rename libs/{server => utils}/src/lib/utils/read-collections.ts (100%) rename libs/{server => utils}/src/lib/utils/read-projects.ts (100%) rename libs/{server => utils}/src/lib/utils/shell-execution.ts (100%) rename libs/{server => utils}/src/lib/utils/utils.spec.ts (100%) rename libs/{server => utils}/src/lib/utils/utils.ts (100%) rename libs/{server => utils}/src/lib/utils/watch-file.ts (100%) rename libs/{server => utils}/tsconfig.json (100%) rename libs/{server => utils}/tsconfig.lib.json (100%) rename libs/{server => utils}/tsconfig.spec.json (100%) diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index 7ace82b5a6..cb7c796729 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -26,7 +26,7 @@ import { watchFile, fileExists, checkIsNxWorkspace, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { GlobalConfigurationStore, WorkspaceConfigurationStore, diff --git a/libs/server/package.json b/libs/server/package.json deleted file mode 100644 index 3ce2b0e9ac..0000000000 --- a/libs/server/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@nx-console/server", - "version": "0.0.1" -} diff --git a/libs/typescript-plugin/src/lib/typescript-plugin.ts b/libs/typescript-plugin/src/lib/typescript-plugin.ts index 569dbbd20d..610e68162a 100644 --- a/libs/typescript-plugin/src/lib/typescript-plugin.ts +++ b/libs/typescript-plugin/src/lib/typescript-plugin.ts @@ -3,7 +3,7 @@ import { findConfig, readAndCacheJsonFile, watchFile, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { GlobalConfigurationStore, WorkspaceConfigurationStore, @@ -83,7 +83,7 @@ export async function enableTypeScriptPlugin(context: vscode.ExtensionContext) { if (!enableLibraryImports) { vscode.window.setStatusBarMessage( - 'Restarting the TypeScript Server', + 'Restarting the TypeScript Utils', 5000 ); await vscode.commands.executeCommand('typescript.restartTsServer'); diff --git a/libs/server/.eslintrc.json b/libs/utils/.eslintrc.json similarity index 100% rename from libs/server/.eslintrc.json rename to libs/utils/.eslintrc.json diff --git a/libs/server/jest.config.ts b/libs/utils/jest.config.ts similarity index 66% rename from libs/server/jest.config.ts rename to libs/utils/jest.config.ts index d1ce8c4631..597c82da94 100644 --- a/libs/server/jest.config.ts +++ b/libs/utils/jest.config.ts @@ -1,7 +1,7 @@ export default { - coverageDirectory: '../../coverage/libs/server', + coverageDirectory: '../../coverage/libs/utils', globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' } }, - displayName: 'server', + displayName: 'utils', testEnvironment: 'node', preset: '../../jest.preset.js', }; diff --git a/libs/utils/package.json b/libs/utils/package.json new file mode 100644 index 0000000000..8788b4ea0a --- /dev/null +++ b/libs/utils/package.json @@ -0,0 +1,4 @@ +{ + "name": "@nx-console/utils", + "version": "0.0.1" +} diff --git a/libs/server/project.json b/libs/utils/project.json similarity index 65% rename from libs/server/project.json rename to libs/utils/project.json index c1402177d2..cecb215768 100644 --- a/libs/server/project.json +++ b/libs/utils/project.json @@ -1,15 +1,15 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/server/src", + "sourceRoot": "libs/utils/src", "projectType": "library", "targets": { "test": { "executor": "@nrwl/jest:jest", "options": { - "jestConfig": "libs/server/jest.config.ts", + "jestConfig": "libs/utils/jest.config.ts", "passWithNoTests": true }, - "outputs": ["coverage/libs/server"] + "outputs": ["coverage/libs/utils"] } }, "tags": [] diff --git a/libs/server/src/index.ts b/libs/utils/src/index.ts similarity index 100% rename from libs/server/src/index.ts rename to libs/utils/src/index.ts diff --git a/libs/server/src/lib/abstract-tree-provider.ts b/libs/utils/src/lib/abstract-tree-provider.ts similarity index 100% rename from libs/server/src/lib/abstract-tree-provider.ts rename to libs/utils/src/lib/abstract-tree-provider.ts diff --git a/libs/server/src/lib/check-is-nx-workspace.ts b/libs/utils/src/lib/check-is-nx-workspace.ts similarity index 100% rename from libs/server/src/lib/check-is-nx-workspace.ts rename to libs/utils/src/lib/check-is-nx-workspace.ts diff --git a/libs/server/src/lib/telemetry/index.ts b/libs/utils/src/lib/telemetry/index.ts similarity index 54% rename from libs/server/src/lib/telemetry/index.ts rename to libs/utils/src/lib/telemetry/index.ts index 99547df1e6..6749287db2 100644 --- a/libs/server/src/lib/telemetry/index.ts +++ b/libs/utils/src/lib/telemetry/index.ts @@ -1,2 +1,2 @@ export * from './telemetry'; -export * from './init' +export * from './init'; diff --git a/libs/server/src/lib/telemetry/init.ts b/libs/utils/src/lib/telemetry/init.ts similarity index 100% rename from libs/server/src/lib/telemetry/init.ts rename to libs/utils/src/lib/telemetry/init.ts diff --git a/libs/server/src/lib/telemetry/message-builder.ts b/libs/utils/src/lib/telemetry/message-builder.ts similarity index 100% rename from libs/server/src/lib/telemetry/message-builder.ts rename to libs/utils/src/lib/telemetry/message-builder.ts diff --git a/libs/server/src/lib/telemetry/record.ts b/libs/utils/src/lib/telemetry/record.ts similarity index 100% rename from libs/server/src/lib/telemetry/record.ts rename to libs/utils/src/lib/telemetry/record.ts diff --git a/libs/server/src/lib/telemetry/sink.ts b/libs/utils/src/lib/telemetry/sink.ts similarity index 100% rename from libs/server/src/lib/telemetry/sink.ts rename to libs/utils/src/lib/telemetry/sink.ts diff --git a/libs/server/src/lib/telemetry/sinks/google-analytics-sink.ts b/libs/utils/src/lib/telemetry/sinks/google-analytics-sink.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/google-analytics-sink.ts rename to libs/utils/src/lib/telemetry/sinks/google-analytics-sink.ts diff --git a/libs/server/src/lib/telemetry/sinks/index.ts b/libs/utils/src/lib/telemetry/sinks/index.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/index.ts rename to libs/utils/src/lib/telemetry/sinks/index.ts diff --git a/libs/server/src/lib/telemetry/sinks/logger-sink.spec.ts b/libs/utils/src/lib/telemetry/sinks/logger-sink.spec.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/logger-sink.spec.ts rename to libs/utils/src/lib/telemetry/sinks/logger-sink.spec.ts diff --git a/libs/server/src/lib/telemetry/sinks/logger-sink.ts b/libs/utils/src/lib/telemetry/sinks/logger-sink.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/logger-sink.ts rename to libs/utils/src/lib/telemetry/sinks/logger-sink.ts diff --git a/libs/server/src/lib/telemetry/sinks/memory-sink.spec.ts b/libs/utils/src/lib/telemetry/sinks/memory-sink.spec.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/memory-sink.spec.ts rename to libs/utils/src/lib/telemetry/sinks/memory-sink.spec.ts diff --git a/libs/server/src/lib/telemetry/sinks/memory-sink.ts b/libs/utils/src/lib/telemetry/sinks/memory-sink.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/memory-sink.ts rename to libs/utils/src/lib/telemetry/sinks/memory-sink.ts diff --git a/libs/server/src/lib/telemetry/sinks/telemetry-parameters.ts b/libs/utils/src/lib/telemetry/sinks/telemetry-parameters.ts similarity index 100% rename from libs/server/src/lib/telemetry/sinks/telemetry-parameters.ts rename to libs/utils/src/lib/telemetry/sinks/telemetry-parameters.ts diff --git a/libs/server/src/lib/telemetry/telemetry.spec.ts b/libs/utils/src/lib/telemetry/telemetry.spec.ts similarity index 100% rename from libs/server/src/lib/telemetry/telemetry.spec.ts rename to libs/utils/src/lib/telemetry/telemetry.spec.ts diff --git a/libs/server/src/lib/telemetry/telemetry.ts b/libs/utils/src/lib/telemetry/telemetry.ts similarity index 100% rename from libs/server/src/lib/telemetry/telemetry.ts rename to libs/utils/src/lib/telemetry/telemetry.ts diff --git a/libs/server/src/lib/telemetry/user.spec.ts b/libs/utils/src/lib/telemetry/user.spec.ts similarity index 100% rename from libs/server/src/lib/telemetry/user.spec.ts rename to libs/utils/src/lib/telemetry/user.spec.ts diff --git a/libs/server/src/lib/telemetry/user.ts b/libs/utils/src/lib/telemetry/user.ts similarity index 100% rename from libs/server/src/lib/telemetry/user.ts rename to libs/utils/src/lib/telemetry/user.ts diff --git a/libs/server/src/lib/utils/build-project-path.ts b/libs/utils/src/lib/utils/build-project-path.ts similarity index 100% rename from libs/server/src/lib/utils/build-project-path.ts rename to libs/utils/src/lib/utils/build-project-path.ts diff --git a/libs/server/src/lib/utils/find-config.ts b/libs/utils/src/lib/utils/find-config.ts similarity index 100% rename from libs/server/src/lib/utils/find-config.ts rename to libs/utils/src/lib/utils/find-config.ts diff --git a/libs/server/src/lib/utils/get-executors.ts b/libs/utils/src/lib/utils/get-executors.ts similarity index 100% rename from libs/server/src/lib/utils/get-executors.ts rename to libs/utils/src/lib/utils/get-executors.ts diff --git a/libs/server/src/lib/utils/get-generators.ts b/libs/utils/src/lib/utils/get-generators.ts similarity index 100% rename from libs/server/src/lib/utils/get-generators.ts rename to libs/utils/src/lib/utils/get-generators.ts diff --git a/libs/server/src/lib/utils/ng-version.ts b/libs/utils/src/lib/utils/ng-version.ts similarity index 100% rename from libs/server/src/lib/utils/ng-version.ts rename to libs/utils/src/lib/utils/ng-version.ts diff --git a/libs/server/src/lib/utils/output-channel.ts b/libs/utils/src/lib/utils/output-channel.ts similarity index 100% rename from libs/server/src/lib/utils/output-channel.ts rename to libs/utils/src/lib/utils/output-channel.ts diff --git a/libs/server/src/lib/utils/read-collections.ts b/libs/utils/src/lib/utils/read-collections.ts similarity index 100% rename from libs/server/src/lib/utils/read-collections.ts rename to libs/utils/src/lib/utils/read-collections.ts diff --git a/libs/server/src/lib/utils/read-projects.ts b/libs/utils/src/lib/utils/read-projects.ts similarity index 100% rename from libs/server/src/lib/utils/read-projects.ts rename to libs/utils/src/lib/utils/read-projects.ts diff --git a/libs/server/src/lib/utils/shell-execution.ts b/libs/utils/src/lib/utils/shell-execution.ts similarity index 100% rename from libs/server/src/lib/utils/shell-execution.ts rename to libs/utils/src/lib/utils/shell-execution.ts diff --git a/libs/server/src/lib/utils/utils.spec.ts b/libs/utils/src/lib/utils/utils.spec.ts similarity index 100% rename from libs/server/src/lib/utils/utils.spec.ts rename to libs/utils/src/lib/utils/utils.spec.ts diff --git a/libs/server/src/lib/utils/utils.ts b/libs/utils/src/lib/utils/utils.ts similarity index 100% rename from libs/server/src/lib/utils/utils.ts rename to libs/utils/src/lib/utils/utils.ts diff --git a/libs/server/src/lib/utils/watch-file.ts b/libs/utils/src/lib/utils/watch-file.ts similarity index 100% rename from libs/server/src/lib/utils/watch-file.ts rename to libs/utils/src/lib/utils/watch-file.ts diff --git a/libs/server/tsconfig.json b/libs/utils/tsconfig.json similarity index 100% rename from libs/server/tsconfig.json rename to libs/utils/tsconfig.json diff --git a/libs/server/tsconfig.lib.json b/libs/utils/tsconfig.lib.json similarity index 100% rename from libs/server/tsconfig.lib.json rename to libs/utils/tsconfig.lib.json diff --git a/libs/server/tsconfig.spec.json b/libs/utils/tsconfig.spec.json similarity index 100% rename from libs/server/tsconfig.spec.json rename to libs/utils/tsconfig.spec.json diff --git a/libs/vscode/json-schema/src/lib/project-json-schema.ts b/libs/vscode/json-schema/src/lib/project-json-schema.ts index fc40e0107a..f8712b5403 100644 --- a/libs/vscode/json-schema/src/lib/project-json-schema.ts +++ b/libs/vscode/json-schema/src/lib/project-json-schema.ts @@ -1,5 +1,5 @@ import { CollectionInfo } from '@nx-console/schema'; -import { getExecutors, watchFile } from '@nx-console/server'; +import { getExecutors, watchFile } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { join } from 'path'; diff --git a/libs/vscode/json-schema/src/lib/workspace-json-schema.ts b/libs/vscode/json-schema/src/lib/workspace-json-schema.ts index c7d87c6bca..5e067fe087 100644 --- a/libs/vscode/json-schema/src/lib/workspace-json-schema.ts +++ b/libs/vscode/json-schema/src/lib/workspace-json-schema.ts @@ -1,5 +1,5 @@ import { CollectionInfo } from '@nx-console/schema'; -import { getExecutors, watchFile } from '@nx-console/server'; +import { getExecutors, watchFile } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { dirname, join } from 'path'; diff --git a/libs/vscode/nx-commands-view/src/lib/nx-commands-provider.ts b/libs/vscode/nx-commands-view/src/lib/nx-commands-provider.ts index 7369d1c354..a6ca80ec30 100644 --- a/libs/vscode/nx-commands-view/src/lib/nx-commands-provider.ts +++ b/libs/vscode/nx-commands-view/src/lib/nx-commands-provider.ts @@ -1,4 +1,4 @@ -import { AbstractTreeProvider } from '@nx-console/server'; +import { AbstractTreeProvider } from '@nx-console/utils'; import { NxCommandsTreeItem } from './nx-commands-tree-item'; import { ExtensionContext } from 'vscode'; diff --git a/libs/vscode/nx-conversion/src/lib/vscode-nx-conversion.ts b/libs/vscode/nx-conversion/src/lib/vscode-nx-conversion.ts index 8e22aac8e3..8220590b23 100644 --- a/libs/vscode/nx-conversion/src/lib/vscode-nx-conversion.ts +++ b/libs/vscode/nx-conversion/src/lib/vscode-nx-conversion.ts @@ -1,4 +1,4 @@ -import { getShellExecutionForConfig, getTelemetry } from '@nx-console/server'; +import { getShellExecutionForConfig, getTelemetry } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { pipe, Subject } from 'rxjs'; import { filter, scan, tap } from 'rxjs/operators'; diff --git a/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts b/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts index 132575da34..690054f482 100644 --- a/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts +++ b/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts @@ -2,7 +2,7 @@ import { AbstractTreeProvider, clearJsonCache, getOutputChannel, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { revealNxProject } from '@nx-console/vscode/nx-workspace'; import { CliTaskProvider } from '@nx-console/vscode/tasks'; diff --git a/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts b/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts index ea1030b3b3..2cd945262b 100644 --- a/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts +++ b/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts @@ -1,4 +1,4 @@ -import { AbstractTreeProvider, clearJsonCache } from '@nx-console/server'; +import { AbstractTreeProvider, clearJsonCache } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { commands, ExtensionContext, TreeItem } from 'vscode'; diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts index 9634995857..a7f2470294 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts @@ -3,7 +3,7 @@ import type { ProjectGraph, ProjectsConfigurations, } from '@nrwl/devkit'; -import { readAndCacheJsonFile } from '@nx-console/server'; +import { readAndCacheJsonFile } from '@nx-console/utils'; import { join } from 'path'; import { getNxProjectGraph, diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts index a69d1f8244..561b4de875 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts @@ -1,5 +1,5 @@ import { workspaceDependencyPath } from '@nx-console/npm'; -import { fileExists, getOutputChannel } from '@nx-console/server'; +import { fileExists, getOutputChannel } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import type * as NxFileUtils from 'nx/src/project-graph/file-utils'; import type * as NxProjectGraph from 'nx/src/project-graph/project-graph'; diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts index 86829931d6..469f4e3278 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts @@ -1,7 +1,7 @@ import { nxWorkspace } from './nx-workspace'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; -import * as server from '@nx-console/server'; -import { getOutputChannel, getTelemetry, fileExists } from '@nx-console/server'; +import * as server from '@nx-console/utils'; +import { getOutputChannel, getTelemetry, fileExists } from '@nx-console/utils'; import { mocked } from 'ts-jest/utils'; import type { NxJsonConfiguration, diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts index f58f5b3536..49eed602a0 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts @@ -5,7 +5,7 @@ import { getOutputChannel, getTelemetry, toWorkspaceFormat, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { diff --git a/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts b/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts index 44fa8e46dc..f26bd1b619 100644 --- a/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts +++ b/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts @@ -1,4 +1,4 @@ -import { buildProjectPath, fileExists } from '@nx-console/server'; +import { buildProjectPath, fileExists } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { Selection, TextDocument, Uri, window, workspace } from 'vscode'; diff --git a/libs/vscode/nx-workspace/src/lib/workspace-codelens-provider.ts b/libs/vscode/nx-workspace/src/lib/workspace-codelens-provider.ts index 90e797f6bd..e3f577763a 100644 --- a/libs/vscode/nx-workspace/src/lib/workspace-codelens-provider.ts +++ b/libs/vscode/nx-workspace/src/lib/workspace-codelens-provider.ts @@ -20,7 +20,7 @@ import { GlobalConfigurationStore, WorkspaceConfigurationStore, } from '@nx-console/vscode/configuration'; -import { buildProjectPath } from '@nx-console/server'; +import { buildProjectPath } from '@nx-console/utils'; export class TargetCodeLens extends CodeLens { constructor( diff --git a/libs/vscode/project-graph/src/lib/create-project-graph.ts b/libs/vscode/project-graph/src/lib/create-project-graph.ts index addeeccd05..3de3605ae2 100644 --- a/libs/vscode/project-graph/src/lib/create-project-graph.ts +++ b/libs/vscode/project-graph/src/lib/create-project-graph.ts @@ -1,5 +1,5 @@ import { detectPackageManager, getPackageManagerCommand } from '@nrwl/devkit'; -import { getOutputChannel } from '@nx-console/server'; +import { getOutputChannel } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { execSync } from 'child_process'; import * as cacheDir from 'find-cache-dir'; diff --git a/libs/vscode/tasks/src/lib/cli-task-commands.ts b/libs/vscode/tasks/src/lib/cli-task-commands.ts index 91cf6b4fae..b4ab059406 100644 --- a/libs/vscode/tasks/src/lib/cli-task-commands.ts +++ b/libs/vscode/tasks/src/lib/cli-task-commands.ts @@ -13,7 +13,7 @@ import { selectFlags } from './select-flags'; import { GeneratorType, Option, OptionType } from '@nx-console/schema'; import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; import { selectGenerator } from './select-generator'; -import { getGenerators } from '@nx-console/server'; +import { getGenerators } from '@nx-console/utils'; const CLI_COMMAND_LIST = [ 'build', diff --git a/libs/vscode/tasks/src/lib/cli-task-provider.ts b/libs/vscode/tasks/src/lib/cli-task-provider.ts index 169b8bd64d..89ee09d0ff 100644 --- a/libs/vscode/tasks/src/lib/cli-task-provider.ts +++ b/libs/vscode/tasks/src/lib/cli-task-provider.ts @@ -3,7 +3,7 @@ import { WorkspaceProjects, WORKSPACE_GENERATOR_NAME_REGEX, } from '@nx-console/schema'; -import { getTelemetry } from '@nx-console/server'; +import { getTelemetry } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { NxConversion } from '@nx-console/vscode/nx-conversion'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; diff --git a/libs/vscode/tasks/src/lib/cli-task.ts b/libs/vscode/tasks/src/lib/cli-task.ts index 2906b44686..02149c2376 100644 --- a/libs/vscode/tasks/src/lib/cli-task.ts +++ b/libs/vscode/tasks/src/lib/cli-task.ts @@ -1,7 +1,7 @@ import { checkIsNxWorkspace, getShellExecutionForConfig, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { Task, TaskGroup, TaskScope } from 'vscode'; import { CliTaskDefinition } from './cli-task-definition'; diff --git a/libs/vscode/tasks/src/lib/nx-task-commands.ts b/libs/vscode/tasks/src/lib/nx-task-commands.ts index a81f0ba32e..8fd43ab2b6 100644 --- a/libs/vscode/tasks/src/lib/nx-task-commands.ts +++ b/libs/vscode/tasks/src/lib/nx-task-commands.ts @@ -4,7 +4,7 @@ import { commands, ExtensionContext, window, tasks } from 'vscode'; import { CliTaskProvider } from './cli-task-provider'; import { selectFlags } from './select-flags'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; -import { getTelemetry } from '@nx-console/server'; +import { getTelemetry } from '@nx-console/utils'; import { NxTask } from './nx-task'; let cliTaskProvider: CliTaskProvider; diff --git a/libs/vscode/tasks/src/lib/nx-task.ts b/libs/vscode/tasks/src/lib/nx-task.ts index 3d734cafdb..48e8754271 100644 --- a/libs/vscode/tasks/src/lib/nx-task.ts +++ b/libs/vscode/tasks/src/lib/nx-task.ts @@ -1,4 +1,4 @@ -import { getShellExecutionForConfig } from '@nx-console/server'; +import { getShellExecutionForConfig } from '@nx-console/utils'; import { Task, TaskScope } from 'vscode'; export interface NxTaskDefinition { diff --git a/libs/vscode/tasks/src/lib/select-generator.ts b/libs/vscode/tasks/src/lib/select-generator.ts index 5887d1cd68..791076bfb1 100644 --- a/libs/vscode/tasks/src/lib/select-generator.ts +++ b/libs/vscode/tasks/src/lib/select-generator.ts @@ -8,7 +8,7 @@ import { getGenerators, normalizeSchema, readAndCacheJsonFile, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { GlobalConfigurationStore } from '@nx-console/vscode/configuration'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { QuickPickItem, window } from 'vscode'; diff --git a/libs/vscode/verify/src/lib/verify-builder-definition.ts b/libs/vscode/verify/src/lib/verify-builder-definition.ts index 6d3a0058f5..28c0415303 100644 --- a/libs/vscode/verify/src/lib/verify-builder-definition.ts +++ b/libs/vscode/verify/src/lib/verify-builder-definition.ts @@ -1,10 +1,6 @@ import { Option, OptionType } from '@nx-console/schema'; import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; -import { - fileExists, - getTelemetry, - readBuilderSchema, -} from '@nx-console/server'; +import { fileExists, getTelemetry, readBuilderSchema } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { window } from 'vscode'; diff --git a/libs/vscode/webview/src/lib/get-task-execution-schema.ts b/libs/vscode/webview/src/lib/get-task-execution-schema.ts index c676fccd65..ceb2e080f0 100644 --- a/libs/vscode/webview/src/lib/get-task-execution-schema.ts +++ b/libs/vscode/webview/src/lib/get-task-execution-schema.ts @@ -3,7 +3,7 @@ import { getOutputChannel, getTelemetry, readTargetDef, -} from '@nx-console/server'; +} from '@nx-console/utils'; import { findProjectWithPath, nxWorkspace, diff --git a/libs/vscode/webview/src/lib/webview.ts b/libs/vscode/webview/src/lib/webview.ts index 505df9c355..764a54de63 100644 --- a/libs/vscode/webview/src/lib/webview.ts +++ b/libs/vscode/webview/src/lib/webview.ts @@ -13,7 +13,7 @@ import { import { CliTaskProvider } from '@nx-console/vscode/tasks'; import { RunTargetTreeItem } from '@nx-console/vscode/nx-run-target-view'; -import { getTelemetry } from '@nx-console/server'; +import { getTelemetry } from '@nx-console/utils'; import { TaskExecutionSchema, TaskExecutionMessage } from '@nx-console/schema'; import { getTaskExecutionSchema } from './get-task-execution-schema'; import { watch } from 'fs'; diff --git a/tsconfig.base.json b/tsconfig.base.json index fc9851cab5..00ae580c9d 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -23,8 +23,8 @@ "paths": { "@nx-console/npm": ["libs/npm/src/index.ts"], "@nx-console/schema": ["libs/schema/src/index.ts"], - "@nx-console/server": ["libs/server/src/index.ts"], "@nx-console/typescript-plugin": ["libs/typescript-plugin/src/index.ts"], + "@nx-console/utils": ["libs/utils/src/index.ts"], "@nx-console/vscode-ui/argument-list": [ "libs/vscode-ui/argument-list/src/index.ts" ], diff --git a/workspace.json b/workspace.json index f3c740a16b..5bbd0eaba4 100644 --- a/workspace.json +++ b/workspace.json @@ -4,8 +4,8 @@ "lsp": "apps/lsp", "npm": "libs/npm", "schema": "libs/schema", - "server": "libs/server", "typescript-plugin": "libs/typescript-plugin", + "utils": "libs/utils", "vscode": "apps/vscode", "vscode-configuration": "libs/vscode/configuration", "vscode-json-schema": "libs/vscode/json-schema", From 89d74dd51a19b22251d07ed0bae63de2dbc2b5f9 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 28 Jul 2022 09:55:09 -0400 Subject: [PATCH 03/27] add lsp deps --- package.json | 3 +++ yarn.lock | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/package.json b/package.json index e4ca264978..b5bdf874a0 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "find-cache-dir": "^3.3.2", "jsonc-parser": "^3.0.0", "tslib": "^2.0.0", + "vscode-json-languageservice": "^5.1.0", + "vscode-languageclient": "^8.0.2", + "vscode-languageserver": "^8.0.2", "xstate": "^4.32.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 00940e7cc3..f5429e3a38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13570,6 +13570,11 @@ jsonc-parser@3.0.0, jsonc-parser@^3.0.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.0.0.tgz#abdd785701c7e7eaca8a9ec8cf070ca51a745a22" integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== +jsonc-parser@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.1.0.tgz#73b8f0e5c940b83d03476bc2e51a20ef0932615d" + integrity sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg== + jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" @@ -19721,6 +19726,66 @@ vsce@^2.6.3: yauzl "^2.3.1" yazl "^2.2.2" +vscode-json-languageservice@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-5.1.0.tgz#b1f197a60338cb378189fcb41489a84846724dd9" + integrity sha512-D5612D7h/Gh4A0JmdttPveWzT9dur21WXvBHWKPdOt0sLO6ILz8vN6+IzWnvwDOVAEFTpzIAMVMZwbKZkwGGiA== + dependencies: + jsonc-parser "^3.1.0" + vscode-languageserver-textdocument "^1.0.4" + vscode-languageserver-types "^3.17.1" + vscode-nls "^5.0.1" + vscode-uri "^3.0.3" + +vscode-jsonrpc@8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-8.0.2.tgz#f239ed2cd6004021b6550af9fd9d3e47eee3cac9" + integrity sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ== + +vscode-languageclient@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-8.0.2.tgz#f1f23ce8c8484aa11e4b7dfb24437d3e59bb61c6" + integrity sha512-lHlthJtphG9gibGb/y72CKqQUxwPsMXijJVpHEC2bvbFqxmkj9LwQ3aGU9dwjBLqsX1S4KjShYppLvg1UJDF/Q== + dependencies: + minimatch "^3.0.4" + semver "^7.3.5" + vscode-languageserver-protocol "3.17.2" + +vscode-languageserver-protocol@3.17.2: + version "3.17.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.2.tgz#beaa46aea06ed061576586c5e11368a9afc1d378" + integrity sha512-8kYisQ3z/SQ2kyjlNeQxbkkTNmVFoQCqkmGrzLH6A9ecPlgTbp3wDTnUNqaUxYr4vlAcloxx8zwy7G5WdguYNg== + dependencies: + vscode-jsonrpc "8.0.2" + vscode-languageserver-types "3.17.2" + +vscode-languageserver-textdocument@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.5.tgz#838769940ece626176ec5d5a2aa2d0aa69f5095c" + integrity sha512-1ah7zyQjKBudnMiHbZmxz5bYNM9KKZYz+5VQLj+yr8l+9w3g+WAhCkUkWbhMEdC5u0ub4Ndiye/fDyS8ghIKQg== + +vscode-languageserver-types@3.17.2, vscode-languageserver-types@^3.17.1: + version "3.17.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz#b2c2e7de405ad3d73a883e91989b850170ffc4f2" + integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA== + +vscode-languageserver@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz#cfe2f0996d9dfd40d3854e786b2821604dfec06d" + integrity sha512-bpEt2ggPxKzsAOZlXmCJ50bV7VrxwCS5BI4+egUmure/oI/t4OlFzi/YNtVvY24A2UDOZAgwFGgnZPwqSJubkA== + dependencies: + vscode-languageserver-protocol "3.17.2" + +vscode-nls@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2" + integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A== + +vscode-uri@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.3.tgz#a95c1ce2e6f41b7549f86279d19f47951e4f4d84" + integrity sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA== + w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" From 2ecfe27d963e62dc6dd64520e43db0a0140e7324 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 28 Jul 2022 20:51:41 -0400 Subject: [PATCH 04/27] add json-langaugeservice --- apps/lsp/src/app/.gitkeep | 0 apps/lsp/src/json-documents.ts | 24 +++++++++ apps/lsp/src/main.ts | 91 +++++++++++++++++++++++++++++++++- apps/vscode/src/lsp-client.ts | 54 ++++++++++++++++++++ apps/vscode/src/main.ts | 3 ++ 5 files changed, 171 insertions(+), 1 deletion(-) delete mode 100644 apps/lsp/src/app/.gitkeep create mode 100644 apps/lsp/src/json-documents.ts create mode 100644 apps/vscode/src/lsp-client.ts diff --git a/apps/lsp/src/app/.gitkeep b/apps/lsp/src/app/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/lsp/src/json-documents.ts b/apps/lsp/src/json-documents.ts new file mode 100644 index 0000000000..8c4b2444db --- /dev/null +++ b/apps/lsp/src/json-documents.ts @@ -0,0 +1,24 @@ +import { JSONDocument, TextDocument } from 'vscode-json-languageservice'; + +const cache = new Map(); + +export function jsonDocumentsMapper( + parse: (document: TextDocument) => JSONDocument +) { + return { + get(document: TextDocument): JSONDocument { + let jsonDocument = cache.get(document.uri); + if (jsonDocument) { + return jsonDocument; + } + + jsonDocument = parse(document); + cache.set(document.uri, jsonDocument); + + return jsonDocument; + }, + remove(document: TextDocument) { + cache.delete(document.uri); + }, + }; +} diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index a420803c09..75b0346963 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -1 +1,90 @@ -console.log('Hello World!'); +import { + ClientCapabilities, + getLanguageService, + JSONDocument, + TextDocument, +} from 'vscode-json-languageservice'; +import { + createConnection, + InitializeResult, + ProposedFeatures, + TextDocuments, + TextDocumentSyncKind, +} from 'vscode-languageserver/node'; +import { Utils, URI } from 'vscode-uri'; +import { jsonDocumentsMapper } from './json-documents'; + +const workspaceContext = { + resolveRelativePath: (relativePath: string, resource: string) => { + const base = resource.substring(0, resource.lastIndexOf('/') + 1); + return Utils.resolvePath(URI.parse(base), relativePath).toString(); + }, +}; + +const connection = createConnection(ProposedFeatures.all); + +let languageService = getLanguageService({ + workspaceContext, + contributions: [], + clientCapabilities: ClientCapabilities.LATEST, +}); + +const jsonDocumentMapper = jsonDocumentsMapper((document) => + languageService.parseJSONDocument(document) +); + +// Create a text document manager. +const documents = new TextDocuments(TextDocument); + +// Make the text document manager listen on the connection +// for open, change and close text document events +documents.listen(connection); + +documents.onDidClose((e) => { + jsonDocumentMapper.remove(e.document); +}); + +connection.onInitialize((params) => { + // TODO: add capability checks + const capabilities = params.capabilities; + + const initializationOptions = params.initializationOptions ?? {}; + + const handledProtocols = initializationOptions?.handledSchemaProtocols; + + languageService = getLanguageService({ + // schemaRequestService: getSchemaRequestService(handledProtocols), + workspaceContext, + contributions: [], + clientCapabilities: params.capabilities, + }); + + const result: InitializeResult = { + capabilities: { + textDocumentSync: TextDocumentSyncKind.Incremental, + completionProvider: { + resolveProvider: false, + }, + }, + }; + + return result; +}); + +connection.onCompletion((completionParams) => { + const document = documents.get(completionParams.textDocument.uri); + if (document) { + const jsonDocument = getJsonDocument(document); + return languageService.doComplete( + document, + completionParams.position, + jsonDocument + ); + } +}); + +function getJsonDocument(document: TextDocument) { + return jsonDocumentMapper.get(document); +} + +connection.listen(); diff --git a/apps/vscode/src/lsp-client.ts b/apps/vscode/src/lsp-client.ts new file mode 100644 index 0000000000..679e19edb4 --- /dev/null +++ b/apps/vscode/src/lsp-client.ts @@ -0,0 +1,54 @@ +import { join } from 'path'; +import { ExtensionContext } from 'vscode'; +import { + LanguageClient, + LanguageClientOptions, + ServerOptions, + TransportKind, +} from 'vscode-languageclient/node'; + +let client: LanguageClient; + +export function lspClient(context: ExtensionContext) { + const serverModule = context.asAbsolutePath(join('lsp', 'main.js')); + + const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }; + const serverOptions: ServerOptions = { + run: { module: serverModule, transport: TransportKind.ipc }, + debug: { + module: serverModule, + transport: TransportKind.ipc, + options: debugOptions, + }, + }; + + // Options to control the language client + const clientOptions: LanguageClientOptions = { + // Register the server for plain text documents + documentSelector: [ + { scheme: 'file', language: 'json', pattern: '**/nx.json' }, + { scheme: 'file', language: 'json', pattern: '**/project.json' }, + { scheme: 'file', language: 'json', pattern: '**/workspace.json' }, + ], + synchronize: {}, + }; + + client = new LanguageClient( + 'NxConsoleClient', + 'Nx Console Client', + serverOptions, + clientOptions + ); + + client.start(); + + context.subscriptions.push({ + dispose() { + if (!client) { + return; + } + + return client.stop(); + }, + }); +} diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index cb7c796729..71a200849b 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -58,6 +58,7 @@ import { REFRESH_WORKSPACE, } from './commands/refresh-workspace'; import { projectGraph } from '@nx-console/vscode/project-graph'; +import { lspClient } from './lsp-client'; let runTargetTreeView: TreeView; let nxProjectTreeView: TreeView; @@ -134,6 +135,8 @@ export async function activate(c: ExtensionContext) { await enableTypeScriptPlugin(context); + lspClient(context); + getTelemetry().extensionActivated((Date.now() - startTime) / 1000); } catch (e) { window.showErrorMessage( From edcd5d3a368160dbbc7bcb07794800f7d4d97f2f Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 2 Aug 2022 09:02:08 -0400 Subject: [PATCH 05/27] fix debug for lsp server --- .vscode/launch.json | 24 ++++++++++++++++++++++-- apps/lsp/project.json | 11 +++++++++++ apps/lsp/src/main.ts | 17 ++++++++++++----- apps/vscode/project.json | 6 +++++- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0ac20f77df..bc7a1e6190 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,11 +21,11 @@ "/**", "/Applications/Visual Studio Code.app/**" ], - "type": "pwa-extensionHost" + "type": "extensionHost" }, { "name": "Run Extension In Dev Mode", - "type": "pwa-extensionHost", + "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ @@ -37,9 +37,29 @@ "outFiles": [ "${workspaceFolder}/dist/apps/vscode", "${workspaceFolder}/dist/apps/vscode/assets/public", + "!${workspaceFolder}/dist/apps/vscode/lsp", "${workspaceFolder}/node_modules" ], "preLaunchTask": "npm: watch" + }, + { + "type": "node", + "request": "attach", + "name": "Attach to LSP Server", + "port": 6009, + "restart": true, + "sourceMaps": true, + "skipFiles": [ + "/**", + "/Applications/Visual Studio Code.app/**" + ] + // "outFiles": ["${workspaceFolder}/dist/vscode/lsp/**/*.js"] + } + ], + "compounds": [ + { + "name": "Launch Client + Server", + "configurations": ["Launch Extension", "Attach to LSP Server"] } ] } diff --git a/apps/lsp/project.json b/apps/lsp/project.json index b4187f05d4..c68d990f23 100644 --- a/apps/lsp/project.json +++ b/apps/lsp/project.json @@ -2,6 +2,17 @@ "sourceRoot": "apps/lsp/src", "projectType": "application", "targets": { + "watch": { + "executor": "@nrwl/node:webpack", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/vscode/lsp", + "main": "apps/lsp/src/main.ts", + "tsConfig": "apps/lsp/tsconfig.app.json", + "assets": ["apps/lsp/src/assets"], + "watch": true + } + }, "build": { "executor": "@nrwl/node:webpack", "outputs": ["{options.outputPath}"], diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index 75b0346963..31e9998f55 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -48,9 +48,8 @@ connection.onInitialize((params) => { // TODO: add capability checks const capabilities = params.capabilities; - const initializationOptions = params.initializationOptions ?? {}; - - const handledProtocols = initializationOptions?.handledSchemaProtocols; + // const initializationOptions = params.initializationOptions ?? {}; + // const handledProtocols = initializationOptions?.handledSchemaProtocols; languageService = getLanguageService({ // schemaRequestService: getSchemaRequestService(handledProtocols), @@ -59,6 +58,10 @@ connection.onInitialize((params) => { clientCapabilities: params.capabilities, }); + languageService.configure({ + schemas: [], + }); + const result: InitializeResult = { capabilities: { textDocumentSync: TextDocumentSyncKind.Incremental, @@ -71,16 +74,20 @@ connection.onInitialize((params) => { return result; }); -connection.onCompletion((completionParams) => { +connection.onCompletion(async (completionParams) => { const document = documents.get(completionParams.textDocument.uri); if (document) { const jsonDocument = getJsonDocument(document); - return languageService.doComplete( + const completionList = await languageService.doComplete( document, completionParams.position, jsonDocument ); + console.log(completionList); + return completionList; } + + return null; }); function getJsonDocument(document: TextDocument) { diff --git a/apps/vscode/project.json b/apps/vscode/project.json index 3d20f9fd68..bf9d76b74e 100644 --- a/apps/vscode/project.json +++ b/apps/vscode/project.json @@ -1,5 +1,4 @@ { - "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/vscode/src", "projectType": "application", "prefix": "vscode", @@ -19,6 +18,11 @@ "command": "yarn nx watch vscode-ui", "prefix": "vscode-ui", "color": "green" + }, + { + "command": "yarn nx watch lsp", + "prefix": "lsp", + "color": "magenta" } ], "parallel": true From 7bd50ea85958cab0ce902300594f7684f8cef172 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 2 Aug 2022 13:35:59 -0400 Subject: [PATCH 06/27] move json-schema lib --- apps/vscode/src/main.ts | 2 +- libs/{vscode => }/json-schema/.eslintrc.json | 2 +- libs/json-schema/README.md | 7 ++++++ libs/{vscode => }/json-schema/jest.config.ts | 6 ++--- libs/json-schema/package.json | 4 ++++ libs/json-schema/project.json | 22 +++++++++++++++++++ libs/{vscode => }/json-schema/src/index.ts | 0 .../src/lib/project-json-schema.ts | 0 .../src/lib/workspace-json-schema.ts | 0 libs/{vscode => }/json-schema/tsconfig.json | 2 +- .../json-schema/tsconfig.lib.json | 2 +- .../json-schema/tsconfig.spec.json | 2 +- libs/vscode/json-schema/README.md | 7 ------ libs/vscode/json-schema/package.json | 4 ---- libs/vscode/json-schema/project.json | 22 ------------------- tsconfig.base.json | 4 +--- workspace.json | 2 +- 17 files changed, 43 insertions(+), 45 deletions(-) rename libs/{vscode => }/json-schema/.eslintrc.json (86%) create mode 100644 libs/json-schema/README.md rename libs/{vscode => }/json-schema/jest.config.ts (62%) create mode 100644 libs/json-schema/package.json create mode 100644 libs/json-schema/project.json rename libs/{vscode => }/json-schema/src/index.ts (100%) rename libs/{vscode => }/json-schema/src/lib/project-json-schema.ts (100%) rename libs/{vscode => }/json-schema/src/lib/workspace-json-schema.ts (100%) rename libs/{vscode => }/json-schema/tsconfig.json (78%) rename libs/{vscode => }/json-schema/tsconfig.lib.json (85%) rename libs/{vscode => }/json-schema/tsconfig.spec.json (89%) delete mode 100644 libs/vscode/json-schema/README.md delete mode 100644 libs/vscode/json-schema/package.json delete mode 100644 libs/vscode/json-schema/project.json diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index 71a200849b..933672a589 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -50,7 +50,7 @@ import { environment } from './environments/environment'; import { WorkspaceJsonSchema, ProjectJsonSchema, -} from '@nx-console/vscode/json-schema'; +} from '@nx-console/json-schema'; import { enableTypeScriptPlugin } from '@nx-console/typescript-plugin'; import { NxConversion } from '@nx-console/vscode/nx-conversion'; import { diff --git a/libs/vscode/json-schema/.eslintrc.json b/libs/json-schema/.eslintrc.json similarity index 86% rename from libs/vscode/json-schema/.eslintrc.json rename to libs/json-schema/.eslintrc.json index 3456be9b90..9d9c0db55b 100644 --- a/libs/vscode/json-schema/.eslintrc.json +++ b/libs/json-schema/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["../../../.eslintrc.json"], + "extends": ["../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { diff --git a/libs/json-schema/README.md b/libs/json-schema/README.md new file mode 100644 index 0000000000..a0e48c9253 --- /dev/null +++ b/libs/json-schema/README.md @@ -0,0 +1,7 @@ +# json-schema + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test json-schema` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/vscode/json-schema/jest.config.ts b/libs/json-schema/jest.config.ts similarity index 62% rename from libs/vscode/json-schema/jest.config.ts rename to libs/json-schema/jest.config.ts index c3ab345cca..c67127b15d 100644 --- a/libs/vscode/json-schema/jest.config.ts +++ b/libs/json-schema/jest.config.ts @@ -1,5 +1,5 @@ export default { - displayName: 'vscode-json-schema', + displayName: 'json-schema', globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' }, @@ -8,7 +8,7 @@ export default { '^.+\\.[tj]sx?$': 'ts-jest', }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../../coverage/libs/vscode/json-schema', + coverageDirectory: '../../coverage/libs/json-schema', testEnvironment: 'node', - preset: '../../../jest.preset.js', + preset: '../../jest.preset.js', }; diff --git a/libs/json-schema/package.json b/libs/json-schema/package.json new file mode 100644 index 0000000000..9196749f42 --- /dev/null +++ b/libs/json-schema/package.json @@ -0,0 +1,4 @@ +{ + "name": "@nx-console/json-schema", + "version": "0.0.1" +} diff --git a/libs/json-schema/project.json b/libs/json-schema/project.json new file mode 100644 index 0000000000..59063ff380 --- /dev/null +++ b/libs/json-schema/project.json @@ -0,0 +1,22 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/json-schema/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["libs/json-schema/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/json-schema"], + "options": { + "jestConfig": "libs/json-schema/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/vscode/json-schema/src/index.ts b/libs/json-schema/src/index.ts similarity index 100% rename from libs/vscode/json-schema/src/index.ts rename to libs/json-schema/src/index.ts diff --git a/libs/vscode/json-schema/src/lib/project-json-schema.ts b/libs/json-schema/src/lib/project-json-schema.ts similarity index 100% rename from libs/vscode/json-schema/src/lib/project-json-schema.ts rename to libs/json-schema/src/lib/project-json-schema.ts diff --git a/libs/vscode/json-schema/src/lib/workspace-json-schema.ts b/libs/json-schema/src/lib/workspace-json-schema.ts similarity index 100% rename from libs/vscode/json-schema/src/lib/workspace-json-schema.ts rename to libs/json-schema/src/lib/workspace-json-schema.ts diff --git a/libs/vscode/json-schema/tsconfig.json b/libs/json-schema/tsconfig.json similarity index 78% rename from libs/vscode/json-schema/tsconfig.json rename to libs/json-schema/tsconfig.json index 667a3463d1..62ebbd9464 100644 --- a/libs/vscode/json-schema/tsconfig.json +++ b/libs/json-schema/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../tsconfig.base.json", "files": [], "include": [], "references": [ diff --git a/libs/vscode/json-schema/tsconfig.lib.json b/libs/json-schema/tsconfig.lib.json similarity index 85% rename from libs/vscode/json-schema/tsconfig.lib.json rename to libs/json-schema/tsconfig.lib.json index ff64bb51cf..5c589aef9e 100644 --- a/libs/vscode/json-schema/tsconfig.lib.json +++ b/libs/json-schema/tsconfig.lib.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "module": "commonjs", - "outDir": "../../../dist/out-tsc", + "outDir": "../../dist/out-tsc", "declaration": true, "types": ["node"] }, diff --git a/libs/vscode/json-schema/tsconfig.spec.json b/libs/json-schema/tsconfig.spec.json similarity index 89% rename from libs/vscode/json-schema/tsconfig.spec.json rename to libs/json-schema/tsconfig.spec.json index e1535ba9d0..46f9467f3b 100644 --- a/libs/vscode/json-schema/tsconfig.spec.json +++ b/libs/json-schema/tsconfig.spec.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../../dist/out-tsc", + "outDir": "../../dist/out-tsc", "module": "commonjs", "types": ["jest", "node"] }, diff --git a/libs/vscode/json-schema/README.md b/libs/vscode/json-schema/README.md deleted file mode 100644 index a4c92ccd9f..0000000000 --- a/libs/vscode/json-schema/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# vscode-json-schema - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test vscode-json-schema` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/vscode/json-schema/package.json b/libs/vscode/json-schema/package.json deleted file mode 100644 index 803d8c9849..0000000000 --- a/libs/vscode/json-schema/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@nx-console/vscode/json-schema", - "version": "0.0.1" -} diff --git a/libs/vscode/json-schema/project.json b/libs/vscode/json-schema/project.json deleted file mode 100644 index efc68ef180..0000000000 --- a/libs/vscode/json-schema/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/vscode/json-schema/src", - "projectType": "library", - "targets": { - "lint": { - "executor": "@nrwl/linter:eslint", - "options": { - "lintFilePatterns": ["libs/vscode/json-schema/**/*.ts"] - } - }, - "test": { - "executor": "@nrwl/jest:jest", - "outputs": ["coverage/libs/vscode/json-schema"], - "options": { - "jestConfig": "libs/vscode/json-schema/jest.config.ts", - "passWithNoTests": true - } - } - }, - "tags": [] -} diff --git a/tsconfig.base.json b/tsconfig.base.json index 00ae580c9d..1fecda5b81 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -21,6 +21,7 @@ "baseUrl": ".", "rootDir": ".", "paths": { + "@nx-console/json-schema": ["libs/json-schema/src/index.ts"], "@nx-console/npm": ["libs/npm/src/index.ts"], "@nx-console/schema": ["libs/schema/src/index.ts"], "@nx-console/typescript-plugin": ["libs/typescript-plugin/src/index.ts"], @@ -37,9 +38,6 @@ "@nx-console/vscode/configuration": [ "libs/vscode/configuration/src/index.ts" ], - "@nx-console/vscode/json-schema": [ - "libs/vscode/json-schema/src/index.ts" - ], "@nx-console/vscode/nx-commands-view": [ "libs/vscode/nx-commands-view/src/index.ts" ], diff --git a/workspace.json b/workspace.json index 5bbd0eaba4..297b588975 100644 --- a/workspace.json +++ b/workspace.json @@ -1,6 +1,7 @@ { "version": 2, "projects": { + "json-schema": "libs/json-schema", "lsp": "apps/lsp", "npm": "libs/npm", "schema": "libs/schema", @@ -8,7 +9,6 @@ "utils": "libs/utils", "vscode": "apps/vscode", "vscode-configuration": "libs/vscode/configuration", - "vscode-json-schema": "libs/vscode/json-schema", "vscode-nx-commands-view": "libs/vscode/nx-commands-view", "vscode-nx-conversion": "libs/vscode/nx-conversion", "vscode-nx-project-view": "libs/vscode/nx-project-view", From 2479121795ddf483f5a88edf5f325e46a875b240 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 11:15:54 -0400 Subject: [PATCH 07/27] refactor packages to remove dependencies on vscode --- apps/lsp/src/main.ts | 28 +- ...{lsp-client.ts => configure-lsp-client.ts} | 22 +- apps/vscode/src/main.ts | 25 +- libs/collections/.babelrc | 3 + libs/collections/.eslintrc.json | 18 + libs/collections/README.md | 11 + libs/collections/jest.config.ts | 16 + libs/collections/project.json | 23 ++ libs/collections/src/index.ts | 3 + .../src/lib}/get-executors.ts | 0 .../src/lib}/get-generators.ts | 6 +- .../src/lib}/read-collections.ts | 2 +- libs/collections/tsconfig.json | 13 + libs/collections/tsconfig.lib.json | 11 + libs/collections/tsconfig.spec.json | 20 + libs/file-system/.babelrc | 3 + libs/file-system/.eslintrc.json | 18 + libs/file-system/README.md | 11 + libs/file-system/jest.config.ts | 16 + libs/file-system/project.json | 23 ++ libs/file-system/src/index.ts | 7 + libs/file-system/src/lib/cache-json.ts | 93 +++++ libs/file-system/src/lib/directory-exists.ts | 9 + libs/file-system/src/lib/file-exists.ts | 9 + libs/file-system/src/lib/list-files.ts | 29 ++ libs/file-system/tsconfig.json | 13 + libs/file-system/tsconfig.lib.json | 11 + libs/file-system/tsconfig.spec.json | 20 + .../src/lib/project-json-schema.ts | 52 +-- .../src/lib/workspace-json-schema.ts | 52 +-- libs/npm/src/lib/pnp-dependencies.ts | 6 +- libs/npm/src/lib/workspace-dependencies.ts | 14 +- libs/package/.babelrc | 3 + libs/package/.eslintrc.json | 18 + libs/package/README.md | 11 + libs/package/jest.config.ts | 16 + libs/package/project.json | 23 ++ libs/package/src/index.ts | 3 + libs/package/src/lib/find-nx-package-path.ts | 36 ++ .../utils => package/src/lib}/ng-version.ts | 9 +- .../src/lib/nx-version.ts | 10 +- libs/package/tsconfig.json | 13 + libs/package/tsconfig.lib.json | 11 + libs/package/tsconfig.spec.json | 20 + libs/schema/src/index.ts | 1 + libs/schema/src/normalize-schema.ts | 201 ++++++++++ .../src/lib/typescript-plugin.ts | 8 +- libs/utils/src/index.ts | 14 +- libs/utils/src/lib/check-is-nx-workspace.ts | 2 +- .../utils/src/lib/utils/build-project-path.ts | 2 +- libs/utils/src/lib/utils/read-projects.ts | 8 +- libs/utils/src/lib/utils/utils.spec.ts | 2 +- libs/utils/src/lib/utils/utils.ts | 350 +++--------------- .../src/lib/nx-project-tree-provider.ts | 7 +- .../src/lib/run-target-tree-provider.ts | 3 +- libs/vscode/nx-workspace/src/index.ts | 1 - .../src/lib/get-nx-workspace-config.ts | 21 +- .../src/lib/get-nx-workspace-package.ts | 37 +- .../nx-workspace/src/lib/nx-workspace.spec.ts | 8 +- .../nx-workspace/src/lib/nx-workspace.ts | 3 +- .../src/lib/reveal-workspace-json.ts | 3 +- .../vscode/tasks/src/lib/cli-task-commands.ts | 8 +- libs/vscode/tasks/src/lib/select-generator.ts | 8 +- .../src/lib/verify-builder-definition.ts | 3 +- tsconfig.base.json | 3 + workspace.json | 3 + 66 files changed, 902 insertions(+), 554 deletions(-) rename apps/vscode/src/{lsp-client.ts => configure-lsp-client.ts} (73%) create mode 100644 libs/collections/.babelrc create mode 100644 libs/collections/.eslintrc.json create mode 100644 libs/collections/README.md create mode 100644 libs/collections/jest.config.ts create mode 100644 libs/collections/project.json create mode 100644 libs/collections/src/index.ts rename libs/{utils/src/lib/utils => collections/src/lib}/get-executors.ts (100%) rename libs/{utils/src/lib/utils => collections/src/lib}/get-generators.ts (98%) rename libs/{utils/src/lib/utils => collections/src/lib}/read-collections.ts (98%) create mode 100644 libs/collections/tsconfig.json create mode 100644 libs/collections/tsconfig.lib.json create mode 100644 libs/collections/tsconfig.spec.json create mode 100644 libs/file-system/.babelrc create mode 100644 libs/file-system/.eslintrc.json create mode 100644 libs/file-system/README.md create mode 100644 libs/file-system/jest.config.ts create mode 100644 libs/file-system/project.json create mode 100644 libs/file-system/src/index.ts create mode 100644 libs/file-system/src/lib/cache-json.ts create mode 100644 libs/file-system/src/lib/directory-exists.ts create mode 100644 libs/file-system/src/lib/file-exists.ts create mode 100644 libs/file-system/src/lib/list-files.ts create mode 100644 libs/file-system/tsconfig.json create mode 100644 libs/file-system/tsconfig.lib.json create mode 100644 libs/file-system/tsconfig.spec.json create mode 100644 libs/package/.babelrc create mode 100644 libs/package/.eslintrc.json create mode 100644 libs/package/README.md create mode 100644 libs/package/jest.config.ts create mode 100644 libs/package/project.json create mode 100644 libs/package/src/index.ts create mode 100644 libs/package/src/lib/find-nx-package-path.ts rename libs/{utils/src/lib/utils => package/src/lib}/ng-version.ts (74%) rename libs/{vscode/nx-workspace => package}/src/lib/nx-version.ts (67%) create mode 100644 libs/package/tsconfig.json create mode 100644 libs/package/tsconfig.lib.json create mode 100644 libs/package/tsconfig.spec.json create mode 100644 libs/schema/src/normalize-schema.ts diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index 31e9998f55..97840c0808 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -1,3 +1,8 @@ +import { getExecutors } from '@nx-console/collections'; +import { + getProjectJsonSchema, + getWorkspaceJsonSchema, +} from '@nx-console/json-schema'; import { ClientCapabilities, getLanguageService, @@ -44,12 +49,11 @@ documents.onDidClose((e) => { jsonDocumentMapper.remove(e.document); }); -connection.onInitialize((params) => { +connection.onInitialize(async (params) => { // TODO: add capability checks const capabilities = params.capabilities; - // const initializationOptions = params.initializationOptions ?? {}; - // const handledProtocols = initializationOptions?.handledSchemaProtocols; + const { workspacePath, projects } = params.initializationOptions ?? {}; languageService = getLanguageService({ // schemaRequestService: getSchemaRequestService(handledProtocols), @@ -58,8 +62,24 @@ connection.onInitialize((params) => { clientCapabilities: params.capabilities, }); + // get schemas + const collections = await getExecutors(workspacePath, projects, false); + const workspaceSchema = getWorkspaceJsonSchema(collections); + const projectSchema = getProjectJsonSchema(collections); + languageService.configure({ - schemas: [], + schemas: [ + { + uri: 'nx://schemas/workspace', + fileMatch: ['**/workspace.json'], + schema: JSON.parse(workspaceSchema), + }, + { + uri: 'nx://schemas/project', + fileMatch: ['**/project.json'], + schema: JSON.parse(projectSchema), + }, + ], }); const result: InitializeResult = { diff --git a/apps/vscode/src/lsp-client.ts b/apps/vscode/src/configure-lsp-client.ts similarity index 73% rename from apps/vscode/src/lsp-client.ts rename to apps/vscode/src/configure-lsp-client.ts index 679e19edb4..fc2f7961a7 100644 --- a/apps/vscode/src/lsp-client.ts +++ b/apps/vscode/src/configure-lsp-client.ts @@ -1,5 +1,6 @@ +import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { join } from 'path'; -import { ExtensionContext } from 'vscode'; +import { Disposable, ExtensionContext } from 'vscode'; import { LanguageClient, LanguageClientOptions, @@ -9,12 +10,17 @@ import { let client: LanguageClient; -export function lspClient(context: ExtensionContext) { +export async function configureLspClient( + context: ExtensionContext +): Promise { + const { workspacePath, workspace } = await nxWorkspace(); + const serverModule = context.asAbsolutePath(join('lsp', 'main.js')); const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }; const serverOptions: ServerOptions = { run: { module: serverModule, transport: TransportKind.ipc }, + debug: { module: serverModule, transport: TransportKind.ipc, @@ -25,6 +31,10 @@ export function lspClient(context: ExtensionContext) { // Options to control the language client const clientOptions: LanguageClientOptions = { // Register the server for plain text documents + initializationOptions: { + workspacePath, + projects: workspace.projects, + }, documentSelector: [ { scheme: 'file', language: 'json', pattern: '**/nx.json' }, { scheme: 'file', language: 'json', pattern: '**/project.json' }, @@ -34,15 +44,15 @@ export function lspClient(context: ExtensionContext) { }; client = new LanguageClient( - 'NxConsoleClient', - 'Nx Console Client', + 'NxConsole', + 'Nx Console', serverOptions, clientOptions ); client.start(); - context.subscriptions.push({ + return { dispose() { if (!client) { return; @@ -50,5 +60,5 @@ export function lspClient(context: ExtensionContext) { return client.stop(); }, - }); + }; } diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index 933672a589..7574850595 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -21,10 +21,8 @@ import { getOutputChannel, getTelemetry, initTelemetry, - getGenerators, teardownTelemetry, watchFile, - fileExists, checkIsNxWorkspace, } from '@nx-console/utils'; import { @@ -47,10 +45,6 @@ import { } from '@nx-console/vscode/nx-project-view'; import { environment } from './environments/environment'; -import { - WorkspaceJsonSchema, - ProjectJsonSchema, -} from '@nx-console/json-schema'; import { enableTypeScriptPlugin } from '@nx-console/typescript-plugin'; import { NxConversion } from '@nx-console/vscode/nx-conversion'; import { @@ -58,7 +52,10 @@ import { REFRESH_WORKSPACE, } from './commands/refresh-workspace'; import { projectGraph } from '@nx-console/vscode/project-graph'; -import { lspClient } from './lsp-client'; +import { configureLspClient } from './configure-lsp-client'; +import { fileExists } from '@nx-console/file-system'; +import { getGenerators } from '@nx-console/collections'; +import { nxVersion } from '@nx-console/package'; let runTargetTreeView: TreeView; let nxProjectTreeView: TreeView; @@ -119,7 +116,8 @@ export async function activate(c: ExtensionContext) { revealWebViewPanelCommand, manuallySelectWorkspaceDefinitionCommand, refreshWorkspace(), - projectGraph() + projectGraph(), + await configureLspClient(context) ); // registers itself as a CodeLensProvider and watches config to dispose/re-register @@ -128,15 +126,11 @@ export async function activate(c: ExtensionContext) { '@nx-console/vscode/nx-workspace' ); new WorkspaceCodeLensProvider(context); - new WorkspaceJsonSchema(context); - new ProjectJsonSchema(context); NxConversion.createInstance(context); await enableTypeScriptPlugin(context); - lspClient(context); - getTelemetry().extensionActivated((Date.now() - startTime) / 1000); } catch (e) { window.showErrorMessage( @@ -271,10 +265,11 @@ async function setWorkspace(workspacePath: string) { workspaceType = 'angular'; } - const { nxVersion } = await import('@nx-console/vscode/nx-workspace'); - WorkspaceConfigurationStore.instance.set('workspaceType', workspaceType); - WorkspaceConfigurationStore.instance.set('nxVersion', await nxVersion()); + WorkspaceConfigurationStore.instance.set( + 'nxVersion', + await nxVersion(workspacePath) + ); getTelemetry().record('WorkspaceType', { workspaceType }); } diff --git a/libs/collections/.babelrc b/libs/collections/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/libs/collections/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/collections/.eslintrc.json b/libs/collections/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/libs/collections/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/collections/README.md b/libs/collections/README.md new file mode 100644 index 0000000000..05e0fe2aa5 --- /dev/null +++ b/libs/collections/README.md @@ -0,0 +1,11 @@ +# collections + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test collections` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint collections` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/collections/jest.config.ts b/libs/collections/jest.config.ts new file mode 100644 index 0000000000..07989a92f3 --- /dev/null +++ b/libs/collections/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'collections', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/collections', +}; diff --git a/libs/collections/project.json b/libs/collections/project.json new file mode 100644 index 0000000000..7a08928d91 --- /dev/null +++ b/libs/collections/project.json @@ -0,0 +1,23 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/collections/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/collections/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/collections"], + "options": { + "jestConfig": "libs/collections/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/collections/src/index.ts b/libs/collections/src/index.ts new file mode 100644 index 0000000000..b66c1cc362 --- /dev/null +++ b/libs/collections/src/index.ts @@ -0,0 +1,3 @@ +export * from './lib/get-executors'; +export * from './lib/get-generators'; +export * from './lib/read-collections'; diff --git a/libs/utils/src/lib/utils/get-executors.ts b/libs/collections/src/lib/get-executors.ts similarity index 100% rename from libs/utils/src/lib/utils/get-executors.ts rename to libs/collections/src/lib/get-executors.ts diff --git a/libs/utils/src/lib/utils/get-generators.ts b/libs/collections/src/lib/get-generators.ts similarity index 98% rename from libs/utils/src/lib/utils/get-generators.ts rename to libs/collections/src/lib/get-generators.ts index 4aebf80aa9..3d61107d91 100644 --- a/libs/utils/src/lib/utils/get-generators.ts +++ b/libs/collections/src/lib/get-generators.ts @@ -1,6 +1,7 @@ import { CollectionInfo, GeneratorType, + normalizeSchema, WorkspaceProjects, } from '@nx-console/schema'; import { basename, join } from 'path'; @@ -9,10 +10,9 @@ import { getCollectionInfo, readCollections } from './read-collections'; import { directoryExists, fileExists, - listFiles, - normalizeSchema, readAndCacheJsonFile, -} from './utils'; + listFiles, +} from '@nx-console/file-system'; export async function getGenerators( workspacePath: string, diff --git a/libs/utils/src/lib/utils/read-collections.ts b/libs/collections/src/lib/read-collections.ts similarity index 98% rename from libs/utils/src/lib/utils/read-collections.ts rename to libs/collections/src/lib/read-collections.ts index 2fc94c119e..3a9dd8a6ce 100644 --- a/libs/utils/src/lib/utils/read-collections.ts +++ b/libs/collections/src/lib/read-collections.ts @@ -10,7 +10,7 @@ import { } from '@nx-console/schema'; import { platform } from 'os'; import { dirname, join, resolve } from 'path'; -import { clearJsonCache, readAndCacheJsonFile } from './utils'; +import { clearJsonCache, readAndCacheJsonFile } from '@nx-console/file-system'; export async function readCollections( workspacePath: string, diff --git a/libs/collections/tsconfig.json b/libs/collections/tsconfig.json new file mode 100644 index 0000000000..62ebbd9464 --- /dev/null +++ b/libs/collections/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/collections/tsconfig.lib.json b/libs/collections/tsconfig.lib.json new file mode 100644 index 0000000000..0e2a172abd --- /dev/null +++ b/libs/collections/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/collections/tsconfig.spec.json b/libs/collections/tsconfig.spec.json new file mode 100644 index 0000000000..ff08addd60 --- /dev/null +++ b/libs/collections/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/file-system/.babelrc b/libs/file-system/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/libs/file-system/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/file-system/.eslintrc.json b/libs/file-system/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/libs/file-system/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/file-system/README.md b/libs/file-system/README.md new file mode 100644 index 0000000000..75dcd7b536 --- /dev/null +++ b/libs/file-system/README.md @@ -0,0 +1,11 @@ +# file-system + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test file-system` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint file-system` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/file-system/jest.config.ts b/libs/file-system/jest.config.ts new file mode 100644 index 0000000000..2800d47d00 --- /dev/null +++ b/libs/file-system/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'file-system', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/file-system', +}; diff --git a/libs/file-system/project.json b/libs/file-system/project.json new file mode 100644 index 0000000000..efec285fa7 --- /dev/null +++ b/libs/file-system/project.json @@ -0,0 +1,23 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/file-system/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/file-system/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/file-system"], + "options": { + "jestConfig": "libs/file-system/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/file-system/src/index.ts b/libs/file-system/src/index.ts new file mode 100644 index 0000000000..ab014ae261 --- /dev/null +++ b/libs/file-system/src/index.ts @@ -0,0 +1,7 @@ +export { fileExists } from './lib/file-exists'; +export { directoryExists } from './lib/directory-exists'; +export { cacheJson } from './lib/cache-json'; +export { readAndCacheJsonFile } from './lib/cache-json'; +export { clearJsonCache } from './lib/cache-json'; +export { readAndParseJson } from './lib/cache-json'; +export { listFiles } from './lib/list-files'; diff --git a/libs/file-system/src/lib/cache-json.ts b/libs/file-system/src/lib/cache-json.ts new file mode 100644 index 0000000000..cc0bcb97b8 --- /dev/null +++ b/libs/file-system/src/lib/cache-json.ts @@ -0,0 +1,93 @@ +import * as path from 'path'; +import { PosixFS, ZipOpenFS } from '@yarnpkg/fslib'; +import { getLibzipSync as libzip } from '@yarnpkg/libzip'; + +import { parse as parseJson, ParseError } from 'jsonc-parser'; + +const zipOpenFs = new ZipOpenFS({ libzip }); +export const crossFs = new PosixFS(zipOpenFs); +export const files: { [path: string]: string[] } = {}; +export const fileContents: { [path: string]: any } = {}; + +export async function readAndParseJson(filePath: string) { + const content = await crossFs.readFilePromise(filePath, 'utf8'); + try { + return JSON.parse(content); + } catch { + const errors: ParseError[] = []; + const result = parseJson(content, errors); + + if (errors.length > 0) { + for (const { error, offset } of errors) { + // TODO(cammisuli): output this generically + // getOutputChannel().appendLine( + // `${printParseErrorCode( + // error + // )} in JSON at position ${offset} in ${filePath}` + // ); + } + } + + return result; + } +} + +export function clearJsonCache(filePath: string, basedir = '') { + const fullFilePath = path.join(basedir, filePath); + return delete fileContents[fullFilePath]; +} + +export async function readAndCacheJsonFile( + filePath: string | undefined, + basedir = '' +): Promise<{ path: string; json: any }> { + if (!filePath) { + return { + path: '', + json: {}, + }; + } + let fullFilePath = path.join(basedir, filePath); + if (fullFilePath.startsWith('file:\\')) { + fullFilePath = fullFilePath.replace('file:\\', ''); + } + try { + const stats = await crossFs.statPromise(fullFilePath); + if (fileContents[fullFilePath] || stats.isFile()) { + fileContents[fullFilePath] ||= await readAndParseJson(fullFilePath); + return { + path: fullFilePath, + json: fileContents[fullFilePath], + }; + } + } catch (e) { + // TODO(cammisuli): output this generically + // getOutputChannel().appendLine(`${fullFilePath} does not exist`); + } + + return { + path: fullFilePath, + json: {}, + }; +} + +/** + * Caches already created json contents to a file path + */ +export function cacheJson(filePath: string, basedir = '', content?: any) { + const fullFilePath = path.join(basedir, filePath); + if (fileContents[fullFilePath]) { + return { + json: fileContents[fullFilePath], + path: fullFilePath, + }; + } + + if (content) { + fileContents[fullFilePath] = content; + } + return { + json: content, + path: fullFilePath, + }; +} diff --git a/libs/file-system/src/lib/directory-exists.ts b/libs/file-system/src/lib/directory-exists.ts new file mode 100644 index 0000000000..eff690f7eb --- /dev/null +++ b/libs/file-system/src/lib/directory-exists.ts @@ -0,0 +1,9 @@ +import { stat } from 'fs/promises'; + +export async function directoryExists(filePath: string): Promise { + try { + return (await stat(filePath)).isDirectory(); + } catch { + return false; + } +} diff --git a/libs/file-system/src/lib/file-exists.ts b/libs/file-system/src/lib/file-exists.ts new file mode 100644 index 0000000000..96e106c452 --- /dev/null +++ b/libs/file-system/src/lib/file-exists.ts @@ -0,0 +1,9 @@ +import { stat } from 'fs/promises'; + +export async function fileExists(filePath: string): Promise { + try { + return (await stat(filePath)).isFile(); + } catch { + return false; + } +} diff --git a/libs/file-system/src/lib/list-files.ts b/libs/file-system/src/lib/list-files.ts new file mode 100644 index 0000000000..85827ff311 --- /dev/null +++ b/libs/file-system/src/lib/list-files.ts @@ -0,0 +1,29 @@ +import { readdirSync, statSync } from 'fs'; +import * as path from 'path'; + +export function listFiles(dirName: string): string[] { + // TODO use .gitignore to skip files + if (dirName.indexOf('node_modules') > -1) return []; + if (dirName.indexOf('dist') > -1) return []; + + const res = [dirName]; + // the try-catch here is intentional. It's only used in auto-completion. + // If it doesn't work, we don't want the process to exit + try { + readdirSync(dirName).forEach((c) => { + const child = path.join(dirName, c); + try { + if (!statSync(child).isDirectory()) { + res.push(child); + } else if (statSync(child).isDirectory()) { + res.push(...listFiles(child)); + } + } catch { + // noop + } + }); + } catch { + // noop + } + return res; +} diff --git a/libs/file-system/tsconfig.json b/libs/file-system/tsconfig.json new file mode 100644 index 0000000000..62ebbd9464 --- /dev/null +++ b/libs/file-system/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/file-system/tsconfig.lib.json b/libs/file-system/tsconfig.lib.json new file mode 100644 index 0000000000..0e2a172abd --- /dev/null +++ b/libs/file-system/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/file-system/tsconfig.spec.json b/libs/file-system/tsconfig.spec.json new file mode 100644 index 0000000000..ff08addd60 --- /dev/null +++ b/libs/file-system/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/json-schema/src/lib/project-json-schema.ts b/libs/json-schema/src/lib/project-json-schema.ts index f8712b5403..6cfa3873fd 100644 --- a/libs/json-schema/src/lib/project-json-schema.ts +++ b/libs/json-schema/src/lib/project-json-schema.ts @@ -1,56 +1,6 @@ import { CollectionInfo } from '@nx-console/schema'; -import { getExecutors, watchFile } from '@nx-console/utils'; -import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; -import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; -import { join } from 'path'; -import * as vscode from 'vscode'; -let FILE_WATCHER: vscode.FileSystemWatcher; - -export class ProjectJsonSchema { - constructor(context: vscode.ExtensionContext) { - const workspacePath = WorkspaceConfigurationStore.instance.get( - 'nxWorkspacePath', - '' - ); - - if (FILE_WATCHER) { - FILE_WATCHER.dispose(); - } - - /** - * Whenever a new package is added to the package.json, we recreate the schema. - * This allows newly added plugins to be added - */ - FILE_WATCHER = watchFile(join(workspacePath, 'package.json'), () => { - this.setupSchema(workspacePath, context.extensionUri, true); - }); - context.subscriptions.push(FILE_WATCHER); - - this.setupSchema(workspacePath, context.extensionUri); - } - - async setupSchema( - workspacePath: string, - extensionUri: vscode.Uri, - clearPackageJsonCache = false - ) { - const filePath = vscode.Uri.joinPath(extensionUri, 'project-schema.json'); - const { workspace } = await nxWorkspace(); - const collections = await getExecutors( - workspacePath, - workspace.projects, - clearPackageJsonCache - ); - const contents = getProjectJsonSchema(collections); - vscode.workspace.fs.writeFile( - filePath, - new Uint8Array(Buffer.from(contents, 'utf8')) - ); - } -} - -function getProjectJsonSchema(collections: CollectionInfo[]) { +export function getProjectJsonSchema(collections: CollectionInfo[]) { const [builders, executors] = createBuildersAndExecutorsSchema(collections); const contents = createJsonSchema(builders, executors); return contents; diff --git a/libs/json-schema/src/lib/workspace-json-schema.ts b/libs/json-schema/src/lib/workspace-json-schema.ts index 5e067fe087..3e668fde15 100644 --- a/libs/json-schema/src/lib/workspace-json-schema.ts +++ b/libs/json-schema/src/lib/workspace-json-schema.ts @@ -1,56 +1,6 @@ import { CollectionInfo } from '@nx-console/schema'; -import { getExecutors, watchFile } from '@nx-console/utils'; -import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; -import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; -import { dirname, join } from 'path'; -import * as vscode from 'vscode'; -let FILE_WATCHER: vscode.FileSystemWatcher; - -export class WorkspaceJsonSchema { - constructor(context: vscode.ExtensionContext) { - const workspacePath = WorkspaceConfigurationStore.instance.get( - 'nxWorkspacePath', - '' - ); - - if (FILE_WATCHER) { - FILE_WATCHER.dispose(); - } - - /** - * Whenever a new package is added to the package.json, we recreate the schema. - * This allows newly added plugins to be added - */ - FILE_WATCHER = watchFile(join(workspacePath, 'package.json'), () => { - this.setupSchema(workspacePath, context.extensionUri, true); - }); - context.subscriptions.push(FILE_WATCHER); - - this.setupSchema(workspacePath, context.extensionUri); - } - - async setupSchema( - workspacePath: string, - extensionUri: vscode.Uri, - clearPackageJsonCache = false - ) { - const filePath = vscode.Uri.joinPath(extensionUri, 'workspace-schema.json'); - const { workspace } = await nxWorkspace(); - const collections = await getExecutors( - workspacePath, - workspace.projects, - clearPackageJsonCache - ); - const contents = await getWorkspaceJsonSchema(collections); - vscode.workspace.fs.writeFile( - filePath, - new Uint8Array(Buffer.from(contents, 'utf8')) - ); - } -} - -function getWorkspaceJsonSchema(collections: CollectionInfo[]) { +export function getWorkspaceJsonSchema(collections: CollectionInfo[]) { const [builders, executors] = createBuildersAndExecutorsSchema(collections); const contents = createJsonSchema(builders, executors); return contents; diff --git a/libs/npm/src/lib/pnp-dependencies.ts b/libs/npm/src/lib/pnp-dependencies.ts index 991806077b..045f57a01b 100644 --- a/libs/npm/src/lib/pnp-dependencies.ts +++ b/libs/npm/src/lib/pnp-dependencies.ts @@ -1,6 +1,6 @@ -import { join } from 'path'; -import { Uri, workspace } from 'vscode'; import type { PnpApi } from '@yarnpkg/pnp'; +import { join } from 'path'; +import { fileExists } from '@nx-console/file-system'; declare function __non_webpack_require__(importPath: string): any; let PNP_API: PnpApi; @@ -11,7 +11,7 @@ async function getPnpFile(workspacePath: string) { try { const fileName = `.pnp${ext}`; const pnpFile = join(workspacePath, fileName); - await workspace.fs.stat(Uri.file(pnpFile)); + await fileExists(pnpFile); return pnpFile; } catch { return; diff --git a/libs/npm/src/lib/workspace-dependencies.ts b/libs/npm/src/lib/workspace-dependencies.ts index 6eff97961a..2ab79fbf05 100644 --- a/libs/npm/src/lib/workspace-dependencies.ts +++ b/libs/npm/src/lib/workspace-dependencies.ts @@ -1,14 +1,14 @@ import { WorkspaceProjects } from '@nx-console/schema'; -import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { stat } from 'fs/promises'; import { join } from 'path'; -import { FileType, Uri, workspace } from 'vscode'; import { npmDependencies } from './npm-dependencies'; import { isWorkspaceInPnp, pnpDependencies, pnpDependencyPath, } from './pnp-dependencies'; +import { directoryExists } from '@nx-console/file-system'; +import { nxVersion } from '@nx-console/package'; /** * Get dependencies for the current workspace. @@ -49,10 +49,7 @@ export async function workspaceDependencyPath( const path = join(workspacePath, 'node_modules', workspaceDependencyName); try { - const directoryType = (await workspace.fs.stat(Uri.file(path))).type; - return (directoryType & FileType.Directory) === FileType.Directory - ? path - : undefined; + return (await directoryExists(path)) ? path : undefined; } catch { return; } @@ -66,9 +63,8 @@ async function localDependencies( return []; } - const nxVersion = WorkspaceConfigurationStore.instance.get('nxVersion', null); - - if (nxVersion && nxVersion < 13) { + // Local plugins do not work with nxVersion less than 13 + if ((await nxVersion(workspacePath)) < 13) { return []; } diff --git a/libs/package/.babelrc b/libs/package/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/libs/package/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/package/.eslintrc.json b/libs/package/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/libs/package/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/package/README.md b/libs/package/README.md new file mode 100644 index 0000000000..5c7ee6eb13 --- /dev/null +++ b/libs/package/README.md @@ -0,0 +1,11 @@ +# package + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test package` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint package` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/package/jest.config.ts b/libs/package/jest.config.ts new file mode 100644 index 0000000000..005b936572 --- /dev/null +++ b/libs/package/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'package', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/package', +}; diff --git a/libs/package/project.json b/libs/package/project.json new file mode 100644 index 0000000000..7d0631e59e --- /dev/null +++ b/libs/package/project.json @@ -0,0 +1,23 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/package/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/package/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/package"], + "options": { + "jestConfig": "libs/package/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/package/src/index.ts b/libs/package/src/index.ts new file mode 100644 index 0000000000..e1d5afa204 --- /dev/null +++ b/libs/package/src/index.ts @@ -0,0 +1,3 @@ +export * from './lib/ng-version'; +export * from './lib/nx-version'; +export * from './lib/find-nx-package-path'; diff --git a/libs/package/src/lib/find-nx-package-path.ts b/libs/package/src/lib/find-nx-package-path.ts new file mode 100644 index 0000000000..77b90054a5 --- /dev/null +++ b/libs/package/src/lib/find-nx-package-path.ts @@ -0,0 +1,36 @@ +import { join } from 'path'; +import { workspaceDependencyPath } from '@nx-console/npm'; +import { fileExists } from '@nx-console/file-system'; + +/** + * Finds the local Nx package in the workspace. + * + * It will try to look for the `nx` package, with the specific file. If it does not exist, it will try to look for the `@nrwl/workspace` package, with the specific file + * @param workspacePath + * @returns + */ +export async function findNxPackagePath( + workspacePath: string, + filePath: string +): Promise { + const buildPath = (base: string) => join(base, filePath); + + const nxWorkspaceDepPath = await workspaceDependencyPath(workspacePath, 'nx'); + if (nxWorkspaceDepPath) { + const path = buildPath(nxWorkspaceDepPath); + if (await fileExists(path)) { + return path; + } + } + + const nrwlWorkspaceDepPath = await workspaceDependencyPath( + workspacePath, + '@nrwl/workspace' + ); + if (nrwlWorkspaceDepPath) { + const path = buildPath(nrwlWorkspaceDepPath); + if (await fileExists(path)) { + return path; + } + } +} diff --git a/libs/utils/src/lib/utils/ng-version.ts b/libs/package/src/lib/ng-version.ts similarity index 74% rename from libs/utils/src/lib/utils/ng-version.ts rename to libs/package/src/lib/ng-version.ts index 08c739542c..1e2911bbac 100644 --- a/libs/utils/src/lib/utils/ng-version.ts +++ b/libs/package/src/lib/ng-version.ts @@ -1,17 +1,12 @@ import { workspaceDependencyPath } from '@nx-console/npm'; -import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; declare function __non_webpack_require__(importPath: string): any; let ngPackageJson: { version: string }; let loadedNgPackage = false; -export async function ngVersion(): Promise { - if (!loadedNgPackage) { - const workspacePath = WorkspaceConfigurationStore.instance.get( - 'nxWorkspacePath', - '' - ); +export async function ngVersion(workspacePath: string): Promise { + if (!loadedNgPackage) { const packagePath = await workspaceDependencyPath( workspacePath, '@angular/cli' diff --git a/libs/vscode/nx-workspace/src/lib/nx-version.ts b/libs/package/src/lib/nx-version.ts similarity index 67% rename from libs/vscode/nx-workspace/src/lib/nx-version.ts rename to libs/package/src/lib/nx-version.ts index aea18aa4a6..8b78959a95 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-version.ts +++ b/libs/package/src/lib/nx-version.ts @@ -1,17 +1,11 @@ -import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; -import { findNxPackagePath } from './get-nx-workspace-package'; +import { findNxPackagePath } from './find-nx-package-path'; declare function __non_webpack_require__(importPath: string): any; let nxWorkspacePackageJson: { version: string }; let loadedNxPackage = false; -export async function nxVersion(): Promise { +export async function nxVersion(workspacePath: string): Promise { if (!loadedNxPackage) { - const workspacePath = WorkspaceConfigurationStore.instance.get( - 'nxWorkspacePath', - '' - ); - const packagePath = await findNxPackagePath(workspacePath, 'package.json'); if (!packagePath) { diff --git a/libs/package/tsconfig.json b/libs/package/tsconfig.json new file mode 100644 index 0000000000..62ebbd9464 --- /dev/null +++ b/libs/package/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/package/tsconfig.lib.json b/libs/package/tsconfig.lib.json new file mode 100644 index 0000000000..0e2a172abd --- /dev/null +++ b/libs/package/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/package/tsconfig.spec.json b/libs/package/tsconfig.spec.json new file mode 100644 index 0000000000..ff08addd60 --- /dev/null +++ b/libs/package/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/schema/src/index.ts b/libs/schema/src/index.ts index 97c6e6fce7..b70f9e7b89 100644 --- a/libs/schema/src/index.ts +++ b/libs/schema/src/index.ts @@ -115,3 +115,4 @@ export const WORKSPACE_GENERATOR_NAME_REGEX = export type WorkspaceProjects = ProjectsConfigurations['projects']; export { Store } from './store'; +export { normalizeSchema } from './normalize-schema'; diff --git a/libs/schema/src/normalize-schema.ts b/libs/schema/src/normalize-schema.ts new file mode 100644 index 0000000000..366afbf908 --- /dev/null +++ b/libs/schema/src/normalize-schema.ts @@ -0,0 +1,201 @@ +import { + CliOption, + ItemsWithEnum, + ItemTooltips, + LongFormXPrompt, + Option, + OptionItemLabelValue, + OptionPropertyDescription, + XPrompt, +} from './index'; +import { Schema } from 'nx/src/utils/params'; +import { names } from '@nrwl/devkit'; + +export interface GeneratorDefaults { + [name: string]: string; +} + +const IMPORTANT_FIELD_NAMES = [ + 'name', + 'project', + 'module', + 'watch', + 'style', + 'directory', + 'port', +]; +const IMPORTANT_FIELDS_SET = new Set(IMPORTANT_FIELD_NAMES); + +export async function normalizeSchema( + s: Schema, + workspaceType: 'ng' | 'nx', + projectDefaults?: GeneratorDefaults +): Promise { + // TODO(cammisuli): check what version ng supports hyphenated args + const hyphenate = workspaceType === 'ng'; + const options = schemaToOptions(s, { hyphenate }); + const requiredFields = new Set(s.required || []); + + const nxOptions = options.map((option) => { + const xPrompt: XPrompt | undefined = option['x-prompt']; + const workspaceDefault = projectDefaults && projectDefaults[option.name]; + const $default = option.$default; + + const nxOption: Option = { + ...option, + isRequired: isFieldRequired(requiredFields, option, xPrompt, $default), + aliases: option.alias ? [option.alias] : [], + ...(workspaceDefault !== undefined && { default: workspaceDefault }), + ...($default && { $default }), + ...(option.enum && { items: option.enum.map((item) => item.toString()) }), + // Strongly suspect items does not belong in the Option schema. + // Angular Option doesn't have the items property outside of x-prompt, + // but items is used in @schematics/angular - guard + ...getItems(option), + }; + + if (xPrompt) { + nxOption.tooltip = isLongFormXPrompt(xPrompt) ? xPrompt.message : xPrompt; + nxOption.itemTooltips = getEnumTooltips(xPrompt); + if (isLongFormXPrompt(xPrompt) && !nxOption.items) { + const items = (xPrompt.items || []).map((item) => + isOptionItemLabelValue(item) ? item.value : item + ); + if (items.length > 0) { + nxOption.items = items; + } + } + } + + return nxOption; + }); + + return nxOptions.sort((a, b) => { + if (typeof a.positional === 'number' && typeof b.positional === 'number') { + return a.positional - b.positional; + } + + if (typeof a.positional === 'number') { + return -1; + } else if (typeof b.positional === 'number') { + return 1; + } else if (a.isRequired) { + if (b.isRequired) { + return a.name.localeCompare(b.name); + } + return -1; + } else if (b.isRequired) { + return 1; + } else if (IMPORTANT_FIELDS_SET.has(a.name)) { + if (IMPORTANT_FIELDS_SET.has(b.name)) { + return ( + IMPORTANT_FIELD_NAMES.indexOf(a.name) - + IMPORTANT_FIELD_NAMES.indexOf(b.name) + ); + } + return -1; + } else if (IMPORTANT_FIELDS_SET.has(b.name)) { + return 1; + } else { + return a.name.localeCompare(b.name); + } + }); +} + +function isFieldRequired( + requiredFields: Set, + nxOption: CliOption, + xPrompt: XPrompt | undefined, + $default: any +): boolean { + // checks schema.json requiredFields and xPrompt for required + return ( + requiredFields.has(nxOption.name) || + // makes xPrompt fields required so nx command can run with --no-interactive + // - except properties with a default (also falsey, empty, null) + // - except properties with a $default $source + // - except boolean properties (should also have default of `true`) + (!!xPrompt && !nxOption.default && !$default && nxOption.type !== 'boolean') + ); +} + +function getItems(option: CliOption): { items: string[] } | undefined { + return ( + option.items && { + items: + (option.items as ItemsWithEnum).enum || + ((option.items as string[]).length && option.items), + } + ); +} + +function isLongFormXPrompt(xPrompt: XPrompt): xPrompt is LongFormXPrompt { + return (xPrompt as Partial).message !== undefined; +} + +function getEnumTooltips(xPrompt: XPrompt): ItemTooltips { + const enumTooltips: ItemTooltips = {}; + if (!!xPrompt && isLongFormXPrompt(xPrompt)) { + (xPrompt.items || []).forEach((item) => { + if (isOptionItemLabelValue(item) && !!item.label) { + enumTooltips[item.value] = item.label; + } + }); + } + return enumTooltips; +} + +function isOptionItemLabelValue( + item: string | OptionItemLabelValue +): item is OptionItemLabelValue { + return ( + (item as Partial).value !== undefined || + (item as Partial).label !== undefined + ); +} + +function schemaToOptions( + schema: Schema, + config?: { hyphenate: boolean } +): CliOption[] { + return Object.keys(schema.properties || {}).reduce( + (cliOptions, option) => { + const currentProperty = schema.properties[option]; + const $default = currentProperty.$default; + const $defaultIndex = + $default?.['$source'] === 'argv' ? $default['index'] : undefined; + const positional: number | undefined = + typeof $defaultIndex === 'number' ? $defaultIndex : undefined; + + const visible = isPropertyVisible(option, currentProperty); + if (!visible) { + return cliOptions; + } + const name = config?.hyphenate ? names(option).fileName : option; + cliOptions.push({ + name, + positional, + ...currentProperty, + }); + return cliOptions; + }, + [] + ); +} + +function isPropertyVisible( + option: string, + property: OptionPropertyDescription +): boolean { + const ALWAYS_VISIBLE_OPTIONS = ['path']; + + if (ALWAYS_VISIBLE_OPTIONS.includes(option)) { + return true; + } + + if ('hidden' in property) { + return !(property as any)['hidden']; + } + + return property.visible ?? true; +} diff --git a/libs/typescript-plugin/src/lib/typescript-plugin.ts b/libs/typescript-plugin/src/lib/typescript-plugin.ts index 610e68162a..cb51be3fd1 100644 --- a/libs/typescript-plugin/src/lib/typescript-plugin.ts +++ b/libs/typescript-plugin/src/lib/typescript-plugin.ts @@ -1,15 +1,11 @@ -import { - clearJsonCache, - findConfig, - readAndCacheJsonFile, - watchFile, -} from '@nx-console/utils'; +import { findConfig, watchFile } from '@nx-console/utils'; import { GlobalConfigurationStore, WorkspaceConfigurationStore, } from '@nx-console/vscode/configuration'; import { dirname, join } from 'path'; import * as vscode from 'vscode'; +import { clearJsonCache, readAndCacheJsonFile } from '@nx-console/file-system'; const TSCONFIG_BASE = 'tsconfig.base.json'; const TSCONFIG_LIB = 'tsconfig.lib.json'; diff --git a/libs/utils/src/index.ts b/libs/utils/src/index.ts index f33615cfdd..d00b115a2d 100644 --- a/libs/utils/src/index.ts +++ b/libs/utils/src/index.ts @@ -2,19 +2,7 @@ export * from './lib/abstract-tree-provider'; export * from './lib/telemetry'; export * from './lib/utils/output-channel'; export * from './lib/utils/read-projects'; -export * from './lib/utils/get-generators'; -export * from './lib/utils/get-executors'; -export * from './lib/utils/read-collections'; -export { - fileExists, - directoryExists, - readAndParseJson, - readAndCacheJsonFile, - normalizeSchema, - cacheJson, - clearJsonCache, - toWorkspaceFormat, -} from './lib/utils/utils'; +export { toWorkspaceFormat } from './lib/utils/utils'; export { watchFile } from './lib/utils/watch-file'; export { buildProjectPath } from './lib/utils/build-project-path'; export { findConfig } from './lib/utils/find-config'; diff --git a/libs/utils/src/lib/check-is-nx-workspace.ts b/libs/utils/src/lib/check-is-nx-workspace.ts index 5aeec499d4..940cf17d01 100644 --- a/libs/utils/src/lib/check-is-nx-workspace.ts +++ b/libs/utils/src/lib/check-is-nx-workspace.ts @@ -1,5 +1,5 @@ import { join } from 'path'; -import { fileExists, readAndCacheJsonFile } from './utils/utils'; +import { fileExists, readAndCacheJsonFile } from '@nx-console/file-system'; export async function checkIsNxWorkspace( workspacePath: string diff --git a/libs/utils/src/lib/utils/build-project-path.ts b/libs/utils/src/lib/utils/build-project-path.ts index 7bb20ff097..58eb15aaa5 100644 --- a/libs/utils/src/lib/utils/build-project-path.ts +++ b/libs/utils/src/lib/utils/build-project-path.ts @@ -1,5 +1,5 @@ import { join } from 'path'; -import { fileExists } from './utils'; +import { fileExists } from '@nx-console/file-system'; /** * Builds the project path from the given project name. diff --git a/libs/utils/src/lib/utils/read-projects.ts b/libs/utils/src/lib/utils/read-projects.ts index c53e7f7efe..b653c76bcd 100644 --- a/libs/utils/src/lib/utils/read-projects.ts +++ b/libs/utils/src/lib/utils/read-projects.ts @@ -3,18 +3,16 @@ import { Option, DefaultValue, TargetConfiguration, + normalizeSchema, } from '@nx-console/schema'; import * as path from 'path'; import { TargetConfiguration as NxTargetConfiguration } from '@nrwl/devkit'; -import { - getPrimitiveValue, - normalizeSchema, - readAndCacheJsonFile, -} from '../utils/utils'; +import { getPrimitiveValue } from './utils'; import { getTelemetry } from '../telemetry'; import { getOutputChannel } from './output-channel'; import { workspaceDependencyPath } from '@nx-console/npm'; +import { readAndCacheJsonFile } from '@nx-console/file-system'; export function readTargetDef( targetName: string, diff --git a/libs/utils/src/lib/utils/utils.spec.ts b/libs/utils/src/lib/utils/utils.spec.ts index 079d67f663..2f4379834e 100644 --- a/libs/utils/src/lib/utils/utils.spec.ts +++ b/libs/utils/src/lib/utils/utils.spec.ts @@ -1,9 +1,9 @@ -import { normalizeSchema } from './utils'; import { LongFormXPrompt, Option, OptionType, OptionPropertyDescription, + normalizeSchema, } from '@nx-console/schema'; import { Schema } from 'nx/src/utils/params'; diff --git a/libs/utils/src/lib/utils/utils.ts b/libs/utils/src/lib/utils/utils.ts index 46f25a9850..633fa26f84 100644 --- a/libs/utils/src/lib/utils/utils.ts +++ b/libs/utils/src/lib/utils/utils.ts @@ -1,307 +1,8 @@ -import { Schema } from 'nx/src/utils/params'; -import * as path from 'path'; import type { - WorkspaceJsonConfiguration, NxJsonConfiguration, + WorkspaceJsonConfiguration, } from '@nrwl/devkit'; -import { names } from '@nrwl/devkit'; - -import { - ItemsWithEnum, - ItemTooltips, - LongFormXPrompt, - Option, - OptionItemLabelValue, - XPrompt, - CliOption, - OptionPropertyDescription, -} from '@nx-console/schema'; - -import { readdirSync, statSync } from 'fs'; -import { readFile, stat } from 'fs/promises'; -import { - parse as parseJson, - ParseError, - printParseErrorCode, -} from 'jsonc-parser'; -import { getOutputChannel } from './output-channel'; import { toNewFormat } from 'nx/src/config/workspaces'; -import { PosixFS, ZipOpenFS } from '@yarnpkg/fslib'; -import { getLibzipSync as libzip } from '@yarnpkg/libzip'; -import { ngVersion } from './ng-version'; - -const zipOpenFs = new ZipOpenFS({ libzip }); -export const crossFs = new PosixFS(zipOpenFs); - -export interface GeneratorDefaults { - [name: string]: string; -} - -export const files: { [path: string]: string[] } = {}; -export const fileContents: { [path: string]: any } = {}; - -const IMPORTANT_FIELD_NAMES = [ - 'name', - 'project', - 'module', - 'watch', - 'style', - 'directory', - 'port', -]; -const IMPORTANT_FIELDS_SET = new Set(IMPORTANT_FIELD_NAMES); - -export function listFiles(dirName: string): string[] { - // TODO use .gitignore to skip files - if (dirName.indexOf('node_modules') > -1) return []; - if (dirName.indexOf('dist') > -1) return []; - - const res = [dirName]; - // the try-catch here is intentional. It's only used in auto-completion. - // If it doesn't work, we don't want the process to exit - try { - readdirSync(dirName).forEach((c) => { - const child = path.join(dirName, c); - try { - if (!statSync(child).isDirectory()) { - res.push(child); - } else if (statSync(child).isDirectory()) { - res.push(...listFiles(child)); - } - } catch { - // noop - } - }); - } catch { - // noop - } - return res; -} - -export async function directoryExists(filePath: string): Promise { - try { - return (await stat(filePath)).isDirectory(); - } catch { - return false; - } -} - -export async function fileExists(filePath: string): Promise { - try { - return (await stat(filePath)).isFile(); - } catch { - return false; - } -} - -export async function readAndParseJson(filePath: string) { - const content = await crossFs.readFilePromise(filePath, 'utf8'); - try { - return JSON.parse(content); - } catch { - const errors: ParseError[] = []; - const result = parseJson(content, errors); - - if (errors.length > 0) { - for (const { error, offset } of errors) { - getOutputChannel().appendLine( - `${printParseErrorCode( - error - )} in JSON at position ${offset} in ${filePath}` - ); - } - } - - return result; - } -} - -export function clearJsonCache(filePath: string, basedir = '') { - const fullFilePath = path.join(basedir, filePath); - return delete fileContents[fullFilePath]; -} - -/** - * Caches already created json contents to a file path - */ -export function cacheJson(filePath: string, basedir = '', content?: any) { - const fullFilePath = path.join(basedir, filePath); - if (fileContents[fullFilePath]) { - return { - json: fileContents[fullFilePath], - path: fullFilePath, - }; - } - - if (content) { - fileContents[fullFilePath] = content; - } - return { - json: content, - path: fullFilePath, - }; -} - -export async function readAndCacheJsonFile( - filePath: string | undefined, - basedir = '' -): Promise<{ path: string; json: any }> { - if (!filePath) { - return { - path: '', - json: {}, - }; - } - let fullFilePath = path.join(basedir, filePath); - if (fullFilePath.startsWith('file:\\')) { - fullFilePath = fullFilePath.replace('file:\\', ''); - } - try { - const stats = await crossFs.statPromise(fullFilePath); - if (fileContents[fullFilePath] || stats.isFile()) { - fileContents[fullFilePath] ||= await readAndParseJson(fullFilePath); - return { - path: fullFilePath, - json: fileContents[fullFilePath], - }; - } - } catch (e) { - getOutputChannel().appendLine(`${fullFilePath} does not exist`); - } - - return { - path: fullFilePath, - json: {}, - }; -} - -export async function normalizeSchema( - s: Schema, - workspaceType: 'ng' | 'nx', - projectDefaults?: GeneratorDefaults -): Promise { - const hyphenate = workspaceType === 'ng' && (await ngVersion()) >= 14; - const options = schemaToOptions(s, { hyphenate }); - const requiredFields = new Set(s.required || []); - - const nxOptions = options.map((option) => { - const xPrompt: XPrompt | undefined = option['x-prompt']; - const workspaceDefault = - projectDefaults?.[option.originalName ?? option.name]; - const $default = option.$default; - - const nxOption: Option = { - ...option, - isRequired: isFieldRequired(requiredFields, option, xPrompt, $default), - aliases: option.alias ? [option.alias] : [], - ...(workspaceDefault !== undefined && { default: workspaceDefault }), - ...($default && { $default }), - ...(option.enum && { items: option.enum.map((item) => item.toString()) }), - // Strongly suspect items does not belong in the Option schema. - // Angular Option doesn't have the items property outside of x-prompt, - // but items is used in @schematics/angular - guard - ...getItems(option), - }; - - if (xPrompt) { - nxOption.tooltip = isLongFormXPrompt(xPrompt) ? xPrompt.message : xPrompt; - nxOption.itemTooltips = getEnumTooltips(xPrompt); - if (isLongFormXPrompt(xPrompt) && !nxOption.items) { - const items = (xPrompt.items || []).map((item) => - isOptionItemLabelValue(item) ? item.value : item - ); - if (items.length > 0) { - nxOption.items = items; - } - } - } - - return nxOption; - }); - - return nxOptions.sort((a, b) => { - if (typeof a.positional === 'number' && typeof b.positional === 'number') { - return a.positional - b.positional; - } - - if (typeof a.positional === 'number') { - return -1; - } else if (typeof b.positional === 'number') { - return 1; - } else if (a.isRequired) { - if (b.isRequired) { - return a.name.localeCompare(b.name); - } - return -1; - } else if (b.isRequired) { - return 1; - } else if (IMPORTANT_FIELDS_SET.has(a.name)) { - if (IMPORTANT_FIELDS_SET.has(b.name)) { - return ( - IMPORTANT_FIELD_NAMES.indexOf(a.name) - - IMPORTANT_FIELD_NAMES.indexOf(b.name) - ); - } - return -1; - } else if (IMPORTANT_FIELDS_SET.has(b.name)) { - return 1; - } else { - return a.name.localeCompare(b.name); - } - }); -} - -function isFieldRequired( - requiredFields: Set, - nxOption: CliOption, - xPrompt: XPrompt | undefined, - $default: any -): boolean { - // checks schema.json requiredFields and xPrompt for required - return ( - requiredFields.has(nxOption.name) || - // makes xPrompt fields required so nx command can run with --no-interactive - // - except properties with a default (also falsey, empty, null) - // - except properties with a $default $source - // - except boolean properties (should also have default of `true`) - (!!xPrompt && !nxOption.default && !$default && nxOption.type !== 'boolean') - ); -} - -function getItems(option: CliOption): { items: string[] } | undefined { - return ( - option.items && { - items: - (option.items as ItemsWithEnum).enum || - ((option.items as string[]).length && option.items), - } - ); -} - -function isLongFormXPrompt(xPrompt: XPrompt): xPrompt is LongFormXPrompt { - return (xPrompt as Partial).message !== undefined; -} - -function getEnumTooltips(xPrompt: XPrompt): ItemTooltips { - const enumTooltips: ItemTooltips = {}; - if (!!xPrompt && isLongFormXPrompt(xPrompt)) { - (xPrompt.items || []).forEach((item) => { - if (isOptionItemLabelValue(item) && !!item.label) { - enumTooltips[item.value] = item.label; - } - }); - } - return enumTooltips; -} - -function isOptionItemLabelValue( - item: string | OptionItemLabelValue -): item is OptionItemLabelValue { - return ( - (item as Partial).value !== undefined || - (item as Partial).label !== undefined - ); -} export function getPrimitiveValue(value: any): string | undefined { if ( @@ -326,6 +27,55 @@ export function toWorkspaceFormat( newFormat.projects = Object.fromEntries(sortedProjects); return newFormat; } +<<<<<<< HEAD + +function schemaToOptions( + schema: Schema, + config?: { hyphenate: boolean } +): CliOption[] { + return Object.keys(schema.properties || {}).reduce( + (cliOptions, option) => { + const currentProperty = schema.properties[option]; + const $default = currentProperty.$default; + const $defaultIndex = + $default?.['$source'] === 'argv' ? $default['index'] : undefined; + const positional: number | undefined = + typeof $defaultIndex === 'number' ? $defaultIndex : undefined; + + const visible = isPropertyVisible(option, currentProperty); + if (!visible) { + return cliOptions; + } + const name = config?.hyphenate ? names(option).fileName : option; + cliOptions.push({ + name, + originalName: option, + positional, + ...currentProperty, + }); + return cliOptions; + }, + [] + ); +} + +function isPropertyVisible( + option: string, + property: OptionPropertyDescription +): boolean { + const ALWAYS_VISIBLE_OPTIONS = ['path']; + + if (ALWAYS_VISIBLE_OPTIONS.includes(option)) { + return true; + } + + if ('hidden' in property) { + return !(property as any)['hidden']; + } + + return property.visible ?? true; +} +||||||| parent of e300db5 (refactor packages to remove dependencies on vscode) function schemaToOptions( schema: Schema, diff --git a/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts b/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts index 690054f482..9dcb1a55ca 100644 --- a/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts +++ b/libs/vscode/nx-project-view/src/lib/nx-project-tree-provider.ts @@ -1,8 +1,4 @@ -import { - AbstractTreeProvider, - clearJsonCache, - getOutputChannel, -} from '@nx-console/utils'; +import { AbstractTreeProvider, getOutputChannel } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { revealNxProject } from '@nx-console/vscode/nx-workspace'; import { CliTaskProvider } from '@nx-console/vscode/tasks'; @@ -14,6 +10,7 @@ import { Uri, } from 'vscode'; import { NxProject, NxProjectTreeItem } from './nx-project-tree-item'; +import { clearJsonCache } from '@nx-console/file-system'; /** * Provides data for the "Projects" tree view diff --git a/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts b/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts index 2cd945262b..ecc6da3159 100644 --- a/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts +++ b/libs/vscode/nx-run-target-view/src/lib/run-target-tree-provider.ts @@ -1,8 +1,9 @@ -import { AbstractTreeProvider, clearJsonCache } from '@nx-console/utils'; +import { AbstractTreeProvider } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { commands, ExtensionContext, TreeItem } from 'vscode'; import { commandList, RunTargetTreeItem } from './run-target-tree-item'; +import { clearJsonCache } from '@nx-console/file-system'; const SCANNING_FOR_WORKSPACE = new TreeItem( 'Scanning for your Nx Workspace...' diff --git a/libs/vscode/nx-workspace/src/index.ts b/libs/vscode/nx-workspace/src/index.ts index 3054cef12c..6a1d080c6e 100644 --- a/libs/vscode/nx-workspace/src/index.ts +++ b/libs/vscode/nx-workspace/src/index.ts @@ -2,5 +2,4 @@ export * from './lib/find-workspace-json-target'; export * from './lib/reveal-workspace-json'; export * from './lib/workspace-codelens-provider'; export * from './lib/nx-workspace'; -export * from './lib/nx-version'; export * from './lib/find-project-with-path'; diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts index a7f2470294..cad418982b 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts @@ -3,13 +3,13 @@ import type { ProjectGraph, ProjectsConfigurations, } from '@nrwl/devkit'; -import { readAndCacheJsonFile } from '@nx-console/utils'; import { join } from 'path'; import { getNxProjectGraph, getNxWorkspacePackageFileUtils, } from './get-nx-workspace-package'; -import { nxVersion } from './nx-version'; +import { readAndCacheJsonFile } from '@nx-console/file-system'; +import { nxVersion } from '@nx-console/package'; export type NxWorkspaceConfiguration = ProjectsConfigurations & NxJsonConfiguration; @@ -24,17 +24,17 @@ export type NxWorkspaceConfiguration = ProjectsConfigurations & * */ export async function getNxWorkspaceConfig( - basedir: string, + workspacePath: string, format: 'nx' | 'angularCli', isNxWorkspace: boolean ): Promise<{ workspaceConfiguration: NxWorkspaceConfiguration; configPath: string; }> { - const version = await nxVersion(); + const version = await nxVersion(workspacePath); if (version < 12) { - return readWorkspaceConfigs(format, basedir); + return readWorkspaceConfigs(format, workspacePath); } try { @@ -48,11 +48,12 @@ export async function getNxWorkspaceConfig( try { workspaceConfiguration = nxWorkspacePackage.readWorkspaceConfig({ format, - path: basedir, + path: workspacePath, }); } catch { - workspaceConfiguration = (await readWorkspaceConfigs(format, basedir)) - .workspaceConfiguration; + workspaceConfiguration = ( + await readWorkspaceConfigs(format, workspacePath) + ).workspaceConfiguration; } let projectGraph: ProjectGraph | null = null; @@ -74,10 +75,10 @@ export async function getNxWorkspaceConfig( return { workspaceConfiguration, - configPath: join(basedir, configFile), + configPath: join(workspacePath, configFile), }; } catch (e) { - return readWorkspaceConfigs(format, basedir); + return readWorkspaceConfigs(format, workspacePath); } } diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts index 561b4de875..8a4d3f5de3 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts @@ -1,10 +1,10 @@ -import { workspaceDependencyPath } from '@nx-console/npm'; -import { fileExists, getOutputChannel } from '@nx-console/utils'; +import { getOutputChannel } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import type * as NxFileUtils from 'nx/src/project-graph/file-utils'; import type * as NxProjectGraph from 'nx/src/project-graph/project-graph'; import { platform } from 'os'; import { join } from 'path'; +import { findNxPackagePath } from '@nx-console/package'; declare function __non_webpack_require__(importPath: string): any; @@ -97,36 +97,3 @@ ${error} return backupPackage; } } - -/** - * Finds the local Nx package in the workspace. - * - * It will try to look for the `nx` package, with the specific file. If it does not exist, it will try to look for the `@nrwl/workspace` package, with the specific file - * @param workspacePath - * @returns - */ -export async function findNxPackagePath( - workspacePath: string, - filePath: string -): Promise { - const buildPath = (base: string) => join(base, filePath); - - const nxWorkspaceDepPath = await workspaceDependencyPath(workspacePath, 'nx'); - if (nxWorkspaceDepPath) { - const path = buildPath(nxWorkspaceDepPath); - if (await fileExists(path)) { - return path; - } - } - - const nrwlWorkspaceDepPath = await workspaceDependencyPath( - workspacePath, - '@nrwl/workspace' - ); - if (nrwlWorkspaceDepPath) { - const path = buildPath(nrwlWorkspaceDepPath); - if (await fileExists(path)) { - return path; - } - } -} diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts index 469f4e3278..0a23ef95f6 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts @@ -1,7 +1,7 @@ import { nxWorkspace } from './nx-workspace'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import * as server from '@nx-console/utils'; -import { getOutputChannel, getTelemetry, fileExists } from '@nx-console/utils'; +import { getOutputChannel, getTelemetry } from '@nx-console/utils'; import { mocked } from 'ts-jest/utils'; import type { NxJsonConfiguration, @@ -11,6 +11,8 @@ import * as vscode from 'vscode'; import type { AsyncReturnType } from 'type-fest'; import { getNxWorkspaceConfig } from './get-nx-workspace-config'; +import { fileExists as fileExists1, fileExists } from '@nx-console/file-system'; + jest.mock('./get-nx-workspace-config', () => { const originalModule = jest.requireActual('./get-nx-workspace-config'); return { @@ -27,9 +29,7 @@ jest.mock('./get-nx-workspace-config', () => { }); const getNxWorkspaceConfigMock = mocked(getNxWorkspaceConfig); -const mockFileExistsFn = fileExists as jest.MockedFunction< - typeof server.fileExists ->; +const mockFileExistsFn = fileExists as jest.MockedFunction; mockFileExistsFn.mockImplementation(async () => false); const mockStoreInstanceGetFn = WorkspaceConfigurationStore.instance diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts index 49eed602a0..9283afe0d1 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts @@ -1,7 +1,5 @@ import { checkIsNxWorkspace, - clearJsonCache, - fileExists, getOutputChannel, getTelemetry, toWorkspaceFormat, @@ -22,6 +20,7 @@ import { getNxWorkspaceConfig, NxWorkspaceConfiguration, } from './get-nx-workspace-config'; +import { clearJsonCache, fileExists } from '@nx-console/file-system'; interface NxWorkspace { validWorkspaceJson: boolean; diff --git a/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts b/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts index f26bd1b619..bc026b5dcf 100644 --- a/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts +++ b/libs/vscode/nx-workspace/src/lib/reveal-workspace-json.ts @@ -1,9 +1,10 @@ -import { buildProjectPath, fileExists } from '@nx-console/utils'; +import { buildProjectPath } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { Selection, TextDocument, Uri, window, workspace } from 'vscode'; import { getProjectLocations } from './find-workspace-json-target'; +import { fileExists } from '@nx-console/file-system'; export async function revealNxProject( projectName: string, diff --git a/libs/vscode/tasks/src/lib/cli-task-commands.ts b/libs/vscode/tasks/src/lib/cli-task-commands.ts index b4ab059406..162b58824d 100644 --- a/libs/vscode/tasks/src/lib/cli-task-commands.ts +++ b/libs/vscode/tasks/src/lib/cli-task-commands.ts @@ -2,7 +2,6 @@ import { commands, ExtensionContext, window, Uri } from 'vscode'; import { findProjectWithPath, - nxVersion, nxWorkspace, } from '@nx-console/vscode/nx-workspace'; import { verifyBuilderDefinition } from '@nx-console/vscode/verify'; @@ -13,7 +12,8 @@ import { selectFlags } from './select-flags'; import { GeneratorType, Option, OptionType } from '@nx-console/schema'; import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; import { selectGenerator } from './select-generator'; -import { getGenerators } from '@nx-console/utils'; +import { getGenerators } from '@nx-console/collections'; +import { nxVersion } from '@nx-console/package'; const CLI_COMMAND_LIST = [ 'build', @@ -75,8 +75,8 @@ export function registerCliTaskCommands( /** * move and remove were release in patch 8.11 */ - const version = await nxVersion(); - if (version && version >= 8) { + const version = await nxVersion(cliTaskProvider.getWorkspacePath()); + if (version >= 8) { commands.registerCommand(`${cli}.move.fileexplorer`, async (uri: Uri) => { /** * Bit of a hack - always runs angular/move if it is installed. diff --git a/libs/vscode/tasks/src/lib/select-generator.ts b/libs/vscode/tasks/src/lib/select-generator.ts index 791076bfb1..afbdd35467 100644 --- a/libs/vscode/tasks/src/lib/select-generator.ts +++ b/libs/vscode/tasks/src/lib/select-generator.ts @@ -1,17 +1,15 @@ import { Generator, GeneratorType, + normalizeSchema, Option, TaskExecutionSchema, } from '@nx-console/schema'; -import { - getGenerators, - normalizeSchema, - readAndCacheJsonFile, -} from '@nx-console/utils'; import { GlobalConfigurationStore } from '@nx-console/vscode/configuration'; import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { QuickPickItem, window } from 'vscode'; +import { readAndCacheJsonFile } from '@nx-console/file-system'; +import { getGenerators } from '@nx-console/collections'; async function readWorkspaceJsonDefaults(): Promise { const { workspace } = await nxWorkspace(); diff --git a/libs/vscode/verify/src/lib/verify-builder-definition.ts b/libs/vscode/verify/src/lib/verify-builder-definition.ts index 28c0415303..aaece7391f 100644 --- a/libs/vscode/verify/src/lib/verify-builder-definition.ts +++ b/libs/vscode/verify/src/lib/verify-builder-definition.ts @@ -1,9 +1,10 @@ import { Option, OptionType } from '@nx-console/schema'; import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; -import { fileExists, getTelemetry, readBuilderSchema } from '@nx-console/utils'; +import { getTelemetry, readBuilderSchema } from '@nx-console/utils'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import { join } from 'path'; import { window } from 'vscode'; +import { fileExists } from '@nx-console/file-system'; const RUN_ONE_OPTIONS = [ { diff --git a/tsconfig.base.json b/tsconfig.base.json index 1fecda5b81..1fded082d2 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -21,8 +21,11 @@ "baseUrl": ".", "rootDir": ".", "paths": { + "@nx-console/collections": ["libs/collections/src/index.ts"], + "@nx-console/file-system": ["libs/file-system/src/index.ts"], "@nx-console/json-schema": ["libs/json-schema/src/index.ts"], "@nx-console/npm": ["libs/npm/src/index.ts"], + "@nx-console/package": ["libs/package/src/index.ts"], "@nx-console/schema": ["libs/schema/src/index.ts"], "@nx-console/typescript-plugin": ["libs/typescript-plugin/src/index.ts"], "@nx-console/utils": ["libs/utils/src/index.ts"], diff --git a/workspace.json b/workspace.json index 297b588975..d5b4c7a15e 100644 --- a/workspace.json +++ b/workspace.json @@ -1,9 +1,12 @@ { "version": 2, "projects": { + "collections": "libs/collections", + "file-system": "libs/file-system", "json-schema": "libs/json-schema", "lsp": "apps/lsp", "npm": "libs/npm", + "package": "libs/package", "schema": "libs/schema", "typescript-plugin": "libs/typescript-plugin", "utils": "libs/utils", From 087b243dd83b5e80f7b3d978bea88208b95c1d81 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 12:47:46 -0400 Subject: [PATCH 08/27] load schemas --- apps/lsp/src/main.ts | 36 +-- apps/lsp/src/runtime.ts | 71 +++++ apps/vscode/src/package.json | 12 - .../create-builders-and-executors-schema.ts | 60 +++++ .../src/lib/project-json-schema.ts | 121 +++------ .../src/lib/workspace-json-schema.ts | 244 +++++++----------- libs/npm/src/lib/pnp-dependencies.ts | 5 +- libs/schema/src/normalize-schema.ts | 1 + libs/utils/src/lib/utils/utils.ts | 96 ------- package.json | 1 + yarn.lock | 5 + 11 files changed, 287 insertions(+), 365 deletions(-) create mode 100644 apps/lsp/src/runtime.ts create mode 100644 libs/json-schema/src/lib/create-builders-and-executors-schema.ts diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index 97840c0808..21ba31adbf 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -6,7 +6,6 @@ import { import { ClientCapabilities, getLanguageService, - JSONDocument, TextDocument, } from 'vscode-json-languageservice'; import { @@ -16,8 +15,9 @@ import { TextDocuments, TextDocumentSyncKind, } from 'vscode-languageserver/node'; -import { Utils, URI } from 'vscode-uri'; +import { URI, Utils } from 'vscode-uri'; import { jsonDocumentsMapper } from './json-documents'; +import { getSchemaRequestService } from './runtime'; const workspaceContext = { resolveRelativePath: (relativePath: string, resource: string) => { @@ -50,13 +50,14 @@ documents.onDidClose((e) => { }); connection.onInitialize(async (params) => { + debugger; // TODO: add capability checks const capabilities = params.capabilities; const { workspacePath, projects } = params.initializationOptions ?? {}; languageService = getLanguageService({ - // schemaRequestService: getSchemaRequestService(handledProtocols), + schemaRequestService: getSchemaRequestService(['file']), workspaceContext, contributions: [], clientCapabilities: params.capabilities, @@ -66,18 +67,18 @@ connection.onInitialize(async (params) => { const collections = await getExecutors(workspacePath, projects, false); const workspaceSchema = getWorkspaceJsonSchema(collections); const projectSchema = getProjectJsonSchema(collections); - + console.log(projectSchema); languageService.configure({ schemas: [ { uri: 'nx://schemas/workspace', - fileMatch: ['**/workspace.json'], - schema: JSON.parse(workspaceSchema), + fileMatch: ['**/workspace.json', '**/angular.json'], + schema: workspaceSchema, }, { uri: 'nx://schemas/project', fileMatch: ['**/project.json'], - schema: JSON.parse(projectSchema), + schema: projectSchema, }, ], }); @@ -87,6 +88,7 @@ connection.onInitialize(async (params) => { textDocumentSync: TextDocumentSyncKind.Incremental, completionProvider: { resolveProvider: false, + triggerCharacters: ['"', ':'], }, }, }; @@ -96,18 +98,18 @@ connection.onInitialize(async (params) => { connection.onCompletion(async (completionParams) => { const document = documents.get(completionParams.textDocument.uri); - if (document) { - const jsonDocument = getJsonDocument(document); - const completionList = await languageService.doComplete( - document, - completionParams.position, - jsonDocument - ); - console.log(completionList); - return completionList; + if (!document) { + return null; } - return null; + const jsonDocument = getJsonDocument(document); + const completionList = await languageService.doComplete( + document, + completionParams.position, + jsonDocument + ); + console.log(completionList); + return completionList; }); function getJsonDocument(document: TextDocument) { diff --git a/apps/lsp/src/runtime.ts b/apps/lsp/src/runtime.ts new file mode 100644 index 0000000000..b22fa5e4bc --- /dev/null +++ b/apps/lsp/src/runtime.ts @@ -0,0 +1,71 @@ +import { + xhr, + XHRResponse, + configure as configureHttpRequests, + getErrorStatusDescription, +} from 'request-light'; +import { URI } from 'vscode-uri'; +import * as fs from 'fs'; + +export interface RequestService { + getContent(uri: string): Promise; +} + +function getHTTPRequestService(): RequestService { + return { + getContent(uri: string, _encoding?: string) { + const headers = { 'Accept-Encoding': 'gzip, deflate' }; + return xhr({ url: uri, followRedirects: 5, headers }).then( + (response) => { + return response.responseText; + }, + (error: XHRResponse) => { + return Promise.reject( + error.responseText || + getErrorStatusDescription(error.status) || + error.toString() + ); + } + ); + }, + }; +} + +function getFileRequestService(): RequestService { + return { + getContent(location: string, encoding?: BufferEncoding) { + return new Promise((c, e) => { + const uri = URI.parse(location); + fs.readFile(uri.fsPath, encoding, (err, buf) => { + if (err) { + return e(err); + } + c(buf.toString()); + }); + }); + }, + }; +} + +export function getSchemaRequestService( + handledSchemas: string[] = ['https', 'http', 'file'] +) { + const builtInHandlers: { [protocol: string]: RequestService | undefined } = + {}; + for (const protocol of handledSchemas) { + if (protocol === 'file') { + builtInHandlers[protocol] = getFileRequestService(); + } else if (protocol === 'http' || protocol === 'https') { + builtInHandlers[protocol] = getHTTPRequestService(); + } + } + return (uri: string): Thenable => { + const protocol = uri.substr(0, uri.indexOf(':')); + + const builtInHandler = builtInHandlers[protocol]; + if (builtInHandler) { + return builtInHandler.getContent(uri); + } + return Promise.reject('Unable to retrieve schema'); + }; +} diff --git a/apps/vscode/src/package.json b/apps/vscode/src/package.json index b9c9978ee9..98e6b55ffb 100644 --- a/apps/vscode/src/package.json +++ b/apps/vscode/src/package.json @@ -884,18 +884,6 @@ ] }, "jsonValidation": [ - { - "fileMatch": "workspace.json", - "url": "./workspace-schema.json" - }, - { - "fileMatch": "angular.json", - "url": "./workspace-schema.json" - }, - { - "fileMatch": "project.json", - "url": "./project-schema.json" - }, { "fileMatch": "nx.json", "url": "./nx-schema.json" diff --git a/libs/json-schema/src/lib/create-builders-and-executors-schema.ts b/libs/json-schema/src/lib/create-builders-and-executors-schema.ts new file mode 100644 index 0000000000..2985c22df7 --- /dev/null +++ b/libs/json-schema/src/lib/create-builders-and-executors-schema.ts @@ -0,0 +1,60 @@ +import { CollectionInfo } from '@nx-console/schema'; +import { JSONSchema } from 'vscode-json-languageservice'; + +type BuildersSchema = JSONSchema; +type ExecutorsSchema = JSONSchema; + +/** + * Builds the schema for builders and executors. + * + * @param collections + * @returns [BuildersSchema[], ExecutorsSchema[]] + */ +export function createBuildersAndExecutorsSchema( + collections: CollectionInfo[] +): [BuildersSchema[], ExecutorsSchema[]] { + return collections.reduce<[BuildersSchema[], ExecutorsSchema[]]>( + (acc, collection) => { + acc[0].push({ + if: { + properties: { builder: { const: collection.name } }, + required: ['builder'], + }, + then: { + properties: { + options: { + $ref: `file://${collection.path}`, + }, + configurations: { + additionalProperties: { + $ref: `file://${collection.path}`, + required: [], + }, + }, + }, + }, + }); + acc[1].push({ + if: { + properties: { executor: { const: collection.name } }, + required: ['executor'], + }, + then: { + properties: { + options: { + $ref: `file://${collection.path}`, + }, + configurations: { + additionalProperties: { + $ref: `file://${collection.path}`, + required: [], + }, + }, + }, + }, + }); + return acc; + }, + [[], []] + ); +} diff --git a/libs/json-schema/src/lib/project-json-schema.ts b/libs/json-schema/src/lib/project-json-schema.ts index 6cfa3873fd..c8ba827b4d 100644 --- a/libs/json-schema/src/lib/project-json-schema.ts +++ b/libs/json-schema/src/lib/project-json-schema.ts @@ -1,100 +1,41 @@ import { CollectionInfo } from '@nx-console/schema'; +import { JSONSchema } from 'vscode-json-languageservice'; +import { createBuildersAndExecutorsSchema } from './create-builders-and-executors-schema'; export function getProjectJsonSchema(collections: CollectionInfo[]) { - const [builders, executors] = createBuildersAndExecutorsSchema(collections); - const contents = createJsonSchema(builders, executors); + const [, executors] = createBuildersAndExecutorsSchema(collections); + const contents = createJsonSchema(executors); return contents; } -function createBuildersAndExecutorsSchema( - collections: CollectionInfo[] -): [string, string] { - const builders = collections - .map( - (collection) => ` -{ - "if": { - "properties": { "builder": { "const": "${collection.name}" } }, - "required": ["builder"] - }, - "then": { - "properties": { - "options": { - "$ref": "${collection.path}" - }, - "configurations": { - "additionalProperties": { - "$ref": "${collection.path}", - "required": [] - } - } - } - } -} -` - ) - .join(','); - - const executors = collections - .map( - (collection) => ` -{ - "if": { - "properties": { "executor": { "const": "${collection.name}" } }, - "required": ["executor"] - }, - "then": { - "properties": { - "options": { - "$ref": "${collection.path}" - }, - "configurations": { - "additionalProperties": { - "$ref": "${collection.path}", - "required": [] - } - } - } - } -} -` - ) - .join(','); - - return [builders, executors]; -} - -function createJsonSchema(builders: string, executors: string) { - return ` - { - "title": "JSON schema for Nx projects", - "id": "https://nx.dev/project-schema", - "type": "object", - "properties": { - "targets": { - "description": "Configures all the targets which define what tasks you can run against the project", - "additionalProperties": { - "type": "object", - "properties": { - "executor": { - "description": "The function that Nx will invoke when you run this target", - "type": "string" +function createJsonSchema(executors: JSONSchema[]): JSONSchema { + return { + title: 'JSON schema for Nx projects', + id: 'https://nx.dev/project-schema', + type: 'object', + properties: { + targets: { + description: + 'Configures all the targets which define what tasks you can run against the project', + additionalProperties: { + type: 'object', + properties: { + executor: { + description: + 'The function that Nx will invoke when you run this target', + type: 'string', }, - "options": { - "type": "object" + configurations: { + description: + 'provides extra sets of values that will be merged into the options map', + additionalProperties: { + type: 'object', + }, }, - "configurations": { - "description": "provides extra sets of values that will be merged into the options map", - "additionalProperties": { - "type": "object" - } - } }, - "allOf": [ - ${executors} - ] - } - } - } - }`; + allOf: executors, + }, + }, + }, + }; } diff --git a/libs/json-schema/src/lib/workspace-json-schema.ts b/libs/json-schema/src/lib/workspace-json-schema.ts index 3e668fde15..ab5a7d489a 100644 --- a/libs/json-schema/src/lib/workspace-json-schema.ts +++ b/libs/json-schema/src/lib/workspace-json-schema.ts @@ -1,4 +1,6 @@ import { CollectionInfo } from '@nx-console/schema'; +import { JSONSchema } from 'vscode-json-languageservice'; +import { createBuildersAndExecutorsSchema } from './create-builders-and-executors-schema'; export function getWorkspaceJsonSchema(collections: CollectionInfo[]) { const [builders, executors] = createBuildersAndExecutorsSchema(collections); @@ -6,168 +8,114 @@ export function getWorkspaceJsonSchema(collections: CollectionInfo[]) { return contents; } -function createBuildersAndExecutorsSchema( - collections: CollectionInfo[] -): [string, string] { - const builders = collections - .map( - (collection) => ` -{ - "if": { - "properties": { "builder": { "const": "${collection.name}" } }, - "required": ["builder"] - }, - "then": { - "properties": { - "options": { - "$ref": "${collection.path}" +function createJsonSchema( + builders: JSONSchema[], + executors: JSONSchema[] +): JSONSchema { + return { + title: 'JSON schema for Nx workspaces', + id: 'https://nx.dev', + type: 'object', + properties: { + version: { + type: 'number', + enum: [1, 2], }, - "configurations": { - "additionalProperties": { - "$ref": "${collection.path}", - "required": [] - } - } - } - } -} -` - ) - .join(','); - - const executors = collections - .map( - (collection) => ` -{ - "if": { - "properties": { "executor": { "const": "${collection.name}" } }, - "required": ["executor"] - }, - "then": { - "properties": { - "options": { - "$ref": "${collection.path}" - }, - "configurations": { - "additionalProperties": { - "$ref": "${collection.path}", - "required": [] - } - } - } - } -} -` - ) - .join(','); - - return [builders, executors]; -} - -function createJsonSchema(builders: string, executors: string) { - return ` - { - "title": "JSON schema for Nx workspaces", - "id": "https://nx.dev", - "type": "object", - "properties": { - "version": { - "type": "number", - "enum": [1, 2] - } }, - "allOf": [ + allOf: [ { - "if": { - "properties": { "version": { "const": 1 } }, - "required": ["version"] + if: { + properties: { version: { const: 1 } }, + required: ['version'], }, - "then": { - "properties": { - "projects": { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "architect": { - "description": "Configures all the targets which define what tasks you can run against the project", - "additionalProperties": { - "type": "object", - "properties": { - "builder": { - "description": "The function that Nx will invoke when you run this architect", - "type": "string" + then: { + properties: { + projects: { + type: 'object', + additionalProperties: { + type: 'object', + properties: { + architect: { + description: + 'Configures all the targets which define what tasks you can run against the project', + additionalProperties: { + type: 'object', + properties: { + builder: { + description: + 'The function that Nx will invoke when you run this architect', + type: 'string', }, - "options": { - "type": "object" + options: { + type: 'object', + }, + configurations: { + description: + 'provides extra sets of values that will be merged into the options map', + additionalProperties: { + type: 'object', + }, }, - "configurations": { - "description": "provides extra sets of values that will be merged into the options map", - "additionalProperties": { - "type": "object" - } - } }, - "allOf": [ - ${builders} - ] - } - } - } - } - } - } - } + allOf: builders, + }, + }, + }, + }, + }, + }, + }, }, { - "if": { - "properties": { "version": { "const": 2 } }, - "required": ["version"] + if: { + properties: { version: { const: 2 } }, + required: ['version'], }, - "then": { - "properties": { - "projects": { - "type": "object", - "additionalProperties": { - "oneOf": [ + then: { + properties: { + projects: { + type: 'object', + additionalProperties: { + oneOf: [ { - "type": "string" + type: 'string', }, { - "type": "object", - "properties": { - "targets": { - "description": "Configures all the targets which define what tasks you can run against the project", - "additionalProperties": { - "type": "object", - "properties": { - "executor": { - "description": "The function that Nx will invoke when you run this target", - "type": "string" + type: 'object', + properties: { + targets: { + description: + 'Configures all the targets which define what tasks you can run against the project', + additionalProperties: { + type: 'object', + properties: { + executor: { + description: + 'The function that Nx will invoke when you run this target', + type: 'string', }, - "options": { - "type": "object" + options: { + type: 'object', + }, + configurations: { + description: + 'provides extra sets of values that will be merged into the options map', + additionalProperties: { + type: 'object', + }, }, - "configurations": { - "description": "provides extra sets of values that will be merged into the options map", - "additionalProperties": { - "type": "object" - } - } }, - "allOf": [ - ${executors} - ] - } - } - } - } - ] - } - } - } - } - } - ] - }`; + allOf: executors, + }, + }, + }, + }, + ], + }, + }, + }, + }, + }, + ], + }; } diff --git a/libs/npm/src/lib/pnp-dependencies.ts b/libs/npm/src/lib/pnp-dependencies.ts index 045f57a01b..4e8bf58801 100644 --- a/libs/npm/src/lib/pnp-dependencies.ts +++ b/libs/npm/src/lib/pnp-dependencies.ts @@ -11,8 +11,9 @@ async function getPnpFile(workspacePath: string) { try { const fileName = `.pnp${ext}`; const pnpFile = join(workspacePath, fileName); - await fileExists(pnpFile); - return pnpFile; + if (await fileExists(pnpFile)) { + return pnpFile; + } } catch { return; } diff --git a/libs/schema/src/normalize-schema.ts b/libs/schema/src/normalize-schema.ts index 366afbf908..e14196d68f 100644 --- a/libs/schema/src/normalize-schema.ts +++ b/libs/schema/src/normalize-schema.ts @@ -174,6 +174,7 @@ function schemaToOptions( const name = config?.hyphenate ? names(option).fileName : option; cliOptions.push({ name, + originalName: option, positional, ...currentProperty, }); diff --git a/libs/utils/src/lib/utils/utils.ts b/libs/utils/src/lib/utils/utils.ts index 633fa26f84..a65b19d478 100644 --- a/libs/utils/src/lib/utils/utils.ts +++ b/libs/utils/src/lib/utils/utils.ts @@ -27,99 +27,3 @@ export function toWorkspaceFormat( newFormat.projects = Object.fromEntries(sortedProjects); return newFormat; } -<<<<<<< HEAD - -function schemaToOptions( - schema: Schema, - config?: { hyphenate: boolean } -): CliOption[] { - return Object.keys(schema.properties || {}).reduce( - (cliOptions, option) => { - const currentProperty = schema.properties[option]; - const $default = currentProperty.$default; - const $defaultIndex = - $default?.['$source'] === 'argv' ? $default['index'] : undefined; - const positional: number | undefined = - typeof $defaultIndex === 'number' ? $defaultIndex : undefined; - - const visible = isPropertyVisible(option, currentProperty); - if (!visible) { - return cliOptions; - } - const name = config?.hyphenate ? names(option).fileName : option; - cliOptions.push({ - name, - originalName: option, - positional, - ...currentProperty, - }); - return cliOptions; - }, - [] - ); -} - -function isPropertyVisible( - option: string, - property: OptionPropertyDescription -): boolean { - const ALWAYS_VISIBLE_OPTIONS = ['path']; - - if (ALWAYS_VISIBLE_OPTIONS.includes(option)) { - return true; - } - - if ('hidden' in property) { - return !(property as any)['hidden']; - } - - return property.visible ?? true; -} -||||||| parent of e300db5 (refactor packages to remove dependencies on vscode) - -function schemaToOptions( - schema: Schema, - config?: { hyphenate: boolean } -): CliOption[] { - return Object.keys(schema.properties || {}).reduce( - (cliOptions, option) => { - const currentProperty = schema.properties[option]; - const $default = currentProperty.$default; - const $defaultIndex = - $default?.['$source'] === 'argv' ? $default['index'] : undefined; - const positional: number | undefined = - typeof $defaultIndex === 'number' ? $defaultIndex : undefined; - - const visible = isPropertyVisible(option, currentProperty); - if (!visible) { - return cliOptions; - } - const name = config?.hyphenate ? names(option).fileName : option; - cliOptions.push({ - name, - originalName: option, - positional, - ...currentProperty, - }); - return cliOptions; - }, - [] - ); -} - -function isPropertyVisible( - option: string, - property: OptionPropertyDescription -): boolean { - const ALWAYS_VISIBLE_OPTIONS = ['path']; - - if (ALWAYS_VISIBLE_OPTIONS.includes(option)) { - return true; - } - - if ('hidden' in property) { - return !(property as any)['hidden']; - } - - return property.visible ?? true; -} diff --git a/package.json b/package.json index b5bdf874a0..0d72e6b77d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@yarnpkg/libzip": "2.2.3-rc.5", "find-cache-dir": "^3.3.2", "jsonc-parser": "^3.0.0", + "request-light": "^0.5.8", "tslib": "^2.0.0", "vscode-json-languageservice": "^5.1.0", "vscode-languageclient": "^8.0.2", diff --git a/yarn.lock b/yarn.lock index f5429e3a38..63bbdd34dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17269,6 +17269,11 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" +request-light@^0.5.8: + version "0.5.8" + resolved "https://registry.yarnpkg.com/request-light/-/request-light-0.5.8.tgz#8bf73a07242b9e7b601fac2fa5dc22a094abcc27" + integrity sha512-3Zjgh+8b5fhRJBQZoy+zbVKpAQGLyka0MPgW3zruTF4dFFJ8Fqcfu9YsAvi/rvdcaTeWG3MkbZv4WKxAn/84Lg== + request-progress@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-3.0.0.tgz#4ca754081c7fec63f505e4faa825aa06cd669dbe" From c5c09de2eb62618ba96feff1748066bf3efc7548 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 13:02:43 -0400 Subject: [PATCH 09/27] fix merge mistakes --- libs/schema/src/normalize-schema.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/schema/src/normalize-schema.ts b/libs/schema/src/normalize-schema.ts index e14196d68f..0944fcc07a 100644 --- a/libs/schema/src/normalize-schema.ts +++ b/libs/schema/src/normalize-schema.ts @@ -38,7 +38,8 @@ export async function normalizeSchema( const nxOptions = options.map((option) => { const xPrompt: XPrompt | undefined = option['x-prompt']; - const workspaceDefault = projectDefaults && projectDefaults[option.name]; + const workspaceDefault = + projectDefaults?.[option.originalName ?? option.name]; const $default = option.$default; const nxOption: Option = { From d21e699aa441e328ae745098afdfb9b826946d5b Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 14:16:11 -0400 Subject: [PATCH 10/27] fix circular dep and add json document cache from vscode --- apps/lsp/src/json-documents.ts | 24 ----- apps/lsp/src/languageModelCache.ts | 102 ++++++++++++++++++ apps/lsp/src/main.ts | 25 +++-- apps/vscode/src/main.ts | 2 +- libs/npm/src/index.ts | 3 + .../src/lib/find-nx-package-path.ts | 2 +- libs/{package => npm}/src/lib/ng-version.ts | 2 +- libs/{package => npm}/src/lib/nx-version.ts | 0 libs/npm/src/lib/workspace-dependencies.ts | 2 +- libs/package/.babelrc | 3 - libs/package/.eslintrc.json | 18 ---- libs/package/README.md | 11 -- libs/package/jest.config.ts | 16 --- libs/package/project.json | 23 ---- libs/package/src/index.ts | 3 - libs/package/tsconfig.json | 13 --- libs/package/tsconfig.lib.json | 11 -- libs/package/tsconfig.spec.json | 20 ---- .../src/lib/get-nx-workspace-config.ts | 2 +- .../src/lib/get-nx-workspace-package.ts | 2 +- .../vscode/tasks/src/lib/cli-task-commands.ts | 12 +-- tsconfig.base.json | 1 - workspace.json | 1 - 23 files changed, 133 insertions(+), 165 deletions(-) delete mode 100644 apps/lsp/src/json-documents.ts create mode 100644 apps/lsp/src/languageModelCache.ts rename libs/{package => npm}/src/lib/find-nx-package-path.ts (93%) rename libs/{package => npm}/src/lib/ng-version.ts (91%) rename libs/{package => npm}/src/lib/nx-version.ts (100%) delete mode 100644 libs/package/.babelrc delete mode 100644 libs/package/.eslintrc.json delete mode 100644 libs/package/README.md delete mode 100644 libs/package/jest.config.ts delete mode 100644 libs/package/project.json delete mode 100644 libs/package/src/index.ts delete mode 100644 libs/package/tsconfig.json delete mode 100644 libs/package/tsconfig.lib.json delete mode 100644 libs/package/tsconfig.spec.json diff --git a/apps/lsp/src/json-documents.ts b/apps/lsp/src/json-documents.ts deleted file mode 100644 index 8c4b2444db..0000000000 --- a/apps/lsp/src/json-documents.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { JSONDocument, TextDocument } from 'vscode-json-languageservice'; - -const cache = new Map(); - -export function jsonDocumentsMapper( - parse: (document: TextDocument) => JSONDocument -) { - return { - get(document: TextDocument): JSONDocument { - let jsonDocument = cache.get(document.uri); - if (jsonDocument) { - return jsonDocument; - } - - jsonDocument = parse(document); - cache.set(document.uri, jsonDocument); - - return jsonDocument; - }, - remove(document: TextDocument) { - cache.delete(document.uri); - }, - }; -} diff --git a/apps/lsp/src/languageModelCache.ts b/apps/lsp/src/languageModelCache.ts new file mode 100644 index 0000000000..9d642be67f --- /dev/null +++ b/apps/lsp/src/languageModelCache.ts @@ -0,0 +1,102 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +// https://github.com/microsoft/vscode/blob/89c30e1b86f941db095d9f52b128287e5039e004/extensions/json-language-features/server/src/languageModelCache.ts + +import { TextDocument } from 'vscode-languageserver-textdocument'; + +export interface LanguageModelCache { + get(document: TextDocument): T; + onDocumentRemoved(document: TextDocument): void; + dispose(): void; +} + +export function getLanguageModelCache( + maxEntries: number, + cleanupIntervalTimeInSec: number, + parse: (document: TextDocument) => T +): LanguageModelCache { + let languageModels: { + [uri: string]: { + version: number; + languageId: string; + cTime: number; + languageModel: T; + }; + } = {}; + let nModels = 0; + + let cleanupInterval: NodeJS.Timer | undefined = undefined; + if (cleanupIntervalTimeInSec > 0) { + cleanupInterval = setInterval(() => { + const cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; + const uris = Object.keys(languageModels); + for (const uri of uris) { + const languageModelInfo = languageModels[uri]; + if (languageModelInfo.cTime < cutoffTime) { + delete languageModels[uri]; + nModels--; + } + } + }, cleanupIntervalTimeInSec * 1000); + } + + return { + get(document: TextDocument): T { + const version = document.version; + const languageId = document.languageId; + const languageModelInfo = languageModels[document.uri]; + if ( + languageModelInfo && + languageModelInfo.version === version && + languageModelInfo.languageId === languageId + ) { + languageModelInfo.cTime = Date.now(); + return languageModelInfo.languageModel; + } + const languageModel = parse(document); + languageModels[document.uri] = { + languageModel, + version, + languageId, + cTime: Date.now(), + }; + if (!languageModelInfo) { + nModels++; + } + + if (nModels === maxEntries) { + let oldestTime = Number.MAX_VALUE; + let oldestUri = null; + for (const uri in languageModels) { + const languageModelInfo = languageModels[uri]; + if (languageModelInfo.cTime < oldestTime) { + oldestUri = uri; + oldestTime = languageModelInfo.cTime; + } + } + if (oldestUri) { + delete languageModels[oldestUri]; + nModels--; + } + } + return languageModel; + }, + onDocumentRemoved(document: TextDocument) { + const uri = document.uri; + if (languageModels[uri]) { + delete languageModels[uri]; + nModels--; + } + }, + dispose() { + if (typeof cleanupInterval !== 'undefined') { + clearInterval(cleanupInterval); + cleanupInterval = undefined; + languageModels = {}; + nModels = 0; + } + }, + }; +} diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index 21ba31adbf..17df336974 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -6,6 +6,7 @@ import { import { ClientCapabilities, getLanguageService, + JSONDocument, TextDocument, } from 'vscode-json-languageservice'; import { @@ -16,7 +17,7 @@ import { TextDocumentSyncKind, } from 'vscode-languageserver/node'; import { URI, Utils } from 'vscode-uri'; -import { jsonDocumentsMapper } from './json-documents'; +import { getLanguageModelCache } from './languageModelCache'; import { getSchemaRequestService } from './runtime'; const workspaceContext = { @@ -34,10 +35,6 @@ let languageService = getLanguageService({ clientCapabilities: ClientCapabilities.LATEST, }); -const jsonDocumentMapper = jsonDocumentsMapper((document) => - languageService.parseJSONDocument(document) -); - // Create a text document manager. const documents = new TextDocuments(TextDocument); @@ -45,10 +42,6 @@ const documents = new TextDocuments(TextDocument); // for open, change and close text document events documents.listen(connection); -documents.onDidClose((e) => { - jsonDocumentMapper.remove(e.document); -}); - connection.onInitialize(async (params) => { debugger; // TODO: add capability checks @@ -112,6 +105,20 @@ connection.onCompletion(async (completionParams) => { return completionList; }); +const jsonDocumentMapper = getLanguageModelCache( + 10, + 60, + (document) => languageService.parseJSONDocument(document) +); + +documents.onDidClose((e) => { + jsonDocumentMapper.onDocumentRemoved(e.document); +}); + +connection.onShutdown(() => { + jsonDocumentMapper.dispose(); +}); + function getJsonDocument(document: TextDocument) { return jsonDocumentMapper.get(document); } diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index 7574850595..ab7a58b432 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -55,7 +55,7 @@ import { projectGraph } from '@nx-console/vscode/project-graph'; import { configureLspClient } from './configure-lsp-client'; import { fileExists } from '@nx-console/file-system'; import { getGenerators } from '@nx-console/collections'; -import { nxVersion } from '@nx-console/package'; +import { nxVersion } from '@nx-console/npm'; let runTargetTreeView: TreeView; let nxProjectTreeView: TreeView; diff --git a/libs/npm/src/index.ts b/libs/npm/src/index.ts index 841cbe1a6a..ae950a78ac 100644 --- a/libs/npm/src/index.ts +++ b/libs/npm/src/index.ts @@ -1 +1,4 @@ export * from './lib/workspace-dependencies'; +export * from './lib/find-nx-package-path'; +export * from './lib/ng-version'; +export * from './lib/nx-version'; diff --git a/libs/package/src/lib/find-nx-package-path.ts b/libs/npm/src/lib/find-nx-package-path.ts similarity index 93% rename from libs/package/src/lib/find-nx-package-path.ts rename to libs/npm/src/lib/find-nx-package-path.ts index 77b90054a5..7ac3c24d53 100644 --- a/libs/package/src/lib/find-nx-package-path.ts +++ b/libs/npm/src/lib/find-nx-package-path.ts @@ -1,6 +1,6 @@ import { join } from 'path'; -import { workspaceDependencyPath } from '@nx-console/npm'; import { fileExists } from '@nx-console/file-system'; +import { workspaceDependencyPath } from './workspace-dependencies'; /** * Finds the local Nx package in the workspace. diff --git a/libs/package/src/lib/ng-version.ts b/libs/npm/src/lib/ng-version.ts similarity index 91% rename from libs/package/src/lib/ng-version.ts rename to libs/npm/src/lib/ng-version.ts index 1e2911bbac..91edc3783a 100644 --- a/libs/package/src/lib/ng-version.ts +++ b/libs/npm/src/lib/ng-version.ts @@ -1,4 +1,4 @@ -import { workspaceDependencyPath } from '@nx-console/npm'; +import { workspaceDependencyPath } from './workspace-dependencies'; declare function __non_webpack_require__(importPath: string): any; diff --git a/libs/package/src/lib/nx-version.ts b/libs/npm/src/lib/nx-version.ts similarity index 100% rename from libs/package/src/lib/nx-version.ts rename to libs/npm/src/lib/nx-version.ts diff --git a/libs/npm/src/lib/workspace-dependencies.ts b/libs/npm/src/lib/workspace-dependencies.ts index 2ab79fbf05..a35bf9e2a6 100644 --- a/libs/npm/src/lib/workspace-dependencies.ts +++ b/libs/npm/src/lib/workspace-dependencies.ts @@ -8,7 +8,7 @@ import { pnpDependencyPath, } from './pnp-dependencies'; import { directoryExists } from '@nx-console/file-system'; -import { nxVersion } from '@nx-console/package'; +import { nxVersion } from './nx-version'; /** * Get dependencies for the current workspace. diff --git a/libs/package/.babelrc b/libs/package/.babelrc deleted file mode 100644 index cf7ddd99c6..0000000000 --- a/libs/package/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] -} diff --git a/libs/package/.eslintrc.json b/libs/package/.eslintrc.json deleted file mode 100644 index 9d9c0db55b..0000000000 --- a/libs/package/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/libs/package/README.md b/libs/package/README.md deleted file mode 100644 index 5c7ee6eb13..0000000000 --- a/libs/package/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# package - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test package` to execute the unit tests via [Jest](https://jestjs.io). - -## Running lint - -Run `nx lint package` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/package/jest.config.ts b/libs/package/jest.config.ts deleted file mode 100644 index 005b936572..0000000000 --- a/libs/package/jest.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'package', - preset: '../../jest.preset.js', - globals: { - 'ts-jest': { - tsconfig: '/tsconfig.spec.json', - }, - }, - testEnvironment: 'node', - transform: { - '^.+\\.[tj]sx?$': 'ts-jest', - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/package', -}; diff --git a/libs/package/project.json b/libs/package/project.json deleted file mode 100644 index 7d0631e59e..0000000000 --- a/libs/package/project.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/package/src", - "projectType": "library", - "targets": { - "lint": { - "executor": "@nrwl/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["libs/package/**/*.ts"] - } - }, - "test": { - "executor": "@nrwl/jest:jest", - "outputs": ["coverage/libs/package"], - "options": { - "jestConfig": "libs/package/jest.config.ts", - "passWithNoTests": true - } - } - }, - "tags": [] -} diff --git a/libs/package/src/index.ts b/libs/package/src/index.ts deleted file mode 100644 index e1d5afa204..0000000000 --- a/libs/package/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './lib/ng-version'; -export * from './lib/nx-version'; -export * from './lib/find-nx-package-path'; diff --git a/libs/package/tsconfig.json b/libs/package/tsconfig.json deleted file mode 100644 index 62ebbd9464..0000000000 --- a/libs/package/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/package/tsconfig.lib.json b/libs/package/tsconfig.lib.json deleted file mode 100644 index 0e2a172abd..0000000000 --- a/libs/package/tsconfig.lib.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, - "types": ["node"] - }, - "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], - "include": ["**/*.ts"] -} diff --git a/libs/package/tsconfig.spec.json b/libs/package/tsconfig.spec.json deleted file mode 100644 index ff08addd60..0000000000 --- a/libs/package/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] -} diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts index cad418982b..735f10dfe2 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts @@ -9,7 +9,7 @@ import { getNxWorkspacePackageFileUtils, } from './get-nx-workspace-package'; import { readAndCacheJsonFile } from '@nx-console/file-system'; -import { nxVersion } from '@nx-console/package'; +import { nxVersion } from '@nx-console/npm'; export type NxWorkspaceConfiguration = ProjectsConfigurations & NxJsonConfiguration; diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts index 8a4d3f5de3..3f71069656 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-package.ts @@ -4,7 +4,7 @@ import type * as NxFileUtils from 'nx/src/project-graph/file-utils'; import type * as NxProjectGraph from 'nx/src/project-graph/project-graph'; import { platform } from 'os'; import { join } from 'path'; -import { findNxPackagePath } from '@nx-console/package'; +import { findNxPackagePath } from '@nx-console/npm'; declare function __non_webpack_require__(importPath: string): any; diff --git a/libs/vscode/tasks/src/lib/cli-task-commands.ts b/libs/vscode/tasks/src/lib/cli-task-commands.ts index 162b58824d..88c6a8917b 100644 --- a/libs/vscode/tasks/src/lib/cli-task-commands.ts +++ b/libs/vscode/tasks/src/lib/cli-task-commands.ts @@ -1,19 +1,19 @@ -import { commands, ExtensionContext, window, Uri } from 'vscode'; +import { commands, ExtensionContext, Uri, window } from 'vscode'; +import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; +import { getGenerators } from '@nx-console/collections'; +import { nxVersion } from '@nx-console/npm'; +import { GeneratorType, Option, OptionType } from '@nx-console/schema'; +import { RunTargetTreeItem } from '@nx-console/vscode/nx-run-target-view'; import { findProjectWithPath, nxWorkspace, } from '@nx-console/vscode/nx-workspace'; import { verifyBuilderDefinition } from '@nx-console/vscode/verify'; -import { RunTargetTreeItem } from '@nx-console/vscode/nx-run-target-view'; import { CliTaskProvider } from './cli-task-provider'; import { CliTaskQuickPickItem } from './cli-task-quick-pick-item'; import { selectFlags } from './select-flags'; -import { GeneratorType, Option, OptionType } from '@nx-console/schema'; -import { WorkspaceJsonConfiguration } from '@nrwl/devkit'; import { selectGenerator } from './select-generator'; -import { getGenerators } from '@nx-console/collections'; -import { nxVersion } from '@nx-console/package'; const CLI_COMMAND_LIST = [ 'build', diff --git a/tsconfig.base.json b/tsconfig.base.json index 1fded082d2..4690161f86 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -25,7 +25,6 @@ "@nx-console/file-system": ["libs/file-system/src/index.ts"], "@nx-console/json-schema": ["libs/json-schema/src/index.ts"], "@nx-console/npm": ["libs/npm/src/index.ts"], - "@nx-console/package": ["libs/package/src/index.ts"], "@nx-console/schema": ["libs/schema/src/index.ts"], "@nx-console/typescript-plugin": ["libs/typescript-plugin/src/index.ts"], "@nx-console/utils": ["libs/utils/src/index.ts"], diff --git a/workspace.json b/workspace.json index d5b4c7a15e..af472fba35 100644 --- a/workspace.json +++ b/workspace.json @@ -6,7 +6,6 @@ "json-schema": "libs/json-schema", "lsp": "apps/lsp", "npm": "libs/npm", - "package": "libs/package", "schema": "libs/schema", "typescript-plugin": "libs/typescript-plugin", "utils": "libs/utils", From 352e7675d646132594f4926413ae1da1871fde04 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 15:25:56 -0400 Subject: [PATCH 11/27] remove $schema fields to get full oncomplete with the json language service --- apps/lsp/src/languageModelCache.ts | 34 ++++++++++++++++++++++-------- apps/lsp/src/main.ts | 14 ++++++------ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/apps/lsp/src/languageModelCache.ts b/apps/lsp/src/languageModelCache.ts index 9d642be67f..1ef2ad908c 100644 --- a/apps/lsp/src/languageModelCache.ts +++ b/apps/lsp/src/languageModelCache.ts @@ -4,25 +4,27 @@ *--------------------------------------------------------------------------------------------*/ // https://github.com/microsoft/vscode/blob/89c30e1b86f941db095d9f52b128287e5039e004/extensions/json-language-features/server/src/languageModelCache.ts +import { JSONDocument } from 'vscode-json-languageservice'; import { TextDocument } from 'vscode-languageserver-textdocument'; export interface LanguageModelCache { - get(document: TextDocument): T; + get(document: TextDocument): { jsonAst: T; document: TextDocument }; onDocumentRemoved(document: TextDocument): void; dispose(): void; } -export function getLanguageModelCache( +export function getLanguageModelCache( maxEntries: number, cleanupIntervalTimeInSec: number, - parse: (document: TextDocument) => T -): LanguageModelCache { + parse: (document: TextDocument) => JSONDocument +): LanguageModelCache { let languageModels: { [uri: string]: { version: number; languageId: string; cTime: number; - languageModel: T; + languageModel: JSONDocument; + document: TextDocument; }; } = {}; let nModels = 0; @@ -43,7 +45,10 @@ export function getLanguageModelCache( } return { - get(document: TextDocument): T { + get(document: TextDocument): { + jsonAst: JSONDocument; + document: TextDocument; + } { const version = document.version; const languageId = document.languageId; const languageModelInfo = languageModels[document.uri]; @@ -53,13 +58,24 @@ export function getLanguageModelCache( languageModelInfo.languageId === languageId ) { languageModelInfo.cTime = Date.now(); - return languageModelInfo.languageModel; + return { + jsonAst: languageModelInfo.languageModel, + document: languageModelInfo.document, + }; } - const languageModel = parse(document); + const newDocument = TextDocument.create( + document.uri, + document.languageId, + document.version, + document.getText().replace(/"\$schema":\s".+",/, '') + ); + const languageModel = parse(newDocument); + languageModels[document.uri] = { languageModel, version, languageId, + document: newDocument, cTime: Date.now(), }; if (!languageModelInfo) { @@ -81,7 +97,7 @@ export function getLanguageModelCache( nModels--; } } - return languageModel; + return { jsonAst: languageModel, document: newDocument }; }, onDocumentRemoved(document: TextDocument) { const uri = document.uri; diff --git a/apps/lsp/src/main.ts b/apps/lsp/src/main.ts index 17df336974..19a1440ca8 100644 --- a/apps/lsp/src/main.ts +++ b/apps/lsp/src/main.ts @@ -90,25 +90,23 @@ connection.onInitialize(async (params) => { }); connection.onCompletion(async (completionParams) => { - const document = documents.get(completionParams.textDocument.uri); - if (!document) { + const changedDocument = documents.get(completionParams.textDocument.uri); + if (!changedDocument) { return null; } - const jsonDocument = getJsonDocument(document); + const { jsonAst, document } = getJsonDocument(changedDocument); const completionList = await languageService.doComplete( document, completionParams.position, - jsonDocument + jsonAst ); console.log(completionList); return completionList; }); -const jsonDocumentMapper = getLanguageModelCache( - 10, - 60, - (document) => languageService.parseJSONDocument(document) +const jsonDocumentMapper = getLanguageModelCache(10, 60, (document) => + languageService.parseJSONDocument(document) ); documents.onDidClose((e) => { From bbc79b36e33b20e824409c70d092b18aad6e3ce1 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 3 Aug 2022 17:14:06 -0400 Subject: [PATCH 12/27] add lsp-client lib --- apps/vscode/src/main.ts | 2 +- libs/vscode/lsp-client/.babelrc | 3 +++ libs/vscode/lsp-client/.eslintrc.json | 18 +++++++++++++++ libs/vscode/lsp-client/README.md | 11 +++++++++ libs/vscode/lsp-client/jest.config.ts | 16 +++++++++++++ libs/vscode/lsp-client/project.json | 23 +++++++++++++++++++ libs/vscode/lsp-client/src/index.ts | 1 + .../src/lib}/configure-lsp-client.ts | 0 libs/vscode/lsp-client/tsconfig.json | 13 +++++++++++ libs/vscode/lsp-client/tsconfig.lib.json | 11 +++++++++ libs/vscode/lsp-client/tsconfig.spec.json | 20 ++++++++++++++++ tsconfig.base.json | 1 + workspace.json | 1 + 13 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 libs/vscode/lsp-client/.babelrc create mode 100644 libs/vscode/lsp-client/.eslintrc.json create mode 100644 libs/vscode/lsp-client/README.md create mode 100644 libs/vscode/lsp-client/jest.config.ts create mode 100644 libs/vscode/lsp-client/project.json create mode 100644 libs/vscode/lsp-client/src/index.ts rename {apps/vscode/src => libs/vscode/lsp-client/src/lib}/configure-lsp-client.ts (100%) create mode 100644 libs/vscode/lsp-client/tsconfig.json create mode 100644 libs/vscode/lsp-client/tsconfig.lib.json create mode 100644 libs/vscode/lsp-client/tsconfig.spec.json diff --git a/apps/vscode/src/main.ts b/apps/vscode/src/main.ts index ab7a58b432..357193c685 100644 --- a/apps/vscode/src/main.ts +++ b/apps/vscode/src/main.ts @@ -52,10 +52,10 @@ import { REFRESH_WORKSPACE, } from './commands/refresh-workspace'; import { projectGraph } from '@nx-console/vscode/project-graph'; -import { configureLspClient } from './configure-lsp-client'; import { fileExists } from '@nx-console/file-system'; import { getGenerators } from '@nx-console/collections'; import { nxVersion } from '@nx-console/npm'; +import { configureLspClient } from '@nx-console/vscode/lsp-client'; let runTargetTreeView: TreeView; let nxProjectTreeView: TreeView; diff --git a/libs/vscode/lsp-client/.babelrc b/libs/vscode/lsp-client/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/libs/vscode/lsp-client/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/vscode/lsp-client/.eslintrc.json b/libs/vscode/lsp-client/.eslintrc.json new file mode 100644 index 0000000000..3456be9b90 --- /dev/null +++ b/libs/vscode/lsp-client/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/vscode/lsp-client/README.md b/libs/vscode/lsp-client/README.md new file mode 100644 index 0000000000..1d0151c967 --- /dev/null +++ b/libs/vscode/lsp-client/README.md @@ -0,0 +1,11 @@ +# vscode-lsp-client + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test vscode-lsp-client` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint vscode-lsp-client` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/vscode/lsp-client/jest.config.ts b/libs/vscode/lsp-client/jest.config.ts new file mode 100644 index 0000000000..e122323b16 --- /dev/null +++ b/libs/vscode/lsp-client/jest.config.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +export default { + displayName: 'vscode-lsp-client', + preset: '../../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../../coverage/libs/vscode/lsp-client', +}; diff --git a/libs/vscode/lsp-client/project.json b/libs/vscode/lsp-client/project.json new file mode 100644 index 0000000000..8da5ee7f5d --- /dev/null +++ b/libs/vscode/lsp-client/project.json @@ -0,0 +1,23 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/vscode/lsp-client/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/vscode/lsp-client/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/vscode/lsp-client"], + "options": { + "jestConfig": "libs/vscode/lsp-client/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/vscode/lsp-client/src/index.ts b/libs/vscode/lsp-client/src/index.ts new file mode 100644 index 0000000000..f72d777ac7 --- /dev/null +++ b/libs/vscode/lsp-client/src/index.ts @@ -0,0 +1 @@ +export * from './lib/configure-lsp-client'; diff --git a/apps/vscode/src/configure-lsp-client.ts b/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts similarity index 100% rename from apps/vscode/src/configure-lsp-client.ts rename to libs/vscode/lsp-client/src/lib/configure-lsp-client.ts diff --git a/libs/vscode/lsp-client/tsconfig.json b/libs/vscode/lsp-client/tsconfig.json new file mode 100644 index 0000000000..667a3463d1 --- /dev/null +++ b/libs/vscode/lsp-client/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/vscode/lsp-client/tsconfig.lib.json b/libs/vscode/lsp-client/tsconfig.lib.json new file mode 100644 index 0000000000..a80995bf42 --- /dev/null +++ b/libs/vscode/lsp-client/tsconfig.lib.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/vscode/lsp-client/tsconfig.spec.json b/libs/vscode/lsp-client/tsconfig.spec.json new file mode 100644 index 0000000000..0be00e2681 --- /dev/null +++ b/libs/vscode/lsp-client/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 4690161f86..39be3d13e6 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -40,6 +40,7 @@ "@nx-console/vscode/configuration": [ "libs/vscode/configuration/src/index.ts" ], + "@nx-console/vscode/lsp-client": ["libs/vscode/lsp-client/src/index.ts"], "@nx-console/vscode/nx-commands-view": [ "libs/vscode/nx-commands-view/src/index.ts" ], diff --git a/workspace.json b/workspace.json index af472fba35..98e6be5932 100644 --- a/workspace.json +++ b/workspace.json @@ -11,6 +11,7 @@ "utils": "libs/utils", "vscode": "apps/vscode", "vscode-configuration": "libs/vscode/configuration", + "vscode-lsp-client": "libs/vscode/lsp-client", "vscode-nx-commands-view": "libs/vscode/nx-commands-view", "vscode-nx-conversion": "libs/vscode/nx-conversion", "vscode-nx-project-view": "libs/vscode/nx-project-view", From 27a248a047452068ac9d2b9909bb74918a404bff Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 09:12:48 -0400 Subject: [PATCH 13/27] add package.json + package command --- apps/{lsp => nxls}/.eslintrc.json | 0 apps/{lsp => nxls}/jest.config.ts | 4 +-- apps/nxls/package.json | 6 ++++ apps/{lsp => nxls}/project.json | 34 ++++++++++++------- apps/{lsp => nxls}/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 0 .../src/environments/environment.ts | 0 apps/{lsp => nxls}/src/languageModelCache.ts | 0 apps/{lsp => nxls}/src/main.ts | 0 apps/{lsp => nxls}/src/runtime.ts | 0 apps/{lsp => nxls}/tsconfig.app.json | 0 apps/{lsp => nxls}/tsconfig.json | 0 apps/{lsp => nxls}/tsconfig.spec.json | 0 workspace.json | 2 +- 14 files changed, 30 insertions(+), 16 deletions(-) rename apps/{lsp => nxls}/.eslintrc.json (100%) rename apps/{lsp => nxls}/jest.config.ts (80%) create mode 100644 apps/nxls/package.json rename apps/{lsp => nxls}/project.json (52%) rename apps/{lsp => nxls}/src/assets/.gitkeep (100%) rename apps/{lsp => nxls}/src/environments/environment.prod.ts (100%) rename apps/{lsp => nxls}/src/environments/environment.ts (100%) rename apps/{lsp => nxls}/src/languageModelCache.ts (100%) rename apps/{lsp => nxls}/src/main.ts (100%) rename apps/{lsp => nxls}/src/runtime.ts (100%) rename apps/{lsp => nxls}/tsconfig.app.json (100%) rename apps/{lsp => nxls}/tsconfig.json (100%) rename apps/{lsp => nxls}/tsconfig.spec.json (100%) diff --git a/apps/lsp/.eslintrc.json b/apps/nxls/.eslintrc.json similarity index 100% rename from apps/lsp/.eslintrc.json rename to apps/nxls/.eslintrc.json diff --git a/apps/lsp/jest.config.ts b/apps/nxls/jest.config.ts similarity index 80% rename from apps/lsp/jest.config.ts rename to apps/nxls/jest.config.ts index 2e83a3073f..25bc0c691f 100644 --- a/apps/lsp/jest.config.ts +++ b/apps/nxls/jest.config.ts @@ -1,6 +1,6 @@ /* eslint-disable */ export default { - displayName: 'lsp', + displayName: 'nxls', preset: '../../jest.preset.js', globals: { 'ts-jest': { @@ -12,5 +12,5 @@ export default { '^.+\\.[tj]s$': 'ts-jest', }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/apps/lsp', + coverageDirectory: '../../coverage/apps/nxls', }; diff --git a/apps/nxls/package.json b/apps/nxls/package.json new file mode 100644 index 0000000000..d9bfedacec --- /dev/null +++ b/apps/nxls/package.json @@ -0,0 +1,6 @@ +{ + "name": "nxls", + "version": "0.0.1", + "main": "main.js", + "bin": "main.js" +} diff --git a/apps/lsp/project.json b/apps/nxls/project.json similarity index 52% rename from apps/lsp/project.json rename to apps/nxls/project.json index c68d990f23..67764d5315 100644 --- a/apps/lsp/project.json +++ b/apps/nxls/project.json @@ -1,5 +1,6 @@ { - "sourceRoot": "apps/lsp/src", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/nxls/src", "projectType": "application", "targets": { "watch": { @@ -7,9 +8,9 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/apps/vscode/lsp", - "main": "apps/lsp/src/main.ts", - "tsConfig": "apps/lsp/tsconfig.app.json", - "assets": ["apps/lsp/src/assets"], + "main": "apps/nxls/src/main.ts", + "tsConfig": "apps/nxls/tsconfig.app.json", + "assets": ["apps/nxls/src/assets"], "watch": true } }, @@ -18,19 +19,26 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/apps/vscode/lsp", - "main": "apps/lsp/src/main.ts", - "tsConfig": "apps/lsp/tsconfig.app.json", - "assets": ["apps/lsp/src/assets"] + "main": "apps/nxls/src/main.ts", + "tsConfig": "apps/nxls/tsconfig.app.json", + "assets": ["apps/nxls/src/assets"] }, "configurations": { + "package": { + "outputPath": "dist/packages/lsp", + "generatePackageJson": true, + "externalDependencies": "all", + "optimization": true, + "extractLicenses": true + }, "production": { "optimization": true, "extractLicenses": true, "inspect": false, "fileReplacements": [ { - "replace": "apps/lsp/src/environments/environment.ts", - "with": "apps/lsp/src/environments/environment.prod.ts" + "replace": "apps/nxls/src/environments/environment.ts", + "with": "apps/nxls/src/environments/environment.prod.ts" } ] } @@ -39,21 +47,21 @@ "serve": { "executor": "@nrwl/node:node", "options": { - "buildTarget": "lsp:build" + "buildTarget": "nxls:build" } }, "lint": { "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/lsp/**/*.ts"] + "lintFilePatterns": ["apps/nxls/**/*.ts"] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": ["coverage/apps/lsp"], + "outputs": ["coverage/apps/nxls"], "options": { - "jestConfig": "apps/lsp/jest.config.ts", + "jestConfig": "apps/nxls/jest.config.ts", "passWithNoTests": true } } diff --git a/apps/lsp/src/assets/.gitkeep b/apps/nxls/src/assets/.gitkeep similarity index 100% rename from apps/lsp/src/assets/.gitkeep rename to apps/nxls/src/assets/.gitkeep diff --git a/apps/lsp/src/environments/environment.prod.ts b/apps/nxls/src/environments/environment.prod.ts similarity index 100% rename from apps/lsp/src/environments/environment.prod.ts rename to apps/nxls/src/environments/environment.prod.ts diff --git a/apps/lsp/src/environments/environment.ts b/apps/nxls/src/environments/environment.ts similarity index 100% rename from apps/lsp/src/environments/environment.ts rename to apps/nxls/src/environments/environment.ts diff --git a/apps/lsp/src/languageModelCache.ts b/apps/nxls/src/languageModelCache.ts similarity index 100% rename from apps/lsp/src/languageModelCache.ts rename to apps/nxls/src/languageModelCache.ts diff --git a/apps/lsp/src/main.ts b/apps/nxls/src/main.ts similarity index 100% rename from apps/lsp/src/main.ts rename to apps/nxls/src/main.ts diff --git a/apps/lsp/src/runtime.ts b/apps/nxls/src/runtime.ts similarity index 100% rename from apps/lsp/src/runtime.ts rename to apps/nxls/src/runtime.ts diff --git a/apps/lsp/tsconfig.app.json b/apps/nxls/tsconfig.app.json similarity index 100% rename from apps/lsp/tsconfig.app.json rename to apps/nxls/tsconfig.app.json diff --git a/apps/lsp/tsconfig.json b/apps/nxls/tsconfig.json similarity index 100% rename from apps/lsp/tsconfig.json rename to apps/nxls/tsconfig.json diff --git a/apps/lsp/tsconfig.spec.json b/apps/nxls/tsconfig.spec.json similarity index 100% rename from apps/lsp/tsconfig.spec.json rename to apps/nxls/tsconfig.spec.json diff --git a/workspace.json b/workspace.json index 98e6be5932..838fb6f369 100644 --- a/workspace.json +++ b/workspace.json @@ -4,8 +4,8 @@ "collections": "libs/collections", "file-system": "libs/file-system", "json-schema": "libs/json-schema", - "lsp": "apps/lsp", "npm": "libs/npm", + "nxls": "apps/nxls", "schema": "libs/schema", "typescript-plugin": "libs/typescript-plugin", "utils": "libs/utils", From 38061b007d98815928c6115784530270394f376a Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 09:28:39 -0400 Subject: [PATCH 14/27] correct dist path --- apps/nxls/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/nxls/project.json b/apps/nxls/project.json index 67764d5315..f063ed5c0b 100644 --- a/apps/nxls/project.json +++ b/apps/nxls/project.json @@ -25,7 +25,7 @@ }, "configurations": { "package": { - "outputPath": "dist/packages/lsp", + "outputPath": "dist/packages/nxls", "generatePackageJson": true, "externalDependencies": "all", "optimization": true, From a997ba539de0a241f65e6fae5a6205120f9dbaa8 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 09:40:02 -0400 Subject: [PATCH 15/27] add bin --- apps/nxls/package.json | 2 +- apps/nxls/project.json | 2 +- apps/nxls/src/bin/nxls | 3 +++ apps/nxls/src/main.ts | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 apps/nxls/src/bin/nxls diff --git a/apps/nxls/package.json b/apps/nxls/package.json index d9bfedacec..84c2c336f2 100644 --- a/apps/nxls/package.json +++ b/apps/nxls/package.json @@ -2,5 +2,5 @@ "name": "nxls", "version": "0.0.1", "main": "main.js", - "bin": "main.js" + "bin": "bin/nxls" } diff --git a/apps/nxls/project.json b/apps/nxls/project.json index f063ed5c0b..ba01204f39 100644 --- a/apps/nxls/project.json +++ b/apps/nxls/project.json @@ -21,7 +21,7 @@ "outputPath": "dist/apps/vscode/lsp", "main": "apps/nxls/src/main.ts", "tsConfig": "apps/nxls/tsconfig.app.json", - "assets": ["apps/nxls/src/assets"] + "assets": ["apps/nxls/src/assets", "apps/nxls/src/bin"] }, "configurations": { "package": { diff --git a/apps/nxls/src/bin/nxls b/apps/nxls/src/bin/nxls new file mode 100644 index 0000000000..b4a43d8822 --- /dev/null +++ b/apps/nxls/src/bin/nxls @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('../main.js'); diff --git a/apps/nxls/src/main.ts b/apps/nxls/src/main.ts index 19a1440ca8..ea1047dd3a 100644 --- a/apps/nxls/src/main.ts +++ b/apps/nxls/src/main.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env node import { getExecutors } from '@nx-console/collections'; import { getProjectJsonSchema, @@ -43,7 +44,6 @@ const documents = new TextDocuments(TextDocument); documents.listen(connection); connection.onInitialize(async (params) => { - debugger; // TODO: add capability checks const capabilities = params.capabilities; From ac5a7a181801b0d6f8f5df3c8eaf60af26e8e3a9 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 09:49:09 -0400 Subject: [PATCH 16/27] add ls as implicit dep --- apps/vscode/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vscode/project.json b/apps/vscode/project.json index bf9d76b74e..2027fbaf31 100644 --- a/apps/vscode/project.json +++ b/apps/vscode/project.json @@ -3,7 +3,7 @@ "projectType": "application", "prefix": "vscode", "generators": {}, - "implicitDependencies": ["vscode-ui"], + "implicitDependencies": ["vscode-ui", "nxls"], "targets": { "watch-all": { "executor": "@nrwl/workspace:run-commands", From 8a3c574469cafa1537e61e64a840883e8a1848fa Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 10:14:15 -0400 Subject: [PATCH 17/27] fix watch --- apps/vscode/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vscode/project.json b/apps/vscode/project.json index 2027fbaf31..b94617934a 100644 --- a/apps/vscode/project.json +++ b/apps/vscode/project.json @@ -20,7 +20,7 @@ "color": "green" }, { - "command": "yarn nx watch lsp", + "command": "yarn nx watch nxls", "prefix": "lsp", "color": "magenta" } From 8c7748e7c28c81404498eca0272a3af35bb93bb7 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Thu, 4 Aug 2022 10:28:44 -0400 Subject: [PATCH 18/27] fix ui build --- libs/collections/src/lib/get-generators.ts | 2 +- libs/schema/src/index.ts | 1 - libs/utils/src/lib/utils/read-projects.ts | 2 +- libs/vscode/tasks/src/lib/select-generator.ts | 2 +- tsconfig.base.json | 1 + 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/collections/src/lib/get-generators.ts b/libs/collections/src/lib/get-generators.ts index 3d61107d91..8d86ff8738 100644 --- a/libs/collections/src/lib/get-generators.ts +++ b/libs/collections/src/lib/get-generators.ts @@ -1,9 +1,9 @@ import { CollectionInfo, GeneratorType, - normalizeSchema, WorkspaceProjects, } from '@nx-console/schema'; +import { normalizeSchema } from '@nx-console/schema/normalize'; import { basename, join } from 'path'; import { getCollectionInfo, readCollections } from './read-collections'; diff --git a/libs/schema/src/index.ts b/libs/schema/src/index.ts index b70f9e7b89..97c6e6fce7 100644 --- a/libs/schema/src/index.ts +++ b/libs/schema/src/index.ts @@ -115,4 +115,3 @@ export const WORKSPACE_GENERATOR_NAME_REGEX = export type WorkspaceProjects = ProjectsConfigurations['projects']; export { Store } from './store'; -export { normalizeSchema } from './normalize-schema'; diff --git a/libs/utils/src/lib/utils/read-projects.ts b/libs/utils/src/lib/utils/read-projects.ts index b653c76bcd..84d5ce5891 100644 --- a/libs/utils/src/lib/utils/read-projects.ts +++ b/libs/utils/src/lib/utils/read-projects.ts @@ -3,7 +3,6 @@ import { Option, DefaultValue, TargetConfiguration, - normalizeSchema, } from '@nx-console/schema'; import * as path from 'path'; import { TargetConfiguration as NxTargetConfiguration } from '@nrwl/devkit'; @@ -13,6 +12,7 @@ import { getTelemetry } from '../telemetry'; import { getOutputChannel } from './output-channel'; import { workspaceDependencyPath } from '@nx-console/npm'; import { readAndCacheJsonFile } from '@nx-console/file-system'; +import { normalizeSchema } from '@nx-console/schema/normalize'; export function readTargetDef( targetName: string, diff --git a/libs/vscode/tasks/src/lib/select-generator.ts b/libs/vscode/tasks/src/lib/select-generator.ts index afbdd35467..48cae8a446 100644 --- a/libs/vscode/tasks/src/lib/select-generator.ts +++ b/libs/vscode/tasks/src/lib/select-generator.ts @@ -1,7 +1,6 @@ import { Generator, GeneratorType, - normalizeSchema, Option, TaskExecutionSchema, } from '@nx-console/schema'; @@ -10,6 +9,7 @@ import { nxWorkspace } from '@nx-console/vscode/nx-workspace'; import { QuickPickItem, window } from 'vscode'; import { readAndCacheJsonFile } from '@nx-console/file-system'; import { getGenerators } from '@nx-console/collections'; +import { normalizeSchema } from '@nx-console/schema/normalize'; async function readWorkspaceJsonDefaults(): Promise { const { workspace } = await nxWorkspace(); diff --git a/tsconfig.base.json b/tsconfig.base.json index 39be3d13e6..518a2337cf 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -26,6 +26,7 @@ "@nx-console/json-schema": ["libs/json-schema/src/index.ts"], "@nx-console/npm": ["libs/npm/src/index.ts"], "@nx-console/schema": ["libs/schema/src/index.ts"], + "@nx-console/schema/normalize": ["libs/schema/src/normalize-schema.ts"], "@nx-console/typescript-plugin": ["libs/typescript-plugin/src/index.ts"], "@nx-console/utils": ["libs/utils/src/index.ts"], "@nx-console/vscode-ui/argument-list": [ From 997f21924902dc62be9bdf4ac11ffee4d24a0d1d Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 5 Aug 2022 10:34:12 -0400 Subject: [PATCH 19/27] add devkit as dep --- apps/nxls/package.json | 5 ++++- apps/nxls/project.json | 2 +- libs/vscode/lsp-client/src/lib/configure-lsp-client.ts | 2 +- package.json | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/nxls/package.json b/apps/nxls/package.json index 84c2c336f2..2c6e1c4b86 100644 --- a/apps/nxls/package.json +++ b/apps/nxls/package.json @@ -2,5 +2,8 @@ "name": "nxls", "version": "0.0.1", "main": "main.js", - "bin": "bin/nxls" + "bin": "bin/nxls", + "dependencies": { + "@nrwl/devkit": "14.4.1" + } } diff --git a/apps/nxls/project.json b/apps/nxls/project.json index ba01204f39..14469923c6 100644 --- a/apps/nxls/project.json +++ b/apps/nxls/project.json @@ -7,7 +7,7 @@ "executor": "@nrwl/node:webpack", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/vscode/lsp", + "outputPath": "dist/apps/vscode/nxls", "main": "apps/nxls/src/main.ts", "tsConfig": "apps/nxls/tsconfig.app.json", "assets": ["apps/nxls/src/assets"], diff --git a/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts b/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts index fc2f7961a7..0fc730957f 100644 --- a/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts +++ b/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts @@ -15,7 +15,7 @@ export async function configureLspClient( ): Promise { const { workspacePath, workspace } = await nxWorkspace(); - const serverModule = context.asAbsolutePath(join('lsp', 'main.js')); + const serverModule = context.asAbsolutePath(join('nxls', 'main.js')); const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] }; const serverOptions: ServerOptions = { diff --git a/package.json b/package.json index 0d72e6b77d..af18f44e85 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "dependencies": { "@monodon/typescript-nx-imports-plugin": "0.2.0", + "@nrwl/devkit": "14.4.1", "@yarnpkg/fslib": "2.6.1-rc.5", "@yarnpkg/libzip": "2.2.3-rc.5", "find-cache-dir": "^3.3.2", From bd2c291096fd67eab2796817286a1cb58901ae58 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 5 Aug 2022 11:52:35 -0400 Subject: [PATCH 20/27] clean up generated project schema, add hover provider --- apps/nxls/src/main.ts | 27 ++++++++++++------- .../src/lib/project-json-schema.ts | 8 ------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apps/nxls/src/main.ts b/apps/nxls/src/main.ts index ea1047dd3a..67ed75a0b2 100644 --- a/apps/nxls/src/main.ts +++ b/apps/nxls/src/main.ts @@ -7,7 +7,6 @@ import { import { ClientCapabilities, getLanguageService, - JSONDocument, TextDocument, } from 'vscode-json-languageservice'; import { @@ -44,9 +43,6 @@ const documents = new TextDocuments(TextDocument); documents.listen(connection); connection.onInitialize(async (params) => { - // TODO: add capability checks - const capabilities = params.capabilities; - const { workspacePath, projects } = params.initializationOptions ?? {}; languageService = getLanguageService({ @@ -57,10 +53,13 @@ connection.onInitialize(async (params) => { }); // get schemas - const collections = await getExecutors(workspacePath, projects, false); + const collections = await getExecutors( + workspacePath ?? params.rootPath, + projects, + false + ); const workspaceSchema = getWorkspaceJsonSchema(collections); const projectSchema = getProjectJsonSchema(collections); - console.log(projectSchema); languageService.configure({ schemas: [ { @@ -83,6 +82,7 @@ connection.onInitialize(async (params) => { resolveProvider: false, triggerCharacters: ['"', ':'], }, + hoverProvider: true, }, }; @@ -96,13 +96,22 @@ connection.onCompletion(async (completionParams) => { } const { jsonAst, document } = getJsonDocument(changedDocument); - const completionList = await languageService.doComplete( + return languageService.doComplete( document, completionParams.position, jsonAst ); - console.log(completionList); - return completionList; +}); + +connection.onHover(async (hoverParams) => { + const hoverDocument = documents.get(hoverParams.textDocument.uri); + + if (!hoverDocument) { + return null; + } + + const { jsonAst, document } = getJsonDocument(hoverDocument); + return languageService.doHover(document, hoverParams.position, jsonAst); }); const jsonDocumentMapper = getLanguageModelCache(10, 60, (document) => diff --git a/libs/json-schema/src/lib/project-json-schema.ts b/libs/json-schema/src/lib/project-json-schema.ts index c8ba827b4d..4f49db6c7a 100644 --- a/libs/json-schema/src/lib/project-json-schema.ts +++ b/libs/json-schema/src/lib/project-json-schema.ts @@ -10,24 +10,16 @@ export function getProjectJsonSchema(collections: CollectionInfo[]) { function createJsonSchema(executors: JSONSchema[]): JSONSchema { return { - title: 'JSON schema for Nx projects', - id: 'https://nx.dev/project-schema', type: 'object', properties: { targets: { - description: - 'Configures all the targets which define what tasks you can run against the project', additionalProperties: { type: 'object', properties: { executor: { - description: - 'The function that Nx will invoke when you run this target', type: 'string', }, configurations: { - description: - 'provides extra sets of values that will be merged into the options map', additionalProperties: { type: 'object', }, From dfcd7ff0ff3668bcae8072e6b6059ee5d5449ea5 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 5 Aug 2022 12:04:54 -0400 Subject: [PATCH 21/27] move schema test --- libs/schema/jest.config.ts | 7 +++++++ libs/schema/project.json | 8 ++++++++ .../src/normalize-schema.spec.ts} | 10 +++++----- libs/schema/tsconfig.spec.json | 9 +++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 libs/schema/jest.config.ts rename libs/{utils/src/lib/utils/utils.spec.ts => schema/src/normalize-schema.spec.ts} (98%) create mode 100644 libs/schema/tsconfig.spec.json diff --git a/libs/schema/jest.config.ts b/libs/schema/jest.config.ts new file mode 100644 index 0000000000..ae91765cb0 --- /dev/null +++ b/libs/schema/jest.config.ts @@ -0,0 +1,7 @@ +export default { + coverageDirectory: '../../coverage/libs/schema', + globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' } }, + displayName: 'schema', + testEnvironment: 'node', + preset: '../../jest.preset.js', +}; diff --git a/libs/schema/project.json b/libs/schema/project.json index 1d305dad7d..1018ad3ca4 100644 --- a/libs/schema/project.json +++ b/libs/schema/project.json @@ -8,6 +8,14 @@ "options": { "lintFilePatterns": ["libs/schema/**/*.ts"] } + }, + "test": { + "executor": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/schema/jest.config.ts", + "passWithNoTests": true + }, + "outputs": ["coverage/libs/schema"] } }, "tags": [] diff --git a/libs/utils/src/lib/utils/utils.spec.ts b/libs/schema/src/normalize-schema.spec.ts similarity index 98% rename from libs/utils/src/lib/utils/utils.spec.ts rename to libs/schema/src/normalize-schema.spec.ts index 2f4379834e..ccb3511107 100644 --- a/libs/utils/src/lib/utils/utils.spec.ts +++ b/libs/schema/src/normalize-schema.spec.ts @@ -1,11 +1,11 @@ +import { Schema } from 'nx/src/utils/params'; import { LongFormXPrompt, - Option, - OptionType, OptionPropertyDescription, - normalizeSchema, -} from '@nx-console/schema'; -import { Schema } from 'nx/src/utils/params'; + OptionType, + Option, +} from './index'; +import { normalizeSchema } from './normalize-schema'; describe('utils', () => { describe('normalizeSchema', () => { diff --git a/libs/schema/tsconfig.spec.json b/libs/schema/tsconfig.spec.json new file mode 100644 index 0000000000..148da8555f --- /dev/null +++ b/libs/schema/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"] +} From cf234b4d0ad70042f6bad624f6fcbbfd6a16e79d Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Mon, 8 Aug 2022 18:18:27 -0400 Subject: [PATCH 22/27] make sure that the ls can be ran within the extension on prod builds --- apps/nxls/project.json | 39 +- apps/nxls/rollup.config.ts | 31 + apps/nxls/src/global-polyfills.ts | 7 + apps/nxls/src/main.ts | 3 +- apps/nxls/tsconfig.app.json | 2 +- apps/vscode-ui/project.json | 3 +- apps/vscode/project.json | 4 +- libs/schema/src/index.ts | 2 +- .../src/lib/configure-lsp-client.ts | 4 +- package.json | 7 + yarn.lock | 575 +++++++++++++++++- 11 files changed, 627 insertions(+), 50 deletions(-) create mode 100644 apps/nxls/rollup.config.ts create mode 100644 apps/nxls/src/global-polyfills.ts diff --git a/apps/nxls/project.json b/apps/nxls/project.json index 14469923c6..5259d2248d 100644 --- a/apps/nxls/project.json +++ b/apps/nxls/project.json @@ -1,5 +1,4 @@ { - "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/nxls/src", "projectType": "application", "targets": { @@ -14,40 +13,24 @@ "watch": true } }, - "build": { + "package": { "executor": "@nrwl/node:webpack", - "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/vscode/lsp", "main": "apps/nxls/src/main.ts", "tsConfig": "apps/nxls/tsconfig.app.json", - "assets": ["apps/nxls/src/assets", "apps/nxls/src/bin"] - }, - "configurations": { - "package": { - "outputPath": "dist/packages/nxls", - "generatePackageJson": true, - "externalDependencies": "all", - "optimization": true, - "extractLicenses": true - }, - "production": { - "optimization": true, - "extractLicenses": true, - "inspect": false, - "fileReplacements": [ - { - "replace": "apps/nxls/src/environments/environment.ts", - "with": "apps/nxls/src/environments/environment.prod.ts" - } - ] - } + "outputPath": "dist/packages/nxls", + "assets": ["apps/nxls/src/bin"], + "generatePackageJson": true, + "externalDependencies": "all", + "optimization": true, + "extractLicenses": true } }, - "serve": { - "executor": "@nrwl/node:node", + "build": { + "executor": "nx:run-commands", + "outputs": ["dist/apps/vscode/nxls"], "options": { - "buildTarget": "nxls:build" + "commands": ["yarn rollup -c ./apps/nxls/rollup.config.ts"] } }, "lint": { diff --git a/apps/nxls/rollup.config.ts b/apps/nxls/rollup.config.ts new file mode 100644 index 0000000000..c687308d47 --- /dev/null +++ b/apps/nxls/rollup.config.ts @@ -0,0 +1,31 @@ +import ts from '@rollup/plugin-typescript'; +import cjs from '@rollup/plugin-commonjs'; +import nodeResolve from '@rollup/plugin-node-resolve'; +import json from '@rollup/plugin-json'; +import replace from '@rollup/plugin-replace'; +import { terser } from 'rollup-plugin-terser'; +import { defineConfig } from 'rollup'; + +export default defineConfig({ + input: './apps/nxls/src/main.ts', + output: { + file: './dist/apps/vscode/nxls/main.js', + format: 'cjs', + plugins: [terser()], + }, + plugins: [ + replace({ + values: { + "'string_decoder/'": "'string_decoder'", + }, + delimiters: ['', ''], + preventAssignment: true, + }), + nodeResolve({ preferBuiltins: true, exportConditions: ['node'] }), + json(), + cjs(), + ts({ + tsconfig: './apps/nxls/tsconfig.app.json', + }), + ], +}); diff --git a/apps/nxls/src/global-polyfills.ts b/apps/nxls/src/global-polyfills.ts new file mode 100644 index 0000000000..5b6332a5dc --- /dev/null +++ b/apps/nxls/src/global-polyfills.ts @@ -0,0 +1,7 @@ +/* eslint-disable */ + +// needed for rollup builds because one of the dependent libraries have a non_webpack_require (essentially the nx package resolve util) +declare var __non_webpack_require__: typeof require; +if (!globalThis.__non_webpack_require__) { + globalThis.__non_webpack_require__ = require; +} diff --git a/apps/nxls/src/main.ts b/apps/nxls/src/main.ts index 67ed75a0b2..7ad0e55054 100644 --- a/apps/nxls/src/main.ts +++ b/apps/nxls/src/main.ts @@ -1,4 +1,5 @@ -#!/usr/bin/env node +import './global-polyfills'; + import { getExecutors } from '@nx-console/collections'; import { getProjectJsonSchema, diff --git a/apps/nxls/tsconfig.app.json b/apps/nxls/tsconfig.app.json index 0d16dce91b..908dff6b33 100644 --- a/apps/nxls/tsconfig.app.json +++ b/apps/nxls/tsconfig.app.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", - "module": "commonjs", + "module": "ESNext", "types": ["node"] }, "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], diff --git a/apps/vscode-ui/project.json b/apps/vscode-ui/project.json index 0382c0f4df..56e00a1367 100644 --- a/apps/vscode-ui/project.json +++ b/apps/vscode-ui/project.json @@ -37,7 +37,8 @@ "stylePreprocessorOptions": { "includePaths": ["libs/vscode-ui/styles/src/lib"] }, - "allowedCommonJsDependencies": ["zone.js"] + "allowedCommonJsDependencies": ["zone.js"], + "deleteOutputPath": false }, "configurations": { "production": { diff --git a/apps/vscode/project.json b/apps/vscode/project.json index b94617934a..08feb18832 100644 --- a/apps/vscode/project.json +++ b/apps/vscode/project.json @@ -76,7 +76,8 @@ "output": "/" } ], - "buildLibsFromSource": true + "buildLibsFromSource": true, + "deleteOutputPath": false }, "configurations": { "production": { @@ -110,7 +111,6 @@ }, "package": { "executor": "@nrwl/workspace:run-commands", - "dependsOn": ["build"], "options": { "commands": [ "yarn nx run vscode:build:production", diff --git a/libs/schema/src/index.ts b/libs/schema/src/index.ts index 97c6e6fce7..5c67c1d60d 100644 --- a/libs/schema/src/index.ts +++ b/libs/schema/src/index.ts @@ -114,4 +114,4 @@ export const WORKSPACE_GENERATOR_NAME_REGEX = export type WorkspaceProjects = ProjectsConfigurations['projects']; -export { Store } from './store'; +export type { Store } from './store'; diff --git a/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts b/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts index 0fc730957f..6a029dbe2f 100644 --- a/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts +++ b/libs/vscode/lsp-client/src/lib/configure-lsp-client.ts @@ -44,8 +44,8 @@ export async function configureLspClient( }; client = new LanguageClient( - 'NxConsole', - 'Nx Console', + 'NxConsoleClient', + 'Nx Console Client', serverOptions, clientOptions ); diff --git a/package.json b/package.json index af18f44e85..1edb1db7ca 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,11 @@ "@nrwl/nx-cloud": "14.2.0", "@nrwl/storybook": "14.4.1", "@nrwl/workspace": "14.4.1", + "@rollup/plugin-commonjs": "^22.0.2", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.3.0", + "@rollup/plugin-replace": "^4.0.0", + "@rollup/plugin-typescript": "^8.3.4", "@storybook/addon-essentials": "6.5.9", "@storybook/addon-knobs": "~6.4.0", "@storybook/angular": "6.5.9", @@ -79,6 +84,8 @@ "ovsx": "^0.3.0", "prettier": "2.7.1", "rimraf": "^3.0.2", + "rollup": "^2.77.2", + "rollup-plugin-terser": "^7.0.2", "rxjs": "~7.5.5", "standard-version": "^9.1.1", "ts-jest": "27.1.4", diff --git a/yarn.lock b/yarn.lock index 63bbdd34dc..84713bb37e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -103,6 +103,18 @@ "@angular-devkit/architect" "0.1400.2" rxjs "6.6.7" +"@angular-devkit/core@13.3.9": + version "13.3.9" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-13.3.9.tgz#71a662feb2c3f6f79a1f27db31cb2f7021195c77" + integrity sha512-XqCuIWyoqIsLABjV3GQL/+EiBCt3xVPPtNp3Mg4gjBsDLW7PEnvbb81yGkiZQmIsq4EIyQC/6fQa3VdjsCshGg== + dependencies: + ajv "8.9.0" + ajv-formats "2.1.1" + fast-json-stable-stringify "2.1.0" + magic-string "0.25.7" + rxjs "6.6.7" + source-map "0.7.3" + "@angular-devkit/core@14.0.2": version "14.0.2" resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.0.2.tgz#47f62a57cf36a2e102188a89ae00f5e5a05d837d" @@ -125,6 +137,17 @@ ora "5.4.1" rxjs "6.6.7" +"@angular-devkit/schematics@^13.2.5": + version "13.3.9" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-13.3.9.tgz#72df522e1737fb727359e60e4d7df0fd8310b2e8" + integrity sha512-oNHLNtwbtEJ0dYPPXy1NpfRdSiFsYBl7+ozJklLgNV/AEOxlSi2qlVx6DoxNVjz5XgQ7Z+eoVDMw7ewGPnGSyA== + dependencies: + "@angular-devkit/core" "13.3.9" + jsonc-parser "3.0.0" + magic-string "0.25.7" + ora "5.4.1" + rxjs "6.6.7" + "@angular-eslint/bundled-angular-compiler@14.0.0": version "14.0.0" resolved "https://registry.yarnpkg.com/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-14.0.0.tgz#82147b128e2a90bada7832f9098778bf80ffbf2d" @@ -3354,6 +3377,11 @@ resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-2.0.1.tgz#b6b8d81780b9a9f6459f4bfe9226ac6aefaefe87" integrity sha512-aG20vknL4/YjQF9BSV7ts4EWm/yrjagAN7OWBNmlbEOUiu0llj4OGrFoOKK3g2vey4/p2omKCoHrWtPxSwV3HA== +"@cush/relative@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@cush/relative/-/relative-1.0.0.tgz#8cd1769bf9bde3bb27dac356b1bc94af40f6cc16" + integrity sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA== + "@cypress/listr-verbose-renderer@^0.4.1": version "0.4.1" resolved "https://registry.yarnpkg.com/@cypress/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#a77492f4b11dcc7c446a34b3e28721afd33c642a" @@ -3494,6 +3522,16 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== +"@esbuild/linux-loong64@0.14.53": + version "0.14.53" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.53.tgz#251b4cd6760fadb4d68a05815e6dc5e432d69cd6" + integrity sha512-W2dAL6Bnyn4xa/QRSU3ilIK4EzD5wgYXKXJiS1HDF5vU3675qc2bvFyLwbUcdmssDveyndy7FbitrCoiV/eMLg== + +"@esbuild/linux-loong64@0.14.54": + version "0.14.54" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" + integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== + "@eslint/eslintrc@^1.2.3": version "1.3.0" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f" @@ -3805,6 +3843,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea" integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.11" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec" @@ -4303,6 +4349,19 @@ magic-string "^0.25.7" resolve "^1.17.0" +"@rollup/plugin-commonjs@^22.0.2": + version "22.0.2" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.2.tgz#ee8ca8415cda30d383b4096aad5222435b4b69b6" + integrity sha512-//NdP6iIwPbMTcazYsiBMbJW7gfmpHom33u1beiIoHDEM0Q9clvtQB1T0efvMqHeKsGohiHo97BCPCkBXdscwg== + dependencies: + "@rollup/pluginutils" "^3.1.0" + commondir "^1.0.1" + estree-walker "^2.0.1" + glob "^7.1.6" + is-reference "^1.2.1" + magic-string "^0.25.7" + resolve "^1.17.0" + "@rollup/plugin-image@^2.1.0": version "2.1.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-image/-/plugin-image-2.1.1.tgz#898d6b59ac0025d7971ef45640ab330cb0663b0c" @@ -4318,7 +4377,7 @@ dependencies: "@rollup/pluginutils" "^3.0.8" -"@rollup/plugin-node-resolve@^13.0.4": +"@rollup/plugin-node-resolve@^13.0.4", "@rollup/plugin-node-resolve@^13.3.0": version "13.3.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz#da1c5c5ce8316cef96a2f823d111c1e4e498801c" integrity sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw== @@ -4330,6 +4389,22 @@ is-module "^1.0.0" resolve "^1.19.0" +"@rollup/plugin-replace@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-4.0.0.tgz#e34c457d6a285f0213359740b43f39d969b38a67" + integrity sha512-+rumQFiaNac9y64OHtkHGmdjm7us9bo1PlbgQfdihQtuNxzjpaB064HbRnewUOggLQxVCCyINfStkgmBeQpv1g== + dependencies: + "@rollup/pluginutils" "^3.1.0" + magic-string "^0.25.7" + +"@rollup/plugin-typescript@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.3.4.tgz#45cdc0787b658b37d0362c705d8de86bc8bc040e" + integrity sha512-wt7JnYE9antX6BOXtsxGoeVSu4dZfw0dU3xykfOQ4hC3EddxRbVG/K0xiY1Wup7QOHJcjLYXWAn0Kx9Z1SBHHg== + dependencies: + "@rollup/pluginutils" "^3.1.0" + resolve "^1.17.0" + "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -6615,6 +6690,16 @@ ajv@8.11.0: require-from-string "^2.0.2" uri-js "^4.2.2" +ajv@8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.9.0.tgz#738019146638824dea25edcf299dcba1b0e7eb18" + integrity sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.2, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -8446,6 +8531,11 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== +consola@^2.15.3: + version "2.15.3" + resolved "https://registry.yarnpkg.com/consola/-/consola-2.15.3.tgz#2e11f98d6a4be71ff72e0bdf07bd23e12cb61550" + integrity sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw== + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -9457,7 +9547,7 @@ detect-libc@^1.0.3: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -detect-newline@^3.0.0, detect-newline@^3.1.0: +detect-newline@3.1.0, detect-newline@^3.0.0, detect-newline@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== @@ -9869,6 +9959,11 @@ entities@~2.0.0: resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== +envinfo@^7.8.1: + version "7.8.1" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" + integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== + errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -9980,6 +10075,16 @@ esbuild-android-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.38.tgz#5b94a1306df31d55055f64a62ff6b763a47b7f64" integrity sha512-aRFxR3scRKkbmNuGAK+Gee3+yFxkTJO/cx83Dkyzo4CnQl/2zVSurtG6+G86EQIZ+w+VYngVyK7P3HyTBKu3nw== +esbuild-android-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.53.tgz#259bc3ef1399a3cad8f4f67c40ee20779c4de675" + integrity sha512-fIL93sOTnEU+NrTAVMIKiAw0YH22HWCAgg4N4Z6zov2t0kY9RAJ50zY9ZMCQ+RT6bnOfDt8gCTnt/RaSNA2yRA== + +esbuild-android-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" + integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== + esbuild-android-arm64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.11.tgz#b8b34e35a5b43880664ac7a3fbc70243d7ed894f" @@ -9990,6 +10095,16 @@ esbuild-android-arm64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.38.tgz#78acc80773d16007de5219ccce544c036abd50b8" integrity sha512-L2NgQRWuHFI89IIZIlpAcINy9FvBk6xFVZ7xGdOwIm8VyhX1vNCEqUJO3DPSSy945Gzdg98cxtNt8Grv1CsyhA== +esbuild-android-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.53.tgz#2158253d4e8f9fdd2a081bbb4f73b8806178841e" + integrity sha512-PC7KaF1v0h/nWpvlU1UMN7dzB54cBH8qSsm7S9mkwFA1BXpaEOufCg8hdoEI1jep0KeO/rjZVWrsH8+q28T77A== + +esbuild-android-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" + integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== + esbuild-darwin-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.11.tgz#ba805de98c0412e50fcd0636451797da157b0625" @@ -10000,6 +10115,16 @@ esbuild-darwin-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.38.tgz#e02b1291f629ebdc2aa46fabfacc9aa28ff6aa46" integrity sha512-5JJvgXkX87Pd1Og0u/NJuO7TSqAikAcQQ74gyJ87bqWRVeouky84ICoV4sN6VV53aTW+NE87qLdGY4QA2S7KNA== +esbuild-darwin-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.53.tgz#b4681831fd8f8d06feb5048acbe90d742074cc2a" + integrity sha512-gE7P5wlnkX4d4PKvLBUgmhZXvL7lzGRLri17/+CmmCzfncIgq8lOBvxGMiQ4xazplhxq+72TEohyFMZLFxuWvg== + +esbuild-darwin-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" + integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== + esbuild-darwin-arm64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.11.tgz#4d3573e448af76ce33e16231f3d9f878542d6fe8" @@ -10010,6 +10135,16 @@ esbuild-darwin-arm64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.38.tgz#01eb6650ec010b18c990e443a6abcca1d71290a9" integrity sha512-eqF+OejMI3mC5Dlo9Kdq/Ilbki9sQBw3QlHW3wjLmsLh+quNfHmGMp3Ly1eWm981iGBMdbtSS9+LRvR2T8B3eQ== +esbuild-darwin-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.53.tgz#d267d957852d121b261b3f76ead86e5b5463acc9" + integrity sha512-otJwDU3hnI15Q98PX4MJbknSZ/WSR1I45il7gcxcECXzfN4Mrpft5hBDHXNRnCh+5858uPXBXA1Vaz2jVWLaIA== + +esbuild-darwin-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" + integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== + esbuild-freebsd-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.11.tgz#9294e6ab359ec93590ab097b0f2017de7c78ab4d" @@ -10020,6 +10155,16 @@ esbuild-freebsd-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.38.tgz#790b8786729d4aac7be17648f9ea8e0e16475b5e" integrity sha512-epnPbhZUt93xV5cgeY36ZxPXDsQeO55DppzsIgWM8vgiG/Rz+qYDLmh5ts3e+Ln1wA9dQ+nZmVHw+RjaW3I5Ig== +esbuild-freebsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.53.tgz#aca2af6d72b537fe66a38eb8f374fb66d4c98ca0" + integrity sha512-WkdJa8iyrGHyKiPF4lk0MiOF87Q2SkE+i+8D4Cazq3/iqmGPJ6u49je300MFi5I2eUsQCkaOWhpCVQMTKGww2w== + +esbuild-freebsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" + integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== + esbuild-freebsd-arm64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.11.tgz#ae3e0b09173350b66cf8321583c9a1c1fcb8bb55" @@ -10030,6 +10175,16 @@ esbuild-freebsd-arm64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.38.tgz#b66340ab28c09c1098e6d9d8ff656db47d7211e6" integrity sha512-/9icXUYJWherhk+y5fjPI5yNUdFPtXHQlwP7/K/zg8t8lQdHVj20SqU9/udQmeUo5pDFHMYzcEFfJqgOVeKNNQ== +esbuild-freebsd-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.53.tgz#76282e19312d914c34343c8a7da6cc5f051580b9" + integrity sha512-9T7WwCuV30NAx0SyQpw8edbKvbKELnnm1FHg7gbSYaatH+c8WJW10g/OdM7JYnv7qkimw2ZTtSA+NokOLd2ydQ== + +esbuild-freebsd-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" + integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== + esbuild-linux-32@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.11.tgz#ddadbc7038aa5a6b1675bb1503cf79a0cbf1229a" @@ -10040,6 +10195,16 @@ esbuild-linux-32@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.38.tgz#7927f950986fd39f0ff319e92839455912b67f70" integrity sha512-QfgfeNHRFvr2XeHFzP8kOZVnal3QvST3A0cgq32ZrHjSMFTdgXhMhmWdKzRXP/PKcfv3e2OW9tT9PpcjNvaq6g== +esbuild-linux-32@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.53.tgz#1045d34cf7c5faaf2af3b29cc1573b06580c37e5" + integrity sha512-VGanLBg5en2LfGDgLEUxQko2lqsOS7MTEWUi8x91YmsHNyzJVT/WApbFFx3MQGhkf+XdimVhpyo5/G0PBY91zg== + +esbuild-linux-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" + integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== + esbuild-linux-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.11.tgz#d698e3ce3a231ddfeec6b5df8c546ae8883fcd88" @@ -10050,6 +10215,16 @@ esbuild-linux-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.38.tgz#4893d07b229d9cfe34a2b3ce586399e73c3ac519" integrity sha512-uuZHNmqcs+Bj1qiW9k/HZU3FtIHmYiuxZ/6Aa+/KHb/pFKr7R3aVqvxlAudYI9Fw3St0VCPfv7QBpUITSmBR1Q== +esbuild-linux-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.53.tgz#ab3f2ee2ebb5a6930c72d9539cb34b428808cbe4" + integrity sha512-pP/FA55j/fzAV7N9DF31meAyjOH6Bjuo3aSKPh26+RW85ZEtbJv9nhoxmGTd9FOqjx59Tc1ZbrJabuiXlMwuZQ== + +esbuild-linux-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" + integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== + esbuild-linux-arm64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.11.tgz#85faea9fa99ad355b5e3b283197a4dfd0a110fe7" @@ -10060,6 +10235,16 @@ esbuild-linux-arm64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.38.tgz#8442402e37d0b8ae946ac616784d9c1a2041056a" integrity sha512-HlMGZTEsBrXrivr64eZ/EO0NQM8H8DuSENRok9d+Jtvq8hOLzrxfsAT9U94K3KOGk2XgCmkaI2KD8hX7F97lvA== +esbuild-linux-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.53.tgz#1f5530412f6690949e78297122350488d3266cfe" + integrity sha512-GDmWITT+PMsjCA6/lByYk7NyFssW4Q6in32iPkpjZ/ytSyH+xeEx8q7HG3AhWH6heemEYEWpTll/eui3jwlSnw== + +esbuild-linux-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" + integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== + esbuild-linux-arm@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.11.tgz#74cbcf0b8a22c8401bcbcd6ebd4cbf2baca8b7b4" @@ -10070,6 +10255,16 @@ esbuild-linux-arm@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.38.tgz#d5dbf32d38b7f79be0ec6b5fb2f9251fd9066986" integrity sha512-FiFvQe8J3VKTDXG01JbvoVRXQ0x6UZwyrU4IaLBZeq39Bsbatd94Fuc3F1RGqPF5RbIWW7RvkVQjn79ejzysnA== +esbuild-linux-arm@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.53.tgz#a44ec9b5b42007ab6c0d65a224ccc6bbd97c54cf" + integrity sha512-/u81NGAVZMopbmzd21Nu/wvnKQK3pT4CrvQ8BTje1STXcQAGnfyKgQlj3m0j2BzYbvQxSy+TMck4TNV2onvoPA== + +esbuild-linux-arm@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" + integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== + esbuild-linux-mips64le@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.11.tgz#490429211a3233f5cbbd8575b7758b897e42979a" @@ -10080,6 +10275,16 @@ esbuild-linux-mips64le@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.38.tgz#95081e42f698bbe35d8ccee0e3a237594b337eb5" integrity sha512-qd1dLf2v7QBiI5wwfil9j0HG/5YMFBAmMVmdeokbNAMbcg49p25t6IlJFXAeLzogv1AvgaXRXvgFNhScYEUXGQ== +esbuild-linux-mips64le@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.53.tgz#a4d0b6b17cfdeea4e41b0b085a5f73d99311be9f" + integrity sha512-d6/XHIQW714gSSp6tOOX2UscedVobELvQlPMkInhx1NPz4ThZI9uNLQ4qQJHGBGKGfu+rtJsxM4NVHLhnNRdWQ== + +esbuild-linux-mips64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" + integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== + esbuild-linux-ppc64le@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.11.tgz#fc79d60710213b5b98345f5b138d48245616827a" @@ -10090,11 +10295,31 @@ esbuild-linux-ppc64le@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.38.tgz#dceb0a1b186f5df679618882a7990bd422089b47" integrity sha512-mnbEm7o69gTl60jSuK+nn+pRsRHGtDPfzhrqEUXyCl7CTOCLtWN2bhK8bgsdp6J/2NyS/wHBjs1x8aBWwP2X9Q== +esbuild-linux-ppc64le@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.53.tgz#8c331822c85465434e086e3e6065863770c38139" + integrity sha512-ndnJmniKPCB52m+r6BtHHLAOXw+xBCWIxNnedbIpuREOcbSU/AlyM/2dA3BmUQhsHdb4w3amD5U2s91TJ3MzzA== + +esbuild-linux-ppc64le@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" + integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== + esbuild-linux-riscv64@0.14.38: version "0.14.38" resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.38.tgz#61fb8edb75f475f9208c4a93ab2bfab63821afd2" integrity sha512-+p6YKYbuV72uikChRk14FSyNJZ4WfYkffj6Af0/Tw63/6TJX6TnIKE+6D3xtEc7DeDth1fjUOEqm+ApKFXbbVQ== +esbuild-linux-riscv64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.53.tgz#36fd75543401304bea8a2d63bf8ea18aaa508e00" + integrity sha512-yG2sVH+QSix6ct4lIzJj329iJF3MhloLE6/vKMQAAd26UVPVkhMFqFopY+9kCgYsdeWvXdPgmyOuKa48Y7+/EQ== + +esbuild-linux-riscv64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" + integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== + esbuild-linux-s390x@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.11.tgz#ca4b93556bbba6cc95b0644f2ee93c982165ba07" @@ -10105,6 +10330,16 @@ esbuild-linux-s390x@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.38.tgz#34c7126a4937406bf6a5e69100185fd702d12fe0" integrity sha512-0zUsiDkGJiMHxBQ7JDU8jbaanUY975CdOW1YDrurjrM0vWHfjv9tLQsW9GSyEb/heSK1L5gaweRjzfUVBFoybQ== +esbuild-linux-s390x@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.53.tgz#1622677ab6824123f48f75d3afc031cd41936129" + integrity sha512-OCJlgdkB+XPYndHmw6uZT7jcYgzmx9K+28PVdOa/eLjdoYkeAFvH5hTwX4AXGLZLH09tpl4bVsEtvuyUldaNCg== + +esbuild-linux-s390x@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" + integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== + esbuild-netbsd-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.11.tgz#edb340bc6653c88804cac2253e21b74258fce165" @@ -10115,6 +10350,16 @@ esbuild-netbsd-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.38.tgz#322ea9937d9e529183ee281c7996b93eb38a5d95" integrity sha512-cljBAApVwkpnJZfnRVThpRBGzCi+a+V9Ofb1fVkKhtrPLDYlHLrSYGtmnoTVWDQdU516qYI8+wOgcGZ4XIZh0Q== +esbuild-netbsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.53.tgz#e86d0efd0116658be335492ed12e66b26b4baf52" + integrity sha512-gp2SB+Efc7MhMdWV2+pmIs/Ja/Mi5rjw+wlDmmbIn68VGXBleNgiEZG+eV2SRS0kJEUyHNedDtwRIMzaohWedQ== + +esbuild-netbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" + integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== + esbuild-openbsd-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.11.tgz#caeff5f946f79a60ce7bcf88871ca4c71d3476e8" @@ -10125,6 +10370,16 @@ esbuild-openbsd-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.38.tgz#1ca29bb7a2bf09592dcc26afdb45108f08a2cdbd" integrity sha512-CDswYr2PWPGEPpLDUO50mL3WO/07EMjnZDNKpmaxUPsrW+kVM3LoAqr/CE8UbzugpEiflYqJsGPLirThRB18IQ== +esbuild-openbsd-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.53.tgz#9bcbbe6f86304872c6e91f64c8eb73fc29c3588b" + integrity sha512-eKQ30ZWe+WTZmteDYg8S+YjHV5s4iTxeSGhJKJajFfQx9TLZJvsJX0/paqwP51GicOUruFpSUAs2NCc0a4ivQQ== + +esbuild-openbsd-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" + integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== + esbuild-sunos-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.11.tgz#90ce7e1749c2958a53509b4bae7b8f7d98f276d6" @@ -10135,6 +10390,16 @@ esbuild-sunos-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.38.tgz#c9446f7d8ebf45093e7bb0e7045506a88540019b" integrity sha512-2mfIoYW58gKcC3bck0j7lD3RZkqYA7MmujFYmSn9l6TiIcAMpuEvqksO+ntBgbLep/eyjpgdplF7b+4T9VJGOA== +esbuild-sunos-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.53.tgz#f7a872f7460bfb7b131f7188a95fbce3d1c577e8" + integrity sha512-OWLpS7a2FrIRukQqcgQqR1XKn0jSJoOdT+RlhAxUoEQM/IpytS3FXzCJM6xjUYtpO5GMY0EdZJp+ur2pYdm39g== + +esbuild-sunos-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" + integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== + esbuild-wasm@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-wasm/-/esbuild-wasm-0.14.11.tgz#bd09f4c42969cddcae39007d284f8ef747aae85d" @@ -10155,6 +10420,16 @@ esbuild-windows-32@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.38.tgz#f8e9b4602fd0ccbd48e5c8d117ec0ba4040f2ad1" integrity sha512-L2BmEeFZATAvU+FJzJiRLFUP+d9RHN+QXpgaOrs2klshoAm1AE6Us4X6fS9k33Uy5SzScn2TpcgecbqJza1Hjw== +esbuild-windows-32@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.53.tgz#c5e3ca50e2d1439cc2c9fe4defa63bcd474ce709" + integrity sha512-m14XyWQP5rwGW0tbEfp95U6A0wY0DYPInWBB7D69FAXUpBpBObRoGTKRv36lf2RWOdE4YO3TNvj37zhXjVL5xg== + +esbuild-windows-32@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" + integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== + esbuild-windows-64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.11.tgz#13e86dd37a6cd61a5276fa2d271342d0f74da864" @@ -10165,6 +10440,16 @@ esbuild-windows-64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.38.tgz#280f58e69f78535f470905ce3e43db1746518107" integrity sha512-Khy4wVmebnzue8aeSXLC+6clo/hRYeNIm0DyikoEqX+3w3rcvrhzpoix0S+MF9vzh6JFskkIGD7Zx47ODJNyCw== +esbuild-windows-64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.53.tgz#ec2ab4a60c5215f092ffe1eab6d01319e88238af" + integrity sha512-s9skQFF0I7zqnQ2K8S1xdLSfZFsPLuOGmSx57h2btSEswv0N0YodYvqLcJMrNMXh6EynOmWD7rz+0rWWbFpIHQ== + +esbuild-windows-64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" + integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== + esbuild-windows-arm64@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.11.tgz#e8edfdf1d712085e6dc3fba18a0c225aaae32b75" @@ -10175,6 +10460,16 @@ esbuild-windows-arm64@0.14.38: resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.38.tgz#d97e9ac0f95a4c236d9173fa9f86c983d6a53f54" integrity sha512-k3FGCNmHBkqdJXuJszdWciAH77PukEyDsdIryEHn9cKLQFxzhT39dSumeTuggaQcXY57UlmLGIkklWZo2qzHpw== +esbuild-windows-arm64@0.14.53: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.53.tgz#f71d403806bdf9f4a1f9d097db9aec949bd675c8" + integrity sha512-E+5Gvb+ZWts+00T9II6wp2L3KG2r3iGxByqd/a1RmLmYWVsSVUjkvIxZuJ3hYTIbhLkH5PRwpldGTKYqVz0nzQ== + +esbuild-windows-arm64@0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" + integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== + esbuild@0.14.11: version "0.14.11" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.11.tgz#ac4acb78907874832afb704c3afe58ad37715c27" @@ -10225,6 +10520,60 @@ esbuild@0.14.38: esbuild-windows-64 "0.14.38" esbuild-windows-arm64 "0.14.38" +esbuild@^0.14.47: + version "0.14.53" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.53.tgz#20b1007f686e8584f2a01a1bec5a37aac9498ce4" + integrity sha512-ohO33pUBQ64q6mmheX1mZ8mIXj8ivQY/L4oVuAshr+aJI+zLl+amrp3EodrUNDNYVrKJXGPfIHFGhO8slGRjuw== + optionalDependencies: + "@esbuild/linux-loong64" "0.14.53" + esbuild-android-64 "0.14.53" + esbuild-android-arm64 "0.14.53" + esbuild-darwin-64 "0.14.53" + esbuild-darwin-arm64 "0.14.53" + esbuild-freebsd-64 "0.14.53" + esbuild-freebsd-arm64 "0.14.53" + esbuild-linux-32 "0.14.53" + esbuild-linux-64 "0.14.53" + esbuild-linux-arm "0.14.53" + esbuild-linux-arm64 "0.14.53" + esbuild-linux-mips64le "0.14.53" + esbuild-linux-ppc64le "0.14.53" + esbuild-linux-riscv64 "0.14.53" + esbuild-linux-s390x "0.14.53" + esbuild-netbsd-64 "0.14.53" + esbuild-openbsd-64 "0.14.53" + esbuild-sunos-64 "0.14.53" + esbuild-windows-32 "0.14.53" + esbuild-windows-64 "0.14.53" + esbuild-windows-arm64 "0.14.53" + +esbuild@^0.14.54: + version "0.14.54" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" + integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== + optionalDependencies: + "@esbuild/linux-loong64" "0.14.54" + esbuild-android-64 "0.14.54" + esbuild-android-arm64 "0.14.54" + esbuild-darwin-64 "0.14.54" + esbuild-darwin-arm64 "0.14.54" + esbuild-freebsd-64 "0.14.54" + esbuild-freebsd-arm64 "0.14.54" + esbuild-linux-32 "0.14.54" + esbuild-linux-64 "0.14.54" + esbuild-linux-arm "0.14.54" + esbuild-linux-arm64 "0.14.54" + esbuild-linux-mips64le "0.14.54" + esbuild-linux-ppc64le "0.14.54" + esbuild-linux-riscv64 "0.14.54" + esbuild-linux-s390x "0.14.54" + esbuild-netbsd-64 "0.14.54" + esbuild-openbsd-64 "0.14.54" + esbuild-sunos-64 "0.14.54" + esbuild-windows-32 "0.14.54" + esbuild-windows-64 "0.14.54" + esbuild-windows-arm64 "0.14.54" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -10725,7 +11074,7 @@ fast-glob@^3.1.1: micromatch "^4.0.2" picomatch "^2.2.1" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.1.0, fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -11147,7 +11496,7 @@ fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^9.0.0, fs-extra@^9.0.1: +fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -11336,6 +11685,11 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +git-hooks-list@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156" + integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ== + git-raw-commits@^2.0.8: version "2.0.10" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.10.tgz#e2255ed9563b1c9c3ea6bd05806410290297bbc1" @@ -11425,6 +11779,11 @@ glob-promise@^3.4.0: dependencies: "@types/glob" "*" +glob-regex@^0.3.0: + version "0.3.2" + resolved "https://registry.yarnpkg.com/glob-regex/-/glob-regex-0.3.2.tgz#27348f2f60648ec32a4a53137090b9fb934f3425" + integrity sha512-m5blUd3/OqDTWwzBBtWBPrGlAzatRywHameHeekAZyZrskYouOGdNB8T/q6JucucvJXtOuyHIn0/Yia7iDasDw== + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" @@ -11523,6 +11882,20 @@ globalthis@^1.0.0: dependencies: define-properties "^1.1.3" +globby@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.0.tgz#abfcd0630037ae174a88590132c2f6804e291072" + integrity sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw== + dependencies: + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" + globby@10.0.1: version "10.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" @@ -11587,6 +11960,11 @@ globby@^9.2.0: pify "^4.0.1" slash "^2.0.0" +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4: version "4.2.6" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" @@ -12433,6 +12811,13 @@ is-core-module@^2.2.0: dependencies: has "^1.0.3" +is-core-module@^2.9.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" + integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -12630,16 +13015,16 @@ is-path-inside@^3.0.1: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== +is-plain-obj@2.1.0, is-plain-obj@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= -is-plain-obj@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - is-plain-obj@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" @@ -13402,7 +13787,7 @@ jest-watcher@^27.5.1: jest-util "^27.5.1" string-length "^4.0.1" -jest-worker@^26.5.0, jest-worker@^26.6.2: +jest-worker@^26.2.1, jest-worker@^26.5.0, jest-worker@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== @@ -14046,6 +14431,13 @@ lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.10.1.tgz#db577f42a94c168f676b638d15da8fb073448cab" integrity sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A== +magic-string@0.25.7: + version "0.25.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== + dependencies: + sourcemap-codec "^1.4.4" + magic-string@0.26.1, magic-string@^0.26.0: version "0.26.1" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.1.tgz#ba9b651354fa9512474199acecf9c6dbe93f97fd" @@ -14520,6 +14912,11 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1. resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimist@^1.2.6: + version "1.2.6" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== + minipass-collect@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/minipass-collect/-/minipass-collect-1.0.2.tgz#22b813bf745dc6edba2576b940022ad6edc8c617" @@ -14995,6 +15392,38 @@ nwsapi@^2.2.0: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== +nx-plugin-devkit@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/nx-plugin-devkit/-/nx-plugin-devkit-1.3.1.tgz#bf6db10dca297943f4014d7c19bfcb3de7a64807" + integrity sha512-HV++hUDaeShTve9ympUuemxFhV1u/MvLDMUG3rJBcSGO2mbkhdfFZTeHL11+dKou/xMITZgbH37Mcf6PWoIiAQ== + dependencies: + chalk "^4.1.2" + consola "^2.15.3" + dotenv "~10.0.0" + envinfo "^7.8.1" + execa "^5.1.1" + fs-extra "^9.1.0" + glob "^7.1.6" + jsonc-parser "^3.0.0" + prettier "^2.3.1" + rxjs "6.6.7" + sort-package-json "^1.50.0" + yargs-parser "^20.2.7" + +nx-plugin-vite@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/nx-plugin-vite/-/nx-plugin-vite-2.2.1.tgz#c02dd28d58cb5a65e50d4572ab69dcc7c0b2b841" + integrity sha512-yK43i3jWHoKgOkWlnikoKZQNzpa00NcTNvMp/UPlDieY9Aux7Vml+M7lavO760E0qlLkjEH61znyFnHWBF4/Fw== + dependencies: + "@angular-devkit/schematics" "^13.2.5" + chalk "^4.1.2" + consola "^2.15.3" + dotenv "~10.0.0" + execa "^5.1.1" + nx-plugin-devkit "^1.3.1" + rxjs "6.6.7" + rxjs-for-await "^0.0.2" + nx@14.4.1: version "14.4.1" resolved "https://registry.yarnpkg.com/nx/-/nx-14.4.1.tgz#80495deafd6bc558a2db2acd0140597bfe1d9587" @@ -15606,6 +16035,11 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + path-strip-sep@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/path-strip-sep/-/path-strip-sep-1.0.12.tgz#e395568764c3a21eb7e879d7573a6eb4619e8bcf" @@ -16429,6 +16863,15 @@ postcss@^8.3.7: picocolors "^1.0.0" source-map-js "^0.6.2" +postcss@^8.4.14: + version "8.4.16" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c" + integrity sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ== + dependencies: + nanoid "^3.3.4" + picocolors "^1.0.0" + source-map-js "^1.0.2" + prebuild-install@^6.0.0: version "6.1.4" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-6.1.4.tgz#ae3c0142ad611d58570b89af4986088a4937e00f" @@ -16458,7 +16901,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@2.7.1: +prettier@2.7.1, prettier@^2.3.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== @@ -17005,6 +17448,16 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" +recrawl-sync@^2.0.3: + version "2.2.2" + resolved "https://registry.yarnpkg.com/recrawl-sync/-/recrawl-sync-2.2.2.tgz#a5a8664c77267d603d601825af544d6716d69e15" + integrity sha512-E2sI4F25Fu2nrfV+KsnC7/qfk/spQIYXlonfQoS4rwxeNK5BjxnLPbWiRXHVXPwYBOTWtPX5765kTm/zJiL+LQ== + dependencies: + "@cush/relative" "^1.0.0" + glob-regex "^0.3.0" + slash "^3.0.0" + tslib "^1.9.3" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -17342,6 +17795,15 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14. is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^1.22.1: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + dependencies: + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -17438,6 +17900,16 @@ rollup-plugin-postcss@^4.0.1: safe-identifier "^0.4.2" style-inject "^0.3.0" +rollup-plugin-terser@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" + integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== + dependencies: + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" + rollup-plugin-typescript2@^0.31.1: version "0.31.2" resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.31.2.tgz#463aa713a7e2bf85b92860094b9f7fb274c5a4d8" @@ -17464,6 +17936,13 @@ rollup@^2.56.2: optionalDependencies: fsevents "~2.3.2" +rollup@^2.75.6, rollup@^2.77.2: + version "2.77.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.77.2.tgz#6b6075c55f9cc2040a5912e6e062151e42e2c4e3" + integrity sha512-m/4YzYgLcpMQbxX3NmAqDvwLATZzxt8bIegO78FZLl+lAgKJBd1DRAOeEiZcKOIOPjxE6ewHWHNgGEalFXuz1g== + optionalDependencies: + fsevents "~2.3.2" + rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -17488,7 +17967,7 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs-for-await@0.0.2: +rxjs-for-await@0.0.2, rxjs-for-await@^0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/rxjs-for-await/-/rxjs-for-await-0.0.2.tgz#26598a1d6167147cc192172970e7eed4e620384b" integrity sha512-IJ8R/ZCFMHOcDIqoABs82jal00VrZx8Xkgfe7TOKoaRPAW5nH/VFlG23bXpeGdrmtqI9UobFPgUKgCuFc7Lncw== @@ -18013,6 +18492,23 @@ sockjs@^0.3.24: uuid "^8.3.2" websocket-driver "^0.7.4" +sort-object-keys@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" + integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg== + +sort-package-json@^1.50.0: + version "1.57.0" + resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.57.0.tgz#e95fb44af8ede0bb6147e3f39258102d4bb23fc4" + integrity sha512-FYsjYn2dHTRb41wqnv+uEqCUvBpK3jZcTp9rbz2qDTmel7Pmdtf+i2rLaaPMRZeSVM60V3Se31GyWFpmKs4Q5Q== + dependencies: + detect-indent "^6.0.0" + detect-newline "3.1.0" + git-hooks-list "1.0.3" + globby "10.0.0" + is-plain-obj "2.1.0" + sort-object-keys "^1.1.3" + source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" @@ -18099,7 +18595,7 @@ source-map@~0.8.0-beta.0: dependencies: whatwg-url "^7.0.0" -sourcemap-codec@^1.4.8: +sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8: version "1.4.8" resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== @@ -18644,6 +19140,11 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + svgo@^2.7.0: version "2.8.0" resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.8.0.tgz#4ff80cce6710dc2795f0c7c74101e6764cfccd24" @@ -18831,6 +19332,16 @@ terser@^4.1.2, terser@^4.6.3: source-map "~0.6.1" source-map-support "~0.5.12" +terser@^5.0.0: + version "5.14.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.14.2.tgz#9ac9f22b06994d736174f4091aa368db896f1c10" + integrity sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA== + dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" + commander "^2.20.0" + source-map-support "~0.5.20" + terser@^5.3.4, terser@^5.7.0: version "5.7.1" resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.1.tgz#2dc7a61009b66bb638305cb2a824763b116bf784" @@ -19170,12 +19681,21 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" +tsconfig-paths@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.1.0.tgz#f8ef7d467f08ae3a695335bf1ece088c5538d2c1" + integrity sha512-AHx4Euop/dXFC+Vx589alFba8QItjF+8hf8LtmuiCwHyI4rHXQtOOENaM8kvYf5fR0dRChy3wzWIZ9WbB7FWow== + dependencies: + json5 "^2.2.1" + minimist "^1.2.6" + strip-bom "^3.0.0" + tslib@2.4.0, tslib@^2, tslib@^2.1.0, tslib@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== -tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -19700,6 +20220,28 @@ vfile@^4.0.0: unist-util-stringify-position "^2.0.0" vfile-message "^2.0.0" +vite-tsconfig-paths@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-3.5.0.tgz#bfdf93f8072eff04125112ea9602fd50ae8cdad9" + integrity sha512-NKIubr7gXgh/3uniQaOytSg+aKWPrjquP6anAy+zCWEn6h9fB8z2/qdlfQrTgZWaXJ2pHVlllrSdRZltHn9P4g== + dependencies: + debug "^4.1.1" + globrex "^0.1.2" + recrawl-sync "^2.0.3" + tsconfig-paths "^4.0.0" + +vite@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/vite/-/vite-3.0.4.tgz#c61688d6b97573e96cf5ac25f2d68597b5ce68e8" + integrity sha512-NU304nqnBeOx2MkQnskBQxVsa0pRAH5FphokTGmyy8M3oxbvw7qAXts2GORxs+h/2vKsD+osMhZ7An6yK6F1dA== + dependencies: + esbuild "^0.14.47" + postcss "^8.4.14" + resolve "^1.22.1" + rollup "^2.75.6" + optionalDependencies: + fsevents "~2.3.2" + vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" @@ -20491,6 +21033,11 @@ yargs-parser@^20.2.3: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== +yargs-parser@^20.2.7: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + yargs-parser@^21.0.0: version "21.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.0.tgz#a485d3966be4317426dd56bdb6a30131b281dc55" From e5b271e9c04616e8c891939ff6c96fae5d970e48 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 9 Aug 2022 09:25:04 -0400 Subject: [PATCH 23/27] fix tests --- .../src/lib/workspace-dependencies.spec.ts | 49 +++---------------- .../nx-workspace/src/lib/nx-workspace.spec.ts | 18 +++---- 2 files changed, 15 insertions(+), 52 deletions(-) diff --git a/libs/npm/src/lib/workspace-dependencies.spec.ts b/libs/npm/src/lib/workspace-dependencies.spec.ts index 766723fb98..eb47b36d9c 100644 --- a/libs/npm/src/lib/workspace-dependencies.spec.ts +++ b/libs/npm/src/lib/workspace-dependencies.spec.ts @@ -1,6 +1,5 @@ import { PartialDeep } from 'type-fest'; -import { mocked } from 'ts-jest/utils'; - +import { mocked } from 'jest-mock'; import { workspaceDependencyPath } from './workspace-dependencies'; import * as pnpDependencies from './pnp-dependencies'; @@ -15,31 +14,14 @@ jest.mock( ); const mockedPnpDependencies = mocked(pnpDependencies); -import * as vscode from 'vscode'; -jest.mock('vscode', (): PartialDeep => { +import * as fs from '@nx-console/file-system'; +jest.mock('@nx-console/file-system', (): Partial => { + const original = jest.requireActual('@nx-console/file-system'); return { - FileType: { - Directory: 2, - SymbolicLink: 64, - }, - Uri: { - file: jest.fn((path) => path as any), - }, - workspace: { - fs: { - stat: jest.fn(() => - Promise.resolve({ - ctime: 0, - mtime: 0, - size: 0, - type: 2, - }) - ), - }, - }, + ...original, + fileExists: jest.fn(() => Promise.resolve(true)), }; }); -const mockedVsCode = mocked(vscode, true); describe('workspace-dependencies path', () => { it('should return a path to a workspace dependency when using node_modules', async () => { @@ -74,23 +56,4 @@ describe('workspace-dependencies path', () => { `"/workspace/tools/local/executor"` ); }); - - it('should support symbolic directory links', async () => { - mockedVsCode.workspace.fs.stat.mockImplementationOnce(() => { - return Promise.resolve({ - ctime: 0, - mtime: 0, - size: 0, - type: 66, - }); - }); - - const dependencyPath = await workspaceDependencyPath( - '/workspace', - '@nrwl/nx' - ); - expect(dependencyPath).toMatchInlineSnapshot( - `"/workspace/node_modules/@nrwl/nx"` - ); - }); }); diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts index 0a23ef95f6..993ea9bae3 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.spec.ts @@ -2,7 +2,7 @@ import { nxWorkspace } from './nx-workspace'; import { WorkspaceConfigurationStore } from '@nx-console/vscode/configuration'; import * as server from '@nx-console/utils'; import { getOutputChannel, getTelemetry } from '@nx-console/utils'; -import { mocked } from 'ts-jest/utils'; +import { mocked } from 'jest-mock'; import type { NxJsonConfiguration, WorkspaceJsonConfiguration, @@ -11,7 +11,6 @@ import * as vscode from 'vscode'; import type { AsyncReturnType } from 'type-fest'; import { getNxWorkspaceConfig } from './get-nx-workspace-config'; -import { fileExists as fileExists1, fileExists } from '@nx-console/file-system'; jest.mock('./get-nx-workspace-config', () => { const originalModule = jest.requireActual('./get-nx-workspace-config'); @@ -29,17 +28,19 @@ jest.mock('./get-nx-workspace-config', () => { }); const getNxWorkspaceConfigMock = mocked(getNxWorkspaceConfig); -const mockFileExistsFn = fileExists as jest.MockedFunction; -mockFileExistsFn.mockImplementation(async () => false); +import * as fs from '@nx-console/file-system'; +jest.mock('@nx-console/file-system', (): Partial => { + const original = jest.requireActual('@nx-console/file-system'); + return { + ...original, + fileExists: jest.fn(() => Promise.resolve(true)), + }; +}); const mockStoreInstanceGetFn = WorkspaceConfigurationStore.instance .get as jest.MockedFunction; mockStoreInstanceGetFn.mockImplementation(() => workspacePath); -const originalNxConsoleServerModule = jest.requireActual('@nx-console/server'); -(server.toWorkspaceFormat as unknown) = - originalNxConsoleServerModule.toWorkspaceFormat; - const mockWorkspace: WorkspaceJsonConfiguration & NxJsonConfiguration = { version: 2, npmScope: '@test', @@ -103,7 +104,6 @@ xdescribe('verifyWorkspace', () => { describe('when Ng workspace exists', () => { it('returns information about Ng workspace', async () => { // arrange - mockFileExistsFn.mockImplementationOnce(async () => true); getNxWorkspaceConfigMock.mockImplementationOnce(async () => { return { workspaceConfiguration: mockWorkspace, From a7b944034c8030e8794e8d95bac5cd81f382e252 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 9 Aug 2022 09:40:31 -0400 Subject: [PATCH 24/27] clean up --- libs/npm/src/lib/workspace-dependencies.spec.ts | 1 + libs/typescript-plugin/src/lib/typescript-plugin.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/npm/src/lib/workspace-dependencies.spec.ts b/libs/npm/src/lib/workspace-dependencies.spec.ts index eb47b36d9c..e33defc1c0 100644 --- a/libs/npm/src/lib/workspace-dependencies.spec.ts +++ b/libs/npm/src/lib/workspace-dependencies.spec.ts @@ -20,6 +20,7 @@ jest.mock('@nx-console/file-system', (): Partial => { return { ...original, fileExists: jest.fn(() => Promise.resolve(true)), + directoryExists: jest.fn(() => Promise.resolve(true)), }; }); diff --git a/libs/typescript-plugin/src/lib/typescript-plugin.ts b/libs/typescript-plugin/src/lib/typescript-plugin.ts index cb51be3fd1..6df93f5c05 100644 --- a/libs/typescript-plugin/src/lib/typescript-plugin.ts +++ b/libs/typescript-plugin/src/lib/typescript-plugin.ts @@ -79,7 +79,7 @@ export async function enableTypeScriptPlugin(context: vscode.ExtensionContext) { if (!enableLibraryImports) { vscode.window.setStatusBarMessage( - 'Restarting the TypeScript Utils', + 'Restarting the TypeScript Server', 5000 ); await vscode.commands.executeCommand('typescript.restartTsServer'); From 463c810339f78bd84d99ba866d40302ac0ee42e4 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 9 Aug 2022 10:02:01 -0400 Subject: [PATCH 25/27] add max old space to all nx commands --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1edb1db7ca..21cf439a64 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ }, "license": "MIT", "scripts": { - "nx": "nx", + "nx": "export NODE_OPTIONS=--max-old-space-size=409 && nx", "watch": "nx watch-all vscode", - "package": "export NODE_OPTIONS=--max-old-space-size=4096 && nx package vscode", + "package": "nx package vscode", "release": "standard-version", "update": "nx migrate latest" }, From f1c879951c858656ec0768ba3c75fa0b917121a0 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 9 Aug 2022 10:13:14 -0400 Subject: [PATCH 26/27] more memory for node --- apps/nxls/package.json | 9 +++++++++ apps/nxls/project.json | 13 ++++++++++++- package.json | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/nxls/package.json b/apps/nxls/package.json index 2c6e1c4b86..adb02de6a0 100644 --- a/apps/nxls/package.json +++ b/apps/nxls/package.json @@ -3,6 +3,15 @@ "version": "0.0.1", "main": "main.js", "bin": "bin/nxls", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/nrwl/nx-console.git" + }, + "author": { + "name": "Narwhal Technologies Inc", + "email": "hello@nrwl.io" + }, "dependencies": { "@nrwl/devkit": "14.4.1" } diff --git a/apps/nxls/project.json b/apps/nxls/project.json index 5259d2248d..bf31ac66c4 100644 --- a/apps/nxls/project.json +++ b/apps/nxls/project.json @@ -30,7 +30,9 @@ "executor": "nx:run-commands", "outputs": ["dist/apps/vscode/nxls"], "options": { - "commands": ["yarn rollup -c ./apps/nxls/rollup.config.ts"] + "commands": [ + "export NODE_OPTIONS=--max-old-space-size=4096 && yarn rollup -c ./apps/nxls/rollup.config.ts" + ] } }, "lint": { @@ -47,6 +49,15 @@ "jestConfig": "apps/nxls/jest.config.ts", "passWithNoTests": true } + }, + "semantic-release": { + "executor": "@theunderscorer/nx-semantic-release:semantic-release", + "options": { + "buildTarget": "nxls:package", + "outputPath": "dist/packages/nxls", + "packageJsonDir": "apps/nxls", + "ci": false + } } }, "tags": [] diff --git a/package.json b/package.json index 21cf439a64..fc81a8bea1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "license": "MIT", "scripts": { - "nx": "export NODE_OPTIONS=--max-old-space-size=409 && nx", + "nx": "export NODE_OPTIONS=--max-old-space-size=4096 && nx", "watch": "nx watch-all vscode", "package": "nx package vscode", "release": "standard-version", From a76c752c291ddd21a50a803b673088bf4ef2313a Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Tue, 9 Aug 2022 10:37:22 -0400 Subject: [PATCH 27/27] skip builds on ci --- .github/workflows/nx-run/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/nx-run/action.yml b/.github/workflows/nx-run/action.yml index 3b434a8b5d..f5de81117c 100644 --- a/.github/workflows/nx-run/action.yml +++ b/.github/workflows/nx-run/action.yml @@ -13,9 +13,6 @@ runs: - name: Test run: yarn nx run-many --all --parallel --target=test --max-parallel=3 shell: bash - - name: Build - run: yarn nx run-many --all --parallel --target=build --max-parallel=3 - shell: bash - name: Stopping nx-cloud ci agents run: npx nx-cloud stop-all-agents shell: bash