From 6353982af997e825265af32f4063743ec8513049 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Wed, 29 Jan 2025 13:26:08 +0900 Subject: [PATCH] add `projectService: undefined` --- src/common/parser-options.ts | 8 ++++++++ src/html/parser.ts | 1 + src/index.ts | 1 + src/script-setup/index.ts | 2 +- src/script/index.ts | 2 +- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/parser-options.ts b/src/common/parser-options.ts index d28504e..25656ab 100644 --- a/src/common/parser-options.ts +++ b/src/common/parser-options.ts @@ -30,6 +30,7 @@ export interface ParserOptions { lib?: string[] project?: string | string[] + projectService?: boolean | ProjectServiceOptions projectFolderIgnoreList?: string[] tsconfigRootDir?: string extraFileExtensions?: string[] @@ -55,6 +56,13 @@ export interface ParserOptions { > } +interface ProjectServiceOptions { + allowDefaultProject?: string[] + defaultProject?: string + loadTypeScriptPlugins?: boolean + maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number +} + export function isSFCFile(parserOptions: ParserOptions) { if (parserOptions.filePath === "") { return true diff --git a/src/html/parser.ts b/src/html/parser.ts index baccda4..367eecc 100644 --- a/src/html/parser.ts +++ b/src/html/parser.ts @@ -303,6 +303,7 @@ export class Parser { }, ), project: undefined, + projectService: undefined, } const scriptParserOptions = { ...this.baseParserOptions, diff --git a/src/index.ts b/src/index.ts index 703e44a..3b45a18 100644 --- a/src/index.ts +++ b/src/index.ts @@ -166,6 +166,7 @@ function parseAsSFC(code: string, options: ParserOptions) { yield getParserLangFromSFC(rootAST) }), project: undefined, + projectService: undefined, }) } result.ast.templateBody = templateBody diff --git a/src/script-setup/index.ts b/src/script-setup/index.ts index d620cb9..d336b0f 100644 --- a/src/script-setup/index.ts +++ b/src/script-setup/index.ts @@ -518,7 +518,7 @@ function getScriptSetupCodeBlocks( const { ast, visitorKeys } = parseScript( scriptCode, - { ...parserOptions, project: undefined }, + { ...parserOptions, project: undefined, projectService: undefined }, offsetLocationCalculator, ) diff --git a/src/script/index.ts b/src/script/index.ts index b8531d3..73c2810 100644 --- a/src/script/index.ts +++ b/src/script/index.ts @@ -1302,7 +1302,7 @@ export function parseGenericExpression( const result = parseScriptFragmentWithOption( scriptLet, locationCalculator.getSubCalculatorShift(-14), - { ...parserOptions, project: undefined }, + { ...parserOptions, project: undefined, projectService: undefined }, { preFixLocationProcess(preResult) { const params = getParams(preResult)