1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.repl = void 0;
|
4 | const common_1 = require("@nestjs/common");
|
5 | const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
|
6 | const nest_factory_1 = require("../nest-factory");
|
7 | const assign_to_object_util_1 = require("./assign-to-object.util");
|
8 | const constants_1 = require("./constants");
|
9 | const repl_context_1 = require("./repl-context");
|
10 | const repl_logger_1 = require("./repl-logger");
|
11 | async function repl(module) {
|
12 | const app = await nest_factory_1.NestFactory.createApplicationContext(module, {
|
13 | abortOnError: false,
|
14 | logger: new repl_logger_1.ReplLogger(),
|
15 | });
|
16 | await app.init();
|
17 | const replContext = new repl_context_1.ReplContext(app);
|
18 | common_1.Logger.log(constants_1.REPL_INITIALIZED_MESSAGE);
|
19 | const _repl = await Promise.resolve().then(() => require('repl'));
|
20 | const replServer = _repl.start({
|
21 | prompt: cli_colors_util_1.clc.green('> '),
|
22 | ignoreUndefined: true,
|
23 | });
|
24 | (0, assign_to_object_util_1.assignToObject)(replServer.context, replContext.globalScope);
|
25 | return replServer;
|
26 | }
|
27 | exports.repl = repl;
|