88} from '@bytecodealliance/jco' ;
99import { spawnSync } from 'node:child_process' ;
1010import { tmpdir } from 'node:os' ;
11- import { resolve , join , dirname } from 'node:path' ;
11+ import { join , dirname } from 'node:path' ;
1212import { readFile , writeFile , mkdir , rm } from 'node:fs/promises' ;
1313import { rmSync , existsSync } from 'node:fs' ;
1414import { createHash } from 'node:crypto' ;
@@ -17,26 +17,13 @@ import {
1717 stubWasi ,
1818} from '../lib/spidermonkey-embedding-splicer.js' ;
1919import { fileURLToPath } from 'node:url' ;
20- import { cwd , stdout , platform } from 'node:process' ;
20+ import { cwd , stdout } from 'node:process' ;
21+
22+ import { maybeWindowsPath } from './platform.js' ;
23+
2124export const { version } = JSON . parse (
2225 await readFile ( new URL ( '../package.json' , import . meta. url ) , 'utf8' ) ,
2326) ;
24- const isWindows = platform === 'win32' ;
25-
26- function maybeWindowsPath ( path ) {
27- if ( ! path ) return path ;
28- const resolvedPath = resolve ( path ) ;
29- if ( ! isWindows ) return resolvedPath ;
30-
31- // Strip any existing UNC prefix check both the format we add as well as what
32- // the windows API returns when using path.resolve
33- let cleanPath = resolvedPath ;
34- while ( cleanPath . startsWith ( '\\\\?\\' ) || cleanPath . startsWith ( '//?/' ) ) {
35- cleanPath = cleanPath . substring ( 4 ) ;
36- }
37-
38- return '//?/' + cleanPath . replace ( / \\ / g, '/' ) ;
39- }
4027
4128/**
4229 * Clean up the given input string by removing the given patterns if
0 commit comments