@dcloudio/uni-vue-devtools 3.0.0-3061320221209001
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/dist/runtime.es.js +130 -0
- package/dist/uni.compiler.js +84 -0
- package/lib/app/backend.js +10934 -0
- package/lib/app/hook.js +3963 -0
- package/lib/front/app.html +60 -0
- package/lib/front/devtools.js +118049 -0
- package/lib/front/icons/128.png +0 -0
- package/lib/front/icons/favicon.ico +0 -0
- package/lib/front/server.js +111 -0
- package/lib/mp/backend.js +11001 -0
- package/lib/mp/hook.js +3962 -0
- package/lib/web/backend.js +10958 -0
- package/lib/web/hook.js +3958 -0
- package/package.json +31 -0
package/lib/app/hook.js
ADDED
|
@@ -0,0 +1,3963 @@
|
|
|
1
|
+
/******/ var __webpack_modules__ = ({
|
|
2
|
+
|
|
3
|
+
/***/ "../app-backend-core/lib/hook.js":
|
|
4
|
+
/*!***************************************!*\
|
|
5
|
+
!*** ../app-backend-core/lib/hook.js ***!
|
|
6
|
+
\***************************************/
|
|
7
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
// this script is injected into every page.
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
12
|
+
value: true
|
|
13
|
+
}));
|
|
14
|
+
exports.installHook = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Install the hook on window, which is an event emitter.
|
|
17
|
+
* Note because Chrome content scripts cannot directly modify the window object,
|
|
18
|
+
* we are evaling this function by inserting a script tag. That's why we have
|
|
19
|
+
* to inline the whole event emitter implementation here.
|
|
20
|
+
*
|
|
21
|
+
* @param {Window|global} target
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function installHook(target, isIframe = false) {
|
|
25
|
+
const devtoolsVersion = '6.0';
|
|
26
|
+
let listeners = {};
|
|
27
|
+
|
|
28
|
+
function injectIframeHook(iframe) {
|
|
29
|
+
if (iframe.__vdevtools__injected) return;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
iframe.__vdevtools__injected = true;
|
|
33
|
+
|
|
34
|
+
const inject = () => {
|
|
35
|
+
try {
|
|
36
|
+
iframe.contentWindow.__VUE_DEVTOOLS_IFRAME__ = iframe;
|
|
37
|
+
const script = iframe.contentDocument.createElement('script');
|
|
38
|
+
script.textContent = ';(' + installHook.toString() + ')(window, true)';
|
|
39
|
+
iframe.contentDocument.documentElement.appendChild(script);
|
|
40
|
+
script.parentNode.removeChild(script);
|
|
41
|
+
} catch (e) {// Ignore
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
inject();
|
|
46
|
+
iframe.addEventListener('load', () => inject());
|
|
47
|
+
} catch (e) {// Ignore
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let iframeChecks = 0;
|
|
52
|
+
|
|
53
|
+
function injectToIframes() {
|
|
54
|
+
if (typeof window === 'undefined') return;
|
|
55
|
+
const iframes = document.querySelectorAll('iframe:not([data-vue-devtools-ignore])');
|
|
56
|
+
|
|
57
|
+
for (const iframe of iframes) {
|
|
58
|
+
injectIframeHook(iframe);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
injectToIframes();
|
|
63
|
+
const iframeTimer = setInterval(() => {
|
|
64
|
+
injectToIframes();
|
|
65
|
+
iframeChecks++;
|
|
66
|
+
|
|
67
|
+
if (iframeChecks >= 5) {
|
|
68
|
+
clearInterval(iframeTimer);
|
|
69
|
+
}
|
|
70
|
+
}, 1000);
|
|
71
|
+
|
|
72
|
+
if (Object.prototype.hasOwnProperty.call(target, '__VUE_DEVTOOLS_GLOBAL_HOOK__')) {
|
|
73
|
+
if (target.__VUE_DEVTOOLS_GLOBAL_HOOK__.devtoolsVersion !== devtoolsVersion) {
|
|
74
|
+
console.error(`Another version of Vue Devtools seems to be installed. Please enable only one version at a time.`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let hook;
|
|
81
|
+
|
|
82
|
+
if (isIframe) {
|
|
83
|
+
const sendToParent = cb => {
|
|
84
|
+
try {
|
|
85
|
+
const hook = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
86
|
+
|
|
87
|
+
if (hook) {
|
|
88
|
+
return cb(hook);
|
|
89
|
+
} else {
|
|
90
|
+
console.warn('[Vue Devtools] No hook in parent window');
|
|
91
|
+
}
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.warn('[Vue Devtools] Failed to send message to parent window', e);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
hook = {
|
|
98
|
+
devtoolsVersion,
|
|
99
|
+
|
|
100
|
+
// eslint-disable-next-line accessor-pairs
|
|
101
|
+
set Vue(value) {
|
|
102
|
+
sendToParent(hook => {
|
|
103
|
+
hook.Vue = value;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
// eslint-disable-next-line accessor-pairs
|
|
108
|
+
set enabled(value) {
|
|
109
|
+
sendToParent(hook => {
|
|
110
|
+
hook.enabled = value;
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
on(event, fn) {
|
|
115
|
+
sendToParent(hook => hook.on(event, fn));
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
once(event, fn) {
|
|
119
|
+
sendToParent(hook => hook.once(event, fn));
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
off(event, fn) {
|
|
123
|
+
sendToParent(hook => hook.off(event, fn));
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
emit(event, ...args) {
|
|
127
|
+
sendToParent(hook => hook.emit(event, ...args));
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
cleanupBuffer(matchArg) {
|
|
131
|
+
var _a;
|
|
132
|
+
|
|
133
|
+
return (_a = sendToParent(hook => hook.cleanupBuffer(matchArg))) !== null && _a !== void 0 ? _a : false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
hook = {
|
|
139
|
+
devtoolsVersion,
|
|
140
|
+
Vue: null,
|
|
141
|
+
enabled: undefined,
|
|
142
|
+
_buffer: [],
|
|
143
|
+
store: null,
|
|
144
|
+
initialState: null,
|
|
145
|
+
storeModules: null,
|
|
146
|
+
flushStoreModules: null,
|
|
147
|
+
apps: [],
|
|
148
|
+
|
|
149
|
+
_replayBuffer(event) {
|
|
150
|
+
const buffer = this._buffer;
|
|
151
|
+
this._buffer = [];
|
|
152
|
+
|
|
153
|
+
for (let i = 0, l = buffer.length; i < l; i++) {
|
|
154
|
+
const allArgs = buffer[i];
|
|
155
|
+
allArgs[0] === event // eslint-disable-next-line prefer-spread
|
|
156
|
+
? this.emit.apply(this, allArgs) : this._buffer.push(allArgs);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
on(event, fn) {
|
|
161
|
+
const $event = '$' + event;
|
|
162
|
+
|
|
163
|
+
if (listeners[$event]) {
|
|
164
|
+
listeners[$event].push(fn);
|
|
165
|
+
} else {
|
|
166
|
+
listeners[$event] = [fn];
|
|
167
|
+
|
|
168
|
+
this._replayBuffer(event);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
once(event, fn) {
|
|
173
|
+
const on = (...args) => {
|
|
174
|
+
this.off(event, on);
|
|
175
|
+
return fn.apply(this, args);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
this.on(event, on);
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
off(event, fn) {
|
|
182
|
+
event = '$' + event;
|
|
183
|
+
|
|
184
|
+
if (!arguments.length) {
|
|
185
|
+
listeners = {};
|
|
186
|
+
} else {
|
|
187
|
+
const cbs = listeners[event];
|
|
188
|
+
|
|
189
|
+
if (cbs) {
|
|
190
|
+
if (!fn) {
|
|
191
|
+
listeners[event] = null;
|
|
192
|
+
} else {
|
|
193
|
+
for (let i = 0, l = cbs.length; i < l; i++) {
|
|
194
|
+
const cb = cbs[i];
|
|
195
|
+
|
|
196
|
+
if (cb === fn || cb.fn === fn) {
|
|
197
|
+
cbs.splice(i, 1);
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
emit(event, ...args) {
|
|
207
|
+
const $event = '$' + event;
|
|
208
|
+
let cbs = listeners[$event];
|
|
209
|
+
|
|
210
|
+
if (cbs) {
|
|
211
|
+
cbs = cbs.slice();
|
|
212
|
+
|
|
213
|
+
for (let i = 0, l = cbs.length; i < l; i++) {
|
|
214
|
+
try {
|
|
215
|
+
const result = cbs[i].apply(this, args);
|
|
216
|
+
|
|
217
|
+
if (typeof (result === null || result === void 0 ? void 0 : result.catch) === 'function') {
|
|
218
|
+
result.catch(e => {
|
|
219
|
+
console.error(`[Hook] Error in async event handler for ${event} with args:`, args);
|
|
220
|
+
console.error(e);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
} catch (e) {
|
|
224
|
+
console.error(`[Hook] Error in event handler for ${event} with args:`, args);
|
|
225
|
+
console.error(e);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
this._buffer.push([event, ...args]);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Remove buffered events with any argument that is equal to the given value.
|
|
235
|
+
* @param matchArg Given value to match.
|
|
236
|
+
*/
|
|
237
|
+
cleanupBuffer(matchArg) {
|
|
238
|
+
let wasBuffered = false;
|
|
239
|
+
this._buffer = this._buffer.filter(item => {
|
|
240
|
+
if (item.some(arg => arg === matchArg)) {
|
|
241
|
+
wasBuffered = true;
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return true;
|
|
246
|
+
});
|
|
247
|
+
return wasBuffered;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
};
|
|
251
|
+
hook.once('init', Vue => {
|
|
252
|
+
hook.Vue = Vue;
|
|
253
|
+
|
|
254
|
+
if (Vue) {
|
|
255
|
+
Vue.prototype.$inspect = function () {
|
|
256
|
+
const fn = target.__VUE_DEVTOOLS_INSPECT__;
|
|
257
|
+
fn && fn(this);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
hook.on('app:init', (app, version, types) => {
|
|
262
|
+
const appRecord = {
|
|
263
|
+
app,
|
|
264
|
+
version,
|
|
265
|
+
types
|
|
266
|
+
};
|
|
267
|
+
hook.apps.push(appRecord);
|
|
268
|
+
hook.emit('app:add', appRecord);
|
|
269
|
+
});
|
|
270
|
+
hook.once('vuex:init', store => {
|
|
271
|
+
hook.store = store;
|
|
272
|
+
hook.initialState = clone(store.state);
|
|
273
|
+
const origReplaceState = store.replaceState.bind(store);
|
|
274
|
+
|
|
275
|
+
store.replaceState = state => {
|
|
276
|
+
hook.initialState = clone(state);
|
|
277
|
+
origReplaceState(state);
|
|
278
|
+
}; // Dynamic modules
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
let origRegister, origUnregister;
|
|
282
|
+
|
|
283
|
+
if (store.registerModule) {
|
|
284
|
+
hook.storeModules = [];
|
|
285
|
+
origRegister = store.registerModule.bind(store);
|
|
286
|
+
|
|
287
|
+
store.registerModule = (path, module, options) => {
|
|
288
|
+
if (typeof path === 'string') path = [path];
|
|
289
|
+
hook.storeModules.push({
|
|
290
|
+
path,
|
|
291
|
+
module,
|
|
292
|
+
options
|
|
293
|
+
});
|
|
294
|
+
origRegister(path, module, options);
|
|
295
|
+
|
|
296
|
+
if (true) {
|
|
297
|
+
// eslint-disable-next-line no-console
|
|
298
|
+
console.log('early register module', path, module, options);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
origUnregister = store.unregisterModule.bind(store);
|
|
303
|
+
|
|
304
|
+
store.unregisterModule = path => {
|
|
305
|
+
if (typeof path === 'string') path = [path];
|
|
306
|
+
const key = path.join('/');
|
|
307
|
+
const index = hook.storeModules.findIndex(m => m.path.join('/') === key);
|
|
308
|
+
if (index !== -1) hook.storeModules.splice(index, 1);
|
|
309
|
+
origUnregister(path);
|
|
310
|
+
|
|
311
|
+
if (true) {
|
|
312
|
+
// eslint-disable-next-line no-console
|
|
313
|
+
console.log('early unregister module', path);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
hook.flushStoreModules = () => {
|
|
319
|
+
store.replaceState = origReplaceState;
|
|
320
|
+
|
|
321
|
+
if (store.registerModule) {
|
|
322
|
+
store.registerModule = origRegister;
|
|
323
|
+
store.unregisterModule = origUnregister;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return hook.storeModules || [];
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (true) {
|
|
332
|
+
// @ts-ignore
|
|
333
|
+
uni.syncDataToGlobal({
|
|
334
|
+
__VUE_DEVTOOLS_GLOBAL_HOOK__: hook
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
Object.defineProperty(target, '__VUE_DEVTOOLS_GLOBAL_HOOK__', {
|
|
339
|
+
get() {
|
|
340
|
+
return hook;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
}); // Handle apps initialized before hook injection
|
|
344
|
+
|
|
345
|
+
if (target.__VUE_DEVTOOLS_HOOK_REPLAY__) {
|
|
346
|
+
try {
|
|
347
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__.forEach(cb => cb(hook));
|
|
348
|
+
|
|
349
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = [];
|
|
350
|
+
} catch (e) {
|
|
351
|
+
console.error('[vue-devtools] Error during hook replay', e);
|
|
352
|
+
}
|
|
353
|
+
} // Clone deep utility for cloning initial state of the store
|
|
354
|
+
// Forked from https://github.com/planttheidea/fast-copy
|
|
355
|
+
// Last update: 2019-10-30
|
|
356
|
+
// ⚠️ Don't forget to update `./hook.js`
|
|
357
|
+
// utils
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
const {
|
|
361
|
+
toString: toStringFunction
|
|
362
|
+
} = Function.prototype;
|
|
363
|
+
const {
|
|
364
|
+
create,
|
|
365
|
+
defineProperty,
|
|
366
|
+
getOwnPropertyDescriptor,
|
|
367
|
+
getOwnPropertyNames,
|
|
368
|
+
getOwnPropertySymbols,
|
|
369
|
+
getPrototypeOf
|
|
370
|
+
} = Object;
|
|
371
|
+
const {
|
|
372
|
+
hasOwnProperty,
|
|
373
|
+
propertyIsEnumerable
|
|
374
|
+
} = Object.prototype;
|
|
375
|
+
/**
|
|
376
|
+
* @enum
|
|
377
|
+
*
|
|
378
|
+
* @const {Object} SUPPORTS
|
|
379
|
+
*
|
|
380
|
+
* @property {boolean} SYMBOL_PROPERTIES are symbol properties supported
|
|
381
|
+
* @property {boolean} WEAKSET is WeakSet supported
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
const SUPPORTS = {
|
|
385
|
+
SYMBOL_PROPERTIES: typeof getOwnPropertySymbols === 'function',
|
|
386
|
+
WEAKSET: typeof WeakSet === 'function'
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* @function createCache
|
|
390
|
+
*
|
|
391
|
+
* @description
|
|
392
|
+
* get a new cache object to prevent circular references
|
|
393
|
+
*
|
|
394
|
+
* @returns the new cache object
|
|
395
|
+
*/
|
|
396
|
+
|
|
397
|
+
const createCache = () => {
|
|
398
|
+
if (SUPPORTS.WEAKSET) {
|
|
399
|
+
return new WeakSet();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const object = create({
|
|
403
|
+
add: value => object._values.push(value),
|
|
404
|
+
has: value => !!~object._values.indexOf(value)
|
|
405
|
+
});
|
|
406
|
+
object._values = [];
|
|
407
|
+
return object;
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* @function getCleanClone
|
|
411
|
+
*
|
|
412
|
+
* @description
|
|
413
|
+
* get an empty version of the object with the same prototype it has
|
|
414
|
+
*
|
|
415
|
+
* @param object the object to build a clean clone from
|
|
416
|
+
* @param realm the realm the object resides in
|
|
417
|
+
* @returns the empty cloned object
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
const getCleanClone = (object, realm) => {
|
|
422
|
+
if (!object.constructor) {
|
|
423
|
+
return create(null);
|
|
424
|
+
} // eslint-disable-next-line no-proto
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
const prototype = object.__proto__ || getPrototypeOf(object);
|
|
428
|
+
|
|
429
|
+
if (object.constructor === realm.Object) {
|
|
430
|
+
return prototype === realm.Object.prototype ? {} : create(prototype);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (~toStringFunction.call(object.constructor).indexOf('[native code]')) {
|
|
434
|
+
try {
|
|
435
|
+
return new object.constructor();
|
|
436
|
+
} catch (e) {// Error
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return create(prototype);
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* @function getObjectCloneLoose
|
|
444
|
+
*
|
|
445
|
+
* @description
|
|
446
|
+
* get a copy of the object based on loose rules, meaning all enumerable keys
|
|
447
|
+
* and symbols are copied, but property descriptors are not considered
|
|
448
|
+
*
|
|
449
|
+
* @param object the object to clone
|
|
450
|
+
* @param realm the realm the object resides in
|
|
451
|
+
* @param handleCopy the function that handles copying the object
|
|
452
|
+
* @returns the copied object
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
const getObjectCloneLoose = (object, realm, handleCopy, cache) => {
|
|
457
|
+
const clone = getCleanClone(object, realm);
|
|
458
|
+
|
|
459
|
+
for (const key in object) {
|
|
460
|
+
if (hasOwnProperty.call(object, key)) {
|
|
461
|
+
clone[key] = handleCopy(object[key], cache);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (SUPPORTS.SYMBOL_PROPERTIES) {
|
|
466
|
+
const symbols = getOwnPropertySymbols(object);
|
|
467
|
+
|
|
468
|
+
if (symbols.length) {
|
|
469
|
+
for (let index = 0, symbol; index < symbols.length; index++) {
|
|
470
|
+
symbol = symbols[index];
|
|
471
|
+
|
|
472
|
+
if (propertyIsEnumerable.call(object, symbol)) {
|
|
473
|
+
clone[symbol] = handleCopy(object[symbol], cache);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return clone;
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* @function getObjectCloneStrict
|
|
483
|
+
*
|
|
484
|
+
* @description
|
|
485
|
+
* get a copy of the object based on strict rules, meaning all keys and symbols
|
|
486
|
+
* are copied based on the original property descriptors
|
|
487
|
+
*
|
|
488
|
+
* @param object the object to clone
|
|
489
|
+
* @param realm the realm the object resides in
|
|
490
|
+
* @param handleCopy the function that handles copying the object
|
|
491
|
+
* @returns the copied object
|
|
492
|
+
*/
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
const getObjectCloneStrict = (object, realm, handleCopy, cache) => {
|
|
496
|
+
const clone = getCleanClone(object, realm);
|
|
497
|
+
const properties = SUPPORTS.SYMBOL_PROPERTIES ? [].concat(getOwnPropertyNames(object), getOwnPropertySymbols(object)) : getOwnPropertyNames(object);
|
|
498
|
+
|
|
499
|
+
if (properties.length) {
|
|
500
|
+
for (let index = 0, property, descriptor; index < properties.length; index++) {
|
|
501
|
+
property = properties[index];
|
|
502
|
+
|
|
503
|
+
if (property !== 'callee' && property !== 'caller') {
|
|
504
|
+
descriptor = getOwnPropertyDescriptor(object, property);
|
|
505
|
+
descriptor.value = handleCopy(object[property], cache);
|
|
506
|
+
defineProperty(clone, property, descriptor);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return clone;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* @function getRegExpFlags
|
|
515
|
+
*
|
|
516
|
+
* @description
|
|
517
|
+
* get the flags to apply to the copied regexp
|
|
518
|
+
*
|
|
519
|
+
* @param regExp the regexp to get the flags of
|
|
520
|
+
* @returns the flags for the regexp
|
|
521
|
+
*/
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
const getRegExpFlags = regExp => {
|
|
525
|
+
let flags = '';
|
|
526
|
+
|
|
527
|
+
if (regExp.global) {
|
|
528
|
+
flags += 'g';
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (regExp.ignoreCase) {
|
|
532
|
+
flags += 'i';
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (regExp.multiline) {
|
|
536
|
+
flags += 'm';
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (regExp.unicode) {
|
|
540
|
+
flags += 'u';
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (regExp.sticky) {
|
|
544
|
+
flags += 'y';
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return flags;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const {
|
|
551
|
+
isArray
|
|
552
|
+
} = Array;
|
|
553
|
+
|
|
554
|
+
const GLOBAL_THIS = (() => {
|
|
555
|
+
if (typeof self !== 'undefined') {
|
|
556
|
+
return self;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (typeof window !== 'undefined') {
|
|
560
|
+
return window;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (typeof __webpack_require__.g !== 'undefined') {
|
|
564
|
+
return __webpack_require__.g;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (console && console.error) {
|
|
568
|
+
console.error('Unable to locate global object, returning "this".');
|
|
569
|
+
}
|
|
570
|
+
})();
|
|
571
|
+
/**
|
|
572
|
+
* @function clone
|
|
573
|
+
*
|
|
574
|
+
* @description
|
|
575
|
+
* copy an object deeply as much as possible
|
|
576
|
+
*
|
|
577
|
+
* If `strict` is applied, then all properties (including non-enumerable ones)
|
|
578
|
+
* are copied with their original property descriptors on both objects and arrays.
|
|
579
|
+
*
|
|
580
|
+
* The object is compared to the global constructors in the `realm` provided,
|
|
581
|
+
* and the native constructor is always used to ensure that extensions of native
|
|
582
|
+
* objects (allows in ES2015+) are maintained.
|
|
583
|
+
*
|
|
584
|
+
* @param object the object to copy
|
|
585
|
+
* @param [options] the options for copying with
|
|
586
|
+
* @param [options.isStrict] should the copy be strict
|
|
587
|
+
* @param [options.realm] the realm (this) object the object is copied from
|
|
588
|
+
* @returns the copied object
|
|
589
|
+
*/
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
function clone(object, options = null) {
|
|
593
|
+
// manually coalesced instead of default parameters for performance
|
|
594
|
+
const isStrict = !!(options && options.isStrict);
|
|
595
|
+
const realm = options && options.realm || GLOBAL_THIS;
|
|
596
|
+
const getObjectClone = isStrict ? getObjectCloneStrict : getObjectCloneLoose;
|
|
597
|
+
/**
|
|
598
|
+
* @function handleCopy
|
|
599
|
+
*
|
|
600
|
+
* @description
|
|
601
|
+
* copy the object recursively based on its type
|
|
602
|
+
*
|
|
603
|
+
* @param object the object to copy
|
|
604
|
+
* @returns the copied object
|
|
605
|
+
*/
|
|
606
|
+
|
|
607
|
+
const handleCopy = (object, cache) => {
|
|
608
|
+
if (!object || typeof object !== 'object' || cache.has(object)) {
|
|
609
|
+
return object;
|
|
610
|
+
} // DOM objects
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
if (typeof HTMLElement !== 'undefined' && object instanceof HTMLElement) {
|
|
614
|
+
return object.cloneNode(false);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const Constructor = object.constructor; // plain objects
|
|
618
|
+
|
|
619
|
+
if (Constructor === realm.Object) {
|
|
620
|
+
cache.add(object);
|
|
621
|
+
return getObjectClone(object, realm, handleCopy, cache);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
let clone; // arrays
|
|
625
|
+
|
|
626
|
+
if (isArray(object)) {
|
|
627
|
+
cache.add(object); // if strict, include non-standard properties
|
|
628
|
+
|
|
629
|
+
if (isStrict) {
|
|
630
|
+
return getObjectCloneStrict(object, realm, handleCopy, cache);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
clone = new Constructor();
|
|
634
|
+
|
|
635
|
+
for (let index = 0; index < object.length; index++) {
|
|
636
|
+
clone[index] = handleCopy(object[index], cache);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return clone;
|
|
640
|
+
} // dates
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
if (object instanceof realm.Date) {
|
|
644
|
+
return new Constructor(object.getTime());
|
|
645
|
+
} // regexps
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
if (object instanceof realm.RegExp) {
|
|
649
|
+
clone = new Constructor(object.source, object.flags || getRegExpFlags(object));
|
|
650
|
+
clone.lastIndex = object.lastIndex;
|
|
651
|
+
return clone;
|
|
652
|
+
} // maps
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
if (realm.Map && object instanceof realm.Map) {
|
|
656
|
+
cache.add(object);
|
|
657
|
+
clone = new Constructor();
|
|
658
|
+
object.forEach((value, key) => {
|
|
659
|
+
clone.set(key, handleCopy(value, cache));
|
|
660
|
+
});
|
|
661
|
+
return clone;
|
|
662
|
+
} // sets
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
if (realm.Set && object instanceof realm.Set) {
|
|
666
|
+
cache.add(object);
|
|
667
|
+
clone = new Constructor();
|
|
668
|
+
object.forEach(value => {
|
|
669
|
+
clone.add(handleCopy(value, cache));
|
|
670
|
+
});
|
|
671
|
+
return clone;
|
|
672
|
+
} // buffers (node-only)
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
if (realm.Buffer && realm.Buffer.isBuffer(object)) {
|
|
676
|
+
clone = realm.Buffer.allocUnsafe ? realm.Buffer.allocUnsafe(object.length) : new Constructor(object.length);
|
|
677
|
+
object.copy(clone);
|
|
678
|
+
return clone;
|
|
679
|
+
} // arraybuffers / dataviews
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
if (realm.ArrayBuffer) {
|
|
683
|
+
// dataviews
|
|
684
|
+
if (realm.ArrayBuffer.isView(object)) {
|
|
685
|
+
return new Constructor(object.buffer.slice(0));
|
|
686
|
+
} // arraybuffers
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
if (object instanceof realm.ArrayBuffer) {
|
|
690
|
+
return object.slice(0);
|
|
691
|
+
}
|
|
692
|
+
} // if the object cannot / should not be cloned, don't
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
if ( // promise-like
|
|
696
|
+
hasOwnProperty.call(object, 'then') && typeof object.then === 'function' || // errors
|
|
697
|
+
object instanceof Error || // weakmaps
|
|
698
|
+
realm.WeakMap && object instanceof realm.WeakMap || // weaksets
|
|
699
|
+
realm.WeakSet && object instanceof realm.WeakSet) {
|
|
700
|
+
return object;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
cache.add(object); // assume anything left is a custom constructor
|
|
704
|
+
|
|
705
|
+
return getObjectClone(object, realm, handleCopy, cache);
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
return handleCopy(object, createCache());
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
exports.installHook = installHook;
|
|
713
|
+
|
|
714
|
+
/***/ }),
|
|
715
|
+
|
|
716
|
+
/***/ "../shared-utils/lib/backend.js":
|
|
717
|
+
/*!**************************************!*\
|
|
718
|
+
!*** ../shared-utils/lib/backend.js ***!
|
|
719
|
+
\**************************************/
|
|
720
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
725
|
+
value: true
|
|
726
|
+
}));
|
|
727
|
+
exports.getCatchedGetters = exports.getCustomStoreDetails = exports.getCustomRouterDetails = exports.isVueInstance = exports.getCustomObjectDetails = exports.getCustomInstanceDetails = exports.getInstanceMap = exports.backendInjections = void 0;
|
|
728
|
+
exports.backendInjections = {
|
|
729
|
+
instanceMap: new Map(),
|
|
730
|
+
isVueInstance: () => false,
|
|
731
|
+
getCustomInstanceDetails: () => ({}),
|
|
732
|
+
getCustomObjectDetails: () => undefined
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
function getInstanceMap() {
|
|
736
|
+
return exports.backendInjections.instanceMap;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
exports.getInstanceMap = getInstanceMap;
|
|
740
|
+
|
|
741
|
+
function getCustomInstanceDetails(instance) {
|
|
742
|
+
return exports.backendInjections.getCustomInstanceDetails(instance);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
exports.getCustomInstanceDetails = getCustomInstanceDetails;
|
|
746
|
+
|
|
747
|
+
function getCustomObjectDetails(value, proto) {
|
|
748
|
+
return exports.backendInjections.getCustomObjectDetails(value, proto);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
exports.getCustomObjectDetails = getCustomObjectDetails;
|
|
752
|
+
|
|
753
|
+
function isVueInstance(value) {
|
|
754
|
+
return exports.backendInjections.isVueInstance(value);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
exports.isVueInstance = isVueInstance; // @TODO refactor
|
|
758
|
+
|
|
759
|
+
function getCustomRouterDetails(router) {
|
|
760
|
+
return {
|
|
761
|
+
_custom: {
|
|
762
|
+
type: 'router',
|
|
763
|
+
display: 'VueRouter',
|
|
764
|
+
value: {
|
|
765
|
+
options: router.options,
|
|
766
|
+
currentRoute: router.currentRoute
|
|
767
|
+
},
|
|
768
|
+
fields: {
|
|
769
|
+
abstract: true
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
exports.getCustomRouterDetails = getCustomRouterDetails; // @TODO refactor
|
|
776
|
+
|
|
777
|
+
function getCustomStoreDetails(store) {
|
|
778
|
+
return {
|
|
779
|
+
_custom: {
|
|
780
|
+
type: 'store',
|
|
781
|
+
display: 'Store',
|
|
782
|
+
value: {
|
|
783
|
+
state: store.state,
|
|
784
|
+
getters: getCatchedGetters(store)
|
|
785
|
+
},
|
|
786
|
+
fields: {
|
|
787
|
+
abstract: true
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
exports.getCustomStoreDetails = getCustomStoreDetails; // @TODO refactor
|
|
794
|
+
|
|
795
|
+
function getCatchedGetters(store) {
|
|
796
|
+
const getters = {};
|
|
797
|
+
const origGetters = store.getters || {};
|
|
798
|
+
const keys = Object.keys(origGetters);
|
|
799
|
+
|
|
800
|
+
for (let i = 0; i < keys.length; i++) {
|
|
801
|
+
const key = keys[i];
|
|
802
|
+
Object.defineProperty(getters, key, {
|
|
803
|
+
enumerable: true,
|
|
804
|
+
get: () => {
|
|
805
|
+
try {
|
|
806
|
+
return origGetters[key];
|
|
807
|
+
} catch (e) {
|
|
808
|
+
return e;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return getters;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
exports.getCatchedGetters = getCatchedGetters;
|
|
818
|
+
|
|
819
|
+
/***/ }),
|
|
820
|
+
|
|
821
|
+
/***/ "../shared-utils/lib/bridge.js":
|
|
822
|
+
/*!*************************************!*\
|
|
823
|
+
!*** ../shared-utils/lib/bridge.js ***!
|
|
824
|
+
\*************************************/
|
|
825
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
830
|
+
value: true
|
|
831
|
+
}));
|
|
832
|
+
exports.Bridge = void 0;
|
|
833
|
+
|
|
834
|
+
const events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
835
|
+
|
|
836
|
+
const raf_1 = __webpack_require__(/*! ./raf */ "../shared-utils/lib/raf.js");
|
|
837
|
+
|
|
838
|
+
const BATCH_DURATION = 100;
|
|
839
|
+
|
|
840
|
+
class Bridge extends events_1.EventEmitter {
|
|
841
|
+
constructor(wall) {
|
|
842
|
+
super();
|
|
843
|
+
this.setMaxListeners(Infinity);
|
|
844
|
+
this.wall = wall;
|
|
845
|
+
wall.listen(messages => {
|
|
846
|
+
if (Array.isArray(messages)) {
|
|
847
|
+
messages.forEach(message => this._emit(message));
|
|
848
|
+
} else {
|
|
849
|
+
this._emit(messages);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
this._batchingQueue = [];
|
|
853
|
+
this._sendingQueue = [];
|
|
854
|
+
this._receivingQueue = [];
|
|
855
|
+
this._sending = false;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
on(event, listener) {
|
|
859
|
+
const wrappedListener = async (...args) => {
|
|
860
|
+
try {
|
|
861
|
+
await listener(...args);
|
|
862
|
+
} catch (e) {
|
|
863
|
+
console.error(`[Bridge] Error in listener for event ${event.toString()} with args:`, args);
|
|
864
|
+
console.error(e);
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
return super.on(event, wrappedListener);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
send(event, payload) {
|
|
872
|
+
this._batchingQueue.push({
|
|
873
|
+
event,
|
|
874
|
+
payload
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
if (this._timer == null) {
|
|
878
|
+
this._timer = setTimeout(() => this._flush(), BATCH_DURATION);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Log a message to the devtools background page.
|
|
883
|
+
*/
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
log(message) {
|
|
887
|
+
this.send('log', message);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
_flush() {
|
|
891
|
+
if (this._batchingQueue.length) this._send(this._batchingQueue);
|
|
892
|
+
clearTimeout(this._timer);
|
|
893
|
+
this._timer = null;
|
|
894
|
+
this._batchingQueue = [];
|
|
895
|
+
} // @TODO types
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
_emit(message) {
|
|
899
|
+
if (typeof message === 'string') {
|
|
900
|
+
this.emit(message);
|
|
901
|
+
} else if (message._chunk) {
|
|
902
|
+
this._receivingQueue.push(message._chunk);
|
|
903
|
+
|
|
904
|
+
if (message.last) {
|
|
905
|
+
this.emit(message.event, this._receivingQueue);
|
|
906
|
+
this._receivingQueue = [];
|
|
907
|
+
}
|
|
908
|
+
} else if (message.event) {
|
|
909
|
+
this.emit(message.event, message.payload);
|
|
910
|
+
}
|
|
911
|
+
} // @TODO types
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
_send(messages) {
|
|
915
|
+
this._sendingQueue.push(messages);
|
|
916
|
+
|
|
917
|
+
this._nextSend();
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
_nextSend() {
|
|
921
|
+
if (!this._sendingQueue.length || this._sending) return;
|
|
922
|
+
this._sending = true;
|
|
923
|
+
|
|
924
|
+
const messages = this._sendingQueue.shift();
|
|
925
|
+
|
|
926
|
+
try {
|
|
927
|
+
this.wall.send(messages);
|
|
928
|
+
} catch (err) {
|
|
929
|
+
if (err.message === 'Message length exceeded maximum allowed length.') {
|
|
930
|
+
this._sendingQueue.splice(0, 0, messages.map(message => [message]));
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
this._sending = false;
|
|
935
|
+
(0, raf_1.raf)(() => this._nextSend());
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
exports.Bridge = Bridge;
|
|
941
|
+
|
|
942
|
+
/***/ }),
|
|
943
|
+
|
|
944
|
+
/***/ "../shared-utils/lib/consts.js":
|
|
945
|
+
/*!*************************************!*\
|
|
946
|
+
!*** ../shared-utils/lib/consts.js ***!
|
|
947
|
+
\*************************************/
|
|
948
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
953
|
+
value: true
|
|
954
|
+
}));
|
|
955
|
+
exports.HookEvents = exports.BridgeSubscriptions = exports.BridgeEvents = exports.BuiltinTabs = void 0;
|
|
956
|
+
var BuiltinTabs;
|
|
957
|
+
|
|
958
|
+
(function (BuiltinTabs) {
|
|
959
|
+
BuiltinTabs["COMPONENTS"] = "components";
|
|
960
|
+
BuiltinTabs["TIMELINE"] = "timeline";
|
|
961
|
+
BuiltinTabs["PLUGINS"] = "plugins";
|
|
962
|
+
BuiltinTabs["SETTINGS"] = "settings";
|
|
963
|
+
})(BuiltinTabs = exports.BuiltinTabs || (exports.BuiltinTabs = {}));
|
|
964
|
+
|
|
965
|
+
var BridgeEvents;
|
|
966
|
+
|
|
967
|
+
(function (BridgeEvents) {
|
|
968
|
+
// Misc
|
|
969
|
+
BridgeEvents["TO_BACK_SUBSCRIBE"] = "b:subscribe";
|
|
970
|
+
BridgeEvents["TO_BACK_UNSUBSCRIBE"] = "b:unsubscribe";
|
|
971
|
+
/** Backend is ready */
|
|
972
|
+
|
|
973
|
+
BridgeEvents["TO_FRONT_READY"] = "f:ready";
|
|
974
|
+
/** Displays the "detected Vue" console log */
|
|
975
|
+
|
|
976
|
+
BridgeEvents["TO_BACK_LOG_DETECTED_VUE"] = "b:log-detected-vue";
|
|
977
|
+
/** Force refresh */
|
|
978
|
+
|
|
979
|
+
BridgeEvents["TO_BACK_REFRESH"] = "b:refresh";
|
|
980
|
+
/** Tab was switched */
|
|
981
|
+
|
|
982
|
+
BridgeEvents["TO_BACK_TAB_SWITCH"] = "b:tab:switch";
|
|
983
|
+
BridgeEvents["TO_BACK_LOG"] = "b:log";
|
|
984
|
+
/** Reconnected after background script is terminated (idle) */
|
|
985
|
+
|
|
986
|
+
BridgeEvents["TO_FRONT_RECONNECTED"] = "f:reconnected";
|
|
987
|
+
/** Change app title (electron) */
|
|
988
|
+
|
|
989
|
+
BridgeEvents["TO_FRONT_TITLE"] = "f:title"; // Apps
|
|
990
|
+
|
|
991
|
+
/** App was registered */
|
|
992
|
+
|
|
993
|
+
BridgeEvents["TO_FRONT_APP_ADD"] = "f:app:add";
|
|
994
|
+
/** Get app list */
|
|
995
|
+
|
|
996
|
+
BridgeEvents["TO_BACK_APP_LIST"] = "b:app:list";
|
|
997
|
+
BridgeEvents["TO_FRONT_APP_LIST"] = "f:app:list";
|
|
998
|
+
BridgeEvents["TO_FRONT_APP_REMOVE"] = "f:app:remove";
|
|
999
|
+
BridgeEvents["TO_BACK_APP_SELECT"] = "b:app:select";
|
|
1000
|
+
BridgeEvents["TO_FRONT_APP_SELECTED"] = "f:app:selected";
|
|
1001
|
+
BridgeEvents["TO_BACK_SCAN_LEGACY_APPS"] = "b:app:scan-legacy"; // Components
|
|
1002
|
+
|
|
1003
|
+
BridgeEvents["TO_BACK_COMPONENT_TREE"] = "b:component:tree";
|
|
1004
|
+
BridgeEvents["TO_FRONT_COMPONENT_TREE"] = "f:component:tree";
|
|
1005
|
+
BridgeEvents["TO_BACK_COMPONENT_SELECTED_DATA"] = "b:component:selected-data";
|
|
1006
|
+
BridgeEvents["TO_FRONT_COMPONENT_SELECTED_DATA"] = "f:component:selected-data";
|
|
1007
|
+
BridgeEvents["TO_BACK_COMPONENT_EXPAND"] = "b:component:expand";
|
|
1008
|
+
BridgeEvents["TO_FRONT_COMPONENT_EXPAND"] = "f:component:expand";
|
|
1009
|
+
BridgeEvents["TO_BACK_COMPONENT_SCROLL_TO"] = "b:component:scroll-to";
|
|
1010
|
+
BridgeEvents["TO_BACK_COMPONENT_FILTER"] = "b:component:filter";
|
|
1011
|
+
BridgeEvents["TO_BACK_COMPONENT_MOUSE_OVER"] = "b:component:mouse-over";
|
|
1012
|
+
BridgeEvents["TO_BACK_COMPONENT_MOUSE_OUT"] = "b:component:mouse-out";
|
|
1013
|
+
BridgeEvents["TO_BACK_COMPONENT_CONTEXT_MENU_TARGET"] = "b:component:context-menu-target";
|
|
1014
|
+
BridgeEvents["TO_BACK_COMPONENT_EDIT_STATE"] = "b:component:edit-state";
|
|
1015
|
+
BridgeEvents["TO_BACK_COMPONENT_PICK"] = "b:component:pick";
|
|
1016
|
+
BridgeEvents["TO_FRONT_COMPONENT_PICK"] = "f:component:pick";
|
|
1017
|
+
BridgeEvents["TO_BACK_COMPONENT_PICK_CANCELED"] = "b:component:pick-canceled";
|
|
1018
|
+
BridgeEvents["TO_FRONT_COMPONENT_PICK_CANCELED"] = "f:component:pick-canceled";
|
|
1019
|
+
BridgeEvents["TO_BACK_COMPONENT_INSPECT_DOM"] = "b:component:inspect-dom";
|
|
1020
|
+
BridgeEvents["TO_FRONT_COMPONENT_INSPECT_DOM"] = "f:component:inspect-dom";
|
|
1021
|
+
BridgeEvents["TO_BACK_COMPONENT_RENDER_CODE"] = "b:component:render-code";
|
|
1022
|
+
BridgeEvents["TO_FRONT_COMPONENT_RENDER_CODE"] = "f:component:render-code";
|
|
1023
|
+
BridgeEvents["TO_FRONT_COMPONENT_UPDATED"] = "f:component:updated"; // Timeline
|
|
1024
|
+
|
|
1025
|
+
BridgeEvents["TO_FRONT_TIMELINE_EVENT"] = "f:timeline:event";
|
|
1026
|
+
BridgeEvents["TO_BACK_TIMELINE_LAYER_LIST"] = "b:timeline:layer-list";
|
|
1027
|
+
BridgeEvents["TO_FRONT_TIMELINE_LAYER_LIST"] = "f:timeline:layer-list";
|
|
1028
|
+
BridgeEvents["TO_FRONT_TIMELINE_LAYER_ADD"] = "f:timeline:layer-add";
|
|
1029
|
+
BridgeEvents["TO_BACK_TIMELINE_SHOW_SCREENSHOT"] = "b:timeline:show-screenshot";
|
|
1030
|
+
BridgeEvents["TO_BACK_TIMELINE_CLEAR"] = "b:timeline:clear";
|
|
1031
|
+
BridgeEvents["TO_BACK_TIMELINE_EVENT_DATA"] = "b:timeline:event-data";
|
|
1032
|
+
BridgeEvents["TO_FRONT_TIMELINE_EVENT_DATA"] = "f:timeline:event-data";
|
|
1033
|
+
BridgeEvents["TO_BACK_TIMELINE_LAYER_LOAD_EVENTS"] = "b:timeline:layer-load-events";
|
|
1034
|
+
BridgeEvents["TO_FRONT_TIMELINE_LAYER_LOAD_EVENTS"] = "f:timeline:layer-load-events";
|
|
1035
|
+
BridgeEvents["TO_BACK_TIMELINE_LOAD_MARKERS"] = "b:timeline:load-markers";
|
|
1036
|
+
BridgeEvents["TO_FRONT_TIMELINE_LOAD_MARKERS"] = "f:timeline:load-markers";
|
|
1037
|
+
BridgeEvents["TO_FRONT_TIMELINE_MARKER"] = "f:timeline:marker"; // Plugins
|
|
1038
|
+
|
|
1039
|
+
BridgeEvents["TO_BACK_DEVTOOLS_PLUGIN_LIST"] = "b:devtools-plugin:list";
|
|
1040
|
+
BridgeEvents["TO_FRONT_DEVTOOLS_PLUGIN_LIST"] = "f:devtools-plugin:list";
|
|
1041
|
+
BridgeEvents["TO_FRONT_DEVTOOLS_PLUGIN_ADD"] = "f:devtools-plugin:add";
|
|
1042
|
+
BridgeEvents["TO_BACK_DEVTOOLS_PLUGIN_SETTING_UPDATED"] = "b:devtools-plugin:setting-updated"; // Custom inspectors
|
|
1043
|
+
|
|
1044
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_LIST"] = "b:custom-inspector:list";
|
|
1045
|
+
BridgeEvents["TO_FRONT_CUSTOM_INSPECTOR_LIST"] = "f:custom-inspector:list";
|
|
1046
|
+
BridgeEvents["TO_FRONT_CUSTOM_INSPECTOR_ADD"] = "f:custom-inspector:add";
|
|
1047
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_TREE"] = "b:custom-inspector:tree";
|
|
1048
|
+
BridgeEvents["TO_FRONT_CUSTOM_INSPECTOR_TREE"] = "f:custom-inspector:tree";
|
|
1049
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_STATE"] = "b:custom-inspector:state";
|
|
1050
|
+
BridgeEvents["TO_FRONT_CUSTOM_INSPECTOR_STATE"] = "f:custom-inspector:state";
|
|
1051
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_EDIT_STATE"] = "b:custom-inspector:edit-state";
|
|
1052
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_ACTION"] = "b:custom-inspector:action";
|
|
1053
|
+
BridgeEvents["TO_BACK_CUSTOM_INSPECTOR_NODE_ACTION"] = "b:custom-inspector:node-action";
|
|
1054
|
+
BridgeEvents["TO_FRONT_CUSTOM_INSPECTOR_SELECT_NODE"] = "f:custom-inspector:select-node"; // Custom state
|
|
1055
|
+
|
|
1056
|
+
BridgeEvents["TO_BACK_CUSTOM_STATE_ACTION"] = "b:custom-state:action";
|
|
1057
|
+
})(BridgeEvents = exports.BridgeEvents || (exports.BridgeEvents = {}));
|
|
1058
|
+
|
|
1059
|
+
var BridgeSubscriptions;
|
|
1060
|
+
|
|
1061
|
+
(function (BridgeSubscriptions) {
|
|
1062
|
+
BridgeSubscriptions["SELECTED_COMPONENT_DATA"] = "component:selected-data";
|
|
1063
|
+
BridgeSubscriptions["COMPONENT_TREE"] = "component:tree";
|
|
1064
|
+
})(BridgeSubscriptions = exports.BridgeSubscriptions || (exports.BridgeSubscriptions = {}));
|
|
1065
|
+
|
|
1066
|
+
var HookEvents;
|
|
1067
|
+
|
|
1068
|
+
(function (HookEvents) {
|
|
1069
|
+
HookEvents["INIT"] = "init";
|
|
1070
|
+
HookEvents["APP_INIT"] = "app:init";
|
|
1071
|
+
HookEvents["APP_ADD"] = "app:add";
|
|
1072
|
+
HookEvents["APP_UNMOUNT"] = "app:unmount";
|
|
1073
|
+
HookEvents["COMPONENT_UPDATED"] = "component:updated";
|
|
1074
|
+
HookEvents["COMPONENT_ADDED"] = "component:added";
|
|
1075
|
+
HookEvents["COMPONENT_REMOVED"] = "component:removed";
|
|
1076
|
+
HookEvents["COMPONENT_EMIT"] = "component:emit";
|
|
1077
|
+
HookEvents["COMPONENT_HIGHLIGHT"] = "component:highlight";
|
|
1078
|
+
HookEvents["COMPONENT_UNHIGHLIGHT"] = "component:unhighlight";
|
|
1079
|
+
HookEvents["SETUP_DEVTOOLS_PLUGIN"] = "devtools-plugin:setup";
|
|
1080
|
+
HookEvents["TIMELINE_LAYER_ADDED"] = "timeline:layer-added";
|
|
1081
|
+
HookEvents["TIMELINE_EVENT_ADDED"] = "timeline:event-added";
|
|
1082
|
+
HookEvents["CUSTOM_INSPECTOR_ADD"] = "custom-inspector:add";
|
|
1083
|
+
HookEvents["CUSTOM_INSPECTOR_SEND_TREE"] = "custom-inspector:send-tree";
|
|
1084
|
+
HookEvents["CUSTOM_INSPECTOR_SEND_STATE"] = "custom-inspector:send-state";
|
|
1085
|
+
HookEvents["CUSTOM_INSPECTOR_SELECT_NODE"] = "custom-inspector:select-node";
|
|
1086
|
+
HookEvents["PERFORMANCE_START"] = "perf:start";
|
|
1087
|
+
HookEvents["PERFORMANCE_END"] = "perf:end";
|
|
1088
|
+
HookEvents["PLUGIN_SETTINGS_SET"] = "plugin:settings:set";
|
|
1089
|
+
/**
|
|
1090
|
+
* @deprecated
|
|
1091
|
+
*/
|
|
1092
|
+
|
|
1093
|
+
HookEvents["FLUSH"] = "flush";
|
|
1094
|
+
/**
|
|
1095
|
+
* @deprecated
|
|
1096
|
+
*/
|
|
1097
|
+
|
|
1098
|
+
HookEvents["TRACK_UPDATE"] = "_track-update";
|
|
1099
|
+
/**
|
|
1100
|
+
* @deprecated
|
|
1101
|
+
*/
|
|
1102
|
+
|
|
1103
|
+
HookEvents["FLASH_UPDATE"] = "_flash-update";
|
|
1104
|
+
})(HookEvents = exports.HookEvents || (exports.HookEvents = {}));
|
|
1105
|
+
|
|
1106
|
+
/***/ }),
|
|
1107
|
+
|
|
1108
|
+
/***/ "../shared-utils/lib/edit.js":
|
|
1109
|
+
/*!***********************************!*\
|
|
1110
|
+
!*** ../shared-utils/lib/edit.js ***!
|
|
1111
|
+
\***********************************/
|
|
1112
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1117
|
+
value: true
|
|
1118
|
+
}));
|
|
1119
|
+
exports.StateEditor = void 0;
|
|
1120
|
+
|
|
1121
|
+
class StateEditor {
|
|
1122
|
+
set(object, path, value, cb = null) {
|
|
1123
|
+
const sections = Array.isArray(path) ? path : path.split('.');
|
|
1124
|
+
|
|
1125
|
+
while (sections.length > 1) {
|
|
1126
|
+
object = object[sections.shift()];
|
|
1127
|
+
|
|
1128
|
+
if (this.isRef(object)) {
|
|
1129
|
+
object = this.getRefValue(object);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
const field = sections[0];
|
|
1134
|
+
|
|
1135
|
+
if (cb) {
|
|
1136
|
+
cb(object, field, value);
|
|
1137
|
+
} else if (this.isRef(object[field])) {
|
|
1138
|
+
this.setRefValue(object[field], value);
|
|
1139
|
+
} else {
|
|
1140
|
+
object[field] = value;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
get(object, path) {
|
|
1145
|
+
const sections = Array.isArray(path) ? path : path.split('.');
|
|
1146
|
+
|
|
1147
|
+
for (let i = 0; i < sections.length; i++) {
|
|
1148
|
+
object = object[sections[i]];
|
|
1149
|
+
|
|
1150
|
+
if (this.isRef(object)) {
|
|
1151
|
+
object = this.getRefValue(object);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
if (!object) {
|
|
1155
|
+
return undefined;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
return object;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
has(object, path, parent = false) {
|
|
1163
|
+
if (typeof object === 'undefined') {
|
|
1164
|
+
return false;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
const sections = Array.isArray(path) ? path.slice() : path.split('.');
|
|
1168
|
+
const size = !parent ? 1 : 2;
|
|
1169
|
+
|
|
1170
|
+
while (object && sections.length > size) {
|
|
1171
|
+
object = object[sections.shift()];
|
|
1172
|
+
|
|
1173
|
+
if (this.isRef(object)) {
|
|
1174
|
+
object = this.getRefValue(object);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return object != null && Object.prototype.hasOwnProperty.call(object, sections[0]);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
createDefaultSetCallback(state) {
|
|
1182
|
+
return (obj, field, value) => {
|
|
1183
|
+
if (state.remove || state.newKey) {
|
|
1184
|
+
if (Array.isArray(obj)) {
|
|
1185
|
+
obj.splice(field, 1);
|
|
1186
|
+
} else {
|
|
1187
|
+
delete obj[field];
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
if (!state.remove) {
|
|
1192
|
+
const target = obj[state.newKey || field];
|
|
1193
|
+
|
|
1194
|
+
if (this.isRef(target)) {
|
|
1195
|
+
this.setRefValue(target, value);
|
|
1196
|
+
} else {
|
|
1197
|
+
obj[state.newKey || field] = value;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
isRef(ref) {
|
|
1204
|
+
// To implement in subclass
|
|
1205
|
+
return false;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
setRefValue(ref, value) {// To implement in subclass
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
getRefValue(ref) {
|
|
1212
|
+
// To implement in subclass
|
|
1213
|
+
return ref;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
exports.StateEditor = StateEditor;
|
|
1219
|
+
|
|
1220
|
+
/***/ }),
|
|
1221
|
+
|
|
1222
|
+
/***/ "../shared-utils/lib/env.js":
|
|
1223
|
+
/*!**********************************!*\
|
|
1224
|
+
!*** ../shared-utils/lib/env.js ***!
|
|
1225
|
+
\**********************************/
|
|
1226
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1231
|
+
value: true
|
|
1232
|
+
}));
|
|
1233
|
+
exports.initEnv = exports.keys = exports.isLinux = exports.isMac = exports.isWindows = exports.isFirefox = exports.isChrome = exports.target = exports.isBrowser = void 0;
|
|
1234
|
+
exports.isBrowser = typeof navigator !== 'undefined' && typeof window !== 'undefined';
|
|
1235
|
+
exports.target = exports.isBrowser ? window : typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof my !== 'undefined' ? my : {};
|
|
1236
|
+
exports.isChrome = typeof exports.target.chrome !== 'undefined' && !!exports.target.chrome.devtools;
|
|
1237
|
+
exports.isFirefox = exports.isBrowser && navigator.userAgent && navigator.userAgent.indexOf('Firefox') > -1;
|
|
1238
|
+
exports.isWindows = exports.isBrowser && navigator.platform.indexOf('Win') === 0;
|
|
1239
|
+
exports.isMac = exports.isBrowser && navigator.platform === 'MacIntel';
|
|
1240
|
+
exports.isLinux = exports.isBrowser && navigator.platform.indexOf('Linux') === 0;
|
|
1241
|
+
exports.keys = {
|
|
1242
|
+
ctrl: exports.isMac ? '⌘' : 'Ctrl',
|
|
1243
|
+
shift: 'Shift',
|
|
1244
|
+
alt: exports.isMac ? '⌥' : 'Alt',
|
|
1245
|
+
del: 'Del',
|
|
1246
|
+
enter: 'Enter',
|
|
1247
|
+
esc: 'Esc'
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
function initEnv(Vue) {
|
|
1251
|
+
if (Vue.prototype.hasOwnProperty('$isChrome')) return;
|
|
1252
|
+
Object.defineProperties(Vue.prototype, {
|
|
1253
|
+
$isChrome: {
|
|
1254
|
+
get: () => exports.isChrome
|
|
1255
|
+
},
|
|
1256
|
+
$isFirefox: {
|
|
1257
|
+
get: () => exports.isFirefox
|
|
1258
|
+
},
|
|
1259
|
+
$isWindows: {
|
|
1260
|
+
get: () => exports.isWindows
|
|
1261
|
+
},
|
|
1262
|
+
$isMac: {
|
|
1263
|
+
get: () => exports.isMac
|
|
1264
|
+
},
|
|
1265
|
+
$isLinux: {
|
|
1266
|
+
get: () => exports.isLinux
|
|
1267
|
+
},
|
|
1268
|
+
$keys: {
|
|
1269
|
+
get: () => exports.keys
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
if (exports.isWindows) document.body.classList.add('platform-windows');
|
|
1273
|
+
if (exports.isMac) document.body.classList.add('platform-mac');
|
|
1274
|
+
if (exports.isLinux) document.body.classList.add('platform-linux');
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
exports.initEnv = initEnv;
|
|
1278
|
+
|
|
1279
|
+
/***/ }),
|
|
1280
|
+
|
|
1281
|
+
/***/ "../shared-utils/lib/index.js":
|
|
1282
|
+
/*!************************************!*\
|
|
1283
|
+
!*** ../shared-utils/lib/index.js ***!
|
|
1284
|
+
\************************************/
|
|
1285
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1290
|
+
if (k2 === undefined) k2 = k;
|
|
1291
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1292
|
+
|
|
1293
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1294
|
+
desc = {
|
|
1295
|
+
enumerable: true,
|
|
1296
|
+
get: function () {
|
|
1297
|
+
return m[k];
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
Object.defineProperty(o, k2, desc);
|
|
1303
|
+
} : function (o, m, k, k2) {
|
|
1304
|
+
if (k2 === undefined) k2 = k;
|
|
1305
|
+
o[k2] = m[k];
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1309
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1313
|
+
value: true
|
|
1314
|
+
}));
|
|
1315
|
+
|
|
1316
|
+
__exportStar(__webpack_require__(/*! ./backend */ "../shared-utils/lib/backend.js"), exports);
|
|
1317
|
+
|
|
1318
|
+
__exportStar(__webpack_require__(/*! ./bridge */ "../shared-utils/lib/bridge.js"), exports);
|
|
1319
|
+
|
|
1320
|
+
__exportStar(__webpack_require__(/*! ./consts */ "../shared-utils/lib/consts.js"), exports);
|
|
1321
|
+
|
|
1322
|
+
__exportStar(__webpack_require__(/*! ./edit */ "../shared-utils/lib/edit.js"), exports);
|
|
1323
|
+
|
|
1324
|
+
__exportStar(__webpack_require__(/*! ./env */ "../shared-utils/lib/env.js"), exports);
|
|
1325
|
+
|
|
1326
|
+
__exportStar(__webpack_require__(/*! ./plugin-permissions */ "../shared-utils/lib/plugin-permissions.js"), exports);
|
|
1327
|
+
|
|
1328
|
+
__exportStar(__webpack_require__(/*! ./plugin-settings */ "../shared-utils/lib/plugin-settings.js"), exports);
|
|
1329
|
+
|
|
1330
|
+
__exportStar(__webpack_require__(/*! ./shared-data */ "../shared-utils/lib/shared-data.js"), exports);
|
|
1331
|
+
|
|
1332
|
+
__exportStar(__webpack_require__(/*! ./shell */ "../shared-utils/lib/shell.js"), exports);
|
|
1333
|
+
|
|
1334
|
+
__exportStar(__webpack_require__(/*! ./storage */ "../shared-utils/lib/storage.js"), exports);
|
|
1335
|
+
|
|
1336
|
+
__exportStar(__webpack_require__(/*! ./transfer */ "../shared-utils/lib/transfer.js"), exports);
|
|
1337
|
+
|
|
1338
|
+
__exportStar(__webpack_require__(/*! ./util */ "../shared-utils/lib/util.js"), exports);
|
|
1339
|
+
|
|
1340
|
+
__exportStar(__webpack_require__(/*! ./raf */ "../shared-utils/lib/raf.js"), exports);
|
|
1341
|
+
|
|
1342
|
+
/***/ }),
|
|
1343
|
+
|
|
1344
|
+
/***/ "../shared-utils/lib/plugin-permissions.js":
|
|
1345
|
+
/*!*************************************************!*\
|
|
1346
|
+
!*** ../shared-utils/lib/plugin-permissions.js ***!
|
|
1347
|
+
\*************************************************/
|
|
1348
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1353
|
+
value: true
|
|
1354
|
+
}));
|
|
1355
|
+
exports.setPluginPermission = exports.hasPluginPermission = exports.PluginPermission = void 0;
|
|
1356
|
+
|
|
1357
|
+
const shared_data_1 = __webpack_require__(/*! ./shared-data */ "../shared-utils/lib/shared-data.js");
|
|
1358
|
+
|
|
1359
|
+
var PluginPermission;
|
|
1360
|
+
|
|
1361
|
+
(function (PluginPermission) {
|
|
1362
|
+
PluginPermission["ENABLED"] = "enabled";
|
|
1363
|
+
PluginPermission["COMPONENTS"] = "components";
|
|
1364
|
+
PluginPermission["CUSTOM_INSPECTOR"] = "custom-inspector";
|
|
1365
|
+
PluginPermission["TIMELINE"] = "timeline";
|
|
1366
|
+
})(PluginPermission = exports.PluginPermission || (exports.PluginPermission = {}));
|
|
1367
|
+
|
|
1368
|
+
function hasPluginPermission(pluginId, permission) {
|
|
1369
|
+
const result = shared_data_1.SharedData.pluginPermissions[`${pluginId}:${permission}`];
|
|
1370
|
+
if (result == null) return true;
|
|
1371
|
+
return !!result;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
exports.hasPluginPermission = hasPluginPermission;
|
|
1375
|
+
|
|
1376
|
+
function setPluginPermission(pluginId, permission, active) {
|
|
1377
|
+
shared_data_1.SharedData.pluginPermissions = { ...shared_data_1.SharedData.pluginPermissions,
|
|
1378
|
+
[`${pluginId}:${permission}`]: active
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
exports.setPluginPermission = setPluginPermission;
|
|
1383
|
+
|
|
1384
|
+
/***/ }),
|
|
1385
|
+
|
|
1386
|
+
/***/ "../shared-utils/lib/plugin-settings.js":
|
|
1387
|
+
/*!**********************************************!*\
|
|
1388
|
+
!*** ../shared-utils/lib/plugin-settings.js ***!
|
|
1389
|
+
\**********************************************/
|
|
1390
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1395
|
+
value: true
|
|
1396
|
+
}));
|
|
1397
|
+
exports.getPluginDefaultSettings = exports.setPluginSettings = exports.getPluginSettings = void 0;
|
|
1398
|
+
|
|
1399
|
+
const shared_data_1 = __webpack_require__(/*! ./shared-data */ "../shared-utils/lib/shared-data.js");
|
|
1400
|
+
|
|
1401
|
+
function getPluginSettings(pluginId, defaultSettings) {
|
|
1402
|
+
var _a;
|
|
1403
|
+
|
|
1404
|
+
return { ...(defaultSettings !== null && defaultSettings !== void 0 ? defaultSettings : {}),
|
|
1405
|
+
...((_a = shared_data_1.SharedData.pluginSettings[pluginId]) !== null && _a !== void 0 ? _a : {})
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
exports.getPluginSettings = getPluginSettings;
|
|
1410
|
+
|
|
1411
|
+
function setPluginSettings(pluginId, settings) {
|
|
1412
|
+
shared_data_1.SharedData.pluginSettings = { ...shared_data_1.SharedData.pluginSettings,
|
|
1413
|
+
[pluginId]: settings
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
exports.setPluginSettings = setPluginSettings;
|
|
1418
|
+
|
|
1419
|
+
function getPluginDefaultSettings(schema) {
|
|
1420
|
+
const result = {};
|
|
1421
|
+
|
|
1422
|
+
if (schema) {
|
|
1423
|
+
for (const id in schema) {
|
|
1424
|
+
const item = schema[id];
|
|
1425
|
+
result[id] = item.defaultValue;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return result;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
exports.getPluginDefaultSettings = getPluginDefaultSettings;
|
|
1433
|
+
|
|
1434
|
+
/***/ }),
|
|
1435
|
+
|
|
1436
|
+
/***/ "../shared-utils/lib/raf.js":
|
|
1437
|
+
/*!**********************************!*\
|
|
1438
|
+
!*** ../shared-utils/lib/raf.js ***!
|
|
1439
|
+
\**********************************/
|
|
1440
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1445
|
+
value: true
|
|
1446
|
+
}));
|
|
1447
|
+
exports.raf = void 0;
|
|
1448
|
+
let pendingCallbacks = [];
|
|
1449
|
+
/**
|
|
1450
|
+
* requestAnimationFrame that also works on non-browser environments like Node.
|
|
1451
|
+
*/
|
|
1452
|
+
|
|
1453
|
+
exports.raf = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : typeof setImmediate === 'function' ? fn => {
|
|
1454
|
+
if (!pendingCallbacks.length) {
|
|
1455
|
+
setImmediate(() => {
|
|
1456
|
+
const now = performance.now();
|
|
1457
|
+
const cbs = pendingCallbacks; // in case cbs add new callbacks
|
|
1458
|
+
|
|
1459
|
+
pendingCallbacks = [];
|
|
1460
|
+
cbs.forEach(cb => cb(now));
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
pendingCallbacks.push(fn);
|
|
1465
|
+
} : function (callback) {
|
|
1466
|
+
return setTimeout(function () {
|
|
1467
|
+
callback(Date.now());
|
|
1468
|
+
}, 1000 / 60);
|
|
1469
|
+
};
|
|
1470
|
+
|
|
1471
|
+
/***/ }),
|
|
1472
|
+
|
|
1473
|
+
/***/ "../shared-utils/lib/shared-data.js":
|
|
1474
|
+
/*!******************************************!*\
|
|
1475
|
+
!*** ../shared-utils/lib/shared-data.js ***!
|
|
1476
|
+
\******************************************/
|
|
1477
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1482
|
+
value: true
|
|
1483
|
+
}));
|
|
1484
|
+
exports.SharedData = exports.watchSharedData = exports.destroySharedData = exports.onSharedDataInit = exports.initSharedData = void 0;
|
|
1485
|
+
|
|
1486
|
+
const storage_1 = __webpack_require__(/*! ./storage */ "../shared-utils/lib/storage.js");
|
|
1487
|
+
|
|
1488
|
+
const env_1 = __webpack_require__(/*! ./env */ "../shared-utils/lib/env.js"); // Initial state
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
const internalSharedData = {
|
|
1492
|
+
openInEditorHost: '/',
|
|
1493
|
+
componentNameStyle: 'class',
|
|
1494
|
+
theme: 'auto',
|
|
1495
|
+
displayDensity: 'low',
|
|
1496
|
+
timeFormat: 'default',
|
|
1497
|
+
recordVuex: true,
|
|
1498
|
+
cacheVuexSnapshotsEvery: 50,
|
|
1499
|
+
cacheVuexSnapshotsLimit: 10,
|
|
1500
|
+
snapshotLoading: false,
|
|
1501
|
+
componentEventsEnabled: true,
|
|
1502
|
+
performanceMonitoringEnabled: true,
|
|
1503
|
+
editableProps: false,
|
|
1504
|
+
logDetected: true,
|
|
1505
|
+
vuexNewBackend: false,
|
|
1506
|
+
vuexAutoload: false,
|
|
1507
|
+
vuexGroupGettersByModule: true,
|
|
1508
|
+
showMenuScrollTip: true,
|
|
1509
|
+
timelineTimeGrid: true,
|
|
1510
|
+
timelineScreenshots: true,
|
|
1511
|
+
menuStepScrolling: env_1.isMac,
|
|
1512
|
+
pluginPermissions: {},
|
|
1513
|
+
pluginSettings: {},
|
|
1514
|
+
pageConfig: {},
|
|
1515
|
+
legacyApps: false,
|
|
1516
|
+
trackUpdates: true,
|
|
1517
|
+
flashUpdates: false,
|
|
1518
|
+
debugInfo: false,
|
|
1519
|
+
isBrowser: env_1.isBrowser
|
|
1520
|
+
};
|
|
1521
|
+
const persisted = ['componentNameStyle', 'theme', 'displayDensity', 'recordVuex', 'editableProps', 'logDetected', 'vuexNewBackend', 'vuexAutoload', 'vuexGroupGettersByModule', 'timeFormat', 'showMenuScrollTip', 'timelineTimeGrid', 'timelineScreenshots', 'menuStepScrolling', 'pluginPermissions', 'pluginSettings', 'performanceMonitoringEnabled', 'componentEventsEnabled', 'trackUpdates', 'flashUpdates', 'debugInfo'];
|
|
1522
|
+
const storageVersion = '6.0.0-alpha.1'; // ---- INTERNALS ---- //
|
|
1523
|
+
|
|
1524
|
+
let bridge; // List of fields to persist to storage (disabled if 'false')
|
|
1525
|
+
// This should be unique to each shared data client to prevent conflicts
|
|
1526
|
+
|
|
1527
|
+
let persist = false;
|
|
1528
|
+
let data;
|
|
1529
|
+
let initRetryInterval;
|
|
1530
|
+
let initRetryCount = 0;
|
|
1531
|
+
const initCbs = [];
|
|
1532
|
+
|
|
1533
|
+
function initSharedData(params) {
|
|
1534
|
+
return new Promise(resolve => {
|
|
1535
|
+
// Mandatory params
|
|
1536
|
+
bridge = params.bridge;
|
|
1537
|
+
persist = !!params.persist;
|
|
1538
|
+
|
|
1539
|
+
if (persist) {
|
|
1540
|
+
if (true) {
|
|
1541
|
+
// eslint-disable-next-line no-console
|
|
1542
|
+
console.log('[shared data] Master init in progress...');
|
|
1543
|
+
} // Load persisted fields
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
persisted.forEach(key => {
|
|
1547
|
+
const value = (0, storage_1.getStorage)(`vue-devtools-${storageVersion}:shared-data:${key}`);
|
|
1548
|
+
|
|
1549
|
+
if (value !== null) {
|
|
1550
|
+
internalSharedData[key] = value;
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
bridge.on('shared-data:load', () => {
|
|
1554
|
+
// Send all fields
|
|
1555
|
+
Object.keys(internalSharedData).forEach(key => {
|
|
1556
|
+
sendValue(key, internalSharedData[key]);
|
|
1557
|
+
});
|
|
1558
|
+
bridge.send('shared-data:load-complete');
|
|
1559
|
+
});
|
|
1560
|
+
bridge.on('shared-data:init-complete', () => {
|
|
1561
|
+
if (true) {
|
|
1562
|
+
// eslint-disable-next-line no-console
|
|
1563
|
+
console.log('[shared data] Master init complete');
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
clearInterval(initRetryInterval);
|
|
1567
|
+
resolve();
|
|
1568
|
+
});
|
|
1569
|
+
bridge.send('shared-data:master-init-waiting'); // In case backend init is executed after frontend
|
|
1570
|
+
|
|
1571
|
+
bridge.on('shared-data:minion-init-waiting', () => {
|
|
1572
|
+
bridge.send('shared-data:master-init-waiting');
|
|
1573
|
+
});
|
|
1574
|
+
initRetryCount = 0;
|
|
1575
|
+
clearInterval(initRetryInterval);
|
|
1576
|
+
initRetryInterval = setInterval(() => {
|
|
1577
|
+
if (true) {
|
|
1578
|
+
// eslint-disable-next-line no-console
|
|
1579
|
+
console.log('[shared data] Master init retrying...');
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
bridge.send('shared-data:master-init-waiting');
|
|
1583
|
+
initRetryCount++;
|
|
1584
|
+
|
|
1585
|
+
if (initRetryCount > 30) {
|
|
1586
|
+
clearInterval(initRetryInterval);
|
|
1587
|
+
console.error('[shared data] Master init failed');
|
|
1588
|
+
}
|
|
1589
|
+
}, 2000);
|
|
1590
|
+
} else {
|
|
1591
|
+
if (true) {
|
|
1592
|
+
// eslint-disable-next-line no-console
|
|
1593
|
+
console.log('[shared data] Minion init in progress...');
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
bridge.on('shared-data:master-init-waiting', () => {
|
|
1597
|
+
if (true) {
|
|
1598
|
+
// eslint-disable-next-line no-console
|
|
1599
|
+
console.log('[shared data] Minion loading data...');
|
|
1600
|
+
} // Load all persisted shared data
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
bridge.send('shared-data:load');
|
|
1604
|
+
bridge.once('shared-data:load-complete', () => {
|
|
1605
|
+
if (true) {
|
|
1606
|
+
// eslint-disable-next-line no-console
|
|
1607
|
+
console.log('[shared data] Minion init complete');
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
bridge.send('shared-data:init-complete');
|
|
1611
|
+
resolve();
|
|
1612
|
+
});
|
|
1613
|
+
});
|
|
1614
|
+
bridge.send('shared-data:minion-init-waiting');
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
data = { ...internalSharedData
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
if (params.Vue) {
|
|
1621
|
+
data = params.Vue.observable(data);
|
|
1622
|
+
} // Update value from other shared data clients
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
bridge.on('shared-data:set', ({
|
|
1626
|
+
key,
|
|
1627
|
+
value
|
|
1628
|
+
}) => {
|
|
1629
|
+
setValue(key, value);
|
|
1630
|
+
});
|
|
1631
|
+
initCbs.forEach(cb => cb());
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
exports.initSharedData = initSharedData;
|
|
1636
|
+
|
|
1637
|
+
function onSharedDataInit(cb) {
|
|
1638
|
+
initCbs.push(cb);
|
|
1639
|
+
return () => {
|
|
1640
|
+
const index = initCbs.indexOf(cb);
|
|
1641
|
+
if (index !== -1) initCbs.splice(index, 1);
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
exports.onSharedDataInit = onSharedDataInit;
|
|
1646
|
+
|
|
1647
|
+
function destroySharedData() {
|
|
1648
|
+
bridge.removeAllListeners('shared-data:set');
|
|
1649
|
+
watchers = {};
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
exports.destroySharedData = destroySharedData;
|
|
1653
|
+
let watchers = {};
|
|
1654
|
+
|
|
1655
|
+
function setValue(key, value) {
|
|
1656
|
+
// Storage
|
|
1657
|
+
if (persist && persisted.includes(key)) {
|
|
1658
|
+
(0, storage_1.setStorage)(`vue-devtools-${storageVersion}:shared-data:${key}`, value);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
const oldValue = data[key];
|
|
1662
|
+
data[key] = value;
|
|
1663
|
+
const handlers = watchers[key];
|
|
1664
|
+
|
|
1665
|
+
if (handlers) {
|
|
1666
|
+
handlers.forEach(h => h(value, oldValue));
|
|
1667
|
+
} // Validate Proxy set trap
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
return true;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
function sendValue(key, value) {
|
|
1674
|
+
bridge && bridge.send('shared-data:set', {
|
|
1675
|
+
key,
|
|
1676
|
+
value
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
function watchSharedData(prop, handler) {
|
|
1681
|
+
const list = watchers[prop] || (watchers[prop] = []);
|
|
1682
|
+
list.push(handler);
|
|
1683
|
+
return () => {
|
|
1684
|
+
const index = list.indexOf(handler);
|
|
1685
|
+
if (index !== -1) list.splice(index, 1);
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
exports.watchSharedData = watchSharedData;
|
|
1690
|
+
const proxy = {};
|
|
1691
|
+
Object.keys(internalSharedData).forEach(key => {
|
|
1692
|
+
Object.defineProperty(proxy, key, {
|
|
1693
|
+
configurable: false,
|
|
1694
|
+
get: () => data[key],
|
|
1695
|
+
set: value => {
|
|
1696
|
+
sendValue(key, value);
|
|
1697
|
+
setValue(key, value);
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
});
|
|
1701
|
+
exports.SharedData = proxy;
|
|
1702
|
+
|
|
1703
|
+
/***/ }),
|
|
1704
|
+
|
|
1705
|
+
/***/ "../shared-utils/lib/shell.js":
|
|
1706
|
+
/*!************************************!*\
|
|
1707
|
+
!*** ../shared-utils/lib/shell.js ***!
|
|
1708
|
+
\************************************/
|
|
1709
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1714
|
+
value: true
|
|
1715
|
+
}));
|
|
1716
|
+
|
|
1717
|
+
/***/ }),
|
|
1718
|
+
|
|
1719
|
+
/***/ "../shared-utils/lib/storage.js":
|
|
1720
|
+
/*!**************************************!*\
|
|
1721
|
+
!*** ../shared-utils/lib/storage.js ***!
|
|
1722
|
+
\**************************************/
|
|
1723
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
|
|
1727
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1728
|
+
value: true
|
|
1729
|
+
}));
|
|
1730
|
+
exports.clearStorage = exports.removeStorage = exports.setStorage = exports.getStorage = exports.initStorage = void 0;
|
|
1731
|
+
|
|
1732
|
+
const env_1 = __webpack_require__(/*! ./env */ "../shared-utils/lib/env.js"); // If we can, we use the browser extension API to store data
|
|
1733
|
+
// it's async though, so we synchronize changes from an intermediate
|
|
1734
|
+
// storageData object
|
|
1735
|
+
|
|
1736
|
+
|
|
1737
|
+
const useStorage = typeof env_1.target.chrome !== 'undefined' && typeof env_1.target.chrome.storage !== 'undefined';
|
|
1738
|
+
let storageData = null;
|
|
1739
|
+
|
|
1740
|
+
function initStorage() {
|
|
1741
|
+
return new Promise(resolve => {
|
|
1742
|
+
if (useStorage) {
|
|
1743
|
+
env_1.target.chrome.storage.local.get(null, result => {
|
|
1744
|
+
storageData = result;
|
|
1745
|
+
resolve();
|
|
1746
|
+
});
|
|
1747
|
+
} else {
|
|
1748
|
+
storageData = {};
|
|
1749
|
+
resolve();
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
exports.initStorage = initStorage;
|
|
1755
|
+
|
|
1756
|
+
function getStorage(key, defaultValue = null) {
|
|
1757
|
+
checkStorage();
|
|
1758
|
+
|
|
1759
|
+
if (useStorage) {
|
|
1760
|
+
return getDefaultValue(storageData[key], defaultValue);
|
|
1761
|
+
} else {
|
|
1762
|
+
try {
|
|
1763
|
+
return getDefaultValue(JSON.parse(localStorage.getItem(key)), defaultValue);
|
|
1764
|
+
} catch (e) {}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
exports.getStorage = getStorage;
|
|
1769
|
+
|
|
1770
|
+
function setStorage(key, val) {
|
|
1771
|
+
checkStorage();
|
|
1772
|
+
|
|
1773
|
+
if (useStorage) {
|
|
1774
|
+
storageData[key] = val;
|
|
1775
|
+
env_1.target.chrome.storage.local.set({
|
|
1776
|
+
[key]: val
|
|
1777
|
+
});
|
|
1778
|
+
} else {
|
|
1779
|
+
try {
|
|
1780
|
+
localStorage.setItem(key, JSON.stringify(val));
|
|
1781
|
+
} catch (e) {}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
exports.setStorage = setStorage;
|
|
1786
|
+
|
|
1787
|
+
function removeStorage(key) {
|
|
1788
|
+
checkStorage();
|
|
1789
|
+
|
|
1790
|
+
if (useStorage) {
|
|
1791
|
+
delete storageData[key];
|
|
1792
|
+
env_1.target.chrome.storage.local.remove([key]);
|
|
1793
|
+
} else {
|
|
1794
|
+
try {
|
|
1795
|
+
localStorage.removeItem(key);
|
|
1796
|
+
} catch (e) {}
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
exports.removeStorage = removeStorage;
|
|
1801
|
+
|
|
1802
|
+
function clearStorage() {
|
|
1803
|
+
checkStorage();
|
|
1804
|
+
|
|
1805
|
+
if (useStorage) {
|
|
1806
|
+
storageData = {};
|
|
1807
|
+
env_1.target.chrome.storage.local.clear();
|
|
1808
|
+
} else {
|
|
1809
|
+
try {
|
|
1810
|
+
localStorage.clear();
|
|
1811
|
+
} catch (e) {}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
exports.clearStorage = clearStorage;
|
|
1816
|
+
|
|
1817
|
+
function checkStorage() {
|
|
1818
|
+
if (!storageData) {
|
|
1819
|
+
throw new Error('Storage wasn\'t initialized with \'init()\'');
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
function getDefaultValue(value, defaultValue) {
|
|
1824
|
+
if (value == null) {
|
|
1825
|
+
return defaultValue;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
return value;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/***/ }),
|
|
1832
|
+
|
|
1833
|
+
/***/ "../shared-utils/lib/transfer.js":
|
|
1834
|
+
/*!***************************************!*\
|
|
1835
|
+
!*** ../shared-utils/lib/transfer.js ***!
|
|
1836
|
+
\***************************************/
|
|
1837
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1842
|
+
value: true
|
|
1843
|
+
}));
|
|
1844
|
+
exports.stringifyStrictCircularAutoChunks = exports.parseCircularAutoChunks = exports.stringifyCircularAutoChunks = void 0;
|
|
1845
|
+
const MAX_SERIALIZED_SIZE = 512 * 1024; // 1MB
|
|
1846
|
+
|
|
1847
|
+
function encode(data, replacer, list, seen) {
|
|
1848
|
+
let stored, key, value, i, l;
|
|
1849
|
+
const seenIndex = seen.get(data);
|
|
1850
|
+
|
|
1851
|
+
if (seenIndex != null) {
|
|
1852
|
+
return seenIndex;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
const index = list.length;
|
|
1856
|
+
const proto = Object.prototype.toString.call(data);
|
|
1857
|
+
|
|
1858
|
+
if (proto === '[object Object]') {
|
|
1859
|
+
stored = {};
|
|
1860
|
+
seen.set(data, index);
|
|
1861
|
+
list.push(stored);
|
|
1862
|
+
const keys = Object.keys(data);
|
|
1863
|
+
|
|
1864
|
+
for (i = 0, l = keys.length; i < l; i++) {
|
|
1865
|
+
key = keys[i];
|
|
1866
|
+
|
|
1867
|
+
try {
|
|
1868
|
+
value = data[key];
|
|
1869
|
+
if (replacer) value = replacer.call(data, key, value);
|
|
1870
|
+
} catch (e) {
|
|
1871
|
+
value = e;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
stored[key] = encode(value, replacer, list, seen);
|
|
1875
|
+
}
|
|
1876
|
+
} else if (proto === '[object Array]') {
|
|
1877
|
+
stored = [];
|
|
1878
|
+
seen.set(data, index);
|
|
1879
|
+
list.push(stored);
|
|
1880
|
+
|
|
1881
|
+
for (i = 0, l = data.length; i < l; i++) {
|
|
1882
|
+
try {
|
|
1883
|
+
value = data[i];
|
|
1884
|
+
if (replacer) value = replacer.call(data, i, value);
|
|
1885
|
+
} catch (e) {
|
|
1886
|
+
value = e;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
stored[i] = encode(value, replacer, list, seen);
|
|
1890
|
+
}
|
|
1891
|
+
} else {
|
|
1892
|
+
list.push(data);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
return index;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
function decode(list, reviver) {
|
|
1899
|
+
let i = list.length;
|
|
1900
|
+
let j, k, data, key, value, proto;
|
|
1901
|
+
|
|
1902
|
+
while (i--) {
|
|
1903
|
+
data = list[i];
|
|
1904
|
+
proto = Object.prototype.toString.call(data);
|
|
1905
|
+
|
|
1906
|
+
if (proto === '[object Object]') {
|
|
1907
|
+
const keys = Object.keys(data);
|
|
1908
|
+
|
|
1909
|
+
for (j = 0, k = keys.length; j < k; j++) {
|
|
1910
|
+
key = keys[j];
|
|
1911
|
+
value = list[data[key]];
|
|
1912
|
+
if (reviver) value = reviver.call(data, key, value);
|
|
1913
|
+
data[key] = value;
|
|
1914
|
+
}
|
|
1915
|
+
} else if (proto === '[object Array]') {
|
|
1916
|
+
for (j = 0, k = data.length; j < k; j++) {
|
|
1917
|
+
value = list[data[j]];
|
|
1918
|
+
if (reviver) value = reviver.call(data, j, value);
|
|
1919
|
+
data[j] = value;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
function stringifyCircularAutoChunks(data, replacer = null, space = null) {
|
|
1926
|
+
let result;
|
|
1927
|
+
|
|
1928
|
+
try {
|
|
1929
|
+
result = arguments.length === 1 ? JSON.stringify(data) // @ts-ignore
|
|
1930
|
+
: JSON.stringify(data, replacer, space);
|
|
1931
|
+
} catch (e) {
|
|
1932
|
+
result = stringifyStrictCircularAutoChunks(data, replacer, space);
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
if (result.length > MAX_SERIALIZED_SIZE) {
|
|
1936
|
+
const chunkCount = Math.ceil(result.length / MAX_SERIALIZED_SIZE);
|
|
1937
|
+
const chunks = [];
|
|
1938
|
+
|
|
1939
|
+
for (let i = 0; i < chunkCount; i++) {
|
|
1940
|
+
chunks.push(result.slice(i * MAX_SERIALIZED_SIZE, (i + 1) * MAX_SERIALIZED_SIZE));
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
return chunks;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
return result;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
exports.stringifyCircularAutoChunks = stringifyCircularAutoChunks;
|
|
1950
|
+
|
|
1951
|
+
function parseCircularAutoChunks(data, reviver = null) {
|
|
1952
|
+
if (Array.isArray(data)) {
|
|
1953
|
+
data = data.join('');
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
const hasCircular = /^\s/.test(data);
|
|
1957
|
+
|
|
1958
|
+
if (!hasCircular) {
|
|
1959
|
+
return arguments.length === 1 ? JSON.parse(data) // @ts-ignore
|
|
1960
|
+
: JSON.parse(data, reviver);
|
|
1961
|
+
} else {
|
|
1962
|
+
const list = JSON.parse(data);
|
|
1963
|
+
decode(list, reviver);
|
|
1964
|
+
return list[0];
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
exports.parseCircularAutoChunks = parseCircularAutoChunks;
|
|
1969
|
+
|
|
1970
|
+
function stringifyStrictCircularAutoChunks(data, replacer = null, space = null) {
|
|
1971
|
+
const list = [];
|
|
1972
|
+
encode(data, replacer, list, new Map());
|
|
1973
|
+
return space ? ' ' + JSON.stringify(list, null, space) : ' ' + JSON.stringify(list);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
exports.stringifyStrictCircularAutoChunks = stringifyStrictCircularAutoChunks;
|
|
1977
|
+
|
|
1978
|
+
/***/ }),
|
|
1979
|
+
|
|
1980
|
+
/***/ "../shared-utils/lib/util.js":
|
|
1981
|
+
/*!***********************************!*\
|
|
1982
|
+
!*** ../shared-utils/lib/util.js ***!
|
|
1983
|
+
\***********************************/
|
|
1984
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1985
|
+
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
1989
|
+
return mod && mod.__esModule ? mod : {
|
|
1990
|
+
"default": mod
|
|
1991
|
+
};
|
|
1992
|
+
};
|
|
1993
|
+
|
|
1994
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1995
|
+
value: true
|
|
1996
|
+
}));
|
|
1997
|
+
exports.isEmptyObject = exports.copyToClipboard = exports.escape = exports.openInEditor = exports.focusInput = exports.simpleGet = exports.sortByKey = exports.searchDeepInObject = exports.isPlainObject = exports.revive = exports.parse = exports.getCustomRefDetails = exports.getCustomHTMLElementDetails = exports.getCustomFunctionDetails = exports.getCustomComponentDefinitionDetails = exports.getComponentName = exports.reviveSet = exports.getCustomSetDetails = exports.reviveMap = exports.getCustomMapDetails = exports.stringify = exports.specialTokenToString = exports.MAX_ARRAY_SIZE = exports.MAX_STRING_SIZE = exports.SPECIAL_TOKENS = exports.NAN = exports.NEGATIVE_INFINITY = exports.INFINITY = exports.UNDEFINED = exports.inDoc = exports.getComponentDisplayName = exports.kebabize = exports.camelize = exports.classify = void 0;
|
|
1998
|
+
|
|
1999
|
+
const path_1 = __importDefault(__webpack_require__(/*! path */ "../../node_modules/path-browserify/index.js"));
|
|
2000
|
+
|
|
2001
|
+
const transfer_1 = __webpack_require__(/*! ./transfer */ "../shared-utils/lib/transfer.js");
|
|
2002
|
+
|
|
2003
|
+
const backend_1 = __webpack_require__(/*! ./backend */ "../shared-utils/lib/backend.js");
|
|
2004
|
+
|
|
2005
|
+
const shared_data_1 = __webpack_require__(/*! ./shared-data */ "../shared-utils/lib/shared-data.js");
|
|
2006
|
+
|
|
2007
|
+
const env_1 = __webpack_require__(/*! ./env */ "../shared-utils/lib/env.js");
|
|
2008
|
+
|
|
2009
|
+
function cached(fn) {
|
|
2010
|
+
const cache = Object.create(null);
|
|
2011
|
+
return function cachedFn(str) {
|
|
2012
|
+
const hit = cache[str];
|
|
2013
|
+
return hit || (cache[str] = fn(str));
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
const classifyRE = /(?:^|[-_/])(\w)/g;
|
|
2018
|
+
exports.classify = cached(str => {
|
|
2019
|
+
// fix: str.replace may causes '"replace" is not a function' exception.
|
|
2020
|
+
// This bug may causes the UI 'Component Filter' to not work properly
|
|
2021
|
+
// e.g. The type of 'str' is Number.
|
|
2022
|
+
// So need cover 'str' to String.
|
|
2023
|
+
return str && ('' + str).replace(classifyRE, toUpper);
|
|
2024
|
+
});
|
|
2025
|
+
const camelizeRE = /-(\w)/g;
|
|
2026
|
+
exports.camelize = cached(str => {
|
|
2027
|
+
return str && str.replace(camelizeRE, toUpper);
|
|
2028
|
+
});
|
|
2029
|
+
const kebabizeRE = /([a-z0-9])([A-Z])/g;
|
|
2030
|
+
exports.kebabize = cached(str => {
|
|
2031
|
+
return str && str.replace(kebabizeRE, (_, lowerCaseCharacter, upperCaseLetter) => {
|
|
2032
|
+
return `${lowerCaseCharacter}-${upperCaseLetter}`;
|
|
2033
|
+
}).toLowerCase();
|
|
2034
|
+
});
|
|
2035
|
+
|
|
2036
|
+
function toUpper(_, c) {
|
|
2037
|
+
return c ? c.toUpperCase() : '';
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
function getComponentDisplayName(originalName, style = 'class') {
|
|
2041
|
+
switch (style) {
|
|
2042
|
+
case 'class':
|
|
2043
|
+
return (0, exports.classify)(originalName);
|
|
2044
|
+
|
|
2045
|
+
case 'kebab':
|
|
2046
|
+
return (0, exports.kebabize)(originalName);
|
|
2047
|
+
|
|
2048
|
+
case 'original':
|
|
2049
|
+
default:
|
|
2050
|
+
return originalName;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
exports.getComponentDisplayName = getComponentDisplayName;
|
|
2055
|
+
|
|
2056
|
+
function inDoc(node) {
|
|
2057
|
+
if (!node) return false;
|
|
2058
|
+
const doc = node.ownerDocument.documentElement;
|
|
2059
|
+
const parent = node.parentNode;
|
|
2060
|
+
return doc === node || doc === parent || !!(parent && parent.nodeType === 1 && doc.contains(parent));
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
exports.inDoc = inDoc;
|
|
2064
|
+
/**
|
|
2065
|
+
* Stringify/parse data using CircularJSON.
|
|
2066
|
+
*/
|
|
2067
|
+
|
|
2068
|
+
exports.UNDEFINED = '__vue_devtool_undefined__';
|
|
2069
|
+
exports.INFINITY = '__vue_devtool_infinity__';
|
|
2070
|
+
exports.NEGATIVE_INFINITY = '__vue_devtool_negative_infinity__';
|
|
2071
|
+
exports.NAN = '__vue_devtool_nan__';
|
|
2072
|
+
exports.SPECIAL_TOKENS = {
|
|
2073
|
+
true: true,
|
|
2074
|
+
false: false,
|
|
2075
|
+
undefined: exports.UNDEFINED,
|
|
2076
|
+
null: null,
|
|
2077
|
+
'-Infinity': exports.NEGATIVE_INFINITY,
|
|
2078
|
+
Infinity: exports.INFINITY,
|
|
2079
|
+
NaN: exports.NAN
|
|
2080
|
+
};
|
|
2081
|
+
exports.MAX_STRING_SIZE = 10000;
|
|
2082
|
+
exports.MAX_ARRAY_SIZE = 5000;
|
|
2083
|
+
|
|
2084
|
+
function specialTokenToString(value) {
|
|
2085
|
+
if (value === null) {
|
|
2086
|
+
return 'null';
|
|
2087
|
+
} else if (value === exports.UNDEFINED) {
|
|
2088
|
+
return 'undefined';
|
|
2089
|
+
} else if (value === exports.NAN) {
|
|
2090
|
+
return 'NaN';
|
|
2091
|
+
} else if (value === exports.INFINITY) {
|
|
2092
|
+
return 'Infinity';
|
|
2093
|
+
} else if (value === exports.NEGATIVE_INFINITY) {
|
|
2094
|
+
return '-Infinity';
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
return false;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
exports.specialTokenToString = specialTokenToString;
|
|
2101
|
+
/**
|
|
2102
|
+
* Needed to prevent stack overflow
|
|
2103
|
+
* while replacing complex objects
|
|
2104
|
+
* like components because we create
|
|
2105
|
+
* new objects with the CustomValue API
|
|
2106
|
+
* (.i.e `{ _custom: { ... } }`)
|
|
2107
|
+
*/
|
|
2108
|
+
|
|
2109
|
+
class EncodeCache {
|
|
2110
|
+
constructor() {
|
|
2111
|
+
this.map = new Map();
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Returns a result unique to each input data
|
|
2115
|
+
* @param {*} data Input data
|
|
2116
|
+
* @param {*} factory Function used to create the unique result
|
|
2117
|
+
*/
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
cache(data, factory) {
|
|
2121
|
+
const cached = this.map.get(data);
|
|
2122
|
+
|
|
2123
|
+
if (cached) {
|
|
2124
|
+
return cached;
|
|
2125
|
+
} else {
|
|
2126
|
+
const result = factory(data);
|
|
2127
|
+
this.map.set(data, result);
|
|
2128
|
+
return result;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
clear() {
|
|
2133
|
+
this.map.clear();
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
const encodeCache = new EncodeCache();
|
|
2139
|
+
|
|
2140
|
+
class ReviveCache {
|
|
2141
|
+
constructor(maxSize) {
|
|
2142
|
+
this.maxSize = maxSize;
|
|
2143
|
+
this.map = new Map();
|
|
2144
|
+
this.index = 0;
|
|
2145
|
+
this.size = 0;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
cache(value) {
|
|
2149
|
+
const currentIndex = this.index;
|
|
2150
|
+
this.map.set(currentIndex, value);
|
|
2151
|
+
this.size++;
|
|
2152
|
+
|
|
2153
|
+
if (this.size > this.maxSize) {
|
|
2154
|
+
this.map.delete(currentIndex - this.size);
|
|
2155
|
+
this.size--;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
this.index++;
|
|
2159
|
+
return currentIndex;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
read(id) {
|
|
2163
|
+
return this.map.get(id);
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
const reviveCache = new ReviveCache(1000);
|
|
2169
|
+
const replacers = {
|
|
2170
|
+
internal: replacerForInternal,
|
|
2171
|
+
user: replaceForUser
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
function stringify(data, target = 'internal') {
|
|
2175
|
+
// Create a fresh cache for each serialization
|
|
2176
|
+
encodeCache.clear();
|
|
2177
|
+
return (0, transfer_1.stringifyCircularAutoChunks)(data, replacers[target]);
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
exports.stringify = stringify;
|
|
2181
|
+
|
|
2182
|
+
function replacerForInternal(key) {
|
|
2183
|
+
var _a; // @ts-ignore
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
const val = this[key];
|
|
2187
|
+
const type = typeof val;
|
|
2188
|
+
|
|
2189
|
+
if (Array.isArray(val)) {
|
|
2190
|
+
const l = val.length;
|
|
2191
|
+
|
|
2192
|
+
if (l > exports.MAX_ARRAY_SIZE) {
|
|
2193
|
+
return {
|
|
2194
|
+
_isArray: true,
|
|
2195
|
+
length: l,
|
|
2196
|
+
items: val.slice(0, exports.MAX_ARRAY_SIZE)
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
return val;
|
|
2201
|
+
} else if (typeof val === 'string') {
|
|
2202
|
+
if (val.length > exports.MAX_STRING_SIZE) {
|
|
2203
|
+
return val.substring(0, exports.MAX_STRING_SIZE) + `... (${val.length} total length)`;
|
|
2204
|
+
} else {
|
|
2205
|
+
return val;
|
|
2206
|
+
}
|
|
2207
|
+
} else if (type === 'undefined') {
|
|
2208
|
+
return exports.UNDEFINED;
|
|
2209
|
+
} else if (val === Infinity) {
|
|
2210
|
+
return exports.INFINITY;
|
|
2211
|
+
} else if (val === -Infinity) {
|
|
2212
|
+
return exports.NEGATIVE_INFINITY;
|
|
2213
|
+
} else if (type === 'function') {
|
|
2214
|
+
return getCustomFunctionDetails(val);
|
|
2215
|
+
} else if (type === 'symbol') {
|
|
2216
|
+
return `[native Symbol ${Symbol.prototype.toString.call(val)}]`;
|
|
2217
|
+
} else if (val !== null && type === 'object') {
|
|
2218
|
+
const proto = Object.prototype.toString.call(val);
|
|
2219
|
+
|
|
2220
|
+
if (proto === '[object Map]') {
|
|
2221
|
+
return encodeCache.cache(val, () => getCustomMapDetails(val));
|
|
2222
|
+
} else if (proto === '[object Set]') {
|
|
2223
|
+
return encodeCache.cache(val, () => getCustomSetDetails(val));
|
|
2224
|
+
} else if (proto === '[object RegExp]') {
|
|
2225
|
+
// special handling of native type
|
|
2226
|
+
return `[native RegExp ${RegExp.prototype.toString.call(val)}]`;
|
|
2227
|
+
} else if (proto === '[object Date]') {
|
|
2228
|
+
return `[native Date ${Date.prototype.toString.call(val)}]`;
|
|
2229
|
+
} else if (proto === '[object Error]') {
|
|
2230
|
+
return `[native Error ${val.message}<>${val.stack}]`;
|
|
2231
|
+
} else if (val.state && val._vm) {
|
|
2232
|
+
return encodeCache.cache(val, () => (0, backend_1.getCustomStoreDetails)(val));
|
|
2233
|
+
} else if (val.constructor && val.constructor.name === 'VueRouter') {
|
|
2234
|
+
return encodeCache.cache(val, () => (0, backend_1.getCustomRouterDetails)(val));
|
|
2235
|
+
} else if ((0, backend_1.isVueInstance)(val)) {
|
|
2236
|
+
return encodeCache.cache(val, () => (0, backend_1.getCustomInstanceDetails)(val));
|
|
2237
|
+
} else if (typeof val.render === 'function') {
|
|
2238
|
+
return encodeCache.cache(val, () => getCustomComponentDefinitionDetails(val));
|
|
2239
|
+
} else if (val.constructor && val.constructor.name === 'VNode') {
|
|
2240
|
+
return `[native VNode <${val.tag}>]`;
|
|
2241
|
+
} else if (typeof HTMLElement !== 'undefined' && val instanceof HTMLElement) {
|
|
2242
|
+
return encodeCache.cache(val, () => getCustomHTMLElementDetails(val));
|
|
2243
|
+
} else if (((_a = val.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Store' && val._wrappedGetters) {
|
|
2244
|
+
return `[object Store]`;
|
|
2245
|
+
} else if (val.currentRoute) {
|
|
2246
|
+
return `[object Router]`;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
const customDetails = (0, backend_1.getCustomObjectDetails)(val, proto);
|
|
2250
|
+
if (customDetails != null) return customDetails;
|
|
2251
|
+
} else if (Number.isNaN(val)) {
|
|
2252
|
+
return exports.NAN;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
return sanitize(val);
|
|
2256
|
+
} // @TODO revive from backend to have more data to the clipboard
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
function replaceForUser(key) {
|
|
2260
|
+
// @ts-ignore
|
|
2261
|
+
let val = this[key];
|
|
2262
|
+
const type = typeof val;
|
|
2263
|
+
|
|
2264
|
+
if ((val === null || val === void 0 ? void 0 : val._custom) && 'value' in val._custom) {
|
|
2265
|
+
val = val._custom.value;
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
if (type !== 'object') {
|
|
2269
|
+
if (val === exports.UNDEFINED) {
|
|
2270
|
+
return undefined;
|
|
2271
|
+
} else if (val === exports.INFINITY) {
|
|
2272
|
+
return Infinity;
|
|
2273
|
+
} else if (val === exports.NEGATIVE_INFINITY) {
|
|
2274
|
+
return -Infinity;
|
|
2275
|
+
} else if (val === exports.NAN) {
|
|
2276
|
+
return NaN;
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
return val;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
return sanitize(val);
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
function getCustomMapDetails(val) {
|
|
2286
|
+
const list = [];
|
|
2287
|
+
val.forEach((value, key) => list.push({
|
|
2288
|
+
key,
|
|
2289
|
+
value
|
|
2290
|
+
}));
|
|
2291
|
+
return {
|
|
2292
|
+
_custom: {
|
|
2293
|
+
type: 'map',
|
|
2294
|
+
display: 'Map',
|
|
2295
|
+
value: list,
|
|
2296
|
+
readOnly: true,
|
|
2297
|
+
fields: {
|
|
2298
|
+
abstract: true
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
exports.getCustomMapDetails = getCustomMapDetails;
|
|
2305
|
+
|
|
2306
|
+
function reviveMap(val) {
|
|
2307
|
+
const result = new Map();
|
|
2308
|
+
const list = val._custom.value;
|
|
2309
|
+
|
|
2310
|
+
for (let i = 0; i < list.length; i++) {
|
|
2311
|
+
const {
|
|
2312
|
+
key,
|
|
2313
|
+
value
|
|
2314
|
+
} = list[i];
|
|
2315
|
+
result.set(key, revive(value));
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
return result;
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
exports.reviveMap = reviveMap;
|
|
2322
|
+
|
|
2323
|
+
function getCustomSetDetails(val) {
|
|
2324
|
+
const list = Array.from(val);
|
|
2325
|
+
return {
|
|
2326
|
+
_custom: {
|
|
2327
|
+
type: 'set',
|
|
2328
|
+
display: `Set[${list.length}]`,
|
|
2329
|
+
value: list,
|
|
2330
|
+
readOnly: true
|
|
2331
|
+
}
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
exports.getCustomSetDetails = getCustomSetDetails;
|
|
2336
|
+
|
|
2337
|
+
function reviveSet(val) {
|
|
2338
|
+
const result = new Set();
|
|
2339
|
+
const list = val._custom.value;
|
|
2340
|
+
|
|
2341
|
+
for (let i = 0; i < list.length; i++) {
|
|
2342
|
+
const value = list[i];
|
|
2343
|
+
result.add(revive(value));
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
return result;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
exports.reviveSet = reviveSet; // Use a custom basename functions instead of the shimed version
|
|
2350
|
+
// because it doesn't work on Windows
|
|
2351
|
+
|
|
2352
|
+
function basename(filename, ext) {
|
|
2353
|
+
return path_1.default.basename(filename.replace(/^[a-zA-Z]:/, '').replace(/\\/g, '/'), ext);
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
function getComponentName(options) {
|
|
2357
|
+
const name = options.displayName || options.name || options._componentTag;
|
|
2358
|
+
|
|
2359
|
+
if (name) {
|
|
2360
|
+
return name;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
const file = options.__file; // injected by vue-loader
|
|
2364
|
+
|
|
2365
|
+
if (file) {
|
|
2366
|
+
return (0, exports.classify)(basename(file, '.vue'));
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
exports.getComponentName = getComponentName;
|
|
2371
|
+
|
|
2372
|
+
function getCustomComponentDefinitionDetails(def) {
|
|
2373
|
+
let display = getComponentName(def);
|
|
2374
|
+
|
|
2375
|
+
if (display) {
|
|
2376
|
+
if (def.name && def.__file) {
|
|
2377
|
+
display += ` <span>(${def.__file})</span>`;
|
|
2378
|
+
}
|
|
2379
|
+
} else {
|
|
2380
|
+
display = '<i>Unknown Component</i>';
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
return {
|
|
2384
|
+
_custom: {
|
|
2385
|
+
type: 'component-definition',
|
|
2386
|
+
display,
|
|
2387
|
+
tooltip: 'Component definition',
|
|
2388
|
+
...(def.__file ? {
|
|
2389
|
+
file: def.__file
|
|
2390
|
+
} : {})
|
|
2391
|
+
}
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
exports.getCustomComponentDefinitionDetails = getCustomComponentDefinitionDetails; // eslint-disable-next-line @typescript-eslint/ban-types
|
|
2396
|
+
|
|
2397
|
+
function getCustomFunctionDetails(func) {
|
|
2398
|
+
let string = '';
|
|
2399
|
+
let matches = null;
|
|
2400
|
+
|
|
2401
|
+
try {
|
|
2402
|
+
string = Function.prototype.toString.call(func);
|
|
2403
|
+
matches = String.prototype.match.call(string, /\([\s\S]*?\)/);
|
|
2404
|
+
} catch (e) {// Func is probably a Proxy, which can break Function.prototype.toString()
|
|
2405
|
+
} // Trim any excess whitespace from the argument string
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
const match = matches && matches[0];
|
|
2409
|
+
const args = typeof match === 'string' ? match : '(?)';
|
|
2410
|
+
const name = typeof func.name === 'string' ? func.name : '';
|
|
2411
|
+
return {
|
|
2412
|
+
_custom: {
|
|
2413
|
+
type: 'function',
|
|
2414
|
+
display: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
|
|
2415
|
+
tooltip: string.trim() ? `<pre>${string}</pre>` : null,
|
|
2416
|
+
_reviveId: reviveCache.cache(func)
|
|
2417
|
+
}
|
|
2418
|
+
};
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
exports.getCustomFunctionDetails = getCustomFunctionDetails;
|
|
2422
|
+
|
|
2423
|
+
function getCustomHTMLElementDetails(value) {
|
|
2424
|
+
try {
|
|
2425
|
+
return {
|
|
2426
|
+
_custom: {
|
|
2427
|
+
type: 'HTMLElement',
|
|
2428
|
+
display: `<span class="opacity-30"><</span><span class="text-blue-500">${value.tagName.toLowerCase()}</span><span class="opacity-30">></span>`,
|
|
2429
|
+
value: namedNodeMapToObject(value.attributes),
|
|
2430
|
+
actions: [{
|
|
2431
|
+
icon: 'input',
|
|
2432
|
+
tooltip: 'Log element to console',
|
|
2433
|
+
action: () => {
|
|
2434
|
+
// eslint-disable-next-line no-console
|
|
2435
|
+
console.log(value);
|
|
2436
|
+
}
|
|
2437
|
+
}]
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2440
|
+
} catch (e) {
|
|
2441
|
+
return {
|
|
2442
|
+
_custom: {
|
|
2443
|
+
type: 'HTMLElement',
|
|
2444
|
+
display: `<span class="text-blue-500">${String(value)}</span>`
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
exports.getCustomHTMLElementDetails = getCustomHTMLElementDetails;
|
|
2451
|
+
|
|
2452
|
+
function namedNodeMapToObject(map) {
|
|
2453
|
+
const result = {};
|
|
2454
|
+
const l = map.length;
|
|
2455
|
+
|
|
2456
|
+
for (let i = 0; i < l; i++) {
|
|
2457
|
+
const node = map.item(i);
|
|
2458
|
+
result[node.name] = node.value;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
return result;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
function getCustomRefDetails(instance, key, ref) {
|
|
2465
|
+
let value;
|
|
2466
|
+
|
|
2467
|
+
if (Array.isArray(ref)) {
|
|
2468
|
+
value = ref.map(r => getCustomRefDetails(instance, key, r)).map(data => data.value);
|
|
2469
|
+
} else {
|
|
2470
|
+
let name;
|
|
2471
|
+
|
|
2472
|
+
if (ref._isVue) {
|
|
2473
|
+
name = getComponentName(ref.$options);
|
|
2474
|
+
} else {
|
|
2475
|
+
name = ref.tagName.toLowerCase();
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
value = {
|
|
2479
|
+
_custom: {
|
|
2480
|
+
display: `<${name}` + (ref.id ? ` <span class="attr-title">id</span>="${ref.id}"` : '') + (ref.className ? ` <span class="attr-title">class</span>="${ref.className}"` : '') + '>',
|
|
2481
|
+
uid: instance.__VUE_DEVTOOLS_UID__,
|
|
2482
|
+
type: 'reference'
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
return {
|
|
2488
|
+
type: '$refs',
|
|
2489
|
+
key: key,
|
|
2490
|
+
value,
|
|
2491
|
+
editable: false
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
exports.getCustomRefDetails = getCustomRefDetails;
|
|
2496
|
+
|
|
2497
|
+
function parse(data, revive = false) {
|
|
2498
|
+
return revive ? (0, transfer_1.parseCircularAutoChunks)(data, reviver) : (0, transfer_1.parseCircularAutoChunks)(data);
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
exports.parse = parse;
|
|
2502
|
+
const specialTypeRE = /^\[native (\w+) (.*?)(<>((.|\s)*))?\]$/;
|
|
2503
|
+
const symbolRE = /^\[native Symbol Symbol\((.*)\)\]$/;
|
|
2504
|
+
|
|
2505
|
+
function reviver(key, val) {
|
|
2506
|
+
return revive(val);
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
function revive(val) {
|
|
2510
|
+
if (val === exports.UNDEFINED) {
|
|
2511
|
+
return undefined;
|
|
2512
|
+
} else if (val === exports.INFINITY) {
|
|
2513
|
+
return Infinity;
|
|
2514
|
+
} else if (val === exports.NEGATIVE_INFINITY) {
|
|
2515
|
+
return -Infinity;
|
|
2516
|
+
} else if (val === exports.NAN) {
|
|
2517
|
+
return NaN;
|
|
2518
|
+
} else if (val && val._custom) {
|
|
2519
|
+
const {
|
|
2520
|
+
_custom: custom
|
|
2521
|
+
} = val;
|
|
2522
|
+
|
|
2523
|
+
if (custom.type === 'component') {
|
|
2524
|
+
return (0, backend_1.getInstanceMap)().get(custom.id);
|
|
2525
|
+
} else if (custom.type === 'map') {
|
|
2526
|
+
return reviveMap(val);
|
|
2527
|
+
} else if (custom.type === 'set') {
|
|
2528
|
+
return reviveSet(val);
|
|
2529
|
+
} else if (custom._reviveId) {
|
|
2530
|
+
return reviveCache.read(custom._reviveId);
|
|
2531
|
+
} else {
|
|
2532
|
+
return revive(custom.value);
|
|
2533
|
+
}
|
|
2534
|
+
} else if (symbolRE.test(val)) {
|
|
2535
|
+
const [, string] = symbolRE.exec(val);
|
|
2536
|
+
return Symbol.for(string);
|
|
2537
|
+
} else if (specialTypeRE.test(val)) {
|
|
2538
|
+
const [, type, string,, details] = specialTypeRE.exec(val);
|
|
2539
|
+
const result = new env_1.target[type](string);
|
|
2540
|
+
|
|
2541
|
+
if (type === 'Error' && details) {
|
|
2542
|
+
result.stack = details;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
return result;
|
|
2546
|
+
} else {
|
|
2547
|
+
return val;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
exports.revive = revive;
|
|
2552
|
+
/**
|
|
2553
|
+
* Sanitize data to be posted to the other side.
|
|
2554
|
+
* Since the message posted is sent with structured clone,
|
|
2555
|
+
* we need to filter out any types that might cause an error.
|
|
2556
|
+
*
|
|
2557
|
+
* @param {*} data
|
|
2558
|
+
* @return {*}
|
|
2559
|
+
*/
|
|
2560
|
+
|
|
2561
|
+
function sanitize(data) {
|
|
2562
|
+
if (!isPrimitive(data) && !Array.isArray(data) && !isPlainObject(data)) {
|
|
2563
|
+
// handle types that will probably cause issues in
|
|
2564
|
+
// the structured clone
|
|
2565
|
+
return Object.prototype.toString.call(data);
|
|
2566
|
+
} else {
|
|
2567
|
+
return data;
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
function isPlainObject(obj) {
|
|
2572
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
exports.isPlainObject = isPlainObject;
|
|
2576
|
+
|
|
2577
|
+
function isPrimitive(data) {
|
|
2578
|
+
if (data == null) {
|
|
2579
|
+
return true;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
const type = typeof data;
|
|
2583
|
+
return type === 'string' || type === 'number' || type === 'boolean';
|
|
2584
|
+
}
|
|
2585
|
+
/**
|
|
2586
|
+
* Searches a key or value in the object, with a maximum deepness
|
|
2587
|
+
* @param {*} obj Search target
|
|
2588
|
+
* @param {string} searchTerm Search string
|
|
2589
|
+
* @returns {boolean} Search match
|
|
2590
|
+
*/
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
function searchDeepInObject(obj, searchTerm) {
|
|
2594
|
+
const seen = new Map();
|
|
2595
|
+
const result = internalSearchObject(obj, searchTerm.toLowerCase(), seen, 0);
|
|
2596
|
+
seen.clear();
|
|
2597
|
+
return result;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
exports.searchDeepInObject = searchDeepInObject;
|
|
2601
|
+
const SEARCH_MAX_DEPTH = 10;
|
|
2602
|
+
/**
|
|
2603
|
+
* Executes a search on each field of the provided object
|
|
2604
|
+
* @param {*} obj Search target
|
|
2605
|
+
* @param {string} searchTerm Search string
|
|
2606
|
+
* @param {Map<any,boolean>} seen Map containing the search result to prevent stack overflow by walking on the same object multiple times
|
|
2607
|
+
* @param {number} depth Deep search depth level, which is capped to prevent performance issues
|
|
2608
|
+
* @returns {boolean} Search match
|
|
2609
|
+
*/
|
|
2610
|
+
|
|
2611
|
+
function internalSearchObject(obj, searchTerm, seen, depth) {
|
|
2612
|
+
if (depth > SEARCH_MAX_DEPTH) {
|
|
2613
|
+
return false;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
let match = false;
|
|
2617
|
+
const keys = Object.keys(obj);
|
|
2618
|
+
let key, value;
|
|
2619
|
+
|
|
2620
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2621
|
+
key = keys[i];
|
|
2622
|
+
value = obj[key];
|
|
2623
|
+
match = internalSearchCheck(searchTerm, key, value, seen, depth + 1);
|
|
2624
|
+
|
|
2625
|
+
if (match) {
|
|
2626
|
+
break;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
return match;
|
|
2631
|
+
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Executes a search on each value of the provided array
|
|
2634
|
+
* @param {*} array Search target
|
|
2635
|
+
* @param {string} searchTerm Search string
|
|
2636
|
+
* @param {Map<any,boolean>} seen Map containing the search result to prevent stack overflow by walking on the same object multiple times
|
|
2637
|
+
* @param {number} depth Deep search depth level, which is capped to prevent performance issues
|
|
2638
|
+
* @returns {boolean} Search match
|
|
2639
|
+
*/
|
|
2640
|
+
|
|
2641
|
+
|
|
2642
|
+
function internalSearchArray(array, searchTerm, seen, depth) {
|
|
2643
|
+
if (depth > SEARCH_MAX_DEPTH) {
|
|
2644
|
+
return false;
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
let match = false;
|
|
2648
|
+
let value;
|
|
2649
|
+
|
|
2650
|
+
for (let i = 0; i < array.length; i++) {
|
|
2651
|
+
value = array[i];
|
|
2652
|
+
match = internalSearchCheck(searchTerm, null, value, seen, depth + 1);
|
|
2653
|
+
|
|
2654
|
+
if (match) {
|
|
2655
|
+
break;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
return match;
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* Checks if the provided field matches the search terms
|
|
2663
|
+
* @param {string} searchTerm Search string
|
|
2664
|
+
* @param {string} key Field key (null if from array)
|
|
2665
|
+
* @param {*} value Field value
|
|
2666
|
+
* @param {Map<any,boolean>} seen Map containing the search result to prevent stack overflow by walking on the same object multiple times
|
|
2667
|
+
* @param {number} depth Deep search depth level, which is capped to prevent performance issues
|
|
2668
|
+
* @returns {boolean} Search match
|
|
2669
|
+
*/
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
function internalSearchCheck(searchTerm, key, value, seen, depth) {
|
|
2673
|
+
let match = false;
|
|
2674
|
+
let result;
|
|
2675
|
+
|
|
2676
|
+
if (key === '_custom') {
|
|
2677
|
+
key = value.display;
|
|
2678
|
+
value = value.value;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
(result = specialTokenToString(value)) && (value = result);
|
|
2682
|
+
|
|
2683
|
+
if (key && compare(key, searchTerm)) {
|
|
2684
|
+
match = true;
|
|
2685
|
+
seen.set(value, true);
|
|
2686
|
+
} else if (seen.has(value)) {
|
|
2687
|
+
match = seen.get(value);
|
|
2688
|
+
} else if (Array.isArray(value)) {
|
|
2689
|
+
seen.set(value, null);
|
|
2690
|
+
match = internalSearchArray(value, searchTerm, seen, depth);
|
|
2691
|
+
seen.set(value, match);
|
|
2692
|
+
} else if (isPlainObject(value)) {
|
|
2693
|
+
seen.set(value, null);
|
|
2694
|
+
match = internalSearchObject(value, searchTerm, seen, depth);
|
|
2695
|
+
seen.set(value, match);
|
|
2696
|
+
} else if (compare(value, searchTerm)) {
|
|
2697
|
+
match = true;
|
|
2698
|
+
seen.set(value, true);
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
return match;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Compares two values
|
|
2705
|
+
* @param {*} value Mixed type value that will be cast to string
|
|
2706
|
+
* @param {string} searchTerm Search string
|
|
2707
|
+
* @returns {boolean} Search match
|
|
2708
|
+
*/
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
function compare(value, searchTerm) {
|
|
2712
|
+
return ('' + value).toLowerCase().indexOf(searchTerm) !== -1;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
function sortByKey(state) {
|
|
2716
|
+
return state && state.slice().sort((a, b) => {
|
|
2717
|
+
if (a.key < b.key) return -1;
|
|
2718
|
+
if (a.key > b.key) return 1;
|
|
2719
|
+
return 0;
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
exports.sortByKey = sortByKey;
|
|
2724
|
+
|
|
2725
|
+
function simpleGet(object, path) {
|
|
2726
|
+
const sections = Array.isArray(path) ? path : path.split('.');
|
|
2727
|
+
|
|
2728
|
+
for (let i = 0; i < sections.length; i++) {
|
|
2729
|
+
object = object[sections[i]];
|
|
2730
|
+
|
|
2731
|
+
if (!object) {
|
|
2732
|
+
return undefined;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
return object;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
exports.simpleGet = simpleGet;
|
|
2740
|
+
|
|
2741
|
+
function focusInput(el) {
|
|
2742
|
+
el.focus();
|
|
2743
|
+
el.setSelectionRange(0, el.value.length);
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
exports.focusInput = focusInput;
|
|
2747
|
+
|
|
2748
|
+
function openInEditor(file) {
|
|
2749
|
+
// Console display
|
|
2750
|
+
const fileName = file.replace(/\\/g, '\\\\');
|
|
2751
|
+
const src = `fetch('${shared_data_1.SharedData.openInEditorHost}__open-in-editor?file=${encodeURI(file)}').then(response => {
|
|
2752
|
+
if (response.ok) {
|
|
2753
|
+
console.log('File ${fileName} opened in editor')
|
|
2754
|
+
} else {
|
|
2755
|
+
const msg = 'Opening component ${fileName} failed'
|
|
2756
|
+
const target = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}
|
|
2757
|
+
if (target.__VUE_DEVTOOLS_TOAST__) {
|
|
2758
|
+
target.__VUE_DEVTOOLS_TOAST__(msg, 'error')
|
|
2759
|
+
} else {
|
|
2760
|
+
console.log('%c' + msg, 'color:red')
|
|
2761
|
+
}
|
|
2762
|
+
console.log('Check the setup of your project, see https://devtools.vuejs.org/guide/open-in-editor.html')
|
|
2763
|
+
}
|
|
2764
|
+
})`;
|
|
2765
|
+
|
|
2766
|
+
if (env_1.isChrome) {
|
|
2767
|
+
env_1.target.chrome.devtools.inspectedWindow.eval(src);
|
|
2768
|
+
} else {
|
|
2769
|
+
// eslint-disable-next-line no-eval
|
|
2770
|
+
[eval][0](src);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
exports.openInEditor = openInEditor;
|
|
2775
|
+
const ESC = {
|
|
2776
|
+
'<': '<',
|
|
2777
|
+
'>': '>',
|
|
2778
|
+
'"': '"',
|
|
2779
|
+
'&': '&'
|
|
2780
|
+
};
|
|
2781
|
+
|
|
2782
|
+
function escape(s) {
|
|
2783
|
+
return s.replace(/[<>"&]/g, escapeChar);
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
exports.escape = escape;
|
|
2787
|
+
|
|
2788
|
+
function escapeChar(a) {
|
|
2789
|
+
return ESC[a] || a;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
function copyToClipboard(state) {
|
|
2793
|
+
let text;
|
|
2794
|
+
|
|
2795
|
+
if (typeof state !== 'object') {
|
|
2796
|
+
text = String(state);
|
|
2797
|
+
} else {
|
|
2798
|
+
text = stringify(state, 'user');
|
|
2799
|
+
} // @TODO navigator.clipboard is buggy in extensions
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
if (typeof document === 'undefined') return;
|
|
2803
|
+
const dummyTextArea = document.createElement('textarea');
|
|
2804
|
+
dummyTextArea.textContent = text;
|
|
2805
|
+
document.body.appendChild(dummyTextArea);
|
|
2806
|
+
dummyTextArea.select();
|
|
2807
|
+
document.execCommand('copy');
|
|
2808
|
+
document.body.removeChild(dummyTextArea);
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
exports.copyToClipboard = copyToClipboard;
|
|
2812
|
+
|
|
2813
|
+
function isEmptyObject(obj) {
|
|
2814
|
+
return obj === exports.UNDEFINED || !obj || Object.keys(obj).length === 0;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
exports.isEmptyObject = isEmptyObject;
|
|
2818
|
+
|
|
2819
|
+
/***/ }),
|
|
2820
|
+
|
|
2821
|
+
/***/ "../../node_modules/events/events.js":
|
|
2822
|
+
/*!*******************************************!*\
|
|
2823
|
+
!*** ../../node_modules/events/events.js ***!
|
|
2824
|
+
\*******************************************/
|
|
2825
|
+
/***/ ((module) => {
|
|
2826
|
+
|
|
2827
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2828
|
+
//
|
|
2829
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2830
|
+
// copy of this software and associated documentation files (the
|
|
2831
|
+
// "Software"), to deal in the Software without restriction, including
|
|
2832
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
2833
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
2834
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
2835
|
+
// following conditions:
|
|
2836
|
+
//
|
|
2837
|
+
// The above copyright notice and this permission notice shall be included
|
|
2838
|
+
// in all copies or substantial portions of the Software.
|
|
2839
|
+
//
|
|
2840
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
2841
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
2842
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
2843
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
2844
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
2845
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
2846
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
|
|
2850
|
+
var R = typeof Reflect === 'object' ? Reflect : null
|
|
2851
|
+
var ReflectApply = R && typeof R.apply === 'function'
|
|
2852
|
+
? R.apply
|
|
2853
|
+
: function ReflectApply(target, receiver, args) {
|
|
2854
|
+
return Function.prototype.apply.call(target, receiver, args);
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
var ReflectOwnKeys
|
|
2858
|
+
if (R && typeof R.ownKeys === 'function') {
|
|
2859
|
+
ReflectOwnKeys = R.ownKeys
|
|
2860
|
+
} else if (Object.getOwnPropertySymbols) {
|
|
2861
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
2862
|
+
return Object.getOwnPropertyNames(target)
|
|
2863
|
+
.concat(Object.getOwnPropertySymbols(target));
|
|
2864
|
+
};
|
|
2865
|
+
} else {
|
|
2866
|
+
ReflectOwnKeys = function ReflectOwnKeys(target) {
|
|
2867
|
+
return Object.getOwnPropertyNames(target);
|
|
2868
|
+
};
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
function ProcessEmitWarning(warning) {
|
|
2872
|
+
if (console && console.warn) console.warn(warning);
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
|
2876
|
+
return value !== value;
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
function EventEmitter() {
|
|
2880
|
+
EventEmitter.init.call(this);
|
|
2881
|
+
}
|
|
2882
|
+
module.exports = EventEmitter;
|
|
2883
|
+
module.exports.once = once;
|
|
2884
|
+
|
|
2885
|
+
// Backwards-compat with node 0.10.x
|
|
2886
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
2887
|
+
|
|
2888
|
+
EventEmitter.prototype._events = undefined;
|
|
2889
|
+
EventEmitter.prototype._eventsCount = 0;
|
|
2890
|
+
EventEmitter.prototype._maxListeners = undefined;
|
|
2891
|
+
|
|
2892
|
+
// By default EventEmitters will print a warning if more than 10 listeners are
|
|
2893
|
+
// added to it. This is a useful default which helps finding memory leaks.
|
|
2894
|
+
var defaultMaxListeners = 10;
|
|
2895
|
+
|
|
2896
|
+
function checkListener(listener) {
|
|
2897
|
+
if (typeof listener !== 'function') {
|
|
2898
|
+
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
|
2903
|
+
enumerable: true,
|
|
2904
|
+
get: function() {
|
|
2905
|
+
return defaultMaxListeners;
|
|
2906
|
+
},
|
|
2907
|
+
set: function(arg) {
|
|
2908
|
+
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
|
2909
|
+
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
|
2910
|
+
}
|
|
2911
|
+
defaultMaxListeners = arg;
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
EventEmitter.init = function() {
|
|
2916
|
+
|
|
2917
|
+
if (this._events === undefined ||
|
|
2918
|
+
this._events === Object.getPrototypeOf(this)._events) {
|
|
2919
|
+
this._events = Object.create(null);
|
|
2920
|
+
this._eventsCount = 0;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
this._maxListeners = this._maxListeners || undefined;
|
|
2924
|
+
};
|
|
2925
|
+
|
|
2926
|
+
// Obviously not all Emitters should be limited to 10. This function allows
|
|
2927
|
+
// that to be increased. Set to zero for unlimited.
|
|
2928
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
2929
|
+
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
|
2930
|
+
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
|
2931
|
+
}
|
|
2932
|
+
this._maxListeners = n;
|
|
2933
|
+
return this;
|
|
2934
|
+
};
|
|
2935
|
+
|
|
2936
|
+
function _getMaxListeners(that) {
|
|
2937
|
+
if (that._maxListeners === undefined)
|
|
2938
|
+
return EventEmitter.defaultMaxListeners;
|
|
2939
|
+
return that._maxListeners;
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
2943
|
+
return _getMaxListeners(this);
|
|
2944
|
+
};
|
|
2945
|
+
|
|
2946
|
+
EventEmitter.prototype.emit = function emit(type) {
|
|
2947
|
+
var args = [];
|
|
2948
|
+
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
2949
|
+
var doError = (type === 'error');
|
|
2950
|
+
|
|
2951
|
+
var events = this._events;
|
|
2952
|
+
if (events !== undefined)
|
|
2953
|
+
doError = (doError && events.error === undefined);
|
|
2954
|
+
else if (!doError)
|
|
2955
|
+
return false;
|
|
2956
|
+
|
|
2957
|
+
// If there is no 'error' event listener then throw.
|
|
2958
|
+
if (doError) {
|
|
2959
|
+
var er;
|
|
2960
|
+
if (args.length > 0)
|
|
2961
|
+
er = args[0];
|
|
2962
|
+
if (er instanceof Error) {
|
|
2963
|
+
// Note: The comments on the `throw` lines are intentional, they show
|
|
2964
|
+
// up in Node's output if this results in an unhandled exception.
|
|
2965
|
+
throw er; // Unhandled 'error' event
|
|
2966
|
+
}
|
|
2967
|
+
// At least give some kind of context to the user
|
|
2968
|
+
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
|
2969
|
+
err.context = er;
|
|
2970
|
+
throw err; // Unhandled 'error' event
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
var handler = events[type];
|
|
2974
|
+
|
|
2975
|
+
if (handler === undefined)
|
|
2976
|
+
return false;
|
|
2977
|
+
|
|
2978
|
+
if (typeof handler === 'function') {
|
|
2979
|
+
ReflectApply(handler, this, args);
|
|
2980
|
+
} else {
|
|
2981
|
+
var len = handler.length;
|
|
2982
|
+
var listeners = arrayClone(handler, len);
|
|
2983
|
+
for (var i = 0; i < len; ++i)
|
|
2984
|
+
ReflectApply(listeners[i], this, args);
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
return true;
|
|
2988
|
+
};
|
|
2989
|
+
|
|
2990
|
+
function _addListener(target, type, listener, prepend) {
|
|
2991
|
+
var m;
|
|
2992
|
+
var events;
|
|
2993
|
+
var existing;
|
|
2994
|
+
|
|
2995
|
+
checkListener(listener);
|
|
2996
|
+
|
|
2997
|
+
events = target._events;
|
|
2998
|
+
if (events === undefined) {
|
|
2999
|
+
events = target._events = Object.create(null);
|
|
3000
|
+
target._eventsCount = 0;
|
|
3001
|
+
} else {
|
|
3002
|
+
// To avoid recursion in the case that type === "newListener"! Before
|
|
3003
|
+
// adding it to the listeners, first emit "newListener".
|
|
3004
|
+
if (events.newListener !== undefined) {
|
|
3005
|
+
target.emit('newListener', type,
|
|
3006
|
+
listener.listener ? listener.listener : listener);
|
|
3007
|
+
|
|
3008
|
+
// Re-assign `events` because a newListener handler could have caused the
|
|
3009
|
+
// this._events to be assigned to a new object
|
|
3010
|
+
events = target._events;
|
|
3011
|
+
}
|
|
3012
|
+
existing = events[type];
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
if (existing === undefined) {
|
|
3016
|
+
// Optimize the case of one listener. Don't need the extra array object.
|
|
3017
|
+
existing = events[type] = listener;
|
|
3018
|
+
++target._eventsCount;
|
|
3019
|
+
} else {
|
|
3020
|
+
if (typeof existing === 'function') {
|
|
3021
|
+
// Adding the second element, need to change to array.
|
|
3022
|
+
existing = events[type] =
|
|
3023
|
+
prepend ? [listener, existing] : [existing, listener];
|
|
3024
|
+
// If we've already got an array, just append.
|
|
3025
|
+
} else if (prepend) {
|
|
3026
|
+
existing.unshift(listener);
|
|
3027
|
+
} else {
|
|
3028
|
+
existing.push(listener);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
// Check for listener leak
|
|
3032
|
+
m = _getMaxListeners(target);
|
|
3033
|
+
if (m > 0 && existing.length > m && !existing.warned) {
|
|
3034
|
+
existing.warned = true;
|
|
3035
|
+
// No error code for this since it is a Warning
|
|
3036
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
3037
|
+
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
|
3038
|
+
existing.length + ' ' + String(type) + ' listeners ' +
|
|
3039
|
+
'added. Use emitter.setMaxListeners() to ' +
|
|
3040
|
+
'increase limit');
|
|
3041
|
+
w.name = 'MaxListenersExceededWarning';
|
|
3042
|
+
w.emitter = target;
|
|
3043
|
+
w.type = type;
|
|
3044
|
+
w.count = existing.length;
|
|
3045
|
+
ProcessEmitWarning(w);
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
return target;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
|
3053
|
+
return _addListener(this, type, listener, false);
|
|
3054
|
+
};
|
|
3055
|
+
|
|
3056
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
3057
|
+
|
|
3058
|
+
EventEmitter.prototype.prependListener =
|
|
3059
|
+
function prependListener(type, listener) {
|
|
3060
|
+
return _addListener(this, type, listener, true);
|
|
3061
|
+
};
|
|
3062
|
+
|
|
3063
|
+
function onceWrapper() {
|
|
3064
|
+
if (!this.fired) {
|
|
3065
|
+
this.target.removeListener(this.type, this.wrapFn);
|
|
3066
|
+
this.fired = true;
|
|
3067
|
+
if (arguments.length === 0)
|
|
3068
|
+
return this.listener.call(this.target);
|
|
3069
|
+
return this.listener.apply(this.target, arguments);
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
function _onceWrap(target, type, listener) {
|
|
3074
|
+
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
|
3075
|
+
var wrapped = onceWrapper.bind(state);
|
|
3076
|
+
wrapped.listener = listener;
|
|
3077
|
+
state.wrapFn = wrapped;
|
|
3078
|
+
return wrapped;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
EventEmitter.prototype.once = function once(type, listener) {
|
|
3082
|
+
checkListener(listener);
|
|
3083
|
+
this.on(type, _onceWrap(this, type, listener));
|
|
3084
|
+
return this;
|
|
3085
|
+
};
|
|
3086
|
+
|
|
3087
|
+
EventEmitter.prototype.prependOnceListener =
|
|
3088
|
+
function prependOnceListener(type, listener) {
|
|
3089
|
+
checkListener(listener);
|
|
3090
|
+
this.prependListener(type, _onceWrap(this, type, listener));
|
|
3091
|
+
return this;
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
// Emits a 'removeListener' event if and only if the listener was removed.
|
|
3095
|
+
EventEmitter.prototype.removeListener =
|
|
3096
|
+
function removeListener(type, listener) {
|
|
3097
|
+
var list, events, position, i, originalListener;
|
|
3098
|
+
|
|
3099
|
+
checkListener(listener);
|
|
3100
|
+
|
|
3101
|
+
events = this._events;
|
|
3102
|
+
if (events === undefined)
|
|
3103
|
+
return this;
|
|
3104
|
+
|
|
3105
|
+
list = events[type];
|
|
3106
|
+
if (list === undefined)
|
|
3107
|
+
return this;
|
|
3108
|
+
|
|
3109
|
+
if (list === listener || list.listener === listener) {
|
|
3110
|
+
if (--this._eventsCount === 0)
|
|
3111
|
+
this._events = Object.create(null);
|
|
3112
|
+
else {
|
|
3113
|
+
delete events[type];
|
|
3114
|
+
if (events.removeListener)
|
|
3115
|
+
this.emit('removeListener', type, list.listener || listener);
|
|
3116
|
+
}
|
|
3117
|
+
} else if (typeof list !== 'function') {
|
|
3118
|
+
position = -1;
|
|
3119
|
+
|
|
3120
|
+
for (i = list.length - 1; i >= 0; i--) {
|
|
3121
|
+
if (list[i] === listener || list[i].listener === listener) {
|
|
3122
|
+
originalListener = list[i].listener;
|
|
3123
|
+
position = i;
|
|
3124
|
+
break;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
if (position < 0)
|
|
3129
|
+
return this;
|
|
3130
|
+
|
|
3131
|
+
if (position === 0)
|
|
3132
|
+
list.shift();
|
|
3133
|
+
else {
|
|
3134
|
+
spliceOne(list, position);
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
if (list.length === 1)
|
|
3138
|
+
events[type] = list[0];
|
|
3139
|
+
|
|
3140
|
+
if (events.removeListener !== undefined)
|
|
3141
|
+
this.emit('removeListener', type, originalListener || listener);
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
return this;
|
|
3145
|
+
};
|
|
3146
|
+
|
|
3147
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
3148
|
+
|
|
3149
|
+
EventEmitter.prototype.removeAllListeners =
|
|
3150
|
+
function removeAllListeners(type) {
|
|
3151
|
+
var listeners, events, i;
|
|
3152
|
+
|
|
3153
|
+
events = this._events;
|
|
3154
|
+
if (events === undefined)
|
|
3155
|
+
return this;
|
|
3156
|
+
|
|
3157
|
+
// not listening for removeListener, no need to emit
|
|
3158
|
+
if (events.removeListener === undefined) {
|
|
3159
|
+
if (arguments.length === 0) {
|
|
3160
|
+
this._events = Object.create(null);
|
|
3161
|
+
this._eventsCount = 0;
|
|
3162
|
+
} else if (events[type] !== undefined) {
|
|
3163
|
+
if (--this._eventsCount === 0)
|
|
3164
|
+
this._events = Object.create(null);
|
|
3165
|
+
else
|
|
3166
|
+
delete events[type];
|
|
3167
|
+
}
|
|
3168
|
+
return this;
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
// emit removeListener for all listeners on all events
|
|
3172
|
+
if (arguments.length === 0) {
|
|
3173
|
+
var keys = Object.keys(events);
|
|
3174
|
+
var key;
|
|
3175
|
+
for (i = 0; i < keys.length; ++i) {
|
|
3176
|
+
key = keys[i];
|
|
3177
|
+
if (key === 'removeListener') continue;
|
|
3178
|
+
this.removeAllListeners(key);
|
|
3179
|
+
}
|
|
3180
|
+
this.removeAllListeners('removeListener');
|
|
3181
|
+
this._events = Object.create(null);
|
|
3182
|
+
this._eventsCount = 0;
|
|
3183
|
+
return this;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
listeners = events[type];
|
|
3187
|
+
|
|
3188
|
+
if (typeof listeners === 'function') {
|
|
3189
|
+
this.removeListener(type, listeners);
|
|
3190
|
+
} else if (listeners !== undefined) {
|
|
3191
|
+
// LIFO order
|
|
3192
|
+
for (i = listeners.length - 1; i >= 0; i--) {
|
|
3193
|
+
this.removeListener(type, listeners[i]);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
return this;
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
function _listeners(target, type, unwrap) {
|
|
3201
|
+
var events = target._events;
|
|
3202
|
+
|
|
3203
|
+
if (events === undefined)
|
|
3204
|
+
return [];
|
|
3205
|
+
|
|
3206
|
+
var evlistener = events[type];
|
|
3207
|
+
if (evlistener === undefined)
|
|
3208
|
+
return [];
|
|
3209
|
+
|
|
3210
|
+
if (typeof evlistener === 'function')
|
|
3211
|
+
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
3212
|
+
|
|
3213
|
+
return unwrap ?
|
|
3214
|
+
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
EventEmitter.prototype.listeners = function listeners(type) {
|
|
3218
|
+
return _listeners(this, type, true);
|
|
3219
|
+
};
|
|
3220
|
+
|
|
3221
|
+
EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
|
3222
|
+
return _listeners(this, type, false);
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3225
|
+
EventEmitter.listenerCount = function(emitter, type) {
|
|
3226
|
+
if (typeof emitter.listenerCount === 'function') {
|
|
3227
|
+
return emitter.listenerCount(type);
|
|
3228
|
+
} else {
|
|
3229
|
+
return listenerCount.call(emitter, type);
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
|
|
3233
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
3234
|
+
function listenerCount(type) {
|
|
3235
|
+
var events = this._events;
|
|
3236
|
+
|
|
3237
|
+
if (events !== undefined) {
|
|
3238
|
+
var evlistener = events[type];
|
|
3239
|
+
|
|
3240
|
+
if (typeof evlistener === 'function') {
|
|
3241
|
+
return 1;
|
|
3242
|
+
} else if (evlistener !== undefined) {
|
|
3243
|
+
return evlistener.length;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
return 0;
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
3251
|
+
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
function arrayClone(arr, n) {
|
|
3255
|
+
var copy = new Array(n);
|
|
3256
|
+
for (var i = 0; i < n; ++i)
|
|
3257
|
+
copy[i] = arr[i];
|
|
3258
|
+
return copy;
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
function spliceOne(list, index) {
|
|
3262
|
+
for (; index + 1 < list.length; index++)
|
|
3263
|
+
list[index] = list[index + 1];
|
|
3264
|
+
list.pop();
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
function unwrapListeners(arr) {
|
|
3268
|
+
var ret = new Array(arr.length);
|
|
3269
|
+
for (var i = 0; i < ret.length; ++i) {
|
|
3270
|
+
ret[i] = arr[i].listener || arr[i];
|
|
3271
|
+
}
|
|
3272
|
+
return ret;
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
function once(emitter, name) {
|
|
3276
|
+
return new Promise(function (resolve, reject) {
|
|
3277
|
+
function errorListener(err) {
|
|
3278
|
+
emitter.removeListener(name, resolver);
|
|
3279
|
+
reject(err);
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
function resolver() {
|
|
3283
|
+
if (typeof emitter.removeListener === 'function') {
|
|
3284
|
+
emitter.removeListener('error', errorListener);
|
|
3285
|
+
}
|
|
3286
|
+
resolve([].slice.call(arguments));
|
|
3287
|
+
};
|
|
3288
|
+
|
|
3289
|
+
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
|
|
3290
|
+
if (name !== 'error') {
|
|
3291
|
+
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
|
|
3292
|
+
}
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
|
|
3297
|
+
if (typeof emitter.on === 'function') {
|
|
3298
|
+
eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
3303
|
+
if (typeof emitter.on === 'function') {
|
|
3304
|
+
if (flags.once) {
|
|
3305
|
+
emitter.once(name, listener);
|
|
3306
|
+
} else {
|
|
3307
|
+
emitter.on(name, listener);
|
|
3308
|
+
}
|
|
3309
|
+
} else if (typeof emitter.addEventListener === 'function') {
|
|
3310
|
+
// EventTarget does not have `error` event semantics like Node
|
|
3311
|
+
// EventEmitters, we do not listen for `error` events here.
|
|
3312
|
+
emitter.addEventListener(name, function wrapListener(arg) {
|
|
3313
|
+
// IE does not have builtin `{ once: true }` support so we
|
|
3314
|
+
// have to do it manually.
|
|
3315
|
+
if (flags.once) {
|
|
3316
|
+
emitter.removeEventListener(name, wrapListener);
|
|
3317
|
+
}
|
|
3318
|
+
listener(arg);
|
|
3319
|
+
});
|
|
3320
|
+
} else {
|
|
3321
|
+
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
|
|
3322
|
+
}
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
|
|
3326
|
+
/***/ }),
|
|
3327
|
+
|
|
3328
|
+
/***/ "../../node_modules/path-browserify/index.js":
|
|
3329
|
+
/*!***************************************************!*\
|
|
3330
|
+
!*** ../../node_modules/path-browserify/index.js ***!
|
|
3331
|
+
\***************************************************/
|
|
3332
|
+
/***/ ((module) => {
|
|
3333
|
+
|
|
3334
|
+
// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
3335
|
+
// transplited with Babel
|
|
3336
|
+
|
|
3337
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
3338
|
+
//
|
|
3339
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
3340
|
+
// copy of this software and associated documentation files (the
|
|
3341
|
+
// "Software"), to deal in the Software without restriction, including
|
|
3342
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
3343
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
3344
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
3345
|
+
// following conditions:
|
|
3346
|
+
//
|
|
3347
|
+
// The above copyright notice and this permission notice shall be included
|
|
3348
|
+
// in all copies or substantial portions of the Software.
|
|
3349
|
+
//
|
|
3350
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
3351
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
3352
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
3353
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
3354
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
3355
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
3356
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
function assertPath(path) {
|
|
3361
|
+
if (typeof path !== 'string') {
|
|
3362
|
+
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
// Resolves . and .. elements in a path with directory names
|
|
3367
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
3368
|
+
var res = '';
|
|
3369
|
+
var lastSegmentLength = 0;
|
|
3370
|
+
var lastSlash = -1;
|
|
3371
|
+
var dots = 0;
|
|
3372
|
+
var code;
|
|
3373
|
+
for (var i = 0; i <= path.length; ++i) {
|
|
3374
|
+
if (i < path.length)
|
|
3375
|
+
code = path.charCodeAt(i);
|
|
3376
|
+
else if (code === 47 /*/*/)
|
|
3377
|
+
break;
|
|
3378
|
+
else
|
|
3379
|
+
code = 47 /*/*/;
|
|
3380
|
+
if (code === 47 /*/*/) {
|
|
3381
|
+
if (lastSlash === i - 1 || dots === 1) {
|
|
3382
|
+
// NOOP
|
|
3383
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
3384
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
|
3385
|
+
if (res.length > 2) {
|
|
3386
|
+
var lastSlashIndex = res.lastIndexOf('/');
|
|
3387
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
3388
|
+
if (lastSlashIndex === -1) {
|
|
3389
|
+
res = '';
|
|
3390
|
+
lastSegmentLength = 0;
|
|
3391
|
+
} else {
|
|
3392
|
+
res = res.slice(0, lastSlashIndex);
|
|
3393
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
3394
|
+
}
|
|
3395
|
+
lastSlash = i;
|
|
3396
|
+
dots = 0;
|
|
3397
|
+
continue;
|
|
3398
|
+
}
|
|
3399
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
3400
|
+
res = '';
|
|
3401
|
+
lastSegmentLength = 0;
|
|
3402
|
+
lastSlash = i;
|
|
3403
|
+
dots = 0;
|
|
3404
|
+
continue;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
if (allowAboveRoot) {
|
|
3408
|
+
if (res.length > 0)
|
|
3409
|
+
res += '/..';
|
|
3410
|
+
else
|
|
3411
|
+
res = '..';
|
|
3412
|
+
lastSegmentLength = 2;
|
|
3413
|
+
}
|
|
3414
|
+
} else {
|
|
3415
|
+
if (res.length > 0)
|
|
3416
|
+
res += '/' + path.slice(lastSlash + 1, i);
|
|
3417
|
+
else
|
|
3418
|
+
res = path.slice(lastSlash + 1, i);
|
|
3419
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
3420
|
+
}
|
|
3421
|
+
lastSlash = i;
|
|
3422
|
+
dots = 0;
|
|
3423
|
+
} else if (code === 46 /*.*/ && dots !== -1) {
|
|
3424
|
+
++dots;
|
|
3425
|
+
} else {
|
|
3426
|
+
dots = -1;
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
return res;
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
function _format(sep, pathObject) {
|
|
3433
|
+
var dir = pathObject.dir || pathObject.root;
|
|
3434
|
+
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
3435
|
+
if (!dir) {
|
|
3436
|
+
return base;
|
|
3437
|
+
}
|
|
3438
|
+
if (dir === pathObject.root) {
|
|
3439
|
+
return dir + base;
|
|
3440
|
+
}
|
|
3441
|
+
return dir + sep + base;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
var posix = {
|
|
3445
|
+
// path.resolve([from ...], to)
|
|
3446
|
+
resolve: function resolve() {
|
|
3447
|
+
var resolvedPath = '';
|
|
3448
|
+
var resolvedAbsolute = false;
|
|
3449
|
+
var cwd;
|
|
3450
|
+
|
|
3451
|
+
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
3452
|
+
var path;
|
|
3453
|
+
if (i >= 0)
|
|
3454
|
+
path = arguments[i];
|
|
3455
|
+
else {
|
|
3456
|
+
if (cwd === undefined)
|
|
3457
|
+
cwd = process.cwd();
|
|
3458
|
+
path = cwd;
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
assertPath(path);
|
|
3462
|
+
|
|
3463
|
+
// Skip empty entries
|
|
3464
|
+
if (path.length === 0) {
|
|
3465
|
+
continue;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
resolvedPath = path + '/' + resolvedPath;
|
|
3469
|
+
resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
// At this point the path should be resolved to a full absolute path, but
|
|
3473
|
+
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
3474
|
+
|
|
3475
|
+
// Normalize the path
|
|
3476
|
+
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
3477
|
+
|
|
3478
|
+
if (resolvedAbsolute) {
|
|
3479
|
+
if (resolvedPath.length > 0)
|
|
3480
|
+
return '/' + resolvedPath;
|
|
3481
|
+
else
|
|
3482
|
+
return '/';
|
|
3483
|
+
} else if (resolvedPath.length > 0) {
|
|
3484
|
+
return resolvedPath;
|
|
3485
|
+
} else {
|
|
3486
|
+
return '.';
|
|
3487
|
+
}
|
|
3488
|
+
},
|
|
3489
|
+
|
|
3490
|
+
normalize: function normalize(path) {
|
|
3491
|
+
assertPath(path);
|
|
3492
|
+
|
|
3493
|
+
if (path.length === 0) return '.';
|
|
3494
|
+
|
|
3495
|
+
var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
3496
|
+
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
3497
|
+
|
|
3498
|
+
// Normalize the path
|
|
3499
|
+
path = normalizeStringPosix(path, !isAbsolute);
|
|
3500
|
+
|
|
3501
|
+
if (path.length === 0 && !isAbsolute) path = '.';
|
|
3502
|
+
if (path.length > 0 && trailingSeparator) path += '/';
|
|
3503
|
+
|
|
3504
|
+
if (isAbsolute) return '/' + path;
|
|
3505
|
+
return path;
|
|
3506
|
+
},
|
|
3507
|
+
|
|
3508
|
+
isAbsolute: function isAbsolute(path) {
|
|
3509
|
+
assertPath(path);
|
|
3510
|
+
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
3511
|
+
},
|
|
3512
|
+
|
|
3513
|
+
join: function join() {
|
|
3514
|
+
if (arguments.length === 0)
|
|
3515
|
+
return '.';
|
|
3516
|
+
var joined;
|
|
3517
|
+
for (var i = 0; i < arguments.length; ++i) {
|
|
3518
|
+
var arg = arguments[i];
|
|
3519
|
+
assertPath(arg);
|
|
3520
|
+
if (arg.length > 0) {
|
|
3521
|
+
if (joined === undefined)
|
|
3522
|
+
joined = arg;
|
|
3523
|
+
else
|
|
3524
|
+
joined += '/' + arg;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
if (joined === undefined)
|
|
3528
|
+
return '.';
|
|
3529
|
+
return posix.normalize(joined);
|
|
3530
|
+
},
|
|
3531
|
+
|
|
3532
|
+
relative: function relative(from, to) {
|
|
3533
|
+
assertPath(from);
|
|
3534
|
+
assertPath(to);
|
|
3535
|
+
|
|
3536
|
+
if (from === to) return '';
|
|
3537
|
+
|
|
3538
|
+
from = posix.resolve(from);
|
|
3539
|
+
to = posix.resolve(to);
|
|
3540
|
+
|
|
3541
|
+
if (from === to) return '';
|
|
3542
|
+
|
|
3543
|
+
// Trim any leading backslashes
|
|
3544
|
+
var fromStart = 1;
|
|
3545
|
+
for (; fromStart < from.length; ++fromStart) {
|
|
3546
|
+
if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
|
3547
|
+
break;
|
|
3548
|
+
}
|
|
3549
|
+
var fromEnd = from.length;
|
|
3550
|
+
var fromLen = fromEnd - fromStart;
|
|
3551
|
+
|
|
3552
|
+
// Trim any leading backslashes
|
|
3553
|
+
var toStart = 1;
|
|
3554
|
+
for (; toStart < to.length; ++toStart) {
|
|
3555
|
+
if (to.charCodeAt(toStart) !== 47 /*/*/)
|
|
3556
|
+
break;
|
|
3557
|
+
}
|
|
3558
|
+
var toEnd = to.length;
|
|
3559
|
+
var toLen = toEnd - toStart;
|
|
3560
|
+
|
|
3561
|
+
// Compare paths to find the longest common path from root
|
|
3562
|
+
var length = fromLen < toLen ? fromLen : toLen;
|
|
3563
|
+
var lastCommonSep = -1;
|
|
3564
|
+
var i = 0;
|
|
3565
|
+
for (; i <= length; ++i) {
|
|
3566
|
+
if (i === length) {
|
|
3567
|
+
if (toLen > length) {
|
|
3568
|
+
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
|
3569
|
+
// We get here if `from` is the exact base path for `to`.
|
|
3570
|
+
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
3571
|
+
return to.slice(toStart + i + 1);
|
|
3572
|
+
} else if (i === 0) {
|
|
3573
|
+
// We get here if `from` is the root
|
|
3574
|
+
// For example: from='/'; to='/foo'
|
|
3575
|
+
return to.slice(toStart + i);
|
|
3576
|
+
}
|
|
3577
|
+
} else if (fromLen > length) {
|
|
3578
|
+
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
|
3579
|
+
// We get here if `to` is the exact base path for `from`.
|
|
3580
|
+
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
3581
|
+
lastCommonSep = i;
|
|
3582
|
+
} else if (i === 0) {
|
|
3583
|
+
// We get here if `to` is the root.
|
|
3584
|
+
// For example: from='/foo'; to='/'
|
|
3585
|
+
lastCommonSep = 0;
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
break;
|
|
3589
|
+
}
|
|
3590
|
+
var fromCode = from.charCodeAt(fromStart + i);
|
|
3591
|
+
var toCode = to.charCodeAt(toStart + i);
|
|
3592
|
+
if (fromCode !== toCode)
|
|
3593
|
+
break;
|
|
3594
|
+
else if (fromCode === 47 /*/*/)
|
|
3595
|
+
lastCommonSep = i;
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
var out = '';
|
|
3599
|
+
// Generate the relative path based on the path difference between `to`
|
|
3600
|
+
// and `from`
|
|
3601
|
+
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
3602
|
+
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
|
3603
|
+
if (out.length === 0)
|
|
3604
|
+
out += '..';
|
|
3605
|
+
else
|
|
3606
|
+
out += '/..';
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3610
|
+
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
3611
|
+
// the common path parts
|
|
3612
|
+
if (out.length > 0)
|
|
3613
|
+
return out + to.slice(toStart + lastCommonSep);
|
|
3614
|
+
else {
|
|
3615
|
+
toStart += lastCommonSep;
|
|
3616
|
+
if (to.charCodeAt(toStart) === 47 /*/*/)
|
|
3617
|
+
++toStart;
|
|
3618
|
+
return to.slice(toStart);
|
|
3619
|
+
}
|
|
3620
|
+
},
|
|
3621
|
+
|
|
3622
|
+
_makeLong: function _makeLong(path) {
|
|
3623
|
+
return path;
|
|
3624
|
+
},
|
|
3625
|
+
|
|
3626
|
+
dirname: function dirname(path) {
|
|
3627
|
+
assertPath(path);
|
|
3628
|
+
if (path.length === 0) return '.';
|
|
3629
|
+
var code = path.charCodeAt(0);
|
|
3630
|
+
var hasRoot = code === 47 /*/*/;
|
|
3631
|
+
var end = -1;
|
|
3632
|
+
var matchedSlash = true;
|
|
3633
|
+
for (var i = path.length - 1; i >= 1; --i) {
|
|
3634
|
+
code = path.charCodeAt(i);
|
|
3635
|
+
if (code === 47 /*/*/) {
|
|
3636
|
+
if (!matchedSlash) {
|
|
3637
|
+
end = i;
|
|
3638
|
+
break;
|
|
3639
|
+
}
|
|
3640
|
+
} else {
|
|
3641
|
+
// We saw the first non-path separator
|
|
3642
|
+
matchedSlash = false;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3646
|
+
if (end === -1) return hasRoot ? '/' : '.';
|
|
3647
|
+
if (hasRoot && end === 1) return '//';
|
|
3648
|
+
return path.slice(0, end);
|
|
3649
|
+
},
|
|
3650
|
+
|
|
3651
|
+
basename: function basename(path, ext) {
|
|
3652
|
+
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
3653
|
+
assertPath(path);
|
|
3654
|
+
|
|
3655
|
+
var start = 0;
|
|
3656
|
+
var end = -1;
|
|
3657
|
+
var matchedSlash = true;
|
|
3658
|
+
var i;
|
|
3659
|
+
|
|
3660
|
+
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
3661
|
+
if (ext.length === path.length && ext === path) return '';
|
|
3662
|
+
var extIdx = ext.length - 1;
|
|
3663
|
+
var firstNonSlashEnd = -1;
|
|
3664
|
+
for (i = path.length - 1; i >= 0; --i) {
|
|
3665
|
+
var code = path.charCodeAt(i);
|
|
3666
|
+
if (code === 47 /*/*/) {
|
|
3667
|
+
// If we reached a path separator that was not part of a set of path
|
|
3668
|
+
// separators at the end of the string, stop now
|
|
3669
|
+
if (!matchedSlash) {
|
|
3670
|
+
start = i + 1;
|
|
3671
|
+
break;
|
|
3672
|
+
}
|
|
3673
|
+
} else {
|
|
3674
|
+
if (firstNonSlashEnd === -1) {
|
|
3675
|
+
// We saw the first non-path separator, remember this index in case
|
|
3676
|
+
// we need it if the extension ends up not matching
|
|
3677
|
+
matchedSlash = false;
|
|
3678
|
+
firstNonSlashEnd = i + 1;
|
|
3679
|
+
}
|
|
3680
|
+
if (extIdx >= 0) {
|
|
3681
|
+
// Try to match the explicit extension
|
|
3682
|
+
if (code === ext.charCodeAt(extIdx)) {
|
|
3683
|
+
if (--extIdx === -1) {
|
|
3684
|
+
// We matched the extension, so mark this as the end of our path
|
|
3685
|
+
// component
|
|
3686
|
+
end = i;
|
|
3687
|
+
}
|
|
3688
|
+
} else {
|
|
3689
|
+
// Extension does not match, so our result is the entire path
|
|
3690
|
+
// component
|
|
3691
|
+
extIdx = -1;
|
|
3692
|
+
end = firstNonSlashEnd;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
|
3699
|
+
return path.slice(start, end);
|
|
3700
|
+
} else {
|
|
3701
|
+
for (i = path.length - 1; i >= 0; --i) {
|
|
3702
|
+
if (path.charCodeAt(i) === 47 /*/*/) {
|
|
3703
|
+
// If we reached a path separator that was not part of a set of path
|
|
3704
|
+
// separators at the end of the string, stop now
|
|
3705
|
+
if (!matchedSlash) {
|
|
3706
|
+
start = i + 1;
|
|
3707
|
+
break;
|
|
3708
|
+
}
|
|
3709
|
+
} else if (end === -1) {
|
|
3710
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
3711
|
+
// path component
|
|
3712
|
+
matchedSlash = false;
|
|
3713
|
+
end = i + 1;
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3717
|
+
if (end === -1) return '';
|
|
3718
|
+
return path.slice(start, end);
|
|
3719
|
+
}
|
|
3720
|
+
},
|
|
3721
|
+
|
|
3722
|
+
extname: function extname(path) {
|
|
3723
|
+
assertPath(path);
|
|
3724
|
+
var startDot = -1;
|
|
3725
|
+
var startPart = 0;
|
|
3726
|
+
var end = -1;
|
|
3727
|
+
var matchedSlash = true;
|
|
3728
|
+
// Track the state of characters (if any) we see before our first dot and
|
|
3729
|
+
// after any path separator we find
|
|
3730
|
+
var preDotState = 0;
|
|
3731
|
+
for (var i = path.length - 1; i >= 0; --i) {
|
|
3732
|
+
var code = path.charCodeAt(i);
|
|
3733
|
+
if (code === 47 /*/*/) {
|
|
3734
|
+
// If we reached a path separator that was not part of a set of path
|
|
3735
|
+
// separators at the end of the string, stop now
|
|
3736
|
+
if (!matchedSlash) {
|
|
3737
|
+
startPart = i + 1;
|
|
3738
|
+
break;
|
|
3739
|
+
}
|
|
3740
|
+
continue;
|
|
3741
|
+
}
|
|
3742
|
+
if (end === -1) {
|
|
3743
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
3744
|
+
// extension
|
|
3745
|
+
matchedSlash = false;
|
|
3746
|
+
end = i + 1;
|
|
3747
|
+
}
|
|
3748
|
+
if (code === 46 /*.*/) {
|
|
3749
|
+
// If this is our first dot, mark it as the start of our extension
|
|
3750
|
+
if (startDot === -1)
|
|
3751
|
+
startDot = i;
|
|
3752
|
+
else if (preDotState !== 1)
|
|
3753
|
+
preDotState = 1;
|
|
3754
|
+
} else if (startDot !== -1) {
|
|
3755
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
|
3756
|
+
// have a good chance at having a non-empty extension
|
|
3757
|
+
preDotState = -1;
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3761
|
+
if (startDot === -1 || end === -1 ||
|
|
3762
|
+
// We saw a non-dot character immediately before the dot
|
|
3763
|
+
preDotState === 0 ||
|
|
3764
|
+
// The (right-most) trimmed path component is exactly '..'
|
|
3765
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
3766
|
+
return '';
|
|
3767
|
+
}
|
|
3768
|
+
return path.slice(startDot, end);
|
|
3769
|
+
},
|
|
3770
|
+
|
|
3771
|
+
format: function format(pathObject) {
|
|
3772
|
+
if (pathObject === null || typeof pathObject !== 'object') {
|
|
3773
|
+
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
3774
|
+
}
|
|
3775
|
+
return _format('/', pathObject);
|
|
3776
|
+
},
|
|
3777
|
+
|
|
3778
|
+
parse: function parse(path) {
|
|
3779
|
+
assertPath(path);
|
|
3780
|
+
|
|
3781
|
+
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
3782
|
+
if (path.length === 0) return ret;
|
|
3783
|
+
var code = path.charCodeAt(0);
|
|
3784
|
+
var isAbsolute = code === 47 /*/*/;
|
|
3785
|
+
var start;
|
|
3786
|
+
if (isAbsolute) {
|
|
3787
|
+
ret.root = '/';
|
|
3788
|
+
start = 1;
|
|
3789
|
+
} else {
|
|
3790
|
+
start = 0;
|
|
3791
|
+
}
|
|
3792
|
+
var startDot = -1;
|
|
3793
|
+
var startPart = 0;
|
|
3794
|
+
var end = -1;
|
|
3795
|
+
var matchedSlash = true;
|
|
3796
|
+
var i = path.length - 1;
|
|
3797
|
+
|
|
3798
|
+
// Track the state of characters (if any) we see before our first dot and
|
|
3799
|
+
// after any path separator we find
|
|
3800
|
+
var preDotState = 0;
|
|
3801
|
+
|
|
3802
|
+
// Get non-dir info
|
|
3803
|
+
for (; i >= start; --i) {
|
|
3804
|
+
code = path.charCodeAt(i);
|
|
3805
|
+
if (code === 47 /*/*/) {
|
|
3806
|
+
// If we reached a path separator that was not part of a set of path
|
|
3807
|
+
// separators at the end of the string, stop now
|
|
3808
|
+
if (!matchedSlash) {
|
|
3809
|
+
startPart = i + 1;
|
|
3810
|
+
break;
|
|
3811
|
+
}
|
|
3812
|
+
continue;
|
|
3813
|
+
}
|
|
3814
|
+
if (end === -1) {
|
|
3815
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
3816
|
+
// extension
|
|
3817
|
+
matchedSlash = false;
|
|
3818
|
+
end = i + 1;
|
|
3819
|
+
}
|
|
3820
|
+
if (code === 46 /*.*/) {
|
|
3821
|
+
// If this is our first dot, mark it as the start of our extension
|
|
3822
|
+
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
|
3823
|
+
} else if (startDot !== -1) {
|
|
3824
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
|
3825
|
+
// have a good chance at having a non-empty extension
|
|
3826
|
+
preDotState = -1;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
if (startDot === -1 || end === -1 ||
|
|
3831
|
+
// We saw a non-dot character immediately before the dot
|
|
3832
|
+
preDotState === 0 ||
|
|
3833
|
+
// The (right-most) trimmed path component is exactly '..'
|
|
3834
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
3835
|
+
if (end !== -1) {
|
|
3836
|
+
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
|
3837
|
+
}
|
|
3838
|
+
} else {
|
|
3839
|
+
if (startPart === 0 && isAbsolute) {
|
|
3840
|
+
ret.name = path.slice(1, startDot);
|
|
3841
|
+
ret.base = path.slice(1, end);
|
|
3842
|
+
} else {
|
|
3843
|
+
ret.name = path.slice(startPart, startDot);
|
|
3844
|
+
ret.base = path.slice(startPart, end);
|
|
3845
|
+
}
|
|
3846
|
+
ret.ext = path.slice(startDot, end);
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
|
3850
|
+
|
|
3851
|
+
return ret;
|
|
3852
|
+
},
|
|
3853
|
+
|
|
3854
|
+
sep: '/',
|
|
3855
|
+
delimiter: ':',
|
|
3856
|
+
win32: null,
|
|
3857
|
+
posix: null
|
|
3858
|
+
};
|
|
3859
|
+
|
|
3860
|
+
posix.posix = posix;
|
|
3861
|
+
|
|
3862
|
+
module.exports = posix;
|
|
3863
|
+
|
|
3864
|
+
|
|
3865
|
+
/***/ })
|
|
3866
|
+
|
|
3867
|
+
/******/ });
|
|
3868
|
+
/************************************************************************/
|
|
3869
|
+
/******/ // The module cache
|
|
3870
|
+
/******/ var __webpack_module_cache__ = {};
|
|
3871
|
+
/******/
|
|
3872
|
+
/******/ // The require function
|
|
3873
|
+
/******/ function __webpack_require__(moduleId) {
|
|
3874
|
+
/******/ // Check if module is in cache
|
|
3875
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
3876
|
+
/******/ if (cachedModule !== undefined) {
|
|
3877
|
+
/******/ return cachedModule.exports;
|
|
3878
|
+
/******/ }
|
|
3879
|
+
/******/ // Create a new module (and put it into the cache)
|
|
3880
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
3881
|
+
/******/ // no module.id needed
|
|
3882
|
+
/******/ // no module.loaded needed
|
|
3883
|
+
/******/ exports: {}
|
|
3884
|
+
/******/ };
|
|
3885
|
+
/******/
|
|
3886
|
+
/******/ // Execute the module function
|
|
3887
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
3888
|
+
/******/
|
|
3889
|
+
/******/ // Return the exports of the module
|
|
3890
|
+
/******/ return module.exports;
|
|
3891
|
+
/******/ }
|
|
3892
|
+
/******/
|
|
3893
|
+
/************************************************************************/
|
|
3894
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
3895
|
+
/******/ (() => {
|
|
3896
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
3897
|
+
/******/ __webpack_require__.n = (module) => {
|
|
3898
|
+
/******/ var getter = module && module.__esModule ?
|
|
3899
|
+
/******/ () => (module['default']) :
|
|
3900
|
+
/******/ () => (module);
|
|
3901
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
3902
|
+
/******/ return getter;
|
|
3903
|
+
/******/ };
|
|
3904
|
+
/******/ })();
|
|
3905
|
+
/******/
|
|
3906
|
+
/******/ /* webpack/runtime/define property getters */
|
|
3907
|
+
/******/ (() => {
|
|
3908
|
+
/******/ // define getter functions for harmony exports
|
|
3909
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
3910
|
+
/******/ for(var key in definition) {
|
|
3911
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
3912
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3913
|
+
/******/ }
|
|
3914
|
+
/******/ }
|
|
3915
|
+
/******/ };
|
|
3916
|
+
/******/ })();
|
|
3917
|
+
/******/
|
|
3918
|
+
/******/ /* webpack/runtime/global */
|
|
3919
|
+
/******/ (() => {
|
|
3920
|
+
/******/ __webpack_require__.g = (function() {
|
|
3921
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
3922
|
+
/******/ try {
|
|
3923
|
+
/******/ return this || new Function('return this')();
|
|
3924
|
+
/******/ } catch (e) {
|
|
3925
|
+
/******/ if (typeof window === 'object') return window;
|
|
3926
|
+
/******/ }
|
|
3927
|
+
/******/ })();
|
|
3928
|
+
/******/ })();
|
|
3929
|
+
/******/
|
|
3930
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3931
|
+
/******/ (() => {
|
|
3932
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
3933
|
+
/******/ })();
|
|
3934
|
+
/******/
|
|
3935
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
3936
|
+
/******/ (() => {
|
|
3937
|
+
/******/ // define __esModule on exports
|
|
3938
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
3939
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
3940
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3941
|
+
/******/ }
|
|
3942
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3943
|
+
/******/ };
|
|
3944
|
+
/******/ })();
|
|
3945
|
+
/******/
|
|
3946
|
+
/************************************************************************/
|
|
3947
|
+
var __webpack_exports__ = {};
|
|
3948
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
3949
|
+
(() => {
|
|
3950
|
+
/*!*********************!*\
|
|
3951
|
+
!*** ./src/hook.ts ***!
|
|
3952
|
+
\*********************/
|
|
3953
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3954
|
+
/* harmony import */ var _back_hook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @back/hook */ "../app-backend-core/lib/hook.js");
|
|
3955
|
+
/* harmony import */ var _vue_devtools_shared_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @vue-devtools/shared-utils */ "../shared-utils/lib/index.js");
|
|
3956
|
+
/* harmony import */ var _vue_devtools_shared_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_vue_devtools_shared_utils__WEBPACK_IMPORTED_MODULE_1__);
|
|
3957
|
+
|
|
3958
|
+
|
|
3959
|
+
|
|
3960
|
+
(0,_back_hook__WEBPACK_IMPORTED_MODULE_0__.installHook)(_vue_devtools_shared_utils__WEBPACK_IMPORTED_MODULE_1__.target);
|
|
3961
|
+
|
|
3962
|
+
})();
|
|
3963
|
+
|