Skip to content

Commit 408dca1

Browse files
committed
refactor(language-core): update path import to use posix style
1 parent b14b8a9 commit 408dca1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/component-meta/lib/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TypeScriptProjectHost, createLanguageServiceHost, resolveFileLanguageId } from '@volar/typescript';
22
import * as vue from '@vue/language-core';
3-
import * as path from 'path-browserify';
3+
import { posix as path } from 'path-browserify';
44
import type * as ts from 'typescript';
55
import { code as typeHelpersCode } from 'vue-component-type-helpers';
66
import { code as vue2TypeHelpersCode } from 'vue-component-type-helpers/vue2';

packages/language-core/lib/plugins/vue-tsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Mapping } from '@volar/language-core';
22
import { computed } from 'computeds';
3-
import * as path from 'path-browserify';
3+
import { posix as path } from 'path-browserify';
44
import { generateScript } from '../codegen/script';
55
import { generateTemplate } from '../codegen/template';
66
import { parseScriptRanges } from '../parsers/scriptRanges';

packages/language-core/lib/utils/ts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { camelize } from '@vue/shared';
22
import type * as ts from 'typescript';
3-
import * as path from 'path-browserify';
3+
import { posix as path } from 'path-browserify';
44
import type { RawVueCompilerOptions, VueCompilerOptions, VueLanguagePlugin } from '../types';
55
import { getAllExtensions } from '../languagePlugin';
66
import { generateGlobalTypes } from '../codegen/globalTypes';
@@ -287,14 +287,14 @@ export function setupGlobalTypes(rootDir: string, vueOptions: VueCompilerOptions
287287
}
288288
try {
289289
let dir = rootDir;
290-
while (!host.fileExists(path.resolve(dir, `node_modules/${vueOptions.lib}/package.json`))) {
291-
const parentDir = path.resolve(dir, '..');
290+
while (!host.fileExists(path.join(dir, 'node_modules', vueOptions.lib, 'package.json'))) {
291+
const parentDir = path.dirname(dir);
292292
if (dir === parentDir) {
293293
throw 0;
294294
}
295295
dir = parentDir;
296296
}
297-
const globalTypesPath = path.resolve(dir, `node_modules/.vue-global-types/${vueOptions.lib}_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`);
297+
const globalTypesPath = path.join(dir, 'node_modules', '.vue-global-types', `${vueOptions.lib}_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`);
298298
const globalTypesContents = `// @ts-nocheck\nexport {};\n` + generateGlobalTypes(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates);
299299
host.writeFile(globalTypesPath, globalTypesContents);
300300
return true;

packages/language-service/lib/plugins/vue-document-drop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VueVirtualCode, forEachEmbeddedCode } from '@vue/language-core';
22
import { camelize, capitalize, hyphenate } from '@vue/shared';
3-
import * as path from 'path-browserify';
3+
import { posix as path } from 'path-browserify';
44
import { getUserPreferences } from 'volar-service-typescript/lib/configs/getUserPreferences';
55
import type * as vscode from 'vscode-languageserver-protocol';
66
import { URI } from 'vscode-uri';

0 commit comments

Comments
 (0)