From 28343f4c042dfedcff79fd0b5f6b62862b38dae9 Mon Sep 17 00:00:00 2001 From: KazariEX <1364035137@qq.com> Date: Fri, 30 Aug 2024 00:03:06 +0800 Subject: [PATCH] fix: apply snake case on globalTypes filename --- packages/component-meta/lib/base.ts | 2 +- packages/language-core/lib/codegen/script/index.ts | 2 +- packages/language-server/lib/initialize.ts | 2 +- packages/tsc/index.ts | 2 +- packages/tsc/tests/dts.spec.ts | 2 +- packages/typescript-plugin/index.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/component-meta/lib/base.ts b/packages/component-meta/lib/base.ts index cda971c749..047ed8f423 100644 --- a/packages/component-meta/lib/base.ts +++ b/packages/component-meta/lib/base.ts @@ -137,7 +137,7 @@ export function baseCreate( const fileExists = languageServiceHost.fileExists.bind(languageServiceHost); const getScriptSnapshot = languageServiceHost.getScriptSnapshot.bind(languageServiceHost); - const globalTypesName = `__globalTypes_${commandLine.vueOptions.target}_${commandLine.vueOptions.strictTemplates}.d.ts`; + const globalTypesName = `__global_types_${commandLine.vueOptions.target}_${commandLine.vueOptions.strictTemplates}.d.ts`; const snapshots = new Map(); languageServiceHost.fileExists = path => { if (path.endsWith(globalTypesName)) { diff --git a/packages/language-core/lib/codegen/script/index.ts b/packages/language-core/lib/codegen/script/index.ts index 30dccd3426..ee20660573 100644 --- a/packages/language-core/lib/codegen/script/index.ts +++ b/packages/language-core/lib/codegen/script/index.ts @@ -51,7 +51,7 @@ export interface ScriptCodegenOptions { export function* generateScript(options: ScriptCodegenOptions): Generator { const ctx = createScriptCodegenContext(options); - yield `/// ${newLine}`; + yield `/// ${newLine}`; if (options.sfc.script?.src) { yield* generateSrc(options.sfc.script, options.sfc.script.src); diff --git a/packages/language-server/lib/initialize.ts b/packages/language-server/lib/initialize.ts index cb2db4cccd..d8cb42ec11 100644 --- a/packages/language-server/lib/initialize.ts +++ b/packages/language-server/lib/initialize.ts @@ -52,7 +52,7 @@ export function initialize( project.vue = { compilerOptions: vueCompilerOptions }; if (project.typescript) { - const globalTypesName = `__globalTypes_${vueCompilerOptions.target}_${vueCompilerOptions.strictTemplates}.d.ts`; + const globalTypesName = `__global_types_${vueCompilerOptions.target}_${vueCompilerOptions.strictTemplates}.d.ts`; const fileExists = project.typescript.languageServiceHost.fileExists.bind(project.typescript.languageServiceHost); const getScriptSnapshot = project.typescript.languageServiceHost.getScriptSnapshot.bind(project.typescript.languageServiceHost); const snapshots = new Map(); diff --git a/packages/tsc/index.ts b/packages/tsc/index.ts index 865d09ca10..34552d449e 100644 --- a/packages/tsc/index.ts +++ b/packages/tsc/index.ts @@ -27,7 +27,7 @@ export function run(tscPath = require.resolve('typescript/lib/tsc')) { : options.host?.getCurrentDirectory() ?? ts.sys.getCurrentDirectory(); const libDir = require.resolve(`${vueOptions.lib}/package.json`, { paths: [rootDir] }) .slice(0, -'package.json'.length); - const globalTypesPath = `${libDir}dist/__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`; + const globalTypesPath = `${libDir}dist/__global_types_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`; const globalTypesContents = vue.generateGlobalTypes(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates); ts.sys.writeFile(globalTypesPath, globalTypesContents); } catch { } diff --git a/packages/tsc/tests/dts.spec.ts b/packages/tsc/tests/dts.spec.ts index 0554dfdcc7..ea25fb86f6 100644 --- a/packages/tsc/tests/dts.spec.ts +++ b/packages/tsc/tests/dts.spec.ts @@ -37,7 +37,7 @@ describe('vue-tsc-dts', () => { : options.host?.getCurrentDirectory() ?? ts.sys.getCurrentDirectory(); const libDir = require.resolve(`${vueOptions.lib}/package.json`, { paths: [rootDir] }) .slice(0, -'package.json'.length); - const globalTypesPath = `${libDir}dist/__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`; + const globalTypesPath = `${libDir}dist/__global_types_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`; const globalTypesContents = vue.generateGlobalTypes(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates); ts.sys.writeFile(globalTypesPath, globalTypesContents); } catch { } diff --git a/packages/typescript-plugin/index.ts b/packages/typescript-plugin/index.ts index 677f6528a2..32f5b4e040 100644 --- a/packages/typescript-plugin/index.ts +++ b/packages/typescript-plugin/index.ts @@ -63,7 +63,7 @@ const plugin: ts.server.PluginModuleFactory = mods => { try { const libDir = require.resolve(`${options.lib}/package.json`, { paths: [proj.getCurrentDirectory()] }) .slice(0, -'package.json'.length); - const globalTypesPath = `${libDir}dist/__globalTypes_${options.target}_${options.strictTemplates}.d.ts`; + const globalTypesPath = `${libDir}dist/__global_types_${options.target}_${options.strictTemplates}.d.ts`; const globalTypesContents = vue.generateGlobalTypes(options.lib, options.target, options.strictTemplates); proj.writeFile(globalTypesPath, globalTypesContents); } catch { }