Lines Matching defs:const
3 const {
47 const { ERR_DEBUGGER_ERROR } = require('internal/errors').codes;
49 const { validateString, validateNumber } = require('internal/validators');
51 const FS = require('fs');
52 const Path = require('path');
53 const Repl = require('repl');
54 const vm = require('vm');
55 const { fileURLToPath } = require('internal/url');
57 const { customInspectSymbol, SideEffectFreeRegExpPrototypeSymbolReplace } = require('internal/util');
58 const { inspect: utilInspect } = require('internal/util/inspect');
59 const debuglog = require('internal/util/debuglog').debuglog('inspect');
61 const SHORTCUTS = {
73 const HELP = StringPrototypeTrim(`
114 const FUNCTION_NAME_PATTERN = /^(?:function\*? )?([^(\s]+)\(/;
116 const fnNameMatch =
121 const {
124 const NATIVES = internalBinding('natives');
134 const dir = StringPrototypeSlice(Path.join(Path.resolve(), 'x'), 0, -1);
136 const filename = StringPrototypeStartsWith(filenameOrURL, 'file://') ?
149 const s = n.toString();
150 const nchars = MathMax(2, String(maxN).length);
151 const nspaces = nchars - s.length;
159 const head = StringPrototypeSlice(sourceText, 0, position);
174 const m = RegExpPrototypeExec(/^\w+: ([^\n]+)/, stack);
179 const { className, description } = result;
180 const err = new ERR_DEBUGGER_ERROR(extractErrorMessage(description));
233 const values = ArrayPrototypeMap(this.entries, (entry) =>
241 const mappings = ArrayPrototypeMap(this.entries, (entry) => {
242 const key = utilInspect(new ObjectPreview(entry.key), opts);
243 const value = utilInspect(new ObjectPreview(entry.value), opts);
253 const props = ArrayPrototypeMap(this.properties, (prop, idx) => {
254 const value = utilInspect(new PropertyPreview(prop));
261 const singleLine = ArrayPrototypeJoin(props, ', ');
262 const propString = singleLine.length > 60 ? ArrayPrototypeJoin(props, ',\n ') : singleLine;
294 const fnName = extractFunctionName(this.description);
295 const formatted = `[${this.className}${fnName}]`;
308 const preview = utilInspect(new ObjectPreview(this.preview), opts);
334 const value = new RemoteObject(prop.value);
341 const type = StringPrototypeToUpperCase(this.type[0]) +
343 const name = this.name ? `<${this.name}>` : '';
344 const prefix = `${type}${name} `;
355 const desc = ReflectGetOwnPropertyDescriptor(source, prop);
362 const desc = ReflectGetOwnPropertyDescriptor(target, key);
368 const { Debugger, HeapProfiler, Profiler, Runtime } = inspector;
373 const history = { control: [], debug: [] };
374 const watchedExpressions = [];
375 const knownBreakpoints = [];
397 const INSPECT_OPTIONS = { colors: inspector.stdout.isTTY };
403 const text = typeof value === 'string' ? value : inspect(value);
427 const isCurrent = isCurrentScript(script);
428 const { isNative, url } = script;
429 const name = `${getRelativePath(url)}${isNative ? ' <native>' : ''}`;
441 const profiles = [];
448 const p = new Profile(profile);
454 const { startTime, endTime } = this.data;
455 const MU = StringFromCharCode(956);
460 const absoluteFile = Path.resolve(filename);
461 const json = JSONStringify(this.data);
475 const { scriptId, lineNumber, columnNumber, delta, scriptSource } = this;
476 const start = MathMax(1, lineNumber - delta + 1);
477 const end = lineNumber + delta + 1;
479 const lines = StringPrototypeSplit(scriptSource, '\n');
484 const i = start + offset;
485 const isCurrent = i === (lineNumber + 1);
487 const markedLine = isCurrent ?
512 const { scriptId } = location;
513 const { scriptSource } = await Debugger.getScriptSource({ scriptId });
529 const { objectId } = scope.object;
530 const { result } = await Runtime.getProperties({
547 const {
551 const name = functionName || '(anonymous)';
553 const script = knownScripts[scriptId];
554 const relativeUrl =
556 const frameLocation =
579 const match = RegExpPrototypeExec(/^\s*(?:exec|p)\s+([^\n]*)/, input);
594 const scopes = await selectedFrame.loadScopes();
621 const code = prepareControlCode(input);
622 const result = vm.runInContext(code, context, filename);
624 const then = result?.then;
657 const inspectValue = (expr) =>
660 const lastIndex = watchedExpressions.length - 1;
662 const values = await SafePromiseAllReturnArrayLike(watchedExpressions, inspectValue);
663 const lines = ArrayPrototypeMap(watchedExpressions, (expr, idx) => {
664 const prefix = `${leftPad(idx, ' ', lastIndex)}: ${expr} =`;
665 const value = inspect(values[idx]);
671 const valueList = ArrayPrototypeJoin(lines, '\n');
700 const script = knownScripts[location.scriptId];
701 const scriptUrl = script && script.url;
705 const isExisting = ArrayPrototypeSome(knownBreakpoints, (bp) => {
725 const script = knownScripts[location.scriptId];
726 const scriptUrl = script ? script.url : location.scriptUrl;
729 const breaklist = ArrayPrototypeJoin(
757 const location = {
770 const debugExpr = `debug(${script.slice(0, -2)})`;
771 const debugCall = selectedFrame ?
794 const scriptUrl = knownScripts[id].url;
814 const location = { scriptId, lineNumber: line - 1 };
820 const escapedPath = SideEffectFreeRegExpPrototypeSymbolReplace(/([/\\.?*()^${}|[\]])/g,
822 const urlRegex = `^(.*[\\/\\\\])?${escapedPath}$`;
845 const breakpoint = ArrayPrototypeFind(knownBreakpoints, ({ location }) => {
847 const script = knownScripts[location.scriptId];
861 const idx = ArrayPrototypeIndexOf(knownBreakpoints, breakpoint);
867 const lastBreakpoints = ArrayPrototypeSplice(knownBreakpoints, 0);
868 const newBreakpoints = ArrayPrototypeMap(
901 const { scriptId, lineNumber } = selectedFrame.location;
903 const breakType = reason === 'other' ? 'break' : reason;
904 const script = knownScripts[scriptId];
905 const scriptUrl = script ? getRelativePath(script.url) : '[unknown]';
907 const header = `${breakType} in ${scriptUrl}:${lineNumber + 1}`;
913 const breakContext = watcherList ?
930 const { scriptId, url } = script;
1029 const absoluteFile = Path.resolve(filename);
1030 const writer = FS.createWriteStream(absoluteFile);
1087 const index = ArrayPrototypeIndexOf(watchedExpressions, expr);
1098 const listeners = ArrayPrototypeSlice(repl.listeners('SIGINT'));
1101 const oldContext = repl.context;
1202 const replOptions = {