44} from 'fs' ;
55import { parseArgs } from 'util' ;
66
7+ process . chdir ( import . meta. dirname ) ;
78const argv = parseArgs ( {
89 options : {
910 forceRemote : {
@@ -50,6 +51,9 @@ function redirectMissingFile(
5051 if ( canUseLocal && existsSync ( './lib/engine262/lib/engine262.mjs' ) ) {
5152 res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
5253 res . end ( 'export * from "/lib/engine262/lib/engine262.mjs";' ) ;
54+ } else if ( canUseLocal && existsSync ( '../lib/engine262.mjs' ) ) {
55+ res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
56+ res . end ( readFileSync ( '../lib/engine262.mjs' , 'utf8' ) ) ;
5357 } else {
5458 logLocalBuild ( ) ;
5559 res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
@@ -61,6 +65,9 @@ function redirectMissingFile(
6165 if ( canUseLocal && existsSync ( './lib/engine262/lib/engine262.js' ) ) {
6266 res . writeHead ( 302 , { Location : '/lib/engine262/lib/engine262.js' } ) ;
6367 res . end ( ) ;
68+ } else if ( canUseLocal && existsSync ( '../lib/engine262.js' ) ) {
69+ res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
70+ res . end ( readFileSync ( '../lib/engine262.js' , 'utf8' ) ) ;
6471 } else {
6572 logLocalBuild ( ) ;
6673 res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
@@ -72,6 +79,9 @@ function redirectMissingFile(
7279 if ( canUseLocal && existsSync ( './lib/engine262/lib/inspector.mjs' ) ) {
7380 res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
7481 res . end ( 'export * from "/lib/engine262/lib/inspector.mjs";' ) ;
82+ } else if ( canUseLocal && existsSync ( '../lib/inspector.mjs' ) ) {
83+ res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
84+ res . end ( readFileSync ( '../lib/inspector.mjs' , 'utf8' ) ) ;
7585 } else {
7686 logLocalBuild ( ) ;
7787 res . writeHead ( 200 , { 'Content-Type' : 'application/javascript; charset=UTF-8' } ) ;
0 commit comments