Skip to content

Commit 8e9a447

Browse files
committed
fix: edge function path parsing on windows
1 parent d520e83 commit 8e9a447

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

packages/mcp-server-supabase/src/edge-function.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { codeBlock } from 'common-tags';
2-
import { fileURLToPath } from 'url';
2+
import { fileURLToPath } from 'node:url';
33
import { extractFiles } from './eszip.js';
44
import {
55
assertSuccess,
@@ -84,11 +84,17 @@ export async function getFullEdgeFunction(
8484
const pathPrefix = getPathPrefix(deploymentId);
8585

8686
const entrypoint_path = edgeFunction.entrypoint_path
87-
? fileURLToPath(edgeFunction.entrypoint_path).replace(pathPrefix, '')
87+
? fileURLToPath(edgeFunction.entrypoint_path, { windows: false }).replace(
88+
pathPrefix,
89+
''
90+
)
8891
: undefined;
8992

9093
const import_map_path = edgeFunction.import_map_path
91-
? fileURLToPath(edgeFunction.import_map_path).replace(pathPrefix, '')
94+
? fileURLToPath(edgeFunction.import_map_path, { windows: false }).replace(
95+
pathPrefix,
96+
''
97+
)
9298
: undefined;
9399

94100
const eszipResponse = await managementApiClient.GET(

packages/mcp-server-supabase/src/eszip.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { build, Parser } from '@deno/eszip';
2-
import { join, relative } from 'node:path';
2+
import { join, relative } from 'node:path/posix';
33
import { fileURLToPath } from 'node:url';
44
import { z } from 'zod';
55

@@ -45,7 +45,10 @@ export async function extractFiles(
4545
const sourceMapString: string =
4646
await parser.getModuleSourceMap(specifier);
4747

48-
const filePath = relative(pathPrefix, fileURLToPath(specifier));
48+
const filePath = relative(
49+
pathPrefix,
50+
fileURLToPath(specifier, { windows: false })
51+
);
4952

5053
const file = new File([source], filePath, {
5154
type: 'text/plain',

packages/mcp-server-supabase/test/mocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PGlite, type PGliteInterface } from '@electric-sql/pglite';
22
import { format } from 'date-fns';
33
import { http, HttpResponse } from 'msw';
44
import { customAlphabet } from 'nanoid';
5-
import { join } from 'node:path';
5+
import { join } from 'node:path/posix';
66
import { expect } from 'vitest';
77
import { z } from 'zod';
88
import packageJson from '../package.json' with { type: 'json' };

0 commit comments

Comments
 (0)