Skip to content

Commit ccb31b5

Browse files
committed
fixup: repl not supported in startup snapshots
1 parent 3f2cc4e commit ccb31b5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/cli-repl/src/repl-paste-support.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Interface as ReadlineInterface } from 'readline';
2-
import { start as replStart, type REPLServer } from 'repl';
2+
import type { REPLServer } from 'repl';
33
import { PassThrough } from 'stream';
44

55
// https://github.com/nodejs/node/blob/d9786109b2a0982677135f0c146f6b591a0e4961/lib/internal/readline/utils.js#L90
@@ -72,9 +72,13 @@ export function installPasteSupport(repl: REPLServer): string {
7272
// Introduced by: https://github.com/nodejs/node/pull/59857
7373
// Fixed by: https://github.com/nodejs/node/pull/60470
7474
function _hasNode60446(): boolean {
75+
// repl is not supported in startup snapshots yet
76+
// eslint-disable-next-line @typescript-eslint/no-var-requires
77+
const { start } = require('repl');
78+
7579
const input = new PassThrough();
7680
const output = new PassThrough();
77-
const repl = replStart({ terminal: true, input, output, useColors: false });
81+
const repl = start({ terminal: true, input, output, useColors: false });
7882
repl.input.emit('data', '{}');
7983
repl.input.emit('keypress', '', { name: 'left' });
8084
repl.input.emit('data', 'node');

0 commit comments

Comments
 (0)