diff --git a/benchmarks/src/cluster.js b/benchmarks/src/cluster.js index 4e30acb..1eb51cc 100644 --- a/benchmarks/src/cluster.js +++ b/benchmarks/src/cluster.js @@ -1,4 +1,5 @@ import { fork } from 'node:child_process' +import * as path from 'node:path' import { createClient } from 'redis' import postgres from 'postgres' import * as promise from 'lib0/promise' @@ -14,7 +15,7 @@ import { sumProcessMetrics } from './metrics.js' * so a full sweep does not pay a boot per row. */ -const hubEntry = new URL('./proc/hub.js', import.meta.url).pathname +const hubEntry = path.join(import.meta.dirname, 'proc/hub.js') /** * @param {any} child diff --git a/benchmarks/src/index.js b/benchmarks/src/index.js index f0e89dc..1f5e610 100644 --- a/benchmarks/src/index.js +++ b/benchmarks/src/index.js @@ -1,3 +1,4 @@ +import * as path from 'node:path' import config from './config.js' import { Reporter, freeDiskGiB } from './report.js' import { stopCluster, reclaimStorage, takeTaskFailures } from './cluster.js' @@ -89,7 +90,7 @@ const run = async () => { } } await stopCluster() - const outPath = new URL('../' + config.run.outFile, import.meta.url).pathname + const outPath = path.join(import.meta.dirname, '..', config.run.outFile) report.write(outPath, derivedSection(report)) } diff --git a/benchmarks/src/suites/y1-primitives.js b/benchmarks/src/suites/y1-primitives.js index bae5c61..5e7f55b 100644 --- a/benchmarks/src/suites/y1-primitives.js +++ b/benchmarks/src/suites/y1-primitives.js @@ -1,4 +1,5 @@ import { fork } from 'node:child_process' +import * as path from 'node:path' import * as Y from '@y/y' import * as promise from 'lib0/promise' import { mergeUpdates } from '../../../src/y-utils.js' @@ -91,7 +92,7 @@ export const runY14 = () => { * cannot be made inside one process. */ const runNative = () => promise.create((resolve, reject) => { - const child = fork(new URL('../proc/y-native.js', import.meta.url).pathname, [], { + const child = fork(path.join(import.meta.dirname, '../proc/y-native.js'), [], { env: { ...process.env, USE_Y_NATIVE: '1' }, execArgv: ['--expose-gc', '--max-old-space-size=8192'], stdio: ['ignore', 'inherit', 'inherit', 'ipc'] diff --git a/benchmarks/src/trace.js b/benchmarks/src/trace.js index 4dcd223..e5b2681 100644 --- a/benchmarks/src/trace.js +++ b/benchmarks/src/trace.js @@ -1,4 +1,5 @@ import * as fs from 'node:fs' +import * as path from 'node:path' import * as decoding from 'lib0/decoding' import config from './config.js' @@ -19,7 +20,7 @@ import config from './config.js' * @typedef {{ type: string, updateFormat: string, gc: boolean, source: any, users: Array, totalBytes: number, updates: Array }} Trace */ -const tracePath = new URL(`../${config.trace.file}`, import.meta.url).pathname +const tracePath = path.join(import.meta.dirname, '..', config.trace.file) export const traceAvailable = () => fs.existsSync(tracePath)