File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- import { createRequire } from 'node:module' ;
4- import { dirname } from 'node:path' ;
53import process from 'node:process' ;
64import fs from 'node:fs' ;
7- import { fileURLToPath } from 'node:url' ;
85import http from 'node:http' ;
6+ import { fileURLToPath } from 'node:url' ;
7+ import { dirname } from 'node:path' ;
8+ import info from '../package.json' with {
9+ type : 'json' ,
10+ } ;
11+ import bin from '../json/bin.json' with {
12+ type : 'json' ,
13+ } ;
914
1015const __filename = fileURLToPath ( import . meta. url ) ;
1116const __dirname = dirname ( __filename ) ;
12- const require = createRequire ( import . meta. url ) ;
1317const [ name ] = process . argv . slice ( 2 ) ;
1418
1519if ( ! name )
@@ -52,9 +56,9 @@ async function main(name) {
5256 app
5357 . use ( express . static ( DIR ) )
5458 . use ( deepword ( {
55- diff : true ,
56- zip : true ,
57- } ) ) ;
59+ diff : true ,
60+ zip : true ,
61+ } ) ) ;
5862
5963 server . listen ( port , ip ) ;
6064
@@ -87,18 +91,14 @@ function checkFile(name, callback) {
8791}
8892
8993function version ( ) {
90- console . log ( `v${ info ( ) . version } ` ) ;
94+ console . log ( `v${ info . version } ` ) ;
9195}
9296
93- const info = ( ) => require ( '../package' ) ;
94-
9597function usage ( ) {
96- console . log ( `Usage: ${ info ( ) . name } [filename]` ) ;
98+ console . log ( `Usage: ${ info . name } [filename]` ) ;
9799}
98100
99101function help ( ) {
100- const bin = require ( '../json/bin' ) ;
101-
102102 usage ( ) ;
103103 console . log ( 'Options:' ) ;
104104
You can’t perform that action at this time.
0 commit comments