iobroker.javascript 8.9.2 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/admin/assets/{createSvgIcon-BdRvDw53.js → createSvgIcon-BQT-7-GS.js} +1 -1
- package/admin/assets/{docs-6na4NFtj.js → docs-BrInh2Pn.js} +2 -2
- package/admin/assets/index-BzKS5vx-.js +1329 -0
- package/admin/assets/index-CfuHVX2B.js +193 -0
- package/admin/assets/index-CuCs5aLs.js +5 -0
- package/admin/assets/index-tExaxF69.js +930 -0
- package/admin/assets/inheritsLoose--KnFDOw1.js +36 -0
- package/admin/assets/{useTheme-Cl1QmYFL.js → useTheme-DF6qfrtI.js} +1 -1
- package/admin/custom/assets/{Components-ChpTW7sE.js → Components-D9kRsHNY.js} +1 -1
- package/admin/custom/assets/{DefaultPropsProvider-CHpMCMgA.js → DefaultPropsProvider-9qubdy-V.js} +2 -2
- package/admin/custom/assets/{FilledInput-CtcQVKyj.js → FilledInput-BpuM_GyB.js} +1 -1
- package/admin/custom/assets/Tabs-CvEv0KOT.js +138 -0
- package/admin/custom/assets/ThemeProvider-DZTpMR8n.js +29 -0
- package/admin/custom/assets/{createSvgIcon-C_vAELFU.js → createSvgIcon-BQThUM-f.js} +1 -1
- package/admin/custom/assets/hostInit-CrAs5YZS.js +1 -1
- package/admin/custom/assets/index-BXmu6lpn.js +904 -0
- package/admin/custom/assets/{index-DwsbskQy.js → index-DIWNdd4a.js} +1 -1
- package/admin/custom/assets/index-DZqbj5K4.js +55 -0
- package/admin/custom/assets/{index-D5apCzjJ.js → index-Dbe-II7_.js} +6 -6
- package/admin/custom/assets/index-sawv1cUe.js +1399 -0
- package/admin/custom/assets/{virtualExposes-BPncCdUy.js → virtualExposes-BMKIjWrE.js} +2 -2
- package/admin/custom/customComponents.js +2 -2
- package/admin/custom/i18n/de.json +29 -29
- package/admin/custom/i18n/es.json +29 -29
- package/admin/custom/i18n/fr.json +29 -29
- package/admin/custom/i18n/it.json +29 -29
- package/admin/custom/i18n/nl.json +29 -29
- package/admin/custom/i18n/pl.json +29 -29
- package/admin/custom/i18n/pt.json +29 -29
- package/admin/custom/i18n/ru.json +29 -29
- package/admin/custom/i18n/uk.json +29 -29
- package/admin/custom/i18n/zh-cn.json +29 -29
- package/admin/google-blockly/blockly_compressed.js +875 -887
- package/admin/google-blockly/blocks_compressed.js +38 -41
- package/admin/google-blockly/javascript_compressed.js +19 -54
- package/admin/google-blockly/media/delete-icon.svg +1 -0
- package/admin/google-blockly/media/foldout-icon.svg +1 -0
- package/admin/google-blockly/media/resize-handle.svg +3 -0
- package/admin/i18n/de.json +61 -0
- package/admin/i18n/en.json +61 -0
- package/admin/i18n/es.json +61 -0
- package/admin/i18n/fr.json +61 -0
- package/admin/i18n/it.json +61 -0
- package/admin/i18n/nl.json +61 -0
- package/admin/i18n/pl.json +61 -0
- package/admin/i18n/pt.json +61 -0
- package/admin/i18n/ru.json +61 -0
- package/admin/i18n/uk.json +61 -0
- package/admin/i18n/zh-cn.json +61 -0
- package/admin/jsonConfig.json +2 -0
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +4 -4
- package/admin/vsFont/README.md +1 -1
- package/admin/vsFont/createJson.js +1 -1
- package/build-backend/lib/consts.js +346 -0
- package/build-backend/lib/consts.js.map +1 -0
- package/build-backend/lib/convert.js +120 -0
- package/build-backend/lib/convert.js.map +1 -0
- package/build-backend/lib/debug.js +163 -0
- package/build-backend/lib/debug.js.map +1 -0
- package/{lib → build-backend/lib}/debugger.js +261 -232
- package/build-backend/lib/debugger.js.map +1 -0
- package/build-backend/lib/eventObj.js +177 -0
- package/build-backend/lib/eventObj.js.map +1 -0
- package/build-backend/lib/inspect.js +728 -0
- package/build-backend/lib/inspect.js.map +1 -0
- package/build-backend/lib/javascript.d.ts +1972 -0
- package/{lib → build-backend/lib}/mirror.js +185 -182
- package/build-backend/lib/mirror.js.map +1 -0
- package/build-backend/lib/nodeModulesManagement.js +25 -0
- package/build-backend/lib/nodeModulesManagement.js.map +1 -0
- package/build-backend/lib/patternCompareFunctions.js +321 -0
- package/build-backend/lib/patternCompareFunctions.js.map +1 -0
- package/build-backend/lib/protectFs.js +477 -0
- package/build-backend/lib/protectFs.js.map +1 -0
- package/build-backend/lib/request.js +89 -0
- package/build-backend/lib/request.js.map +1 -0
- package/{lib → build-backend/lib}/sandbox.js +2046 -1852
- package/build-backend/lib/sandbox.js.map +1 -0
- package/build-backend/lib/scheduler.js +553 -0
- package/build-backend/lib/scheduler.js.map +1 -0
- package/build-backend/lib/tools.js +183 -0
- package/build-backend/lib/tools.js.map +1 -0
- package/build-backend/lib/typescriptSettings.js +39 -0
- package/build-backend/lib/typescriptSettings.js.map +1 -0
- package/build-backend/lib/typescriptTools.js +435 -0
- package/build-backend/lib/typescriptTools.js.map +1 -0
- package/build-backend/lib/utils.js +66 -0
- package/build-backend/lib/utils.js.map +1 -0
- package/{lib → build-backend/lib}/words.js +23 -30
- package/build-backend/lib/words.js.map +1 -0
- package/build-backend/main.js +2671 -0
- package/build-backend/main.js.map +1 -0
- package/build-backend/types.d.ts +742 -0
- package/docs/de/README.md +1 -1
- package/docs/en/README.md +1 -1
- package/docs/en/javascript.md +10 -6
- package/docs/en/upgrade-guide.md +5 -2
- package/docs/ru/README.md +1 -1
- package/install/installTypings.js +34 -47
- package/io-package.json +14 -14
- package/package.json +14 -14
- package/admin/assets/index-DCkkMRRa.js +0 -1335
- package/admin/assets/index-DJfSBoBB.js +0 -192
- package/admin/assets/index-DTiA4WdK.js +0 -930
- package/admin/assets/index-qABB1JVe.js +0 -5
- package/admin/assets/inheritsLoose-BW-3V39H.js +0 -36
- package/admin/custom/assets/Tabs-C1KOyWRi.js +0 -137
- package/admin/custom/assets/ThemeProvider-Buvx5nSd.js +0 -29
- package/admin/custom/assets/index-BGCRznKh.js +0 -904
- package/admin/custom/assets/index-DfBPYXqA.js +0 -55
- package/admin/custom/assets/index-jIr6kOLK.js +0 -1398
- package/admin/i18n/de/flat.txt +0 -427
- package/admin/i18n/de/translations.json +0 -429
- package/admin/i18n/en/flat.txt +0 -427
- package/admin/i18n/en/translations.json +0 -429
- package/admin/i18n/es/flat.txt +0 -427
- package/admin/i18n/es/translations.json +0 -429
- package/admin/i18n/flat.txt +0 -427
- package/admin/i18n/fr/flat.txt +0 -427
- package/admin/i18n/fr/translations.json +0 -429
- package/admin/i18n/it/flat.txt +0 -427
- package/admin/i18n/it/translations.json +0 -429
- package/admin/i18n/nl/flat.txt +0 -427
- package/admin/i18n/nl/translations.json +0 -429
- package/admin/i18n/pl/flat.txt +0 -427
- package/admin/i18n/pl/translations.json +0 -429
- package/admin/i18n/pt/flat.txt +0 -427
- package/admin/i18n/pt/translations.json +0 -429
- package/admin/i18n/ru/flat.txt +0 -427
- package/admin/i18n/ru/translations.json +0 -429
- package/admin/i18n/uk/flat.txt +0 -427
- package/admin/i18n/uk/translations.json +0 -429
- package/admin/i18n/zh-cn/flat.txt +0 -427
- package/admin/i18n/zh-cn/translations.json +0 -429
- package/lib/adapter-config.d.ts +0 -16
- package/lib/consts.js +0 -83
- package/lib/convert.js +0 -106
- package/lib/debug.js +0 -154
- package/lib/eventObj.js +0 -201
- package/lib/inspect.js +0 -688
- package/lib/javascript.d.ts +0 -1858
- package/lib/nodeModulesManagement.js +0 -26
- package/lib/patternCompareFunctions.js +0 -391
- package/lib/protectFs.js +0 -401
- package/lib/request.js +0 -72
- package/lib/scheduler.js +0 -447
- package/lib/tools.js +0 -192
- package/lib/typescriptSettings.js +0 -44
- package/lib/typescriptTools.js +0 -529
- package/lib/utils.js +0 -87
- package/main.js +0 -2653
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createRepl;
|
|
1
4
|
/*
|
|
2
5
|
* Copyright Node.js contributors. All rights reserved.
|
|
3
6
|
*
|
|
@@ -19,16 +22,13 @@
|
|
|
19
22
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
20
23
|
* IN THE SOFTWARE.
|
|
21
24
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const debuglog = util.debuglog('inspect');
|
|
31
|
-
|
|
25
|
+
const node_path_1 = require("node:path");
|
|
26
|
+
const repl_1 = require("repl");
|
|
27
|
+
const node_util_1 = require("node:util");
|
|
28
|
+
const node_vm_1 = require("node:vm");
|
|
29
|
+
const node_url_1 = require("node:url");
|
|
30
|
+
const node_module_1 = require("node:module");
|
|
31
|
+
const debuglog = (0, node_util_1.debuglog)('inspect');
|
|
32
32
|
/*const SHORTCUTS = {
|
|
33
33
|
cont: 'c',
|
|
34
34
|
next: 'n',
|
|
@@ -78,78 +78,66 @@ profiles[n].save(filepath = 'node.cpuprofile')
|
|
|
78
78
|
takeHeapSnapshot(filepath = 'node.heapsnapshot')
|
|
79
79
|
Take a heap snapshot and save to disk as JSON.
|
|
80
80
|
`.trim();*/
|
|
81
|
-
|
|
82
81
|
const FUNCTION_NAME_PATTERN = /^(?:function\*? )?([^(\s]+)\(/;
|
|
83
82
|
function extractFunctionName(description) {
|
|
84
|
-
const fnNameMatch = description
|
|
83
|
+
const fnNameMatch = description?.match(FUNCTION_NAME_PATTERN);
|
|
85
84
|
return fnNameMatch ? `: ${fnNameMatch[1]}` : '';
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const NATIVES =
|
|
86
|
+
// process.binding is a method available on the process object, which allows you to load internal modules written in C++
|
|
87
|
+
// @ts-expect-error binding is internal function
|
|
88
|
+
const NATIVES = node_module_1.builtinModules ? process.binding('natives') : {};
|
|
90
89
|
function isNativeUrl(url) {
|
|
91
90
|
url = url.replace(/\.js$/, '');
|
|
92
|
-
if (
|
|
93
|
-
if (url.startsWith('internal/') ||
|
|
91
|
+
if (node_module_1.builtinModules) {
|
|
92
|
+
if (url.startsWith('internal/') || node_module_1.builtinModules.includes(url)) {
|
|
94
93
|
return true;
|
|
94
|
+
}
|
|
95
95
|
}
|
|
96
|
-
|
|
97
96
|
return url in NATIVES || url === 'bootstrap_node';
|
|
98
97
|
}
|
|
99
|
-
|
|
100
98
|
function getRelativePath(filenameOrURL) {
|
|
101
|
-
const dir =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
fileURLToPath(filenameOrURL) : filenameOrURL;
|
|
105
|
-
|
|
106
|
-
// Change path to relative, if possible
|
|
99
|
+
const dir = (0, node_path_1.join)((0, node_path_1.resolve)(), 'x').slice(0, -1);
|
|
100
|
+
const filename = filenameOrURL.startsWith('file://') ? (0, node_url_1.fileURLToPath)(filenameOrURL) : filenameOrURL;
|
|
101
|
+
// Change a path to relative, if possible
|
|
107
102
|
if (filename.indexOf(dir) === 0) {
|
|
108
103
|
return filename.slice(dir.length);
|
|
109
104
|
}
|
|
110
105
|
return filename;
|
|
111
106
|
}
|
|
112
|
-
|
|
113
107
|
function toCallback(promise, callback) {
|
|
114
108
|
function forward(...args) {
|
|
115
109
|
process.nextTick(() => callback(...args));
|
|
116
110
|
}
|
|
117
111
|
promise.then(forward.bind(null, null), forward);
|
|
118
112
|
}
|
|
119
|
-
|
|
120
113
|
// Adds spaces and prefix to number
|
|
121
114
|
// maxN is a maximum number we should have space for
|
|
122
115
|
function leftPad(n, prefix, maxN) {
|
|
123
116
|
const s = n.toString();
|
|
124
117
|
const nchars = Math.max(2, String(maxN).length) + 1;
|
|
125
118
|
const nspaces = nchars - s.length - 1;
|
|
126
|
-
|
|
127
119
|
return prefix + ' '.repeat(nspaces) + s;
|
|
128
120
|
}
|
|
129
|
-
|
|
130
121
|
function markSourceColumn(sourceText, position, useColors) {
|
|
131
122
|
if (!sourceText) {
|
|
132
123
|
return '';
|
|
133
124
|
}
|
|
134
|
-
|
|
135
125
|
const head = sourceText.slice(0, position);
|
|
136
126
|
let tail = sourceText.slice(position);
|
|
137
|
-
|
|
138
127
|
// Colorize char if stdout supports colours
|
|
139
128
|
if (useColors) {
|
|
140
129
|
tail = tail.replace(/(.+?)([^\w]|$)/, '\u001b[32m$1\u001b[39m$2');
|
|
141
130
|
}
|
|
142
|
-
|
|
143
131
|
// Return source line with coloured char at `position`
|
|
144
132
|
return [head, tail].join('');
|
|
145
133
|
}
|
|
146
|
-
|
|
147
134
|
function extractErrorMessage(stack) {
|
|
148
|
-
if (!stack)
|
|
135
|
+
if (!stack) {
|
|
136
|
+
return '<unknown>';
|
|
137
|
+
}
|
|
149
138
|
const m = stack.match(/^\w+: ([^\n]+)/);
|
|
150
139
|
return m ? m[1] : stack;
|
|
151
140
|
}
|
|
152
|
-
|
|
153
141
|
function convertResultToError(result) {
|
|
154
142
|
const { className, description } = result;
|
|
155
143
|
const err = new Error(extractErrorMessage(description));
|
|
@@ -157,37 +145,41 @@ function convertResultToError(result) {
|
|
|
157
145
|
Object.defineProperty(err, 'name', { value: className });
|
|
158
146
|
return err;
|
|
159
147
|
}
|
|
160
|
-
|
|
161
148
|
class RemoteObject {
|
|
149
|
+
type;
|
|
150
|
+
subtype;
|
|
151
|
+
className;
|
|
152
|
+
value;
|
|
153
|
+
unserializableValue;
|
|
154
|
+
description;
|
|
155
|
+
objectId;
|
|
156
|
+
preview;
|
|
157
|
+
customPreview;
|
|
162
158
|
constructor(attributes) {
|
|
159
|
+
this.type = 'undefined';
|
|
163
160
|
Object.assign(this, attributes);
|
|
164
161
|
if (this.type === 'number') {
|
|
165
|
-
this.value =
|
|
166
|
-
this.unserializableValue ? +this.unserializableValue : +this.value;
|
|
162
|
+
this.value = this.unserializableValue ? +this.unserializableValue : +this.value;
|
|
167
163
|
}
|
|
168
164
|
}
|
|
169
|
-
|
|
170
|
-
[util.inspect.custom](depth, opts) {
|
|
165
|
+
[node_util_1.inspect.custom](_depth, opts) {
|
|
171
166
|
function formatProperty(prop) {
|
|
172
167
|
switch (prop.type) {
|
|
173
168
|
case 'string':
|
|
174
169
|
case 'undefined':
|
|
175
|
-
return
|
|
176
|
-
|
|
170
|
+
return (0, node_util_1.inspect)(prop.value, opts);
|
|
177
171
|
case 'number':
|
|
178
172
|
case 'boolean':
|
|
179
173
|
return opts.stylize(prop.value, prop.type);
|
|
180
|
-
|
|
181
174
|
case 'object':
|
|
182
175
|
case 'symbol':
|
|
183
176
|
if (prop.subtype === 'date') {
|
|
184
|
-
return
|
|
177
|
+
return (0, node_util_1.inspect)(new Date(prop.value), opts);
|
|
185
178
|
}
|
|
186
179
|
if (prop.subtype === 'array') {
|
|
187
180
|
return opts.stylize(prop.value, 'special');
|
|
188
181
|
}
|
|
189
182
|
return opts.stylize(prop.value, prop.subtype || 'special');
|
|
190
|
-
|
|
191
183
|
default:
|
|
192
184
|
return prop.value;
|
|
193
185
|
}
|
|
@@ -197,87 +189,99 @@ class RemoteObject {
|
|
|
197
189
|
case 'number':
|
|
198
190
|
case 'string':
|
|
199
191
|
case 'undefined':
|
|
200
|
-
return
|
|
201
|
-
|
|
192
|
+
return (0, node_util_1.inspect)(this.value, opts);
|
|
202
193
|
case 'symbol':
|
|
203
194
|
return opts.stylize(this.description, 'special');
|
|
204
|
-
|
|
205
195
|
case 'function': {
|
|
206
196
|
const fnName = extractFunctionName(this.description);
|
|
207
197
|
const formatted = `[${this.className}${fnName}]`;
|
|
208
198
|
return opts.stylize(formatted, 'special');
|
|
209
199
|
}
|
|
210
|
-
|
|
211
200
|
case 'object':
|
|
212
201
|
switch (this.subtype) {
|
|
213
202
|
case 'date':
|
|
214
|
-
return
|
|
215
|
-
|
|
203
|
+
return (0, node_util_1.inspect)(new Date(this.description), opts);
|
|
216
204
|
case 'null':
|
|
217
|
-
return
|
|
218
|
-
|
|
205
|
+
return (0, node_util_1.inspect)(null, opts);
|
|
219
206
|
case 'regexp':
|
|
220
207
|
return opts.stylize(this.description, 'regexp');
|
|
221
|
-
|
|
222
208
|
default:
|
|
223
209
|
break;
|
|
224
210
|
}
|
|
225
211
|
if (this.preview) {
|
|
226
|
-
const props = this.preview.properties
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
212
|
+
const props = this.preview.properties.map((prop, idx) => {
|
|
213
|
+
const value = formatProperty(prop);
|
|
214
|
+
if (prop.name === `${idx}`) {
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
return `${prop.name}: ${value}`;
|
|
218
|
+
});
|
|
232
219
|
if (this.preview.overflow) {
|
|
233
220
|
props.push('...');
|
|
234
221
|
}
|
|
235
222
|
const singleLine = props.join(', ');
|
|
236
|
-
const propString =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return this.subtype === 'array' ?
|
|
240
|
-
`[ ${propString} ]` : `{ ${propString} }`;
|
|
223
|
+
const propString = singleLine.length > 60 ? props.join(',\n ') : singleLine;
|
|
224
|
+
return this.subtype === 'array' ? `[ ${propString} ]` : `{ ${propString} }`;
|
|
241
225
|
}
|
|
242
|
-
return this.description;
|
|
243
|
-
|
|
226
|
+
return this.description || '';
|
|
244
227
|
default:
|
|
245
|
-
return this.description;
|
|
228
|
+
return this.description || '';
|
|
246
229
|
}
|
|
247
230
|
}
|
|
248
|
-
|
|
249
231
|
static fromEvalResult({ result, wasThrown }) {
|
|
250
|
-
if (wasThrown)
|
|
232
|
+
if (wasThrown) {
|
|
233
|
+
return convertResultToError(result);
|
|
234
|
+
}
|
|
251
235
|
return new RemoteObject(result);
|
|
252
236
|
}
|
|
253
237
|
}
|
|
254
|
-
|
|
255
238
|
class ScopeSnapshot {
|
|
239
|
+
/**
|
|
240
|
+
* Scope type.
|
|
241
|
+
*/
|
|
242
|
+
type;
|
|
243
|
+
/**
|
|
244
|
+
* Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
|
|
245
|
+
*/
|
|
246
|
+
object;
|
|
247
|
+
name;
|
|
248
|
+
/**
|
|
249
|
+
* Location in the source code where scope starts
|
|
250
|
+
*/
|
|
251
|
+
startLocation;
|
|
252
|
+
/**
|
|
253
|
+
* Location in the source code where scope ends
|
|
254
|
+
*/
|
|
255
|
+
endLocation;
|
|
256
|
+
properties;
|
|
257
|
+
completionGroup;
|
|
256
258
|
constructor(scope, properties) {
|
|
259
|
+
this.type = scope.type;
|
|
260
|
+
this.object = scope.object;
|
|
257
261
|
Object.assign(this, scope);
|
|
258
|
-
this.properties = new Map(properties.map(
|
|
262
|
+
this.properties = new Map(properties.map(prop => {
|
|
259
263
|
const value = new RemoteObject(prop.value);
|
|
260
264
|
return [prop.name, value];
|
|
261
265
|
}));
|
|
262
|
-
this.completionGroup = properties.map(
|
|
266
|
+
this.completionGroup = properties.map(prop => prop.name);
|
|
263
267
|
}
|
|
264
|
-
|
|
265
|
-
[util.inspect.custom](depth, opts) {
|
|
268
|
+
[node_util_1.inspect.custom](_depth, opts) {
|
|
266
269
|
const type = `${this.type[0].toUpperCase()}${this.type.slice(1)}`;
|
|
267
270
|
const name = this.name ? `<${this.name}>` : '';
|
|
268
271
|
const prefix = `${type}${name} `;
|
|
269
|
-
return
|
|
270
|
-
.replace(/^Map /, prefix);
|
|
272
|
+
return (0, node_util_1.inspect)(this.properties, opts).replace(/^Map /, prefix);
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
|
-
|
|
274
|
-
function copyOwnProperties(target, source) {
|
|
275
|
-
Object.getOwnPropertyNames(source).forEach(
|
|
275
|
+
/*
|
|
276
|
+
function copyOwnProperties(target: any, source: any): void {
|
|
277
|
+
Object.getOwnPropertyNames(source).forEach(prop => {
|
|
276
278
|
const descriptor = Object.getOwnPropertyDescriptor(source, prop);
|
|
277
|
-
|
|
279
|
+
if (descriptor) {
|
|
280
|
+
Object.defineProperty(target, prop, descriptor);
|
|
281
|
+
}
|
|
278
282
|
});
|
|
279
283
|
}
|
|
280
|
-
|
|
284
|
+
|
|
281
285
|
function aliasProperties(target, mapping) {
|
|
282
286
|
Object.keys(mapping).forEach((key) => {
|
|
283
287
|
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
@@ -287,77 +291,71 @@ function aliasProperties(target, mapping) {
|
|
|
287
291
|
*/
|
|
288
292
|
function createRepl(inspector) {
|
|
289
293
|
const { Debugger, /*HeapProfiler, Profiler,*/ Runtime } = inspector;
|
|
290
|
-
|
|
291
|
-
let repl; // eslint-disable-line prefer-const
|
|
292
|
-
|
|
294
|
+
let repl;
|
|
293
295
|
// Things we want to keep around
|
|
294
296
|
// const history = { control: [], debug: [] };
|
|
295
297
|
// const watchedExpressions = [];
|
|
296
298
|
// const knownBreakpoints = [];
|
|
297
299
|
// let pauseOnExceptionState = 'none';
|
|
298
300
|
let lastCommand;
|
|
299
|
-
|
|
300
301
|
// Things we need to reset when the app restarts
|
|
301
|
-
let knownScripts;
|
|
302
|
+
let knownScripts = {};
|
|
302
303
|
let currentBacktrace;
|
|
303
304
|
let selectedFrame;
|
|
304
305
|
let exitDebugRepl;
|
|
305
|
-
|
|
306
306
|
function resetOnStart() {
|
|
307
307
|
knownScripts = {};
|
|
308
|
-
currentBacktrace =
|
|
309
|
-
selectedFrame =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
308
|
+
currentBacktrace = undefined;
|
|
309
|
+
selectedFrame = undefined;
|
|
310
|
+
if (exitDebugRepl) {
|
|
311
|
+
exitDebugRepl();
|
|
312
|
+
}
|
|
313
|
+
exitDebugRepl = undefined;
|
|
313
314
|
}
|
|
314
315
|
resetOnStart();
|
|
315
|
-
|
|
316
316
|
const INSPECT_OPTIONS = { colors: inspector.stdout.isTTY };
|
|
317
317
|
function inspect(value) {
|
|
318
|
-
return
|
|
318
|
+
return (0, node_util_1.inspect)(value, INSPECT_OPTIONS);
|
|
319
319
|
}
|
|
320
|
-
|
|
321
320
|
function print(value, oneline = false) {
|
|
322
321
|
const text = typeof value === 'string' ? value : inspect(value);
|
|
323
322
|
return inspector.print(text, oneline);
|
|
324
323
|
}
|
|
325
|
-
|
|
326
324
|
function getCurrentLocation() {
|
|
327
325
|
if (!selectedFrame) {
|
|
328
326
|
throw new Error('Requires execution to be paused');
|
|
329
327
|
}
|
|
330
328
|
return selectedFrame.location;
|
|
331
329
|
}
|
|
332
|
-
|
|
333
330
|
function isCurrentScript(script) {
|
|
334
|
-
return selectedFrame && getCurrentLocation().scriptId === script.scriptId;
|
|
331
|
+
return !!selectedFrame && getCurrentLocation().scriptId === script.scriptId;
|
|
335
332
|
}
|
|
336
|
-
|
|
337
333
|
function formatScripts(displayNatives = false) {
|
|
338
334
|
function isVisible(script) {
|
|
339
|
-
if (displayNatives)
|
|
335
|
+
if (displayNatives) {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
340
338
|
return !script.isNative || isCurrentScript(script);
|
|
341
339
|
}
|
|
342
|
-
|
|
343
340
|
return Object.keys(knownScripts)
|
|
344
|
-
.map(
|
|
341
|
+
.map(scriptId => knownScripts[scriptId])
|
|
345
342
|
.filter(isVisible)
|
|
346
|
-
.map(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
343
|
+
.map(script => {
|
|
344
|
+
const isCurrent = isCurrentScript(script);
|
|
345
|
+
const { isNative, url } = script;
|
|
346
|
+
const name = `${getRelativePath(url)}${isNative ? ' <native>' : ''}`;
|
|
347
|
+
return `${isCurrent ? '*' : ' '} ${script.scriptId}: ${name}`;
|
|
348
|
+
})
|
|
352
349
|
.join('\n');
|
|
353
350
|
}
|
|
354
351
|
function listScripts(displayNatives = false) {
|
|
355
352
|
print(formatScripts(displayNatives));
|
|
356
353
|
}
|
|
357
|
-
|
|
354
|
+
// @ts-expect-error no idea what this is
|
|
355
|
+
listScripts[node_util_1.inspect.custom] = function listWithoutInternal() {
|
|
358
356
|
return formatScripts();
|
|
359
357
|
};
|
|
360
|
-
/*
|
|
358
|
+
/*
|
|
361
359
|
const profiles = [];
|
|
362
360
|
class Profile {
|
|
363
361
|
constructor(data) {
|
|
@@ -384,101 +382,137 @@ function createRepl(inspector) {
|
|
|
384
382
|
}
|
|
385
383
|
*/
|
|
386
384
|
class SourceSnippet {
|
|
385
|
+
scriptSource;
|
|
386
|
+
/**
|
|
387
|
+
* Script identifier as reported in the <code>Debugger.scriptParsed</code>.
|
|
388
|
+
*/
|
|
389
|
+
scriptId;
|
|
390
|
+
/**
|
|
391
|
+
* Line number in the script (0-based).
|
|
392
|
+
*/
|
|
393
|
+
lineNumber;
|
|
394
|
+
/**
|
|
395
|
+
* Column number in the script (0-based).
|
|
396
|
+
*/
|
|
397
|
+
columnNumber;
|
|
398
|
+
delta;
|
|
387
399
|
constructor(location, delta, scriptSource) {
|
|
388
|
-
|
|
400
|
+
this.lineNumber = location.lineNumber;
|
|
401
|
+
this.columnNumber = location.columnNumber || 0;
|
|
402
|
+
this.scriptId = location.scriptId;
|
|
389
403
|
this.scriptSource = scriptSource;
|
|
390
404
|
this.delta = delta;
|
|
405
|
+
Object.assign(this, location);
|
|
391
406
|
}
|
|
392
|
-
|
|
393
|
-
[util.inspect.custom](depth, options) {
|
|
407
|
+
[node_util_1.inspect.custom](_depth, options) {
|
|
394
408
|
const { /* scriptId, */ lineNumber, columnNumber, delta, scriptSource } = this;
|
|
395
409
|
const start = Math.max(1, lineNumber - delta + 1);
|
|
396
410
|
const end = lineNumber + delta + 1;
|
|
397
|
-
|
|
398
411
|
const lines = scriptSource.split('\n');
|
|
399
|
-
return lines
|
|
412
|
+
return lines
|
|
413
|
+
.slice(start - 1, end)
|
|
414
|
+
.map((lineText, offset) => {
|
|
400
415
|
const i = start + offset;
|
|
401
|
-
const isCurrent = i ===
|
|
402
|
-
|
|
403
|
-
const markedLine = isCurrent
|
|
404
|
-
? markSourceColumn(lineText, columnNumber, options.colors)
|
|
405
|
-
: lineText;
|
|
406
|
-
|
|
416
|
+
const isCurrent = i === lineNumber + 1;
|
|
417
|
+
const markedLine = isCurrent ? markSourceColumn(lineText, columnNumber, options.colors) : lineText;
|
|
407
418
|
/*
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
let isBreakpoint = false;
|
|
420
|
+
knownBreakpoints.forEach(({ location }) => {
|
|
421
|
+
if (!location) return;
|
|
422
|
+
if (scriptId === location.scriptId &&
|
|
423
|
+
i === (location.lineNumber + 1)) {
|
|
424
|
+
isBreakpoint = true;
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
*/
|
|
418
428
|
let prefixChar = ' ';
|
|
419
429
|
if (isCurrent) {
|
|
420
430
|
prefixChar = '>';
|
|
421
431
|
} /*else if (isBreakpoint) {
|
|
422
|
-
|
|
423
|
-
|
|
432
|
+
prefixChar = '*';
|
|
433
|
+
}*/
|
|
424
434
|
return `${leftPad(i, prefixChar, end)} ${markedLine}`;
|
|
425
|
-
})
|
|
435
|
+
})
|
|
436
|
+
.join('\n');
|
|
426
437
|
}
|
|
427
438
|
}
|
|
428
|
-
|
|
429
439
|
function getSourceSnippet(location, delta = 5) {
|
|
430
440
|
const { scriptId } = location;
|
|
431
|
-
return Debugger.getScriptSource({ scriptId })
|
|
432
|
-
.then(({ scriptSource }) =>
|
|
433
|
-
new SourceSnippet(location, delta, scriptSource));
|
|
441
|
+
return Debugger.getScriptSource({ scriptId }).then(({ scriptSource }) => new SourceSnippet(location, delta, scriptSource));
|
|
434
442
|
}
|
|
435
|
-
|
|
436
443
|
class CallFrame {
|
|
444
|
+
/**
|
|
445
|
+
* Call frame identifier. This identifier is only valid while the virtual machine is paused.
|
|
446
|
+
*/
|
|
447
|
+
callFrameId;
|
|
448
|
+
/**
|
|
449
|
+
* Name of the JavaScript function called on this call frame.
|
|
450
|
+
*/
|
|
451
|
+
functionName;
|
|
452
|
+
/**
|
|
453
|
+
* Location in the source code.
|
|
454
|
+
*/
|
|
455
|
+
functionLocation;
|
|
456
|
+
/**
|
|
457
|
+
* Location in the source code.
|
|
458
|
+
*/
|
|
459
|
+
location;
|
|
460
|
+
/**
|
|
461
|
+
* JavaScript script name or url.
|
|
462
|
+
*/
|
|
463
|
+
url;
|
|
464
|
+
/**
|
|
465
|
+
* Scope chain for this call frame.
|
|
466
|
+
*/
|
|
467
|
+
scopeChain;
|
|
468
|
+
/**
|
|
469
|
+
* <code>this</code> object for this call frame.
|
|
470
|
+
*/
|
|
471
|
+
this;
|
|
472
|
+
/**
|
|
473
|
+
* The value being returned if the function is at return point.
|
|
474
|
+
*/
|
|
475
|
+
returnValue;
|
|
437
476
|
constructor(callFrame) {
|
|
477
|
+
this.functionName = callFrame.functionName;
|
|
478
|
+
this.url = callFrame.url;
|
|
479
|
+
this.scopeChain = callFrame.scopeChain;
|
|
480
|
+
this.this = callFrame.this;
|
|
481
|
+
this.returnValue = callFrame.returnValue;
|
|
482
|
+
this.location = callFrame.location;
|
|
483
|
+
this.callFrameId = callFrame.callFrameId;
|
|
438
484
|
Object.assign(this, callFrame);
|
|
439
485
|
}
|
|
440
|
-
|
|
441
486
|
loadScopes() {
|
|
442
|
-
return Promise.all(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
);
|
|
487
|
+
return Promise.all(this.scopeChain
|
|
488
|
+
.filter(scope => scope.type !== 'global')
|
|
489
|
+
.map(scope => {
|
|
490
|
+
const { objectId } = scope.object;
|
|
491
|
+
return Runtime.getProperties({
|
|
492
|
+
objectId,
|
|
493
|
+
generatePreview: true,
|
|
494
|
+
}).then(({ result }) => {
|
|
495
|
+
return new ScopeSnapshot(scope, result);
|
|
496
|
+
});
|
|
497
|
+
}));
|
|
454
498
|
}
|
|
455
|
-
|
|
456
499
|
list(delta = 5) {
|
|
457
500
|
return getSourceSnippet(this.location, delta);
|
|
458
501
|
}
|
|
459
502
|
}
|
|
460
|
-
|
|
461
503
|
class Backtrace extends Array {
|
|
462
|
-
[
|
|
504
|
+
[node_util_1.inspect.custom]() {
|
|
463
505
|
return this.map((callFrame, idx) => {
|
|
464
|
-
const {
|
|
465
|
-
location: { scriptId, lineNumber, columnNumber },
|
|
466
|
-
functionName
|
|
467
|
-
} = callFrame;
|
|
506
|
+
const { location: { scriptId, lineNumber, columnNumber }, functionName, } = callFrame;
|
|
468
507
|
const name = functionName || '(anonymous)';
|
|
469
|
-
|
|
470
508
|
const script = knownScripts[scriptId];
|
|
471
|
-
const relativeUrl =
|
|
472
|
-
|
|
473
|
-
const frameLocation =
|
|
474
|
-
`${relativeUrl}:${lineNumber + 1}:${columnNumber}`;
|
|
475
|
-
|
|
509
|
+
const relativeUrl = (script && getRelativePath(script.url)) || '<unknown>';
|
|
510
|
+
const frameLocation = `${relativeUrl}:${lineNumber + 1}:${columnNumber}`;
|
|
476
511
|
return `#${idx} ${name} ${frameLocation}`;
|
|
477
512
|
}).join('\n');
|
|
478
513
|
}
|
|
479
|
-
|
|
480
514
|
static from(callFrames) {
|
|
481
|
-
return super.from(Array.from(callFrames).map(
|
|
515
|
+
return super.from(Array.from(callFrames).map(callFrame => {
|
|
482
516
|
if (callFrame instanceof CallFrame) {
|
|
483
517
|
return callFrame;
|
|
484
518
|
}
|
|
@@ -486,19 +520,20 @@ function createRepl(inspector) {
|
|
|
486
520
|
}));
|
|
487
521
|
}
|
|
488
522
|
}
|
|
489
|
-
|
|
490
523
|
function prepareControlCode(input) {
|
|
491
|
-
if (input === '\n')
|
|
524
|
+
if (input === '\n') {
|
|
525
|
+
return lastCommand;
|
|
526
|
+
}
|
|
492
527
|
// exec process.title => exec("process.title");
|
|
493
528
|
const match = input.match(/^\s*exec\s+([^\n]*)/);
|
|
494
529
|
if (match) {
|
|
495
530
|
lastCommand = `exec(${JSON.stringify(match[1])})`;
|
|
496
|
-
}
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
497
533
|
lastCommand = input;
|
|
498
534
|
}
|
|
499
535
|
return lastCommand;
|
|
500
536
|
}
|
|
501
|
-
|
|
502
537
|
// function evalInCurrentContext(code) {
|
|
503
538
|
// // Repl asked for scope variables
|
|
504
539
|
// if (code === '.scope') {
|
|
@@ -524,28 +559,25 @@ function createRepl(inspector) {
|
|
|
524
559
|
// generatePreview: true,
|
|
525
560
|
// }).then(RemoteObject.fromEvalResult);
|
|
526
561
|
// }
|
|
527
|
-
|
|
528
562
|
function controlEval(input, context, filename, callback) {
|
|
529
563
|
debuglog('eval:', input);
|
|
530
564
|
function returnToCallback(error, result) {
|
|
531
565
|
debuglog('end-eval:', input, error);
|
|
532
566
|
callback(error, result);
|
|
533
567
|
}
|
|
534
|
-
|
|
535
568
|
try {
|
|
536
569
|
const code = prepareControlCode(input);
|
|
537
|
-
const result =
|
|
538
|
-
|
|
570
|
+
const result = (0, node_vm_1.runInContext)(code, context, filename);
|
|
539
571
|
if (result && typeof result.then === 'function') {
|
|
540
572
|
toCallback(result, returnToCallback);
|
|
541
573
|
return;
|
|
542
574
|
}
|
|
543
575
|
returnToCallback(null, result);
|
|
544
|
-
}
|
|
576
|
+
}
|
|
577
|
+
catch (e) {
|
|
545
578
|
returnToCallback(e);
|
|
546
579
|
}
|
|
547
580
|
}
|
|
548
|
-
|
|
549
581
|
// function debugEval(input, context, filename, callback) {
|
|
550
582
|
// debuglog('eval:', input);
|
|
551
583
|
// function returnToCallback(error, result) {
|
|
@@ -565,7 +597,6 @@ function createRepl(inspector) {
|
|
|
565
597
|
// returnToCallback(e);
|
|
566
598
|
// }
|
|
567
599
|
// }
|
|
568
|
-
|
|
569
600
|
/*function formatWatchers(verbose = false) {
|
|
570
601
|
if (!watchedExpressions.length) {
|
|
571
602
|
return Promise.resolve('');
|
|
@@ -594,11 +625,9 @@ function createRepl(inspector) {
|
|
|
594
625
|
return verbose ? `Watchers:\n${valueList}\n` : valueList;
|
|
595
626
|
});
|
|
596
627
|
}*/
|
|
597
|
-
|
|
598
628
|
//function watchers(verbose = false) {
|
|
599
629
|
// return formatWatchers(verbose).then(print);
|
|
600
630
|
//}
|
|
601
|
-
|
|
602
631
|
// List source code
|
|
603
632
|
// function list(delta = 5) {
|
|
604
633
|
// return selectedFrame.list(delta)
|
|
@@ -607,7 +636,6 @@ function createRepl(inspector) {
|
|
|
607
636
|
// throw error;
|
|
608
637
|
// });
|
|
609
638
|
// }
|
|
610
|
-
|
|
611
639
|
//function handleBreakpointResolved({ breakpointId, location }) {
|
|
612
640
|
// const script = knownScripts[location.scriptId];
|
|
613
641
|
// const scriptUrl = script && script.url;
|
|
@@ -625,7 +653,6 @@ function createRepl(inspector) {
|
|
|
625
653
|
// knownBreakpoints.push({ breakpointId, location });
|
|
626
654
|
// }
|
|
627
655
|
//}
|
|
628
|
-
|
|
629
656
|
// function listBreakpoints() {
|
|
630
657
|
// if (!knownBreakpoints.length) {
|
|
631
658
|
// print('No breakpoints yet');
|
|
@@ -643,7 +670,6 @@ function createRepl(inspector) {
|
|
|
643
670
|
// .join('\n');
|
|
644
671
|
// print(breaklist);
|
|
645
672
|
// }
|
|
646
|
-
|
|
647
673
|
// function setBreakpoint(script, line, condition, silent) {
|
|
648
674
|
// function registerBreakpoint({ breakpointId, actualLocation }) {
|
|
649
675
|
// handleBreakpointResolved({ breakpointId, location: actualLocation });
|
|
@@ -778,53 +804,45 @@ function createRepl(inspector) {
|
|
|
778
804
|
// print(`${results.length} breakpoints restored.`);
|
|
779
805
|
// });
|
|
780
806
|
// }
|
|
781
|
-
|
|
782
807
|
// function setPauseOnExceptions(state) {
|
|
783
808
|
// return Debugger.setPauseOnExceptions({ state })
|
|
784
809
|
// .then(() => {
|
|
785
810
|
// pauseOnExceptionState = state;
|
|
786
811
|
// });
|
|
787
812
|
// }
|
|
788
|
-
|
|
789
|
-
|
|
813
|
+
Debugger.on('paused', (data) => {
|
|
814
|
+
const callFrames = data.callFrames;
|
|
815
|
+
const reason = data.reason;
|
|
790
816
|
if (process.env.NODE_INSPECT_RESUME_ON_START === '1' && reason === 'Break on start') {
|
|
791
817
|
debuglog('Paused on start, but NODE_INSPECT_RESUME_ON_START environment variable is set to 1, resuming');
|
|
792
818
|
inspector.client.callMethod('Debugger.resume');
|
|
793
819
|
return;
|
|
794
820
|
}
|
|
795
|
-
|
|
796
821
|
// Save execution context's data
|
|
797
822
|
currentBacktrace = Backtrace.from(callFrames);
|
|
798
823
|
selectedFrame = currentBacktrace[0];
|
|
799
824
|
const { scriptId, lineNumber } = selectedFrame.location;
|
|
800
|
-
|
|
801
825
|
const breakType = reason === 'other' ? 'break' : reason;
|
|
802
826
|
const script = knownScripts[scriptId];
|
|
803
827
|
const scriptUrl = script ? getRelativePath(script.url) : '[unknown]';
|
|
804
|
-
|
|
805
828
|
const header = `${breakType} in ${scriptUrl}:${lineNumber + 1}`;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
}));
|
|
829
|
+
void inspector.suspendReplWhile(() => Promise.all([/*formatWatchers(true), */ selectedFrame?.list(3)])
|
|
830
|
+
.then(([/*watcherList, */ context]) => {
|
|
831
|
+
/*if (watcherList) {
|
|
832
|
+
return `${watcherList}\n${inspect(context)}`;
|
|
833
|
+
}*/
|
|
834
|
+
return inspect(context);
|
|
835
|
+
})
|
|
836
|
+
.then(breakContext => {
|
|
837
|
+
print(`${header}\n${breakContext}`);
|
|
838
|
+
}));
|
|
817
839
|
});
|
|
818
|
-
|
|
819
840
|
function handleResumed() {
|
|
820
|
-
currentBacktrace =
|
|
821
|
-
selectedFrame =
|
|
841
|
+
currentBacktrace = undefined;
|
|
842
|
+
selectedFrame = undefined;
|
|
822
843
|
}
|
|
823
|
-
|
|
824
844
|
Debugger.on('resumed', handleResumed);
|
|
825
|
-
|
|
826
845
|
//Debugger.on('breakpointResolved', handleBreakpointResolved);
|
|
827
|
-
|
|
828
846
|
Debugger.on('scriptParsed', (script) => {
|
|
829
847
|
const { scriptId, url } = script;
|
|
830
848
|
if (url) {
|
|
@@ -833,7 +851,6 @@ function createRepl(inspector) {
|
|
|
833
851
|
}, script);
|
|
834
852
|
}
|
|
835
853
|
});
|
|
836
|
-
|
|
837
854
|
/*Profiler.on('consoleProfileFinished', ({ profile }) => {
|
|
838
855
|
Profile.createAndRegister({ profile });
|
|
839
856
|
print([
|
|
@@ -841,17 +858,35 @@ function createRepl(inspector) {
|
|
|
841
858
|
`Access it with profiles[${profiles.length - 1}]`
|
|
842
859
|
].join('\n'));
|
|
843
860
|
});*/
|
|
844
|
-
|
|
845
861
|
function initializeContext(context) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
862
|
+
Object.defineProperty(context, 'Debugger', {
|
|
863
|
+
value: inspector.Debugger,
|
|
864
|
+
enumerable: true,
|
|
865
|
+
configurable: true,
|
|
866
|
+
// @ts-expect-error fix later
|
|
867
|
+
writeable: false,
|
|
868
|
+
});
|
|
869
|
+
Object.defineProperty(context, 'HeapProfiler', {
|
|
870
|
+
value: inspector.HeapProfiler,
|
|
871
|
+
enumerable: true,
|
|
872
|
+
configurable: true,
|
|
873
|
+
// @ts-expect-error fix later
|
|
874
|
+
writeable: false,
|
|
875
|
+
});
|
|
876
|
+
Object.defineProperty(context, 'Profiler', {
|
|
877
|
+
value: inspector.Profiler,
|
|
878
|
+
enumerable: true,
|
|
879
|
+
configurable: true,
|
|
880
|
+
// @ts-expect-error fix later
|
|
881
|
+
writeable: false,
|
|
882
|
+
});
|
|
883
|
+
Object.defineProperty(context, 'Runtime', {
|
|
884
|
+
value: inspector.Runtime,
|
|
885
|
+
enumerable: true,
|
|
886
|
+
configurable: true,
|
|
887
|
+
// @ts-expect-error fix later
|
|
888
|
+
writeable: false,
|
|
853
889
|
});
|
|
854
|
-
|
|
855
890
|
/*copyOwnProperties(context, {
|
|
856
891
|
get help() {
|
|
857
892
|
print(HELP);
|
|
@@ -1059,7 +1094,6 @@ function createRepl(inspector) {
|
|
|
1059
1094
|
});*/
|
|
1060
1095
|
//aliasProperties(context, SHORTCUTS);
|
|
1061
1096
|
}
|
|
1062
|
-
|
|
1063
1097
|
function initAfterStart() {
|
|
1064
1098
|
const setupTasks = [
|
|
1065
1099
|
Runtime.enable(),
|
|
@@ -1075,15 +1109,13 @@ function createRepl(inspector) {
|
|
|
1075
1109
|
];
|
|
1076
1110
|
return Promise.all(setupTasks);
|
|
1077
1111
|
}
|
|
1078
|
-
|
|
1079
1112
|
return function startRepl() {
|
|
1080
|
-
inspector.client.on('close', () =>
|
|
1081
|
-
resetOnStart();
|
|
1082
|
-
});
|
|
1113
|
+
inspector.client.on('close', () => resetOnStart());
|
|
1083
1114
|
inspector.client.on('ready', () => {
|
|
1084
|
-
initAfterStart()
|
|
1115
|
+
initAfterStart().catch(err => {
|
|
1116
|
+
print(`Error starting inspector: ${err.message}`);
|
|
1117
|
+
});
|
|
1085
1118
|
});
|
|
1086
|
-
|
|
1087
1119
|
const replOptions = {
|
|
1088
1120
|
prompt: 'debug> ',
|
|
1089
1121
|
input: inspector.stdin,
|
|
@@ -1092,21 +1124,18 @@ function createRepl(inspector) {
|
|
|
1092
1124
|
useGlobal: false,
|
|
1093
1125
|
ignoreUndefined: true,
|
|
1094
1126
|
};
|
|
1095
|
-
|
|
1096
|
-
repl = Repl.start(replOptions); // eslint-disable-line prefer-const
|
|
1127
|
+
repl = (0, repl_1.start)(replOptions);
|
|
1097
1128
|
initializeContext(repl.context);
|
|
1098
1129
|
repl.on('reset', initializeContext);
|
|
1099
|
-
|
|
1100
1130
|
repl.defineCommand('interrupt', () => {
|
|
1101
1131
|
// We want this for testing purposes where sending CTRL-C can be tricky.
|
|
1102
1132
|
repl.emit('SIGINT');
|
|
1103
1133
|
});
|
|
1104
|
-
|
|
1105
1134
|
// Init once for the initial connection
|
|
1106
|
-
initAfterStart()
|
|
1107
|
-
|
|
1135
|
+
initAfterStart().catch(err => {
|
|
1136
|
+
print(`Error starting inspector: ${err.message}`);
|
|
1137
|
+
});
|
|
1108
1138
|
return repl;
|
|
1109
1139
|
};
|
|
1110
1140
|
}
|
|
1111
|
-
|
|
1112
|
-
module.exports = createRepl;
|
|
1141
|
+
//# sourceMappingURL=debugger.js.map
|