From 431a2bc76ac78a6a751921a2a27a4416bc898f4a Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Fri, 15 Dec 2023 14:24:08 +0800 Subject: [PATCH] refactor: no longer emit js files to out directory --- .gitignore | 3 + .vscode/settings.json | 9 ++- packages/css/{src => }/index.ts | 0 packages/css/tsconfig.json | 6 +- packages/emmet/{src => }/empty.ts | 0 packages/emmet/{src => }/index.ts | 0 packages/emmet/package.json | 2 +- packages/emmet/tsconfig.json | 6 +- packages/eslint/{src => }/index.ts | 0 packages/eslint/tsconfig.json | 6 +- packages/html/{src => }/index.ts | 0 packages/html/tsconfig.json | 6 +- packages/json/{src => }/index.ts | 0 packages/json/tsconfig.json | 6 +- packages/markdown/{src => }/index.ts | 0 packages/markdown/tsconfig.json | 6 +- packages/prettier/{src => }/index.ts | 0 packages/prettier/tsconfig.json | 6 +- packages/pretty-ts-errors/{src => }/index.ts | 0 packages/pretty-ts-errors/tsconfig.json | 6 +- packages/prettyhtml/{src => }/index.ts | 0 packages/prettyhtml/tsconfig.json | 6 +- packages/pug-beautify/{src => }/index.ts | 0 packages/pug-beautify/tsconfig.json | 6 +- packages/pug/{src => }/empty.ts | 0 packages/pug/{src => }/index.ts | 2 +- packages/pug/{src => lib}/baseParse.ts | 0 packages/pug/{src => lib}/languageService.ts | 0 packages/pug/{src => lib}/pugDocument.ts | 0 .../pug/{src => lib}/services/completion.ts | 0 .../services/documentHighlight.ts | 0 .../{src => lib}/services/documentLinks.ts | 0 .../{src => lib}/services/foldingRanges.ts | 0 packages/pug/{src => lib}/services/hover.ts | 0 .../{src => lib}/services/quoteComplete.ts | 0 packages/pug/{src => lib}/services/scanner.ts | 0 .../{src => lib}/services/selectionRanges.ts | 0 packages/pug/package.json | 2 +- packages/pug/tsconfig.json | 6 +- packages/sass-formatter/{src => }/index.ts | 0 packages/sass-formatter/tsconfig.json | 6 +- packages/tsconfig/{src => }/index.ts | 0 packages/tsconfig/tsconfig.json | 6 +- packages/tslint/{src => }/index.ts | 0 packages/tslint/tsconfig.json | 6 +- .../{src => }/index.ts | 0 .../typescript-twoslash-queries/tsconfig.json | 6 +- packages/typescript/{src => }/index.ts | 56 +++++++++---------- .../configs/getFormatCodeSettings.ts | 0 .../configs/getUserPreferences.ts | 0 .../{src => lib}/features/callHierarchy.ts | 0 .../{src => lib}/features/codeAction.ts | 0 .../features/codeActionResolve.ts | 0 .../features/completions/basic.ts | 0 .../features/completions/directiveComment.ts | 0 .../features/completions/jsDoc.ts | 0 .../features/completions/resolve.ts | 0 .../{src => lib}/features/definition.ts | 0 .../{src => lib}/features/diagnostics.ts | 0 .../features/documentHighlight.ts | 0 .../{src => lib}/features/documentSymbol.ts | 0 .../{src => lib}/features/fileReferences.ts | 0 .../{src => lib}/features/fileRename.ts | 0 .../{src => lib}/features/foldingRanges.ts | 0 .../{src => lib}/features/formatting.ts | 0 .../typescript/{src => lib}/features/hover.ts | 0 .../{src => lib}/features/implementation.ts | 0 .../{src => lib}/features/inlayHints.ts | 0 .../{src => lib}/features/prepareRename.ts | 0 .../{src => lib}/features/references.ts | 0 .../{src => lib}/features/rename.ts | 0 .../{src => lib}/features/selectionRanges.ts | 0 .../{src => lib}/features/semanticTokens.ts | 0 .../{src => lib}/features/signatureHelp.ts | 0 .../{src => lib}/features/typeDefinition.ts | 0 .../{src => lib}/features/workspaceSymbol.ts | 0 .../typescript/{src => lib}/protocol.const.ts | 0 packages/typescript/{src => lib}/shared.ts | 0 packages/typescript/{src => lib}/types.ts | 0 .../{src => lib}/utils/errorCodes.ts | 0 .../typescript/{src => lib}/utils/fixNames.ts | 0 .../{src => lib}/utils/modifiers.ts | 0 .../{src => lib}/utils/previewer.ts | 17 +++--- .../utils/snippetForFunctionCall.ts | 12 ++-- .../{src => lib}/utils/transforms.ts | 0 .../{src => lib}/utils/typeConverters.ts | 0 packages/typescript/src/protocol.d.ts | 17 ------ packages/typescript/tsconfig.json | 6 +- packages/vetur/{src => }/index.ts | 2 +- packages/vetur/{src => lib}/userSnippetDir.ts | 0 packages/vetur/tsconfig.json | 6 +- packages/yaml/{src => }/index.ts | 0 packages/yaml/tsconfig.json | 6 +- 93 files changed, 75 insertions(+), 155 deletions(-) rename packages/css/{src => }/index.ts (100%) rename packages/emmet/{src => }/empty.ts (100%) rename packages/emmet/{src => }/index.ts (100%) rename packages/eslint/{src => }/index.ts (100%) rename packages/html/{src => }/index.ts (100%) rename packages/json/{src => }/index.ts (100%) rename packages/markdown/{src => }/index.ts (100%) rename packages/prettier/{src => }/index.ts (100%) rename packages/pretty-ts-errors/{src => }/index.ts (100%) rename packages/prettyhtml/{src => }/index.ts (100%) rename packages/pug-beautify/{src => }/index.ts (100%) rename packages/pug/{src => }/empty.ts (100%) rename packages/pug/{src => }/index.ts (99%) rename packages/pug/{src => lib}/baseParse.ts (100%) rename packages/pug/{src => lib}/languageService.ts (100%) rename packages/pug/{src => lib}/pugDocument.ts (100%) rename packages/pug/{src => lib}/services/completion.ts (100%) rename packages/pug/{src => lib}/services/documentHighlight.ts (100%) rename packages/pug/{src => lib}/services/documentLinks.ts (100%) rename packages/pug/{src => lib}/services/foldingRanges.ts (100%) rename packages/pug/{src => lib}/services/hover.ts (100%) rename packages/pug/{src => lib}/services/quoteComplete.ts (100%) rename packages/pug/{src => lib}/services/scanner.ts (100%) rename packages/pug/{src => lib}/services/selectionRanges.ts (100%) rename packages/sass-formatter/{src => }/index.ts (100%) rename packages/tsconfig/{src => }/index.ts (100%) rename packages/tslint/{src => }/index.ts (100%) rename packages/typescript-twoslash-queries/{src => }/index.ts (100%) rename packages/typescript/{src => }/index.ts (91%) rename packages/typescript/{src => lib}/configs/getFormatCodeSettings.ts (100%) rename packages/typescript/{src => lib}/configs/getUserPreferences.ts (100%) rename packages/typescript/{src => lib}/features/callHierarchy.ts (100%) rename packages/typescript/{src => lib}/features/codeAction.ts (100%) rename packages/typescript/{src => lib}/features/codeActionResolve.ts (100%) rename packages/typescript/{src => lib}/features/completions/basic.ts (100%) rename packages/typescript/{src => lib}/features/completions/directiveComment.ts (100%) rename packages/typescript/{src => lib}/features/completions/jsDoc.ts (100%) rename packages/typescript/{src => lib}/features/completions/resolve.ts (100%) rename packages/typescript/{src => lib}/features/definition.ts (100%) rename packages/typescript/{src => lib}/features/diagnostics.ts (100%) rename packages/typescript/{src => lib}/features/documentHighlight.ts (100%) rename packages/typescript/{src => lib}/features/documentSymbol.ts (100%) rename packages/typescript/{src => lib}/features/fileReferences.ts (100%) rename packages/typescript/{src => lib}/features/fileRename.ts (100%) rename packages/typescript/{src => lib}/features/foldingRanges.ts (100%) rename packages/typescript/{src => lib}/features/formatting.ts (100%) rename packages/typescript/{src => lib}/features/hover.ts (100%) rename packages/typescript/{src => lib}/features/implementation.ts (100%) rename packages/typescript/{src => lib}/features/inlayHints.ts (100%) rename packages/typescript/{src => lib}/features/prepareRename.ts (100%) rename packages/typescript/{src => lib}/features/references.ts (100%) rename packages/typescript/{src => lib}/features/rename.ts (100%) rename packages/typescript/{src => lib}/features/selectionRanges.ts (100%) rename packages/typescript/{src => lib}/features/semanticTokens.ts (100%) rename packages/typescript/{src => lib}/features/signatureHelp.ts (100%) rename packages/typescript/{src => lib}/features/typeDefinition.ts (100%) rename packages/typescript/{src => lib}/features/workspaceSymbol.ts (100%) rename packages/typescript/{src => lib}/protocol.const.ts (100%) rename packages/typescript/{src => lib}/shared.ts (100%) rename packages/typescript/{src => lib}/types.ts (100%) rename packages/typescript/{src => lib}/utils/errorCodes.ts (100%) rename packages/typescript/{src => lib}/utils/fixNames.ts (100%) rename packages/typescript/{src => lib}/utils/modifiers.ts (100%) rename packages/typescript/{src => lib}/utils/previewer.ts (91%) rename packages/typescript/{src => lib}/utils/snippetForFunctionCall.ts (88%) rename packages/typescript/{src => lib}/utils/transforms.ts (100%) rename packages/typescript/{src => lib}/utils/typeConverters.ts (100%) delete mode 100644 packages/typescript/src/protocol.d.ts rename packages/vetur/{src => }/index.ts (99%) rename packages/vetur/{src => lib}/userSnippetDir.ts (100%) rename packages/yaml/{src => }/index.ts (100%) diff --git a/.gitignore b/.gitignore index 1db8b3b1..fffdfe15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ out node_modules *.tsbuildinfo +*.d.ts +*.js +*.map diff --git a/.vscode/settings.json b/.vscode/settings.json index 9f806aa4..b71437c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,6 @@ "editor.insertSpaces": false, "editor.detectIndentation": false, "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, "json.format.keepLines": true, "typescript.tsdk": "node_modules/typescript/lib", "[typescript]": { @@ -17,5 +16,13 @@ }, "[jsonc]": { "editor.defaultFormatter": "vscode.json-language-features" + }, + "files.exclude": { + "packages/*/*.d.ts": true, + "packages/*/*.js": true, + "packages/*/*.map": true, + "packages/*/lib/**/*.d.ts": true, + "packages/*/lib/**/*.js": true, + "packages/*/lib/**/*.map": true } } diff --git a/packages/css/src/index.ts b/packages/css/index.ts similarity index 100% rename from packages/css/src/index.ts rename to packages/css/index.ts diff --git a/packages/css/tsconfig.json b/packages/css/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/css/tsconfig.json +++ b/packages/css/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/emmet/src/empty.ts b/packages/emmet/empty.ts similarity index 100% rename from packages/emmet/src/empty.ts rename to packages/emmet/empty.ts diff --git a/packages/emmet/src/index.ts b/packages/emmet/index.ts similarity index 100% rename from packages/emmet/src/index.ts rename to packages/emmet/index.ts diff --git a/packages/emmet/package.json b/packages/emmet/package.json index 5df30598..84da9092 100644 --- a/packages/emmet/package.json +++ b/packages/emmet/package.json @@ -37,6 +37,6 @@ } }, "browser": { - "./out/index.js": "./out/empty.js" + "./index.js": "./empty.js" } } diff --git a/packages/emmet/tsconfig.json b/packages/emmet/tsconfig.json index 032f0dc5..439b3d9e 100644 --- a/packages/emmet/tsconfig.json +++ b/packages/emmet/tsconfig.json @@ -1,10 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], "references": [ { "path": "../html/tsconfig.json" }, ], diff --git a/packages/eslint/src/index.ts b/packages/eslint/index.ts similarity index 100% rename from packages/eslint/src/index.ts rename to packages/eslint/index.ts diff --git a/packages/eslint/tsconfig.json b/packages/eslint/tsconfig.json index 2a0662fc..8d655e0c 100644 --- a/packages/eslint/tsconfig.json +++ b/packages/eslint/tsconfig.json @@ -1,10 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], "references": [ { "path": "../typescript/tsconfig.json" }, ], diff --git a/packages/html/src/index.ts b/packages/html/index.ts similarity index 100% rename from packages/html/src/index.ts rename to packages/html/index.ts diff --git a/packages/html/tsconfig.json b/packages/html/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/html/tsconfig.json +++ b/packages/html/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/json/src/index.ts b/packages/json/index.ts similarity index 100% rename from packages/json/src/index.ts rename to packages/json/index.ts diff --git a/packages/json/tsconfig.json b/packages/json/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/json/tsconfig.json +++ b/packages/json/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/markdown/src/index.ts b/packages/markdown/index.ts similarity index 100% rename from packages/markdown/src/index.ts rename to packages/markdown/index.ts diff --git a/packages/markdown/tsconfig.json b/packages/markdown/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/markdown/tsconfig.json +++ b/packages/markdown/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/prettier/src/index.ts b/packages/prettier/index.ts similarity index 100% rename from packages/prettier/src/index.ts rename to packages/prettier/index.ts diff --git a/packages/prettier/tsconfig.json b/packages/prettier/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/prettier/tsconfig.json +++ b/packages/prettier/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/pretty-ts-errors/src/index.ts b/packages/pretty-ts-errors/index.ts similarity index 100% rename from packages/pretty-ts-errors/src/index.ts rename to packages/pretty-ts-errors/index.ts diff --git a/packages/pretty-ts-errors/tsconfig.json b/packages/pretty-ts-errors/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/pretty-ts-errors/tsconfig.json +++ b/packages/pretty-ts-errors/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/prettyhtml/src/index.ts b/packages/prettyhtml/index.ts similarity index 100% rename from packages/prettyhtml/src/index.ts rename to packages/prettyhtml/index.ts diff --git a/packages/prettyhtml/tsconfig.json b/packages/prettyhtml/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/prettyhtml/tsconfig.json +++ b/packages/prettyhtml/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/pug-beautify/src/index.ts b/packages/pug-beautify/index.ts similarity index 100% rename from packages/pug-beautify/src/index.ts rename to packages/pug-beautify/index.ts diff --git a/packages/pug-beautify/tsconfig.json b/packages/pug-beautify/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/pug-beautify/tsconfig.json +++ b/packages/pug-beautify/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/pug/src/empty.ts b/packages/pug/empty.ts similarity index 100% rename from packages/pug/src/empty.ts rename to packages/pug/empty.ts diff --git a/packages/pug/src/index.ts b/packages/pug/index.ts similarity index 99% rename from packages/pug/src/index.ts rename to packages/pug/index.ts index c8137578..948ec010 100644 --- a/packages/pug/src/index.ts +++ b/packages/pug/index.ts @@ -2,7 +2,7 @@ import { transformDocumentSymbol, type Diagnostic, type DiagnosticSeverity, type import { create as createHtmlService } from 'volar-service-html'; import type * as html from 'vscode-html-languageservice'; import type { TextDocument } from 'vscode-languageserver-textdocument'; -import * as pug from './languageService'; +import * as pug from './lib/languageService'; export interface Provide { 'pug/pugDocument': (document: TextDocument) => pug.PugDocument | undefined; diff --git a/packages/pug/src/baseParse.ts b/packages/pug/lib/baseParse.ts similarity index 100% rename from packages/pug/src/baseParse.ts rename to packages/pug/lib/baseParse.ts diff --git a/packages/pug/src/languageService.ts b/packages/pug/lib/languageService.ts similarity index 100% rename from packages/pug/src/languageService.ts rename to packages/pug/lib/languageService.ts diff --git a/packages/pug/src/pugDocument.ts b/packages/pug/lib/pugDocument.ts similarity index 100% rename from packages/pug/src/pugDocument.ts rename to packages/pug/lib/pugDocument.ts diff --git a/packages/pug/src/services/completion.ts b/packages/pug/lib/services/completion.ts similarity index 100% rename from packages/pug/src/services/completion.ts rename to packages/pug/lib/services/completion.ts diff --git a/packages/pug/src/services/documentHighlight.ts b/packages/pug/lib/services/documentHighlight.ts similarity index 100% rename from packages/pug/src/services/documentHighlight.ts rename to packages/pug/lib/services/documentHighlight.ts diff --git a/packages/pug/src/services/documentLinks.ts b/packages/pug/lib/services/documentLinks.ts similarity index 100% rename from packages/pug/src/services/documentLinks.ts rename to packages/pug/lib/services/documentLinks.ts diff --git a/packages/pug/src/services/foldingRanges.ts b/packages/pug/lib/services/foldingRanges.ts similarity index 100% rename from packages/pug/src/services/foldingRanges.ts rename to packages/pug/lib/services/foldingRanges.ts diff --git a/packages/pug/src/services/hover.ts b/packages/pug/lib/services/hover.ts similarity index 100% rename from packages/pug/src/services/hover.ts rename to packages/pug/lib/services/hover.ts diff --git a/packages/pug/src/services/quoteComplete.ts b/packages/pug/lib/services/quoteComplete.ts similarity index 100% rename from packages/pug/src/services/quoteComplete.ts rename to packages/pug/lib/services/quoteComplete.ts diff --git a/packages/pug/src/services/scanner.ts b/packages/pug/lib/services/scanner.ts similarity index 100% rename from packages/pug/src/services/scanner.ts rename to packages/pug/lib/services/scanner.ts diff --git a/packages/pug/src/services/selectionRanges.ts b/packages/pug/lib/services/selectionRanges.ts similarity index 100% rename from packages/pug/src/services/selectionRanges.ts rename to packages/pug/lib/services/selectionRanges.ts diff --git a/packages/pug/package.json b/packages/pug/package.json index 926f2acf..46500a81 100644 --- a/packages/pug/package.json +++ b/packages/pug/package.json @@ -36,6 +36,6 @@ "@types/node": "latest" }, "browser": { - "./out/index.js": "./out/empty.js" + "./index.js": "./empty.js" } } diff --git a/packages/pug/tsconfig.json b/packages/pug/tsconfig.json index 032f0dc5..439b3d9e 100644 --- a/packages/pug/tsconfig.json +++ b/packages/pug/tsconfig.json @@ -1,10 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], "references": [ { "path": "../html/tsconfig.json" }, ], diff --git a/packages/sass-formatter/src/index.ts b/packages/sass-formatter/index.ts similarity index 100% rename from packages/sass-formatter/src/index.ts rename to packages/sass-formatter/index.ts diff --git a/packages/sass-formatter/tsconfig.json b/packages/sass-formatter/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/sass-formatter/tsconfig.json +++ b/packages/sass-formatter/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/tsconfig/src/index.ts b/packages/tsconfig/index.ts similarity index 100% rename from packages/tsconfig/src/index.ts rename to packages/tsconfig/index.ts diff --git a/packages/tsconfig/tsconfig.json b/packages/tsconfig/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/tsconfig/tsconfig.json +++ b/packages/tsconfig/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/tslint/src/index.ts b/packages/tslint/index.ts similarity index 100% rename from packages/tslint/src/index.ts rename to packages/tslint/index.ts diff --git a/packages/tslint/tsconfig.json b/packages/tslint/tsconfig.json index 2a0662fc..8d655e0c 100644 --- a/packages/tslint/tsconfig.json +++ b/packages/tslint/tsconfig.json @@ -1,10 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], "references": [ { "path": "../typescript/tsconfig.json" }, ], diff --git a/packages/typescript-twoslash-queries/src/index.ts b/packages/typescript-twoslash-queries/index.ts similarity index 100% rename from packages/typescript-twoslash-queries/src/index.ts rename to packages/typescript-twoslash-queries/index.ts diff --git a/packages/typescript-twoslash-queries/tsconfig.json b/packages/typescript-twoslash-queries/tsconfig.json index 2a0662fc..8d655e0c 100644 --- a/packages/typescript-twoslash-queries/tsconfig.json +++ b/packages/typescript-twoslash-queries/tsconfig.json @@ -1,10 +1,6 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], "references": [ { "path": "../typescript/tsconfig.json" }, ], diff --git a/packages/typescript/src/index.ts b/packages/typescript/index.ts similarity index 91% rename from packages/typescript/src/index.ts rename to packages/typescript/index.ts index ce5da616..c0588fd0 100644 --- a/packages/typescript/src/index.ts +++ b/packages/typescript/index.ts @@ -2,37 +2,37 @@ import type { CancellationToken, CompletionList, CompletionTriggerKind, FileChan import * as semver from 'semver'; import type * as ts from 'typescript/lib/tsserverlibrary'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { getConfigTitle, isJsonDocument, isTsDocument } from './shared'; +import { getConfigTitle, isJsonDocument, isTsDocument } from './lib/shared'; import { getDocumentRegistry } from '@volar/typescript'; import * as tsFaster from 'typescript-auto-import-cache'; -import * as _callHierarchy from './features/callHierarchy'; -import * as codeActions from './features/codeAction'; -import * as codeActionResolve from './features/codeActionResolve'; -import * as completions from './features/completions/basic'; -import * as directiveCommentCompletions from './features/completions/directiveComment'; -import * as jsDocCompletions from './features/completions/jsDoc'; -import * as completionResolve from './features/completions/resolve'; -import * as definitions from './features/definition'; -import * as diagnostics from './features/diagnostics'; -import * as documentHighlight from './features/documentHighlight'; -import * as documentSymbol from './features/documentSymbol'; -import * as fileReferences from './features/fileReferences'; -import * as fileRename from './features/fileRename'; -import * as foldingRanges from './features/foldingRanges'; -import * as formatting from './features/formatting'; -import * as hover from './features/hover'; -import * as implementation from './features/implementation'; -import * as inlayHints from './features/inlayHints'; -import * as prepareRename from './features/prepareRename'; -import * as references from './features/references'; -import * as rename from './features/rename'; -import * as selectionRanges from './features/selectionRanges'; -import * as semanticTokens from './features/semanticTokens'; -import * as signatureHelp from './features/signatureHelp'; -import * as typeDefinitions from './features/typeDefinition'; -import * as workspaceSymbols from './features/workspaceSymbol'; -import type { SharedContext } from './types'; +import * as _callHierarchy from './lib/features/callHierarchy'; +import * as codeActions from './lib/features/codeAction'; +import * as codeActionResolve from './lib/features/codeActionResolve'; +import * as completions from './lib/features/completions/basic'; +import * as directiveCommentCompletions from './lib/features/completions/directiveComment'; +import * as jsDocCompletions from './lib/features/completions/jsDoc'; +import * as completionResolve from './lib/features/completions/resolve'; +import * as definitions from './lib/features/definition'; +import * as diagnostics from './lib/features/diagnostics'; +import * as documentHighlight from './lib/features/documentHighlight'; +import * as documentSymbol from './lib/features/documentSymbol'; +import * as fileReferences from './lib/features/fileReferences'; +import * as fileRename from './lib/features/fileRename'; +import * as foldingRanges from './lib/features/foldingRanges'; +import * as formatting from './lib/features/formatting'; +import * as hover from './lib/features/hover'; +import * as implementation from './lib/features/implementation'; +import * as inlayHints from './lib/features/inlayHints'; +import * as prepareRename from './lib/features/prepareRename'; +import * as references from './lib/features/references'; +import * as rename from './lib/features/rename'; +import * as selectionRanges from './lib/features/selectionRanges'; +import * as semanticTokens from './lib/features/semanticTokens'; +import * as signatureHelp from './lib/features/signatureHelp'; +import * as typeDefinitions from './lib/features/typeDefinition'; +import * as workspaceSymbols from './lib/features/workspaceSymbol'; +import type { SharedContext } from './lib/types'; export * from '@volar/typescript'; diff --git a/packages/typescript/src/configs/getFormatCodeSettings.ts b/packages/typescript/lib/configs/getFormatCodeSettings.ts similarity index 100% rename from packages/typescript/src/configs/getFormatCodeSettings.ts rename to packages/typescript/lib/configs/getFormatCodeSettings.ts diff --git a/packages/typescript/src/configs/getUserPreferences.ts b/packages/typescript/lib/configs/getUserPreferences.ts similarity index 100% rename from packages/typescript/src/configs/getUserPreferences.ts rename to packages/typescript/lib/configs/getUserPreferences.ts diff --git a/packages/typescript/src/features/callHierarchy.ts b/packages/typescript/lib/features/callHierarchy.ts similarity index 100% rename from packages/typescript/src/features/callHierarchy.ts rename to packages/typescript/lib/features/callHierarchy.ts diff --git a/packages/typescript/src/features/codeAction.ts b/packages/typescript/lib/features/codeAction.ts similarity index 100% rename from packages/typescript/src/features/codeAction.ts rename to packages/typescript/lib/features/codeAction.ts diff --git a/packages/typescript/src/features/codeActionResolve.ts b/packages/typescript/lib/features/codeActionResolve.ts similarity index 100% rename from packages/typescript/src/features/codeActionResolve.ts rename to packages/typescript/lib/features/codeActionResolve.ts diff --git a/packages/typescript/src/features/completions/basic.ts b/packages/typescript/lib/features/completions/basic.ts similarity index 100% rename from packages/typescript/src/features/completions/basic.ts rename to packages/typescript/lib/features/completions/basic.ts diff --git a/packages/typescript/src/features/completions/directiveComment.ts b/packages/typescript/lib/features/completions/directiveComment.ts similarity index 100% rename from packages/typescript/src/features/completions/directiveComment.ts rename to packages/typescript/lib/features/completions/directiveComment.ts diff --git a/packages/typescript/src/features/completions/jsDoc.ts b/packages/typescript/lib/features/completions/jsDoc.ts similarity index 100% rename from packages/typescript/src/features/completions/jsDoc.ts rename to packages/typescript/lib/features/completions/jsDoc.ts diff --git a/packages/typescript/src/features/completions/resolve.ts b/packages/typescript/lib/features/completions/resolve.ts similarity index 100% rename from packages/typescript/src/features/completions/resolve.ts rename to packages/typescript/lib/features/completions/resolve.ts diff --git a/packages/typescript/src/features/definition.ts b/packages/typescript/lib/features/definition.ts similarity index 100% rename from packages/typescript/src/features/definition.ts rename to packages/typescript/lib/features/definition.ts diff --git a/packages/typescript/src/features/diagnostics.ts b/packages/typescript/lib/features/diagnostics.ts similarity index 100% rename from packages/typescript/src/features/diagnostics.ts rename to packages/typescript/lib/features/diagnostics.ts diff --git a/packages/typescript/src/features/documentHighlight.ts b/packages/typescript/lib/features/documentHighlight.ts similarity index 100% rename from packages/typescript/src/features/documentHighlight.ts rename to packages/typescript/lib/features/documentHighlight.ts diff --git a/packages/typescript/src/features/documentSymbol.ts b/packages/typescript/lib/features/documentSymbol.ts similarity index 100% rename from packages/typescript/src/features/documentSymbol.ts rename to packages/typescript/lib/features/documentSymbol.ts diff --git a/packages/typescript/src/features/fileReferences.ts b/packages/typescript/lib/features/fileReferences.ts similarity index 100% rename from packages/typescript/src/features/fileReferences.ts rename to packages/typescript/lib/features/fileReferences.ts diff --git a/packages/typescript/src/features/fileRename.ts b/packages/typescript/lib/features/fileRename.ts similarity index 100% rename from packages/typescript/src/features/fileRename.ts rename to packages/typescript/lib/features/fileRename.ts diff --git a/packages/typescript/src/features/foldingRanges.ts b/packages/typescript/lib/features/foldingRanges.ts similarity index 100% rename from packages/typescript/src/features/foldingRanges.ts rename to packages/typescript/lib/features/foldingRanges.ts diff --git a/packages/typescript/src/features/formatting.ts b/packages/typescript/lib/features/formatting.ts similarity index 100% rename from packages/typescript/src/features/formatting.ts rename to packages/typescript/lib/features/formatting.ts diff --git a/packages/typescript/src/features/hover.ts b/packages/typescript/lib/features/hover.ts similarity index 100% rename from packages/typescript/src/features/hover.ts rename to packages/typescript/lib/features/hover.ts diff --git a/packages/typescript/src/features/implementation.ts b/packages/typescript/lib/features/implementation.ts similarity index 100% rename from packages/typescript/src/features/implementation.ts rename to packages/typescript/lib/features/implementation.ts diff --git a/packages/typescript/src/features/inlayHints.ts b/packages/typescript/lib/features/inlayHints.ts similarity index 100% rename from packages/typescript/src/features/inlayHints.ts rename to packages/typescript/lib/features/inlayHints.ts diff --git a/packages/typescript/src/features/prepareRename.ts b/packages/typescript/lib/features/prepareRename.ts similarity index 100% rename from packages/typescript/src/features/prepareRename.ts rename to packages/typescript/lib/features/prepareRename.ts diff --git a/packages/typescript/src/features/references.ts b/packages/typescript/lib/features/references.ts similarity index 100% rename from packages/typescript/src/features/references.ts rename to packages/typescript/lib/features/references.ts diff --git a/packages/typescript/src/features/rename.ts b/packages/typescript/lib/features/rename.ts similarity index 100% rename from packages/typescript/src/features/rename.ts rename to packages/typescript/lib/features/rename.ts diff --git a/packages/typescript/src/features/selectionRanges.ts b/packages/typescript/lib/features/selectionRanges.ts similarity index 100% rename from packages/typescript/src/features/selectionRanges.ts rename to packages/typescript/lib/features/selectionRanges.ts diff --git a/packages/typescript/src/features/semanticTokens.ts b/packages/typescript/lib/features/semanticTokens.ts similarity index 100% rename from packages/typescript/src/features/semanticTokens.ts rename to packages/typescript/lib/features/semanticTokens.ts diff --git a/packages/typescript/src/features/signatureHelp.ts b/packages/typescript/lib/features/signatureHelp.ts similarity index 100% rename from packages/typescript/src/features/signatureHelp.ts rename to packages/typescript/lib/features/signatureHelp.ts diff --git a/packages/typescript/src/features/typeDefinition.ts b/packages/typescript/lib/features/typeDefinition.ts similarity index 100% rename from packages/typescript/src/features/typeDefinition.ts rename to packages/typescript/lib/features/typeDefinition.ts diff --git a/packages/typescript/src/features/workspaceSymbol.ts b/packages/typescript/lib/features/workspaceSymbol.ts similarity index 100% rename from packages/typescript/src/features/workspaceSymbol.ts rename to packages/typescript/lib/features/workspaceSymbol.ts diff --git a/packages/typescript/src/protocol.const.ts b/packages/typescript/lib/protocol.const.ts similarity index 100% rename from packages/typescript/src/protocol.const.ts rename to packages/typescript/lib/protocol.const.ts diff --git a/packages/typescript/src/shared.ts b/packages/typescript/lib/shared.ts similarity index 100% rename from packages/typescript/src/shared.ts rename to packages/typescript/lib/shared.ts diff --git a/packages/typescript/src/types.ts b/packages/typescript/lib/types.ts similarity index 100% rename from packages/typescript/src/types.ts rename to packages/typescript/lib/types.ts diff --git a/packages/typescript/src/utils/errorCodes.ts b/packages/typescript/lib/utils/errorCodes.ts similarity index 100% rename from packages/typescript/src/utils/errorCodes.ts rename to packages/typescript/lib/utils/errorCodes.ts diff --git a/packages/typescript/src/utils/fixNames.ts b/packages/typescript/lib/utils/fixNames.ts similarity index 100% rename from packages/typescript/src/utils/fixNames.ts rename to packages/typescript/lib/utils/fixNames.ts diff --git a/packages/typescript/src/utils/modifiers.ts b/packages/typescript/lib/utils/modifiers.ts similarity index 100% rename from packages/typescript/src/utils/modifiers.ts rename to packages/typescript/lib/utils/modifiers.ts diff --git a/packages/typescript/src/utils/previewer.ts b/packages/typescript/lib/utils/previewer.ts similarity index 91% rename from packages/typescript/src/utils/previewer.ts rename to packages/typescript/lib/utils/previewer.ts index 614db876..51aa7834 100644 --- a/packages/typescript/src/utils/previewer.ts +++ b/packages/typescript/lib/utils/previewer.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import type * as ts from 'typescript/lib/tsserverlibrary'; -import type * as Proto from '../protocol'; import type { SharedContext } from '../types'; export interface IFilePathToResourceConverter { @@ -33,7 +32,7 @@ function processInlineTags(text: string): string { } function getTagBodyText( - tag: Proto.JSDocTagInfo, + tag: ts.server.protocol.JSDocTagInfo, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext, ): string | undefined { @@ -76,7 +75,7 @@ function getTagBodyText( } function getTagDocumentation( - tag: Proto.JSDocTagInfo, + tag: ts.server.protocol.JSDocTagInfo, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext, ): string | undefined { @@ -107,7 +106,7 @@ function getTagDocumentation( } export function plainWithLinks( - parts: readonly Proto.SymbolDisplayPart[] | string, + parts: readonly ts.server.protocol.SymbolDisplayPart[] | string, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext, ): string { @@ -118,7 +117,7 @@ export function plainWithLinks( * Convert `@link` inline tags to markdown links */ function convertLinkTags( - parts: readonly Proto.SymbolDisplayPart[] | string | undefined, + parts: readonly ts.server.protocol.SymbolDisplayPart[] | string | undefined, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext, ): string { @@ -132,7 +131,7 @@ function convertLinkTags( const out: string[] = []; - let currentLink: { name?: string, target?: Proto.FileSpan, text?: string; } | undefined; + let currentLink: { name?: string, target?: ts.server.protocol.FileSpan, text?: string; } | undefined; for (const part of parts) { switch (part.kind) { case 'link': @@ -184,7 +183,7 @@ function convertLinkTags( case 'linkName': if (currentLink) { currentLink.name = part.text; - currentLink.target = (part as Proto.JSDocLinkDisplayPart).target; + currentLink.target = (part as ts.server.protocol.JSDocLinkDisplayPart).target; } break; @@ -211,7 +210,7 @@ export function tagsMarkdownPreview( } export function markdownDocumentation( - documentation: Proto.SymbolDisplayPart[] | string | undefined, + documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, filePathConverter: IFilePathToResourceConverter, ctx: SharedContext, @@ -221,7 +220,7 @@ export function markdownDocumentation( export function addMarkdownDocumentation( out: string, - documentation: Proto.SymbolDisplayPart[] | string | undefined, + documentation: ts.server.protocol.SymbolDisplayPart[] | string | undefined, tags: ts.JSDocTagInfo[] | undefined, converter: IFilePathToResourceConverter, ctx: SharedContext, diff --git a/packages/typescript/src/utils/snippetForFunctionCall.ts b/packages/typescript/lib/utils/snippetForFunctionCall.ts similarity index 88% rename from packages/typescript/src/utils/snippetForFunctionCall.ts rename to packages/typescript/lib/utils/snippetForFunctionCall.ts index 8771f088..595796cb 100644 --- a/packages/typescript/src/utils/snippetForFunctionCall.ts +++ b/packages/typescript/lib/utils/snippetForFunctionCall.ts @@ -1,9 +1,9 @@ -import type * as Proto from '../protocol'; +import type * as ts from 'typescript/lib/tsserverlibrary'; import * as PConst from '../protocol.const'; export function snippetForFunctionCall( item: { insertText?: string; label: string; }, - displayParts: ReadonlyArray + displayParts: ReadonlyArray ): { snippet: string; parameterCount: number; } { if (item.insertText && typeof item.insertText !== 'string') { return { snippet: item.insertText, parameterCount: 0 }; @@ -24,7 +24,7 @@ export function snippetForFunctionCall( function appendJoinedPlaceholders( snippet: string, - parts: ReadonlyArray, + parts: ReadonlyArray, joiner: string ) { for (let i = 0; i < parts.length; ++i) { @@ -39,14 +39,14 @@ export function snippetForFunctionCall( } interface ParamterListParts { - readonly parts: ReadonlyArray; + readonly parts: ReadonlyArray; readonly hasOptionalParameters: boolean; } function getParameterListParts( - displayParts: ReadonlyArray + displayParts: ReadonlyArray ): ParamterListParts { - const parts: Proto.SymbolDisplayPart[] = []; + const parts: ts.server.protocol.SymbolDisplayPart[] = []; let isInMethod = false; let hasOptionalParameters = false; let parenCount = 0; diff --git a/packages/typescript/src/utils/transforms.ts b/packages/typescript/lib/utils/transforms.ts similarity index 100% rename from packages/typescript/src/utils/transforms.ts rename to packages/typescript/lib/utils/transforms.ts diff --git a/packages/typescript/src/utils/typeConverters.ts b/packages/typescript/lib/utils/typeConverters.ts similarity index 100% rename from packages/typescript/src/utils/typeConverters.ts rename to packages/typescript/lib/utils/typeConverters.ts diff --git a/packages/typescript/src/protocol.d.ts b/packages/typescript/src/protocol.d.ts deleted file mode 100644 index 9550e848..00000000 --- a/packages/typescript/src/protocol.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type * as Proto from 'typescript/lib/tsserverlibrary'; -export = Proto.server.protocol; - -declare enum ServerType { - Syntax = 'syntax', - Semantic = 'semantic', -} -declare module 'typescript/lib/tsserverlibrary' { - - interface Response { - readonly _serverType?: ServerType; - } - - interface JSDocLinkDisplayPart { - target: Proto.server.protocol.FileSpan; - } -} diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/vetur/src/index.ts b/packages/vetur/index.ts similarity index 99% rename from packages/vetur/src/index.ts rename to packages/vetur/index.ts index 3145a07f..7c7a5e55 100644 --- a/packages/vetur/src/index.ts +++ b/packages/vetur/index.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as vls from 'vls'; import type { TextDocument } from 'vscode-html-languageservice'; import * as html from 'vscode-html-languageservice'; -import { getGlobalSnippetDir } from './userSnippetDir'; +import { getGlobalSnippetDir } from './lib/userSnippetDir'; export function create(): ServicePlugin { return { diff --git a/packages/vetur/src/userSnippetDir.ts b/packages/vetur/lib/userSnippetDir.ts similarity index 100% rename from packages/vetur/src/userSnippetDir.ts rename to packages/vetur/lib/userSnippetDir.ts diff --git a/packages/vetur/tsconfig.json b/packages/vetur/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/vetur/tsconfig.json +++ b/packages/vetur/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], } diff --git a/packages/yaml/src/index.ts b/packages/yaml/index.ts similarity index 100% rename from packages/yaml/src/index.ts rename to packages/yaml/index.ts diff --git a/packages/yaml/tsconfig.json b/packages/yaml/tsconfig.json index 0917d559..45b22f96 100644 --- a/packages/yaml/tsconfig.json +++ b/packages/yaml/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "out", - "rootDir": "src", - }, - "include": [ "src" ], + "include": [ "*", "lib/**/*" ], }