Skip to content

Commit

Permalink
Merge pull request #182 from davidchambers/node-options
Browse files Browse the repository at this point in the history
remove `--nodejs` option
  • Loading branch information
davidchambers authored Feb 17, 2024
2 parents 107e3d3 + 04fea4e commit b6d1bcb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
35 changes: 20 additions & 15 deletions bin/doctest
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@

'use strict';

const path = require ('path');
const {spawn} = require ('node:child_process');
const path = require ('node:path');
const process = require ('node:process');

const args = process.argv.slice (2);
const idx = args.indexOf ('--nodejs');
const flags = idx >= 0 && idx < args.length - 1;
const command = process.execPath;

require ('child_process')
.spawn (
process.execPath,
['--experimental-import-meta-resolve',
'--experimental-vm-modules',
...(flags ? args[idx + 1].split (/\s+/) : []),
'--',
path.resolve (__dirname, '..', 'lib', 'command.js'),
...(flags ? [...(args.slice (0, idx)), ...(args.slice (idx + 2))] : args)],
{cwd: process.cwd (), env: process.env, stdio: [0, 1, 2]}
)
const args = [
...process.execArgv,
'--experimental-import-meta-resolve',
'--experimental-vm-modules',
'--',
path.resolve (__dirname, '..', 'lib', 'command.js'),
...(process.argv.slice (2)),
];

const options = {
cwd: process.cwd (),
env: process.env,
stdio: [0, 1, 2],
};

spawn (command, args, options)
.on ('exit', process.exit);
2 changes: 0 additions & 2 deletions lib/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ program
'specify module system ("commonjs" or "esm")')
.option (' --coffee',
'parse CoffeeScript files')
.option (' --nodejs <options>',
'pass options directly to the "node" binary')
.option (' --prefix <prefix>',
'specify Transcribe-style prefix (e.g. ".")')
.option (' --opening-delimiter <delimiter>',
Expand Down

0 comments on commit b6d1bcb

Please sign in to comment.