1- import * as fs from 'fs' ;
2- import { join } from 'path' ;
1+ import * as fs from 'node:fs' ;
2+ import { promisify } from 'node:util' ;
3+ import { createServer } from 'node:http' ;
4+ import { join , dirname } from 'node:path' ;
5+ import { createRequire } from 'node:module' ;
6+ import { spawnSync , execFile } from 'node:child_process' ;
7+ import { fileURLToPath } from 'node:url' ;
8+
39import { send } from 'httpie' ;
410import * as mime from 'mrmime' ;
5- import { promisify } from 'util' ;
6- import { createServer } from 'http' ;
7- import * as child from 'child_process' ;
811import * as assert from 'uvu/assert' ;
9- import sirv from '../packages/sirv' ;
12+ import sirv from '../packages/sirv/index.mjs' ;
13+
14+ const require = createRequire ( import . meta. url ) ;
15+ const __filename = fileURLToPath ( import . meta. url ) ;
16+ const __dirname = dirname ( __filename ) ;
1017
1118const www = join ( __dirname , 'public' ) ;
1219const BIN = require . resolve ( '../packages/sirv-cli/bin.js' ) ;
@@ -31,13 +38,13 @@ export function http(opts) {
3138}
3239
3340export function exec ( ...argv ) {
34- return child . spawnSync ( 'node' , [ BIN , www , ...argv ] ) ;
41+ return spawnSync ( 'node' , [ BIN , www , ...argv ] ) ;
3542}
3643
3744export function spawn ( ...argv ) {
3845 return new Promise ( r => {
3946 let address , output = '' ;
40- let pid = child . execFile ( 'node' , [ BIN , www , ...argv ] ) ;
47+ let pid = execFile ( 'node' , [ BIN , www , ...argv ] ) ;
4148
4249 pid . stdout . on ( 'data' , x => {
4350 output += x . toString ( ) ;
0 commit comments