From ad705c30fd7d81d03a9c4515d822402af3e00dac Mon Sep 17 00:00:00 2001 From: Michael Ferris Date: Sun, 27 Feb 2022 12:27:36 -0500 Subject: [PATCH] fix: fix Windows fileUri to resolve type definition --- .../graphql-language-service-server/src/GraphQLCache.ts | 2 +- .../src/MessageProcessor.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/graphql-language-service-server/src/GraphQLCache.ts b/packages/graphql-language-service-server/src/GraphQLCache.ts index f3af3f79430..b7d697ac665 100644 --- a/packages/graphql-language-service-server/src/GraphQLCache.ts +++ b/packages/graphql-language-service-server/src/GraphQLCache.ts @@ -363,7 +363,7 @@ export class GraphQLCache implements GraphQLCacheInterface { // the docs indicate that is what's there :shrug: const cacheEntry = globResult.statCache[filePath] as fs.Stats; return { - filePath: URI.parse(filePath).toString(), + filePath: URI.file(filePath).toString(), mtime: Math.trunc(cacheEntry.mtime.getTime() / 1000), size: cacheEntry.size, }; diff --git a/packages/graphql-language-service-server/src/MessageProcessor.ts b/packages/graphql-language-service-server/src/MessageProcessor.ts index ccd4b5a7654..60e53c71a8c 100644 --- a/packages/graphql-language-service-server/src/MessageProcessor.ts +++ b/packages/graphql-language-service-server/src/MessageProcessor.ts @@ -131,7 +131,7 @@ export class MessageProcessor { }; this._tmpDir = tmpDir || tmpdir(); this._tmpDirBase = path.join(this._tmpDir, 'graphql-language-service'); - this._tmpUriBase = URI.parse(this._tmpDirBase).toString(); + this._tmpUriBase = URI.file(this._tmpDirBase).toString(); this._loadConfigOptions = loadConfigOptions; if ( loadConfigOptions.extensions && @@ -833,7 +833,7 @@ export class MessageProcessor { const isFileUri = existsSync(uri); let version = 1; if (isFileUri) { - const schemaUri = URI.parse(path.join(project.dirpath, uri)).toString(); + const schemaUri = URI.file(path.join(project.dirpath, uri)).toString(); const schemaDocument = this._getCachedDocument(schemaUri); if (schemaDocument) { @@ -859,7 +859,7 @@ export class MessageProcessor { projectTmpPath = path.join(projectTmpPath, appendPath); } if (prependWithProtocol) { - return URI.parse(path.resolve(projectTmpPath)).toString(); + return URI.file(path.resolve(projectTmpPath)).toString(); } else { return path.resolve(projectTmpPath); } @@ -1014,7 +1014,7 @@ export class MessageProcessor { } // build full system URI path with protocol - const uri = URI.parse(filePath).toString(); + const uri = URI.file(filePath).toString(); // i would use the already existing graphql-config AST, but there are a few reasons we can't yet const contents = this._parser(document.rawSDL, uri);